@babylonjs/core 7.25.2 → 7.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/Engines/Extensions/engine.prefilteredCubeTexture.d.ts +0 -1
  2. package/Engines/Extensions/engine.prefilteredCubeTexture.js +0 -1
  3. package/Engines/Extensions/engine.prefilteredCubeTexture.js.map +1 -1
  4. package/Engines/WebGPU/Extensions/engine.alpha.js +3 -3
  5. package/Engines/WebGPU/Extensions/engine.alpha.js.map +1 -1
  6. package/Engines/WebGPU/Extensions/engine.cubeTexture.js +5 -5
  7. package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
  8. package/Engines/WebGPU/Extensions/engine.rawTexture.js +10 -10
  9. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  10. package/Engines/WebGPU/Extensions/engine.readTexture.js +3 -3
  11. package/Engines/WebGPU/Extensions/engine.readTexture.js.map +1 -1
  12. package/Engines/WebGPU/Extensions/engine.renderTarget.js +6 -6
  13. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  14. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js +2 -2
  15. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
  16. package/Engines/WebGPU/Extensions/engine.renderTargetTexture.js +2 -2
  17. package/Engines/WebGPU/Extensions/engine.renderTargetTexture.js.map +1 -1
  18. package/Engines/WebGPU/webgpuRenderTargetWrapper.d.ts +2 -2
  19. package/Engines/WebGPU/webgpuRenderTargetWrapper.js.map +1 -1
  20. package/Engines/abstractEngine.d.ts +2 -0
  21. package/Engines/abstractEngine.js +2 -2
  22. package/Engines/abstractEngine.js.map +1 -1
  23. package/Engines/engine.d.ts +5 -5
  24. package/Engines/engine.js +5 -0
  25. package/Engines/engine.js.map +1 -1
  26. package/Engines/thinWebGPUEngine.d.ts +66 -0
  27. package/Engines/thinWebGPUEngine.js +120 -0
  28. package/Engines/thinWebGPUEngine.js.map +1 -0
  29. package/Engines/webgpuEngine.d.ts +9 -58
  30. package/Engines/webgpuEngine.js +9 -108
  31. package/Engines/webgpuEngine.js.map +1 -1
  32. package/Materials/Node/Blocks/colorConverterBlock.d.ts +36 -0
  33. package/Materials/Node/Blocks/colorConverterBlock.js +192 -0
  34. package/Materials/Node/Blocks/colorConverterBlock.js.map +1 -0
  35. package/Materials/Node/Blocks/index.d.ts +1 -0
  36. package/Materials/Node/Blocks/index.js +1 -0
  37. package/Materials/Node/Blocks/index.js.map +1 -1
  38. package/Materials/Node/nodeMaterialBuildState.d.ts +1 -1
  39. package/Materials/Textures/Filtering/hdrFiltering.d.ts +0 -1
  40. package/Materials/Textures/Filtering/hdrFiltering.js +0 -1
  41. package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
  42. package/Materials/Textures/Loaders/basisTextureLoader.d.ts +0 -1
  43. package/Materials/Textures/Loaders/basisTextureLoader.js +0 -1
  44. package/Materials/Textures/Loaders/basisTextureLoader.js.map +1 -1
  45. package/Materials/Textures/Loaders/ddsTextureLoader.d.ts +0 -1
  46. package/Materials/Textures/Loaders/ddsTextureLoader.js +0 -1
  47. package/Materials/Textures/Loaders/ddsTextureLoader.js.map +1 -1
  48. package/Materials/Textures/Loaders/ktxTextureLoader.d.ts +0 -1
  49. package/Materials/Textures/Loaders/ktxTextureLoader.js +0 -1
  50. package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
  51. package/Materials/Textures/Procedurals/proceduralTexture.d.ts +0 -2
  52. package/Materials/Textures/Procedurals/proceduralTexture.js +0 -2
  53. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  54. package/Materials/Textures/baseTexture.d.ts +0 -1
  55. package/Materials/Textures/baseTexture.js +0 -1
  56. package/Materials/Textures/baseTexture.js.map +1 -1
  57. package/Materials/Textures/colorGradingTexture.d.ts +0 -1
  58. package/Materials/Textures/colorGradingTexture.js +0 -2
  59. package/Materials/Textures/colorGradingTexture.js.map +1 -1
  60. package/Materials/Textures/cubeTexture.d.ts +0 -1
  61. package/Materials/Textures/cubeTexture.js +0 -1
  62. package/Materials/Textures/cubeTexture.js.map +1 -1
  63. package/Materials/Textures/equiRectangularCubeTexture.d.ts +0 -1
  64. package/Materials/Textures/equiRectangularCubeTexture.js +0 -1
  65. package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
  66. package/Materials/Textures/hdrCubeTexture.d.ts +0 -1
  67. package/Materials/Textures/hdrCubeTexture.js +0 -1
  68. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  69. package/Materials/Textures/rawCubeTexture.d.ts +0 -1
  70. package/Materials/Textures/rawCubeTexture.js +0 -1
  71. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  72. package/Materials/Textures/rawTexture.d.ts +0 -1
  73. package/Materials/Textures/rawTexture.js +0 -1
  74. package/Materials/Textures/rawTexture.js.map +1 -1
  75. package/Materials/Textures/rawTexture2DArray.d.ts +0 -1
  76. package/Materials/Textures/rawTexture2DArray.js +0 -1
  77. package/Materials/Textures/rawTexture2DArray.js.map +1 -1
  78. package/Materials/Textures/rawTexture3D.d.ts +0 -1
  79. package/Materials/Textures/rawTexture3D.js +0 -1
  80. package/Materials/Textures/rawTexture3D.js.map +1 -1
  81. package/Materials/Textures/renderTargetTexture.d.ts +0 -3
  82. package/Materials/Textures/renderTargetTexture.js +0 -3
  83. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  84. package/Materials/material.detailMapConfiguration.d.ts +2 -2
  85. package/Materials/material.detailMapConfiguration.js.map +1 -1
  86. package/Misc/basis.d.ts +3 -3
  87. package/Misc/basis.js.map +1 -1
  88. package/Misc/dds.d.ts +0 -1
  89. package/Misc/dds.js +0 -1
  90. package/Misc/dds.js.map +1 -1
  91. package/Misc/environmentTextureTools.d.ts +0 -2
  92. package/Misc/environmentTextureTools.js +0 -2
  93. package/Misc/environmentTextureTools.js.map +1 -1
  94. package/Misc/minMaxReducer.d.ts +0 -1
  95. package/Misc/minMaxReducer.js +0 -1
  96. package/Misc/minMaxReducer.js.map +1 -1
  97. package/Misc/rgbdTextureTools.d.ts +0 -2
  98. package/Misc/rgbdTextureTools.js +5 -10
  99. package/Misc/rgbdTextureTools.js.map +1 -1
  100. package/Misc/screenshotTools.d.ts +0 -1
  101. package/Misc/screenshotTools.js +0 -1
  102. package/Misc/screenshotTools.js.map +1 -1
  103. package/Particles/particleSystem.js.map +1 -1
  104. package/Particles/thinParticleSystem.js.map +1 -1
  105. package/PostProcesses/anaglyphPostProcess.d.ts +2 -2
  106. package/PostProcesses/anaglyphPostProcess.js.map +1 -1
  107. package/PostProcesses/highlightsPostProcess.d.ts +2 -2
  108. package/PostProcesses/highlightsPostProcess.js.map +1 -1
  109. package/PostProcesses/postProcess.d.ts +0 -1
  110. package/PostProcesses/postProcess.js +0 -1
  111. package/PostProcesses/postProcess.js.map +1 -1
  112. package/PostProcesses/stereoscopicInterlacePostProcess.d.ts +3 -3
  113. package/PostProcesses/stereoscopicInterlacePostProcess.js.map +1 -1
  114. package/PostProcesses/tonemapPostProcess.d.ts +2 -2
  115. package/PostProcesses/tonemapPostProcess.js.map +1 -1
  116. package/package.json +1 -1
@@ -1,7 +1,6 @@
1
1
  import { InternalTexture } from "../../Materials/Textures/internalTexture";
2
2
  import type { Nullable } from "../../types";
3
3
  import type { Scene } from "../../scene";
