@babylonjs/core 7.5.0 → 7.6.1

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 (230) hide show
  1. package/Audio/sound.js +3 -0
  2. package/Audio/sound.js.map +1 -1
  3. package/Bones/bone.js +1 -1
  4. package/Bones/bone.js.map +1 -1
  5. package/Buffers/storageBuffer.d.ts +2 -2
  6. package/Buffers/storageBuffer.js.map +1 -1
  7. package/Cameras/arcRotateCamera.js +3 -0
  8. package/Cameras/arcRotateCamera.js.map +1 -1
  9. package/Cameras/camera.js +1 -1
  10. package/Cameras/camera.js.map +1 -1
  11. package/Cameras/flyCamera.js +3 -0
  12. package/Cameras/flyCamera.js.map +1 -1
  13. package/Cameras/followCamera.js +4 -0
  14. package/Cameras/followCamera.js.map +1 -1
  15. package/Cameras/freeCamera.js +3 -0
  16. package/Cameras/freeCamera.js.map +1 -1
  17. package/Engines/Extensions/index.d.ts +0 -3
  18. package/Engines/Extensions/index.js +0 -3
  19. package/Engines/Extensions/index.js.map +1 -1
  20. package/Engines/WebGPU/Extensions/index.d.ts +0 -3
  21. package/Engines/WebGPU/Extensions/index.js +0 -3
  22. package/Engines/WebGPU/Extensions/index.js.map +1 -1
  23. package/Engines/abstractEngine.d.ts +0 -51
  24. package/Engines/abstractEngine.js +7 -3
  25. package/Engines/abstractEngine.js.map +1 -1
  26. package/Engines/engine.js +5 -2
  27. package/Engines/engine.js.map +1 -1
  28. package/Engines/nativeEngine.js +2 -2
  29. package/Engines/nativeEngine.js.map +1 -1
  30. package/Engines/thinEngine.functions.d.ts +0 -10
  31. package/Engines/thinEngine.functions.js +0 -19
  32. package/Engines/thinEngine.functions.js.map +1 -1
  33. package/Engines/thinEngine.js +18 -1
  34. package/Engines/thinEngine.js.map +1 -1
  35. package/Engines/webgpuEngine.d.ts +54 -2
  36. package/Engines/webgpuEngine.js +147 -0
  37. package/Engines/webgpuEngine.js.map +1 -1
  38. package/Inputs/scene.inputManager.d.ts +1 -0
  39. package/Inputs/scene.inputManager.js +1 -0
  40. package/Inputs/scene.inputManager.js.map +1 -1
  41. package/Lights/directionalLight.js +3 -0
  42. package/Lights/directionalLight.js.map +1 -1
  43. package/Lights/hemisphericLight.js +3 -0
  44. package/Lights/hemisphericLight.js.map +1 -1
  45. package/Lights/light.js +1 -1
  46. package/Lights/light.js.map +1 -1
  47. package/Lights/pointLight.js +3 -0
  48. package/Lights/pointLight.js.map +1 -1
  49. package/Lights/spotLight.js +3 -0
  50. package/Lights/spotLight.js.map +1 -1
  51. package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +1 -1
  52. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  53. package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +1 -1
  54. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  55. package/Materials/Node/Blocks/Dual/fogBlock.d.ts +1 -1
  56. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  57. package/Materials/Node/Blocks/Dual/imageSourceBlock.d.ts +1 -1
  58. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +9 -3
  59. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  60. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +1 -1
  61. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  62. package/Materials/Node/Blocks/Dual/sceneDepthBlock.d.ts +1 -1
  63. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  64. package/Materials/Node/Blocks/Dual/textureBlock.d.ts +2 -2
  65. package/Materials/Node/Blocks/Dual/textureBlock.js +13 -3
  66. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  67. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +1 -1
  68. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  69. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +1 -1
  70. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  71. package/Materials/Node/Blocks/Fragment/screenSizeBlock.d.ts +1 -1
  72. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  73. package/Materials/Node/Blocks/Fragment/shadowMapBlock.d.ts +1 -1
  74. package/Materials/Node/Blocks/Fragment/shadowMapBlock.js.map +1 -1
  75. package/Materials/Node/Blocks/Input/animatedInputBlockTypes.d.ts +2 -1
  76. package/Materials/Node/Blocks/Input/animatedInputBlockTypes.js +1 -0
  77. package/Materials/Node/Blocks/Input/animatedInputBlockTypes.js.map +1 -1
  78. package/Materials/Node/Blocks/Input/inputBlock.d.ts +1 -1
  79. package/Materials/Node/Blocks/Input/inputBlock.js +16 -0
  80. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  81. package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +1 -1
  82. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  83. package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +1 -1
  84. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  85. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +1 -1
  86. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  87. package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +1 -1
  88. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  89. package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +1 -1
  90. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  91. package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +1 -1
  92. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  93. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.d.ts +1 -1
  94. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
  95. package/Materials/Node/Blocks/baseMathBlock.js +2 -4
  96. package/Materials/Node/Blocks/baseMathBlock.js.map +1 -1
  97. package/Materials/Node/Blocks/triPlanarBlock.d.ts +1 -1
  98. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  99. package/Materials/Node/Blocks/trigonometryBlock.d.ts +3 -1
  100. package/Materials/Node/Blocks/trigonometryBlock.js +6 -0
  101. package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
  102. package/Materials/Node/nodeMaterial.d.ts +6 -3
  103. package/Materials/Node/nodeMaterial.js +9 -6
  104. package/Materials/Node/nodeMaterial.js.map +1 -1
  105. package/Materials/Node/nodeMaterialBlock.d.ts +1 -1
  106. package/Materials/Node/nodeMaterialBlock.js +1 -1
  107. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  108. package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +34 -14
  109. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +87 -9
  110. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  111. package/Materials/Node/nodeMaterialBuildState.d.ts +1 -1
  112. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  113. package/Materials/Textures/Loaders/ktxTextureLoader.js +1 -1
  114. package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
  115. package/Materials/Textures/htmlElementTexture.d.ts +0 -1
  116. package/Materials/Textures/htmlElementTexture.js +7 -2
  117. package/Materials/Textures/htmlElementTexture.js.map +1 -1
  118. package/Materials/Textures/videoTexture.js +4 -2
  119. package/Materials/Textures/videoTexture.js.map +1 -1
  120. package/Materials/effect.functions.d.ts +1 -1
  121. package/Materials/effect.functions.js +4 -4
  122. package/Materials/effect.functions.js.map +1 -1
  123. package/Materials/effect.js +1 -1
  124. package/Materials/effect.js.map +1 -1
  125. package/Materials/effect.webgl.functions.js +2 -2
  126. package/Materials/effect.webgl.functions.js.map +1 -1
  127. package/Materials/imageProcessingConfiguration.js +3 -0
  128. package/Materials/imageProcessingConfiguration.js.map +1 -1
  129. package/Materials/materialPluginBase.js +3 -0
  130. package/Materials/materialPluginBase.js.map +1 -1
  131. package/Materials/shaderMaterial.js +18 -8
  132. package/Materials/shaderMaterial.js.map +1 -1
  133. package/Maths/math.color.d.ts +85 -82
  134. package/Maths/math.color.js +34 -27
  135. package/Maths/math.color.js.map +1 -1
  136. package/Maths/math.vector.d.ts +202 -202
  137. package/Maths/math.vector.js +133 -130
  138. package/Maths/math.vector.js.map +1 -1
  139. package/Maths/tensor.d.ts +44 -42
  140. package/Maths/tensor.js.map +1 -1
  141. package/Meshes/Compression/dracoCompression.d.ts +7 -0
  142. package/Meshes/Compression/dracoCompression.js +14 -0
  143. package/Meshes/Compression/dracoCompression.js.map +1 -1
  144. package/Meshes/instancedMesh.js +3 -0
  145. package/Meshes/instancedMesh.js.map +1 -1
  146. package/Meshes/transformNode.js +1 -1
  147. package/Meshes/transformNode.js.map +1 -1
  148. package/Misc/dumpTools.js +11 -0
  149. package/Misc/dumpTools.js.map +1 -1
  150. package/Misc/fileTools.d.ts +9 -9
  151. package/Misc/fileTools.js +17 -15
  152. package/Misc/fileTools.js.map +1 -1
  153. package/Misc/tools.d.ts +5 -0
  154. package/Misc/tools.js +9 -0
  155. package/Misc/tools.js.map +1 -1
  156. package/Misc/typeStore.d.ts +4 -0
  157. package/Misc/typeStore.js +11 -0
  158. package/Misc/typeStore.js.map +1 -1
  159. package/NOTICE.md +8 -0
  160. package/Particles/baseParticleSystem.js +3 -0
  161. package/Particles/baseParticleSystem.js.map +1 -1
  162. package/Particles/computeShaderParticleSystem.d.ts +2 -2
  163. package/Particles/computeShaderParticleSystem.js.map +1 -1
  164. package/Physics/v1/Plugins/ammoJSPlugin.js +39 -10
  165. package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
  166. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +3 -0
  167. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  168. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +4 -0
  169. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  170. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +7 -0
  171. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +40 -20
  172. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  173. package/Rendering/prePassRenderer.js +3 -0
  174. package/Rendering/prePassRenderer.js.map +1 -1
  175. package/Shaders/ShadersInclude/screenSpaceRayTrace.js +8 -0
  176. package/Shaders/ShadersInclude/screenSpaceRayTrace.js.map +1 -1
  177. package/Shaders/fluidRenderingRender.fragment.js +11 -2
  178. package/Shaders/fluidRenderingRender.fragment.js.map +1 -1
  179. package/Shaders/screenSpaceReflection2.fragment.js +7 -1
  180. package/Shaders/screenSpaceReflection2.fragment.js.map +1 -1
  181. package/Shaders/sprites.fragment.d.ts +2 -0
  182. package/Shaders/sprites.fragment.js +8 -1
  183. package/Shaders/sprites.fragment.js.map +1 -1
  184. package/Shaders/sprites.vertex.d.ts +2 -0
  185. package/Shaders/sprites.vertex.js +4 -0
  186. package/Shaders/sprites.vertex.js.map +1 -1
  187. package/Shaders/ssao2.fragment.js +1 -1
  188. package/Shaders/ssao2.fragment.js.map +1 -1
  189. package/Sprites/spriteManager.d.ts +3 -0
  190. package/Sprites/spriteManager.js +11 -0
  191. package/Sprites/spriteManager.js.map +1 -1
  192. package/Sprites/spriteRenderer.d.ts +11 -3
  193. package/Sprites/spriteRenderer.js +49 -32
  194. package/Sprites/spriteRenderer.js.map +1 -1
  195. package/XR/features/WebXRNearInteraction.d.ts +6 -0
  196. package/XR/features/WebXRNearInteraction.js +14 -2
  197. package/XR/features/WebXRNearInteraction.js.map +1 -1
  198. package/XR/webXRManagedOutputCanvas.d.ts +2 -0
  199. package/XR/webXRManagedOutputCanvas.js +14 -6
  200. package/XR/webXRManagedOutputCanvas.js.map +1 -1
  201. package/abstractScene.js +3 -0
  202. package/abstractScene.js.map +1 -1
  203. package/assets/glslang/glslang.js +113 -0
  204. package/assets/glslang/glslang.wasm +0 -0
  205. package/assets/twgsl/twgsl.js +53 -0
  206. package/assets/twgsl/twgsl.wasm +0 -0
  207. package/node.d.ts +2 -1
  208. package/node.js +5 -1
  209. package/node.js.map +1 -1
  210. package/package.json +1 -1
  211. package/scene.js +3 -0
  212. package/scene.js.map +1 -1
  213. package/Engines/Extensions/engine.externalTexture.d.ts +0 -18
  214. package/Engines/Extensions/engine.externalTexture.js +0 -10
  215. package/Engines/Extensions/engine.externalTexture.js.map +0 -1
  216. package/Engines/Extensions/engine.storageBuffer.d.ts +0 -39
  217. package/Engines/Extensions/engine.storageBuffer.js +0 -16
  218. package/Engines/Extensions/engine.storageBuffer.js.map +0 -1
  219. package/Engines/Extensions/engine.textureSampler.d.ts +0 -12
  220. package/Engines/Extensions/engine.textureSampler.js +0 -6
  221. package/Engines/Extensions/engine.textureSampler.js.map +0 -1
  222. package/Engines/WebGPU/Extensions/engine.externalTexture.d.ts +0 -28
  223. package/Engines/WebGPU/Extensions/engine.externalTexture.js +0 -18
  224. package/Engines/WebGPU/Extensions/engine.externalTexture.js.map +0 -1
  225. package/Engines/WebGPU/Extensions/engine.storageBuffer.d.ts +0 -50
  226. package/Engines/WebGPU/Extensions/engine.storageBuffer.js +0 -88
  227. package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +0 -1
  228. package/Engines/WebGPU/Extensions/engine.textureSampler.d.ts +0 -22
  229. package/Engines/WebGPU/Extensions/engine.textureSampler.js +0 -9
  230. package/Engines/WebGPU/Extensions/engine.textureSampler.js.map +0 -1
