@spiffcommerce/preview 3.6.2-rc.5 → 3.6.2-rc.6

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 (490) hide show
  1. package/dist/index.esm.js +79094 -9
  2. package/dist/index.umd.js +54 -54
  3. package/package.json +2 -3
  4. package/dist/lib/assetCache.esm.js +0 -21
  5. package/dist/lib/configuration.esm.js +0 -98
  6. package/dist/lib/core.esm.js +0 -417
  7. package/dist/lib/dynamicTexture.esm.js +0 -51
  8. package/dist/lib/glbLoaderExtensions.esm.js +0 -137
  9. package/dist/lib/glowLayerManager.esm.js +0 -19
  10. package/dist/lib/guid.esm.js +0 -7
  11. package/dist/lib/material.esm.js +0 -50
  12. package/dist/lib/modelContainer.esm.js +0 -351
  13. package/dist/lib/productAnimations.esm.js +0 -123
  14. package/dist/lib/productCamera.esm.js +0 -113
  15. package/dist/lib/renderConstants.esm.js +0 -103
  16. package/dist/lib/renderingPipeline.esm.js +0 -99
  17. package/dist/lib/types.esm.js +0 -5
  18. package/dist/lib/variants.esm.js +0 -112
  19. package/dist/node_modules/@babylonjs/core/Actions/abstractActionManager.esm.js +0 -41
  20. package/dist/node_modules/@babylonjs/core/Actions/action.esm.js +0 -122
  21. package/dist/node_modules/@babylonjs/core/Actions/actionEvent.esm.js +0 -59
  22. package/dist/node_modules/@babylonjs/core/Actions/actionManager.esm.js +0 -335
  23. package/dist/node_modules/@babylonjs/core/Actions/condition.esm.js +0 -193
  24. package/dist/node_modules/@babylonjs/core/Actions/directActions.esm.js +0 -354
  25. package/dist/node_modules/@babylonjs/core/Animations/animatable.esm.js +0 -478
  26. package/dist/node_modules/@babylonjs/core/Animations/animation.esm.js +0 -866
  27. package/dist/node_modules/@babylonjs/core/Animations/animationEvent.esm.js +0 -18
  28. package/dist/node_modules/@babylonjs/core/Animations/animationGroup.esm.js +0 -470
  29. package/dist/node_modules/@babylonjs/core/Animations/animationKey.esm.js +0 -7
  30. package/dist/node_modules/@babylonjs/core/Animations/animationRange.esm.js +0 -21
  31. package/dist/node_modules/@babylonjs/core/Animations/easing.esm.js +0 -93
  32. package/dist/node_modules/@babylonjs/core/Animations/runtimeAnimation.esm.js +0 -281
  33. package/dist/node_modules/@babylonjs/core/Audio/sound.esm.js +0 -568
  34. package/dist/node_modules/@babylonjs/core/Audio/weightedsound.esm.js +0 -117
  35. package/dist/node_modules/@babylonjs/core/Behaviors/Cameras/autoRotationBehavior.esm.js +0 -145
  36. package/dist/node_modules/@babylonjs/core/Behaviors/Cameras/bouncingBehavior.esm.js +0 -93
  37. package/dist/node_modules/@babylonjs/core/Behaviors/Cameras/framingBehavior.esm.js +0 -295
  38. package/dist/node_modules/@babylonjs/core/Bones/bone.esm.js +0 -701
  39. package/dist/node_modules/@babylonjs/core/Bones/skeleton.esm.js +0 -478
  40. package/dist/node_modules/@babylonjs/core/Buffers/buffer.esm.js +0 -433
  41. package/dist/node_modules/@babylonjs/core/Buffers/dataBuffer.esm.js +0 -18
  42. package/dist/node_modules/@babylonjs/core/Cameras/Inputs/BaseCameraMouseWheelInput.esm.js +0 -67
  43. package/dist/node_modules/@babylonjs/core/Cameras/Inputs/BaseCameraPointersInput.esm.js +0 -191
  44. package/dist/node_modules/@babylonjs/core/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.esm.js +0 -93
  45. package/dist/node_modules/@babylonjs/core/Cameras/Inputs/arcRotateCameraMouseWheelInput.esm.js +0 -119
  46. package/dist/node_modules/@babylonjs/core/Cameras/Inputs/arcRotateCameraPointersInput.esm.js +0 -119
  47. package/dist/node_modules/@babylonjs/core/Cameras/Inputs/freeCameraKeyboardMoveInput.esm.js +0 -108
  48. package/dist/node_modules/@babylonjs/core/Cameras/Inputs/freeCameraMouseInput.esm.js +0 -114
  49. package/dist/node_modules/@babylonjs/core/Cameras/Inputs/freeCameraMouseWheelInput.esm.js +0 -249
  50. package/dist/node_modules/@babylonjs/core/Cameras/Inputs/freeCameraTouchInput.esm.js +0 -103
  51. package/dist/node_modules/@babylonjs/core/Cameras/arcRotateCamera.esm.js +0 -589
  52. package/dist/node_modules/@babylonjs/core/Cameras/arcRotateCameraInputsManager.esm.js +0 -37
  53. package/dist/node_modules/@babylonjs/core/Cameras/camera.esm.js +0 -686
  54. package/dist/node_modules/@babylonjs/core/Cameras/cameraInputsManager.esm.js +0 -147
  55. package/dist/node_modules/@babylonjs/core/Cameras/freeCamera.esm.js +0 -236
  56. package/dist/node_modules/@babylonjs/core/Cameras/freeCameraInputsManager.esm.js +0 -66
  57. package/dist/node_modules/@babylonjs/core/Cameras/targetCamera.esm.js +0 -214
  58. package/dist/node_modules/@babylonjs/core/Collisions/intersectionInfo.esm.js +0 -8
  59. package/dist/node_modules/@babylonjs/core/Collisions/meshCollisionData.esm.js +0 -9
  60. package/dist/node_modules/@babylonjs/core/Collisions/pickingInfo.esm.js +0 -59
  61. package/dist/node_modules/@babylonjs/core/Compat/compatibilityOptions.esm.js +0 -6
  62. package/dist/node_modules/@babylonjs/core/Culling/boundingBox.esm.js +0 -174
  63. package/dist/node_modules/@babylonjs/core/Culling/boundingInfo.esm.js +0 -159
  64. package/dist/node_modules/@babylonjs/core/Culling/boundingSphere.esm.js +0 -114
  65. package/dist/node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceEnums.esm.js +0 -37
  66. package/dist/node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceSource.esm.js +0 -23
  67. package/dist/node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceSourceManager.esm.js +0 -106
  68. package/dist/node_modules/@babylonjs/core/DeviceInput/eventFactory.esm.js +0 -118
  69. package/dist/node_modules/@babylonjs/core/DeviceInput/internalDeviceSourceManager.esm.js +0 -46
  70. package/dist/node_modules/@babylonjs/core/DeviceInput/nativeDeviceInputSystem.esm.js +0 -50
  71. package/dist/node_modules/@babylonjs/core/DeviceInput/webDeviceInputSystem.esm.js +0 -354
  72. package/dist/node_modules/@babylonjs/core/Engines/Extensions/engine.alpha.esm.js +0 -101
  73. package/dist/node_modules/@babylonjs/core/Engines/Extensions/engine.cubeTexture.esm.js +0 -103
  74. package/dist/node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicBuffer.esm.js +0 -11
  75. package/dist/node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicTexture.esm.js +0 -14
  76. package/dist/node_modules/@babylonjs/core/Engines/Extensions/engine.multiRender.esm.js +0 -111
  77. package/dist/node_modules/@babylonjs/core/Engines/Extensions/engine.rawTexture.esm.js +0 -109
  78. package/dist/node_modules/@babylonjs/core/Engines/Extensions/engine.readTexture.esm.js +0 -76
  79. package/dist/node_modules/@babylonjs/core/Engines/Extensions/engine.renderTarget.esm.js +0 -69
  80. package/dist/node_modules/@babylonjs/core/Engines/Extensions/engine.renderTargetCube.esm.js +0 -15
  81. package/dist/node_modules/@babylonjs/core/Engines/Extensions/engine.uniformBuffer.esm.js +0 -29
  82. package/dist/node_modules/@babylonjs/core/Engines/Extensions/engine.views.esm.js +0 -85
  83. package/dist/node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.esm.js +0 -9
  84. package/dist/node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.esm.js +0 -36
  85. package/dist/node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.esm.js +0 -13
  86. package/dist/node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.esm.js +0 -9
  87. package/dist/node_modules/@babylonjs/core/Engines/Processors/Expressions/shaderDefineExpression.esm.js +0 -88
  88. package/dist/node_modules/@babylonjs/core/Engines/Processors/shaderCodeConditionNode.esm.js +0 -14
  89. package/dist/node_modules/@babylonjs/core/Engines/Processors/shaderCodeCursor.esm.js +0 -44
  90. package/dist/node_modules/@babylonjs/core/Engines/Processors/shaderCodeNode.esm.js +0 -31
  91. package/dist/node_modules/@babylonjs/core/Engines/Processors/shaderCodeTestNode.esm.js +0 -9
  92. package/dist/node_modules/@babylonjs/core/Engines/Processors/shaderProcessor.esm.js +0 -230
  93. package/dist/node_modules/@babylonjs/core/Engines/WebGL/webGL2ShaderProcessors.esm.js +0 -30
  94. package/dist/node_modules/@babylonjs/core/Engines/WebGL/webGLHardwareTexture.esm.js +0 -34
  95. package/dist/node_modules/@babylonjs/core/Engines/WebGL/webGLPipelineContext.esm.js +0 -388
  96. package/dist/node_modules/@babylonjs/core/Engines/WebGL/webGLRenderTargetWrapper.esm.js +0 -87
  97. package/dist/node_modules/@babylonjs/core/Engines/WebGL/webGLShaderProcessors.esm.js +0 -16
  98. package/dist/node_modules/@babylonjs/core/Engines/constants.esm.js +0 -254
  99. package/dist/node_modules/@babylonjs/core/Engines/engine.esm.js +0 -1120
  100. package/dist/node_modules/@babylonjs/core/Engines/engineStore.esm.js +0 -23
  101. package/dist/node_modules/@babylonjs/core/Engines/nullEngine.esm.js +0 -697
  102. package/dist/node_modules/@babylonjs/core/Engines/performanceConfigurator.esm.js +0 -22
  103. package/dist/node_modules/@babylonjs/core/Engines/renderTargetWrapper.esm.js +0 -273
  104. package/dist/node_modules/@babylonjs/core/Engines/shaderStore.esm.js +0 -36
  105. package/dist/node_modules/@babylonjs/core/Engines/thinEngine.esm.js +0 -2921
  106. package/dist/node_modules/@babylonjs/core/Events/deviceInputEvents.esm.js +0 -13
  107. package/dist/node_modules/@babylonjs/core/Events/keyboardEvents.esm.js +0 -41
  108. package/dist/node_modules/@babylonjs/core/Events/pointerEvents.esm.js +0 -63
  109. package/dist/node_modules/@babylonjs/core/Inputs/pointerPickingConfiguration.esm.js +0 -8
  110. package/dist/node_modules/@babylonjs/core/Inputs/scene.inputManager.esm.js +0 -418
  111. package/dist/node_modules/@babylonjs/core/Layers/effectLayer.esm.js +0 -437
  112. package/dist/node_modules/@babylonjs/core/Layers/effectLayerSceneComponent.esm.js +0 -141
  113. package/dist/node_modules/@babylonjs/core/Layers/glowLayer.esm.js +0 -343
  114. package/dist/node_modules/@babylonjs/core/Layers/highlightLayer.esm.js +0 -396
  115. package/dist/node_modules/@babylonjs/core/Lights/directionalLight.esm.js +0 -224
  116. package/dist/node_modules/@babylonjs/core/Lights/hemisphericLight.esm.js +0 -92
  117. package/dist/node_modules/@babylonjs/core/Lights/light.esm.js +0 -476
  118. package/dist/node_modules/@babylonjs/core/Lights/lightConstants.esm.js +0 -30
  119. package/dist/node_modules/@babylonjs/core/Lights/pointLight.esm.js +0 -153
  120. package/dist/node_modules/@babylonjs/core/Lights/shadowLight.esm.js +0 -196
  121. package/dist/node_modules/@babylonjs/core/Lights/spotLight.esm.js +0 -287
  122. package/dist/node_modules/@babylonjs/core/Loading/sceneLoader.esm.js +0 -551
  123. package/dist/node_modules/@babylonjs/core/Loading/sceneLoaderFlags.esm.js +0 -48
  124. package/dist/node_modules/@babylonjs/core/Materials/PBR/pbrAnisotropicConfiguration.esm.js +0 -112
  125. package/dist/node_modules/@babylonjs/core/Materials/PBR/pbrBRDFConfiguration.esm.js +0 -48
  126. package/dist/node_modules/@babylonjs/core/Materials/PBR/pbrBaseMaterial.esm.js +0 -568
  127. package/dist/node_modules/@babylonjs/core/Materials/PBR/pbrClearCoatConfiguration.esm.js +0 -139
  128. package/dist/node_modules/@babylonjs/core/Materials/PBR/pbrIridescenceConfiguration.esm.js +0 -97
  129. package/dist/node_modules/@babylonjs/core/Materials/PBR/pbrMaterial.esm.js +0 -496
  130. package/dist/node_modules/@babylonjs/core/Materials/PBR/pbrSheenConfiguration.esm.js +0 -106
  131. package/dist/node_modules/@babylonjs/core/Materials/PBR/pbrSubSurfaceConfiguration.esm.js +0 -270
  132. package/dist/node_modules/@babylonjs/core/Materials/Textures/Filtering/hdrFiltering.esm.js +0 -103
  133. package/dist/node_modules/@babylonjs/core/Materials/Textures/Loaders/ddsTextureLoader.esm.js +0 -53
  134. package/dist/node_modules/@babylonjs/core/Materials/Textures/Loaders/envTextureLoader.esm.js +0 -51
  135. package/dist/node_modules/@babylonjs/core/Materials/Textures/Loaders/ktxTextureLoader.esm.js +0 -81
  136. package/dist/node_modules/@babylonjs/core/Materials/Textures/baseTexture.esm.js +0 -542
  137. package/dist/node_modules/@babylonjs/core/Materials/Textures/baseTexture.polynomial.esm.js +0 -23
  138. package/dist/node_modules/@babylonjs/core/Materials/Textures/cubeTexture.esm.js +0 -244
  139. package/dist/node_modules/@babylonjs/core/Materials/Textures/dynamicTexture.esm.js +0 -134
  140. package/dist/node_modules/@babylonjs/core/Materials/Textures/equiRectangularCubeTexture.esm.js +0 -89
  141. package/dist/node_modules/@babylonjs/core/Materials/Textures/hdrCubeTexture.esm.js +0 -175
  142. package/dist/node_modules/@babylonjs/core/Materials/Textures/internalTexture.esm.js +0 -150
  143. package/dist/node_modules/@babylonjs/core/Materials/Textures/ktx2decoderTypes.esm.js +0 -17
  144. package/dist/node_modules/@babylonjs/core/Materials/Textures/mirrorTexture.esm.js +0 -138
  145. package/dist/node_modules/@babylonjs/core/Materials/Textures/multiRenderTarget.esm.js +0 -223
  146. package/dist/node_modules/@babylonjs/core/Materials/Textures/rawCubeTexture.esm.js +0 -58
  147. package/dist/node_modules/@babylonjs/core/Materials/Textures/rawTexture.esm.js +0 -156
  148. package/dist/node_modules/@babylonjs/core/Materials/Textures/rawTexture2DArray.esm.js +0 -53
  149. package/dist/node_modules/@babylonjs/core/Materials/Textures/renderTargetTexture.esm.js +0 -605
  150. package/dist/node_modules/@babylonjs/core/Materials/Textures/texture.esm.js +0 -421
  151. package/dist/node_modules/@babylonjs/core/Materials/Textures/textureSampler.esm.js +0 -101
  152. package/dist/node_modules/@babylonjs/core/Materials/Textures/thinTexture.esm.js +0 -170
  153. package/dist/node_modules/@babylonjs/core/Materials/clipPlaneMaterialHelper.esm.js +0 -28
  154. package/dist/node_modules/@babylonjs/core/Materials/colorCurves.esm.js +0 -397
  155. package/dist/node_modules/@babylonjs/core/Materials/drawWrapper.esm.js +0 -22
  156. package/dist/node_modules/@babylonjs/core/Materials/effect.esm.js +0 -890
  157. package/dist/node_modules/@babylonjs/core/Materials/effectFallbacks.esm.js +0 -73
  158. package/dist/node_modules/@babylonjs/core/Materials/effectRenderer.esm.js +0 -132
  159. package/dist/node_modules/@babylonjs/core/Materials/imageProcessingConfiguration.esm.js +0 -428
  160. package/dist/node_modules/@babylonjs/core/Materials/material.detailMapConfiguration.esm.js +0 -90
  161. package/dist/node_modules/@babylonjs/core/Materials/material.esm.js +0 -906
  162. package/dist/node_modules/@babylonjs/core/Materials/materialDefines.esm.js +0 -161
  163. package/dist/node_modules/@babylonjs/core/Materials/materialFlags.esm.js +0 -226
  164. package/dist/node_modules/@babylonjs/core/Materials/materialHelper.esm.js +0 -501
  165. package/dist/node_modules/@babylonjs/core/Materials/materialPluginBase.esm.js +0 -226
  166. package/dist/node_modules/@babylonjs/core/Materials/materialPluginEvent.esm.js +0 -7
  167. package/dist/node_modules/@babylonjs/core/Materials/materialPluginManager.esm.js +0 -212
  168. package/dist/node_modules/@babylonjs/core/Materials/materialStencilState.esm.js +0 -145
  169. package/dist/node_modules/@babylonjs/core/Materials/multiMaterial.esm.js +0 -164
  170. package/dist/node_modules/@babylonjs/core/Materials/prePassConfiguration.esm.js +0 -38
  171. package/dist/node_modules/@babylonjs/core/Materials/pushMaterial.esm.js +0 -48
  172. package/dist/node_modules/@babylonjs/core/Materials/shaderLanguage.esm.js +0 -7
  173. package/dist/node_modules/@babylonjs/core/Materials/shaderMaterial.esm.js +0 -838
  174. package/dist/node_modules/@babylonjs/core/Materials/standardMaterial.esm.js +0 -934
  175. package/dist/node_modules/@babylonjs/core/Materials/uniformBuffer.esm.js +0 -541
  176. package/dist/node_modules/@babylonjs/core/Maths/math.axis.esm.js +0 -19
  177. package/dist/node_modules/@babylonjs/core/Maths/math.color.esm.js +0 -903
  178. package/dist/node_modules/@babylonjs/core/Maths/math.constants.esm.js +0 -6
  179. package/dist/node_modules/@babylonjs/core/Maths/math.frustum.esm.js +0 -91
  180. package/dist/node_modules/@babylonjs/core/Maths/math.functions.esm.js +0 -43
  181. package/dist/node_modules/@babylonjs/core/Maths/math.path.esm.js +0 -9
  182. package/dist/node_modules/@babylonjs/core/Maths/math.plane.esm.js +0 -145
  183. package/dist/node_modules/@babylonjs/core/Maths/math.scalar.esm.js +0 -284
  184. package/dist/node_modules/@babylonjs/core/Maths/math.size.esm.js +0 -124
  185. package/dist/node_modules/@babylonjs/core/Maths/math.vector.esm.js +0 -4915
  186. package/dist/node_modules/@babylonjs/core/Maths/math.viewport.esm.js +0 -41
  187. package/dist/node_modules/@babylonjs/core/Maths/sphericalPolynomial.esm.js +0 -177
  188. package/dist/node_modules/@babylonjs/core/Meshes/Builders/boxBuilder.esm.js +0 -260
  189. package/dist/node_modules/@babylonjs/core/Meshes/Compression/dracoCompression.esm.js +0 -233
  190. package/dist/node_modules/@babylonjs/core/Meshes/Compression/meshoptCompression.esm.js +0 -47
  191. package/dist/node_modules/@babylonjs/core/Meshes/WebGL/webGLDataBuffer.esm.js +0 -12
  192. package/dist/node_modules/@babylonjs/core/Meshes/abstractMesh.esm.js +0 -1448
  193. package/dist/node_modules/@babylonjs/core/Meshes/geometry.esm.js +0 -729
  194. package/dist/node_modules/@babylonjs/core/Meshes/instancedMesh.esm.js +0 -455
  195. package/dist/node_modules/@babylonjs/core/Meshes/mesh.esm.js +0 -2526
  196. package/dist/node_modules/@babylonjs/core/Meshes/mesh.vertexData.esm.js +0 -865
  197. package/dist/node_modules/@babylonjs/core/Meshes/meshLODLevel.esm.js +0 -13
  198. package/dist/node_modules/@babylonjs/core/Meshes/subMesh.esm.js +0 -422
  199. package/dist/node_modules/@babylonjs/core/Meshes/thinInstanceMesh.esm.js +0 -129
  200. package/dist/node_modules/@babylonjs/core/Meshes/transformNode.esm.js +0 -796
  201. package/dist/node_modules/@babylonjs/core/Misc/HighDynamicRange/cubemapToSphericalPolynomial.esm.js +0 -111
  202. package/dist/node_modules/@babylonjs/core/Misc/HighDynamicRange/hdr.esm.js +0 -122
  203. package/dist/node_modules/@babylonjs/core/Misc/HighDynamicRange/panoramaToCubemap.esm.js +0 -78
  204. package/dist/node_modules/@babylonjs/core/Misc/andOrNotEvaluator.esm.js +0 -41
  205. package/dist/node_modules/@babylonjs/core/Misc/arrayTools.esm.js +0 -52
  206. package/dist/node_modules/@babylonjs/core/Misc/assetsManager.esm.js +0 -561
  207. package/dist/node_modules/@babylonjs/core/Misc/brdfTextureTools.esm.js +0 -31
  208. package/dist/node_modules/@babylonjs/core/Misc/copyTools.esm.js +0 -44
  209. package/dist/node_modules/@babylonjs/core/Misc/coroutine.esm.js +0 -53
  210. package/dist/node_modules/@babylonjs/core/Misc/dataReader.esm.js +0 -55
  211. package/dist/node_modules/@babylonjs/core/Misc/dds.esm.js +0 -329
  212. package/dist/node_modules/@babylonjs/core/Misc/decorators.esm.js +0 -332
  213. package/dist/node_modules/@babylonjs/core/Misc/deepCopier.esm.js +0 -52
  214. package/dist/node_modules/@babylonjs/core/Misc/deferred.esm.js +0 -25
  215. package/dist/node_modules/@babylonjs/core/Misc/devTools.esm.js +0 -6
  216. package/dist/node_modules/@babylonjs/core/Misc/domManagement.esm.js +0 -21
  217. package/dist/node_modules/@babylonjs/core/Misc/dumpTools.esm.js +0 -117
  218. package/dist/node_modules/@babylonjs/core/Misc/environmentTextureTools.esm.js +0 -187
  219. package/dist/node_modules/@babylonjs/core/Misc/error.esm.js +0 -40
  220. package/dist/node_modules/@babylonjs/core/Misc/fileTools.esm.js +0 -339
  221. package/dist/node_modules/@babylonjs/core/Misc/filesInputStore.esm.js +0 -6
  222. package/dist/node_modules/@babylonjs/core/Misc/guid.esm.js +0 -9
  223. package/dist/node_modules/@babylonjs/core/Misc/instantiationTools.esm.js +0 -26
  224. package/dist/node_modules/@babylonjs/core/Misc/khronosTextureContainer.esm.js +0 -79
  225. package/dist/node_modules/@babylonjs/core/Misc/khronosTextureContainer2.esm.js +0 -281
  226. package/dist/node_modules/@babylonjs/core/Misc/logger.esm.js +0 -77
  227. package/dist/node_modules/@babylonjs/core/Misc/observable.esm.js +0 -231
  228. package/dist/node_modules/@babylonjs/core/Misc/perfCounter.esm.js +0 -99
  229. package/dist/node_modules/@babylonjs/core/Misc/performanceMonitor.esm.js +0 -144
  230. package/dist/node_modules/@babylonjs/core/Misc/precisionDate.esm.js +0 -12
  231. package/dist/node_modules/@babylonjs/core/Misc/retryStrategy.esm.js +0 -14
  232. package/dist/node_modules/@babylonjs/core/Misc/rgbdTextureTools.esm.js +0 -51
  233. package/dist/node_modules/@babylonjs/core/Misc/screenshotTools.esm.js +0 -92
  234. package/dist/node_modules/@babylonjs/core/Misc/smartArray.esm.js +0 -118
  235. package/dist/node_modules/@babylonjs/core/Misc/stringDictionary.esm.js +0 -129
  236. package/dist/node_modules/@babylonjs/core/Misc/stringTools.esm.js +0 -26
  237. package/dist/node_modules/@babylonjs/core/Misc/tags.esm.js +0 -97
  238. package/dist/node_modules/@babylonjs/core/Misc/textureTools.esm.js +0 -41
  239. package/dist/node_modules/@babylonjs/core/Misc/timingTools.esm.js +0 -13
  240. package/dist/node_modules/@babylonjs/core/Misc/tools.esm.js +0 -929
  241. package/dist/node_modules/@babylonjs/core/Misc/typeStore.esm.js +0 -11
  242. package/dist/node_modules/@babylonjs/core/Misc/uniqueIdGenerator.esm.js +0 -13
  243. package/dist/node_modules/@babylonjs/core/Misc/webRequest.esm.js +0 -135
  244. package/dist/node_modules/@babylonjs/core/Misc/workerPool.esm.js +0 -80
  245. package/dist/node_modules/@babylonjs/core/Morph/morphTarget.esm.js +0 -187
  246. package/dist/node_modules/@babylonjs/core/Morph/morphTargetManager.esm.js +0 -249
  247. package/dist/node_modules/@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.esm.js +0 -349
  248. package/dist/node_modules/@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.esm.js +0 -306
  249. package/dist/node_modules/@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.esm.js +0 -161
  250. package/dist/node_modules/@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.esm.js +0 -589
  251. package/dist/node_modules/@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.esm.js +0 -512
  252. package/dist/node_modules/@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderEffect.esm.js +0 -114
  253. package/dist/node_modules/@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipeline.esm.js +0 -139
  254. package/dist/node_modules/@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.esm.js +0 -99
  255. package/dist/node_modules/@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.esm.js +0 -48
  256. package/dist/node_modules/@babylonjs/core/PostProcesses/bloomEffect.esm.js +0 -76
  257. package/dist/node_modules/@babylonjs/core/PostProcesses/bloomMergePostProcess.esm.js +0 -40
  258. package/dist/node_modules/@babylonjs/core/PostProcesses/blurPostProcess.esm.js +0 -165
  259. package/dist/node_modules/@babylonjs/core/PostProcesses/chromaticAberrationPostProcess.esm.js +0 -61
  260. package/dist/node_modules/@babylonjs/core/PostProcesses/circleOfConfusionPostProcess.esm.js +0 -62
  261. package/dist/node_modules/@babylonjs/core/PostProcesses/depthOfFieldBlurPostProcess.esm.js +0 -58
  262. package/dist/node_modules/@babylonjs/core/PostProcesses/depthOfFieldEffect.esm.js +0 -131
  263. package/dist/node_modules/@babylonjs/core/PostProcesses/depthOfFieldMergePostProcess.esm.js +0 -48
  264. package/dist/node_modules/@babylonjs/core/PostProcesses/extractHighlightsPostProcess.esm.js +0 -27
  265. package/dist/node_modules/@babylonjs/core/PostProcesses/fxaaPostProcess.esm.js +0 -41
  266. package/dist/node_modules/@babylonjs/core/PostProcesses/grainPostProcess.esm.js +0 -46
  267. package/dist/node_modules/@babylonjs/core/PostProcesses/imageProcessingPostProcess.esm.js +0 -359
  268. package/dist/node_modules/@babylonjs/core/PostProcesses/motionBlurPostProcess.esm.js +0 -178
  269. package/dist/node_modules/@babylonjs/core/PostProcesses/passPostProcess.esm.js +0 -40
  270. package/dist/node_modules/@babylonjs/core/PostProcesses/postProcess.esm.js +0 -457
  271. package/dist/node_modules/@babylonjs/core/PostProcesses/postProcessManager.esm.js +0 -94
  272. package/dist/node_modules/@babylonjs/core/PostProcesses/screenSpaceReflectionPostProcess.esm.js +0 -147
  273. package/dist/node_modules/@babylonjs/core/PostProcesses/sharpenPostProcess.esm.js +0 -46
  274. package/dist/node_modules/@babylonjs/core/Probes/reflectionProbe.esm.js +0 -184
  275. package/dist/node_modules/@babylonjs/core/Rendering/boundingBoxRenderer.esm.js +0 -170
  276. package/dist/node_modules/@babylonjs/core/Rendering/depthRenderer.esm.js +0 -185
  277. package/dist/node_modules/@babylonjs/core/Rendering/depthRendererSceneComponent.esm.js +0 -65
  278. package/dist/node_modules/@babylonjs/core/Rendering/geometryBufferRenderer.esm.js +0 -353
  279. package/dist/node_modules/@babylonjs/core/Rendering/geometryBufferRendererSceneComponent.esm.js +0 -55
  280. package/dist/node_modules/@babylonjs/core/Rendering/motionBlurConfiguration.esm.js +0 -8
  281. package/dist/node_modules/@babylonjs/core/Rendering/renderingGroup.esm.js +0 -223
  282. package/dist/node_modules/@babylonjs/core/Rendering/renderingManager.esm.js +0 -185
  283. package/dist/node_modules/@babylonjs/core/Rendering/screenSpaceReflections2Configuration.esm.js +0 -8
  284. package/dist/node_modules/@babylonjs/core/Rendering/screenSpaceReflectionsConfiguration.esm.js +0 -8
  285. package/dist/node_modules/@babylonjs/core/Rendering/ssao2Configuration.esm.js +0 -8
  286. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation.esm.js +0 -48
  287. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.esm.js +0 -24
  288. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.esm.js +0 -35
  289. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesVertex.esm.js +0 -56
  290. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/boundingBoxRendererFragmentDeclaration.esm.js +0 -4
  291. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/boundingBoxRendererUboDeclaration.esm.js +0 -19
  292. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/boundingBoxRendererVertexDeclaration.esm.js +0 -8
  293. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragment.esm.js +0 -67
  294. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentFunctions.esm.js +0 -58
  295. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentMainFunctions.esm.js +0 -93
  296. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertex.esm.js +0 -11
  297. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertexDeclaration.esm.js +0 -8
  298. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.esm.js +0 -42
  299. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.esm.js +0 -21
  300. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.esm.js +0 -21
  301. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.esm.js +0 -27
  302. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/decalFragment.esm.js +0 -12
  303. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/decalFragmentDeclaration.esm.js +0 -6
  304. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/decalVertexDeclaration.esm.js +0 -7
  305. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/defaultFragmentDeclaration.esm.js +0 -86
  306. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/defaultUboDeclaration.esm.js +0 -50
  307. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/defaultVertexDeclaration.esm.js +0 -46
  308. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/depthPrePass.esm.js +0 -7
  309. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragment.esm.js +0 -10
  310. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.esm.js +0 -34
  311. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertex.esm.js +0 -6
  312. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.esm.js +0 -6
  313. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/fresnelFunction.esm.js +0 -10
  314. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/geometryUboDeclaration.esm.js +0 -5
  315. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/geometryVertexDeclaration.esm.js +0 -4
  316. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/harmonicsFunctions.esm.js +0 -42
  317. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/hdrFilteringFunctions.esm.js +0 -139
  318. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/helperFunctions.esm.js +0 -166
  319. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingDeclaration.esm.js +0 -32
  320. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingFunctions.esm.js +0 -129
  321. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/importanceSampling.esm.js +0 -22
  322. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.esm.js +0 -31
  323. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesVertex.esm.js +0 -20
  324. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/kernelBlurFragment.esm.js +0 -15
  325. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/kernelBlurFragment2.esm.js +0 -15
  326. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/kernelBlurVaryingDeclaration.esm.js +0 -3
  327. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/kernelBlurVertex.esm.js +0 -3
  328. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragment.esm.js +0 -278
  329. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.esm.js +0 -82
  330. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.esm.js +0 -81
  331. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/lightVxFragmentDeclaration.esm.js +0 -35
  332. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/lightVxUboDeclaration.esm.js +0 -34
  333. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions.esm.js +0 -93
  334. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.esm.js +0 -7
  335. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.esm.js +0 -6
  336. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.esm.js +0 -7
  337. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/mainUVVaryingDeclaration.esm.js +0 -6
  338. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/meshUboDeclaration.esm.js +0 -15
  339. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertex.esm.js +0 -32
  340. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexDeclaration.esm.js +0 -17
  341. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexGlobal.esm.js +0 -8
  342. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.esm.js +0 -19
  343. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/mrtFragmentDeclaration.esm.js +0 -6
  344. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/oitDeclaration.esm.js +0 -13
  345. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/oitFragment.esm.js +0 -40
  346. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/packingFunctions.esm.js +0 -15
  347. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBRDFFunctions.esm.js +0 -268
  348. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.esm.js +0 -83
  349. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAlphaFresnel.esm.js +0 -37
  350. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAmbientOcclusion.esm.js +0 -32
  351. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAnisotropic.esm.js +0 -50
  352. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockClearcoat.esm.js +0 -276
  353. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockDirectLighting.esm.js +0 -19
  354. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockFinalColorComposition.esm.js +0 -45
  355. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockFinalLitComponents.esm.js +0 -100
  356. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.esm.js +0 -27
  357. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockGeometryInfo.esm.js +0 -30
  358. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockImageProcessing.esm.js +0 -14
  359. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockIridescence.esm.js +0 -63
  360. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockLightmapInit.esm.js +0 -13
  361. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockNormalFinal.esm.js +0 -13
  362. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockNormalGeometric.esm.js +0 -13
  363. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflectance.esm.js +0 -24
  364. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflectance0.esm.js +0 -14
  365. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflection.esm.js +0 -270
  366. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflectivity.esm.js +0 -131
  367. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockSheen.esm.js +0 -197
  368. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockSubSurface.esm.js +0 -337
  369. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDebug.esm.js +0 -176
  370. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDirectLightingFalloffFunctions.esm.js +0 -64
  371. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDirectLightingFunctions.esm.js +0 -130
  372. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.esm.js +0 -53
  373. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrFragmentDeclaration.esm.js +0 -179
  374. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.esm.js +0 -18
  375. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.esm.js +0 -101
  376. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrHelperFunctions.esm.js +0 -83
  377. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrIBLFunctions.esm.js +0 -35
  378. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrUboDeclaration.esm.js +0 -65
  379. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrVertexDeclaration.esm.js +0 -151
  380. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/pointCloudVertex.esm.js +0 -6
  381. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassDeclaration.esm.js +0 -13
  382. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassVertex.esm.js +0 -37
  383. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassVertexDeclaration.esm.js +0 -13
  384. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/reflectionFunction.esm.js +0 -116
  385. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerFragmentAlternateDeclaration.esm.js +0 -20
  386. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerFragmentDeclaration.esm.js +0 -21
  387. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerVertexDeclaration.esm.js +0 -6
  388. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerVertexImplementation.esm.js +0 -39
  389. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/sceneUboDeclaration.esm.js +0 -13
  390. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/screenSpaceRayTrace.esm.js +0 -208
  391. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsFragmentFunctions.esm.js +0 -614
  392. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.esm.js +0 -23
  393. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/subSurfaceScatteringFunctions.esm.js +0 -6
  394. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/uvAttributeDeclaration.esm.js +0 -6
  395. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/uvVariableDeclaration.esm.js +0 -9
  396. package/dist/node_modules/@babylonjs/core/Shaders/ShadersInclude/vertexColorMixing.esm.js +0 -16
  397. package/dist/node_modules/@babylonjs/core/Shaders/bloomMerge.fragment.esm.js +0 -14
  398. package/dist/node_modules/@babylonjs/core/Shaders/boundingBoxRenderer.fragment.esm.js +0 -11
  399. package/dist/node_modules/@babylonjs/core/Shaders/boundingBoxRenderer.vertex.esm.js +0 -22
  400. package/dist/node_modules/@babylonjs/core/Shaders/chromaticAberration.fragment.esm.js +0 -34
  401. package/dist/node_modules/@babylonjs/core/Shaders/circleOfConfusion.fragment.esm.js +0 -19
  402. package/dist/node_modules/@babylonjs/core/Shaders/default.fragment.esm.js +0 -387
  403. package/dist/node_modules/@babylonjs/core/Shaders/default.vertex.esm.js +0 -171
  404. package/dist/node_modules/@babylonjs/core/Shaders/depth.fragment.esm.js +0 -47
  405. package/dist/node_modules/@babylonjs/core/Shaders/depth.vertex.esm.js +0 -72
  406. package/dist/node_modules/@babylonjs/core/Shaders/depthOfField.fragment.esm.js +0 -137
  407. package/dist/node_modules/@babylonjs/core/Shaders/depthOfFieldMerge.fragment.esm.js +0 -54
  408. package/dist/node_modules/@babylonjs/core/Shaders/extractHighlights.fragment.esm.js +0 -15
  409. package/dist/node_modules/@babylonjs/core/Shaders/fxaa.fragment.esm.js +0 -211
  410. package/dist/node_modules/@babylonjs/core/Shaders/fxaa.vertex.esm.js +0 -29
  411. package/dist/node_modules/@babylonjs/core/Shaders/geometry.fragment.esm.js +0 -147
  412. package/dist/node_modules/@babylonjs/core/Shaders/geometry.vertex.esm.js +0 -164
  413. package/dist/node_modules/@babylonjs/core/Shaders/glowBlurPostProcess.fragment.esm.js +0 -39
  414. package/dist/node_modules/@babylonjs/core/Shaders/glowMapGeneration.fragment.esm.js +0 -73
  415. package/dist/node_modules/@babylonjs/core/Shaders/glowMapGeneration.vertex.esm.js +0 -94
  416. package/dist/node_modules/@babylonjs/core/Shaders/glowMapMerge.fragment.esm.js +0 -29
  417. package/dist/node_modules/@babylonjs/core/Shaders/glowMapMerge.vertex.esm.js +0 -12
  418. package/dist/node_modules/@babylonjs/core/Shaders/grain.fragment.esm.js +0 -19
  419. package/dist/node_modules/@babylonjs/core/Shaders/hdrFiltering.fragment.esm.js +0 -19
  420. package/dist/node_modules/@babylonjs/core/Shaders/hdrFiltering.vertex.esm.js +0 -15
  421. package/dist/node_modules/@babylonjs/core/Shaders/imageProcessing.fragment.esm.js +0 -26
  422. package/dist/node_modules/@babylonjs/core/Shaders/kernelBlur.fragment.esm.js +0 -49
  423. package/dist/node_modules/@babylonjs/core/Shaders/kernelBlur.vertex.esm.js +0 -17
  424. package/dist/node_modules/@babylonjs/core/Shaders/lensHighlights.fragment.esm.js +0 -115
  425. package/dist/node_modules/@babylonjs/core/Shaders/motionBlur.fragment.esm.js +0 -74
  426. package/dist/node_modules/@babylonjs/core/Shaders/pass.fragment.esm.js +0 -13
  427. package/dist/node_modules/@babylonjs/core/Shaders/passCube.fragment.esm.js +0 -27
  428. package/dist/node_modules/@babylonjs/core/Shaders/pbr.fragment.esm.js +0 -648
  429. package/dist/node_modules/@babylonjs/core/Shaders/pbr.vertex.esm.js +0 -236
  430. package/dist/node_modules/@babylonjs/core/Shaders/postprocess.vertex.esm.js +0 -13
  431. package/dist/node_modules/@babylonjs/core/Shaders/rgbdDecode.fragment.esm.js +0 -11
  432. package/dist/node_modules/@babylonjs/core/Shaders/rgbdEncode.fragment.esm.js +0 -11
  433. package/dist/node_modules/@babylonjs/core/Shaders/screenSpaceReflection.fragment.esm.js +0 -136
  434. package/dist/node_modules/@babylonjs/core/Shaders/screenSpaceReflection2.fragment.esm.js +0 -215
  435. package/dist/node_modules/@babylonjs/core/Shaders/screenSpaceReflection2Blur.fragment.esm.js +0 -52
  436. package/dist/node_modules/@babylonjs/core/Shaders/screenSpaceReflection2BlurCombiner.fragment.esm.js +0 -59
  437. package/dist/node_modules/@babylonjs/core/Shaders/sharpen.fragment.esm.js +0 -18
  438. package/dist/node_modules/@babylonjs/core/Shaders/ssao.fragment.esm.js +0 -55
  439. package/dist/node_modules/@babylonjs/core/Shaders/ssao2.fragment.esm.js +0 -165
  440. package/dist/node_modules/@babylonjs/core/Shaders/ssaoCombine.fragment.esm.js +0 -15
  441. package/dist/node_modules/@babylonjs/core/Shaders/standard.fragment.esm.js +0 -339
  442. package/dist/node_modules/@babylonjs/core/States/alphaCullingState.esm.js +0 -35
  443. package/dist/node_modules/@babylonjs/core/States/depthCullingState.esm.js +0 -69
  444. package/dist/node_modules/@babylonjs/core/States/stencilState.esm.js +0 -62
  445. package/dist/node_modules/@babylonjs/core/States/stencilStateComposer.esm.js +0 -70
  446. package/dist/node_modules/@babylonjs/core/abstractScene.esm.js +0 -71
  447. package/dist/node_modules/@babylonjs/core/assetContainer.esm.js +0 -425
  448. package/dist/node_modules/@babylonjs/core/node.esm.js +0 -536
  449. package/dist/node_modules/@babylonjs/core/scene.esm.js +0 -2809
  450. package/dist/node_modules/@babylonjs/core/sceneComponent.esm.js +0 -102
  451. package/dist/node_modules/@babylonjs/core/tslib.es6.esm.js +0 -12
  452. package/dist/node_modules/@babylonjs/loaders/glTF/1.0/glTFBinaryExtension.esm.js +0 -37
  453. package/dist/node_modules/@babylonjs/loaders/glTF/1.0/glTFLoader.esm.js +0 -902
  454. package/dist/node_modules/@babylonjs/loaders/glTF/1.0/glTFLoaderInterfaces.esm.js +0 -42
  455. package/dist/node_modules/@babylonjs/loaders/glTF/1.0/glTFLoaderUtils.esm.js +0 -195
  456. package/dist/node_modules/@babylonjs/loaders/glTF/1.0/glTFMaterialsCommonExtension.esm.js +0 -75
  457. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_lights_image_based.esm.js +0 -77
  458. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.esm.js +0 -53
  459. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_meshopt_compression.esm.js +0 -31
  460. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_texture_webp.esm.js +0 -29
  461. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/ExtrasAsMetadata.esm.js +0 -47
  462. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_animation_pointer.data.esm.js +0 -173
  463. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_animation_pointer.esm.js +0 -82
  464. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_draco_mesh_compression.esm.js +0 -68
  465. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_lights_punctual.esm.js +0 -60
  466. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_anisotropy.esm.js +0 -39
  467. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_clearcoat.esm.js +0 -42
  468. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_emissive_strength.esm.js +0 -32
  469. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_ior.esm.js +0 -35
  470. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_iridescence.esm.js +0 -41
  471. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.esm.js +0 -41
  472. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_sheen.esm.js +0 -41
  473. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_specular.esm.js +0 -41
  474. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_translucency.esm.js +0 -41
  475. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_transmission.esm.js +0 -136
  476. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_unlit.esm.js +0 -37
  477. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_variants.esm.js +0 -178
  478. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_volume.esm.js +0 -40
  479. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_mesh_quantization.esm.js +0 -17
  480. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_basisu.esm.js +0 -29
  481. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_transform.esm.js +0 -29
  482. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_xmp_json_ld.esm.js +0 -31
  483. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_audio_emitter.esm.js +0 -149
  484. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_lod.esm.js +0 -170
  485. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_minecraftMesh.esm.js +0 -29
  486. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_sRGBFactors.esm.js +0 -29
  487. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/glTFLoader.esm.js +0 -1562
  488. package/dist/node_modules/@babylonjs/loaders/glTF/2.0/glTFLoaderAnimation.esm.js +0 -66
  489. package/dist/node_modules/@babylonjs/loaders/glTF/glTFFileLoader.esm.js +0 -462
  490. package/dist/node_modules/@babylonjs/loaders/glTF/glTFValidation.esm.js +0 -81