4
- import "../../Engines/Extensions/engine.cubeTexture";
5
4
  declare module "../../Engines/abstractEngine" {
6
5
  interface AbstractEngine {
7
6
  /**
@@ -5,7 +5,6 @@ import { Logger } from "../../Misc/logger.js";
5
5
  import { SphericalPolynomial } from "../../Maths/sphericalPolynomial.js";
6
6
  import { BaseTexture } from "../../Materials/Textures/baseTexture.js";
7
7
  import { DDSTools } from "../../Misc/dds.js";
8
- import "../../Engines/Extensions/engine.cubeTexture.js";
9
8
  ThinEngine.prototype.createPrefilteredCubeTexture = function (rootUrl, scene, lodScale, lodOffset, onLoad = null, onError = null, format, forcedExtension = null, createPolynomials = true) {
10
9
  const callback = (loadData) => {
11
10
  if (!loadData) {
@@ -1 +1 @@
1
- {"version":3,"file":"engine.prefilteredCubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Extensions/engine.prefilteredCubeTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAyB,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,2CAAuC;AACrE,OAAO,EAAE,WAAW,EAAE,gDAA4C;AAElE,OAAO,EAAE,QAAQ,EAAE,0BAAsB;AAEzC,OAAO,6CAA6C,CAAC;AA+BrD,UAAU,CAAC,SAAS,CAAC,4BAA4B,GAAG,UAChD,OAAe,EACf,KAAsB,EACtB,QAAgB,EAChB,SAAiB,EACjB,SAAyE,IAAI,EAC7E,UAAiE,IAAI,EACrE,MAAe,EACf,kBAAuB,IAAI,EAC3B,oBAA6B,IAAI;IAEjC,MAAM,QAAQ,GAAG,CAAC,QAAa,EAAE,EAAE;QAC/B,IAAI,CAAC,QAAQ,EAAE;YACX,IAAI,MAAM,EAAE;gBACR,MAAM,CAAC,IAAI,CAAC,CAAC;aAChB;YACD,OAAO;SACV;QAED,MAAM,OAAO,GAAG,QAAQ,CAAC,OAA0B,CAAC;QACpD,IAAI,CAAC,iBAAiB,EAAE;YACpB,OAAO,CAAC,oBAAoB,GAAG,IAAI,mBAAmB,EAAE,CAAC;SAC5D;aAAM,IAAI,QAAQ,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC1C,OAAO,CAAC,oBAAoB,GAAG,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC;SACpE;QACD,OAAO,CAAC,OAAO,gDAAwC,CAAC;QAExD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;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,IAAI,CAAC,wDAAwD,CAAC,CAAC;aACzE;YAED,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;YAErD,2CAA2C;YAC3C,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;YAC1C,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;YAC1B,UAAU,CAAC,QAAQ,GAAG,gBAAgB,CAAC;YAEvC,gBAAgB,CAAC,OAAO,GAAG,IAAI,CAAC;YAChC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC7B;QAED,OAAO,CAAC,eAAe,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACtC,OAAO,CAAC,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACrC,OAAO,CAAC,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAErC,IAAI,MAAM,EAAE;YACR,MAAM,CAAC,OAAO,CAAC,CAAC;SACnB;IACL,CAAC,CAAC;IAEF,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,iBAAiB,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AACnJ,CAAC,CAAC","sourcesContent":["import { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Constants } from \"../constants\";\r\nimport { SphericalPolynomial } from \"core/Maths/sphericalPolynomial\";\r\nimport { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { DDSInfo } from \"core/Misc/dds\";\r\nimport { DDSTools } from \"core/Misc/dds\";\r\n\r\nimport \"../../Engines/Extensions/engine.cubeTexture\";\r\n\r\ndeclare module \"../../Engines/abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * Create a cube texture from prefiltered data (ie. the mipmaps contain ready to use data for PBR reflection)\r\n * @param rootUrl defines the url where the file to load is located\r\n * @param scene defines the current scene\r\n * @param lodScale defines scale to apply to the mip map selection\r\n * @param lodOffset defines offset to apply to the mip map selection\r\n * @param onLoad defines an optional callback raised when the texture is loaded\r\n * @param onError defines an optional callback raised if there is an issue to load the texture\r\n * @param format defines the format of the data\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param createPolynomials defines wheter or not to create polynomails harmonics for the texture\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createPrefilteredCubeTexture(\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n lodScale: number,\r\n lodOffset: number,\r\n onLoad?: Nullable<(internalTexture: Nullable<InternalTexture>) => void>,\r\n onError?: Nullable<(message?: string, exception?: any) => void>,\r\n format?: number,\r\n forcedExtension?: any,\r\n createPolynomials?: boolean\r\n ): InternalTexture;\r\n }\r\n}\r\n\r\nThinEngine.prototype.createPrefilteredCubeTexture = function (\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n lodScale: number,\r\n lodOffset: number,\r\n onLoad: Nullable<(internalTexture: Nullable<InternalTexture>) => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n format?: number,\r\n forcedExtension: any = null,\r\n createPolynomials: boolean = true\r\n): InternalTexture {\r\n const callback = (loadData: any) => {\r\n if (!loadData) {\r\n if (onLoad) {\r\n onLoad(null);\r\n }\r\n return;\r\n }\r\n\r\n const texture = loadData.texture as InternalTexture;\r\n if (!createPolynomials) {\r\n texture._sphericalPolynomial = new SphericalPolynomial();\r\n } else if (loadData.info.sphericalPolynomial) {\r\n texture._sphericalPolynomial = loadData.info.sphericalPolynomial;\r\n }\r\n texture._source = InternalTextureSource.CubePrefiltered;\r\n\r\n if (this.getCaps().textureLOD) {\r\n // Do not add extra process if texture lod is supported.\r\n if (onLoad) {\r\n onLoad(texture);\r\n }\r\n return;\r\n }\r\n\r\n const mipSlices = 3;\r\n\r\n const gl = this._gl;\r\n const width = loadData.width;\r\n if (!width) {\r\n return;\r\n }\r\n\r\n const textures: BaseTexture[] = [];\r\n for (let i = 0; i < mipSlices; i++) {\r\n //compute LOD from even spacing in smoothness (matching shader calculation)\r\n const smoothness = i / (mipSlices - 1);\r\n const roughness = 1 - smoothness;\r\n\r\n const minLODIndex = lodOffset; // roughness = 0\r\n const maxLODIndex = Math.log2(width) * lodScale + lodOffset; // roughness = 1\r\n\r\n const lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;\r\n const mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));\r\n\r\n const glTextureFromLod = new InternalTexture(this, InternalTextureSource.Temp);\r\n glTextureFromLod.type = texture.type;\r\n glTextureFromLod.format = texture.format;\r\n glTextureFromLod.width = Math.pow(2, Math.max(Math.log2(width) - mipmapIndex, 0));\r\n glTextureFromLod.height = glTextureFromLod.width;\r\n glTextureFromLod.isCube = true;\r\n glTextureFromLod._cachedWrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n glTextureFromLod._cachedWrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, glTextureFromLod, true);\r\n\r\n glTextureFromLod.samplingMode = Constants.TEXTURE_LINEAR_LINEAR;\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n\r\n if (loadData.isDDS) {\r\n const info: DDSInfo = loadData.info;\r\n const data: any = loadData.data;\r\n this._unpackFlipY(info.isCompressed);\r\n\r\n DDSTools.UploadDDSLevels(this, glTextureFromLod, data, info, true, 6, mipmapIndex);\r\n } else {\r\n Logger.Warn(\"DDS is the only prefiltered cube map supported so far.\");\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n\r\n // Wrap in a base texture for easy binding.\r\n const lodTexture = new BaseTexture(scene);\r\n lodTexture._isCube = true;\r\n lodTexture._texture = glTextureFromLod;\r\n\r\n glTextureFromLod.isReady = true;\r\n textures.push(lodTexture);\r\n }\r\n\r\n texture._lodTextureHigh = textures[2];\r\n texture._lodTextureMid = textures[1];\r\n texture._lodTextureLow = textures[0];\r\n\r\n if (onLoad) {\r\n onLoad(texture);\r\n }\r\n };\r\n\r\n return this.createCubeTexture(rootUrl, scene, null, false, callback, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset);\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.prefilteredCubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Extensions/engine.prefilteredCubeTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAyB,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,2CAAuC;AACrE,OAAO,EAAE,WAAW,EAAE,gDAA4C;AAElE,OAAO,EAAE,QAAQ,EAAE,0BAAsB;AA+BzC,UAAU,CAAC,SAAS,CAAC,4BAA4B,GAAG,UAChD,OAAe,EACf,KAAsB,EACtB,QAAgB,EAChB,SAAiB,EACjB,SAAyE,IAAI,EAC7E,UAAiE,IAAI,EACrE,MAAe,EACf,kBAAuB,IAAI,EAC3B,oBAA6B,IAAI;IAEjC,M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AAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,iBAAiB,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AACnJ,CAAC,CAAC","sourcesContent":["import { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Constants } from \"../constants\";\r\nimport { SphericalPolynomial } from \"core/Maths/sphericalPolynomial\";\r\nimport { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { DDSInfo } from \"core/Misc/dds\";\r\nimport { DDSTools } from \"core/Misc/dds\";\r\n\r\ndeclare module \"../../Engines/abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * Create a cube texture from prefiltered data (ie. the mipmaps contain ready to use data for PBR reflection)\r\n * @param rootUrl defines the url where the file to load is located\r\n * @param scene defines the current scene\r\n * @param lodScale defines scale to apply to the mip map selection\r\n * @param lodOffset defines offset to apply to the mip map selection\r\n * @param onLoad defines an optional callback raised when the texture is loaded\r\n * @param onError defines an optional callback raised if there is an issue to load the texture\r\n * @param format defines the format of the data\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param createPolynomials defines wheter or not to create polynomails harmonics for the texture\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createPrefilteredCubeTexture(\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n lodScale: number,\r\n lodOffset: number,\r\n onLoad?: Nullable<(internalTexture: Nullable<InternalTexture>) => void>,\r\n onError?: Nullable<(message?: string, exception?: any) => void>,\r\n format?: number,\r\n forcedExtension?: any,\r\n createPolynomials?: boolean\r\n ): InternalTexture;\r\n }\r\n}\r\n\r\nThinEngine.prototype.createPrefilteredCubeTexture = function (\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n lodScale: number,\r\n lodOffset: number,\r\n onLoad: Nullable<(internalTexture: Nullable<InternalTexture>) => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n format?: number,\r\n forcedExtension: any = null,\r\n createPolynomials: boolean = true\r\n): InternalTexture {\r\n const callback = (loadData: any) => {\r\n if (!loadData) {\r\n if (onLoad) {\r\n onLoad(null);\r\n }\r\n return;\r\n }\r\n\r\n const texture = loadData.texture as InternalTexture;\r\n if (!createPolynomials) {\r\n texture._sphericalPolynomial = new SphericalPolynomial();\r\n } else if (loadData.info.sphericalPolynomial) {\r\n texture._sphericalPolynomial = loadData.info.sphericalPolynomial;\r\n }\r\n texture._source = InternalTextureSource.CubePrefiltered;\r\n\r\n if (this.getCaps().textureLOD) {\r\n // Do not add extra process if texture lod is supported.\r\n if (onLoad) {\r\n onLoad(texture);\r\n }\r\n return;\r\n }\r\n\r\n const mipSlices = 3;\r\n\r\n const gl = this._gl;\r\n const width = loadData.width;\r\n if (!width) {\r\n return;\r\n }\r\n\r\n const textures: BaseTexture[] = [];\r\n for (let i = 0; i < mipSlices; i++) {\r\n //compute LOD from even spacing in smoothness (matching shader calculation)\r\n const smoothness = i / (mipSlices - 1);\r\n const roughness = 1 - smoothness;\r\n\r\n const minLODIndex = lodOffset; // roughness = 0\r\n const maxLODIndex = Math.log2(width) * lodScale + lodOffset; // roughness = 1\r\n\r\n const lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;\r\n const mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));\r\n\r\n const glTextureFromLod = new InternalTexture(this, InternalTextureSource.Temp);\r\n glTextureFromLod.type = texture.type;\r\n glTextureFromLod.format = texture.format;\r\n glTextureFromLod.width = Math.pow(2, Math.max(Math.log2(width) - mipmapIndex, 0));\r\n glTextureFromLod.height = glTextureFromLod.width;\r\n glTextureFromLod.isCube = true;\r\n glTextureFromLod._cachedWrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n glTextureFromLod._cachedWrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, glTextureFromLod, true);\r\n\r\n glTextureFromLod.samplingMode = Constants.TEXTURE_LINEAR_LINEAR;\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n\r\n if (loadData.isDDS) {\r\n const info: DDSInfo = loadData.info;\r\n const data: any = loadData.data;\r\n this._unpackFlipY(info.isCompressed);\r\n\r\n DDSTools.UploadDDSLevels(this, glTextureFromLod, data, info, true, 6, mipmapIndex);\r\n } else {\r\n Logger.Warn(\"DDS is the only prefiltered cube map supported so far.\");\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n\r\n // Wrap in a base texture for easy binding.\r\n const lodTexture = new BaseTexture(scene);\r\n lodTexture._isCube = true;\r\n lodTexture._texture = glTextureFromLod;\r\n\r\n glTextureFromLod.isReady = true;\r\n textures.push(lodTexture);\r\n }\r\n\r\n texture._lodTextureHigh = textures[2];\r\n texture._lodTextureMid = textures[1];\r\n texture._lodTextureLow = textures[0];\r\n\r\n if (onLoad) {\r\n onLoad(texture);\r\n }\r\n };\r\n\r\n return this.createCubeTexture(rootUrl, scene, null, false, callback, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset);\r\n};\r\n"]}
@@ -1,8 +1,8 @@
1
1
  import { AbstractEngine } from "../../abstractEngine.js";
2
2
 
3
- import { WebGPUEngine } from "../../webgpuEngine.js";
4
3
  import "../../AbstractEngine/abstractEngine.alpha.js";
5
- WebGPUEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange = false) {
4
+ import { ThinWebGPUEngine } from "../../thinWebGPUEngine.js";
5
+ ThinWebGPUEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange = false) {
6
6
  if (this._alphaMode === mode && ((mode === 0 && !this._alphaState.alphaBlend) || (mode !== 0 && this._alphaState.alphaBlend))) {
7
7
  if (!noDepthWriteChange) {
8
8
  // Make sure we still have the correct depth mask according to the alpha mode (a transparent material could have forced writting to the depth buffer, for instance)
@@ -96,7 +96,7 @@ WebGPUEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange = false
96
96
  this._cacheRenderPipeline.setAlphaBlendEnabled(this._alphaState.alphaBlend);
97
97
  this._cacheRenderPipeline.setAlphaBlendFactors(this._alphaState._blendFunctionParameters, this._alphaState._blendEquationParameters);
98
98
  };
99
- WebGPUEngine.prototype.setAlphaEquation = function (equation) {
99
+ ThinWebGPUEngine.prototype.setAlphaEquation = function (equation) {
100
100
  AbstractEngine.prototype.setAlphaEquation.call(this, equation);
101
101
  this._cacheRenderPipeline.setAlphaBlendFactors(this._alphaState._blendFunctionParameters, this._alphaState._blendEquationParameters);
102
102
  };
@@ -1 +1 @@
1
- {"version":3,"file":"engine.alpha.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.alpha.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gCAAoC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,2CAA2C,CAAC;AAcnD,YAAY,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,IAAY,EAAE,qBAA8B,KAAK;IAC7F,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC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AC,oBAAoB,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,wBAAwB,EAAE,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;AACzI,CAAC,CAAC","sourcesContent":["import { AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport { Constants } from \"../../constants\";\r\nimport { WebGPUEngine } from \"../../webgpuEngine\";\r\n\r\nimport \"../../AbstractEngine/abstractEngine.alpha\";\r\n\r\ndeclare module \"../../abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * Sets the current alpha mode\r\n * @param mode defines the mode to use (one of the Engine.ALPHA_XXX)\r\n * @param noDepthWriteChange defines if depth writing state should remains unchanged (false by default)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering\r\n */\r\n setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;\r\n }\r\n}\r\n\r\nWebGPUEngine.prototype.setAlphaMode = function (mode: number, noDepthWriteChange: boolean = false): void {\r\n if (this._alphaMode === mode && ((mode === Constants.ALPHA_DISABLE && !this._alphaState.alphaBlend) || (mode !== Constants.ALPHA_DISABLE && this._alphaState.alphaBlend))) {\r\n if (!noDepthWriteChange) {\r\n // Make sure we still have the correct depth mask according to the alpha mode (a transparent material could have forced writting to the depth buffer, for instance)\r\n const depthMask = mode === Constants.ALPHA_DISABLE;\r\n if (this.depthCullingState.depthMask !== depthMask) {\r\n this.setDepthWrite(depthMask);\r\n this._cacheRenderPipeline.setDepthWriteEnabled(depthMask);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n switch (mode) {\r\n case Constants.ALPHA_DISABLE:\r\n this._alphaState.alphaBlend = false;\r\n break;\r\n case Constants.ALPHA_PREMULTIPLIED:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_PREMULTIPLIED_PORTERDUFF:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_COMBINE:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_SRC_ALPHA, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, 1, 0, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ADD:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_SRC_ALPHA, 1, 0, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SUBTRACT:\r\n this._alphaState.setAlphaBlendFunctionParameters(0, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_MULTIPLY:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_DST_COLOR, 0, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_MAXIMIZED:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_SRC_ALPHA, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_INTERPOLATE:\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n Constants.GL_ALPHA_FUNCTION_CONSTANT_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_CONSTANT_ALPHA,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SCREENMODE:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, 1, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ALPHATOCOLOR:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_DST_ALPHA, 1, 0, 0);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_REVERSEONEMINUS:\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_ALPHA,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SRC_DSTONEMINUSSRCALPHA:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE_ONEZERO:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, 1, 1, 0);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_EXCLUSION:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 0, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_LAYER_ACCUMULATE:\r\n // Same as ALPHA_COMBINE but accumulates (1 - alpha) values in the alpha channel for a later readout in order independant transparency\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n Constants.GL_ALPHA_FUNCTION_SRC_ALPHA,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA,\r\n 1,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n }\r\n if (!noDepthWriteChange) {\r\n this.setDepthWrite(mode === Constants.ALPHA_DISABLE);\r\n this._cacheRenderPipeline.setDepthWriteEnabled(mode === Constants.ALPHA_DISABLE);\r\n }\r\n this._alphaMode = mode;\r\n this._cacheRenderPipeline.setAlphaBlendEnabled(this._alphaState.alphaBlend);\r\n this._cacheRenderPipeline.setAlphaBlendFactors(this._alphaState._blendFunctionParameters, this._alphaState._blendEquationParameters);\r\n};\r\n\r\nWebGPUEngine.prototype.setAlphaEquation = function (equation: number): void {\r\n AbstractEngine.prototype.setAlphaEquation.call(this, equation);\r\n\r\n this._cacheRenderPipeline.setAlphaBlendFactors(this._alphaState._blendFunctionParameters, this._alphaState._blendEquationParameters);\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.alpha.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.alpha.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gCAAoC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,kCAAsC;AAcjE,gBAAgB,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,IAAY,EAAE,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C;AAEF,gBAAgB,CAAC,SAAS,CAAC,gBAAgB,GAAG,UAAU,QAAgB;IACpE,cAAc,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAE/D,IAAI,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,wBAAwB,EAAE,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;AACzI,CAAC,CAAC","sourcesContent":["import { AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport { Constants } from \"../../constants\";\r\n\r\nimport \"../../AbstractEngine/abstractEngine.alpha\";\r\nimport { ThinWebGPUEngine } from \"core/Engines/thinWebGPUEngine\";\r\n\r\ndeclare module \"../../abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * Sets the current alpha mode\r\n * @param mode defines the mode to use (one of the Engine.ALPHA_XXX)\r\n * @param noDepthWriteChange defines if depth writing state should remains unchanged (false by default)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering\r\n */\r\n setAlphaMode(mode: number, noDepthWriteChange?: boolean): void;\r\n }\r\n}\r\n\r\nThinWebGPUEngine.prototype.setAlphaMode = function (mode: number, noDepthWriteChange: boolean = false): void {\r\n if (this._alphaMode === mode && ((mode === Constants.ALPHA_DISABLE && !this._alphaState.alphaBlend) || (mode !== Constants.ALPHA_DISABLE && this._alphaState.alphaBlend))) {\r\n if (!noDepthWriteChange) {\r\n // Make sure we still have the correct depth mask according to the alpha mode (a transparent material could have forced writting to the depth buffer, for instance)\r\n const depthMask = mode === Constants.ALPHA_DISABLE;\r\n if (this.depthCullingState.depthMask !== depthMask) {\r\n this.setDepthWrite(depthMask);\r\n this._cacheRenderPipeline.setDepthWriteEnabled(depthMask);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n switch (mode) {\r\n case Constants.ALPHA_DISABLE:\r\n this._alphaState.alphaBlend = false;\r\n break;\r\n case Constants.ALPHA_PREMULTIPLIED:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_PREMULTIPLIED_PORTERDUFF:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_COMBINE:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_SRC_ALPHA, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, 1, 0, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ADD:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_SRC_ALPHA, 1, 0, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SUBTRACT:\r\n this._alphaState.setAlphaBlendFunctionParameters(0, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_MULTIPLY:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_DST_COLOR, 0, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_MAXIMIZED:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_SRC_ALPHA, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_INTERPOLATE:\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n Constants.GL_ALPHA_FUNCTION_CONSTANT_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_CONSTANT_ALPHA,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SCREENMODE:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE_ONEONE:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, 1, 1, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ALPHATOCOLOR:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_DST_ALPHA, 1, 0, 0);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_REVERSEONEMINUS:\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_ALPHA,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_SRC_DSTONEMINUSSRCALPHA:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA, 1, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_ONEONE_ONEZERO:\r\n this._alphaState.setAlphaBlendFunctionParameters(1, 1, 1, 0);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_EXCLUSION:\r\n this._alphaState.setAlphaBlendFunctionParameters(Constants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR, Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR, 0, 1);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case Constants.ALPHA_LAYER_ACCUMULATE:\r\n // Same as ALPHA_COMBINE but accumulates (1 - alpha) values in the alpha channel for a later readout in order independant transparency\r\n this._alphaState.setAlphaBlendFunctionParameters(\r\n Constants.GL_ALPHA_FUNCTION_SRC_ALPHA,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA,\r\n 1,\r\n Constants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA\r\n );\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n }\r\n if (!noDepthWriteChange) {\r\n this.setDepthWrite(mode === Constants.ALPHA_DISABLE);\r\n this._cacheRenderPipeline.setDepthWriteEnabled(mode === Constants.ALPHA_DISABLE);\r\n }\r\n this._alphaMode = mode;\r\n this._cacheRenderPipeline.setAlphaBlendEnabled(this._alphaState.alphaBlend);\r\n this._cacheRenderPipeline.setAlphaBlendFactors(this._alphaState._blendFunctionParameters, this._alphaState._blendEquationParameters);\r\n};\r\n\r\nThinWebGPUEngine.prototype.setAlphaEquation = function (equation: number): void {\r\n AbstractEngine.prototype.setAlphaEquation.call(this, equation);\r\n\r\n this._cacheRenderPipeline.setAlphaBlendFactors(this._alphaState._blendFunctionParameters, this._alphaState._blendEquationParameters);\r\n};\r\n"]}
@@ -1,8 +1,8 @@
1
1
  import { InternalTexture } from "../../../Materials/Textures/internalTexture.js";
2
2
 
3
- import { WebGPUEngine } from "../../webgpuEngine.js";
4
3
  import { WebGPUTextureHelper } from "../webgpuTextureHelper.js";
5
- WebGPUEngine.prototype._createDepthStencilCubeTexture = function (size, options) {
4
+ import { ThinWebGPUEngine } from "../../thinWebGPUEngine.js";
5
+ ThinWebGPUEngine.prototype._createDepthStencilCubeTexture = function (size, options) {
6
6
  const internalTexture = new InternalTexture(this, options.generateStencil ? 12 /* InternalTextureSource.DepthStencil */ : 14 /* InternalTextureSource.Depth */);
7
7
  internalTexture.isCube = true;
8
8
  internalTexture.label = options.label;
@@ -23,7 +23,7 @@ WebGPUEngine.prototype._createDepthStencilCubeTexture = function (size, options)
23
23
  this._internalTexturesCache.push(internalTexture);
24
24
  return internalTexture;
25
25
  };
26
- WebGPUEngine.prototype.createCubeTexture = function (rootUrl, scene, files, noMipmap, onLoad = null, onError = null, format, forcedExtension = null, createPolynomials = false, lodScale = 0, lodOffset = 0, fallback = null, loaderOptions, useSRGBBuffer = false, buffer = null) {
26
+ ThinWebGPUEngine.prototype.createCubeTexture = function (rootUrl, scene, files, noMipmap, onLoad = null, onError = null, format, forcedExtension = null, createPolynomials = false, lodScale = 0, lodOffset = 0, fallback = null, loaderOptions, useSRGBBuffer = false, buffer = null) {
27
27
  return this.createCubeTextureBase(rootUrl, scene, files, !!noMipmap, onLoad, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset, fallback, null, (texture, imgs) => {
28
28
  const imageBitmaps = imgs; // we will always get an ImageBitmap array in WebGPU
29
29
  const width = imageBitmaps[0].width;
@@ -43,7 +43,7 @@ WebGPUEngine.prototype.createCubeTexture = function (rootUrl, scene, files, noMi
43
43
  }
44
44
  }, !!useSRGBBuffer, buffer);
45
45
  };
46
- WebGPUEngine.prototype._setCubeMapTextureParams = function (texture, loadMipmap, maxLevel) {
46
+ ThinWebGPUEngine.prototype._setCubeMapTextureParams = function (texture, loadMipmap, maxLevel) {
47
47
  texture.samplingMode = loadMipmap ? 3 : 2;
48
48
  texture._cachedWrapU = 0;
49
49
  texture._cachedWrapV = 0;
@@ -51,7 +51,7 @@ WebGPUEngine.prototype._setCubeMapTextureParams = function (texture, loadMipmap,
51
51
  texture._maxLodLevel = maxLevel;
52
52
  }
53
53
  };
54
- WebGPUEngine.prototype.generateMipMapsForCubemap = function (texture) {
54
+ ThinWebGPUEngine.prototype.generateMipMapsForCubemap = function (texture) {
55
55
  if (texture.generateMipMaps) {
56
56
  const gpuTexture = texture._hardwareTexture?.underlyingResource;
57
57
  if (!gpuTexture) {
@@ -1 +1 @@
1
- {"version":3,"file":"engine.cubeTexture.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.cubeTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAyB,MAAM,6CAA6C,CAAC;AAErG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AA4K7D,YAAY,CAAC,SAAS,CAAC,8BAA8B,GAAG,UAAU,IAAY,EAAE,OAAoC;IAChH,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,6CAAoC,CAAC,qCAA4B,CAAC,CAAC;IAE9I,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAEtC,MAAM,eAAe,GAAG;QACpB,iBAAiB,EAAE,KAAK;QACxB,kBAAkB,EAAE,CAAC;QACrB,eAAe,EAAE,KAAK;QACtB,OAAO,EAAE,CAAC;QACV,kBAAkB,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,8BAA8B,CAAC,CAAC,CAAC,SAAS,CAAC,2BAA2B;QAC9H,GAAG,OAAO;KACb,CAAC;IAEF,eAAe,CAAC,MAAM,GAAG,eAAe,CAAC,kBAAkB,CAAC;IAE5D,IAAI,CAAC,yBAAyB,CAAC,eAAe,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MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,EAAE,kBAAkB,CAAC;QAEhE,IAAI,CAAC,UAAU,EAAE;YACb,IAAI,CAAC,cAAc,CAAC,kCAAkC,CAAC,OAAO,CAAC,CAAC;SACnE;QAED,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;KAClC;AACL,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { Constants } from \"../../constants\";\r\nimport type { DepthTextureCreationOptions } from \"../../../Materials/Textures/textureCreationOptions\";\r\nimport { WebGPUEngine } from \"../../webgpuEngine\";\r\nimport type { WebGPUHardwareTexture } from \"../webgpuHardwareTexture\";\r\nimport { WebGPUTextureHelper } from \"../webgpuTextureHelper\";\r\n\r\nimport type { Scene } from \"../../../scene\";\r\n\r\ndeclare module \"../../abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * @internal\r\n */\r\n _setCubeMapTextureParams(texture: InternalTexture, loadMipmap: boolean, maxLevel?: number): void;\r\n\r\n /**\r\n * Creates a depth stencil cube texture.\r\n * This is only available in WebGL 2.\r\n * @param size The size of face edge in the cube texture.\r\n * @param options The options defining the cube texture.\r\n * @returns The cube texture\r\n */\r\n _createDepthStencilCubeTexture(size: number, options: DepthTextureCreationOptions): InternalTexture;\r\n\r\n /**\r\n * Creates a cube texture\r\n * @param rootUrl defines the url where the files to load is located\r\n * @param scene defines the current scene\r\n * @param files defines the list of files to load (1 per face)\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated (false by default)\r\n * @param onLoad defines an optional callback raised when the texture is loaded\r\n * @param onError defines an optional callback raised if there is an issue to load the texture\r\n * @param format defines the format of the data\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param createPolynomials if a polynomial sphere should be created for the cube texture\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @param fallback defines texture to use while falling back when (compressed) texture file not found.\r\n * @param loaderOptions options to be passed to the loader\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @param buffer defines the data buffer to load instead of loading the rootUrl\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createCubeTexture(\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap: boolean | undefined,\r\n onLoad: Nullable<(data?: any) => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n format: number | undefined,\r\n forcedExtension: any,\r\n createPolynomials: boolean,\r\n lodScale: number,\r\n lodOffset: number,\r\n fallback: Nullable<InternalTexture>,\r\n loaderOptions: any,\r\n useSRGBBuffer: boolean,\r\n buffer: Nullable<ArrayBufferView>\r\n ): InternalTexture;\r\n\r\n /**\r\n * Creates a cube texture\r\n * @param rootUrl defines the url where the files to load is located\r\n * @param scene defines the current scene\r\n * @param files defines the list of files to load (1 per face)\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated (false by default)\r\n * @param onLoad defines an optional callback raised when the texture is loaded\r\n * @param onError defines an optional callback raised if there is an issue to load the texture\r\n * @param format defines the format of the data\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createCubeTexture(\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap: boolean,\r\n onLoad: Nullable<(data?: any) => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n format: number | undefined,\r\n forcedExtension: any\r\n ): InternalTexture;\r\n\r\n /**\r\n * Creates a cube texture\r\n * @param rootUrl defines the url where the files to load is located\r\n * @param scene defines the current scene\r\n * @param files defines the list of files to load (1 per face)\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated (false by default)\r\n * @param onLoad defines an optional callback raised when the texture is loaded\r\n * @param onError defines an optional callback raised if there is an issue to load the texture\r\n * @param format defines the format of the data\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param createPolynomials if a polynomial sphere should be created for the cube texture\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createCubeTexture(\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap: boolean,\r\n onLoad: Nullable<(data?: any) => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n format: number | undefined,\r\n forcedExtension: any,\r\n createPolynomials: boolean,\r\n lodScale: number,\r\n lodOffset: number\r\n ): InternalTexture;\r\n\r\n /** @internal */\r\n createCubeTextureBase(\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap: boolean,\r\n onLoad: Nullable<(data?: any) => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n format: number | undefined,\r\n forcedExtension: any,\r\n createPolynomials: boolean,\r\n lodScale: number,\r\n lodOffset: number,\r\n fallback: Nullable<InternalTexture>,\r\n beforeLoadCubeDataCallback: Nullable<(texture: InternalTexture, data: ArrayBufferView | ArrayBufferView[]) => void>,\r\n imageHandler: Nullable<(texture: InternalTexture, imgs: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n useSRGBBuffer: boolean,\r\n buffer: Nullable<ArrayBufferView>\r\n ): InternalTexture;\r\n\r\n /** @internal */\r\n _partialLoadFile(\r\n url: string,\r\n index: number,\r\n loadedFiles: ArrayBuffer[],\r\n onfinish: (files: ArrayBuffer[]) => void,\r\n onErrorCallBack: Nullable<(message?: string, exception?: any) => void>\r\n ): void;\r\n\r\n /** @internal */\r\n _cascadeLoadFiles(scene: Nullable<Scene>, onfinish: (images: ArrayBuffer[]) => void, files: string[], onError: Nullable<(message?: string, exception?: any) => void>): void;\r\n\r\n /** @internal */\r\n _cascadeLoadImgs(\r\n scene: Nullable<Scene>,\r\n texture: InternalTexture,\r\n onfinish: Nullable<(texture: InternalTexture, images: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n files: string[],\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n mimeType?: string\r\n ): void;\r\n\r\n /** @internal */\r\n _partialLoadImg(\r\n url: string,\r\n index: number,\r\n loadedImages: HTMLImageElement[] | ImageBitmap[],\r\n scene: Nullable<Scene>,\r\n texture: InternalTexture,\r\n onfinish: Nullable<(texture: InternalTexture, images: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n onErrorCallBack: Nullable<(message?: string, exception?: any) => void>,\r\n mimeType?: string\r\n ): void;\r\n\r\n /**\r\n * Force the mipmap generation for the given render target texture\r\n * @param texture defines the render target texture to use\r\n * @param unbind defines whether or not to unbind the texture after generation. Defaults to true.\r\n */\r\n generateMipMapsForCubemap(texture: InternalTexture, unbind?: boolean): void;\r\n }\r\n}\r\n\r\nWebGPUEngine.prototype._createDepthStencilCubeTexture = function (size: number, options: DepthTextureCreationOptions): InternalTexture {\r\n const internalTexture = new InternalTexture(this, options.generateStencil ? InternalTextureSource.DepthStencil : InternalTextureSource.Depth);\r\n\r\n internalTexture.isCube = true;\r\n internalTexture.label = options.label;\r\n\r\n const internalOptions = {\r\n bilinearFiltering: false,\r\n comparisonFunction: 0,\r\n generateStencil: false,\r\n samples: 1,\r\n depthTextureFormat: options.generateStencil ? Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 : Constants.TEXTUREFORMAT_DEPTH32_FLOAT,\r\n ...options,\r\n };\r\n\r\n internalTexture.format = internalOptions.depthTextureFormat;\r\n\r\n this._setupDepthStencilTexture(internalTexture, size, internalOptions.bilinearFiltering, internalOptions.comparisonFunction, internalOptions.samples);\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(internalTexture);\r\n\r\n // Now that the hardware texture is created, we can retrieve the GPU format and set the right type to the internal texture\r\n const gpuTextureWrapper = internalTexture._hardwareTexture as WebGPUHardwareTexture;\r\n\r\n internalTexture.type = WebGPUTextureHelper.GetTextureTypeFromFormat(gpuTextureWrapper.format);\r\n\r\n this._internalTexturesCache.push(internalTexture);\r\n\r\n return internalTexture;\r\n};\r\n\r\nWebGPUEngine.prototype.createCubeTexture = function (\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap?: boolean,\r\n onLoad: Nullable<(data?: any) => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n format?: number,\r\n forcedExtension: any = null,\r\n createPolynomials: boolean = false,\r\n lodScale: number = 0,\r\n lodOffset: number = 0,\r\n fallback: Nullable<InternalTexture> = null,\r\n loaderOptions?: any,\r\n useSRGBBuffer = false,\r\n buffer: Nullable<ArrayBufferView> = null\r\n): InternalTexture {\r\n return this.createCubeTextureBase(\r\n rootUrl,\r\n scene,\r\n files,\r\n !!noMipmap,\r\n onLoad,\r\n onError,\r\n format,\r\n forcedExtension,\r\n createPolynomials,\r\n lodScale,\r\n lodOffset,\r\n fallback,\r\n null,\r\n (texture: InternalTexture, imgs: HTMLImageElement[] | ImageBitmap[]) => {\r\n const imageBitmaps = imgs as ImageBitmap[]; // we will always get an ImageBitmap array in WebGPU\r\n const width = imageBitmaps[0].width;\r\n const height = width;\r\n\r\n this._setCubeMapTextureParams(texture, !noMipmap);\r\n texture.format = format ?? -1;\r\n\r\n const gpuTextureWrapper = this._textureHelper.createGPUTextureForInternalTexture(texture, width, height);\r\n\r\n this._textureHelper.updateCubeTextures(imageBitmaps, gpuTextureWrapper.underlyingResource!, width, height, gpuTextureWrapper.format, false, false, 0, 0);\r\n\r\n if (!noMipmap) {\r\n this._generateMipmaps(texture, this._uploadEncoder);\r\n }\r\n\r\n texture.isReady = true;\r\n\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n },\r\n !!useSRGBBuffer,\r\n buffer\r\n );\r\n};\r\n\r\nWebGPUEngine.prototype._setCubeMapTextureParams = function (texture: InternalTexture, loadMipmap: boolean, maxLevel?: number) {\r\n texture.samplingMode = loadMipmap ? Constants.TEXTURE_TRILINEAR_SAMPLINGMODE : Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n texture._cachedWrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n texture._cachedWrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n if (maxLevel) {\r\n texture._maxLodLevel = maxLevel;\r\n }\r\n};\r\n\r\nWebGPUEngine.prototype.generateMipMapsForCubemap = function (texture: InternalTexture) {\r\n if (texture.generateMipMaps) {\r\n const gpuTexture = texture._hardwareTexture?.underlyingResource;\r\n\r\n if (!gpuTexture) {\r\n this._textureHelper.createGPUTextureForInternalTexture(texture);\r\n }\r\n\r\n this._generateMipmaps(texture);\r\n }\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.cubeTexture.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.cubeTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAyB,MAAM,6CAA6C,CAAC;AAErG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAAE,gBAAgB,EAAE,kCAAsC;AA0KjE,gBAAgB,CAAC,SAAS,CAAC,8BAA8B,GAAG,UAAU,IAAY,EAAE,OAAoC;IACpH,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,6CAAoC,CAAC,qCAA4B,CAAC,CAAC;IAE9I,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAEtC,MAAM,eAAe,GAAG;QACpB,iBAAiB,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C,SAAS,CAAC,6BAA6B,CAAC;IACvH,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,yBAAyB,CAAC;IAC3D,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,yBAAyB,CAAC;IAC3D,IAAI,QAAQ,EAAE;QACV,OAAO,CAAC,YAAY,GAAG,QAAQ,CAAC;KACnC;AACL,CAAC,CAAC;AAEF,gBAAgB,CAAC,SAAS,CAAC,yBAAyB,GAAG,UAAU,OAAwB;IACrF,IAAI,OAAO,CAAC,eAAe,EAAE;QACzB,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,EAAE,kBAAkB,CAAC;QAEhE,IAAI,CAAC,UAAU,EAAE;YACb,IAAI,CAAC,cAAc,CAAC,kCAAkC,CAAC,OAAO,CAAC,CAAC;SACnE;QAED,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;KAClC;AACL,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { Constants } from \"../../constants\";\r\nimport type { DepthTextureCreationOptions } from \"../../../Materials/Textures/textureCreationOptions\";\r\nimport type { WebGPUHardwareTexture } from \"../webgpuHardwareTexture\";\r\nimport { WebGPUTextureHelper } from \"../webgpuTextureHelper\";\r\n\r\nimport type { Scene } from \"../../../scene\";\r\nimport { ThinWebGPUEngine } from \"core/Engines/thinWebGPUEngine\";\r\n\r\ndeclare module \"../../abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * @internal\r\n */\r\n _setCubeMapTextureParams(texture: InternalTexture, loadMipmap: boolean, maxLevel?: number): void;\r\n\r\n /**\r\n * Creates a depth stencil cube texture.\r\n * This is only available in WebGL 2.\r\n * @param size The size of face edge in the cube texture.\r\n * @param options The options defining the cube texture.\r\n * @returns The cube texture\r\n */\r\n _createDepthStencilCubeTexture(size: number, options: DepthTextureCreationOptions): InternalTexture;\r\n\r\n /**\r\n * Creates a cube texture\r\n * @param rootUrl defines the url where the files to load is located\r\n * @param scene defines the current scene\r\n * @param files defines the list of files to load (1 per face)\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated (false by default)\r\n * @param onLoad defines an optional callback raised when the texture is loaded\r\n * @param onError defines an optional callback raised if there is an issue to load the texture\r\n * @param format defines the format of the data\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param createPolynomials if a polynomial sphere should be created for the cube texture\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @param fallback defines texture to use while falling back when (compressed) texture file not found.\r\n * @param loaderOptions options to be passed to the loader\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @param buffer defines the data buffer to load instead of loading the rootUrl\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createCubeTexture(\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap: boolean | undefined,\r\n onLoad: Nullable<(data?: any) => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n format: number | undefined,\r\n forcedExtension: any,\r\n createPolynomials: boolean,\r\n lodScale: number,\r\n lodOffset: number,\r\n fallback: Nullable<InternalTexture>,\r\n loaderOptions: any,\r\n useSRGBBuffer: boolean,\r\n buffer: Nullable<ArrayBufferView>\r\n ): InternalTexture;\r\n\r\n /**\r\n * Creates a cube texture\r\n * @param rootUrl defines the url where the files to load is located\r\n * @param scene defines the current scene\r\n * @param files defines the list of files to load (1 per face)\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated (false by default)\r\n * @param onLoad defines an optional callback raised when the texture is loaded\r\n * @param onError defines an optional callback raised if there is an issue to load the texture\r\n * @param format defines the format of the data\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createCubeTexture(\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap: boolean,\r\n onLoad: Nullable<(data?: any) => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n format: number | undefined,\r\n forcedExtension: any\r\n ): InternalTexture;\r\n\r\n /**\r\n * Creates a cube texture\r\n * @param rootUrl defines the url where the files to load is located\r\n * @param scene defines the current scene\r\n * @param files defines the list of files to load (1 per face)\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated (false by default)\r\n * @param onLoad defines an optional callback raised when the texture is loaded\r\n * @param onError defines an optional callback raised if there is an issue to load the texture\r\n * @param format defines the format of the data\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param createPolynomials if a polynomial sphere should be created for the cube texture\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createCubeTexture(\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap: boolean,\r\n onLoad: Nullable<(data?: any) => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n format: number | undefined,\r\n forcedExtension: any,\r\n createPolynomials: boolean,\r\n lodScale: number,\r\n lodOffset: number\r\n ): InternalTexture;\r\n\r\n /** @internal */\r\n createCubeTextureBase(\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap: boolean,\r\n onLoad: Nullable<(data?: any) => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n format: number | undefined,\r\n forcedExtension: any,\r\n createPolynomials: boolean,\r\n lodScale: number,\r\n lodOffset: number,\r\n fallback: Nullable<InternalTexture>,\r\n beforeLoadCubeDataCallback: Nullable<(texture: InternalTexture, data: ArrayBufferView | ArrayBufferView[]) => void>,\r\n imageHandler: Nullable<(texture: InternalTexture, imgs: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n useSRGBBuffer: boolean,\r\n buffer: Nullable<ArrayBufferView>\r\n ): InternalTexture;\r\n\r\n /** @internal */\r\n _partialLoadFile(\r\n url: string,\r\n index: number,\r\n loadedFiles: ArrayBuffer[],\r\n onfinish: (files: ArrayBuffer[]) => void,\r\n onErrorCallBack: Nullable<(message?: string, exception?: any) => void>\r\n ): void;\r\n\r\n /** @internal */\r\n _cascadeLoadFiles(scene: Nullable<Scene>, onfinish: (images: ArrayBuffer[]) => void, files: string[], onError: Nullable<(message?: string, exception?: any) => void>): void;\r\n\r\n /** @internal */\r\n _cascadeLoadImgs(\r\n scene: Nullable<Scene>,\r\n texture: InternalTexture,\r\n onfinish: Nullable<(texture: InternalTexture, images: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n files: string[],\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n mimeType?: string\r\n ): void;\r\n\r\n /** @internal */\r\n _partialLoadImg(\r\n url: string,\r\n index: number,\r\n loadedImages: HTMLImageElement[] | ImageBitmap[],\r\n scene: Nullable<Scene>,\r\n texture: InternalTexture,\r\n onfinish: Nullable<(texture: InternalTexture, images: HTMLImageElement[] | ImageBitmap[]) => void>,\r\n onErrorCallBack: Nullable<(message?: string, exception?: any) => void>,\r\n mimeType?: string\r\n ): void;\r\n\r\n /**\r\n * Force the mipmap generation for the given render target texture\r\n * @param texture defines the render target texture to use\r\n * @param unbind defines whether or not to unbind the texture after generation. Defaults to true.\r\n */\r\n generateMipMapsForCubemap(texture: InternalTexture, unbind?: boolean): void;\r\n }\r\n}\r\n\r\nThinWebGPUEngine.prototype._createDepthStencilCubeTexture = function (size: number, options: DepthTextureCreationOptions): InternalTexture {\r\n const internalTexture = new InternalTexture(this, options.generateStencil ? InternalTextureSource.DepthStencil : InternalTextureSource.Depth);\r\n\r\n internalTexture.isCube = true;\r\n internalTexture.label = options.label;\r\n\r\n const internalOptions = {\r\n bilinearFiltering: false,\r\n comparisonFunction: 0,\r\n generateStencil: false,\r\n samples: 1,\r\n depthTextureFormat: options.generateStencil ? Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 : Constants.TEXTUREFORMAT_DEPTH32_FLOAT,\r\n ...options,\r\n };\r\n\r\n internalTexture.format = internalOptions.depthTextureFormat;\r\n\r\n this._setupDepthStencilTexture(internalTexture, size, internalOptions.bilinearFiltering, internalOptions.comparisonFunction, internalOptions.samples);\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(internalTexture);\r\n\r\n // Now that the hardware texture is created, we can retrieve the GPU format and set the right type to the internal texture\r\n const gpuTextureWrapper = internalTexture._hardwareTexture as WebGPUHardwareTexture;\r\n\r\n internalTexture.type = WebGPUTextureHelper.GetTextureTypeFromFormat(gpuTextureWrapper.format);\r\n\r\n this._internalTexturesCache.push(internalTexture);\r\n\r\n return internalTexture;\r\n};\r\n\r\nThinWebGPUEngine.prototype.createCubeTexture = function (\r\n rootUrl: string,\r\n scene: Nullable<Scene>,\r\n files: Nullable<string[]>,\r\n noMipmap?: boolean,\r\n onLoad: Nullable<(data?: any) => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n format?: number,\r\n forcedExtension: any = null,\r\n createPolynomials: boolean = false,\r\n lodScale: number = 0,\r\n lodOffset: number = 0,\r\n fallback: Nullable<InternalTexture> = null,\r\n loaderOptions?: any,\r\n useSRGBBuffer = false,\r\n buffer: Nullable<ArrayBufferView> = null\r\n): InternalTexture {\r\n return this.createCubeTextureBase(\r\n rootUrl,\r\n scene,\r\n files,\r\n !!noMipmap,\r\n onLoad,\r\n onError,\r\n format,\r\n forcedExtension,\r\n createPolynomials,\r\n lodScale,\r\n lodOffset,\r\n fallback,\r\n null,\r\n (texture: InternalTexture, imgs: HTMLImageElement[] | ImageBitmap[]) => {\r\n const imageBitmaps = imgs as ImageBitmap[]; // we will always get an ImageBitmap array in WebGPU\r\n const width = imageBitmaps[0].width;\r\n const height = width;\r\n\r\n this._setCubeMapTextureParams(texture, !noMipmap);\r\n texture.format = format ?? -1;\r\n\r\n const gpuTextureWrapper = this._textureHelper.createGPUTextureForInternalTexture(texture, width, height);\r\n\r\n this._textureHelper.updateCubeTextures(imageBitmaps, gpuTextureWrapper.underlyingResource!, width, height, gpuTextureWrapper.format, false, false, 0, 0);\r\n\r\n if (!noMipmap) {\r\n this._generateMipmaps(texture, this._uploadEncoder);\r\n }\r\n\r\n texture.isReady = true;\r\n\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n },\r\n !!useSRGBBuffer,\r\n buffer\r\n );\r\n};\r\n\r\nThinWebGPUEngine.prototype._setCubeMapTextureParams = function (texture: InternalTexture, loadMipmap: boolean, maxLevel?: number) {\r\n texture.samplingMode = loadMipmap ? Constants.TEXTURE_TRILINEAR_SAMPLINGMODE : Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n texture._cachedWrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n texture._cachedWrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n if (maxLevel) {\r\n texture._maxLodLevel = maxLevel;\r\n }\r\n};\r\n\r\nThinWebGPUEngine.prototype.generateMipMapsForCubemap = function (texture: InternalTexture) {\r\n if (texture.generateMipMaps) {\r\n const gpuTexture = texture._hardwareTexture?.underlyingResource;\r\n\r\n if (!gpuTexture) {\r\n this._textureHelper.createGPUTextureForInternalTexture(texture);\r\n }\r\n\r\n this._generateMipmaps(texture);\r\n }\r\n};\r\n"]}
@@ -1,8 +1,8 @@
1
1
  import { InternalTexture } from "../../../Materials/Textures/internalTexture.js";
2
2
 
3
- import { WebGPUEngine } from "../../webgpuEngine.js";
4
3
  import { Logger } from "../../../Misc/logger.js";
5
- WebGPUEngine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression = null, type = 0, creationFlags = 0, useSRGBBuffer = false) {
4
+ import { ThinWebGPUEngine } from "../../thinWebGPUEngine.js";
5
+ ThinWebGPUEngine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression = null, type = 0, creationFlags = 0, useSRGBBuffer = false) {
6
6
  const texture = new InternalTexture(this, 3 /* InternalTextureSource.Raw */);
7
7
  texture.baseWidth = width;
8
8
  texture.baseHeight = height;
@@ -24,7 +24,7 @@ WebGPUEngine.prototype.createRawTexture = function (data, width, height, format,
24
24
  this._internalTexturesCache.push(texture);
25
25
  return texture;
26
26
  };
27
- WebGPUEngine.prototype.updateRawTexture = function (texture, bufferView, format, invertY, compression = null, type = 0, useSRGBBuffer = false) {
27
+ ThinWebGPUEngine.prototype.updateRawTexture = function (texture, bufferView, format, invertY, compression = null, type = 0, useSRGBBuffer = false) {
28
28
  if (!texture) {
29
29
  return;
30
30
  }
@@ -48,7 +48,7 @@ WebGPUEngine.prototype.updateRawTexture = function (texture, bufferView, format,
48
48
  }
49
49
  texture.isReady = true;
50
50
  };
51
- WebGPUEngine.prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression = null) {
51
+ ThinWebGPUEngine.prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression = null) {
52
52
  const texture = new InternalTexture(this, 8 /* InternalTextureSource.CubeRaw */);
53
53
  if (type === 1 && !this._caps.textureFloatLinearFiltering) {
54
54
  generateMipMaps = false;
@@ -94,7 +94,7 @@ WebGPUEngine.prototype.createRawCubeTexture = function (data, size, format, type
94
94
  texture.isReady = true;
95
95
  return texture;
96
96
  };
97
- WebGPUEngine.prototype.updateRawCubeTexture = function (texture, bufferView, _format, type, invertY, compression = null) {
97
+ ThinWebGPUEngine.prototype.updateRawCubeTexture = function (texture, bufferView, _format, type, invertY, compression = null) {
98
98
  texture._bufferViewArray = bufferView;
99
99
  texture.invertY = invertY;
100
100
  texture._compression = compression;
@@ -115,7 +115,7 @@ WebGPUEngine.prototype.updateRawCubeTexture = function (texture, bufferView, _fo
115
115
  }
116
116
  texture.isReady = true;
117
117
  };
118
- WebGPUEngine.prototype.createRawCubeTextureFromUrl = function (url, scene, size, format, type, noMipmap, callback, mipmapGenerator, onLoad = null, onError = null, samplingMode = 3, invertY = false) {
118
+ ThinWebGPUEngine.prototype.createRawCubeTextureFromUrl = function (url, scene, size, format, type, noMipmap, callback, mipmapGenerator, onLoad = null, onError = null, samplingMode = 3, invertY = false) {
119
119
  const texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode, null);
120
120
  scene?.addPendingData(texture);
121
121
  texture.url = url;
@@ -165,7 +165,7 @@ WebGPUEngine.prototype.createRawCubeTextureFromUrl = function (url, scene, size,
165
165
  }, undefined, scene?.offlineProvider, true, onerror);
166
166
  return texture;
167
167
  };
168
- WebGPUEngine.prototype.createRawTexture3D = function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression = null, textureType = 0, creationFlags = 0) {
168
+ ThinWebGPUEngine.prototype.createRawTexture3D = function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression = null, textureType = 0, creationFlags = 0) {
169
169
  const source = 10 /* InternalTextureSource.Raw3D */;
170
170
  const texture = new InternalTexture(this, source);
171
171
  texture.baseWidth = width;
@@ -188,7 +188,7 @@ WebGPUEngine.prototype.createRawTexture3D = function (data, width, height, depth
188
188
  this._internalTexturesCache.push(texture);
189
189
  return texture;
190
190
  };
191
- WebGPUEngine.prototype.updateRawTexture3D = function (texture, bufferView, format, invertY, compression = null, textureType = 0) {
191
+ ThinWebGPUEngine.prototype.updateRawTexture3D = function (texture, bufferView, format, invertY, compression = null, textureType = 0) {
192
192
  if (!this._doNotHandleContextLost) {
193
193
  texture._bufferView = bufferView;
194
194
  texture.format = format;
@@ -209,7 +209,7 @@ WebGPUEngine.prototype.updateRawTexture3D = function (texture, bufferView, forma
209
209
  }
210
210
  texture.isReady = true;
211
211
  };
212
- WebGPUEngine.prototype.createRawTexture2DArray = function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression = null, textureType = 0, creationFlags = 0) {
212
+ ThinWebGPUEngine.prototype.createRawTexture2DArray = function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression = null, textureType = 0, creationFlags = 0) {
213
213
  const source = 11 /* InternalTextureSource.Raw2DArray */;
214
214
  const texture = new InternalTexture(this, source);
215
215
  texture.baseWidth = width;
@@ -232,7 +232,7 @@ WebGPUEngine.prototype.createRawTexture2DArray = function (data, width, height,
232
232
  this._internalTexturesCache.push(texture);
233
233
  return texture;
234
234
  };
235
- WebGPUEngine.prototype.updateRawTexture2DArray = function (texture, bufferView, format, invertY, compression = null, textureType = 0) {
235
+ ThinWebGPUEngine.prototype.updateRawTexture2DArray = function (texture, bufferView, format, invertY, compression = null, textureType = 0) {
236
236
  if (!this._doNotHandleContextLost) {
237
237
  texture._bufferView = bufferView;
238
238
  texture.format = format;
@@ -1 +1 @@
1
- {"version":3,"file":"engine.rawTexture.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.rawTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAyB,MAAM,6CAA6C,CAAC;AAGrG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAsM9C,YAAY,CAAC,SAAS,CAAC,gBAAgB,GAAG,UACtC,IAA+B,EAC/B,KAAa,EACb,MAAc,EACd,MAAc,EACd,eAAwB,EACxB,OAAgB,EAChB,YAAoB,EACpB,cAAgC,IAAI,EACpC,OAAe,SAAS,CAAC,wBAAwB,EACjD,gBAAwB,CAAC,EACzB,gBAAyB,KAAK;IAE9B,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC,IAAI,oCAA4B,CAAC;IACrE,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC;IAC1B,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC;IAC5B,OAAO,CAAC,KAAK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InternalTextureSource } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { IWebRequest } from \"../../../Misc/interfaces/iWebRequest\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { Constants } from \"../../constants\";\r\nimport { WebGPUEngine } from \"../../webgpuEngine\";\r\nimport type { WebGPUHardwareTexture } from \"../webgpuHardwareTexture\";\r\nimport { Logger } from \"../../../Misc/logger\";\r\n\r\nimport type { Scene } from \"../../../scene\";\r\n\r\ndeclare module \"../../abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * Update a raw texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store in the texture\r\n * @param format defines the format of the data\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store in the texture\r\n * @param format defines the format of the data\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n */\r\n updateRawTexture(\r\n texture: Nullable<InternalTexture>,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string>,\r\n type: number,\r\n useSRGBBuffer: boolean\r\n ): void;\r\n\r\n /**\r\n * Creates a new raw cube texture\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTexture(\r\n data: Nullable<ArrayBufferView[]>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string>\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>): void;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param level defines which level of the texture to update\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>, level: number): void;\r\n\r\n /**\r\n * Creates a new raw cube texture from a specified url\r\n * @param url defines the url where the data is located\r\n * @param scene defines the current scene\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param noMipmap defines if the engine should avoid generating the mip levels\r\n * @param callback defines a callback used to extract texture data from loaded data\r\n * @param mipmapGenerator defines to provide an optional tool to generate mip levels\r\n * @param onLoad defines a callback called when texture is loaded\r\n * @param onError defines a callback called if there is an error\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTextureFromUrl(\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>\r\n ): InternalTexture;\r\n\r\n /**\r\n * Creates a new raw cube texture from a specified url\r\n * @param url defines the url where the data is located\r\n * @param scene defines the current scene\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param noMipmap defines if the engine should avoid generating the mip levels\r\n * @param callback defines a callback used to extract texture data from loaded data\r\n * @param mipmapGenerator defines to provide an optional tool to generate mip levels\r\n * @param onLoad defines a callback called when texture is loaded\r\n * @param onError defines a callback called if there is an error\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTextureFromUrl(\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n samplingMode: number,\r\n invertY: boolean\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw 3D texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw 3D texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the used compression (can be null)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string>, textureType: number): void;\r\n\r\n /**\r\n * Update a raw 2D array texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture2DArray(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw 2D array texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the used compression (can be null)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n updateRawTexture2DArray(\r\n texture: InternalTexture,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string>,\r\n textureType: number\r\n ): void;\r\n }\r\n}\r\n\r\nWebGPUEngine.prototype.createRawTexture = function (\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags: number = 0,\r\n useSRGBBuffer: boolean = false\r\n): InternalTexture {\r\n const texture = new InternalTexture(this, InternalTextureSource.Raw);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.format = format;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture.type = type;\r\n texture._creationFlags = creationFlags;\r\n texture._useSRGBBuffer = useSRGBBuffer;\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(texture, width, height, undefined, creationFlags);\r\n\r\n this.updateRawTexture(texture, data, format, invertY, compression, type, useSRGBBuffer);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n};\r\n\r\nWebGPUEngine.prototype.updateRawTexture = function (\r\n texture: Nullable<InternalTexture>,\r\n bufferView: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n useSRGBBuffer: boolean = false\r\n): void {\r\n if (!texture) {\r\n return;\r\n }\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = bufferView;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture._useSRGBBuffer = useSRGBBuffer;\r\n }\r\n\r\n if (bufferView) {\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n const needConversion = format === Constants.TEXTUREFORMAT_RGB;\r\n\r\n if (needConversion) {\r\n bufferView = _convertRGBtoRGBATextureData(bufferView, texture.width, texture.height, type);\r\n }\r\n\r\n const data = new Uint8Array(bufferView.buffer, bufferView.byteOffset, bufferView.byteLength);\r\n\r\n this._textureHelper.updateTexture(data, texture, texture.width, texture.height, texture.depth, gpuTextureWrapper.format, 0, 0, invertY, false, 0, 0);\r\n if (texture.generateMipMaps) {\r\n this._generateMipmaps(texture, this._uploadEncoder);\r\n }\r\n }\r\n\r\n texture.isReady = true;\r\n};\r\n\r\nWebGPUEngine.prototype.createRawCubeTexture = function (\r\n data: Nullable<ArrayBufferView[]>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null\r\n): InternalTexture {\r\n const texture = new InternalTexture(this, InternalTextureSource.CubeRaw);\r\n\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n Logger.Warn(\"Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n } else if (type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n Logger.Warn(\"Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n } else if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatRender) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to float textures is not supported. Mipmap generation forced to false.\");\r\n } else if (type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.colorBufferFloat) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to half float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n\r\n texture.isCube = true;\r\n texture._originalFormat = format;\r\n texture.format = format === Constants.TEXTUREFORMAT_RGB ? Constants.TEXTUREFORMAT_RGBA : format;\r\n texture.type = type;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.width = size;\r\n texture.height = size;\r\n texture.samplingMode = samplingMode;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferViewArray = data;\r\n }\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture._cachedWrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n texture._cachedWrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(texture);\r\n\r\n if (format === Constants.TEXTUREFORMAT_RGB) {\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n gpuTextureWrapper._originalFormatIsRGB = true;\r\n }\r\n\r\n if (data) {\r\n this.updateRawCubeTexture(texture, data, format, type, invertY, compression);\r\n }\r\n\r\n texture.isReady = true;\r\n\r\n return texture;\r\n};\r\n\r\nWebGPUEngine.prototype.updateRawCubeTexture = function (\r\n texture: InternalTexture,\r\n bufferView: ArrayBufferView[],\r\n _format: number,\r\n type: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null\r\n): void {\r\n texture._bufferViewArray = bufferView;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n const needConversion = gpuTextureWrapper._originalFormatIsRGB;\r\n\r\n const faces = [0, 2, 4, 1, 3, 5];\r\n\r\n const data = [];\r\n for (let i = 0; i < bufferView.length; ++i) {\r\n let faceData = bufferView[faces[i]];\r\n if (needConversion) {\r\n faceData = _convertRGBtoRGBATextureData(faceData, texture.width, texture.height, type);\r\n }\r\n data.push(new Uint8Array(faceData.buffer, faceData.byteOffset, faceData.byteLength));\r\n }\r\n\r\n this._textureHelper.updateCubeTextures(data, gpuTextureWrapper.underlyingResource!, texture.width, texture.height, gpuTextureWrapper.format, invertY, false, 0, 0);\r\n if (texture.generateMipMaps) {\r\n this._generateMipmaps(texture, this._uploadEncoder);\r\n }\r\n\r\n texture.isReady = true;\r\n};\r\n\r\nWebGPUEngine.prototype.createRawCubeTextureFromUrl = function (\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n invertY: boolean = false\r\n): InternalTexture {\r\n const texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode, null);\r\n scene?.addPendingData(texture);\r\n texture.url = url;\r\n texture.isReady = false;\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n const onerror = (request?: IWebRequest, exception?: any) => {\r\n scene?.removePendingData(texture);\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n\r\n const internalCallback = (data: any) => {\r\n const width = texture.width;\r\n const faceDataArrays = callback(data);\r\n\r\n if (!faceDataArrays) {\r\n return;\r\n }\r\n\r\n if (mipmapGenerator) {\r\n const needConversion = format === Constants.TEXTUREFORMAT_RGB;\r\n const mipData = mipmapGenerator(faceDataArrays);\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n const faces = [0, 1, 2, 3, 4, 5];\r\n for (let level = 0; level < mipData.length; level++) {\r\n const mipSize = width >> level;\r\n const allFaces = [];\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n let mipFaceData = mipData[level][faces[faceIndex]];\r\n if (needConversion) {\r\n mipFaceData = _convertRGBtoRGBATextureData(mipFaceData, mipSize, mipSize, type);\r\n }\r\n allFaces.push(new Uint8Array(mipFaceData.buffer, mipFaceData.byteOffset, mipFaceData.byteLength));\r\n }\r\n this._textureHelper.updateCubeTextures(allFaces, gpuTextureWrapper.underlyingResource!, mipSize, mipSize, gpuTextureWrapper.format, invertY, false, 0, 0);\r\n }\r\n } else {\r\n this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);\r\n }\r\n\r\n texture.isReady = true;\r\n scene?.removePendingData(texture);\r\n\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n\r\n this._loadFile(\r\n url,\r\n (data) => {\r\n internalCallback(data);\r\n },\r\n undefined,\r\n scene?.offlineProvider,\r\n true,\r\n onerror\r\n );\r\n\r\n return texture;\r\n};\r\n\r\nWebGPUEngine.prototype.createRawTexture3D = function (\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags: number = 0\r\n): InternalTexture {\r\n const source = InternalTextureSource.Raw3D;\r\n const texture = new InternalTexture(this, source);\r\n\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.baseDepth = depth;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = depth;\r\n texture.format = format;\r\n texture.type = textureType;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.is3D = true;\r\n texture._creationFlags = creationFlags;\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(texture, width, height, undefined, creationFlags);\r\n\r\n this.updateRawTexture3D(texture, data, format, invertY, compression, textureType);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n};\r\n\r\nWebGPUEngine.prototype.updateRawTexture3D = function (\r\n texture: InternalTexture,\r\n bufferView: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT\r\n): void {\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = bufferView;\r\n texture.format = format;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n\r\n if (bufferView) {\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n const needConversion = format === Constants.TEXTUREFORMAT_RGB;\r\n\r\n if (needConversion) {\r\n bufferView = _convertRGBtoRGBATextureData(bufferView, texture.width, texture.height, textureType);\r\n }\r\n\r\n const data = new Uint8Array(bufferView.buffer, bufferView.byteOffset, bufferView.byteLength);\r\n\r\n this._textureHelper.updateTexture(data, texture, texture.width, texture.height, texture.depth, gpuTextureWrapper.format, 0, 0, invertY, false, 0, 0);\r\n if (texture.generateMipMaps) {\r\n this._generateMipmaps(texture, this._uploadEncoder);\r\n }\r\n }\r\n\r\n texture.isReady = true;\r\n};\r\n\r\nWebGPUEngine.prototype.createRawTexture2DArray = function (\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags: number = 0\r\n): InternalTexture {\r\n const source = InternalTextureSource.Raw2DArray;\r\n const texture = new InternalTexture(this, source);\r\n\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.baseDepth = depth;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = depth;\r\n texture.format = format;\r\n texture.type = textureType;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.is2DArray = true;\r\n texture._creationFlags = creationFlags;\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(texture, width, height, depth, creationFlags);\r\n\r\n this.updateRawTexture2DArray(texture, data, format, invertY, compression, textureType);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n};\r\n\r\nWebGPUEngine.prototype.updateRawTexture2DArray = function (\r\n texture: InternalTexture,\r\n bufferView: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT\r\n): void {\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = bufferView;\r\n texture.format = format;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n\r\n if (bufferView) {\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n const needConversion = format === Constants.TEXTUREFORMAT_RGB;\r\n\r\n if (needConversion) {\r\n bufferView = _convertRGBtoRGBATextureData(bufferView, texture.width, texture.height, textureType);\r\n }\r\n\r\n const data = new Uint8Array(bufferView.buffer, bufferView.byteOffset, bufferView.byteLength);\r\n\r\n this._textureHelper.updateTexture(data, texture, texture.width, texture.height, texture.depth, gpuTextureWrapper.format, 0, 0, invertY, false, 0, 0);\r\n if (texture.generateMipMaps) {\r\n this._generateMipmaps(texture, this._uploadEncoder);\r\n }\r\n }\r\n\r\n texture.isReady = true;\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _convertRGBtoRGBATextureData(rgbData: any, width: number, height: number, textureType: number): ArrayBufferView {\r\n // Create new RGBA data container.\r\n let rgbaData: any;\r\n let val1 = 1;\r\n if (textureType === Constants.TEXTURETYPE_FLOAT) {\r\n rgbaData = new Float32Array(width * height * 4);\r\n } else if (textureType === Constants.TEXTURETYPE_HALF_FLOAT) {\r\n rgbaData = new Uint16Array(width * height * 4);\r\n val1 = 15360; // 15360 is the encoding of 1 in half float\r\n } else if (textureType === Constants.TEXTURETYPE_UNSIGNED_INTEGER) {\r\n rgbaData = new Uint32Array(width * height * 4);\r\n } else {\r\n rgbaData = new Uint8Array(width * height * 4);\r\n }\r\n\r\n // Convert each pixel.\r\n for (let x = 0; x < width; x++) {\r\n for (let y = 0; y < height; y++) {\r\n const index = (y * width + x) * 3;\r\n const newIndex = (y * width + x) * 4;\r\n\r\n // Map Old Value to new value.\r\n rgbaData[newIndex + 0] = rgbData[index + 0];\r\n rgbaData[newIndex + 1] = rgbData[index + 1];\r\n rgbaData[newIndex + 2] = rgbData[index + 2];\r\n\r\n // Add fully opaque alpha channel.\r\n rgbaData[newIndex + 3] = val1;\r\n }\r\n }\r\n\r\n return rgbaData;\r\n}\r\n"]}
1
+ {"version":3,"file":"engine.rawTexture.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.rawTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAyB,MAAM,6CAA6C,CAAC;AAGrG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,gBAAgB,EAAE,kCAAsC;AAoMjE,gBAAgB,CAAC,SAAS,CAAC,gBAAgB,GAAG,UAC1C,IAA+B,EAC/B,KAAa,EACb,MAAc,EACd,MAAc,EACd,eAAwB,EACxB,OAAgB,EAChB,YAAoB,EACpB,cAAgC,IAAI,EACpC,OAAe,SAAS,CAAC,wBAAwB,EACjD,gBAAwB,CAAC,EACzB,gBAAyB,KAAK;IAE9B,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC,IAAI,oCAA4B,CAAC;IACrE,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC;IAC1B,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC;IAC5B,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IACtB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,eAAe,GAAG,eAAe,CAAC;IAC1C,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;IACpC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,YAAY,GAAG,WAAW,CAAC;IACnC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IACpB,OAAO,CAAC,cAAc,GAAG,aAAa,CAAC;IACvC,OAAO,CAAC,cAAc,GAAG,aAAa,CAAC;IAEvC,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE;QAC/B,OA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IAED,sBAAsB;IACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7B,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YAClC,MAAM,QAAQ,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YAErC,8BAA8B;YAC9B,QAAQ,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAC5C,QAAQ,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAC5C,QAAQ,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAE5C,kCAAkC;YAClC,QAAQ,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;SACjC;KACJ;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { IWebRequest } from \"../../../Misc/interfaces/iWebRequest\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { Constants } from \"../../constants\";\r\nimport type { WebGPUHardwareTexture } from \"../webgpuHardwareTexture\";\r\nimport { Logger } from \"../../../Misc/logger\";\r\n\r\nimport type { Scene } from \"../../../scene\";\r\nimport { ThinWebGPUEngine } from \"core/Engines/thinWebGPUEngine\";\r\n\r\ndeclare module \"../../abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * Update a raw texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store in the texture\r\n * @param format defines the format of the data\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store in the texture\r\n * @param format defines the format of the data\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n */\r\n updateRawTexture(\r\n texture: Nullable<InternalTexture>,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string>,\r\n type: number,\r\n useSRGBBuffer: boolean\r\n ): void;\r\n\r\n /**\r\n * Creates a new raw cube texture\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTexture(\r\n data: Nullable<ArrayBufferView[]>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string>\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>): void;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param level defines which level of the texture to update\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>, level: number): void;\r\n\r\n /**\r\n * Creates a new raw cube texture from a specified url\r\n * @param url defines the url where the data is located\r\n * @param scene defines the current scene\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param noMipmap defines if the engine should avoid generating the mip levels\r\n * @param callback defines a callback used to extract texture data from loaded data\r\n * @param mipmapGenerator defines to provide an optional tool to generate mip levels\r\n * @param onLoad defines a callback called when texture is loaded\r\n * @param onError defines a callback called if there is an error\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTextureFromUrl(\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>\r\n ): InternalTexture;\r\n\r\n /**\r\n * Creates a new raw cube texture from a specified url\r\n * @param url defines the url where the data is located\r\n * @param scene defines the current scene\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param noMipmap defines if the engine should avoid generating the mip levels\r\n * @param callback defines a callback used to extract texture data from loaded data\r\n * @param mipmapGenerator defines to provide an optional tool to generate mip levels\r\n * @param onLoad defines a callback called when texture is loaded\r\n * @param onError defines a callback called if there is an error\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTextureFromUrl(\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n samplingMode: number,\r\n invertY: boolean\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw 3D texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw 3D texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the used compression (can be null)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string>, textureType: number): void;\r\n\r\n /**\r\n * Update a raw 2D array texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture2DArray(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw 2D array texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the used compression (can be null)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n updateRawTexture2DArray(\r\n texture: InternalTexture,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string>,\r\n textureType: number\r\n ): void;\r\n }\r\n}\r\n\r\nThinWebGPUEngine.prototype.createRawTexture = function (\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags: number = 0,\r\n useSRGBBuffer: boolean = false\r\n): InternalTexture {\r\n const texture = new InternalTexture(this, InternalTextureSource.Raw);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.format = format;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture.type = type;\r\n texture._creationFlags = creationFlags;\r\n texture._useSRGBBuffer = useSRGBBuffer;\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(texture, width, height, undefined, creationFlags);\r\n\r\n this.updateRawTexture(texture, data, format, invertY, compression, type, useSRGBBuffer);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n};\r\n\r\nThinWebGPUEngine.prototype.updateRawTexture = function (\r\n texture: Nullable<InternalTexture>,\r\n bufferView: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n useSRGBBuffer: boolean = false\r\n): void {\r\n if (!texture) {\r\n return;\r\n }\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = bufferView;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture._useSRGBBuffer = useSRGBBuffer;\r\n }\r\n\r\n if (bufferView) {\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n const needConversion = format === Constants.TEXTUREFORMAT_RGB;\r\n\r\n if (needConversion) {\r\n bufferView = _convertRGBtoRGBATextureData(bufferView, texture.width, texture.height, type);\r\n }\r\n\r\n const data = new Uint8Array(bufferView.buffer, bufferView.byteOffset, bufferView.byteLength);\r\n\r\n this._textureHelper.updateTexture(data, texture, texture.width, texture.height, texture.depth, gpuTextureWrapper.format, 0, 0, invertY, false, 0, 0);\r\n if (texture.generateMipMaps) {\r\n this._generateMipmaps(texture, this._uploadEncoder);\r\n }\r\n }\r\n\r\n texture.isReady = true;\r\n};\r\n\r\nThinWebGPUEngine.prototype.createRawCubeTexture = function (\r\n data: Nullable<ArrayBufferView[]>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null\r\n): InternalTexture {\r\n const texture = new InternalTexture(this, InternalTextureSource.CubeRaw);\r\n\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n Logger.Warn(\"Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n } else if (type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n Logger.Warn(\"Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n } else if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatRender) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to float textures is not supported. Mipmap generation forced to false.\");\r\n } else if (type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.colorBufferFloat) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to half float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n\r\n texture.isCube = true;\r\n texture._originalFormat = format;\r\n texture.format = format === Constants.TEXTUREFORMAT_RGB ? Constants.TEXTUREFORMAT_RGBA : format;\r\n texture.type = type;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.width = size;\r\n texture.height = size;\r\n texture.samplingMode = samplingMode;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferViewArray = data;\r\n }\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture._cachedWrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n texture._cachedWrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(texture);\r\n\r\n if (format === Constants.TEXTUREFORMAT_RGB) {\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n gpuTextureWrapper._originalFormatIsRGB = true;\r\n }\r\n\r\n if (data) {\r\n this.updateRawCubeTexture(texture, data, format, type, invertY, compression);\r\n }\r\n\r\n texture.isReady = true;\r\n\r\n return texture;\r\n};\r\n\r\nThinWebGPUEngine.prototype.updateRawCubeTexture = function (\r\n texture: InternalTexture,\r\n bufferView: ArrayBufferView[],\r\n _format: number,\r\n type: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null\r\n): void {\r\n texture._bufferViewArray = bufferView;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n const needConversion = gpuTextureWrapper._originalFormatIsRGB;\r\n\r\n const faces = [0, 2, 4, 1, 3, 5];\r\n\r\n const data = [];\r\n for (let i = 0; i < bufferView.length; ++i) {\r\n let faceData = bufferView[faces[i]];\r\n if (needConversion) {\r\n faceData = _convertRGBtoRGBATextureData(faceData, texture.width, texture.height, type);\r\n }\r\n data.push(new Uint8Array(faceData.buffer, faceData.byteOffset, faceData.byteLength));\r\n }\r\n\r\n this._textureHelper.updateCubeTextures(data, gpuTextureWrapper.underlyingResource!, texture.width, texture.height, gpuTextureWrapper.format, invertY, false, 0, 0);\r\n if (texture.generateMipMaps) {\r\n this._generateMipmaps(texture, this._uploadEncoder);\r\n }\r\n\r\n texture.isReady = true;\r\n};\r\n\r\nThinWebGPUEngine.prototype.createRawCubeTextureFromUrl = function (\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n invertY: boolean = false\r\n): InternalTexture {\r\n const texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode, null);\r\n scene?.addPendingData(texture);\r\n texture.url = url;\r\n texture.isReady = false;\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n const onerror = (request?: IWebRequest, exception?: any) => {\r\n scene?.removePendingData(texture);\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n\r\n const internalCallback = (data: any) => {\r\n const width = texture.width;\r\n const faceDataArrays = callback(data);\r\n\r\n if (!faceDataArrays) {\r\n return;\r\n }\r\n\r\n if (mipmapGenerator) {\r\n const needConversion = format === Constants.TEXTUREFORMAT_RGB;\r\n const mipData = mipmapGenerator(faceDataArrays);\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n const faces = [0, 1, 2, 3, 4, 5];\r\n for (let level = 0; level < mipData.length; level++) {\r\n const mipSize = width >> level;\r\n const allFaces = [];\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n let mipFaceData = mipData[level][faces[faceIndex]];\r\n if (needConversion) {\r\n mipFaceData = _convertRGBtoRGBATextureData(mipFaceData, mipSize, mipSize, type);\r\n }\r\n allFaces.push(new Uint8Array(mipFaceData.buffer, mipFaceData.byteOffset, mipFaceData.byteLength));\r\n }\r\n this._textureHelper.updateCubeTextures(allFaces, gpuTextureWrapper.underlyingResource!, mipSize, mipSize, gpuTextureWrapper.format, invertY, false, 0, 0);\r\n }\r\n } else {\r\n this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);\r\n }\r\n\r\n texture.isReady = true;\r\n scene?.removePendingData(texture);\r\n\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n\r\n this._loadFile(\r\n url,\r\n (data) => {\r\n internalCallback(data);\r\n },\r\n undefined,\r\n scene?.offlineProvider,\r\n true,\r\n onerror\r\n );\r\n\r\n return texture;\r\n};\r\n\r\nThinWebGPUEngine.prototype.createRawTexture3D = function (\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags: number = 0\r\n): InternalTexture {\r\n const source = InternalTextureSource.Raw3D;\r\n const texture = new InternalTexture(this, source);\r\n\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.baseDepth = depth;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = depth;\r\n texture.format = format;\r\n texture.type = textureType;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.is3D = true;\r\n texture._creationFlags = creationFlags;\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(texture, width, height, undefined, creationFlags);\r\n\r\n this.updateRawTexture3D(texture, data, format, invertY, compression, textureType);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n};\r\n\r\nThinWebGPUEngine.prototype.updateRawTexture3D = function (\r\n texture: InternalTexture,\r\n bufferView: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT\r\n): void {\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = bufferView;\r\n texture.format = format;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n\r\n if (bufferView) {\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n const needConversion = format === Constants.TEXTUREFORMAT_RGB;\r\n\r\n if (needConversion) {\r\n bufferView = _convertRGBtoRGBATextureData(bufferView, texture.width, texture.height, textureType);\r\n }\r\n\r\n const data = new Uint8Array(bufferView.buffer, bufferView.byteOffset, bufferView.byteLength);\r\n\r\n this._textureHelper.updateTexture(data, texture, texture.width, texture.height, texture.depth, gpuTextureWrapper.format, 0, 0, invertY, false, 0, 0);\r\n if (texture.generateMipMaps) {\r\n this._generateMipmaps(texture, this._uploadEncoder);\r\n }\r\n }\r\n\r\n texture.isReady = true;\r\n};\r\n\r\nThinWebGPUEngine.prototype.createRawTexture2DArray = function (\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags: number = 0\r\n): InternalTexture {\r\n const source = InternalTextureSource.Raw2DArray;\r\n const texture = new InternalTexture(this, source);\r\n\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.baseDepth = depth;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = depth;\r\n texture.format = format;\r\n texture.type = textureType;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.is2DArray = true;\r\n texture._creationFlags = creationFlags;\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n this._textureHelper.createGPUTextureForInternalTexture(texture, width, height, depth, creationFlags);\r\n\r\n this.updateRawTexture2DArray(texture, data, format, invertY, compression, textureType);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n};\r\n\r\nThinWebGPUEngine.prototype.updateRawTexture2DArray = function (\r\n texture: InternalTexture,\r\n bufferView: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_INT\r\n): void {\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = bufferView;\r\n texture.format = format;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n\r\n if (bufferView) {\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n const needConversion = format === Constants.TEXTUREFORMAT_RGB;\r\n\r\n if (needConversion) {\r\n bufferView = _convertRGBtoRGBATextureData(bufferView, texture.width, texture.height, textureType);\r\n }\r\n\r\n const data = new Uint8Array(bufferView.buffer, bufferView.byteOffset, bufferView.byteLength);\r\n\r\n this._textureHelper.updateTexture(data, texture, texture.width, texture.height, texture.depth, gpuTextureWrapper.format, 0, 0, invertY, false, 0, 0);\r\n if (texture.generateMipMaps) {\r\n this._generateMipmaps(texture, this._uploadEncoder);\r\n }\r\n }\r\n\r\n texture.isReady = true;\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _convertRGBtoRGBATextureData(rgbData: any, width: number, height: number, textureType: number): ArrayBufferView {\r\n // Create new RGBA data container.\r\n let rgbaData: any;\r\n let val1 = 1;\r\n if (textureType === Constants.TEXTURETYPE_FLOAT) {\r\n rgbaData = new Float32Array(width * height * 4);\r\n } else if (textureType === Constants.TEXTURETYPE_HALF_FLOAT) {\r\n rgbaData = new Uint16Array(width * height * 4);\r\n val1 = 15360; // 15360 is the encoding of 1 in half float\r\n } else if (textureType === Constants.TEXTURETYPE_UNSIGNED_INTEGER) {\r\n rgbaData = new Uint32Array(width * height * 4);\r\n } else {\r\n rgbaData = new Uint8Array(width * height * 4);\r\n }\r\n\r\n // Convert each pixel.\r\n for (let x = 0; x < width; x++) {\r\n for (let y = 0; y < height; y++) {\r\n const index = (y * width + x) * 3;\r\n const newIndex = (y * width + x) * 4;\r\n\r\n // Map Old Value to new value.\r\n rgbaData[newIndex + 0] = rgbData[index + 0];\r\n rgbaData[newIndex + 1] = rgbData[index + 1];\r\n rgbaData[newIndex + 2] = rgbData[index + 2];\r\n\r\n // Add fully opaque alpha channel.\r\n rgbaData[newIndex + 3] = val1;\r\n }\r\n }\r\n\r\n return rgbaData;\r\n}\r\n"]}
@@ -1,12 +1,12 @@
1
- import { WebGPUEngine } from "../../webgpuEngine.js";
2
- WebGPUEngine.prototype._readTexturePixels = function (texture, width, height, faceIndex = -1, level = 0, buffer = null, flushRenderer = true, noDataConversion = false, x = 0, y = 0) {
1
+ import { ThinWebGPUEngine } from "../../thinWebGPUEngine.js";
2
+ ThinWebGPUEngine.prototype._readTexturePixels = function (texture, width, height, faceIndex = -1, level = 0, buffer = null, flushRenderer = true, noDataConversion = false, x = 0, y = 0) {
3
3
  const gpuTextureWrapper = texture._hardwareTexture;
4
4
  if (flushRenderer) {
5
5
  this.flushFramebuffer();
6
6
  }
7
7
  return this._textureHelper.readPixels(gpuTextureWrapper.underlyingResource, x, y, width, height, gpuTextureWrapper.format, faceIndex, level, buffer, noDataConversion);
8
8
  };
9
- WebGPUEngine.prototype._readTexturePixelsSync = function () {
9
+ ThinWebGPUEngine.prototype._readTexturePixelsSync = function () {
10
10
  // eslint-disable-next-line no-throw-literal
11
11
  throw "_readTexturePixelsSync is unsupported in WebGPU!";
12
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"engine.readTexture.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.readTexture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAmClD,YAAY,CAAC,SAAS,CAAC,kBAAkB,GAAG,UACxC,OAAwB,EACxB,KAAa,EACb,MAAc,EACd,SAAS,GAAG,CAAC,CAAC,EACd,KAAK,GAAG,CAAC,EACT,SAAoC,IAAI,EACxC,aAAa,GAAG,IAAI,EACpB,gBAAgB,GAAG,KAAK,EACxB,CAAC,GAAG,CAAC,EACL,CAAC,GAAG,CAAC;IAEL,MAAM,iBAAiB,GAAG,OAAO,CAAC,gBAAyC,CAAC;IAE5E,IAAI,aAAa,EAAE;QACf,IAAI,CAAC,gBAAgB,EAAE,CAAC;KAC3B;IAED,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,iBAAiB,CAAC,kBAAmB,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAC5K,CAAC,CAAC;AAEF,YAAY,CAAC,SAAS,CAAC,sBAAsB,GAAG;IAC5C,4CAA4C;IAC5C,MAAM,kDAAkD,CAAC;AAC7D,CAAC,CAAC","sourcesContent":["import type { InternalTexture } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { WebGPUEngine } from \"../../webgpuEngine\";\r\nimport type { WebGPUHardwareTexture } from \"../webgpuHardwareTexture\";\r\n\r\ndeclare module \"../../abstractEngine\" {\r\n export interface AbstractEngine {\r\n /** @internal */\r\n _readTexturePixels(\r\n texture: InternalTexture,\r\n width: number,\r\n height: number,\r\n faceIndex?: number,\r\n level?: number,\r\n buffer?: Nullable<ArrayBufferView>,\r\n flushRenderer?: boolean,\r\n noDataConversion?: boolean,\r\n x?: number,\r\n y?: number\r\n ): Promise<ArrayBufferView>;\r\n\r\n /** @internal */\r\n _readTexturePixelsSync(\r\n texture: InternalTexture,\r\n width: number,\r\n height: number,\r\n faceIndex?: number,\r\n level?: number,\r\n buffer?: Nullable<ArrayBufferView>,\r\n flushRenderer?: boolean,\r\n noDataConversion?: boolean,\r\n x?: number,\r\n y?: number\r\n ): ArrayBufferView;\r\n }\r\n}\r\n\r\nWebGPUEngine.prototype._readTexturePixels = function (\r\n texture: InternalTexture,\r\n width: number,\r\n height: number,\r\n faceIndex = -1,\r\n level = 0,\r\n buffer: Nullable<ArrayBufferView> = null,\r\n flushRenderer = true,\r\n noDataConversion = false,\r\n x = 0,\r\n y = 0\r\n): Promise<ArrayBufferView> {\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n\r\n if (flushRenderer) {\r\n this.flushFramebuffer();\r\n }\r\n\r\n return this._textureHelper.readPixels(gpuTextureWrapper.underlyingResource!, x, y, width, height, gpuTextureWrapper.format, faceIndex, level, buffer, noDataConversion);\r\n};\r\n\r\nWebGPUEngine.prototype._readTexturePixelsSync = function (): ArrayBufferView {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"_readTexturePixelsSync is unsupported in WebGPU!\";\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.readTexture.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Engines/WebGPU/Extensions/engine.readTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kCAAsC;AAqCjE,gBAAgB,CAAC,SAAS,CAAC,kBAAkB,GAAG,UAC5C,OAAwB,EACxB,KAAa,EACb,MAAc,EACd,SAAS,GAAG,CAAC,CAAC,EACd,KAAK,GAAG,CAAC,EACT,SAAoC,IAAI,EACxC,aAAa,GAAG,IAAI,EACpB,gBAAgB,GAAG,KAAK,EACxB,CAAC,GAAG,CAAC,EACL,CAAC,GAAG,CAAC;IAEL,MAAM,iBAAiB,GAAG,OAAO,CAAC,gBAAyC,CAAC;IAE5E,IAAI,aAAa,EAAE;QACf,IAAI,CAAC,gBAAgB,EAAE,CAAC;KAC3B;IAED,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,iBAAiB,CAAC,kBAAmB,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAC5K,CAAC,CAAC;AAEF,gBAAgB,CAAC,SAAS,CAAC,sBAAsB,GAAG;IAChD,4CAA4C;IAC5C,MAAM,kDAAkD,CAAC;AAC7D,CAAC,CAAC","sourcesContent":["import { ThinWebGPUEngine } from \"core/Engines/thinWebGPUEngine\";\r\nimport type { InternalTexture } from \"../../../Materials/Textures/internalTexture\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport type { WebGPUHardwareTexture } from \"../webgpuHardwareTexture\";\r\n\r\ndeclare module \"../../abstractEngine\" {\r\n export interface AbstractEngine {\r\n /** @internal */\r\n _readTexturePixels(\r\n texture: InternalTexture,\r\n width: number,\r\n height: number,\r\n faceIndex?: number,\r\n level?: number,\r\n buffer?: Nullable<ArrayBufferView>,\r\n flushRenderer?: boolean,\r\n noDataConversion?: boolean,\r\n x?: number,\r\n y?: number\r\n ): Promise<ArrayBufferView>;\r\n\r\n /** @internal */\r\n _readTexturePixelsSync(\r\n texture: InternalTexture,\r\n width: number,\r\n height: number,\r\n faceIndex?: number,\r\n level?: number,\r\n buffer?: Nullable<ArrayBufferView>,\r\n flushRenderer?: boolean,\r\n noDataConversion?: boolean,\r\n x?: number,\r\n y?: number\r\n ): ArrayBufferView;\r\n }\r\n}\r\n\r\nThinWebGPUEngine.prototype._readTexturePixels = function (\r\n texture: InternalTexture,\r\n width: number,\r\n height: number,\r\n faceIndex = -1,\r\n level = 0,\r\n buffer: Nullable<ArrayBufferView> = null,\r\n flushRenderer = true,\r\n noDataConversion = false,\r\n x = 0,\r\n y = 0\r\n): Promise<ArrayBufferView> {\r\n const gpuTextureWrapper = texture._hardwareTexture as WebGPUHardwareTexture;\r\n\r\n if (flushRenderer) {\r\n this.flushFramebuffer();\r\n }\r\n\r\n return this._textureHelper.readPixels(gpuTextureWrapper.underlyingResource!, x, y, width, height, gpuTextureWrapper.format, faceIndex, level, buffer, noDataConversion);\r\n};\r\n\r\nThinWebGPUEngine.prototype._readTexturePixelsSync = function (): ArrayBufferView {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"_readTexturePixelsSync is unsupported in WebGPU!\";\r\n};\r\n"]}