@@ -78,16 +78,6 @@ export declare function _finalizePipelineContext(pipelineContext: WebGLPipelineC
78
78
  * @internal
79
79
  */
80
80
  export declare function _preparePipelineContext(pipelineContext: IPipelineContext, vertexSourceCode: string, fragmentSourceCode: string, createAsRaw: boolean, _rawVertexSourceCode: string, _rawFragmentSourceCode: string, rebuildRebind: any, defines: Nullable<string>, transformFeedbackVaryings: Nullable<string[]>, _key?: string, createRawShaderProgramInjection?: typeof createRawShaderProgram, createShaderProgramInjection?: typeof createShaderProgram): void;
81
- /**
82
- * Binds an effect to the webGL context
83
- * @param pipelineContext defines the pipeline context to use
84
- * @param samplers defines the list of webGL samplers to bind
85
- * @param uniforms defines the list of webGL uniforms to bind
86
- * @returns the webGL program
87
- */
88
- export declare function bindSamplers(pipelineContext: IPipelineContext, samplers: string[], uniforms: {
89
- [key: string]: Nullable<WebGLUniformLocation>;
90
- }): Nullable<WebGLUniformLocation>[];
91
81
  /**
92
82
  * @internal
93
83
  */
@@ -206,25 +206,6 @@ function _compileRawShader(source, type, gl, _contextWasLost) {
206
206
  gl.compileShader(shader);
207
207
  return shader;
208
208
  }
209
- /**
210
- * Binds an effect to the webGL context
211
- * @param pipelineContext defines the pipeline context to use
212
- * @param samplers defines the list of webGL samplers to bind
213
- * @param uniforms defines the list of webGL uniforms to bind
214
- * @returns the webGL program
215
- */
216
- export function bindSamplers(pipelineContext, samplers, uniforms) {
217
- const webGLPipelineContext = pipelineContext;
218
- _setProgram(webGLPipelineContext.program, webGLPipelineContext.context);
219
- const _boundUniforms = [];
220
- for (let index = 0; index < samplers.length; index++) {
221
- const uniform = uniforms[samplers[index]];
222
- if (uniform) {
223
- _boundUniforms[index] = uniform;
224
- }
225
- }
226
- return _boundUniforms;
227
- }
228
209
  /**
229
210
  * @internal
230
211
  */
@@ -1 +1 @@
1
- {"version":3,"file":"thinEngine.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/thinEngine.functions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAiBhE;;GAEG;AACH,MAAM,YAAY,GAAkD,IAAI,OAAO,EAAE,CAAC;AAElF;;GAEG;AACH,MAAM,iBAAiB,GAA2B;IAC9C,aAAa,EAAE,CAAC;IACh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,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAE1C,IAAI,OAAO,EAAE;YACT,cAAc,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;SACnC;KACJ;IACD,OAAO,cAAc,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAAqB,EAAE,EAAgB;IAC/D,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oCAAoC,CAAC,eAAiC,EAAE,MAAoD;IACxI,MAAM,oBAAoB,GAAG,eAAuC,CAAC;IAErE,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,EAAE;QAC1C,MAAM,CAAC,eAAe,CAAC,CAAC;QACxB,OAAO;KACV;IAED,MAAM,UAAU,GAAG,oBAAoB,CAAC,UAAU,CAAC;IAEnD,oBAAoB,CAAC,UAAU,GAAG,GAAG,EAAE;QACnC,UAAU,EAAE,EAAE,CAAC;QACf,MAAM,CAAC,eAAe,CAAC,CAAC;IAC5B,CAAC,CAAC;AACN,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { IPipelineContext } from \"./IPipelineContext\";\r\nimport type { ShaderProcessingContext } from \"./Processors/shaderProcessingOptions\";\r\nimport { WebGLPipelineContext } from \"./WebGL/webGLPipelineContext\";\r\nimport type { _loadFile } from \"./abstractEngine.functions\";\r\nimport { _ConcatenateShader } from \"./abstractEngine.functions\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface IThinEngineStateObject {\r\n _contextWasLost?: boolean;\r\n validateShaderPrograms?: boolean;\r\n _webGLVersion: number;\r\n parallelShaderCompile?: { COMPLETION_STATUS_KHR: number };\r\n _context?: WebGLContext;\r\n _createShaderProgramInjection?: typeof _createShaderProgram;\r\n createRawShaderProgramInjection?: typeof createRawShaderProgram;\r\n createShaderProgramInjection?: typeof createShaderProgram;\r\n loadFileInjection?: typeof _loadFile;\r\n cachedPipelines: { [name: string]: IPipelineContext };\r\n}\r\n/**\r\n * @internal\r\n */\r\nconst _stateObject: WeakMap<WebGLContext, IThinEngineStateObject> = new WeakMap();\r\n\r\n/**\r\n * This will be used in cases where the engine doesn't have a context (like the nullengine)\r\n */\r\nconst singleStateObject: IThinEngineStateObject = {\r\n _webGLVersion: 2,\r\n cachedPipelines: {},\r\n};\r\n\r\n/**\r\n * get or create a state object for the given context\r\n * Note - Used in WebGL only at the moment.\r\n * @param context The context to get the state object from\r\n * @returns the state object\r\n * @internal\r\n */\r\nexport function getStateObject(context: WebGLContext): IThinEngineStateObject {\r\n let state = _stateObject.get(context);\r\n if (!state) {\r\n if (!context) {\r\n return singleStateObject;\r\n }\r\n state = {\r\n // use feature detection. instanceof returns false. This only exists on WebGL2 context\r\n _webGLVersion: (context as WebGL2RenderingContext).TEXTURE_BINDING_3D ? 2 : 1,\r\n _context: context,\r\n cachedPipelines: {},\r\n };\r\n _stateObject.set(context, state);\r\n }\r\n return state;\r\n}\r\n/**\r\n * Remove the state object that belongs to the specific context\r\n * @param context the context that is being\r\n */\r\nexport function deleteStateObject(context: WebGLContext): void {\r\n _stateObject.delete(context);\r\n}\r\n\r\nexport type WebGLContext = WebGLRenderingContext | WebGL2RenderingContext;\r\n/**\r\n * Directly creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @param _createShaderProgramInjection defines an optional injection to use to create the shader program\r\n * @returns the new webGL program\r\n */\r\nexport function createRawShaderProgram(\r\n pipelineContext: IPipelineContext,\r\n vertexCode: string,\r\n fragmentCode: string,\r\n context: WebGLContext,\r\n transformFeedbackVaryings: Nullable<string[]>,\r\n _createShaderProgramInjection?: typeof _createShaderProgram\r\n): WebGLProgram {\r\n const stateObject = getStateObject(context);\r\n if (!_createShaderProgramInjection) {\r\n _createShaderProgramInjection = stateObject._createShaderProgramInjection ?? _createShaderProgram;\r\n }\r\n\r\n const vertexShader = _compileRawShader(vertexCode, \"vertex\", context, stateObject._contextWasLost);\r\n const fragmentShader = _compileRawShader(fragmentCode, \"fragment\", context, stateObject._contextWasLost);\r\n\r\n return _createShaderProgramInjection(\r\n pipelineContext as WebGLPipelineContext,\r\n vertexShader,\r\n fragmentShader,\r\n context,\r\n transformFeedbackVaryings,\r\n stateObject.validateShaderPrograms\r\n );\r\n}\r\n\r\n/**\r\n * Creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @param _createShaderProgramInjection defines an optional injection to use to create the shader program\r\n * @returns the new webGL program\r\n */\r\nexport function createShaderProgram(\r\n pipelineContext: IPipelineContext,\r\n vertexCode: string,\r\n fragmentCode: string,\r\n defines: Nullable<string>,\r\n context: WebGLContext,\r\n transformFeedbackVaryings: Nullable<string[]> = null,\r\n _createShaderProgramInjection?: typeof _createShaderProgram\r\n): WebGLProgram {\r\n const stateObject = getStateObject(context);\r\n if (!_createShaderProgramInjection) {\r\n _createShaderProgramInjection = stateObject._createShaderProgramInjection ?? _createShaderProgram;\r\n }\r\n const shaderVersion = stateObject._webGLVersion > 1 ? \"#version 300 es\\n#define WEBGL2 \\n\" : \"\";\r\n const vertexShader = _compileShader(vertexCode, \"vertex\", defines, shaderVersion, context, stateObject._contextWasLost);\r\n const fragmentShader = _compileShader(fragmentCode, \"fragment\", defines, shaderVersion, context, stateObject._contextWasLost);\r\n\r\n return _createShaderProgramInjection(\r\n pipelineContext as WebGLPipelineContext,\r\n vertexShader,\r\n fragmentShader,\r\n context,\r\n transformFeedbackVaryings,\r\n stateObject.validateShaderPrograms\r\n );\r\n}\r\n\r\n/**\r\n * Creates a new pipeline context. Note, make sure to attach an engine instance to the created context\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param _shaderProcessingContext defines the shader processing context used during the processing if available\r\n * @returns the new pipeline\r\n */\r\nexport function createPipelineContext(context: WebGLContext, _shaderProcessingContext: Nullable<ShaderProcessingContext>): IPipelineContext {\r\n const pipelineContext = new WebGLPipelineContext();\r\n const stateObject = getStateObject(context);\r\n if (stateObject.parallelShaderCompile) {\r\n pipelineContext.isParallelCompiled = true;\r\n }\r\n pipelineContext.context = stateObject._context;\r\n return pipelineContext;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _createShaderProgram(\r\n pipelineContext: WebGLPipelineContext,\r\n vertexShader: WebGLShader,\r\n fragmentShader: WebGLShader,\r\n context: WebGLContext,\r\n _transformFeedbackVaryings: Nullable<string[]> = null,\r\n validateShaderPrograms?: boolean\r\n): WebGLProgram {\r\n const shaderProgram = context.createProgram();\r\n pipelineContext.program = shaderProgram;\r\n\r\n if (!shaderProgram) {\r\n throw new Error(\"Unable to create program\");\r\n }\r\n\r\n context.attachShader(shaderProgram, vertexShader);\r\n context.attachShader(shaderProgram, fragmentShader);\r\n\r\n context.linkProgram(shaderProgram);\r\n\r\n pipelineContext.context = context;\r\n pipelineContext.vertexShader = vertexShader;\r\n pipelineContext.fragmentShader = fragmentShader;\r\n\r\n if (!pipelineContext.isParallelCompiled) {\r\n _finalizePipelineContext(pipelineContext, context, validateShaderPrograms);\r\n }\r\n\r\n return shaderProgram;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _finalizePipelineContext(pipelineContext: WebGLPipelineContext, gl: WebGLContext, validateShaderPrograms?: boolean) {\r\n const context = pipelineContext.context!;\r\n const vertexShader = pipelineContext.vertexShader!;\r\n const fragmentShader = pipelineContext.fragmentShader!;\r\n const program = pipelineContext.program!;\r\n\r\n const linked = context.getProgramParameter(program, context.LINK_STATUS);\r\n if (!linked) {\r\n // Get more info\r\n // Vertex\r\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {\r\n const log = gl.getShaderInfoLog(vertexShader);\r\n if (log) {\r\n pipelineContext.vertexCompilationError = log;\r\n throw new Error(\"VERTEX SHADER \" + log);\r\n }\r\n }\r\n\r\n // Fragment\r\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {\r\n const log = gl.getShaderInfoLog(fragmentShader);\r\n if (log) {\r\n pipelineContext.fragmentCompilationError = log;\r\n throw new Error(\"FRAGMENT SHADER \" + log);\r\n }\r\n }\r\n\r\n const error = context.getProgramInfoLog(program);\r\n if (error) {\r\n pipelineContext.programLinkError = error;\r\n throw new Error(error);\r\n }\r\n }\r\n\r\n if (/*this.*/ validateShaderPrograms) {\r\n context.validateProgram(program);\r\n const validated = context.getProgramParameter(program, context.VALIDATE_STATUS);\r\n\r\n if (!validated) {\r\n const error = context.getProgramInfoLog(program);\r\n if (error) {\r\n pipelineContext.programValidationError = error;\r\n throw new Error(error);\r\n }\r\n }\r\n }\r\n\r\n context.deleteShader(vertexShader);\r\n context.deleteShader(fragmentShader);\r\n\r\n pipelineContext.vertexShader = undefined;\r\n pipelineContext.fragmentShader = undefined;\r\n\r\n if (pipelineContext.onCompiled) {\r\n pipelineContext.onCompiled();\r\n pipelineContext.onCompiled = undefined;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _preparePipelineContext(\r\n pipelineContext: IPipelineContext,\r\n vertexSourceCode: string,\r\n fragmentSourceCode: string,\r\n createAsRaw: boolean,\r\n _rawVertexSourceCode: string,\r\n _rawFragmentSourceCode: string,\r\n rebuildRebind: any,\r\n defines: Nullable<string>,\r\n transformFeedbackVaryings: Nullable<string[]>,\r\n _key: string = \"\",\r\n createRawShaderProgramInjection?: typeof createRawShaderProgram,\r\n createShaderProgramInjection?: typeof createShaderProgram\r\n) {\r\n const stateObject = getStateObject((pipelineContext as WebGLPipelineContext).context!);\r\n if (!createRawShaderProgramInjection) {\r\n createRawShaderProgramInjection = stateObject.createRawShaderProgramInjection ?? createRawShaderProgram;\r\n }\r\n if (!createShaderProgramInjection) {\r\n createShaderProgramInjection = stateObject.createShaderProgramInjection ?? createShaderProgram;\r\n }\r\n const webGLRenderingState = pipelineContext as WebGLPipelineContext;\r\n\r\n if (createAsRaw) {\r\n webGLRenderingState.program = createRawShaderProgramInjection(\r\n webGLRenderingState,\r\n vertexSourceCode,\r\n fragmentSourceCode,\r\n webGLRenderingState.context!,\r\n transformFeedbackVaryings\r\n );\r\n } else {\r\n webGLRenderingState.program = createShaderProgramInjection(\r\n webGLRenderingState,\r\n vertexSourceCode,\r\n fragmentSourceCode,\r\n defines,\r\n webGLRenderingState.context!,\r\n transformFeedbackVaryings\r\n );\r\n }\r\n webGLRenderingState.program.__SPECTOR_rebuildProgram = rebuildRebind;\r\n}\r\n\r\nfunction _compileShader(source: string, type: string, defines: Nullable<string>, shaderVersion: string, gl: WebGLContext, _contextWasLost?: boolean): WebGLShader {\r\n return _compileRawShader(_ConcatenateShader(source, defines, shaderVersion), type, gl, _contextWasLost);\r\n}\r\n\r\nfunction _compileRawShader(source: string, type: string, gl: WebGLContext, _contextWasLost?: boolean): WebGLShader {\r\n const shader = gl.createShader(type === \"vertex\" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);\r\n\r\n if (!shader) {\r\n let error: GLenum = gl.NO_ERROR;\r\n let tempError: GLenum = gl.NO_ERROR;\r\n while ((tempError = gl.getError()) !== gl.NO_ERROR) {\r\n error = tempError;\r\n }\r\n\r\n throw new Error(\r\n `Something went wrong while creating a gl ${type} shader object. gl error=${error}, gl isContextLost=${gl.isContextLost()}, _contextWasLost=${_contextWasLost}`\r\n );\r\n }\r\n\r\n gl.shaderSource(shader, source);\r\n gl.compileShader(shader);\r\n\r\n return shader;\r\n}\r\n\r\n/**\r\n * Binds an effect to the webGL context\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param samplers defines the list of webGL samplers to bind\r\n * @param uniforms defines the list of webGL uniforms to bind\r\n * @returns the webGL program\r\n */\r\nexport function bindSamplers(\r\n pipelineContext: IPipelineContext,\r\n samplers: string[],\r\n uniforms: {\r\n [key: string]: Nullable<WebGLUniformLocation>;\r\n }\r\n) {\r\n const webGLPipelineContext = pipelineContext as WebGLPipelineContext;\r\n _setProgram(webGLPipelineContext.program!, webGLPipelineContext.context!);\r\n const _boundUniforms: Nullable<WebGLUniformLocation>[] = [];\r\n for (let index = 0; index < samplers.length; index++) {\r\n const uniform = uniforms[samplers[index]];\r\n\r\n if (uniform) {\r\n _boundUniforms[index] = uniform;\r\n }\r\n }\r\n return _boundUniforms;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _setProgram(program: WebGLProgram, gl: WebGLContext): void {\r\n gl.useProgram(program);\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _executeWhenRenderingStateIsCompiled(pipelineContext: IPipelineContext, action: (pipelineContext?: IPipelineContext) => void) {\r\n const webGLPipelineContext = pipelineContext as WebGLPipelineContext;\r\n\r\n if (!webGLPipelineContext.isParallelCompiled) {\r\n action(pipelineContext);\r\n return;\r\n }\r\n\r\n const oldHandler = webGLPipelineContext.onCompiled;\r\n\r\n webGLPipelineContext.onCompiled = () => {\r\n oldHandler?.();\r\n action(pipelineContext);\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"thinEngine.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/thinEngine.functions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAiBhE;;GAEG;AACH,MAAM,YAAY,GAAkD,IAAI,OAAO,EAAE,CAAC;AAElF;;GAEG;AACH,MAAM,iBAAiB,GAA2B;IAC9C,aAAa,EAAE,CAAC;IAChB,eAAe,EAAE,EAAE;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,M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AAC,UAAU,GAAG,GAAG,EAAE;QACnC,UAAU,EAAE,EAAE,CAAC;QACf,MAAM,CAAC,eAAe,CAAC,CAAC;IAC5B,CAAC,CAAC;AACN,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { IPipelineContext } from \"./IPipelineContext\";\r\nimport type { ShaderProcessingContext } from \"./Processors/shaderProcessingOptions\";\r\nimport { WebGLPipelineContext } from \"./WebGL/webGLPipelineContext\";\r\nimport type { _loadFile } from \"./abstractEngine.functions\";\r\nimport { _ConcatenateShader } from \"./abstractEngine.functions\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface IThinEngineStateObject {\r\n _contextWasLost?: boolean;\r\n validateShaderPrograms?: boolean;\r\n _webGLVersion: number;\r\n parallelShaderCompile?: { COMPLETION_STATUS_KHR: number };\r\n _context?: WebGLContext;\r\n _createShaderProgramInjection?: typeof _createShaderProgram;\r\n createRawShaderProgramInjection?: typeof createRawShaderProgram;\r\n createShaderProgramInjection?: typeof createShaderProgram;\r\n loadFileInjection?: typeof _loadFile;\r\n cachedPipelines: { [name: string]: IPipelineContext };\r\n}\r\n/**\r\n * @internal\r\n */\r\nconst _stateObject: WeakMap<WebGLContext, IThinEngineStateObject> = new WeakMap();\r\n\r\n/**\r\n * This will be used in cases where the engine doesn't have a context (like the nullengine)\r\n */\r\nconst singleStateObject: IThinEngineStateObject = {\r\n _webGLVersion: 2,\r\n cachedPipelines: {},\r\n};\r\n\r\n/**\r\n * get or create a state object for the given context\r\n * Note - Used in WebGL only at the moment.\r\n * @param context The context to get the state object from\r\n * @returns the state object\r\n * @internal\r\n */\r\nexport function getStateObject(context: WebGLContext): IThinEngineStateObject {\r\n let state = _stateObject.get(context);\r\n if (!state) {\r\n if (!context) {\r\n return singleStateObject;\r\n }\r\n state = {\r\n // use feature detection. instanceof returns false. This only exists on WebGL2 context\r\n _webGLVersion: (context as WebGL2RenderingContext).TEXTURE_BINDING_3D ? 2 : 1,\r\n _context: context,\r\n cachedPipelines: {},\r\n };\r\n _stateObject.set(context, state);\r\n }\r\n return state;\r\n}\r\n/**\r\n * Remove the state object that belongs to the specific context\r\n * @param context the context that is being\r\n */\r\nexport function deleteStateObject(context: WebGLContext): void {\r\n _stateObject.delete(context);\r\n}\r\n\r\nexport type WebGLContext = WebGLRenderingContext | WebGL2RenderingContext;\r\n/**\r\n * Directly creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @param _createShaderProgramInjection defines an optional injection to use to create the shader program\r\n * @returns the new webGL program\r\n */\r\nexport function createRawShaderProgram(\r\n pipelineContext: IPipelineContext,\r\n vertexCode: string,\r\n fragmentCode: string,\r\n context: WebGLContext,\r\n transformFeedbackVaryings: Nullable<string[]>,\r\n _createShaderProgramInjection?: typeof _createShaderProgram\r\n): WebGLProgram {\r\n const stateObject = getStateObject(context);\r\n if (!_createShaderProgramInjection) {\r\n _createShaderProgramInjection = stateObject._createShaderProgramInjection ?? _createShaderProgram;\r\n }\r\n\r\n const vertexShader = _compileRawShader(vertexCode, \"vertex\", context, stateObject._contextWasLost);\r\n const fragmentShader = _compileRawShader(fragmentCode, \"fragment\", context, stateObject._contextWasLost);\r\n\r\n return _createShaderProgramInjection(\r\n pipelineContext as WebGLPipelineContext,\r\n vertexShader,\r\n fragmentShader,\r\n context,\r\n transformFeedbackVaryings,\r\n stateObject.validateShaderPrograms\r\n );\r\n}\r\n\r\n/**\r\n * Creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @param _createShaderProgramInjection defines an optional injection to use to create the shader program\r\n * @returns the new webGL program\r\n */\r\nexport function createShaderProgram(\r\n pipelineContext: IPipelineContext,\r\n vertexCode: string,\r\n fragmentCode: string,\r\n defines: Nullable<string>,\r\n context: WebGLContext,\r\n transformFeedbackVaryings: Nullable<string[]> = null,\r\n _createShaderProgramInjection?: typeof _createShaderProgram\r\n): WebGLProgram {\r\n const stateObject = getStateObject(context);\r\n if (!_createShaderProgramInjection) {\r\n _createShaderProgramInjection = stateObject._createShaderProgramInjection ?? _createShaderProgram;\r\n }\r\n const shaderVersion = stateObject._webGLVersion > 1 ? \"#version 300 es\\n#define WEBGL2 \\n\" : \"\";\r\n const vertexShader = _compileShader(vertexCode, \"vertex\", defines, shaderVersion, context, stateObject._contextWasLost);\r\n const fragmentShader = _compileShader(fragmentCode, \"fragment\", defines, shaderVersion, context, stateObject._contextWasLost);\r\n\r\n return _createShaderProgramInjection(\r\n pipelineContext as WebGLPipelineContext,\r\n vertexShader,\r\n fragmentShader,\r\n context,\r\n transformFeedbackVaryings,\r\n stateObject.validateShaderPrograms\r\n );\r\n}\r\n\r\n/**\r\n * Creates a new pipeline context. Note, make sure to attach an engine instance to the created context\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param _shaderProcessingContext defines the shader processing context used during the processing if available\r\n * @returns the new pipeline\r\n */\r\nexport function createPipelineContext(context: WebGLContext, _shaderProcessingContext: Nullable<ShaderProcessingContext>): IPipelineContext {\r\n const pipelineContext = new WebGLPipelineContext();\r\n const stateObject = getStateObject(context);\r\n if (stateObject.parallelShaderCompile) {\r\n pipelineContext.isParallelCompiled = true;\r\n }\r\n pipelineContext.context = stateObject._context;\r\n return pipelineContext;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _createShaderProgram(\r\n pipelineContext: WebGLPipelineContext,\r\n vertexShader: WebGLShader,\r\n fragmentShader: WebGLShader,\r\n context: WebGLContext,\r\n _transformFeedbackVaryings: Nullable<string[]> = null,\r\n validateShaderPrograms?: boolean\r\n): WebGLProgram {\r\n const shaderProgram = context.createProgram();\r\n pipelineContext.program = shaderProgram;\r\n\r\n if (!shaderProgram) {\r\n throw new Error(\"Unable to create program\");\r\n }\r\n\r\n context.attachShader(shaderProgram, vertexShader);\r\n context.attachShader(shaderProgram, fragmentShader);\r\n\r\n context.linkProgram(shaderProgram);\r\n\r\n pipelineContext.context = context;\r\n pipelineContext.vertexShader = vertexShader;\r\n pipelineContext.fragmentShader = fragmentShader;\r\n\r\n if (!pipelineContext.isParallelCompiled) {\r\n _finalizePipelineContext(pipelineContext, context, validateShaderPrograms);\r\n }\r\n\r\n return shaderProgram;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _finalizePipelineContext(pipelineContext: WebGLPipelineContext, gl: WebGLContext, validateShaderPrograms?: boolean) {\r\n const context = pipelineContext.context!;\r\n const vertexShader = pipelineContext.vertexShader!;\r\n const fragmentShader = pipelineContext.fragmentShader!;\r\n const program = pipelineContext.program!;\r\n\r\n const linked = context.getProgramParameter(program, context.LINK_STATUS);\r\n if (!linked) {\r\n // Get more info\r\n // Vertex\r\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {\r\n const log = gl.getShaderInfoLog(vertexShader);\r\n if (log) {\r\n pipelineContext.vertexCompilationError = log;\r\n throw new Error(\"VERTEX SHADER \" + log);\r\n }\r\n }\r\n\r\n // Fragment\r\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {\r\n const log = gl.getShaderInfoLog(fragmentShader);\r\n if (log) {\r\n pipelineContext.fragmentCompilationError = log;\r\n throw new Error(\"FRAGMENT SHADER \" + log);\r\n }\r\n }\r\n\r\n const error = context.getProgramInfoLog(program);\r\n if (error) {\r\n pipelineContext.programLinkError = error;\r\n throw new Error(error);\r\n }\r\n }\r\n\r\n if (/*this.*/ validateShaderPrograms) {\r\n context.validateProgram(program);\r\n const validated = context.getProgramParameter(program, context.VALIDATE_STATUS);\r\n\r\n if (!validated) {\r\n const error = context.getProgramInfoLog(program);\r\n if (error) {\r\n pipelineContext.programValidationError = error;\r\n throw new Error(error);\r\n }\r\n }\r\n }\r\n\r\n context.deleteShader(vertexShader);\r\n context.deleteShader(fragmentShader);\r\n\r\n pipelineContext.vertexShader = undefined;\r\n pipelineContext.fragmentShader = undefined;\r\n\r\n if (pipelineContext.onCompiled) {\r\n pipelineContext.onCompiled();\r\n pipelineContext.onCompiled = undefined;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _preparePipelineContext(\r\n pipelineContext: IPipelineContext,\r\n vertexSourceCode: string,\r\n fragmentSourceCode: string,\r\n createAsRaw: boolean,\r\n _rawVertexSourceCode: string,\r\n _rawFragmentSourceCode: string,\r\n rebuildRebind: any,\r\n defines: Nullable<string>,\r\n transformFeedbackVaryings: Nullable<string[]>,\r\n _key: string = \"\",\r\n createRawShaderProgramInjection?: typeof createRawShaderProgram,\r\n createShaderProgramInjection?: typeof createShaderProgram\r\n) {\r\n const stateObject = getStateObject((pipelineContext as WebGLPipelineContext).context!);\r\n if (!createRawShaderProgramInjection) {\r\n createRawShaderProgramInjection = stateObject.createRawShaderProgramInjection ?? createRawShaderProgram;\r\n }\r\n if (!createShaderProgramInjection) {\r\n createShaderProgramInjection = stateObject.createShaderProgramInjection ?? createShaderProgram;\r\n }\r\n const webGLRenderingState = pipelineContext as WebGLPipelineContext;\r\n\r\n if (createAsRaw) {\r\n webGLRenderingState.program = createRawShaderProgramInjection(\r\n webGLRenderingState,\r\n vertexSourceCode,\r\n fragmentSourceCode,\r\n webGLRenderingState.context!,\r\n transformFeedbackVaryings\r\n );\r\n } else {\r\n webGLRenderingState.program = createShaderProgramInjection(\r\n webGLRenderingState,\r\n vertexSourceCode,\r\n fragmentSourceCode,\r\n defines,\r\n webGLRenderingState.context!,\r\n transformFeedbackVaryings\r\n );\r\n }\r\n webGLRenderingState.program.__SPECTOR_rebuildProgram = rebuildRebind;\r\n}\r\n\r\nfunction _compileShader(source: string, type: string, defines: Nullable<string>, shaderVersion: string, gl: WebGLContext, _contextWasLost?: boolean): WebGLShader {\r\n return _compileRawShader(_ConcatenateShader(source, defines, shaderVersion), type, gl, _contextWasLost);\r\n}\r\n\r\nfunction _compileRawShader(source: string, type: string, gl: WebGLContext, _contextWasLost?: boolean): WebGLShader {\r\n const shader = gl.createShader(type === \"vertex\" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);\r\n\r\n if (!shader) {\r\n let error: GLenum = gl.NO_ERROR;\r\n let tempError: GLenum = gl.NO_ERROR;\r\n while ((tempError = gl.getError()) !== gl.NO_ERROR) {\r\n error = tempError;\r\n }\r\n\r\n throw new Error(\r\n `Something went wrong while creating a gl ${type} shader object. gl error=${error}, gl isContextLost=${gl.isContextLost()}, _contextWasLost=${_contextWasLost}`\r\n );\r\n }\r\n\r\n gl.shaderSource(shader, source);\r\n gl.compileShader(shader);\r\n\r\n return shader;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _setProgram(program: WebGLProgram, gl: WebGLContext): void {\r\n gl.useProgram(program);\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _executeWhenRenderingStateIsCompiled(pipelineContext: IPipelineContext, action: (pipelineContext?: IPipelineContext) => void) {\r\n const webGLPipelineContext = pipelineContext as WebGLPipelineContext;\r\n\r\n if (!webGLPipelineContext.isParallelCompiled) {\r\n action(pipelineContext);\r\n return;\r\n }\r\n\r\n const oldHandler = webGLPipelineContext.onCompiled;\r\n\r\n webGLPipelineContext.onCompiled = () => {\r\n oldHandler?.();\r\n action(pipelineContext);\r\n };\r\n}\r\n"]}
@@ -137,7 +137,7 @@ export class ThinEngine extends AbstractEngine {
137
137
  options.preserveDrawingBuffer = false;
138
138
  }