@@ -1,2921 +0,0 @@
1
- import { EngineStore as U } from "./engineStore.esm.js";
2
- import { Effect as G } from "../Materials/effect.esm.js";
3
- import { _WarnImport as P } from "../Misc/devTools.esm.js";
4
- import { Observable as F } from "../Misc/observable.esm.js";
5
- import { DepthCullingState as j } from "../States/depthCullingState.esm.js";
6
- import { StencilState as z } from "../States/stencilState.esm.js";
7
- import { AlphaState as K } from "../States/alphaCullingState.esm.js";
8
- import { InternalTexture as M, InternalTextureSource as O } from "../Materials/Textures/internalTexture.esm.js";
9
- import { Logger as y } from "../Misc/logger.esm.js";
10
- import { IsDocumentAvailable as N, IsWindowObjectExist as v } from "../Misc/domManagement.esm.js";
11
- import { WebGLShaderProcessor as Q } from "./WebGL/webGLShaderProcessors.esm.js";
12
- import { WebGL2ShaderProcessor as Z } from "./WebGL/webGL2ShaderProcessors.esm.js";
13
- import { WebGLDataBuffer as V } from "../Meshes/WebGL/webGLDataBuffer.esm.js";
14
- import { WebGLPipelineContext as q } from "./WebGL/webGLPipelineContext.esm.js";
15
- import { PerformanceConfigurator as $ } from "./performanceConfigurator.esm.js";
16
- import { WebGLHardwareTexture as J } from "./WebGL/webGLHardwareTexture.esm.js";
17
- import { DrawWrapper as ee } from "../Materials/drawWrapper.esm.js";
18
- import { StencilStateComposer as te } from "../States/stencilStateComposer.esm.js";
19
- import { ShaderLanguage as re } from "../Materials/shaderLanguage.esm.js";
20
- import { PrecisionDate as se } from "../Misc/precisionDate.esm.js";
21
- class ie {
22
- }
23
- class R {
24
- /**
25
- * Returns the current npm package of the sdk
26
- */
27
- // Not mixed with Version for tooling purpose.
28
- static get NpmPackage() {
29
- return "babylonjs@6.14.0";
30
- }
31
- /**
32
- * Returns the current version of the framework
33
- */
34
- static get Version() {
35
- return "6.14.0";
36
- }
37
- /**
38
- * Returns a string describing the current engine
39
- */
40
- get description() {
41
- let e = this.name + this.webGLVersion;
42
- return this._caps.parallelShaderCompile && (e += " - Parallel shader compilation"), e;
43
- }
44
- /**
45
- * Gets or sets the name of the engine
46
- */
47
- get name() {
48
- return this._name;
49
- }
50
- set name(e) {
51
- this._name = e;
52
- }
53
- /**
54
- * Returns the version of the engine
55
- */
56
- get version() {
57
- return this._webGLVersion;
58
- }
59
- get isDisposed() {
60
- return this._isDisposed;
61
- }
62
- /**
63
- * Gets or sets the relative url used to load shaders if using the engine in non-minified mode
64
- */
65
- static get ShadersRepository() {
66
- return G.ShadersRepository;
67
- }
68
- static set ShadersRepository(e) {
69
- G.ShadersRepository = e;
70
- }
71
- /**
72
- * @internal
73
- */
74
- _getShaderProcessor(e) {
75
- return this._shaderProcessor;
76
- }
77
- /**
78
- * Gets or sets a boolean indicating if depth buffer should be reverse, going from far to near.
79
- * This can provide greater z depth for distant objects.
80
- */
81
- get useReverseDepthBuffer() {
82
- return this._useReverseDepthBuffer;
83
- }
84
- set useReverseDepthBuffer(e) {
85
- e !== this._useReverseDepthBuffer && (this._useReverseDepthBuffer = e, e ? this._depthCullingState.depthFunc = 518 : this._depthCullingState.depthFunc = 515);
86
- }
87
- /**
88
- * Gets the current frame id
89
- */
90
- get frameId() {
91
- return this._frameId;
92
- }
93
- /**
94
- * Gets a boolean indicating that the engine supports uniform buffers
95
- * @see https://doc.babylonjs.com/setup/support/webGL2#uniform-buffer-objets
96
- */
97
- get supportsUniformBuffers() {
98
- return this.webGLVersion > 1 && !this.disableUniformBuffers;
99
- }
100
- /**
101
- * Gets the options used for engine creation
102
- * @returns EngineOptions object
103
- */
104
- getCreationOptions() {
105
- return this._creationOptions;
106
- }
107
- /** @internal */
108
- get _shouldUseHighPrecisionShader() {
109
- return !!(this._caps.highPrecisionShaderSupported && this._highPrecisionShadersAllowed);
110
- }
111
- /**
112
- * Gets a boolean indicating that only power of 2 textures are supported
113
- * Please note that you can still use non power of 2 textures but in this case the engine will forcefully convert them
114
- */
115
- get needPOTTextures() {
116
- return this._webGLVersion < 2 || this.forcePOTTextures;
117
- }
118
- /**
119
- * Gets the list of current active render loop functions
120
- * @returns an array with the current render loop functions
121
- */
122
- get activeRenderLoops() {
123
- return this._activeRenderLoops;
124
- }
125
- /**
126
- * Gets or sets a boolean indicating if resources should be retained to be able to handle context lost events
127
- * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#handling-webgl-context-lost
128
- */
129
- get doNotHandleContextLost() {
130
- return this._doNotHandleContextLost;
131
- }
132
- set doNotHandleContextLost(e) {
133
- this._doNotHandleContextLost = e;
134
- }
135
- get _supportsHardwareTextureRescaling() {
136
- return !1;
137
- }
138
- /**
139
- * sets the object from which width and height will be taken from when getting render width and height
140
- * Will fallback to the gl object
141
- * @param dimensions the framebuffer width and height that will be used.
142
- */
143
- set framebufferDimensionsObject(e) {
144
- this._framebufferDimensionsObject = e;
145
- }
146
- /**
147
- * Gets the current viewport
148
- */
149
- get currentViewport() {
150
- return this._cachedViewport;
151
- }
152
- /**
153
- * Gets the default empty texture
154
- */
155
- get emptyTexture() {
156
- return this._emptyTexture || (this._emptyTexture = this.createRawTexture(new Uint8Array(4), 1, 1, 5, !1, !1, 1)), this._emptyTexture;
157
- }
158
- /**
159
- * Gets the default empty 3D texture
160
- */
161
- get emptyTexture3D() {
162
- return this._emptyTexture3D || (this._emptyTexture3D = this.createRawTexture3D(new Uint8Array(4), 1, 1, 1, 5, !1, !1, 1)), this._emptyTexture3D;
163
- }
164
- /**
165
- * Gets the default empty 2D array texture
166
- */
167
- get emptyTexture2DArray() {
168
- return this._emptyTexture2DArray || (this._emptyTexture2DArray = this.createRawTexture2DArray(new Uint8Array(4), 1, 1, 1, 5, !1, !1, 1)), this._emptyTexture2DArray;
169
- }
170
- /**
171
- * Gets the default empty cube texture
172
- */
173
- get emptyCubeTexture() {
174
- if (!this._emptyCubeTexture) {
175
- const e = new Uint8Array(4), t = [e, e, e, e, e, e];
176
- this._emptyCubeTexture = this.createRawCubeTexture(t, 1, 5, 0, !1, !1, 1);
177
- }
178
- return this._emptyCubeTexture;
179
- }
180
- /**
181
- * Gets a boolean indicating if the engine runs in WebGPU or not.
182
- */
183
- get isWebGPU() {
184
- return this._isWebGPU;
185
- }
186
- /**
187
- * Gets the shader platform name used by the effects.
188
- */
189
- get shaderPlatformName() {
190
- return this._shaderPlatformName;
191
- }
192
- /**
193
- * Enables or disables the snapshot rendering mode
194
- * Note that the WebGL engine does not support snapshot rendering so setting the value won't have any effect for this engine
195
- */
196
- get snapshotRendering() {
197
- return !1;
198
- }
199
- set snapshotRendering(e) {
200
- }
201
- /**
202
- * Gets or sets the snapshot rendering mode
203
- */
204
- get snapshotRenderingMode() {
205
- return this._snapshotRenderingMode;
206
- }
207
- set snapshotRenderingMode(e) {
208
- this._snapshotRenderingMode = e;
209
- }
210
- /**
211
- * Creates a new snapshot at the next frame using the current snapshotRenderingMode
212
- */
213
- snapshotRenderingReset() {
214
- this.snapshotRendering = !1;
215
- }
216
- static _CreateCanvas(e, t) {
217
- if (typeof document > "u")
218
- return new OffscreenCanvas(e, t);
219
- const r = document.createElement("canvas");
220
- return r.width = e, r.height = t, r;
221
- }
222
- /**
223
- * Create a canvas. This method is overridden by other engines
224
- * @param width width
225
- * @param height height
226
- * @returns ICanvas interface
227
- */
228
- createCanvas(e, t) {
229
- return R._CreateCanvas(e, t);
230
- }
231
- /**
232
- * Create an image to use with canvas
233
- * @returns IImage interface
234
- */
235
- createCanvasImage() {
236
- return document.createElement("img");
237
- }
238
- /**
239
- * Creates a new engine
240
- * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which already used the WebGL context
241
- * @param antialias defines enable antialiasing (default: false)
242
- * @param options defines further options to be sent to the getContext() function
243
- * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)
244
- */
245
- constructor(e, t, r, s) {
246
- var i, n, l, a, _, h, f, g, c, u, E;
247
- this._name = "WebGL", this._isDisposed = !1, this.forcePOTTextures = !1, this.isFullscreen = !1, this.cullBackFaces = null, this.renderEvenInBackground = !0, this.preventCacheWipeBetweenFrames = !1, this.validateShaderPrograms = !1, this._useReverseDepthBuffer = !1, this.isNDCHalfZRange = !1, this.hasOriginBottomLeft = !0, this.disableUniformBuffers = !1, this.onDisposeObservable = new F(), this._frameId = 0, this._uniformBuffers = new Array(), this._storageBuffers = new Array(), this._webGLVersion = 1, this._windowIsBackground = !1, this._highPrecisionShadersAllowed = !0, this._badOS = !1, this._badDesktopOS = !1, this._renderingQueueLaunched = !1, this._activeRenderLoops = new Array(), this.onContextLostObservable = new F(), this.onContextRestoredObservable = new F(), this._contextWasLost = !1, this._doNotHandleContextLost = !1, this.disableVertexArrayObjects = !1, this._colorWrite = !0, this._colorWriteChanged = !0, this._depthCullingState = new j(), this._stencilStateComposer = new te(), this._stencilState = new z(), this._alphaState = new K(), this._alphaMode = 1, this._alphaEquation = 0, this._internalTexturesCache = new Array(), this._renderTargetWrapperCache = new Array(), this._activeChannel = 0, this._currentTextureChannel = -1, this._boundTexturesCache = {}, this._compiledEffects = {}, this._vertexAttribArraysEnabled = [], this._uintIndicesCurrentlySet = !1, this._currentBoundBuffer = new Array(), this._currentFramebuffer = null, this._dummyFramebuffer = null, this._currentBufferPointers = new Array(), this._currentInstanceLocations = new Array(), this._currentInstanceBuffers = new Array(), this._vaoRecordInProgress = !1, this._mustWipeVertexAttributes = !1, this._nextFreeTextureSlots = new Array(), this._maxSimultaneousTextures = 0, this._maxMSAASamplesOverride = null, this._activeRequests = new Array(), this.adaptToDeviceRatio = !1, this._lastDevicePixelRatio = 1, this._transformTextureUrl = null, this.hostInformation = {
248
- isMobile: !1
249
- }, this.premultipliedAlpha = !0, this.onBeforeTextureInitObservable = new F(), this._isWebGPU = !1, this._snapshotRenderingMode = 0, this._viewportCached = { x: 0, y: 0, z: 0, w: 0 }, this._unpackFlipYCached = null, this.enableUnpackFlipYCached = !0, this._boundUniforms = {}, this.startTime = se.Now;
250
- let d = null;
251
- r = r || {}, this._creationOptions = r, this.adaptToDeviceRatio = s ?? !1, this._stencilStateComposer.stencilGlobal = this._stencilState, $.SetMatrixPrecision(!!r.useHighPrecisionMatrix), r.antialias = t ?? r.antialias, r.deterministicLockstep = (i = r.deterministicLockstep) !== null && i !== void 0 ? i : !1, r.lockstepMaxSteps = (n = r.lockstepMaxSteps) !== null && n !== void 0 ? n : 4, r.timeStep = (l = r.timeStep) !== null && l !== void 0 ? l : 1 / 60, r.audioEngine = (a = r.audioEngine) !== null && a !== void 0 ? a : !0, r.stencil = (_ = r.stencil) !== null && _ !== void 0 ? _ : !0, this._audioContext = (f = (h = r.audioEngineOptions) === null || h === void 0 ? void 0 : h.audioContext) !== null && f !== void 0 ? f : null, this._audioDestination = (c = (g = r.audioEngineOptions) === null || g === void 0 ? void 0 : g.audioDestination) !== null && c !== void 0 ? c : null, this.premultipliedAlpha = (u = r.premultipliedAlpha) !== null && u !== void 0 ? u : !0, this.useExactSrgbConversions = (E = r.useExactSrgbConversions) !== null && E !== void 0 ? E : !1, this._doNotHandleContextLost = !!r.doNotHandleContextLost, this._isStencilEnable = !!r.stencil, s = s || r.adaptToDeviceRatio || !1;
252
- const b = v() && window.devicePixelRatio || 1, m = r.limitDeviceRatio || b;
253
- if (this._hardwareScalingLevel = s ? 1 / Math.min(m, b) : 1, this._lastDevicePixelRatio = b, !e)
254
- return;
255
- if (e.getContext) {
256
- if (d = e, this._renderingCanvas = d, r.preserveDrawingBuffer === void 0 && (r.preserveDrawingBuffer = !1), r.xrCompatible === void 0 && (r.xrCompatible = !0), navigator && navigator.userAgent) {
257
- this._setupMobileChecks();
258
- const o = navigator.userAgent;
259
- for (const S of R.ExceptionList) {
260
- const T = S.key, C = S.targets;
261
- if (new RegExp(T).test(o)) {
262
- if (S.capture && S.captureConstraint) {
263
- const w = S.capture, I = S.captureConstraint, p = new RegExp(w).exec(o);
264
- if (p && p.length > 0 && parseInt(p[p.length - 1]) >= I)
265
- continue;
266
- }
267
- for (const w of C)
268
- switch (w) {
269
- case "uniformBuffer":
270
- this.disableUniformBuffers = !0;
271
- break;
272
- case "vao":
273
- this.disableVertexArrayObjects = !0;
274
- break;
275
- case "antialias":
276
- r.antialias = !1;
277
- break;
278
- case "maxMSAASamples":
279
- this._maxMSAASamplesOverride = 1;
280
- break;
281
- }
282
- }
283
- }
284
- }
285
- if (this._doNotHandleContextLost || (this._onContextLost = (o) => {
286
- o.preventDefault(), this._contextWasLost = !0, y.Warn("WebGL context lost."), this.onContextLostObservable.notifyObservers(this);
287
- }, this._onContextRestored = () => {
288
- this._restoreEngineAfterContextLost(this._initGLContext.bind(this));
289
- }, d.addEventListener("webglcontextlost", this._onContextLost, !1), d.addEventListener("webglcontextrestored", this._onContextRestored, !1), r.powerPreference = r.powerPreference || "high-performance"), this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), this._badDesktopOS && (r.xrCompatible = !1), !r.disableWebGL2Support)
290
- try {
291
- this._gl = d.getContext("webgl2", r) || d.getContext("experimental-webgl2", r), this._gl && (this._webGLVersion = 2, this._shaderPlatformName = "WEBGL2", this._gl.deleteQuery || (this._webGLVersion = 1, this._shaderPlatformName = "WEBGL1"));
292
- } catch {
293
- }
294
- if (!this._gl) {
295
- if (!d)
296
- throw new Error("The provided canvas is null or undefined.");
297
- try {
298
- this._gl = d.getContext("webgl", r) || d.getContext("experimental-webgl", r);
299
- } catch {
300
- throw new Error("WebGL not supported");
301
- }
302
- }
303
- if (!this._gl)
304
- throw new Error("WebGL not supported");
305
- } else {
306
- this._gl = e, this._renderingCanvas = this._gl.canvas, this._gl.renderbufferStorageMultisample ? (this._webGLVersion = 2, this._shaderPlatformName = "WEBGL2") : this._shaderPlatformName = "WEBGL1";
307
- const o = this._gl.getContextAttributes();
308
- o && (r.stencil = o.stencil);
309
- }
310
- this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE), r.useHighPrecisionFloats !== void 0 && (this._highPrecisionShadersAllowed = r.useHighPrecisionFloats), this.resize(), this._initGLContext(), this._initFeatures();
311
- for (let o = 0; o < this._caps.maxVertexAttribs; o++)
312
- this._currentBufferPointers[o] = new ie();
313
- this._shaderProcessor = this.webGLVersion > 1 ? new Z() : new Q(), this._badOS = /iPad/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent);
314
- const A = `Babylon.js v${R.Version}`;
315
- console.log(A + ` - ${this.description}`), this._renderingCanvas && this._renderingCanvas.setAttribute && this._renderingCanvas.setAttribute("data-engine", A);
316
- }
317
- _setupMobileChecks() {
318
- navigator && navigator.userAgent && (this._checkForMobile = () => {
319
- const e = navigator.userAgent;
320
- this.hostInformation.isMobile = e.indexOf("Mobile") !== -1 || // Needed for iOS 13+ detection on iPad (inspired by solution from https://stackoverflow.com/questions/9038625/detect-if-device-is-ios)
321
- e.indexOf("Mac") !== -1 && N() && "ontouchend" in document;
322
- }, this._checkForMobile(), v() && window.addEventListener("resize", this._checkForMobile));
323
- }
324
- _restoreEngineAfterContextLost(e) {
325
- setTimeout(async () => {
326
- var t;
327
- this._dummyFramebuffer = null;
328
- const r = this._depthCullingState.depthTest, s = this._depthCullingState.depthFunc, i = this._depthCullingState.depthMask, n = this._stencilState.stencilTest;
329
- await e(), this.wipeCaches(!0), this._rebuildEffects(), (t = this._rebuildComputeEffects) === null || t === void 0 || t.call(this), this._rebuildBuffers(), this._rebuildInternalTextures(), this._rebuildRenderTargetWrappers(), this.wipeCaches(!0), this._depthCullingState.depthTest = r, this._depthCullingState.depthFunc = s, this._depthCullingState.depthMask = i, this._stencilState.stencilTest = n, y.Warn(this.name + " context successfully restored."), this.onContextRestoredObservable.notifyObservers(this), this._contextWasLost = !1;
330
- }, 0);
331
- }
332
- /**
333
- * Shared initialization across engines types.
334
- * @param canvas The canvas associated with this instance of the engine.
335
- */
336
- _sharedInit(e) {
337
- this._renderingCanvas = e;
338
- }
339
- /**
340
- * @internal
341
- */
342
- _getShaderProcessingContext(e) {
343
- return null;
344
- }
345
- _rebuildInternalTextures() {
346
- const e = this._internalTexturesCache.slice();
347
- for (const t of e)
348
- t._rebuild();
349
- }
350
- _rebuildRenderTargetWrappers() {
351
- const e = this._renderTargetWrapperCache.slice();
352
- for (const t of e)
353
- t._rebuild();
354
- }
355
- _rebuildEffects() {
356
- for (const e in this._compiledEffects) {
357
- const t = this._compiledEffects[e];
358
- t._pipelineContext = null, t._wasPreviouslyReady = !1, t._prepareEffect();
359
- }
360
- G.ResetCache();
361
- }
362
- /**
363
- * Gets a boolean indicating if all created effects are ready
364
- * @returns true if all effects are ready
365
- */
366
- areAllEffectsReady() {
367
- for (const e in this._compiledEffects)
368
- if (!this._compiledEffects[e].isReady())
369
- return !1;
370
- return !0;
371
- }
372
- _rebuildBuffers() {
373
- for (const e of this._uniformBuffers)
374
- e._rebuild();
375
- for (const e of this._storageBuffers)
376
- e._rebuild();
377
- }
378
- _initGLContext() {
379
- var e;
380
- this._caps = {
381
- maxTexturesImageUnits: this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),
382
- maxCombinedTexturesImageUnits: this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),
383
- maxVertexTextureImageUnits: this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),
384
- maxTextureSize: this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),
385
- maxSamples: this._webGLVersion > 1 ? this._gl.getParameter(this._gl.MAX_SAMPLES) : 1,
386
- maxCubemapTextureSize: this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),
387
- maxRenderTextureSize: this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),
388
- maxVertexAttribs: this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),
389
- maxVaryingVectors: this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),
390
- maxFragmentUniformVectors: this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),
391
- maxVertexUniformVectors: this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),
392
- parallelShaderCompile: this._gl.getExtension("KHR_parallel_shader_compile") || void 0,
393
- standardDerivatives: this._webGLVersion > 1 || this._gl.getExtension("OES_standard_derivatives") !== null,
394
- maxAnisotropy: 1,
395
- astc: this._gl.getExtension("WEBGL_compressed_texture_astc") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),
396
- bptc: this._gl.getExtension("EXT_texture_compression_bptc") || this._gl.getExtension("WEBKIT_EXT_texture_compression_bptc"),
397
- s3tc: this._gl.getExtension("WEBGL_compressed_texture_s3tc") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),
398
- // eslint-disable-next-line @typescript-eslint/naming-convention
399
- s3tc_srgb: this._gl.getExtension("WEBGL_compressed_texture_s3tc_srgb") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc_srgb"),
400
- pvrtc: this._gl.getExtension("WEBGL_compressed_texture_pvrtc") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
401
- etc1: this._gl.getExtension("WEBGL_compressed_texture_etc1") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),
402
- etc2: this._gl.getExtension("WEBGL_compressed_texture_etc") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc") || this._gl.getExtension("WEBGL_compressed_texture_es3_0"),
403
- textureAnisotropicFilterExtension: this._gl.getExtension("EXT_texture_filter_anisotropic") || this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic") || this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),
404
- uintIndices: this._webGLVersion > 1 || this._gl.getExtension("OES_element_index_uint") !== null,
405
- fragmentDepthSupported: this._webGLVersion > 1 || this._gl.getExtension("EXT_frag_depth") !== null,
406
- highPrecisionShaderSupported: !1,
407
- timerQuery: this._gl.getExtension("EXT_disjoint_timer_query_webgl2") || this._gl.getExtension("EXT_disjoint_timer_query"),
408
- supportOcclusionQuery: this._webGLVersion > 1,
409
- canUseTimestampForTimerQuery: !1,
410
- drawBuffersExtension: !1,
411
- maxMSAASamples: 1,
412
- colorBufferFloat: !!(this._webGLVersion > 1 && this._gl.getExtension("EXT_color_buffer_float")),
413
- colorBufferHalfFloat: !!(this._webGLVersion > 1 && this._gl.getExtension("EXT_color_buffer_half_float")),
414
- textureFloat: !!(this._webGLVersion > 1 || this._gl.getExtension("OES_texture_float")),
415
- textureHalfFloat: !!(this._webGLVersion > 1 || this._gl.getExtension("OES_texture_half_float")),
416
- textureHalfFloatRender: !1,
417
- textureFloatLinearFiltering: !1,
418
- textureFloatRender: !1,
419
- textureHalfFloatLinearFiltering: !1,
420
- vertexArrayObject: !1,
421
- instancedArrays: !1,
422
- textureLOD: !!(this._webGLVersion > 1 || this._gl.getExtension("EXT_shader_texture_lod")),
423
- texelFetch: this._webGLVersion !== 1,
424
- blendMinMax: !1,
425
- multiview: this._gl.getExtension("OVR_multiview2"),
426
- oculusMultiview: this._gl.getExtension("OCULUS_multiview"),
427
- depthTextureExtension: !1,
428
- canUseGLInstanceID: this._webGLVersion > 1,
429
- canUseGLVertexID: this._webGLVersion > 1,
430
- supportComputeShaders: !1,
431
- supportSRGBBuffers: !1,
432
- supportTransformFeedbacks: this._webGLVersion > 1,
433
- textureMaxLevel: this._webGLVersion > 1,
434
- texture2DArrayMaxLayerCount: this._webGLVersion > 1 ? this._gl.getParameter(this._gl.MAX_ARRAY_TEXTURE_LAYERS) : 128,
435
- disableMorphTargetTexture: !1
436
- }, this._glVersion = this._gl.getParameter(this._gl.VERSION);
437
- const t = this._gl.getExtension("WEBGL_debug_renderer_info");
438
- if (t != null && (this._glRenderer = this._gl.getParameter(t.UNMASKED_RENDERER_WEBGL), this._glVendor = this._gl.getParameter(t.UNMASKED_VENDOR_WEBGL)), this._glVendor || (this._glVendor = this._gl.getParameter(this._gl.VENDOR) || "Unknown vendor"), this._glRenderer || (this._glRenderer = this._gl.getParameter(this._gl.RENDERER) || "Unknown renderer"), this._gl.HALF_FLOAT_OES !== 36193 && (this._gl.HALF_FLOAT_OES = 36193), this._gl.RGBA16F !== 34842 && (this._gl.RGBA16F = 34842), this._gl.RGBA32F !== 34836 && (this._gl.RGBA32F = 34836), this._gl.DEPTH24_STENCIL8 !== 35056 && (this._gl.DEPTH24_STENCIL8 = 35056), this._caps.timerQuery && (this._webGLVersion === 1 && (this._gl.getQuery = this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)), this._caps.canUseTimestampForTimerQuery = ((e = this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT, this._caps.timerQuery.QUERY_COUNTER_BITS_EXT)) !== null && e !== void 0 ? e : 0) > 0), this._caps.maxAnisotropy = this._caps.textureAnisotropicFilterExtension ? this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0, this._caps.textureFloatLinearFiltering = !!(this._caps.textureFloat && this._gl.getExtension("OES_texture_float_linear")), this._caps.textureFloatRender = !!(this._caps.textureFloat && this._canRenderToFloatFramebuffer()), this._caps.textureHalfFloatLinearFiltering = !!(this._webGLVersion > 1 || this._caps.textureHalfFloat && this._gl.getExtension("OES_texture_half_float_linear")), this._caps.astc && (this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR), this._caps.bptc && (this._gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = this._caps.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT), this._caps.s3tc_srgb && (this._gl.COMPRESSED_SRGB_S3TC_DXT1_EXT = this._caps.s3tc_srgb.COMPRESSED_SRGB_S3TC_DXT1_EXT, this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT), this._caps.etc2 && (this._gl.COMPRESSED_SRGB8_ETC2 = this._caps.etc2.COMPRESSED_SRGB8_ETC2, this._gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = this._caps.etc2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC), this._webGLVersion > 1 && this._gl.HALF_FLOAT_OES !== 5131 && (this._gl.HALF_FLOAT_OES = 5131), this._caps.textureHalfFloatRender = this._caps.textureHalfFloat && this._canRenderToHalfFloatFramebuffer(), this._webGLVersion > 1)
439
- this._caps.drawBuffersExtension = !0, this._caps.maxMSAASamples = this._maxMSAASamplesOverride !== null ? this._maxMSAASamplesOverride : this._gl.getParameter(this._gl.MAX_SAMPLES);
440
- else {
441
- const r = this._gl.getExtension("WEBGL_draw_buffers");
442
- if (r !== null) {
443
- this._caps.drawBuffersExtension = !0, this._gl.drawBuffers = r.drawBuffersWEBGL.bind(r), this._gl.DRAW_FRAMEBUFFER = this._gl.FRAMEBUFFER;
444
- for (let s = 0; s < 16; s++)
445
- this._gl["COLOR_ATTACHMENT" + s + "_WEBGL"] = r["COLOR_ATTACHMENT" + s + "_WEBGL"];
446
- }
447
- }
448
- if (this._webGLVersion > 1)
449
- this._caps.depthTextureExtension = !0;
450
- else {
451
- const r = this._gl.getExtension("WEBGL_depth_texture");
452
- r != null && (this._caps.depthTextureExtension = !0, this._gl.UNSIGNED_INT_24_8 = r.UNSIGNED_INT_24_8_WEBGL);
453
- }
454
- if (this.disableVertexArrayObjects)
455
- this._caps.vertexArrayObject = !1;
456
- else if (this._webGLVersion > 1)
457
- this._caps.vertexArrayObject = !0;
458
- else {
459
- const r = this._gl.getExtension("OES_vertex_array_object");
460
- r != null && (this._caps.vertexArrayObject = !0, this._gl.createVertexArray = r.createVertexArrayOES.bind(r), this._gl.bindVertexArray = r.bindVertexArrayOES.bind(r), this._gl.deleteVertexArray = r.deleteVertexArrayOES.bind(r));
461
- }
462
- if (this._webGLVersion > 1)
463
- this._caps.instancedArrays = !0;
464
- else {
465
- const r = this._gl.getExtension("ANGLE_instanced_arrays");
466
- r != null ? (this._caps.instancedArrays = !0, this._gl.drawArraysInstanced = r.drawArraysInstancedANGLE.bind(r), this._gl.drawElementsInstanced = r.drawElementsInstancedANGLE.bind(r), this._gl.vertexAttribDivisor = r.vertexAttribDivisorANGLE.bind(r)) : this._caps.instancedArrays = !1;
467
- }
468
- if (this._gl.getShaderPrecisionFormat) {
469
- const r = this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER, this._gl.HIGH_FLOAT), s = this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER, this._gl.HIGH_FLOAT);
470
- r && s && (this._caps.highPrecisionShaderSupported = r.precision !== 0 && s.precision !== 0);
471
- }
472
- if (this._webGLVersion > 1)
473
- this._caps.blendMinMax = !0;
474
- else {
475
- const r = this._gl.getExtension("EXT_blend_minmax");
476
- r != null && (this._caps.blendMinMax = !0, this._gl.MAX = r.MAX_EXT, this._gl.MIN = r.MIN_EXT);
477
- }
478
- if (!this._caps.supportSRGBBuffers) {
479
- if (this._webGLVersion > 1)
480
- this._caps.supportSRGBBuffers = !0, this._glSRGBExtensionValues = {
481
- SRGB: WebGL2RenderingContext.SRGB,
482
- SRGB8: WebGL2RenderingContext.SRGB8,
483
- SRGB8_ALPHA8: WebGL2RenderingContext.SRGB8_ALPHA8
484
- };
485
- else {
486
- const r = this._gl.getExtension("EXT_sRGB");
487
- r != null && (this._caps.supportSRGBBuffers = !0, this._glSRGBExtensionValues = {
488
- SRGB: r.SRGB_EXT,
489
- SRGB8: r.SRGB_ALPHA_EXT,
490
- SRGB8_ALPHA8: r.SRGB_ALPHA_EXT
491
- });
492
- }
493
- this._caps.supportSRGBBuffers = this._caps.supportSRGBBuffers && !!(this._creationOptions && this._creationOptions.forceSRGBBufferSupportState);
494
- }
495
- this._depthCullingState.depthTest = !0, this._depthCullingState.depthFunc = this._gl.LEQUAL, this._depthCullingState.depthMask = !0, this._maxSimultaneousTextures = this._caps.maxCombinedTexturesImageUnits;
496
- for (let r = 0; r < this._maxSimultaneousTextures; r++)
497
- this._nextFreeTextureSlots.push(r);
498
- this._glRenderer === "Mali-G72" && (this._caps.disableMorphTargetTexture = !0);
499
- }
500
- _initFeatures() {
501
- this._features = {
502
- forceBitmapOverHTMLImageElement: !1,
503
- supportRenderAndCopyToLodForFloatTextures: this._webGLVersion !== 1,
504
- supportDepthStencilTexture: this._webGLVersion !== 1,
505
- supportShadowSamplers: this._webGLVersion !== 1,
506
- uniformBufferHardCheckMatrix: !1,
507
- allowTexturePrefiltering: this._webGLVersion !== 1,
508
- trackUbosInFrame: !1,
509
- checkUbosContentBeforeUpload: !1,
510
- supportCSM: this._webGLVersion !== 1,
511
- basisNeedsPOT: this._webGLVersion === 1,
512
- support3DTextures: this._webGLVersion !== 1,
513
- needTypeSuffixInShaderConstants: this._webGLVersion !== 1,
514
- supportMSAA: this._webGLVersion !== 1,
515
- supportSSAO2: this._webGLVersion !== 1,
516
- supportExtendedTextureFormats: this._webGLVersion !== 1,
517
- supportSwitchCaseInShader: this._webGLVersion !== 1,
518
- supportSyncTextureRead: !0,
519
- needsInvertingBitmap: !0,
520
- useUBOBindingCache: !0,
521
- needShaderCodeInlining: !1,
522
- needToAlwaysBindUniformBuffers: !1,
523
- supportRenderPasses: !1,
524
- supportSpriteInstancing: !0,
525
- _collectUbosUpdatedInFrame: !1
526
- };
527
- }
528
- /**
529
- * Gets version of the current webGL context
530
- * Keep it for back compat - use version instead
531
- */
532
- get webGLVersion() {
533
- return this._webGLVersion;
534
- }
535
- /**
536
- * Gets a string identifying the name of the class
537
- * @returns "Engine" string
538
- */
539
- getClassName() {
540
- return "ThinEngine";
541
- }
542
- /**
543
- * Returns true if the stencil buffer has been enabled through the creation option of the context.
544
- */
545
- get isStencilEnable() {
546
- return this._isStencilEnable;
547
- }
548
- /** @internal */
549
- _prepareWorkingCanvas() {
550
- if (this._workingCanvas)
551
- return;
552
- this._workingCanvas = this.createCanvas(1, 1);
553
- const e = this._workingCanvas.getContext("2d");
554
- e && (this._workingContext = e);
555
- }
556
- /**
557
- * Reset the texture cache to empty state
558
- */
559
- resetTextureCache() {
560
- for (const e in this._boundTexturesCache)
561
- Object.prototype.hasOwnProperty.call(this._boundTexturesCache, e) && (this._boundTexturesCache[e] = null);
562
- this._currentTextureChannel = -1;
563
- }
564
- /**
565
- * Gets an object containing information about the current engine context
566
- * @returns an object containing the vendor, the renderer and the version of the current engine context
567
- */
568
- getInfo() {
569
- return this.getGlInfo();
570
- }
571
- /**
572
- * Gets an object containing information about the current webGL context
573
- * @returns an object containing the vendor, the renderer and the version of the current webGL context
574
- */
575
- getGlInfo() {
576
- return {
577
- vendor: this._glVendor,
578
- renderer: this._glRenderer,
579
- version: this._glVersion
580
- };
581
- }
582
- /**
583
- * Defines the hardware scaling level.
584
- * By default the hardware scaling level is computed from the window device ratio.
585
- * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.
586
- * @param level defines the level to use
587
- */
588
- setHardwareScalingLevel(e) {
589
- this._hardwareScalingLevel = e, this.resize();
590
- }
591
- /**
592
- * Gets the current hardware scaling level.
593
- * By default the hardware scaling level is computed from the window device ratio.
594
- * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.
595
- * @returns a number indicating the current hardware scaling level
596
- */
597
- getHardwareScalingLevel() {
598
- return this._hardwareScalingLevel;
599
- }
600
- /**
601
- * Gets the list of loaded textures
602
- * @returns an array containing all loaded textures
603
- */
604
- getLoadedTexturesCache() {
605
- return this._internalTexturesCache;
606
- }
607
- /**
608
- * Gets the object containing all engine capabilities
609
- * @returns the EngineCapabilities object
610
- */
611
- getCaps() {
612
- return this._caps;
613
- }
614
- /**
615
- * stop executing a render loop function and remove it from the execution array
616
- * @param renderFunction defines the function to be removed. If not provided all functions will be removed.
617
- */
618
- stopRenderLoop(e) {
619
- if (!e) {
620
- this._activeRenderLoops.length = 0;
621
- return;
622
- }
623
- const t = this._activeRenderLoops.indexOf(e);
624
- t >= 0 && this._activeRenderLoops.splice(t, 1);
625
- }
626
- /** @internal */
627
- _renderLoop() {
628
- if (!this._contextWasLost) {
629
- let e = !0;
630
- if ((this._isDisposed || !this.renderEvenInBackground && this._windowIsBackground) && (e = !1), e) {
631
- this.beginFrame();
632
- for (let t = 0; t < this._activeRenderLoops.length; t++) {
633
- const r = this._activeRenderLoops[t];
634
- r();
635
- }
636
- this.endFrame();
637
- }
638
- }
639
- this._activeRenderLoops.length > 0 ? this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow()) : this._renderingQueueLaunched = !1;
640
- }
641
- /**
642
- * Gets the HTML canvas attached with the current webGL context
643
- * @returns a HTML canvas
644
- */
645
- getRenderingCanvas() {
646
- return this._renderingCanvas;
647
- }
648
- /**
649
- * Gets the audio context specified in engine initialization options
650
- * @returns an Audio Context
651
- */
652
- getAudioContext() {
653
- return this._audioContext;
654
- }
655
- /**
656
- * Gets the audio destination specified in engine initialization options
657
- * @returns an audio destination node
658
- */
659
- getAudioDestination() {
660
- return this._audioDestination;
661
- }
662
- /**
663
- * Gets host window
664
- * @returns the host window object
665
- */
666
- getHostWindow() {
667
- return v() ? this._renderingCanvas && this._renderingCanvas.ownerDocument && this._renderingCanvas.ownerDocument.defaultView ? this._renderingCanvas.ownerDocument.defaultView : window : null;
668
- }
669
- /**
670
- * Gets the current render width
671
- * @param useScreen defines if screen size must be used (or the current render target if any)
672
- * @returns a number defining the current render width
673
- */
674
- getRenderWidth(e = !1) {
675
- return !e && this._currentRenderTarget ? this._currentRenderTarget.width : this._framebufferDimensionsObject ? this._framebufferDimensionsObject.framebufferWidth : this._gl.drawingBufferWidth;
676
- }
677
- /**
678
- * Gets the current render height
679
- * @param useScreen defines if screen size must be used (or the current render target if any)
680
- * @returns a number defining the current render height
681
- */
682
- getRenderHeight(e = !1) {
683
- return !e && this._currentRenderTarget ? this._currentRenderTarget.height : this._framebufferDimensionsObject ? this._framebufferDimensionsObject.framebufferHeight : this._gl.drawingBufferHeight;
684
- }
685
- /**
686
- * Can be used to override the current requestAnimationFrame requester.
687
- * @internal
688
- */
689
- _queueNewFrame(e, t) {
690
- return R.QueueNewFrame(e, t);
691
- }
692
- /**
693
- * Register and execute a render loop. The engine can have more than one render function
694
- * @param renderFunction defines the function to continuously execute
695
- */
696
- runRenderLoop(e) {
697
- this._activeRenderLoops.indexOf(e) === -1 && (this._activeRenderLoops.push(e), this._renderingQueueLaunched || (this._renderingQueueLaunched = !0, this._boundRenderFunction = this._renderLoop.bind(this), this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow())));
698
- }
699
- /**
700
- * Clear the current render buffer or the current render target (if any is set up)
701
- * @param color defines the color to use
702
- * @param backBuffer defines if the back buffer must be cleared
703
- * @param depth defines if the depth buffer must be cleared
704
- * @param stencil defines if the stencil buffer must be cleared
705
- */
706
- clear(e, t, r, s = !1) {
707
- const i = this.stencilStateComposer.useStencilGlobalOnly;
708
- this.stencilStateComposer.useStencilGlobalOnly = !0, this.applyStates(), this.stencilStateComposer.useStencilGlobalOnly = i;
709
- let n = 0;
710
- t && e && (this._gl.clearColor(e.r, e.g, e.b, e.a !== void 0 ? e.a : 1), n |= this._gl.COLOR_BUFFER_BIT), r && (this.useReverseDepthBuffer ? (this._depthCullingState.depthFunc = this._gl.GEQUAL, this._gl.clearDepth(0)) : this._gl.clearDepth(1), n |= this._gl.DEPTH_BUFFER_BIT), s && (this._gl.clearStencil(0), n |= this._gl.STENCIL_BUFFER_BIT), this._gl.clear(n);
711
- }
712
- /**
713
- * @internal
714
- */
715
- _viewport(e, t, r, s) {
716
- (e !== this._viewportCached.x || t !== this._viewportCached.y || r !== this._viewportCached.z || s !== this._viewportCached.w) && (this._viewportCached.x = e, this._viewportCached.y = t, this._viewportCached.z = r, this._viewportCached.w = s, this._gl.viewport(e, t, r, s));
717
- }
718
- /**
719
- * Set the WebGL's viewport
720
- * @param viewport defines the viewport element to be used
721
- * @param requiredWidth defines the width required for rendering. If not provided the rendering canvas' width is used
722
- * @param requiredHeight defines the height required for rendering. If not provided the rendering canvas' height is used
723
- */
724
- setViewport(e, t, r) {
725
- const s = t || this.getRenderWidth(), i = r || this.getRenderHeight(), n = e.x || 0, l = e.y || 0;
726
- this._cachedViewport = e, this._viewport(n * s, l * i, s * e.width, i * e.height);
727
- }
728
- /**
729
- * Begin a new frame
730
- */
731
- beginFrame() {
732
- }
733
- /**
734
- * Enf the current frame
735
- */
736
- endFrame() {
737
- this._badOS && this.flushFramebuffer(), this._frameId++;
738
- }
739
- /**
740
- * Resize the view according to the canvas' size
741
- * @param forceSetSize true to force setting the sizes of the underlying canvas
742
- */
743
- resize(e = !1) {
744
- let t, r;
745
- if (this.adaptToDeviceRatio) {
746
- const s = v() && window.devicePixelRatio || 1, i = this._lastDevicePixelRatio / s;
747
- this._lastDevicePixelRatio = s, this._hardwareScalingLevel *= i;
748
- }
749
- if (v() && N())
750
- if (this._renderingCanvas) {
751
- const s = this._renderingCanvas.getBoundingClientRect ? this._renderingCanvas.getBoundingClientRect() : {
752
- // fallback to last solution in case the function doesn't exist
753
- width: this._renderingCanvas.width * this._hardwareScalingLevel,
754
- height: this._renderingCanvas.height * this._hardwareScalingLevel
755
- };
756
- t = this._renderingCanvas.clientWidth || s.width || this._renderingCanvas.width || 100, r = this._renderingCanvas.clientHeight || s.height || this._renderingCanvas.height || 100;
757
- } else
758
- t = window.innerWidth, r = window.innerHeight;
759
- else
760
- t = this._renderingCanvas ? this._renderingCanvas.width : 100, r = this._renderingCanvas ? this._renderingCanvas.height : 100;
761
- this.setSize(t / this._hardwareScalingLevel, r / this._hardwareScalingLevel, e);
762
- }
763
- /**
764
- * Force a specific size of the canvas
765
- * @param width defines the new canvas' width
766
- * @param height defines the new canvas' height
767
- * @param forceSetSize true to force setting the sizes of the underlying canvas
768
- * @returns true if the size was changed
769
- */
770
- setSize(e, t, r = !1) {
771
- return !this._renderingCanvas || (e = e | 0, t = t | 0, !r && this._renderingCanvas.width === e && this._renderingCanvas.height === t) ? !1 : (this._renderingCanvas.width = e, this._renderingCanvas.height = t, !0);
772
- }
773
- /**
774
- * Binds the frame buffer to the specified texture.
775
- * @param rtWrapper The render target wrapper to render to
776
- * @param faceIndex The face of the texture to render to in case of cube texture and if the render target wrapper is not a multi render target
777
- * @param requiredWidth The width of the target to render to
778
- * @param requiredHeight The height of the target to render to
779
- * @param forceFullscreenViewport Forces the viewport to be the entire texture/screen if true
780
- * @param lodLevel Defines the lod level to bind to the frame buffer
781
- * @param layer Defines the 2d array index to bind to the frame buffer if the render target wrapper is not a multi render target
782
- */
783
- bindFramebuffer(e, t = 0, r, s, i, n = 0, l = 0) {
784
- var a, _, h, f, g;
785
- const c = e;
786
- this._currentRenderTarget && this.unBindFramebuffer(this._currentRenderTarget), this._currentRenderTarget = e, this._bindUnboundFramebuffer(c._MSAAFramebuffer ? c._MSAAFramebuffer : c._framebuffer);
787
- const u = this._gl;
788
- e.isMulti || (e.is2DArray ? u.framebufferTextureLayer(u.FRAMEBUFFER, u.COLOR_ATTACHMENT0, (a = e.texture._hardwareTexture) === null || a === void 0 ? void 0 : a.underlyingResource, n, l) : e.isCube && u.framebufferTexture2D(u.FRAMEBUFFER, u.COLOR_ATTACHMENT0, u.TEXTURE_CUBE_MAP_POSITIVE_X + t, (_ = e.texture._hardwareTexture) === null || _ === void 0 ? void 0 : _.underlyingResource, n));
789
- const E = e._depthStencilTexture;
790
- if (E) {
791
- const d = e._depthStencilTextureWithStencil ? u.DEPTH_STENCIL_ATTACHMENT : u.DEPTH_ATTACHMENT;
792
- e.is2DArray ? u.framebufferTextureLayer(u.FRAMEBUFFER, d, (h = E._hardwareTexture) === null || h === void 0 ? void 0 : h.underlyingResource, n, l) : e.isCube ? u.framebufferTexture2D(u.FRAMEBUFFER, d, u.TEXTURE_CUBE_MAP_POSITIVE_X + t, (f = E._hardwareTexture) === null || f === void 0 ? void 0 : f.underlyingResource, n) : u.framebufferTexture2D(u.FRAMEBUFFER, d, u.TEXTURE_2D, (g = E._hardwareTexture) === null || g === void 0 ? void 0 : g.underlyingResource, n);
793
- }
794
- this._cachedViewport && !i ? this.setViewport(this._cachedViewport, r, s) : (r || (r = e.width, n && (r = r / Math.pow(2, n))), s || (s = e.height, n && (s = s / Math.pow(2, n))), this._viewport(0, 0, r, s)), this.wipeCaches();
795
- }
796
- /**
797
- * Set various states to the webGL context
798
- * @param culling defines culling state: true to enable culling, false to disable it
799
- * @param zOffset defines the value to apply to zOffset (0 by default)
800
- * @param force defines if states must be applied even if cache is up to date
801
- * @param reverseSide defines if culling must be reversed (CCW if false, CW if true)
802
- * @param cullBackFaces true to cull back faces, false to cull front faces (if culling is enabled)
803
- * @param stencil stencil states to set
804
- * @param zOffsetUnits defines the value to apply to zOffsetUnits (0 by default)
805
- */
806
- setState(e, t = 0, r, s = !1, i, n, l = 0) {
807
- var a, _;
808
- (this._depthCullingState.cull !== e || r) && (this._depthCullingState.cull = e);
809
- const h = !((_ = (a = this.cullBackFaces) !== null && a !== void 0 ? a : i) !== null && _ !== void 0) || _ ? this._gl.BACK : this._gl.FRONT;
810
- (this._depthCullingState.cullFace !== h || r) && (this._depthCullingState.cullFace = h), this.setZOffset(t), this.setZOffsetUnits(l);
811
- const f = s ? this._gl.CW : this._gl.CCW;
812
- (this._depthCullingState.frontFace !== f || r) && (this._depthCullingState.frontFace = f), this._stencilStateComposer.stencilMaterial = n;
813
- }
814
- /**
815
- * Gets a boolean indicating if depth testing is enabled
816
- * @returns the current state
817
- */
818
- getDepthBuffer() {
819
- return this._depthCullingState.depthTest;
820
- }
821
- /**
822
- * Enable or disable depth buffering
823
- * @param enable defines the state to set
824
- */
825
- setDepthBuffer(e) {
826
- this._depthCullingState.depthTest = e;
827
- }
828
- /**
829
- * Set the z offset Factor to apply to current rendering
830
- * @param value defines the offset to apply
831
- */
832
- setZOffset(e) {
833
- this._depthCullingState.zOffset = this.useReverseDepthBuffer ? -e : e;
834
- }
835
- /**
836
- * Gets the current value of the zOffset Factor
837
- * @returns the current zOffset Factor state
838
- */
839
- getZOffset() {
840
- const e = this._depthCullingState.zOffset;
841
- return this.useReverseDepthBuffer ? -e : e;
842
- }
843
- /**
844
- * Set the z offset Units to apply to current rendering
845
- * @param value defines the offset to apply
846
- */
847
- setZOffsetUnits(e) {
848
- this._depthCullingState.zOffsetUnits = this.useReverseDepthBuffer ? -e : e;
849
- }
850
- /**
851
- * Gets the current value of the zOffset Units
852
- * @returns the current zOffset Units state
853
- */
854
- getZOffsetUnits() {
855
- const e = this._depthCullingState.zOffsetUnits;
856
- return this.useReverseDepthBuffer ? -e : e;
857
- }
858
- /**
859
- * @internal
860
- */
861
- _bindUnboundFramebuffer(e) {
862
- this._currentFramebuffer !== e && (this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, e), this._currentFramebuffer = e);
863
- }
864
- /** @internal */
865
- _currentFrameBufferIsDefaultFrameBuffer() {
866
- return this._currentFramebuffer === null;
867
- }
868
- /**
869
- * Generates the mipmaps for a texture
870
- * @param texture texture to generate the mipmaps for
871
- */
872
- generateMipmaps(e) {
873
- this._bindTextureDirectly(this._gl.TEXTURE_2D, e, !0), this._gl.generateMipmap(this._gl.TEXTURE_2D), this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
874
- }
875
- /**
876
- * Unbind the current render target texture from the webGL context
877
- * @param texture defines the render target wrapper to unbind
878
- * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated
879
- * @param onBeforeUnbind defines a function which will be called before the effective unbind
880
- */
881
- unBindFramebuffer(e, t = !1, r) {
882
- var s;
883
- const i = e;
884
- this._currentRenderTarget = null;
885
- const n = this._gl;
886
- if (i._MSAAFramebuffer) {
887
- if (e.isMulti) {
888
- this.unBindMultiColorAttachmentFramebuffer(e, t, r);
889
- return;
890
- }
891
- n.bindFramebuffer(n.READ_FRAMEBUFFER, i._MSAAFramebuffer), n.bindFramebuffer(n.DRAW_FRAMEBUFFER, i._framebuffer), n.blitFramebuffer(0, 0, e.width, e.height, 0, 0, e.width, e.height, n.COLOR_BUFFER_BIT, n.NEAREST);
892
- }
893
- !((s = e.texture) === null || s === void 0) && s.generateMipMaps && !t && !e.isCube && this.generateMipmaps(e.texture), r && (i._MSAAFramebuffer && this._bindUnboundFramebuffer(i._framebuffer), r()), this._bindUnboundFramebuffer(null);
894
- }
895
- /**
896
- * Force a webGL flush (ie. a flush of all waiting webGL commands)
897
- */
898
- flushFramebuffer() {
899
- this._gl.flush();
900
- }
901
- /**
902
- * Unbind the current render target and bind the default framebuffer
903
- */
904
- restoreDefaultFramebuffer() {
905
- this._currentRenderTarget ? this.unBindFramebuffer(this._currentRenderTarget) : this._bindUnboundFramebuffer(null), this._cachedViewport && this.setViewport(this._cachedViewport), this.wipeCaches();
906
- }
907
- // VBOs
908
- /** @internal */
909
- _resetVertexBufferBinding() {
910
- this.bindArrayBuffer(null), this._cachedVertexBuffers = null;
911
- }
912
- /**
913
- * Creates a vertex buffer
914
- * @param data the data for the vertex buffer
915
- * @returns the new WebGL static buffer
916
- */
917
- createVertexBuffer(e) {
918
- return this._createVertexBuffer(e, this._gl.STATIC_DRAW);
919
- }
920
- _createVertexBuffer(e, t) {
921
- const r = this._gl.createBuffer();
922
- if (!r)
923
- throw new Error("Unable to create vertex buffer");
924
- const s = new V(r);
925
- return this.bindArrayBuffer(s), e instanceof Array ? this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(e), t) : this._gl.bufferData(this._gl.ARRAY_BUFFER, e, t), this._resetVertexBufferBinding(), s.references = 1, s;
926
- }
927
- /**
928
- * Creates a dynamic vertex buffer
929
- * @param data the data for the dynamic vertex buffer
930
- * @returns the new WebGL dynamic buffer
931
- */
932
- createDynamicVertexBuffer(e) {
933
- return this._createVertexBuffer(e, this._gl.DYNAMIC_DRAW);
934
- }
935
- _resetIndexBufferBinding() {
936
- this.bindIndexBuffer(null), this._cachedIndexBuffer = null;
937
- }
938
- /**
939
- * Creates a new index buffer
940
- * @param indices defines the content of the index buffer
941
- * @param updatable defines if the index buffer must be updatable
942
- * @returns a new webGL buffer
943
- */
944
- createIndexBuffer(e, t) {
945
- const r = this._gl.createBuffer(), s = new V(r);
946
- if (!r)
947
- throw new Error("Unable to create index buffer");
948
- this.bindIndexBuffer(s);
949
- const i = this._normalizeIndexData(e);
950
- return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, i, t ? this._gl.DYNAMIC_DRAW : this._gl.STATIC_DRAW), this._resetIndexBufferBinding(), s.references = 1, s.is32Bits = i.BYTES_PER_ELEMENT === 4, s;
951
- }
952
- _normalizeIndexData(e) {
953
- if (e.BYTES_PER_ELEMENT === 2)
954
- return e;
955
- if (this._caps.uintIndices) {
956
- if (e instanceof Uint32Array)
957
- return e;
958
- for (let r = 0; r < e.length; r++)
959
- if (e[r] >= 65535)
960
- return new Uint32Array(e);
961
- return new Uint16Array(e);
962
- }
963
- return new Uint16Array(e);
964
- }
965
- /**
966
- * Bind a webGL buffer to the webGL context
967
- * @param buffer defines the buffer to bind
968
- */
969
- bindArrayBuffer(e) {
970
- this._vaoRecordInProgress || this._unbindVertexArrayObject(), this._bindBuffer(e, this._gl.ARRAY_BUFFER);
971
- }
972
- /**
973
- * Bind a specific block at a given index in a specific shader program
974
- * @param pipelineContext defines the pipeline context to use
975
- * @param blockName defines the block name
976
- * @param index defines the index where to bind the block
977
- */
978
- bindUniformBlock(e, t, r) {
979
- const s = e.program, i = this._gl.getUniformBlockIndex(s, t);
980
- this._gl.uniformBlockBinding(s, i, r);
981
- }
982
- // eslint-disable-next-line @typescript-eslint/naming-convention
983
- bindIndexBuffer(e) {
984
- this._vaoRecordInProgress || this._unbindVertexArrayObject(), this._bindBuffer(e, this._gl.ELEMENT_ARRAY_BUFFER);
985
- }
986
- _bindBuffer(e, t) {
987
- (this._vaoRecordInProgress || this._currentBoundBuffer[t] !== e) && (this._gl.bindBuffer(t, e ? e.underlyingResource : null), this._currentBoundBuffer[t] = e);
988
- }
989
- /**
990
- * update the bound buffer with the given data
991
- * @param data defines the data to update
992
- */
993
- updateArrayBuffer(e) {
994
- this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, e);
995
- }
996
- _vertexAttribPointer(e, t, r, s, i, n, l) {
997
- const a = this._currentBufferPointers[t];
998
- if (!a)
999
- return;
1000
- let _ = !1;
1001
- a.active ? (a.buffer !== e && (a.buffer = e, _ = !0), a.size !== r && (a.size = r, _ = !0), a.type !== s && (a.type = s, _ = !0), a.normalized !== i && (a.normalized = i, _ = !0), a.stride !== n && (a.stride = n, _ = !0), a.offset !== l && (a.offset = l, _ = !0)) : (_ = !0, a.active = !0, a.index = t, a.size = r, a.type = s, a.normalized = i, a.stride = n, a.offset = l, a.buffer = e), (_ || this._vaoRecordInProgress) && (this.bindArrayBuffer(e), s === this._gl.UNSIGNED_INT || s === this._gl.INT ? this._gl.vertexAttribIPointer(t, r, s, n, l) : this._gl.vertexAttribPointer(t, r, s, i, n, l));
1002
- }
1003
- /**
1004
- * @internal
1005
- */
1006
- _bindIndexBufferWithCache(e) {
1007
- e != null && this._cachedIndexBuffer !== e && (this._cachedIndexBuffer = e, this.bindIndexBuffer(e), this._uintIndicesCurrentlySet = e.is32Bits);
1008
- }
1009
- _bindVertexBuffersAttributes(e, t, r) {
1010
- const s = t.getAttributesNames();
1011
- this._vaoRecordInProgress || this._unbindVertexArrayObject(), this.unbindAllAttributes();
1012
- for (let i = 0; i < s.length; i++) {
1013
- const n = t.getAttributeLocation(i);
1014
- if (n >= 0) {
1015
- const l = s[i];
1016
- let a = null;
1017
- if (r && (a = r[l]), a || (a = e[l]), !a)
1018
- continue;
1019
- this._gl.enableVertexAttribArray(n), this._vaoRecordInProgress || (this._vertexAttribArraysEnabled[n] = !0);
1020
- const _ = a.getBuffer();
1021
- _ && (this._vertexAttribPointer(_, n, a.getSize(), a.type, a.normalized, a.byteStride, a.byteOffset), a.getIsInstanced() && (this._gl.vertexAttribDivisor(n, a.getInstanceDivisor()), this._vaoRecordInProgress || (this._currentInstanceLocations.push(n), this._currentInstanceBuffers.push(_))));
1022
- }
1023
- }
1024
- }
1025
- /**
1026
- * Records a vertex array object
1027
- * @see https://doc.babylonjs.com/setup/support/webGL2#vertex-array-objects
1028
- * @param vertexBuffers defines the list of vertex buffers to store
1029
- * @param indexBuffer defines the index buffer to store
1030
- * @param effect defines the effect to store
1031
- * @param overrideVertexBuffers defines optional list of avertex buffers that overrides the entries in vertexBuffers
1032
- * @returns the new vertex array object
1033
- */
1034
- recordVertexArrayObject(e, t, r, s) {
1035
- const i = this._gl.createVertexArray();
1036
- if (!i)
1037
- throw new Error("Unable to create VAO");
1038
- return this._vaoRecordInProgress = !0, this._gl.bindVertexArray(i), this._mustWipeVertexAttributes = !0, this._bindVertexBuffersAttributes(e, r, s), this.bindIndexBuffer(t), this._vaoRecordInProgress = !1, this._gl.bindVertexArray(null), i;
1039
- }
1040
- /**
1041
- * Bind a specific vertex array object
1042
- * @see https://doc.babylonjs.com/setup/support/webGL2#vertex-array-objects
1043
- * @param vertexArrayObject defines the vertex array object to bind
1044
- * @param indexBuffer defines the index buffer to bind
1045
- */
1046
- bindVertexArrayObject(e, t) {
1047
- this._cachedVertexArrayObject !== e && (this._cachedVertexArrayObject = e, this._gl.bindVertexArray(e), this._cachedVertexBuffers = null, this._cachedIndexBuffer = null, this._uintIndicesCurrentlySet = t != null && t.is32Bits, this._mustWipeVertexAttributes = !0);
1048
- }
1049
- /**
1050
- * Bind webGl buffers directly to the webGL context
1051
- * @param vertexBuffer defines the vertex buffer to bind
1052
- * @param indexBuffer defines the index buffer to bind
1053
- * @param vertexDeclaration defines the vertex declaration to use with the vertex buffer
1054
- * @param vertexStrideSize defines the vertex stride of the vertex buffer
1055
- * @param effect defines the effect associated with the vertex buffer
1056
- */
1057
- bindBuffersDirectly(e, t, r, s, i) {
1058
- if (this._cachedVertexBuffers !== e || this._cachedEffectForVertexBuffers !== i) {
1059
- this._cachedVertexBuffers = e, this._cachedEffectForVertexBuffers = i;
1060
- const n = i.getAttributesCount();
1061
- this._unbindVertexArrayObject(), this.unbindAllAttributes();
1062
- let l = 0;
1063
- for (let a = 0; a < n; a++)
1064
- if (a < r.length) {
1065
- const _ = i.getAttributeLocation(a);
1066
- _ >= 0 && (this._gl.enableVertexAttribArray(_), this._vertexAttribArraysEnabled[_] = !0, this._vertexAttribPointer(e, _, r[a], this._gl.FLOAT, !1, s, l)), l += r[a] * 4;
1067
- }
1068
- }
1069
- this._bindIndexBufferWithCache(t);
1070
- }
1071
- _unbindVertexArrayObject() {
1072
- this._cachedVertexArrayObject && (this._cachedVertexArrayObject = null, this._gl.bindVertexArray(null));
1073
- }
1074
- /**
1075
- * Bind a list of vertex buffers to the webGL context
1076
- * @param vertexBuffers defines the list of vertex buffers to bind
1077
- * @param indexBuffer defines the index buffer to bind
1078
- * @param effect defines the effect associated with the vertex buffers
1079
- * @param overrideVertexBuffers defines optional list of avertex buffers that overrides the entries in vertexBuffers
1080
- */
1081
- bindBuffers(e, t, r, s) {
1082
- (this._cachedVertexBuffers !== e || this._cachedEffectForVertexBuffers !== r) && (this._cachedVertexBuffers = e, this._cachedEffectForVertexBuffers = r, this._bindVertexBuffersAttributes(e, r, s)), this._bindIndexBufferWithCache(t);
1083
- }
1084
- /**
1085
- * Unbind all instance attributes
1086
- */
1087
- unbindInstanceAttributes() {
1088
- let e;
1089
- for (let t = 0, r = this._currentInstanceLocations.length; t < r; t++) {
1090
- const s = this._currentInstanceBuffers[t];
1091
- e != s && s.references && (e = s, this.bindArrayBuffer(s));
1092
- const i = this._currentInstanceLocations[t];
1093
- this._gl.vertexAttribDivisor(i, 0);
1094
- }
1095
- this._currentInstanceBuffers.length = 0, this._currentInstanceLocations.length = 0;
1096
- }
1097
- /**
1098
- * Release and free the memory of a vertex array object
1099
- * @param vao defines the vertex array object to delete
1100
- */
1101
- releaseVertexArrayObject(e) {
1102
- this._gl.deleteVertexArray(e);
1103
- }
1104
- /**
1105
- * @internal
1106
- */
1107
- _releaseBuffer(e) {
1108
- return e.references--, e.references === 0 ? (this._deleteBuffer(e), !0) : !1;
1109
- }
1110
- _deleteBuffer(e) {
1111
- this._gl.deleteBuffer(e.underlyingResource);
1112
- }
1113
- /**
1114
- * Update the content of a webGL buffer used with instantiation and bind it to the webGL context
1115
- * @param instancesBuffer defines the webGL buffer to update and bind
1116
- * @param data defines the data to store in the buffer
1117
- * @param offsetLocations defines the offsets or attributes information used to determine where data must be stored in the buffer
1118
- */
1119
- updateAndBindInstancesBuffer(e, t, r) {
1120
- if (this.bindArrayBuffer(e), t && this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, t), r[0].index !== void 0)
1121
- this.bindInstancesBuffer(e, r, !0);
1122
- else
1123
- for (let s = 0; s < 4; s++) {
1124
- const i = r[s];
1125
- this._vertexAttribArraysEnabled[i] || (this._gl.enableVertexAttribArray(i), this._vertexAttribArraysEnabled[i] = !0), this._vertexAttribPointer(e, i, 4, this._gl.FLOAT, !1, 64, s * 16), this._gl.vertexAttribDivisor(i, 1), this._currentInstanceLocations.push(i), this._currentInstanceBuffers.push(e);
1126
- }
1127
- }
1128
- /**
1129
- * Bind the content of a webGL buffer used with instantiation
1130
- * @param instancesBuffer defines the webGL buffer to bind
1131
- * @param attributesInfo defines the offsets or attributes information used to determine where data must be stored in the buffer
1132
- * @param computeStride defines Whether to compute the strides from the info or use the default 0
1133
- */
1134
- bindInstancesBuffer(e, t, r = !0) {
1135
- this.bindArrayBuffer(e);
1136
- let s = 0;
1137
- if (r)
1138
- for (let i = 0; i < t.length; i++) {
1139
- const n = t[i];
1140
- s += n.attributeSize * 4;
1141
- }
1142
- for (let i = 0; i < t.length; i++) {
1143
- const n = t[i];
1144
- n.index === void 0 && (n.index = this._currentEffect.getAttributeLocationByName(n.attributeName)), !(n.index < 0) && (this._vertexAttribArraysEnabled[n.index] || (this._gl.enableVertexAttribArray(n.index), this._vertexAttribArraysEnabled[n.index] = !0), this._vertexAttribPointer(e, n.index, n.attributeSize, n.attributeType || this._gl.FLOAT, n.normalized || !1, s, n.offset), this._gl.vertexAttribDivisor(n.index, n.divisor === void 0 ? 1 : n.divisor), this._currentInstanceLocations.push(n.index), this._currentInstanceBuffers.push(e));
1145
- }
1146
- }
1147
- /**
1148
- * Disable the instance attribute corresponding to the name in parameter
1149
- * @param name defines the name of the attribute to disable
1150
- */
1151
- disableInstanceAttributeByName(e) {
1152
- if (!this._currentEffect)
1153
- return;
1154
- const t = this._currentEffect.getAttributeLocationByName(e);
1155
- this.disableInstanceAttribute(t);
1156
- }
1157
- /**
1158
- * Disable the instance attribute corresponding to the location in parameter
1159
- * @param attributeLocation defines the attribute location of the attribute to disable
1160
- */
1161
- disableInstanceAttribute(e) {
1162
- let t = !1, r;
1163
- for (; (r = this._currentInstanceLocations.indexOf(e)) !== -1; )
1164
- this._currentInstanceLocations.splice(r, 1), this._currentInstanceBuffers.splice(r, 1), t = !0, r = this._currentInstanceLocations.indexOf(e);
1165
- t && (this._gl.vertexAttribDivisor(e, 0), this.disableAttributeByIndex(e));
1166
- }
1167
- /**
1168
- * Disable the attribute corresponding to the location in parameter
1169
- * @param attributeLocation defines the attribute location of the attribute to disable
1170
- */
1171
- disableAttributeByIndex(e) {
1172
- this._gl.disableVertexAttribArray(e), this._vertexAttribArraysEnabled[e] = !1, this._currentBufferPointers[e].active = !1;
1173
- }
1174
- /**
1175
- * Send a draw order
1176
- * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)
1177
- * @param indexStart defines the starting index
1178
- * @param indexCount defines the number of index to draw
1179
- * @param instancesCount defines the number of instances to draw (if instantiation is enabled)
1180
- */
1181
- draw(e, t, r, s) {
1182
- this.drawElementsType(e ? 0 : 1, t, r, s);
1183
- }
1184
- /**
1185
- * Draw a list of points
1186
- * @param verticesStart defines the index of first vertex to draw
1187
- * @param verticesCount defines the count of vertices to draw
1188
- * @param instancesCount defines the number of instances to draw (if instantiation is enabled)
1189
- */
1190
- drawPointClouds(e, t, r) {
1191
- this.drawArraysType(2, e, t, r);
1192
- }
1193
- /**
1194
- * Draw a list of unindexed primitives
1195
- * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)
1196
- * @param verticesStart defines the index of first vertex to draw
1197
- * @param verticesCount defines the count of vertices to draw
1198
- * @param instancesCount defines the number of instances to draw (if instantiation is enabled)
1199
- */
1200
- drawUnIndexed(e, t, r, s) {
1201
- this.drawArraysType(e ? 0 : 1, t, r, s);
1202
- }
1203
- /**
1204
- * Draw a list of indexed primitives
1205
- * @param fillMode defines the primitive to use
1206
- * @param indexStart defines the starting index
1207
- * @param indexCount defines the number of index to draw
1208
- * @param instancesCount defines the number of instances to draw (if instantiation is enabled)
1209
- */
1210
- drawElementsType(e, t, r, s) {
1211
- this.applyStates(), this._reportDrawCall();
1212
- const i = this._drawMode(e), n = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT, l = this._uintIndicesCurrentlySet ? 4 : 2;
1213
- s ? this._gl.drawElementsInstanced(i, r, n, t * l, s) : this._gl.drawElements(i, r, n, t * l);
1214
- }
1215
- /**
1216
- * Draw a list of unindexed primitives
1217
- * @param fillMode defines the primitive to use
1218
- * @param verticesStart defines the index of first vertex to draw
1219
- * @param verticesCount defines the count of vertices to draw
1220
- * @param instancesCount defines the number of instances to draw (if instantiation is enabled)
1221
- */
1222
- drawArraysType(e, t, r, s) {
1223
- this.applyStates(), this._reportDrawCall();
1224
- const i = this._drawMode(e);
1225
- s ? this._gl.drawArraysInstanced(i, t, r, s) : this._gl.drawArrays(i, t, r);
1226
- }
1227
- _drawMode(e) {
1228
- switch (e) {
1229
- case 0:
1230
- return this._gl.TRIANGLES;
1231
- case 2:
1232
- return this._gl.POINTS;
1233
- case 1:
1234
- return this._gl.LINES;
1235
- case 3:
1236
- return this._gl.POINTS;
1237
- case 4:
1238
- return this._gl.LINES;
1239
- case 5:
1240
- return this._gl.LINE_LOOP;
1241
- case 6:
1242
- return this._gl.LINE_STRIP;
1243
- case 7:
1244
- return this._gl.TRIANGLE_STRIP;
1245
- case 8:
1246
- return this._gl.TRIANGLE_FAN;
1247
- default:
1248
- return this._gl.TRIANGLES;
1249
- }
1250
- }
1251
- /** @internal */
1252
- _reportDrawCall() {
1253
- }
1254
- // Shaders
1255
- /**
1256
- * @internal
1257
- */
1258
- _releaseEffect(e) {
1259
- this._compiledEffects[e._key] && delete this._compiledEffects[e._key];
1260
- const t = e.getPipelineContext();
1261
- t && this._deletePipelineContext(t);
1262
- }
1263
- /**
1264
- * @internal
1265
- */
1266
- _deletePipelineContext(e) {
1267
- const t = e;
1268
- t && t.program && (t.program.__SPECTOR_rebuildProgram = null, this._gl.deleteProgram(t.program));
1269
- }
1270
- /** @internal */
1271
- _getGlobalDefines(e) {
1272
- if (e) {
1273
- this.isNDCHalfZRange ? e.IS_NDC_HALF_ZRANGE = "" : delete e.IS_NDC_HALF_ZRANGE, this.useReverseDepthBuffer ? e.USE_REVERSE_DEPTHBUFFER = "" : delete e.USE_REVERSE_DEPTHBUFFER, this.useExactSrgbConversions ? e.USE_EXACT_SRGB_CONVERSIONS = "" : delete e.USE_EXACT_SRGB_CONVERSIONS;
1274
- return;
1275
- } else {
1276
- let t = "";
1277
- return this.isNDCHalfZRange && (t += "#define IS_NDC_HALF_ZRANGE"), this.useReverseDepthBuffer && (t && (t += `
1278
- `), t += "#define USE_REVERSE_DEPTHBUFFER"), this.useExactSrgbConversions && (t && (t += `
1279
- `), t += "#define USE_EXACT_SRGB_CONVERSIONS"), t;
1280
- }
1281
- }
1282
- /**
1283
- * Create a new effect (used to store vertex/fragment shaders)
1284
- * @param baseName defines the base name of the effect (The name of file without .fragment.fx or .vertex.fx)
1285
- * @param attributesNamesOrOptions defines either a list of attribute names or an IEffectCreationOptions object
1286
- * @param uniformsNamesOrEngine defines either a list of uniform names or the engine to use
1287
- * @param samplers defines an array of string used to represent textures
1288
- * @param defines defines the string containing the defines to use to compile the shaders
1289
- * @param fallbacks defines the list of potential fallbacks to use if shader compilation fails
1290
- * @param onCompiled defines a function to call when the effect creation is successful
1291
- * @param onError defines a function to call when the effect creation has failed
1292
- * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)
1293
- * @param shaderLanguage the language the shader is written in (default: GLSL)
1294
- * @returns the new Effect
1295
- */
1296
- createEffect(e, t, r, s, i, n, l, a, _, h = re.GLSL) {
1297
- var f;
1298
- const g = e.vertexElement || e.vertex || e.vertexToken || e.vertexSource || e, c = e.fragmentElement || e.fragment || e.fragmentToken || e.fragmentSource || e, u = this._getGlobalDefines();
1299
- let E = (f = i ?? t.defines) !== null && f !== void 0 ? f : "";
1300
- u && (E += u);
1301
- const d = g + "+" + c + "@" + E;
1302
- if (this._compiledEffects[d]) {
1303
- const m = this._compiledEffects[d];
1304
- return l && m.isReady() && l(m), m;
1305
- }
1306
- const b = new G(e, t, r, s, this, i, n, l, a, _, d, h);
1307
- return this._compiledEffects[d] = b, b;
1308
- }
1309
- // eslint-disable-next-line @typescript-eslint/naming-convention
1310
- static _ConcatenateShader(e, t, r = "") {
1311
- return r + (t ? t + `
1312
- ` : "") + e;
1313
- }
1314
- _compileShader(e, t, r, s) {
1315
- return this._compileRawShader(R._ConcatenateShader(e, r, s), t);
1316
- }
1317
- _compileRawShader(e, t) {
1318
- const r = this._gl, s = r.createShader(t === "vertex" ? r.VERTEX_SHADER : r.FRAGMENT_SHADER);
1319
- if (!s) {
1320
- let i = r.NO_ERROR, n = r.NO_ERROR;
1321
- for (; (n = r.getError()) !== r.NO_ERROR; )
1322
- i = n;
1323
- throw new Error(`Something went wrong while creating a gl ${t} shader object. gl error=${i}, gl isContextLost=${r.isContextLost()}, _contextWasLost=${this._contextWasLost}`);
1324
- }
1325
- return r.shaderSource(s, e), r.compileShader(s), s;
1326
- }
1327
- /**
1328
- * @internal
1329
- */
1330
- _getShaderSource(e) {
1331
- return this._gl.getShaderSource(e);
1332
- }
1333
- /**
1334
- * Directly creates a webGL program
1335
- * @param pipelineContext defines the pipeline context to attach to
1336
- * @param vertexCode defines the vertex shader code to use
1337
- * @param fragmentCode defines the fragment shader code to use
1338
- * @param context defines the webGL context to use (if not set, the current one will be used)
1339
- * @param transformFeedbackVaryings defines the list of transform feedback varyings to use
1340
- * @returns the new webGL program
1341
- */
1342
- createRawShaderProgram(e, t, r, s, i = null) {
1343
- s = s || this._gl;
1344
- const n = this._compileRawShader(t, "vertex"), l = this._compileRawShader(r, "fragment");
1345
- return this._createShaderProgram(e, n, l, s, i);
1346
- }
1347
- /**
1348
- * Creates a webGL program
1349
- * @param pipelineContext defines the pipeline context to attach to
1350
- * @param vertexCode defines the vertex shader code to use
1351
- * @param fragmentCode defines the fragment shader code to use
1352
- * @param defines defines the string containing the defines to use to compile the shaders
1353
- * @param context defines the webGL context to use (if not set, the current one will be used)
1354
- * @param transformFeedbackVaryings defines the list of transform feedback varyings to use
1355
- * @returns the new webGL program
1356
- */
1357
- createShaderProgram(e, t, r, s, i, n = null) {
1358
- i = i || this._gl;
1359
- const l = this._webGLVersion > 1 ? `#version 300 es
1360
- #define WEBGL2
1361
- ` : "", a = this._compileShader(t, "vertex", s, l), _ = this._compileShader(r, "fragment", s, l);
1362
- return this._createShaderProgram(e, a, _, i, n);
1363
- }
1364
- /**
1365
- * Inline functions in shader code that are marked to be inlined
1366
- * @param code code to inline
1367
- * @returns inlined code
1368
- */
1369
- inlineShaderCode(e) {
1370
- return e;
1371
- }
1372
- /**
1373
- * Creates a new pipeline context
1374
- * @param shaderProcessingContext defines the shader processing context used during the processing if available
1375
- * @returns the new pipeline
1376
- */
1377
- createPipelineContext(e) {
1378
- const t = new q();
1379
- return t.engine = this, this._caps.parallelShaderCompile && (t.isParallelCompiled = !0), t;
1380
- }
1381
- /**
1382
- * Creates a new material context
1383
- * @returns the new context
1384
- */
1385
- createMaterialContext() {
1386
- }
1387
- /**
1388
- * Creates a new draw context
1389
- * @returns the new context
1390
- */
1391
- createDrawContext() {
1392
- }
1393
- _createShaderProgram(e, t, r, s, i = null) {
1394
- const n = s.createProgram();
1395
- if (e.program = n, !n)
1396
- throw new Error("Unable to create program");
1397
- return s.attachShader(n, t), s.attachShader(n, r), s.linkProgram(n), e.context = s, e.vertexShader = t, e.fragmentShader = r, e.isParallelCompiled || this._finalizePipelineContext(e), n;
1398
- }
1399
- _finalizePipelineContext(e) {
1400
- const t = e.context, r = e.vertexShader, s = e.fragmentShader, i = e.program;
1401
- if (!t.getProgramParameter(i, t.LINK_STATUS)) {
1402
- if (!this._gl.getShaderParameter(r, this._gl.COMPILE_STATUS)) {
1403
- const a = this._gl.getShaderInfoLog(r);
1404
- if (a)
1405
- throw e.vertexCompilationError = a, new Error("VERTEX SHADER " + a);
1406
- }
1407
- if (!this._gl.getShaderParameter(s, this._gl.COMPILE_STATUS)) {
1408
- const a = this._gl.getShaderInfoLog(s);
1409
- if (a)
1410
- throw e.fragmentCompilationError = a, new Error("FRAGMENT SHADER " + a);
1411
- }
1412
- const l = t.getProgramInfoLog(i);
1413
- if (l)
1414
- throw e.programLinkError = l, new Error(l);
1415
- }
1416
- if (this.validateShaderPrograms && (t.validateProgram(i), !t.getProgramParameter(i, t.VALIDATE_STATUS))) {
1417
- const a = t.getProgramInfoLog(i);
1418
- if (a)
1419
- throw e.programValidationError = a, new Error(a);
1420
- }
1421
- t.deleteShader(r), t.deleteShader(s), e.vertexShader = void 0, e.fragmentShader = void 0, e.onCompiled && (e.onCompiled(), e.onCompiled = void 0);
1422
- }
1423
- /**
1424
- * @internal
1425
- */
1426
- _preparePipelineContext(e, t, r, s, i, n, l, a, _, h) {
1427
- const f = e;
1428
- s ? f.program = this.createRawShaderProgram(f, t, r, void 0, _) : f.program = this.createShaderProgram(f, t, r, a, void 0, _), f.program.__SPECTOR_rebuildProgram = l;
1429
- }
1430
- /**
1431
- * @internal
1432
- */
1433
- _isRenderingStateCompiled(e) {
1434
- const t = e;
1435
- return this._isDisposed || t._isDisposed ? !1 : this._gl.getProgramParameter(t.program, this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR) ? (this._finalizePipelineContext(t), !0) : !1;
1436
- }
1437
- /**
1438
- * @internal
1439
- */
1440
- _executeWhenRenderingStateIsCompiled(e, t) {
1441
- const r = e;
1442
- if (!r.isParallelCompiled) {
1443
- t();
1444
- return;
1445
- }
1446
- const s = r.onCompiled;
1447
- s ? r.onCompiled = () => {
1448
- s(), t();
1449
- } : r.onCompiled = t;
1450
- }
1451
- /**
1452
- * Gets the list of webGL uniform locations associated with a specific program based on a list of uniform names
1453
- * @param pipelineContext defines the pipeline context to use
1454
- * @param uniformsNames defines the list of uniform names
1455
- * @returns an array of webGL uniform locations
1456
- */
1457
- getUniforms(e, t) {
1458
- const r = new Array(), s = e;
1459
- for (let i = 0; i < t.length; i++)
1460
- r.push(this._gl.getUniformLocation(s.program, t[i]));
1461
- return r;
1462
- }
1463
- /**
1464
- * Gets the list of active attributes for a given webGL program
1465
- * @param pipelineContext defines the pipeline context to use
1466
- * @param attributesNames defines the list of attribute names to get
1467
- * @returns an array of indices indicating the offset of each attribute
1468
- */
1469
- getAttributes(e, t) {
1470
- const r = [], s = e;
1471
- for (let i = 0; i < t.length; i++)
1472
- try {
1473
- r.push(this._gl.getAttribLocation(s.program, t[i]));
1474
- } catch {
1475
- r.push(-1);
1476
- }
1477
- return r;
1478
- }
1479
- /**
1480
- * Activates an effect, making it the current one (ie. the one used for rendering)
1481
- * @param effect defines the effect to activate
1482
- */
1483
- enableEffect(e) {
1484
- e = e !== null && ee.IsWrapper(e) ? e.effect : e, !(!e || e === this._currentEffect) && (this._stencilStateComposer.stencilMaterial = void 0, e = e, this.bindSamplers(e), this._currentEffect = e, e.onBind && e.onBind(e), e._onBindObservable && e._onBindObservable.notifyObservers(e));
1485
- }
1486
- /**
1487
- * Set the value of an uniform to a number (int)
1488
- * @param uniform defines the webGL uniform location where to store the value
1489
- * @param value defines the int number to store
1490
- * @returns true if the value was set
1491
- */
1492
- setInt(e, t) {
1493
- return e ? (this._gl.uniform1i(e, t), !0) : !1;
1494
- }
1495
- /**
1496
- * Set the value of an uniform to a int2
1497
- * @param uniform defines the webGL uniform location where to store the value
1498
- * @param x defines the 1st component of the value
1499
- * @param y defines the 2nd component of the value
1500
- * @returns true if the value was set
1501
- */
1502
- setInt2(e, t, r) {
1503
- return e ? (this._gl.uniform2i(e, t, r), !0) : !1;
1504
- }
1505
- /**
1506
- * Set the value of an uniform to a int3
1507
- * @param uniform defines the webGL uniform location where to store the value
1508
- * @param x defines the 1st component of the value
1509
- * @param y defines the 2nd component of the value
1510
- * @param z defines the 3rd component of the value
1511
- * @returns true if the value was set
1512
- */
1513
- setInt3(e, t, r, s) {
1514
- return e ? (this._gl.uniform3i(e, t, r, s), !0) : !1;
1515
- }
1516
- /**
1517
- * Set the value of an uniform to a int4
1518
- * @param uniform defines the webGL uniform location where to store the value
1519
- * @param x defines the 1st component of the value
1520
- * @param y defines the 2nd component of the value
1521
- * @param z defines the 3rd component of the value
1522
- * @param w defines the 4th component of the value
1523
- * @returns true if the value was set
1524
- */
1525
- setInt4(e, t, r, s, i) {
1526
- return e ? (this._gl.uniform4i(e, t, r, s, i), !0) : !1;
1527
- }
1528
- /**
1529
- * Set the value of an uniform to an array of int32
1530
- * @param uniform defines the webGL uniform location where to store the value
1531
- * @param array defines the array of int32 to store
1532
- * @returns true if the value was set
1533
- */
1534
- setIntArray(e, t) {
1535
- return e ? (this._gl.uniform1iv(e, t), !0) : !1;
1536
- }
1537
- /**
1538
- * Set the value of an uniform to an array of int32 (stored as vec2)
1539
- * @param uniform defines the webGL uniform location where to store the value
1540
- * @param array defines the array of int32 to store
1541
- * @returns true if the value was set
1542
- */
1543
- setIntArray2(e, t) {
1544
- return !e || t.length % 2 !== 0 ? !1 : (this._gl.uniform2iv(e, t), !0);
1545
- }
1546
- /**
1547
- * Set the value of an uniform to an array of int32 (stored as vec3)
1548
- * @param uniform defines the webGL uniform location where to store the value
1549
- * @param array defines the array of int32 to store
1550
- * @returns true if the value was set
1551
- */
1552
- setIntArray3(e, t) {
1553
- return !e || t.length % 3 !== 0 ? !1 : (this._gl.uniform3iv(e, t), !0);
1554
- }
1555
- /**
1556
- * Set the value of an uniform to an array of int32 (stored as vec4)
1557
- * @param uniform defines the webGL uniform location where to store the value
1558
- * @param array defines the array of int32 to store
1559
- * @returns true if the value was set
1560
- */
1561
- setIntArray4(e, t) {
1562
- return !e || t.length % 4 !== 0 ? !1 : (this._gl.uniform4iv(e, t), !0);
1563
- }
1564
- /**
1565
- * Set the value of an uniform to a number (unsigned int)
1566
- * @param uniform defines the webGL uniform location where to store the value
1567
- * @param value defines the unsigned int number to store
1568
- * @returns true if the value was set
1569
- */
1570
- setUInt(e, t) {
1571
- return e ? (this._gl.uniform1ui(e, t), !0) : !1;
1572
- }
1573
- /**
1574
- * Set the value of an uniform to a unsigned int2
1575
- * @param uniform defines the webGL uniform location where to store the value
1576
- * @param x defines the 1st component of the value
1577
- * @param y defines the 2nd component of the value
1578
- * @returns true if the value was set
1579
- */
1580
- setUInt2(e, t, r) {
1581
- return e ? (this._gl.uniform2ui(e, t, r), !0) : !1;
1582
- }
1583
- /**
1584
- * Set the value of an uniform to a unsigned int3
1585
- * @param uniform defines the webGL uniform location where to store the value
1586
- * @param x defines the 1st component of the value
1587
- * @param y defines the 2nd component of the value
1588
- * @param z defines the 3rd component of the value
1589
- * @returns true if the value was set
1590
- */
1591
- setUInt3(e, t, r, s) {
1592
- return e ? (this._gl.uniform3ui(e, t, r, s), !0) : !1;
1593
- }
1594
- /**
1595
- * Set the value of an uniform to a unsigned int4
1596
- * @param uniform defines the webGL uniform location where to store the value
1597
- * @param x defines the 1st component of the value
1598
- * @param y defines the 2nd component of the value
1599
- * @param z defines the 3rd component of the value
1600
- * @param w defines the 4th component of the value
1601
- * @returns true if the value was set
1602
- */
1603
- setUInt4(e, t, r, s, i) {
1604
- return e ? (this._gl.uniform4ui(e, t, r, s, i), !0) : !1;
1605
- }
1606
- /**
1607
- * Set the value of an uniform to an array of unsigned int32
1608
- * @param uniform defines the webGL uniform location where to store the value
1609
- * @param array defines the array of unsigned int32 to store
1610
- * @returns true if the value was set
1611
- */
1612
- setUIntArray(e, t) {
1613
- return e ? (this._gl.uniform1uiv(e, t), !0) : !1;
1614
- }
1615
- /**
1616
- * Set the value of an uniform to an array of unsigned int32 (stored as vec2)
1617
- * @param uniform defines the webGL uniform location where to store the value
1618
- * @param array defines the array of unsigned int32 to store
1619
- * @returns true if the value was set
1620
- */
1621
- setUIntArray2(e, t) {
1622
- return !e || t.length % 2 !== 0 ? !1 : (this._gl.uniform2uiv(e, t), !0);
1623
- }
1624
- /**
1625
- * Set the value of an uniform to an array of unsigned int32 (stored as vec3)
1626
- * @param uniform defines the webGL uniform location where to store the value
1627
- * @param array defines the array of unsigned int32 to store
1628
- * @returns true if the value was set
1629
- */
1630
- setUIntArray3(e, t) {
1631
- return !e || t.length % 3 !== 0 ? !1 : (this._gl.uniform3uiv(e, t), !0);
1632
- }
1633
- /**
1634
- * Set the value of an uniform to an array of unsigned int32 (stored as vec4)
1635
- * @param uniform defines the webGL uniform location where to store the value
1636
- * @param array defines the array of unsigned int32 to store
1637
- * @returns true if the value was set
1638
- */
1639
- setUIntArray4(e, t) {
1640
- return !e || t.length % 4 !== 0 ? !1 : (this._gl.uniform4uiv(e, t), !0);
1641
- }
1642
- /**
1643
- * Set the value of an uniform to an array of number
1644
- * @param uniform defines the webGL uniform location where to store the value
1645
- * @param array defines the array of number to store
1646
- * @returns true if the value was set
1647
- */
1648
- setArray(e, t) {
1649
- return !e || t.length < 1 ? !1 : (this._gl.uniform1fv(e, t), !0);
1650
- }
1651
- /**
1652
- * Set the value of an uniform to an array of number (stored as vec2)
1653
- * @param uniform defines the webGL uniform location where to store the value
1654
- * @param array defines the array of number to store
1655
- * @returns true if the value was set
1656
- */
1657
- setArray2(e, t) {
1658
- return !e || t.length % 2 !== 0 ? !1 : (this._gl.uniform2fv(e, t), !0);
1659
- }
1660
- /**
1661
- * Set the value of an uniform to an array of number (stored as vec3)
1662
- * @param uniform defines the webGL uniform location where to store the value
1663
- * @param array defines the array of number to store
1664
- * @returns true if the value was set
1665
- */
1666
- setArray3(e, t) {
1667
- return !e || t.length % 3 !== 0 ? !1 : (this._gl.uniform3fv(e, t), !0);
1668
- }
1669
- /**
1670
- * Set the value of an uniform to an array of number (stored as vec4)
1671
- * @param uniform defines the webGL uniform location where to store the value
1672
- * @param array defines the array of number to store
1673
- * @returns true if the value was set
1674
- */
1675
- setArray4(e, t) {
1676
- return !e || t.length % 4 !== 0 ? !1 : (this._gl.uniform4fv(e, t), !0);
1677
- }
1678
- /**
1679
- * Set the value of an uniform to an array of float32 (stored as matrices)
1680
- * @param uniform defines the webGL uniform location where to store the value
1681
- * @param matrices defines the array of float32 to store
1682
- * @returns true if the value was set
1683
- */
1684
- setMatrices(e, t) {
1685
- return e ? (this._gl.uniformMatrix4fv(e, !1, t), !0) : !1;
1686
- }
1687
- /**
1688
- * Set the value of an uniform to a matrix (3x3)
1689
- * @param uniform defines the webGL uniform location where to store the value
1690
- * @param matrix defines the Float32Array representing the 3x3 matrix to store
1691
- * @returns true if the value was set
1692
- */
1693
- setMatrix3x3(e, t) {
1694
- return e ? (this._gl.uniformMatrix3fv(e, !1, t), !0) : !1;
1695
- }
1696
- /**
1697
- * Set the value of an uniform to a matrix (2x2)
1698
- * @param uniform defines the webGL uniform location where to store the value
1699
- * @param matrix defines the Float32Array representing the 2x2 matrix to store
1700
- * @returns true if the value was set
1701
- */
1702
- setMatrix2x2(e, t) {
1703
- return e ? (this._gl.uniformMatrix2fv(e, !1, t), !0) : !1;
1704
- }
1705
- /**
1706
- * Set the value of an uniform to a number (float)
1707
- * @param uniform defines the webGL uniform location where to store the value
1708
- * @param value defines the float number to store
1709
- * @returns true if the value was transferred
1710
- */
1711
- setFloat(e, t) {
1712
- return e ? (this._gl.uniform1f(e, t), !0) : !1;
1713
- }
1714
- /**
1715
- * Set the value of an uniform to a vec2
1716
- * @param uniform defines the webGL uniform location where to store the value
1717
- * @param x defines the 1st component of the value
1718
- * @param y defines the 2nd component of the value
1719
- * @returns true if the value was set
1720
- */
1721
- setFloat2(e, t, r) {
1722
- return e ? (this._gl.uniform2f(e, t, r), !0) : !1;
1723
- }
1724
- /**
1725
- * Set the value of an uniform to a vec3
1726
- * @param uniform defines the webGL uniform location where to store the value
1727
- * @param x defines the 1st component of the value
1728
- * @param y defines the 2nd component of the value
1729
- * @param z defines the 3rd component of the value
1730
- * @returns true if the value was set
1731
- */
1732
- setFloat3(e, t, r, s) {
1733
- return e ? (this._gl.uniform3f(e, t, r, s), !0) : !1;
1734
- }
1735
- /**
1736
- * Set the value of an uniform to a vec4
1737
- * @param uniform defines the webGL uniform location where to store the value
1738
- * @param x defines the 1st component of the value
1739
- * @param y defines the 2nd component of the value
1740
- * @param z defines the 3rd component of the value
1741
- * @param w defines the 4th component of the value
1742
- * @returns true if the value was set
1743
- */
1744
- setFloat4(e, t, r, s, i) {
1745
- return e ? (this._gl.uniform4f(e, t, r, s, i), !0) : !1;
1746
- }
1747
- // States
1748
- /**
1749
- * Apply all cached states (depth, culling, stencil and alpha)
1750
- */
1751
- applyStates() {
1752
- if (this._depthCullingState.apply(this._gl), this._stencilStateComposer.apply(this._gl), this._alphaState.apply(this._gl), this._colorWriteChanged) {
1753
- this._colorWriteChanged = !1;
1754
- const e = this._colorWrite;
1755
- this._gl.colorMask(e, e, e, e);
1756
- }
1757
- }
1758
- /**
1759
- * Enable or disable color writing
1760
- * @param enable defines the state to set
1761
- */
1762
- setColorWrite(e) {
1763
- e !== this._colorWrite && (this._colorWriteChanged = !0, this._colorWrite = e);
1764
- }
1765
- /**
1766
- * Gets a boolean indicating if color writing is enabled
1767
- * @returns the current color writing state
1768
- */
1769
- getColorWrite() {
1770
- return this._colorWrite;
1771
- }
1772
- /**
1773
- * Gets the depth culling state manager
1774
- */
1775
- get depthCullingState() {
1776
- return this._depthCullingState;
1777
- }
1778
- /**
1779
- * Gets the alpha state manager
1780
- */
1781
- get alphaState() {
1782
- return this._alphaState;
1783
- }
1784
- /**
1785
- * Gets the stencil state manager
1786
- */
1787
- get stencilState() {
1788
- return this._stencilState;
1789
- }
1790
- /**
1791
- * Gets the stencil state composer
1792
- */
1793
- get stencilStateComposer() {
1794
- return this._stencilStateComposer;
1795
- }
1796
- // Textures
1797
- /**
1798
- * Clears the list of texture accessible through engine.
1799
- * This can help preventing texture load conflict due to name collision.
1800
- */
1801
- clearInternalTexturesCache() {
1802
- this._internalTexturesCache.length = 0;
1803
- }
1804
- /**
1805
- * Force the entire cache to be cleared
1806
- * You should not have to use this function unless your engine needs to share the webGL context with another engine
1807
- * @param bruteForce defines a boolean to force clearing ALL caches (including stencil, detoh and alpha states)
1808
- */
1809
- wipeCaches(e) {
1810
- this.preventCacheWipeBetweenFrames && !e || (this._currentEffect = null, this._viewportCached.x = 0, this._viewportCached.y = 0, this._viewportCached.z = 0, this._viewportCached.w = 0, this._unbindVertexArrayObject(), e && (this._currentProgram = null, this.resetTextureCache(), this._stencilStateComposer.reset(), this._depthCullingState.reset(), this._depthCullingState.depthFunc = this._gl.LEQUAL, this._alphaState.reset(), this._alphaMode = 1, this._alphaEquation = 0, this._colorWrite = !0, this._colorWriteChanged = !0, this._unpackFlipYCached = null, this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE), this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), this._mustWipeVertexAttributes = !0, this.unbindAllAttributes()), this._resetVertexBufferBinding(), this._cachedIndexBuffer = null, this._cachedEffectForVertexBuffers = null, this.bindIndexBuffer(null));
1811
- }
1812
- /**
1813
- * @internal
1814
- */
1815
- _getSamplingParameters(e, t) {
1816
- const r = this._gl;
1817
- let s = r.NEAREST, i = r.NEAREST;
1818
- switch (e) {
1819
- case 11:
1820
- s = r.LINEAR, t ? i = r.LINEAR_MIPMAP_NEAREST : i = r.LINEAR;
1821
- break;
1822
- case 3:
1823
- s = r.LINEAR, t ? i = r.LINEAR_MIPMAP_LINEAR : i = r.LINEAR;
1824
- break;
1825
- case 8:
1826
- s = r.NEAREST, t ? i = r.NEAREST_MIPMAP_LINEAR : i = r.NEAREST;
1827
- break;
1828
- case 4:
1829
- s = r.NEAREST, t ? i = r.NEAREST_MIPMAP_NEAREST : i = r.NEAREST;
1830
- break;
1831
- case 5:
1832
- s = r.NEAREST, t ? i = r.LINEAR_MIPMAP_NEAREST : i = r.LINEAR;
1833
- break;
1834
- case 6:
1835
- s = r.NEAREST, t ? i = r.LINEAR_MIPMAP_LINEAR : i = r.LINEAR;
1836
- break;
1837
- case 7:
1838
- s = r.NEAREST, i = r.LINEAR;
1839
- break;
1840
- case 1:
1841
- s = r.NEAREST, i = r.NEAREST;
1842
- break;
1843
- case 9:
1844
- s = r.LINEAR, t ? i = r.NEAREST_MIPMAP_NEAREST : i = r.NEAREST;
1845
- break;
1846
- case 10:
1847
- s = r.LINEAR, t ? i = r.NEAREST_MIPMAP_LINEAR : i = r.NEAREST;
1848
- break;
1849
- case 2:
1850
- s = r.LINEAR, i = r.LINEAR;
1851
- break;
1852
- case 12:
1853
- s = r.LINEAR, i = r.NEAREST;
1854
- break;
1855
- }
1856
- return {
1857
- min: i,
1858
- mag: s
1859
- };
1860
- }
1861
- /** @internal */
1862
- _createTexture() {
1863
- const e = this._gl.createTexture();
1864
- if (!e)
1865
- throw new Error("Unable to create texture");
1866
- return e;
1867
- }
1868
- /** @internal */
1869
- _createHardwareTexture() {
1870
- return new J(this._createTexture(), this._gl);
1871
- }
1872
- /**
1873
- * Creates an internal texture without binding it to a framebuffer
1874
- * @internal
1875
- * @param size defines the size of the texture
1876
- * @param options defines the options used to create the texture
1877
- * @param delayGPUTextureCreation true to delay the texture creation the first time it is really needed. false to create it right away
1878
- * @param source source type of the texture
1879
- * @returns a new internal texture
1880
- */
1881
- _createInternalTexture(e, t, r = !0, s = O.Unknown) {
1882
- var i;
1883
- let n = !1, l = 0, a = 3, _ = 5, h = !1, f = 1, g;
1884
- t !== void 0 && typeof t == "object" ? (n = !!t.generateMipMaps, l = t.type === void 0 ? 0 : t.type, a = t.samplingMode === void 0 ? 3 : t.samplingMode, _ = t.format === void 0 ? 5 : t.format, h = t.useSRGBBuffer === void 0 ? !1 : t.useSRGBBuffer, f = (i = t.samples) !== null && i !== void 0 ? i : 1, g = t.label) : n = !!t, h && (h = this._caps.supportSRGBBuffers && (this.webGLVersion > 1 || this.isWebGPU)), (l === 1 && !this._caps.textureFloatLinearFiltering || l === 2 && !this._caps.textureHalfFloatLinearFiltering) && (a = 1), l === 1 && !this._caps.textureFloat && (l = 0, y.Warn("Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE"));
1885
- const c = this._gl, u = new M(this, s), E = e.width || e, d = e.height || e, b = e.layers || 0, m = this._getSamplingParameters(a, n), A = b !== 0 ? c.TEXTURE_2D_ARRAY : c.TEXTURE_2D, o = this._getRGBABufferInternalSizedFormat(l, _, h), S = this._getInternalFormat(_), T = this._getWebGLTextureType(l);
1886
- return this._bindTextureDirectly(A, u), b !== 0 ? (u.is2DArray = !0, c.texImage3D(A, 0, o, E, d, b, 0, S, T, null)) : c.texImage2D(A, 0, o, E, d, 0, S, T, null), c.texParameteri(A, c.TEXTURE_MAG_FILTER, m.mag), c.texParameteri(A, c.TEXTURE_MIN_FILTER, m.min), c.texParameteri(A, c.TEXTURE_WRAP_S, c.CLAMP_TO_EDGE), c.texParameteri(A, c.TEXTURE_WRAP_T, c.CLAMP_TO_EDGE), n && this._gl.generateMipmap(A), this._bindTextureDirectly(A, null), u._useSRGBBuffer = h, u.baseWidth = E, u.baseHeight = d, u.width = E, u.height = d, u.depth = b, u.isReady = !0, u.samples = f, u.generateMipMaps = n, u.samplingMode = a, u.type = l, u.format = _, u.label = g, this._internalTexturesCache.push(u), u;
1887
- }
1888
- /**
1889
- * @internal
1890
- */
1891
- _getUseSRGBBuffer(e, t) {
1892
- return e && this._caps.supportSRGBBuffers && (this.webGLVersion > 1 || this.isWebGPU || t);
1893
- }
1894
- _createTextureBase(e, t, r, s, i = 3, n = null, l = null, a, _, h = null, f = null, g = null, c = null, u, E, d) {
1895
- e = e || "";
1896
- const b = e.substr(0, 5) === "data:", m = e.substr(0, 5) === "blob:", A = b && e.indexOf(";base64,") !== -1, o = f || new M(this, O.Url);
1897
- o !== f && (o.label = e.substring(0, 60));
1898
- const S = e;
1899
- this._transformTextureUrl && !A && !f && !h && (e = this._transformTextureUrl(e)), S !== e && (o._originalUrl = S);
1900
- const T = e.lastIndexOf(".");
1901
- let C = c || (T > -1 ? e.substring(T).toLowerCase() : ""), B = null;
1902
- C.indexOf("?") > -1 && (C = C.split("?")[0]);
1903
- for (const p of R._TextureLoaders)
1904
- if (p.canLoad(C, u)) {
1905
- B = p;
1906
- break;
1907
- }
1908
- s && s.addPendingData(o), o.url = e, o.generateMipMaps = !t, o.samplingMode = i, o.invertY = r, o._useSRGBBuffer = this._getUseSRGBBuffer(!!d, t), this._doNotHandleContextLost || (o._buffer = h);
1909
- let I = null;
1910
- n && !f && (I = o.onLoadedObservable.add(n)), f || this._internalTexturesCache.push(o);
1911
- const L = (p, x) => {
1912
- s && s.removePendingData(o), e === S ? (I && o.onLoadedObservable.remove(I), U.UseFallbackTexture && this._createTextureBase(U.FallbackTexture, t, o.invertY, s, i, null, l, a, _, h, o), p = (p || "Unknown error") + (U.UseFallbackTexture ? " - Fallback texture was used" : ""), o.onErrorObservable.notifyObservers({ message: p, exception: x }), l && l(p, x)) : (y.Warn(`Failed to load ${e}, falling back to ${S}`), this._createTextureBase(S, t, o.invertY, s, i, n, l, a, _, h, o, g, c, u, E, d));
1913
- };
1914
- if (B) {
1915
- const p = (x) => {
1916
- B.loadData(x, o, (D, X, W, H, k, Y) => {
1917
- Y ? L("TextureLoader failed to load data") : a(o, C, s, { width: D, height: X }, o.invertY, !W, H, () => (k(), !1), i);
1918
- }, E);
1919
- };
1920
- h ? h instanceof ArrayBuffer ? p(new Uint8Array(h)) : ArrayBuffer.isView(h) ? p(h) : l && l("Unable to load: only ArrayBuffer or ArrayBufferView is supported", null) : this._loadFile(e, (x) => p(new Uint8Array(x)), void 0, s ? s.offlineProvider : void 0, !0, (x, D) => {
1921
- L("Unable to load " + (x && x.responseURL, D));
1922
- });
1923
- } else {
1924
- const p = (x) => {
1925
- m && !this._doNotHandleContextLost && (o._buffer = x), a(o, C, s, x, o.invertY, t, !1, _, i);
1926
- };
1927
- !b || A ? h && (typeof h.decoding == "string" || h.close) ? p(h) : R._FileToolsLoadImage(e, p, L, s ? s.offlineProvider : null, u, o.invertY && this._features.needsInvertingBitmap ? { imageOrientation: "flipY" } : void 0) : typeof h == "string" || h instanceof ArrayBuffer || ArrayBuffer.isView(h) || h instanceof Blob ? R._FileToolsLoadImage(h, p, L, s ? s.offlineProvider : null, u, o.invertY && this._features.needsInvertingBitmap ? { imageOrientation: "flipY" } : void 0) : h && p(h);
1928
- }
1929
- return o;
1930
- }
1931
- /**
1932
- * Usually called from Texture.ts.
1933
- * Passed information to create a WebGLTexture
1934
- * @param url defines a value which contains one of the following:
1935
- * * A conventional http URL, e.g. 'http://...' or 'file://...'
1936
- * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'
1937
- * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'
1938
- * @param noMipmap defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file
1939
- * @param invertY when true, image is flipped when loaded. You probably want true. Certain compressed textures may invert this if their default is inverted (eg. ktx)
1940
- * @param scene needed for loading to the correct scene
1941
- * @param samplingMode mode with should be used sample / access the texture (Default: Texture.TRILINEAR_SAMPLINGMODE)
1942
- * @param onLoad optional callback to be called upon successful completion
1943
- * @param onError optional callback to be called upon failure
1944
- * @param buffer a source of a file previously fetched as either a base64 string, an ArrayBuffer (compressed or image format), HTMLImageElement (image format), or a Blob
1945
- * @param fallback an internal argument in case the function must be called again, due to etc1 not having alpha capabilities
1946
- * @param format internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures
1947
- * @param forcedExtension defines the extension to use to pick the right loader
1948
- * @param mimeType defines an optional mime type
1949
- * @param loaderOptions options to be passed to the loader
1950
- * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)
1951
- * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
1952
- * @returns a InternalTexture for assignment back into BABYLON.Texture
1953
- */
1954
- createTexture(e, t, r, s, i = 3, n = null, l = null, a = null, _ = null, h = null, f = null, g, c, u, E) {
1955
- return this._createTextureBase(e, t, r, s, i, n, l, this._prepareWebGLTexture.bind(this), (d, b, m, A, o, S) => {
1956
- const T = this._gl, C = m.width === d && m.height === b, B = h ? this._getInternalFormat(h, o._useSRGBBuffer) : A === ".jpg" && !o._useSRGBBuffer ? T.RGB : o._useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : T.RGBA;
1957
- let w = h ? this._getInternalFormat(h) : A === ".jpg" && !o._useSRGBBuffer ? T.RGB : T.RGBA;
1958
- if (o._useSRGBBuffer && this.webGLVersion === 1 && (w = B), C)
1959
- return T.texImage2D(T.TEXTURE_2D, 0, B, w, T.UNSIGNED_BYTE, m), !1;
1960
- const I = this._caps.maxTextureSize;
1961
- if (m.width > I || m.height > I || !this._supportsHardwareTextureRescaling)
1962
- return this._prepareWorkingCanvas(), !this._workingCanvas || !this._workingContext || (this._workingCanvas.width = d, this._workingCanvas.height = b, this._workingContext.drawImage(m, 0, 0, m.width, m.height, 0, 0, d, b), T.texImage2D(T.TEXTURE_2D, 0, B, w, T.UNSIGNED_BYTE, this._workingCanvas), o.width = d, o.height = b), !1;
1963
- {
1964
- const L = new M(this, O.Temp);
1965
- this._bindTextureDirectly(T.TEXTURE_2D, L, !0), T.texImage2D(T.TEXTURE_2D, 0, B, w, T.UNSIGNED_BYTE, m), this._rescaleTexture(L, o, s, B, () => {
1966
- this._releaseTexture(L), this._bindTextureDirectly(T.TEXTURE_2D, o, !0), S();
1967
- });
1968
- }
1969
- return !0;
1970
- }, a, _, h, f, g, c, E);
1971
- }
1972
- /**
1973
- * Loads an image as an HTMLImageElement.
1974
- * @param input url string, ArrayBuffer, or Blob to load
1975
- * @param onLoad callback called when the image successfully loads
1976
- * @param onError callback called when the image fails to load
1977
- * @param offlineProvider offline provider for caching
1978
- * @param mimeType optional mime type
1979
- * @param imageBitmapOptions optional the options to use when creating an ImageBitmap
1980
- * @returns the HTMLImageElement of the loaded image
1981
- * @internal
1982
- */
1983
- static _FileToolsLoadImage(e, t, r, s, i, n) {
1984
- throw P("FileTools");
1985
- }
1986
- /**
1987
- * @internal
1988
- */
1989
- _rescaleTexture(e, t, r, s, i) {
1990
- }
1991
- /**
1992
- * Creates a raw texture
1993
- * @param data defines the data to store in the texture
1994
- * @param width defines the width of the texture
1995
- * @param height defines the height of the texture
1996
- * @param format defines the format of the data
1997
- * @param generateMipMaps defines if the engine should generate the mip levels
1998
- * @param invertY defines if data must be stored with Y axis inverted
1999
- * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
2000
- * @param compression defines the compression used (null by default)
2001
- * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)
2002
- * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)
2003
- * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).
2004
- * @returns the raw texture inside an InternalTexture
2005
- */
2006
- createRawTexture(e, t, r, s, i, n, l, a = null, _ = 0, h = 0, f = !1) {
2007
- throw P("Engine.RawTexture");
2008
- }
2009
- /**
2010
- * Creates a new raw cube texture
2011
- * @param data defines the array of data to use to create each face
2012
- * @param size defines the size of the textures
2013
- * @param format defines the format of the data
2014
- * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)
2015
- * @param generateMipMaps defines if the engine should generate the mip levels
2016
- * @param invertY defines if data must be stored with Y axis inverted
2017
- * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)
2018
- * @param compression defines the compression used (null by default)
2019
- * @returns the cube texture as an InternalTexture
2020
- */
2021
- createRawCubeTexture(e, t, r, s, i, n, l, a = null) {
2022
- throw P("Engine.RawTexture");
2023
- }
2024
- /**
2025
- * Creates a new raw 3D texture
2026
- * @param data defines the data used to create the texture
2027
- * @param width defines the width of the texture
2028
- * @param height defines the height of the texture
2029
- * @param depth defines the depth of the texture
2030
- * @param format defines the format of the texture
2031
- * @param generateMipMaps defines if the engine must generate mip levels
2032
- * @param invertY defines if data must be stored with Y axis inverted
2033
- * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)
2034
- * @param compression defines the compressed used (can be null)
2035
- * @param textureType defines the compressed used (can be null)
2036
- * @returns a new raw 3D texture (stored in an InternalTexture)
2037
- */
2038
- createRawTexture3D(e, t, r, s, i, n, l, a, _ = null, h = 0) {
2039
- throw P("Engine.RawTexture");
2040
- }
2041
- /**
2042
- * Creates a new raw 2D array texture
2043
- * @param data defines the data used to create the texture
2044
- * @param width defines the width of the texture
2045
- * @param height defines the height of the texture
2046
- * @param depth defines the number of layers of the texture
2047
- * @param format defines the format of the texture
2048
- * @param generateMipMaps defines if the engine must generate mip levels
2049
- * @param invertY defines if data must be stored with Y axis inverted
2050
- * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)
2051
- * @param compression defines the compressed used (can be null)
2052
- * @param textureType defines the compressed used (can be null)
2053
- * @returns a new raw 2D array texture (stored in an InternalTexture)
2054
- */
2055
- createRawTexture2DArray(e, t, r, s, i, n, l, a, _ = null, h = 0) {
2056
- throw P("Engine.RawTexture");
2057
- }
2058
- /**
2059
- * @internal
2060
- */
2061
- _unpackFlipY(e) {
2062
- this._unpackFlipYCached !== e && (this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, e ? 1 : 0), this.enableUnpackFlipYCached && (this._unpackFlipYCached = e));
2063
- }
2064
- /** @internal */
2065
- _getUnpackAlignement() {
2066
- return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT);
2067
- }
2068
- _getTextureTarget(e) {
2069
- return e.isCube ? this._gl.TEXTURE_CUBE_MAP : e.is3D ? this._gl.TEXTURE_3D : e.is2DArray || e.isMultiview ? this._gl.TEXTURE_2D_ARRAY : this._gl.TEXTURE_2D;
2070
- }
2071
- /**
2072
- * Update the sampling mode of a given texture
2073
- * @param samplingMode defines the required sampling mode
2074
- * @param texture defines the texture to update
2075
- * @param generateMipMaps defines whether to generate mipmaps for the texture
2076
- */
2077
- updateTextureSamplingMode(e, t, r = !1) {
2078
- const s = this._getTextureTarget(t), i = this._getSamplingParameters(e, t.useMipMaps || r);
2079
- this._setTextureParameterInteger(s, this._gl.TEXTURE_MAG_FILTER, i.mag, t), this._setTextureParameterInteger(s, this._gl.TEXTURE_MIN_FILTER, i.min), r && (t.generateMipMaps = !0, this._gl.generateMipmap(s)), this._bindTextureDirectly(s, null), t.samplingMode = e;
2080
- }
2081
- /**
2082
- * Update the dimensions of a texture
2083
- * @param texture texture to update
2084
- * @param width new width of the texture
2085
- * @param height new height of the texture
2086
- * @param depth new depth of the texture
2087
- */
2088
- updateTextureDimensions(e, t, r, s = 1) {
2089
- }
2090
- /**
2091
- * Update the sampling mode of a given texture
2092
- * @param texture defines the texture to update
2093
- * @param wrapU defines the texture wrap mode of the u coordinates
2094
- * @param wrapV defines the texture wrap mode of the v coordinates
2095
- * @param wrapR defines the texture wrap mode of the r coordinates
2096
- */
2097
- updateTextureWrappingMode(e, t, r = null, s = null) {
2098
- const i = this._getTextureTarget(e);
2099
- t !== null && (this._setTextureParameterInteger(i, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(t), e), e._cachedWrapU = t), r !== null && (this._setTextureParameterInteger(i, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(r), e), e._cachedWrapV = r), (e.is2DArray || e.is3D) && s !== null && (this._setTextureParameterInteger(i, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(s), e), e._cachedWrapR = s), this._bindTextureDirectly(i, null);
2100
- }
2101
- /**
2102
- * @internal
2103
- */
2104
- _setupDepthStencilTexture(e, t, r, s, i, n = 1) {
2105
- const l = t.width || t, a = t.height || t, _ = t.layers || 0;
2106
- e.baseWidth = l, e.baseHeight = a, e.width = l, e.height = a, e.is2DArray = _ > 0, e.depth = _, e.isReady = !0, e.samples = n, e.generateMipMaps = !1, e.samplingMode = s ? 2 : 1, e.type = 0, e._comparisonFunction = i;
2107
- const h = this._gl, f = this._getTextureTarget(e), g = this._getSamplingParameters(e.samplingMode, !1);
2108
- h.texParameteri(f, h.TEXTURE_MAG_FILTER, g.mag), h.texParameteri(f, h.TEXTURE_MIN_FILTER, g.min), h.texParameteri(f, h.TEXTURE_WRAP_S, h.CLAMP_TO_EDGE), h.texParameteri(f, h.TEXTURE_WRAP_T, h.CLAMP_TO_EDGE), this.webGLVersion > 1 && (i === 0 ? (h.texParameteri(f, h.TEXTURE_COMPARE_FUNC, 515), h.texParameteri(f, h.TEXTURE_COMPARE_MODE, h.NONE)) : (h.texParameteri(f, h.TEXTURE_COMPARE_FUNC, i), h.texParameteri(f, h.TEXTURE_COMPARE_MODE, h.COMPARE_REF_TO_TEXTURE)));
2109
- }
2110
- /**
2111
- * @internal
2112
- */
2113
- _uploadCompressedDataToTextureDirectly(e, t, r, s, i, n = 0, l = 0) {
2114
- const a = this._gl;
2115
- let _ = a.TEXTURE_2D;
2116
- if (e.isCube && (_ = a.TEXTURE_CUBE_MAP_POSITIVE_X + n), e._useSRGBBuffer)
2117
- switch (t) {
2118
- case 37492:
2119
- case 36196:
2120
- this._caps.etc2 ? t = a.COMPRESSED_SRGB8_ETC2 : e._useSRGBBuffer = !1;
2121
- break;
2122
- case 37496:
2123
- this._caps.etc2 ? t = a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : e._useSRGBBuffer = !1;
2124
- break;
2125
- case 36492:
2126
- t = a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;
2127
- break;
2128
- case 37808:
2129
- t = a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
2130
- break;
2131
- case 33776:
2132
- this._caps.s3tc_srgb ? t = a.COMPRESSED_SRGB_S3TC_DXT1_EXT : e._useSRGBBuffer = !1;
2133
- break;
2134
- case 33777:
2135
- this._caps.s3tc_srgb ? t = a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT : e._useSRGBBuffer = !1;
2136
- break;
2137
- case 33779:
2138
- this._caps.s3tc_srgb ? t = a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT : e._useSRGBBuffer = !1;
2139
- break;
2140
- default:
2141
- e._useSRGBBuffer = !1;
2142
- break;
2143
- }
2144
- this._gl.compressedTexImage2D(_, l, t, r, s, 0, i);
2145
- }
2146
- /**
2147
- * @internal
2148
- */
2149
- _uploadDataToTextureDirectly(e, t, r = 0, s = 0, i, n = !1) {
2150
- const l = this._gl, a = this._getWebGLTextureType(e.type), _ = this._getInternalFormat(e.format), h = i === void 0 ? this._getRGBABufferInternalSizedFormat(e.type, e.format, e._useSRGBBuffer) : this._getInternalFormat(i, e._useSRGBBuffer);
2151
- this._unpackFlipY(e.invertY);
2152
- let f = l.TEXTURE_2D;
2153
- e.isCube && (f = l.TEXTURE_CUBE_MAP_POSITIVE_X + r);
2154
- const g = Math.round(Math.log(e.width) * Math.LOG2E), c = Math.round(Math.log(e.height) * Math.LOG2E), u = n ? e.width : Math.pow(2, Math.max(g - s, 0)), E = n ? e.height : Math.pow(2, Math.max(c - s, 0));
2155
- l.texImage2D(f, s, h, u, E, 0, _, a, t);
2156
- }
2157
- /**
2158
- * Update a portion of an internal texture
2159
- * @param texture defines the texture to update
2160
- * @param imageData defines the data to store into the texture
2161
- * @param xOffset defines the x coordinates of the update rectangle
2162
- * @param yOffset defines the y coordinates of the update rectangle
2163
- * @param width defines the width of the update rectangle
2164
- * @param height defines the height of the update rectangle
2165
- * @param faceIndex defines the face index if texture is a cube (0 by default)
2166
- * @param lod defines the lod level to update (0 by default)
2167
- * @param generateMipMaps defines whether to generate mipmaps or not
2168
- */
2169
- updateTextureData(e, t, r, s, i, n, l = 0, a = 0, _ = !1) {
2170
- const h = this._gl, f = this._getWebGLTextureType(e.type), g = this._getInternalFormat(e.format);
2171
- this._unpackFlipY(e.invertY);
2172
- let c = h.TEXTURE_2D, u = h.TEXTURE_2D;
2173
- e.isCube && (u = h.TEXTURE_CUBE_MAP_POSITIVE_X + l, c = h.TEXTURE_CUBE_MAP), this._bindTextureDirectly(c, e, !0), h.texSubImage2D(u, a, r, s, i, n, g, f, t), _ && this._gl.generateMipmap(u), this._bindTextureDirectly(c, null);
2174
- }
2175
- /**
2176
- * @internal
2177
- */
2178
- _uploadArrayBufferViewToTexture(e, t, r = 0, s = 0) {
2179
- const i = this._gl, n = e.isCube ? i.TEXTURE_CUBE_MAP : i.TEXTURE_2D;
2180
- this._bindTextureDirectly(n, e, !0), this._uploadDataToTextureDirectly(e, t, r, s), this._bindTextureDirectly(n, null, !0);
2181
- }
2182
- _prepareWebGLTextureContinuation(e, t, r, s, i) {
2183
- const n = this._gl;
2184
- if (!n)
2185
- return;
2186
- const l = this._getSamplingParameters(i, !r);
2187
- n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, l.mag), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, l.min), !r && !s && n.generateMipmap(n.TEXTURE_2D), this._bindTextureDirectly(n.TEXTURE_2D, null), t && t.removePendingData(e), e.onLoadedObservable.notifyObservers(e), e.onLoadedObservable.clear();
2188
- }
2189
- _prepareWebGLTexture(e, t, r, s, i, n, l, a, _ = 3) {
2190
- const h = this.getCaps().maxTextureSize, f = Math.min(h, this.needPOTTextures ? R.GetExponentOfTwo(s.width, h) : s.width), g = Math.min(h, this.needPOTTextures ? R.GetExponentOfTwo(s.height, h) : s.height), c = this._gl;
2191
- if (c) {
2192
- if (!e._hardwareTexture) {
2193
- r && r.removePendingData(e);
2194
- return;
2195
- }
2196
- this._bindTextureDirectly(c.TEXTURE_2D, e, !0), this._unpackFlipY(i === void 0 ? !0 : !!i), e.baseWidth = s.width, e.baseHeight = s.height, e.width = f, e.height = g, e.isReady = !0, !a(f, g, s, t, e, () => {
2197
- this._prepareWebGLTextureContinuation(e, r, n, l, _);
2198
- }) && this._prepareWebGLTextureContinuation(e, r, n, l, _);
2199
- }
2200
- }
2201
- /**
2202
- * @internal
2203
- */
2204
- _setupFramebufferDepthAttachments(e, t, r, s, i = 1) {
2205
- const n = this._gl;
2206
- if (e && t)
2207
- return this._createRenderBuffer(r, s, i, n.DEPTH_STENCIL, n.DEPTH24_STENCIL8, n.DEPTH_STENCIL_ATTACHMENT);
2208
- if (t) {
2209
- let l = n.DEPTH_COMPONENT16;
2210
- return this._webGLVersion > 1 && (l = n.DEPTH_COMPONENT32F), this._createRenderBuffer(r, s, i, l, l, n.DEPTH_ATTACHMENT);
2211
- }
2212
- return e ? this._createRenderBuffer(r, s, i, n.STENCIL_INDEX8, n.STENCIL_INDEX8, n.STENCIL_ATTACHMENT) : null;
2213
- }
2214
- /**
2215
- * @internal
2216
- */
2217
- _createRenderBuffer(e, t, r, s, i, n, l = !0) {
2218
- const _ = this._gl.createRenderbuffer();
2219
- return this._updateRenderBuffer(_, e, t, r, s, i, n, l);
2220
- }
2221
- _updateRenderBuffer(e, t, r, s, i, n, l, a = !0) {
2222
- const _ = this._gl;
2223
- return _.bindRenderbuffer(_.RENDERBUFFER, e), s > 1 && _.renderbufferStorageMultisample ? _.renderbufferStorageMultisample(_.RENDERBUFFER, s, n, t, r) : _.renderbufferStorage(_.RENDERBUFFER, i, t, r), _.framebufferRenderbuffer(_.FRAMEBUFFER, l, _.RENDERBUFFER, e), a && _.bindRenderbuffer(_.RENDERBUFFER, null), e;
2224
- }
2225
- /**
2226
- * @internal
2227
- */
2228
- _releaseTexture(e) {
2229
- var t;
2230
- this._deleteTexture((t = e._hardwareTexture) === null || t === void 0 ? void 0 : t.underlyingResource), this.unbindAllTextures();
2231
- const r = this._internalTexturesCache.indexOf(e);
2232
- r !== -1 && this._internalTexturesCache.splice(r, 1), e._lodTextureHigh && e._lodTextureHigh.dispose(), e._lodTextureMid && e._lodTextureMid.dispose(), e._lodTextureLow && e._lodTextureLow.dispose(), e._irradianceTexture && e._irradianceTexture.dispose();
2233
- }
2234
- /**
2235
- * @internal
2236
- */
2237
- _releaseRenderTargetWrapper(e) {
2238
- const t = this._renderTargetWrapperCache.indexOf(e);
2239
- t !== -1 && this._renderTargetWrapperCache.splice(t, 1);
2240
- }
2241
- _deleteTexture(e) {
2242
- e && this._gl.deleteTexture(e);
2243
- }
2244
- _setProgram(e) {
2245
- this._currentProgram !== e && (this._gl.useProgram(e), this._currentProgram = e);
2246
- }
2247
- /**
2248
- * Binds an effect to the webGL context
2249
- * @param effect defines the effect to bind
2250
- */
2251
- bindSamplers(e) {
2252
- const t = e.getPipelineContext();
2253
- this._setProgram(t.program);
2254
- const r = e.getSamplers();
2255
- for (let s = 0; s < r.length; s++) {
2256
- const i = e.getUniform(r[s]);
2257
- i && (this._boundUniforms[s] = i);
2258
- }
2259
- this._currentEffect = null;
2260
- }
2261
- _activateCurrentTexture() {
2262
- this._currentTextureChannel !== this._activeChannel && (this._gl.activeTexture(this._gl.TEXTURE0 + this._activeChannel), this._currentTextureChannel = this._activeChannel);
2263
- }
2264
- /**
2265
- * @internal
2266
- */
2267
- _bindTextureDirectly(e, t, r = !1, s = !1) {
2268
- var i, n;
2269
- let l = !1;
2270
- const a = t && t._associatedChannel > -1;
2271
- if (r && a && (this._activeChannel = t._associatedChannel), this._boundTexturesCache[this._activeChannel] !== t || s) {
2272
- if (this._activateCurrentTexture(), t && t.isMultiview)
2273
- throw console.error(e, t), "_bindTextureDirectly called with a multiview texture!";
2274
- this._gl.bindTexture(e, (n = (i = t == null ? void 0 : t._hardwareTexture) === null || i === void 0 ? void 0 : i.underlyingResource) !== null && n !== void 0 ? n : null), this._boundTexturesCache[this._activeChannel] = t, t && (t._associatedChannel = this._activeChannel);
2275
- } else
2276
- r && (l = !0, this._activateCurrentTexture());
2277
- return a && !r && this._bindSamplerUniformToChannel(t._associatedChannel, this._activeChannel), l;
2278
- }
2279
- /**
2280
- * @internal
2281
- */
2282
- _bindTexture(e, t, r) {
2283
- if (e === void 0)
2284
- return;
2285
- t && (t._associatedChannel = e), this._activeChannel = e;
2286
- const s = t ? this._getTextureTarget(t) : this._gl.TEXTURE_2D;
2287
- this._bindTextureDirectly(s, t);
2288
- }
2289
- /**
2290
- * Unbind all textures from the webGL context
2291
- */
2292
- unbindAllTextures() {
2293
- for (let e = 0; e < this._maxSimultaneousTextures; e++)
2294
- this._activeChannel = e, this._bindTextureDirectly(this._gl.TEXTURE_2D, null), this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null), this.webGLVersion > 1 && (this._bindTextureDirectly(this._gl.TEXTURE_3D, null), this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, null));
2295
- }
2296
- /**
2297
- * Sets a texture to the according uniform.
2298
- * @param channel The texture channel
2299
- * @param uniform The uniform to set
2300
- * @param texture The texture to apply
2301
- * @param name The name of the uniform in the effect
2302
- */
2303
- setTexture(e, t, r, s) {
2304
- e !== void 0 && (t && (this._boundUniforms[e] = t), this._setTexture(e, r));
2305
- }
2306
- _bindSamplerUniformToChannel(e, t) {
2307
- const r = this._boundUniforms[e];
2308
- !r || r._currentState === t || (this._gl.uniform1i(r, t), r._currentState = t);
2309
- }
2310
- _getTextureWrapMode(e) {
2311
- switch (e) {
2312
- case 1:
2313
- return this._gl.REPEAT;
2314
- case 0:
2315
- return this._gl.CLAMP_TO_EDGE;
2316
- case 2:
2317
- return this._gl.MIRRORED_REPEAT;
2318
- }
2319
- return this._gl.REPEAT;
2320
- }
2321
- _setTexture(e, t, r = !1, s = !1, i = "") {
2322
- if (!t)
2323
- return this._boundTexturesCache[e] != null && (this._activeChannel = e, this._bindTextureDirectly(this._gl.TEXTURE_2D, null), this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null), this.webGLVersion > 1 && (this._bindTextureDirectly(this._gl.TEXTURE_3D, null), this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, null))), !1;
2324
- if (t.video) {
2325
- this._activeChannel = e;
2326
- const _ = t.getInternalTexture();
2327
- _ && (_._associatedChannel = e), t.update();
2328
- } else if (t.delayLoadState === 4)
2329
- return t.delayLoad(), !1;
2330
- let n;
2331
- s ? n = t.depthStencilTexture : t.isReady() ? n = t.getInternalTexture() : t.isCube ? n = this.emptyCubeTexture : t.is3D ? n = this.emptyTexture3D : t.is2DArray ? n = this.emptyTexture2DArray : n = this.emptyTexture, !r && n && (n._associatedChannel = e);
2332
- let l = !0;
2333
- this._boundTexturesCache[e] === n && (r || this._bindSamplerUniformToChannel(n._associatedChannel, e), l = !1), this._activeChannel = e;
2334
- const a = this._getTextureTarget(n);
2335
- if (l && this._bindTextureDirectly(a, n, r), n && !n.isMultiview) {
2336
- if (n.isCube && n._cachedCoordinatesMode !== t.coordinatesMode) {
2337
- n._cachedCoordinatesMode = t.coordinatesMode;
2338
- const _ = t.coordinatesMode !== 3 && t.coordinatesMode !== 5 ? 1 : 0;
2339
- t.wrapU = _, t.wrapV = _;
2340
- }
2341
- n._cachedWrapU !== t.wrapU && (n._cachedWrapU = t.wrapU, this._setTextureParameterInteger(a, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(t.wrapU), n)), n._cachedWrapV !== t.wrapV && (n._cachedWrapV = t.wrapV, this._setTextureParameterInteger(a, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(t.wrapV), n)), n.is3D && n._cachedWrapR !== t.wrapR && (n._cachedWrapR = t.wrapR, this._setTextureParameterInteger(a, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(t.wrapR), n)), this._setAnisotropicLevel(a, n, t.anisotropicFilteringLevel);
2342
- }
2343
- return !0;
2344
- }
2345
- /**
2346
- * Sets an array of texture to the webGL context
2347
- * @param channel defines the channel where the texture array must be set
2348
- * @param uniform defines the associated uniform location
2349
- * @param textures defines the array of textures to bind
2350
- * @param name name of the channel
2351
- */
2352
- setTextureArray(e, t, r, s) {
2353
- if (!(e === void 0 || !t)) {
2354
- (!this._textureUnits || this._textureUnits.length !== r.length) && (this._textureUnits = new Int32Array(r.length));
2355
- for (let i = 0; i < r.length; i++) {
2356
- const n = r[i].getInternalTexture();
2357
- n ? (this._textureUnits[i] = e + i, n._associatedChannel = e + i) : this._textureUnits[i] = -1;
2358
- }
2359
- this._gl.uniform1iv(t, this._textureUnits);
2360
- for (let i = 0; i < r.length; i++)
2361
- this._setTexture(this._textureUnits[i], r[i], !0);
2362
- }
2363
- }
2364
- /**
2365
- * @internal
2366
- */
2367
- _setAnisotropicLevel(e, t, r) {
2368
- const s = this._caps.textureAnisotropicFilterExtension;
2369
- t.samplingMode !== 11 && t.samplingMode !== 3 && t.samplingMode !== 2 && (r = 1), s && t._cachedAnisotropicFilteringLevel !== r && (this._setTextureParameterFloat(e, s.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(r, this._caps.maxAnisotropy), t), t._cachedAnisotropicFilteringLevel = r);
2370
- }
2371
- _setTextureParameterFloat(e, t, r, s) {
2372
- this._bindTextureDirectly(e, s, !0, !0), this._gl.texParameterf(e, t, r);
2373
- }
2374
- _setTextureParameterInteger(e, t, r, s) {
2375
- s && this._bindTextureDirectly(e, s, !0, !0), this._gl.texParameteri(e, t, r);
2376
- }
2377
- /**
2378
- * Unbind all vertex attributes from the webGL context
2379
- */
2380
- unbindAllAttributes() {
2381
- if (this._mustWipeVertexAttributes) {
2382
- this._mustWipeVertexAttributes = !1;
2383
- for (let e = 0; e < this._caps.maxVertexAttribs; e++)
2384
- this.disableAttributeByIndex(e);
2385
- return;
2386
- }
2387
- for (let e = 0, t = this._vertexAttribArraysEnabled.length; e < t; e++)
2388
- e >= this._caps.maxVertexAttribs || !this._vertexAttribArraysEnabled[e] || this.disableAttributeByIndex(e);
2389
- }
2390
- /**
2391
- * Force the engine to release all cached effects. This means that next effect compilation will have to be done completely even if a similar effect was already compiled
2392
- */
2393
- releaseEffects() {
2394
- for (const e in this._compiledEffects) {
2395
- const t = this._compiledEffects[e].getPipelineContext();
2396
- this._deletePipelineContext(t);
2397
- }
2398
- this._compiledEffects = {};
2399
- }
2400
- /**
2401
- * Dispose and release all associated resources
2402
- */
2403
- dispose() {
2404
- var e;
2405
- this._isDisposed = !0, this.stopRenderLoop(), this.onBeforeTextureInitObservable && this.onBeforeTextureInitObservable.clear(), this._emptyTexture && (this._releaseTexture(this._emptyTexture), this._emptyTexture = null), this._emptyCubeTexture && (this._releaseTexture(this._emptyCubeTexture), this._emptyCubeTexture = null), this._dummyFramebuffer && this._gl.deleteFramebuffer(this._dummyFramebuffer), this.releaseEffects(), (e = this.releaseComputeEffects) === null || e === void 0 || e.call(this), this.unbindAllAttributes(), this._boundUniforms = {}, v() && this._renderingCanvas && (this._doNotHandleContextLost || (this._renderingCanvas.removeEventListener("webglcontextlost", this._onContextLost), this._renderingCanvas.removeEventListener("webglcontextrestored", this._onContextRestored)), window.removeEventListener("resize", this._checkForMobile)), this._workingCanvas = null, this._workingContext = null, this._currentBufferPointers.length = 0, this._renderingCanvas = null, this._currentProgram = null, this._boundRenderFunction = null, G.ResetCache();
2406
- for (const t of this._activeRequests)
2407
- t.abort();
2408
- this.onDisposeObservable.notifyObservers(this), this.onDisposeObservable.clear();
2409
- }
2410
- /**
2411
- * Attach a new callback raised when context lost event is fired
2412
- * @param callback defines the callback to call
2413
- */
2414
- attachContextLostEvent(e) {
2415
- this._renderingCanvas && this._renderingCanvas.addEventListener("webglcontextlost", e, !1);
2416
- }
2417
- /**
2418
- * Attach a new callback raised when context restored event is fired
2419
- * @param callback defines the callback to call
2420
- */
2421
- attachContextRestoredEvent(e) {
2422
- this._renderingCanvas && this._renderingCanvas.addEventListener("webglcontextrestored", e, !1);
2423
- }
2424
- /**
2425
- * Get the current error code of the webGL context
2426
- * @returns the error code
2427
- * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getError
2428
- */
2429
- getError() {
2430
- return this._gl.getError();
2431
- }
2432
- _canRenderToFloatFramebuffer() {
2433
- return this._webGLVersion > 1 ? this._caps.colorBufferFloat : this._canRenderToFramebuffer(1);
2434
- }
2435
- _canRenderToHalfFloatFramebuffer() {
2436
- return this._webGLVersion > 1 ? this._caps.colorBufferFloat : this._canRenderToFramebuffer(2);
2437
- }
2438
- // Thank you : http://stackoverflow.com/questions/28827511/webgl-ios-render-to-floating-point-texture
2439
- _canRenderToFramebuffer(e) {
2440
- const t = this._gl;
2441
- for (; t.getError() !== t.NO_ERROR; )
2442
- ;
2443
- let r = !0;
2444
- const s = t.createTexture();
2445
- t.bindTexture(t.TEXTURE_2D, s), t.texImage2D(t.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(e), 1, 1, 0, t.RGBA, this._getWebGLTextureType(e), null), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.NEAREST), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.NEAREST);
2446
- const i = t.createFramebuffer();
2447
- t.bindFramebuffer(t.FRAMEBUFFER, i), t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, s, 0);
2448
- const n = t.checkFramebufferStatus(t.FRAMEBUFFER);
2449
- if (r = r && n === t.FRAMEBUFFER_COMPLETE, r = r && t.getError() === t.NO_ERROR, r && (t.clear(t.COLOR_BUFFER_BIT), r = r && t.getError() === t.NO_ERROR), r) {
2450
- t.bindFramebuffer(t.FRAMEBUFFER, null);
2451
- const l = t.RGBA, a = t.UNSIGNED_BYTE, _ = new Uint8Array(4);
2452
- t.readPixels(0, 0, 1, 1, l, a, _), r = r && t.getError() === t.NO_ERROR;
2453
- }
2454
- for (t.deleteTexture(s), t.deleteFramebuffer(i), t.bindFramebuffer(t.FRAMEBUFFER, null); !r && t.getError() !== t.NO_ERROR; )
2455
- ;
2456
- return r;
2457
- }
2458
- /**
2459
- * @internal
2460
- */
2461
- _getWebGLTextureType(e) {
2462
- if (this._webGLVersion === 1) {
2463
- switch (e) {
2464
- case 1:
2465
- return this._gl.FLOAT;
2466
- case 2:
2467
- return this._gl.HALF_FLOAT_OES;
2468
- case 0:
2469
- return this._gl.UNSIGNED_BYTE;
2470
- case 8:
2471
- return this._gl.UNSIGNED_SHORT_4_4_4_4;
2472
- case 9:
2473
- return this._gl.UNSIGNED_SHORT_5_5_5_1;
2474
- case 10:
2475
- return this._gl.UNSIGNED_SHORT_5_6_5;
2476
- }
2477
- return this._gl.UNSIGNED_BYTE;
2478
- }
2479
- switch (e) {
2480
- case 3:
2481
- return this._gl.BYTE;
2482
- case 0:
2483
- return this._gl.UNSIGNED_BYTE;
2484
- case 4:
2485
- return this._gl.SHORT;
2486
- case 5:
2487
- return this._gl.UNSIGNED_SHORT;
2488
- case 6:
2489
- return this._gl.INT;
2490
- case 7:
2491
- return this._gl.UNSIGNED_INT;
2492
- case 1:
2493
- return this._gl.FLOAT;
2494
- case 2:
2495
- return this._gl.HALF_FLOAT;
2496
- case 8:
2497
- return this._gl.UNSIGNED_SHORT_4_4_4_4;
2498
- case 9:
2499
- return this._gl.UNSIGNED_SHORT_5_5_5_1;
2500
- case 10:
2501
- return this._gl.UNSIGNED_SHORT_5_6_5;
2502
- case 11:
2503
- return this._gl.UNSIGNED_INT_2_10_10_10_REV;
2504
- case 12:
2505
- return this._gl.UNSIGNED_INT_24_8;
2506
- case 13:
2507
- return this._gl.UNSIGNED_INT_10F_11F_11F_REV;
2508
- case 14:
2509
- return this._gl.UNSIGNED_INT_5_9_9_9_REV;
2510
- case 15:
2511
- return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV;
2512
- }
2513
- return this._gl.UNSIGNED_BYTE;
2514
- }
2515
- /**
2516
- * @internal
2517
- */
2518
- _getInternalFormat(e, t = !1) {
2519
- let r = t ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : this._gl.RGBA;
2520
- switch (e) {
2521
- case 0:
2522
- r = this._gl.ALPHA;
2523
- break;
2524
- case 1:
2525
- r = this._gl.LUMINANCE;
2526
- break;
2527
- case 2:
2528
- r = this._gl.LUMINANCE_ALPHA;
2529
- break;
2530
- case 6:
2531
- r = this._gl.RED;
2532
- break;
2533
- case 7:
2534
- r = this._gl.RG;
2535
- break;
2536
- case 4:
2537
- r = t ? this._glSRGBExtensionValues.SRGB : this._gl.RGB;
2538
- break;
2539
- case 5:
2540
- r = t ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : this._gl.RGBA;
2541
- break;
2542
- }
2543
- if (this._webGLVersion > 1)
2544
- switch (e) {
2545
- case 8:
2546
- r = this._gl.RED_INTEGER;
2547
- break;
2548
- case 9:
2549
- r = this._gl.RG_INTEGER;
2550
- break;
2551
- case 10:
2552
- r = this._gl.RGB_INTEGER;
2553
- break;
2554
- case 11:
2555
- r = this._gl.RGBA_INTEGER;
2556
- break;
2557
- }
2558
- return r;
2559
- }
2560
- /**
2561
- * @internal
2562
- */
2563
- _getRGBABufferInternalSizedFormat(e, t, r = !1) {
2564
- if (this._webGLVersion === 1) {
2565
- if (t !== void 0)
2566
- switch (t) {
2567
- case 0:
2568
- return this._gl.ALPHA;
2569
- case 1:
2570
- return this._gl.LUMINANCE;
2571
- case 2:
2572
- return this._gl.LUMINANCE_ALPHA;
2573
- case 4:
2574
- return r ? this._glSRGBExtensionValues.SRGB : this._gl.RGB;
2575
- }
2576
- return this._gl.RGBA;
2577
- }
2578
- switch (e) {
2579
- case 3:
2580
- switch (t) {
2581
- case 6:
2582
- return this._gl.R8_SNORM;
2583
- case 7:
2584
- return this._gl.RG8_SNORM;
2585
- case 4:
2586
- return this._gl.RGB8_SNORM;
2587
- case 8:
2588
- return this._gl.R8I;
2589
- case 9:
2590
- return this._gl.RG8I;
2591
- case 10:
2592
- return this._gl.RGB8I;
2593
- case 11:
2594
- return this._gl.RGBA8I;
2595
- default:
2596
- return this._gl.RGBA8_SNORM;
2597
- }
2598
- case 0:
2599
- switch (t) {
2600
- case 6:
2601
- return this._gl.R8;
2602
- case 7:
2603
- return this._gl.RG8;
2604
- case 4:
2605
- return r ? this._glSRGBExtensionValues.SRGB8 : this._gl.RGB8;
2606
- case 5:
2607
- return r ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : this._gl.RGBA8;
2608
- case 8:
2609
- return this._gl.R8UI;
2610
- case 9:
2611
- return this._gl.RG8UI;
2612
- case 10:
2613
- return this._gl.RGB8UI;
2614
- case 11:
2615
- return this._gl.RGBA8UI;
2616
- case 0:
2617
- return this._gl.ALPHA;
2618
- case 1:
2619
- return this._gl.LUMINANCE;
2620
- case 2:
2621
- return this._gl.LUMINANCE_ALPHA;
2622
- default:
2623
- return this._gl.RGBA8;
2624
- }
2625
- case 4:
2626
- switch (t) {
2627
- case 8:
2628
- return this._gl.R16I;
2629
- case 9:
2630
- return this._gl.RG16I;
2631
- case 10:
2632
- return this._gl.RGB16I;
2633
- case 11:
2634
- return this._gl.RGBA16I;
2635
- default:
2636
- return this._gl.RGBA16I;
2637
- }
2638
- case 5:
2639
- switch (t) {
2640
- case 8:
2641
- return this._gl.R16UI;
2642
- case 9:
2643
- return this._gl.RG16UI;
2644
- case 10:
2645
- return this._gl.RGB16UI;
2646
- case 11:
2647
- return this._gl.RGBA16UI;
2648
- default:
2649
- return this._gl.RGBA16UI;
2650
- }
2651
- case 6:
2652
- switch (t) {
2653
- case 8:
2654
- return this._gl.R32I;
2655
- case 9:
2656
- return this._gl.RG32I;
2657
- case 10:
2658
- return this._gl.RGB32I;
2659
- case 11:
2660
- return this._gl.RGBA32I;
2661
- default:
2662
- return this._gl.RGBA32I;
2663
- }
2664
- case 7:
2665
- switch (t) {
2666
- case 8:
2667
- return this._gl.R32UI;
2668
- case 9:
2669
- return this._gl.RG32UI;
2670
- case 10:
2671
- return this._gl.RGB32UI;
2672
- case 11:
2673
- return this._gl.RGBA32UI;
2674
- default:
2675
- return this._gl.RGBA32UI;
2676
- }
2677
- case 1:
2678
- switch (t) {
2679
- case 6:
2680
- return this._gl.R32F;
2681
- case 7:
2682
- return this._gl.RG32F;
2683
- case 4:
2684
- return this._gl.RGB32F;
2685
- case 5:
2686
- return this._gl.RGBA32F;
2687
- default:
2688
- return this._gl.RGBA32F;
2689
- }
2690
- case 2:
2691
- switch (t) {
2692
- case 6:
2693
- return this._gl.R16F;
2694
- case 7:
2695
- return this._gl.RG16F;
2696
- case 4:
2697
- return this._gl.RGB16F;
2698
- case 5:
2699
- return this._gl.RGBA16F;
2700
- default:
2701
- return this._gl.RGBA16F;
2702
- }
2703
- case 10:
2704
- return this._gl.RGB565;
2705
- case 13:
2706
- return this._gl.R11F_G11F_B10F;
2707
- case 14:
2708
- return this._gl.RGB9_E5;
2709
- case 8:
2710
- return this._gl.RGBA4;
2711
- case 9:
2712
- return this._gl.RGB5_A1;
2713
- case 11:
2714
- switch (t) {
2715
- case 5:
2716
- return this._gl.RGB10_A2;
2717
- case 11:
2718
- return this._gl.RGB10_A2UI;
2719
- default:
2720
- return this._gl.RGB10_A2;
2721
- }
2722
- }
2723
- return r ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : this._gl.RGBA8;
2724
- }
2725
- /**
2726
- * @internal
2727
- */
2728
- _getRGBAMultiSampleBufferFormat(e, t = 5) {
2729
- switch (e) {
2730
- case 1:
2731
- switch (t) {
2732
- case 6:
2733
- return this._gl.R32F;
2734
- default:
2735
- return this._gl.RGBA32F;
2736
- }
2737
- case 2:
2738
- switch (t) {
2739
- case 6:
2740
- return this._gl.R16F;
2741
- default:
2742
- return this._gl.RGBA16F;
2743
- }
2744
- }
2745
- return this._gl.RGBA8;
2746
- }
2747
- /**
2748
- * @internal
2749
- */
2750
- _loadFile(e, t, r, s, i, n) {
2751
- const l = R._FileToolsLoadFile(e, t, r, s, i, n);
2752
- return this._activeRequests.push(l), l.onCompleteObservable.add((a) => {
2753
- this._activeRequests.splice(this._activeRequests.indexOf(a), 1);
2754
- }), l;
2755
- }
2756
- /**
2757
- * Loads a file from a url
2758
- * @param url url to load
2759
- * @param onSuccess callback called when the file successfully loads
2760
- * @param onProgress callback called while file is loading (if the server supports this mode)
2761
- * @param offlineProvider defines the offline provider for caching
2762
- * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer
2763
- * @param onError callback called when the file fails to load
2764
- * @returns a file request object
2765
- * @internal
2766
- */
2767
- static _FileToolsLoadFile(e, t, r, s, i, n) {
2768
- throw P("FileTools");
2769
- }
2770
- /**
2771
- * Reads pixels from the current frame buffer. Please note that this function can be slow
2772
- * @param x defines the x coordinate of the rectangle where pixels must be read
2773
- * @param y defines the y coordinate of the rectangle where pixels must be read
2774
- * @param width defines the width of the rectangle where pixels must be read
2775
- * @param height defines the height of the rectangle where pixels must be read
2776
- * @param hasAlpha defines whether the output should have alpha or not (defaults to true)
2777
- * @param flushRenderer true to flush the renderer from the pending commands before reading the pixels
2778
- * @returns a ArrayBufferView promise (Uint8Array) containing RGBA colors
2779
- */
2780
- readPixels(e, t, r, s, i = !0, n = !0) {
2781
- const l = i ? 4 : 3, a = i ? this._gl.RGBA : this._gl.RGB, _ = new Uint8Array(s * r * l);
2782
- return n && this.flushFramebuffer(), this._gl.readPixels(e, t, r, s, a, this._gl.UNSIGNED_BYTE, _), Promise.resolve(_);
2783
- }
2784
- /**
2785
- * Gets a Promise<boolean> indicating if the engine can be instantiated (ie. if a webGL context can be found)
2786
- */
2787
- static get IsSupportedAsync() {
2788
- return Promise.resolve(this.isSupported());
2789
- }
2790
- /**
2791
- * Gets a boolean indicating if the engine can be instantiated (ie. if a webGL context can be found)
2792
- */
2793
- static get IsSupported() {
2794
- return this.isSupported();
2795
- }
2796
- /**
2797
- * Gets a boolean indicating if the engine can be instantiated (ie. if a webGL context can be found)
2798
- * @returns true if the engine can be created
2799
- * @ignorenaming
2800
- */
2801
- // eslint-disable-next-line @typescript-eslint/naming-convention
2802
- static isSupported() {
2803
- if (this._HasMajorPerformanceCaveat !== null)
2804
- return !this._HasMajorPerformanceCaveat;
2805
- if (this._IsSupported === null)
2806
- try {
2807
- const e = this._CreateCanvas(1, 1), t = e.getContext("webgl") || e.getContext("experimental-webgl");
2808
- this._IsSupported = t != null && !!window.WebGLRenderingContext;
2809
- } catch {
2810
- this._IsSupported = !1;
2811
- }
2812
- return this._IsSupported;
2813
- }
2814
- /**
2815
- * Gets a boolean indicating if the engine can be instantiated on a performant device (ie. if a webGL context can be found and it does not use a slow implementation)
2816
- */
2817
- static get HasMajorPerformanceCaveat() {
2818
- if (this._HasMajorPerformanceCaveat === null)
2819
- try {
2820
- const e = this._CreateCanvas(1, 1), t = e.getContext("webgl", { failIfMajorPerformanceCaveat: !0 }) || e.getContext("experimental-webgl", { failIfMajorPerformanceCaveat: !0 });
2821
- this._HasMajorPerformanceCaveat = !t;
2822
- } catch {
2823
- this._HasMajorPerformanceCaveat = !1;
2824
- }
2825
- return this._HasMajorPerformanceCaveat;
2826
- }
2827
- /**
2828
- * Find the next highest power of two.
2829
- * @param x Number to start search from.
2830
- * @returns Next highest power of two.
2831
- */
2832
- static CeilingPOT(e) {
2833
- return e--, e |= e >> 1, e |= e >> 2, e |= e >> 4, e |= e >> 8, e |= e >> 16, e++, e;
2834
- }
2835
- /**
2836
- * Find the next lowest power of two.
2837
- * @param x Number to start search from.
2838
- * @returns Next lowest power of two.
2839
- */
2840
- static FloorPOT(e) {
2841
- return e = e | e >> 1, e = e | e >> 2, e = e | e >> 4, e = e | e >> 8, e = e | e >> 16, e - (e >> 1);
2842
- }
2843
- /**
2844
- * Find the nearest power of two.
2845
- * @param x Number to start search from.
2846
- * @returns Next nearest power of two.
2847
- */
2848
- static NearestPOT(e) {
2849
- const t = R.CeilingPOT(e), r = R.FloorPOT(e);
2850
- return t - e > e - r ? r : t;
2851
- }
2852
- /**
2853
- * Get the closest exponent of two
2854
- * @param value defines the value to approximate
2855
- * @param max defines the maximum value to return
2856
- * @param mode defines how to define the closest value
2857
- * @returns closest exponent of two of the given value
2858
- */
2859
- static GetExponentOfTwo(e, t, r = 2) {
2860
- let s;
2861
- switch (r) {
2862
- case 1:
2863
- s = R.FloorPOT(e);
2864
- break;
2865
- case 2:
2866
- s = R.NearestPOT(e);
2867
- break;
2868
- case 3:
2869
- default:
2870
- s = R.CeilingPOT(e);
2871
- break;
2872
- }
2873
- return Math.min(s, t);
2874
- }
2875
- /**
2876
- * Queue a new function into the requested animation frame pool (ie. this function will be executed by the browser (or the javascript engine) for the next frame)
2877
- * @param func - the function to be called
2878
- * @param requester - the object that will request the next frame. Falls back to window.
2879
- * @returns frame number
2880
- */
2881
- static QueueNewFrame(e, t) {
2882
- if (v()) {
2883
- const { requestPostAnimationFrame: r, requestAnimationFrame: s } = t || window;
2884
- if (typeof r == "function")
2885
- return r(e);
2886
- if (typeof s == "function")
2887
- return s(e);
2888
- } else if (typeof requestAnimationFrame == "function")
2889
- return requestAnimationFrame(e);
2890
- return setTimeout(e, 16);
2891
- }
2892
- /**
2893
- * Gets host document
2894
- * @returns the host document object
2895
- */
2896
- getHostDocument() {
2897
- return this._renderingCanvas && this._renderingCanvas.ownerDocument ? this._renderingCanvas.ownerDocument : N() ? document : null;
2898
- }
2899
- }
2900
- R.ExceptionList = [
2901
- { key: "Chrome/63.0", capture: "63\\.0\\.3239\\.(\\d+)", captureConstraint: 108, targets: ["uniformBuffer"] },
2902
- { key: "Firefox/58", capture: null, captureConstraint: null, targets: ["uniformBuffer"] },
2903
- { key: "Firefox/59", capture: null, captureConstraint: null, targets: ["uniformBuffer"] },
2904
- { key: "Chrome/72.+?Mobile", capture: null, captureConstraint: null, targets: ["vao"] },
2905
- { key: "Chrome/73.+?Mobile", capture: null, captureConstraint: null, targets: ["vao"] },
2906
- { key: "Chrome/74.+?Mobile", capture: null, captureConstraint: null, targets: ["vao"] },
2907
- { key: "Mac OS.+Chrome/71", capture: null, captureConstraint: null, targets: ["vao"] },
2908
- { key: "Mac OS.+Chrome/72", capture: null, captureConstraint: null, targets: ["vao"] },
2909
- { key: "Mac OS.+Chrome", capture: null, captureConstraint: null, targets: ["uniformBuffer"] },
2910
- // desktop osx safari 15.4
2911
- { key: ".*AppleWebKit.*(15.4).*Safari", capture: null, captureConstraint: null, targets: ["antialias", "maxMSAASamples"] },
2912
- // mobile browsers using safari 15.4 on ios
2913
- { key: ".*(15.4).*AppleWebKit.*Safari", capture: null, captureConstraint: null, targets: ["antialias", "maxMSAASamples"] }
2914
- ];
2915
- R._TextureLoaders = [];
2916
- R.CollisionsEpsilon = 1e-3;
2917
- R._IsSupported = null;
2918
- R._HasMajorPerformanceCaveat = null;
2919
- export {
2920
- R as ThinEngine
2921
- };