139
139
  if (options.xrCompatible === undefined) {
140
- options.xrCompatible = true;
140
+ options.xrCompatible = false;
141
141
  }
142
142
  // Exceptions
143
143
  if (navigator && navigator.userAgent) {
@@ -2533,6 +2533,23 @@ export class ThinEngine extends AbstractEngine {
2533
2533
  createRawTexture2DArray(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression = null, textureType = 0) {
2534
2534
  throw _WarnImport("Engine.RawTexture");
2535
2535
  }
2536
+ // eslint-disable-next-line jsdoc/require-returns-check
2537
+ /**
2538
+ * Create a cube texture from prefiltered data (ie. the mipmaps contain ready to use data for PBR reflection)
2539
+ * @param rootUrl defines the url where the file to load is located
2540
+ * @param scene defines the current scene
2541
+ * @param lodScale defines scale to apply to the mip map selection
2542
+ * @param lodOffset defines offset to apply to the mip map selection
2543
+ * @param onLoad defines an optional callback raised when the texture is loaded
2544
+ * @param onError defines an optional callback raised if there is an issue to load the texture
2545
+ * @param format defines the format of the data
2546
+ * @param forcedExtension defines the extension to use to pick the right loader
2547
+ * @param createPolynomials defines wheter or not to create polynomails harmonics for the texture
2548
+ * @returns the cube texture as an InternalTexture
2549
+ */
2550
+ createPrefilteredCubeTexture(rootUrl, scene, lodScale, lodOffset, onLoad, onError, format, forcedExtension, createPolynomials) {
2551
+ throw _WarnImport("Misc/dds");
2552
+ }
2536
2553
  /**
2537
2554
  * @internal
2538
2555
  */