@babylonjs/core 7.12.0 → 7.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animation.js +1 -2
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroupMask.d.ts +1 -1
- package/Animations/animationGroupMask.js +2 -2
- package/Animations/animationGroupMask.js.map +1 -1
- package/Animations/animationKey.d.ts +1 -1
- package/Animations/animationKey.js.map +1 -1
- package/Behaviors/Meshes/handConstraintBehavior.d.ts +3 -3
- package/Behaviors/Meshes/handConstraintBehavior.js +16 -17
- package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
- package/Behaviors/Meshes/sixDofDragBehavior.js +2 -3
- package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
- package/Bones/bone.js +31 -32
- package/Bones/bone.js.map +1 -1
- package/Bones/boneIKController.js +5 -6
- package/Bones/boneIKController.js.map +1 -1
- package/Bones/boneLookController.js +13 -13
- package/Bones/boneLookController.js.map +1 -1
- package/Buffers/bufferUtils.d.ts +13 -0
- package/Buffers/bufferUtils.js +42 -0
- package/Buffers/bufferUtils.js.map +1 -0
- package/Buffers/index.d.ts +1 -0
- package/Buffers/index.js +1 -0
- package/Buffers/index.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseWheelInput.js +5 -6
- package/Cameras/Inputs/freeCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraVirtualJoystickInput.js +5 -5
- package/Cameras/Inputs/freeCameraVirtualJoystickInput.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.js +8 -10
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Compute/computeEffect.js +2 -3
- package/Compute/computeEffect.js.map +1 -1
- package/Compute/computeShader.js +19 -20
- package/Compute/computeShader.js.map +1 -1
- package/Culling/Helper/IBoundingInfoHelperPlatform.d.ts +4 -0
- package/Culling/Helper/IBoundingInfoHelperPlatform.js.map +1 -1
- package/Culling/Helper/boundingInfoHelper.d.ts +26 -4
- package/Culling/Helper/boundingInfoHelper.js +41 -10
- package/Culling/Helper/boundingInfoHelper.js.map +1 -1
- package/Culling/Helper/computeShaderBoundingHelper.d.ts +12 -3
- package/Culling/Helper/computeShaderBoundingHelper.js +164 -76
- package/Culling/Helper/computeShaderBoundingHelper.js.map +1 -1
- package/Culling/Helper/transformFeedbackBoundingHelper.d.ts +11 -0
- package/Culling/Helper/transformFeedbackBoundingHelper.js +46 -14
- package/Culling/Helper/transformFeedbackBoundingHelper.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Decorators/nodeDecorator.d.ts +1 -1
- package/Decorators/nodeDecorator.js +1 -1
- package/Decorators/nodeDecorator.js.map +1 -1
- package/DeviceInput/InputDevices/deviceEnums.d.ts +5 -5
- package/DeviceInput/InputDevices/deviceEnums.js.map +1 -1
- package/DeviceInput/eventFactory.js +3 -3
- package/DeviceInput/eventFactory.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +2 -2
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.computeShader.d.ts +1 -1
- package/Engines/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/Extensions/engine.cubeTexture.js +2 -2
- package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.dynamicTexture.js +2 -2
- package/Engines/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js +3 -3
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.multiview.js +2 -2
- package/Engines/Extensions/engine.multiview.js.map +1 -1
- package/Engines/Extensions/engine.prefilteredCubeTexture.js +3 -3
- package/Engines/Extensions/engine.prefilteredCubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.js +4 -4
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +3 -3
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Extensions/engine.renderTargetCube.js +2 -2
- package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/Native/nativeShaderProcessors.js +1 -2
- package/Engines/Native/nativeShaderProcessors.js.map +1 -1
- package/Engines/Processors/shaderProcessor.js +2 -3
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGL/webGL2ShaderProcessors.js +1 -2
- package/Engines/WebGL/webGL2ShaderProcessors.js.map +1 -1
- package/Engines/WebGL/webGLShaderProcessors.js +1 -2
- package/Engines/WebGL/webGLShaderProcessors.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.computeShader.js +1 -2
- package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js +2 -2
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +2 -2
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js +2 -2
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.js +5 -5
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +3 -3
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js +2 -2
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +81 -82
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +60 -64
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.js +1 -2
- package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
- package/Engines/WebGPU/webgpuComputeContext.js +13 -15
- package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
- package/Engines/WebGPU/webgpuConstants.d.ts +39 -39
- package/Engines/WebGPU/webgpuConstants.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +6 -8
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -2
- package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
- package/Engines/WebGPU/webgpuQuerySet.js +3 -3
- package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessor.js +15 -19
- package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +8 -10
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +26 -28
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +413 -416
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +50 -51
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/WebGPU/webgpuTimestampQuery.js +1 -2
- package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
- package/Engines/abstractEngine.js +4 -4
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.js +2 -2
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.js +9 -9
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +5 -5
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.js +1 -2
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/shaderStore.js +6 -7
- package/Engines/shaderStore.js.map +1 -1
- package/Engines/thinEngine.js +4 -5
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +11 -0
- package/Engines/webgpuEngine.js +91 -72
- package/Engines/webgpuEngine.js.map +1 -1
- package/Events/deviceInputEvents.d.ts +1 -1
- package/Events/deviceInputEvents.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +1 -1
- package/FlowGraph/flowGraph.js +5 -5
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphBlock.js +2 -3
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +1 -1
- package/FlowGraph/flowGraphConnection.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.js +3 -3
- package/FlowGraph/flowGraphDataConnection.js.map +1 -1
- package/FlowGraph/flowGraphExecutionBlock.js +2 -3
- package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphSignalConnection.js +3 -3
- package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
- package/Gamepads/dualShockGamepad.d.ts +2 -2
- package/Gamepads/dualShockGamepad.js +14 -14
- package/Gamepads/dualShockGamepad.js.map +1 -1
- package/Gamepads/xboxGamepad.d.ts +2 -2
- package/Gamepads/xboxGamepad.js +14 -14
- package/Gamepads/xboxGamepad.js.map +1 -1
- package/Gizmos/gizmo.d.ts +2 -2
- package/Gizmos/gizmo.js +4 -4
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/gizmoManager.js +2 -2
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/scaleGizmo.js +3 -3
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Loading/sceneLoader.d.ts +1 -1
- package/Loading/sceneLoader.js +6 -6
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +3 -3
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +10 -11
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +8 -9
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js +3 -4
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js +2 -3
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +1 -2
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +5 -6
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +4 -5
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +7 -8
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.js +4 -6
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.js +2 -4
- package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/derivativeBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/derivativeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragDepthBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/fragDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +5 -6
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/frontFacingBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +5 -6
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +3 -4
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +7 -9
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +19 -21
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js +3 -4
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js +2 -3
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +4 -5
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js +1 -2
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +28 -29
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +4 -5
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js +5 -6
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.js +4 -5
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +2 -3
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +1 -2
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +1 -2
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +1 -2
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js +1 -2
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/arcTan2Block.js +1 -2
- package/Materials/Node/Blocks/arcTan2Block.js.map +1 -1
- package/Materials/Node/Blocks/biPlanarBlock.js +3 -4
- package/Materials/Node/Blocks/biPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/clampBlock.js +4 -5
- package/Materials/Node/Blocks/clampBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js +3 -4
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/curveBlock.js +1 -2
- package/Materials/Node/Blocks/curveBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.js +1 -2
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -2
- package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.d.ts +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js +35 -35
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
- package/Materials/Node/Blocks/modBlock.js +1 -2
- package/Materials/Node/Blocks/modBlock.js.map +1 -1
- package/Materials/Node/Blocks/remapBlock.js +3 -3
- package/Materials/Node/Blocks/remapBlock.js.map +1 -1
- package/Materials/Node/Blocks/simplexPerlin3DBlock.js +1 -2
- package/Materials/Node/Blocks/simplexPerlin3DBlock.js.map +1 -1
- package/Materials/Node/Blocks/transformBlock.js +1 -2
- package/Materials/Node/Blocks/transformBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js +10 -12
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/voronoiNoiseBlock.js +3 -4
- package/Materials/Node/Blocks/voronoiNoiseBlock.js.map +1 -1
- package/Materials/Node/Blocks/waveBlock.d.ts +1 -1
- package/Materials/Node/Blocks/waveBlock.js +4 -4
- package/Materials/Node/Blocks/waveBlock.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.js +3 -4
- package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
- package/Materials/Node/Enums/nodeMaterialBlockConnectionPointMode.d.ts +1 -1
- package/Materials/Node/Enums/nodeMaterialBlockConnectionPointMode.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +3 -4
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.js +5 -6
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +2 -2
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +10 -10
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +18 -19
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Node/nodeMaterialConnectionPointCustomObject.js +3 -3
- package/Materials/Node/nodeMaterialConnectionPointCustomObject.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +3 -4
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +1 -1
- package/Materials/Textures/internalTexture.js +13 -13
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/ktx2decoderTypes.d.ts +1 -1
- package/Materials/Textures/ktx2decoderTypes.js.map +1 -1
- package/Materials/Textures/rawCubeTexture.js +1 -2
- package/Materials/Textures/rawCubeTexture.js.map +1 -1
- package/Materials/effect.functions.js +2 -3
- package/Materials/effect.functions.js.map +1 -1
- package/Materials/effect.js +3 -4
- package/Materials/effect.js.map +1 -1
- package/Materials/effect.webgl.functions.js +1 -2
- package/Materials/effect.webgl.functions.js.map +1 -1
- package/Materials/material.js +7 -9
- package/Materials/material.js.map +1 -1
- package/Materials/materialPluginEvent.d.ts +1 -1
- package/Materials/materialPluginEvent.js.map +1 -1
- package/Materials/materialPluginManager.js +9 -11
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/meshDebugPluginMaterial.d.ts +1 -1
- package/Materials/meshDebugPluginMaterial.js +2 -2
- package/Materials/meshDebugPluginMaterial.js.map +1 -1
- package/Materials/shaderLanguage.d.ts +1 -1
- package/Materials/shaderLanguage.js.map +1 -1
- package/Materials/shadowDepthWrapper.js +1 -2
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Materials/standardMaterial.js +2 -3
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/math.axis.d.ts +2 -2
- package/Maths/math.axis.js.map +1 -1
- package/Maths/math.path.d.ts +1 -1
- package/Maths/math.path.js +3 -3
- package/Maths/math.path.js.map +1 -1
- package/Maths/math.vector.js +32 -6
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.d.ts +2 -2
- package/Meshes/Builders/greasedLineBuilder.js +21 -23
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +3 -3
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +14 -14
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +2 -2
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +2 -2
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +3 -3
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +3 -3
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setColorsBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.js +3 -3
- package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +2 -2
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +2 -2
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
- package/Meshes/Node/Blocks/booleanGeometryBlock.js +3 -3
- package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/conditionBlock.js +2 -2
- package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryClampBlock.js +3 -3
- package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCollectionBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCurveBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js +3 -3
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mappingBlock.js +2 -2
- package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mathBlock.js +2 -2
- package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.js +2 -2
- package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.js +2 -2
- package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.js +3 -3
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +2 -2
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +7 -7
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +49 -17
- package/Meshes/abstractMesh.js +128 -133
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/geometry.d.ts +8 -0
- package/Meshes/geometry.js +17 -0
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +5 -8
- package/Meshes/instancedMesh.js +15 -9
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +7 -3
- package/Meshes/mesh.js +21 -13
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/meshSimplification.d.ts +1 -1
- package/Meshes/meshSimplification.js +1 -1
- package/Meshes/meshSimplification.js.map +1 -1
- package/Meshes/meshSimplificationSceneComponent.js +2 -2
- package/Meshes/meshSimplificationSceneComponent.js.map +1 -1
- package/Meshes/transformNode.js +7 -8
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/assetsManager.d.ts +1 -1
- package/Misc/assetsManager.js +9 -9
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/basis.js +2 -2
- package/Misc/basis.js.map +1 -1
- package/Misc/copyTextureToTexture.d.ts +1 -1
- package/Misc/copyTextureToTexture.js +1 -1
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Misc/environmentTextureTools.js +3 -3
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/iInspectable.d.ts +1 -1
- package/Misc/iInspectable.js.map +1 -1
- package/Misc/khronosTextureContainer2.js +2 -2
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/timer.d.ts +1 -1
- package/Misc/timer.js +5 -5
- package/Misc/timer.js.map +1 -1
- package/Misc/virtualJoystick.d.ts +1 -1
- package/Misc/virtualJoystick.js +16 -16
- package/Misc/virtualJoystick.js.map +1 -1
- package/Particles/particleSystem.js +3 -3
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/particleSystemComponent.js +1 -2
- package/Particles/particleSystemComponent.js.map +1 -1
- package/Particles/pointsCloudSystem.d.ts +1 -1
- package/Particles/pointsCloudSystem.js +14 -14
- package/Particles/pointsCloudSystem.js.map +1 -1
- package/Particles/subEmitter.d.ts +1 -1
- package/Particles/subEmitter.js +1 -1
- package/Particles/subEmitter.js.map +1 -1
- package/Physics/physicsHelper.d.ts +2 -2
- package/Physics/physicsHelper.js +6 -7
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/v1/physicsImpostor.js +4 -5
- package/Physics/v1/physicsImpostor.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +16 -8
- package/Physics/v2/IPhysicsEnginePlugin.js +9 -0
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +96 -79
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsAggregate.js +8 -9
- package/Physics/v2/physicsAggregate.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +14 -2
- package/Physics/v2/physicsBody.js +30 -11
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Physics/v2/physicsConstraint.js +8 -9
- package/Physics/v2/physicsConstraint.js.map +1 -1
- package/Physics/v2/physicsMaterial.d.ts +1 -1
- package/Physics/v2/physicsMaterial.js.map +1 -1
- package/Physics/v2/physicsShape.js +9 -10
- package/Physics/v2/physicsShape.js.map +1 -1
- package/Physics/v2/ragdoll.js +11 -12
- package/Physics/v2/ragdoll.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +2 -2
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/depthOfFieldEffect.d.ts +1 -1
- package/PostProcesses/depthOfFieldEffect.js +3 -3
- package/PostProcesses/depthOfFieldEffect.js.map +1 -1
- package/PostProcesses/postProcess.js +2 -3
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/tonemapPostProcess.d.ts +1 -1
- package/PostProcesses/tonemapPostProcess.js +4 -4
- package/PostProcesses/tonemapPostProcess.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +10 -10
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
- package/Shaders/spriteMap.fragment.js +3 -2
- package/Shaders/spriteMap.fragment.js.map +1 -1
- package/ShadersWGSL/boundingInfo.compute.js +8 -8
- package/ShadersWGSL/boundingInfo.compute.js.map +1 -1
- package/XR/features/WebXRDepthSensing.js +2 -2
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +2 -2
- package/XR/features/WebXRHandTracking.js +76 -76
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRLightEstimation.js +2 -2
- package/XR/features/WebXRLightEstimation.js.map +1 -1
- package/XR/features/WebXRNearInteraction.d.ts +1 -1
- package/XR/features/WebXRNearInteraction.js +5 -5
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/features/WebXRRawCameraAccess.js +2 -2
- package/XR/features/WebXRRawCameraAccess.js.map +1 -1
- package/XR/motionController/webXRProfiledMotionController.js +2 -2
- package/XR/motionController/webXRProfiledMotionController.js.map +1 -1
- package/XR/webXRCamera.js +3 -4
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXREnterExitUI.js +3 -4
- package/XR/webXREnterExitUI.js.map +1 -1
- package/XR/webXRExperienceHelper.js +12 -13
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRManagedOutputCanvas.d.ts +1 -1
- package/XR/webXRManagedOutputCanvas.js +15 -6
- package/XR/webXRManagedOutputCanvas.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.js +2 -2
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/XR/webXRTypes.d.ts +2 -2
- package/XR/webXRTypes.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +1 -1
- package/scene.js +4 -4
- package/scene.js.map +1 -1
|
@@ -9,7 +9,7 @@ import type { SphericalPolynomial } from "../../Maths/sphericalPolynomial";
|
|
|
9
9
|
/**
|
|
10
10
|
* Defines the source of the internal texture
|
|
11
11
|
*/
|
|
12
|
-
export declare enum InternalTextureSource {
|
|
12
|
+
export declare const enum InternalTextureSource {
|
|
13
13
|
/**
|
|
14
14
|
* The source of the texture data is unknown
|
|
15
15
|
*/
|
|
@@ -196,7 +196,7 @@ export class InternalTexture extends TextureSampler {
|
|
|
196
196
|
/** @internal */
|
|
197
197
|
this._associatedChannel = -1;
|
|
198
198
|
/** @internal */
|
|
199
|
-
this._source = InternalTextureSource.Unknown
|
|
199
|
+
this._source = 0 /* InternalTextureSource.Unknown */;
|
|
200
200
|
/** @internal */
|
|
201
201
|
this._buffer = null;
|
|
202
202
|
/** @internal */
|
|
@@ -315,9 +315,9 @@ export class InternalTexture extends TextureSampler {
|
|
|
315
315
|
}
|
|
316
316
|
let proxy;
|
|
317
317
|
switch (this.source) {
|
|
318
|
-
case InternalTextureSource.Temp
|
|
318
|
+
case 2 /* InternalTextureSource.Temp */:
|
|
319
319
|
break;
|
|
320
|
-
case InternalTextureSource.Url
|
|
320
|
+
case 1 /* InternalTextureSource.Url */:
|
|
321
321
|
proxy = this._engine.createTexture(this._originalUrl ?? this.url, !this.generateMipMaps, this.invertY, null, this.samplingMode,
|
|
322
322
|
// Do not use Proxy here as it could be fully synchronous
|
|
323
323
|
// and proxy would be undefined.
|
|
@@ -326,22 +326,22 @@ export class InternalTexture extends TextureSampler {
|
|
|
326
326
|
this.isReady = true;
|
|
327
327
|
}, null, this._buffer, undefined, this.format, this._extension, undefined, undefined, undefined, this._useSRGBBuffer);
|
|
328
328
|
return;
|
|
329
|
-
case InternalTextureSource.Raw
|
|
329
|
+
case 3 /* InternalTextureSource.Raw */:
|
|
330
330
|
proxy = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression, this.type, this._creationFlags, this._useSRGBBuffer);
|
|
331
331
|
proxy._swapAndDie(this, false);
|
|
332
332
|
this.isReady = true;
|
|
333
333
|
break;
|
|
334
|
-
case InternalTextureSource.Raw3D
|
|
334
|
+
case 10 /* InternalTextureSource.Raw3D */:
|
|
335
335
|
proxy = this._engine.createRawTexture3D(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression, this.type);
|
|
336
336
|
proxy._swapAndDie(this, false);
|
|
337
337
|
this.isReady = true;
|
|
338
338
|
break;
|
|
339
|
-
case InternalTextureSource.Raw2DArray
|
|
339
|
+
case 11 /* InternalTextureSource.Raw2DArray */:
|
|
340
340
|
proxy = this._engine.createRawTexture2DArray(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression, this.type);
|
|
341
341
|
proxy._swapAndDie(this, false);
|
|
342
342
|
this.isReady = true;
|
|
343
343
|
break;
|
|
344
|
-
case InternalTextureSource.Dynamic
|
|
344
|
+
case 4 /* InternalTextureSource.Dynamic */:
|
|
345
345
|
proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);
|
|
346
346
|
proxy._swapAndDie(this, false);
|
|
347
347
|
if (this._dynamicTextureSource) {
|
|
@@ -349,22 +349,22 @@ export class InternalTexture extends TextureSampler {
|
|
|
349
349
|
}
|
|
350
350
|
// The engine will make sure to update content so no need to flag it as isReady = true
|
|
351
351
|
break;
|
|
352
|
-
case InternalTextureSource.Cube
|
|
352
|
+
case 7 /* InternalTextureSource.Cube */:
|
|
353
353
|
proxy = this._engine.createCubeTexture(this.url, null, this._files, !this.generateMipMaps, () => {
|
|
354
354
|
proxy._swapAndDie(this, false);
|
|
355
355
|
this.isReady = true;
|
|
356
356
|
}, null, this.format, this._extension, false, 0, 0, null, undefined, this._useSRGBBuffer, ArrayBuffer.isView(this._buffer) ? this._buffer : null);
|
|
357
357
|
return;
|
|
358
|
-
case InternalTextureSource.CubeRaw
|
|
358
|
+
case 8 /* InternalTextureSource.CubeRaw */:
|
|
359
359
|
proxy = this._engine.createRawCubeTexture(this._bufferViewArray, this.width, this._originalFormat ?? this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);
|
|
360
360
|
proxy._swapAndDie(this, false);
|
|
361
361
|
this.isReady = true;
|
|
362
362
|
break;
|
|
363
|
-
case InternalTextureSource.CubeRawRGBD
|
|
363
|
+
case 13 /* InternalTextureSource.CubeRawRGBD */:
|
|
364
364
|
// This case is being handeled by the environment texture tools and is not a part of the rebuild process.
|
|
365
365
|
// To use CubeRawRGBD use updateRGBDAsync on the cube texture.
|
|
366
366
|
return;
|
|
367
|
-
case InternalTextureSource.CubePrefiltered
|
|
367
|
+
case 9 /* InternalTextureSource.CubePrefiltered */:
|
|
368
368
|
proxy = this._engine.createPrefilteredCubeTexture(this.url, null, this._lodGenerationScale, this._lodGenerationOffset, (proxy) => {
|
|
369
369
|
if (proxy) {
|
|
370
370
|
proxy._swapAndDie(this, false);
|
|
@@ -373,8 +373,8 @@ export class InternalTexture extends TextureSampler {
|
|
|
373
373
|
}, null, this.format, this._extension);
|
|
374
374
|
proxy._sphericalPolynomial = this._sphericalPolynomial;
|
|
375
375
|
return;
|
|
376
|
-
case InternalTextureSource.DepthStencil
|
|
377
|
-
case InternalTextureSource.Depth
|
|
376
|
+
case 12 /* InternalTextureSource.DepthStencil */:
|
|
377
|
+
case 14 /* InternalTextureSource.Depth */: {
|
|
378
378
|
// Will be handled at the RenderTargetWrapper level
|
|
379
379
|
break;
|
|
380
380
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/internalTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMlD;;GAEG;AACH,MAAM,CAAN,IAAY,qBA6DX;AA7DD,WAAY,qBAAqB;IAC7B;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,+DAAG,CAAA;IACH;;OAEG;IACH,iEAAI,CAAA;IACJ;;OAEG;IACH,+DAAG,CAAA;IACH;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,iFAAY,CAAA;IACZ;;OAEG;IACH,2FAAiB,CAAA;IACjB;;OAEG;IACH,iEAAI,CAAA;IACJ;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,uFAAe,CAAA;IACf;;OAEG;IACH,oEAAK,CAAA;IACL;;OAEG;IACH,8EAAU,CAAA;IACV;;OAEG;IACH,kFAAY,CAAA;IACZ;;OAEG;IACH,gFAAW,CAAA;IACX;;OAEG;IACH,oEAAK,CAAA;AACT,CAAC,EA7DW,qBAAqB,KAArB,qBAAqB,QA6DhC;AAED;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,cAAc;IA+B/C;;;OAGG;IACH,IAAoB,UAAU;QAC1B,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IACD,IAAoB,UAA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Ac,CAAC,OAAO,EAAE,CAAC;aACnC;YACD,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;SAC/C;QAED,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACzB,IAAI,MAAM,CAAC,kBAAkB,EAAE;gBAC3B,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;aACvC;YACD,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;SACvD;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC;QACpD,IAAI,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SAC1B;QAED,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACtB;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,IAAI,CAAC,WAAW,KAAK,CAAC,EAAE;YACxB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;SACrC;IACL,CAAC;;AArUD,gBAAgB;AACF,wBAAQ,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import { Observable } from \"../../Misc/observable\";\r\nimport type { ImageSource, Nullable, int } from \"../../types\";\r\nimport type { ICanvas, ICanvasRenderingContext } from \"../../Engines/ICanvas\";\r\nimport type { HardwareTextureWrapper } from \"./hardwareTextureWrapper\";\r\nimport { TextureSampler } from \"./textureSampler\";\r\n\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport type { SphericalPolynomial } from \"../../Maths/sphericalPolynomial\";\r\n\r\n/**\r\n * Defines the source of the internal texture\r\n */\r\nexport enum InternalTextureSource {\r\n /**\r\n * The source of the texture data is unknown\r\n */\r\n Unknown,\r\n /**\r\n * Texture data comes from an URL\r\n */\r\n Url,\r\n /**\r\n * Texture data is only used for temporary storage\r\n */\r\n Temp,\r\n /**\r\n * Texture data comes from raw data (ArrayBuffer)\r\n */\r\n Raw,\r\n /**\r\n * Texture content is dynamic (video or dynamic texture)\r\n */\r\n Dynamic,\r\n /**\r\n * Texture content is generated by rendering to it\r\n */\r\n RenderTarget,\r\n /**\r\n * Texture content is part of a multi render target process\r\n */\r\n MultiRenderTarget,\r\n /**\r\n * Texture data comes from a cube data file\r\n */\r\n Cube,\r\n /**\r\n * Texture data comes from a raw cube data\r\n */\r\n CubeRaw,\r\n /**\r\n * Texture data come from a prefiltered cube data file\r\n */\r\n CubePrefiltered,\r\n /**\r\n * Texture content is raw 3D data\r\n */\r\n Raw3D,\r\n /**\r\n * Texture content is raw 2D array data\r\n */\r\n Raw2DArray,\r\n /**\r\n * Texture content is a depth/stencil texture\r\n */\r\n DepthStencil,\r\n /**\r\n * Texture data comes from a raw cube data encoded with RGBD\r\n */\r\n CubeRawRGBD,\r\n /**\r\n * Texture content is a depth texture\r\n */\r\n Depth,\r\n}\r\n\r\n/**\r\n * Class used to store data associated with WebGL texture data for the engine\r\n * This class should not be used directly\r\n */\r\nexport class InternalTexture extends TextureSampler {\r\n /**\r\n * Defines if the texture is ready\r\n */\r\n public isReady: boolean = false;\r\n /**\r\n * Defines if the texture is a cube texture\r\n */\r\n public isCube: boolean = false;\r\n /**\r\n * Defines if the texture contains 3D data\r\n */\r\n public is3D: boolean = false;\r\n /**\r\n * Defines if the texture contains 2D array data\r\n */\r\n public is2DArray: boolean = false;\r\n /**\r\n * Defines if the texture contains multiview data\r\n */\r\n public isMultiview: boolean = false;\r\n /**\r\n * Gets the URL used to load this texture\r\n */\r\n public url: string = \"\";\r\n /** @internal */\r\n public _originalUrl: string; // not empty only if different from url\r\n /**\r\n * Gets a boolean indicating if the texture needs mipmaps generation\r\n */\r\n public generateMipMaps: boolean = false;\r\n /**\r\n * Gets a boolean indicating if the texture uses mipmaps\r\n * TODO implements useMipMaps as a separate setting from generateMipMaps\r\n */\r\n public override get useMipMaps() {\r\n return this.generateMipMaps;\r\n }\r\n public override set useMipMaps(value: boolean) {\r\n this.generateMipMaps = value;\r\n }\r\n /**\r\n * Gets the number of samples used by the texture (WebGL2+ only)\r\n */\r\n public samples: number = 0;\r\n /**\r\n * Gets the type of the texture (int, float...)\r\n */\r\n public type: number = -1;\r\n /**\r\n * Gets the format of the texture (RGB, RGBA...)\r\n */\r\n public format: number = -1;\r\n /**\r\n * Observable called when the texture is loaded\r\n */\r\n public onLoadedObservable = new Observable<InternalTexture>();\r\n /**\r\n * Observable called when the texture load is raising an error\r\n */\r\n public onErrorObservable = new Observable<Partial<{ message: string; exception: any }>>();\r\n /**\r\n * If this callback is defined it will be called instead of the default _rebuild function\r\n */\r\n public onRebuildCallback: Nullable<\r\n (internalTexture: InternalTexture) => {\r\n proxy: Nullable<InternalTexture | Promise<InternalTexture>>;\r\n isReady: boolean;\r\n isAsync: boolean;\r\n }\r\n > = null;\r\n /**\r\n * Gets the width of the texture\r\n */\r\n public width: number = 0;\r\n /**\r\n * Gets the height of the texture\r\n */\r\n public height: number = 0;\r\n /**\r\n * Gets the depth of the texture\r\n */\r\n public depth: number = 0;\r\n /**\r\n * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseWidth: number = 0;\r\n /**\r\n * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseHeight: number = 0;\r\n /**\r\n * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseDepth: number = 0;\r\n /**\r\n * Gets a boolean indicating if the texture is inverted on Y axis\r\n */\r\n public invertY: boolean = false;\r\n\r\n // Private\r\n /** @internal */\r\n public _invertVScale = false;\r\n /** @internal */\r\n public _associatedChannel = -1;\r\n /** @internal */\r\n public _source = InternalTextureSource.Unknown;\r\n /** @internal */\r\n public _buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap> = null;\r\n /** @internal */\r\n public _bufferView: Nullable<ArrayBufferView> = null;\r\n /** @internal */\r\n public _bufferViewArray: Nullable<ArrayBufferView[]> = null;\r\n /** @internal */\r\n public _bufferViewArrayArray: Nullable<ArrayBufferView[][]> = null;\r\n /** @internal */\r\n public _size: number = 0;\r\n /** @internal */\r\n public _extension: string = \"\";\r\n /** @internal */\r\n public _files: Nullable<string[]> = null;\r\n /** @internal */\r\n public _workingCanvas: Nullable<ICanvas> = null;\r\n /** @internal */\r\n public _workingContext: Nullable<ICanvasRenderingContext> = null;\r\n /** @internal */\r\n public _cachedCoordinatesMode: Nullable<number> = null;\r\n /** @internal */\r\n public _isDisabled: boolean = false;\r\n /** @internal */\r\n public _compression: Nullable<string> = null;\r\n /** @internal */\r\n public _sphericalPolynomial: Nullable<SphericalPolynomial> = null;\r\n /** @internal */\r\n public _sphericalPolynomialPromise: Nullable<Promise<SphericalPolynomial>> = null;\r\n /** @internal */\r\n public _sphericalPolynomialComputed = false;\r\n /** @internal */\r\n public _lodGenerationScale: number = 0;\r\n /** @internal */\r\n public _lodGenerationOffset: number = 0;\r\n /** @internal */\r\n public _useSRGBBuffer: boolean = false;\r\n /** @internal */\r\n public _creationFlags: number = 0;\r\n /** @internal */\r\n public _originalFormat?: number;\r\n\r\n // The following three fields helps sharing generated fixed LODs for texture filtering\r\n // In environment not supporting the textureLOD extension like EDGE. They are for internal use only.\r\n // They are at the level of the gl texture to benefit from the cache.\r\n /** @internal */\r\n public _lodTextureHigh: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _lodTextureMid: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _lodTextureLow: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _isRGBD: boolean = false;\r\n\r\n /** @internal */\r\n public _linearSpecularLOD: boolean = false;\r\n /** @internal */\r\n public _irradianceTexture: Nullable<BaseTexture> = null;\r\n\r\n /** @internal */\r\n public _hardwareTexture: Nullable<HardwareTextureWrapper> = null;\r\n\r\n /** @internal */\r\n public _maxLodLevel: Nullable<number> = null;\r\n\r\n /** @internal */\r\n public _references: number = 1;\r\n\r\n /** @internal */\r\n public _gammaSpace: Nullable<boolean> = null;\r\n\r\n /** @internal */\r\n public _premulAlpha = false;\r\n\r\n /** @internal */\r\n public _dynamicTextureSource: Nullable<ImageSource> = null;\r\n\r\n private _engine: AbstractEngine;\r\n private _uniqueId: number;\r\n\r\n /** @internal */\r\n public static _Counter = 0;\r\n\r\n /** Gets the unique id of the internal texture */\r\n public get uniqueId() {\r\n return this._uniqueId;\r\n }\r\n\r\n /** @internal */\r\n public _setUniqueId(id: number) {\r\n this._uniqueId = id;\r\n }\r\n\r\n /**\r\n * Gets the Engine the texture belongs to.\r\n * @returns The babylon engine\r\n */\r\n public getEngine(): AbstractEngine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the data source type of the texture\r\n */\r\n public get source(): InternalTextureSource {\r\n return this._source;\r\n }\r\n\r\n /**\r\n * Creates a new InternalTexture\r\n * @param engine defines the engine to use\r\n * @param source defines the type of data that will be used\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n constructor(engine: AbstractEngine, source: InternalTextureSource, delayAllocation = false) {\r\n super();\r\n\r\n this._engine = engine;\r\n this._source = source;\r\n this._uniqueId = InternalTexture._Counter++;\r\n\r\n if (!delayAllocation) {\r\n this._hardwareTexture = engine._createHardwareTexture();\r\n }\r\n }\r\n\r\n /**\r\n * Increments the number of references (ie. the number of Texture that point to it)\r\n */\r\n public incrementReferences(): void {\r\n this._references++;\r\n }\r\n\r\n /**\r\n * Change the size of the texture (not the size of the content)\r\n * @param width defines the new width\r\n * @param height defines the new height\r\n * @param depth defines the new depth (1 by default)\r\n */\r\n public updateSize(width: int, height: int, depth: int = 1): void {\r\n this._engine.updateTextureDimensions(this, width, height, depth);\r\n\r\n this.width = width;\r\n this.height = height;\r\n this.depth = depth;\r\n\r\n this.baseWidth = width;\r\n this.baseHeight = height;\r\n this.baseDepth = depth;\r\n\r\n this._size = width * height * depth;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n this.isReady = false;\r\n this._cachedCoordinatesMode = null;\r\n this._cachedWrapU = null;\r\n this._cachedWrapV = null;\r\n this._cachedWrapR = null;\r\n this._cachedAnisotropicFilteringLevel = null;\r\n if (this.onRebuildCallback) {\r\n const data = this.onRebuildCallback(this);\r\n const swapAndSetIsReady = (proxyInternalTexture: InternalTexture) => {\r\n proxyInternalTexture._swapAndDie(this, false);\r\n this.isReady = data.isReady;\r\n };\r\n if (data.isAsync) {\r\n (data.proxy as Promise<InternalTexture>).then(swapAndSetIsReady);\r\n } else {\r\n swapAndSetIsReady(data.proxy as InternalTexture);\r\n }\r\n return;\r\n }\r\n\r\n let proxy: InternalTexture;\r\n switch (this.source) {\r\n case InternalTextureSource.Temp:\r\n break;\r\n\r\n case InternalTextureSource.Url:\r\n proxy = this._engine.createTexture(\r\n this._originalUrl ?? this.url,\r\n !this.generateMipMaps,\r\n this.invertY,\r\n null,\r\n this.samplingMode,\r\n // Do not use Proxy here as it could be fully synchronous\r\n // and proxy would be undefined.\r\n (temp) => {\r\n temp._swapAndDie(this, false);\r\n this.isReady = true;\r\n },\r\n null,\r\n this._buffer,\r\n undefined,\r\n this.format,\r\n this._extension,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this._useSRGBBuffer\r\n );\r\n return;\r\n\r\n case InternalTextureSource.Raw:\r\n proxy = this._engine.createRawTexture(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type,\r\n this._creationFlags,\r\n this._useSRGBBuffer\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Raw3D:\r\n proxy = this._engine.createRawTexture3D(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.baseDepth,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Raw2DArray:\r\n proxy = this._engine.createRawTexture2DArray(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.baseDepth,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Dynamic:\r\n proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);\r\n proxy._swapAndDie(this, false);\r\n if (this._dynamicTextureSource) {\r\n this._engine.updateDynamicTexture(this, this._dynamicTextureSource, this.invertY, this._premulAlpha, this.format, true);\r\n }\r\n\r\n // The engine will make sure to update content so no need to flag it as isReady = true\r\n break;\r\n\r\n case InternalTextureSource.Cube:\r\n proxy = this._engine.createCubeTexture(\r\n this.url,\r\n null,\r\n this._files,\r\n !this.generateMipMaps,\r\n () => {\r\n proxy._swapAndDie(this, false);\r\n this.isReady = true;\r\n },\r\n null,\r\n this.format,\r\n this._extension,\r\n false,\r\n 0,\r\n 0,\r\n null,\r\n undefined,\r\n this._useSRGBBuffer,\r\n ArrayBuffer.isView(this._buffer) ? this._buffer : null\r\n );\r\n return;\r\n\r\n case InternalTextureSource.CubeRaw:\r\n proxy = this._engine.createRawCubeTexture(\r\n this._bufferViewArray!,\r\n this.width,\r\n this._originalFormat ?? this.format,\r\n this.type,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression\r\n );\r\n proxy._swapAndDie(this, false);\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.CubeRawRGBD:\r\n // This case is being handeled by the environment texture tools and is not a part of the rebuild process.\r\n // To use CubeRawRGBD use updateRGBDAsync on the cube texture.\r\n return;\r\n\r\n case InternalTextureSource.CubePrefiltered:\r\n proxy = this._engine.createPrefilteredCubeTexture(\r\n this.url,\r\n null,\r\n this._lodGenerationScale,\r\n this._lodGenerationOffset,\r\n (proxy) => {\r\n if (proxy) {\r\n proxy._swapAndDie(this, false);\r\n }\r\n this.isReady = true;\r\n },\r\n null,\r\n this.format,\r\n this._extension\r\n );\r\n proxy._sphericalPolynomial = this._sphericalPolynomial;\r\n return;\r\n\r\n case InternalTextureSource.DepthStencil:\r\n case InternalTextureSource.Depth: {\r\n // Will be handled at the RenderTargetWrapper level\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _swapAndDie(target: InternalTexture, swapAll = true): void {\r\n // TODO what about refcount on target?\r\n\r\n this._hardwareTexture?.setUsage(target._source, this.generateMipMaps, this.is2DArray, this.isCube, this.is3D, this.width, this.height, this.depth);\r\n\r\n target._hardwareTexture = this._hardwareTexture;\r\n if (swapAll) {\r\n target._isRGBD = this._isRGBD;\r\n }\r\n\r\n if (this._lodTextureHigh) {\r\n if (target._lodTextureHigh) {\r\n target._lodTextureHigh.dispose();\r\n }\r\n target._lodTextureHigh = this._lodTextureHigh;\r\n }\r\n\r\n if (this._lodTextureMid) {\r\n if (target._lodTextureMid) {\r\n target._lodTextureMid.dispose();\r\n }\r\n target._lodTextureMid = this._lodTextureMid;\r\n }\r\n\r\n if (this._lodTextureLow) {\r\n if (target._lodTextureLow) {\r\n target._lodTextureLow.dispose();\r\n }\r\n target._lodTextureLow = this._lodTextureLow;\r\n }\r\n\r\n if (this._irradianceTexture) {\r\n if (target._irradianceTexture) {\r\n target._irradianceTexture.dispose();\r\n }\r\n target._irradianceTexture = this._irradianceTexture;\r\n }\r\n\r\n const cache = this._engine.getLoadedTexturesCache();\r\n let index = cache.indexOf(this);\r\n if (index !== -1) {\r\n cache.splice(index, 1);\r\n }\r\n\r\n index = cache.indexOf(target);\r\n if (index === -1) {\r\n cache.push(target);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the current allocated resources\r\n */\r\n public dispose(): void {\r\n this._references--;\r\n this.onLoadedObservable.clear();\r\n this.onErrorObservable.clear();\r\n if (this._references === 0) {\r\n this._engine._releaseTexture(this);\r\n this._hardwareTexture = null;\r\n this._dynamicTextureSource = null;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"internalTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/internalTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMlD;;GAEG;AACH,MAAM,CAAN,IAAkB,qBA6DjB;AA7DD,WAAkB,qBAAqB;IACnC;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,+DAAG,CAAA;IACH;;OAEG;IACH,iEAAI,CAAA;IACJ;;OAEG;IACH,+DAAG,CAAA;IACH;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,iFAAY,CAAA;IACZ;;OAEG;IACH,2FAAiB,CAAA;IACjB;;OAEG;IACH,iEAAI,CAAA;IACJ;;OAEG;IACH,uEAAO,CAAA;IACP;;OAEG;IACH,uFAAe,CAAA;IACf;;OAEG;IACH,oEAAK,CAAA;IACL;;OAEG;IACH,8EAAU,CAAA;IACV;;OAEG;IACH,kFAA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CAAC;SAC/C;QAED,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACzB,IAAI,MAAM,CAAC,kBAAkB,EAAE;gBAC3B,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;aACvC;YACD,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;SACvD;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC;QACpD,IAAI,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SAC1B;QAED,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACtB;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,IAAI,CAAC,WAAW,KAAK,CAAC,EAAE;YACxB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;SACrC;IACL,CAAC;;AArUD,gBAAgB;AACF,wBAAQ,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import { Observable } from \"../../Misc/observable\";\r\nimport type { ImageSource, Nullable, int } from \"../../types\";\r\nimport type { ICanvas, ICanvasRenderingContext } from \"../../Engines/ICanvas\";\r\nimport type { HardwareTextureWrapper } from \"./hardwareTextureWrapper\";\r\nimport { TextureSampler } from \"./textureSampler\";\r\n\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport type { SphericalPolynomial } from \"../../Maths/sphericalPolynomial\";\r\n\r\n/**\r\n * Defines the source of the internal texture\r\n */\r\nexport const enum InternalTextureSource {\r\n /**\r\n * The source of the texture data is unknown\r\n */\r\n Unknown,\r\n /**\r\n * Texture data comes from an URL\r\n */\r\n Url,\r\n /**\r\n * Texture data is only used for temporary storage\r\n */\r\n Temp,\r\n /**\r\n * Texture data comes from raw data (ArrayBuffer)\r\n */\r\n Raw,\r\n /**\r\n * Texture content is dynamic (video or dynamic texture)\r\n */\r\n Dynamic,\r\n /**\r\n * Texture content is generated by rendering to it\r\n */\r\n RenderTarget,\r\n /**\r\n * Texture content is part of a multi render target process\r\n */\r\n MultiRenderTarget,\r\n /**\r\n * Texture data comes from a cube data file\r\n */\r\n Cube,\r\n /**\r\n * Texture data comes from a raw cube data\r\n */\r\n CubeRaw,\r\n /**\r\n * Texture data come from a prefiltered cube data file\r\n */\r\n CubePrefiltered,\r\n /**\r\n * Texture content is raw 3D data\r\n */\r\n Raw3D,\r\n /**\r\n * Texture content is raw 2D array data\r\n */\r\n Raw2DArray,\r\n /**\r\n * Texture content is a depth/stencil texture\r\n */\r\n DepthStencil,\r\n /**\r\n * Texture data comes from a raw cube data encoded with RGBD\r\n */\r\n CubeRawRGBD,\r\n /**\r\n * Texture content is a depth texture\r\n */\r\n Depth,\r\n}\r\n\r\n/**\r\n * Class used to store data associated with WebGL texture data for the engine\r\n * This class should not be used directly\r\n */\r\nexport class InternalTexture extends TextureSampler {\r\n /**\r\n * Defines if the texture is ready\r\n */\r\n public isReady: boolean = false;\r\n /**\r\n * Defines if the texture is a cube texture\r\n */\r\n public isCube: boolean = false;\r\n /**\r\n * Defines if the texture contains 3D data\r\n */\r\n public is3D: boolean = false;\r\n /**\r\n * Defines if the texture contains 2D array data\r\n */\r\n public is2DArray: boolean = false;\r\n /**\r\n * Defines if the texture contains multiview data\r\n */\r\n public isMultiview: boolean = false;\r\n /**\r\n * Gets the URL used to load this texture\r\n */\r\n public url: string = \"\";\r\n /** @internal */\r\n public _originalUrl: string; // not empty only if different from url\r\n /**\r\n * Gets a boolean indicating if the texture needs mipmaps generation\r\n */\r\n public generateMipMaps: boolean = false;\r\n /**\r\n * Gets a boolean indicating if the texture uses mipmaps\r\n * TODO implements useMipMaps as a separate setting from generateMipMaps\r\n */\r\n public override get useMipMaps() {\r\n return this.generateMipMaps;\r\n }\r\n public override set useMipMaps(value: boolean) {\r\n this.generateMipMaps = value;\r\n }\r\n /**\r\n * Gets the number of samples used by the texture (WebGL2+ only)\r\n */\r\n public samples: number = 0;\r\n /**\r\n * Gets the type of the texture (int, float...)\r\n */\r\n public type: number = -1;\r\n /**\r\n * Gets the format of the texture (RGB, RGBA...)\r\n */\r\n public format: number = -1;\r\n /**\r\n * Observable called when the texture is loaded\r\n */\r\n public onLoadedObservable = new Observable<InternalTexture>();\r\n /**\r\n * Observable called when the texture load is raising an error\r\n */\r\n public onErrorObservable = new Observable<Partial<{ message: string; exception: any }>>();\r\n /**\r\n * If this callback is defined it will be called instead of the default _rebuild function\r\n */\r\n public onRebuildCallback: Nullable<\r\n (internalTexture: InternalTexture) => {\r\n proxy: Nullable<InternalTexture | Promise<InternalTexture>>;\r\n isReady: boolean;\r\n isAsync: boolean;\r\n }\r\n > = null;\r\n /**\r\n * Gets the width of the texture\r\n */\r\n public width: number = 0;\r\n /**\r\n * Gets the height of the texture\r\n */\r\n public height: number = 0;\r\n /**\r\n * Gets the depth of the texture\r\n */\r\n public depth: number = 0;\r\n /**\r\n * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseWidth: number = 0;\r\n /**\r\n * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseHeight: number = 0;\r\n /**\r\n * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n public baseDepth: number = 0;\r\n /**\r\n * Gets a boolean indicating if the texture is inverted on Y axis\r\n */\r\n public invertY: boolean = false;\r\n\r\n // Private\r\n /** @internal */\r\n public _invertVScale = false;\r\n /** @internal */\r\n public _associatedChannel = -1;\r\n /** @internal */\r\n public _source = InternalTextureSource.Unknown;\r\n /** @internal */\r\n public _buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap> = null;\r\n /** @internal */\r\n public _bufferView: Nullable<ArrayBufferView> = null;\r\n /** @internal */\r\n public _bufferViewArray: Nullable<ArrayBufferView[]> = null;\r\n /** @internal */\r\n public _bufferViewArrayArray: Nullable<ArrayBufferView[][]> = null;\r\n /** @internal */\r\n public _size: number = 0;\r\n /** @internal */\r\n public _extension: string = \"\";\r\n /** @internal */\r\n public _files: Nullable<string[]> = null;\r\n /** @internal */\r\n public _workingCanvas: Nullable<ICanvas> = null;\r\n /** @internal */\r\n public _workingContext: Nullable<ICanvasRenderingContext> = null;\r\n /** @internal */\r\n public _cachedCoordinatesMode: Nullable<number> = null;\r\n /** @internal */\r\n public _isDisabled: boolean = false;\r\n /** @internal */\r\n public _compression: Nullable<string> = null;\r\n /** @internal */\r\n public _sphericalPolynomial: Nullable<SphericalPolynomial> = null;\r\n /** @internal */\r\n public _sphericalPolynomialPromise: Nullable<Promise<SphericalPolynomial>> = null;\r\n /** @internal */\r\n public _sphericalPolynomialComputed = false;\r\n /** @internal */\r\n public _lodGenerationScale: number = 0;\r\n /** @internal */\r\n public _lodGenerationOffset: number = 0;\r\n /** @internal */\r\n public _useSRGBBuffer: boolean = false;\r\n /** @internal */\r\n public _creationFlags: number = 0;\r\n /** @internal */\r\n public _originalFormat?: number;\r\n\r\n // The following three fields helps sharing generated fixed LODs for texture filtering\r\n // In environment not supporting the textureLOD extension like EDGE. They are for internal use only.\r\n // They are at the level of the gl texture to benefit from the cache.\r\n /** @internal */\r\n public _lodTextureHigh: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _lodTextureMid: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _lodTextureLow: Nullable<BaseTexture> = null;\r\n /** @internal */\r\n public _isRGBD: boolean = false;\r\n\r\n /** @internal */\r\n public _linearSpecularLOD: boolean = false;\r\n /** @internal */\r\n public _irradianceTexture: Nullable<BaseTexture> = null;\r\n\r\n /** @internal */\r\n public _hardwareTexture: Nullable<HardwareTextureWrapper> = null;\r\n\r\n /** @internal */\r\n public _maxLodLevel: Nullable<number> = null;\r\n\r\n /** @internal */\r\n public _references: number = 1;\r\n\r\n /** @internal */\r\n public _gammaSpace: Nullable<boolean> = null;\r\n\r\n /** @internal */\r\n public _premulAlpha = false;\r\n\r\n /** @internal */\r\n public _dynamicTextureSource: Nullable<ImageSource> = null;\r\n\r\n private _engine: AbstractEngine;\r\n private _uniqueId: number;\r\n\r\n /** @internal */\r\n public static _Counter = 0;\r\n\r\n /** Gets the unique id of the internal texture */\r\n public get uniqueId() {\r\n return this._uniqueId;\r\n }\r\n\r\n /** @internal */\r\n public _setUniqueId(id: number) {\r\n this._uniqueId = id;\r\n }\r\n\r\n /**\r\n * Gets the Engine the texture belongs to.\r\n * @returns The babylon engine\r\n */\r\n public getEngine(): AbstractEngine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the data source type of the texture\r\n */\r\n public get source(): InternalTextureSource {\r\n return this._source;\r\n }\r\n\r\n /**\r\n * Creates a new InternalTexture\r\n * @param engine defines the engine to use\r\n * @param source defines the type of data that will be used\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n constructor(engine: AbstractEngine, source: InternalTextureSource, delayAllocation = false) {\r\n super();\r\n\r\n this._engine = engine;\r\n this._source = source;\r\n this._uniqueId = InternalTexture._Counter++;\r\n\r\n if (!delayAllocation) {\r\n this._hardwareTexture = engine._createHardwareTexture();\r\n }\r\n }\r\n\r\n /**\r\n * Increments the number of references (ie. the number of Texture that point to it)\r\n */\r\n public incrementReferences(): void {\r\n this._references++;\r\n }\r\n\r\n /**\r\n * Change the size of the texture (not the size of the content)\r\n * @param width defines the new width\r\n * @param height defines the new height\r\n * @param depth defines the new depth (1 by default)\r\n */\r\n public updateSize(width: int, height: int, depth: int = 1): void {\r\n this._engine.updateTextureDimensions(this, width, height, depth);\r\n\r\n this.width = width;\r\n this.height = height;\r\n this.depth = depth;\r\n\r\n this.baseWidth = width;\r\n this.baseHeight = height;\r\n this.baseDepth = depth;\r\n\r\n this._size = width * height * depth;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n this.isReady = false;\r\n this._cachedCoordinatesMode = null;\r\n this._cachedWrapU = null;\r\n this._cachedWrapV = null;\r\n this._cachedWrapR = null;\r\n this._cachedAnisotropicFilteringLevel = null;\r\n if (this.onRebuildCallback) {\r\n const data = this.onRebuildCallback(this);\r\n const swapAndSetIsReady = (proxyInternalTexture: InternalTexture) => {\r\n proxyInternalTexture._swapAndDie(this, false);\r\n this.isReady = data.isReady;\r\n };\r\n if (data.isAsync) {\r\n (data.proxy as Promise<InternalTexture>).then(swapAndSetIsReady);\r\n } else {\r\n swapAndSetIsReady(data.proxy as InternalTexture);\r\n }\r\n return;\r\n }\r\n\r\n let proxy: InternalTexture;\r\n switch (this.source) {\r\n case InternalTextureSource.Temp:\r\n break;\r\n\r\n case InternalTextureSource.Url:\r\n proxy = this._engine.createTexture(\r\n this._originalUrl ?? this.url,\r\n !this.generateMipMaps,\r\n this.invertY,\r\n null,\r\n this.samplingMode,\r\n // Do not use Proxy here as it could be fully synchronous\r\n // and proxy would be undefined.\r\n (temp) => {\r\n temp._swapAndDie(this, false);\r\n this.isReady = true;\r\n },\r\n null,\r\n this._buffer,\r\n undefined,\r\n this.format,\r\n this._extension,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this._useSRGBBuffer\r\n );\r\n return;\r\n\r\n case InternalTextureSource.Raw:\r\n proxy = this._engine.createRawTexture(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type,\r\n this._creationFlags,\r\n this._useSRGBBuffer\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Raw3D:\r\n proxy = this._engine.createRawTexture3D(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.baseDepth,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Raw2DArray:\r\n proxy = this._engine.createRawTexture2DArray(\r\n this._bufferView,\r\n this.baseWidth,\r\n this.baseHeight,\r\n this.baseDepth,\r\n this.format,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression,\r\n this.type\r\n );\r\n proxy._swapAndDie(this, false);\r\n\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.Dynamic:\r\n proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);\r\n proxy._swapAndDie(this, false);\r\n if (this._dynamicTextureSource) {\r\n this._engine.updateDynamicTexture(this, this._dynamicTextureSource, this.invertY, this._premulAlpha, this.format, true);\r\n }\r\n\r\n // The engine will make sure to update content so no need to flag it as isReady = true\r\n break;\r\n\r\n case InternalTextureSource.Cube:\r\n proxy = this._engine.createCubeTexture(\r\n this.url,\r\n null,\r\n this._files,\r\n !this.generateMipMaps,\r\n () => {\r\n proxy._swapAndDie(this, false);\r\n this.isReady = true;\r\n },\r\n null,\r\n this.format,\r\n this._extension,\r\n false,\r\n 0,\r\n 0,\r\n null,\r\n undefined,\r\n this._useSRGBBuffer,\r\n ArrayBuffer.isView(this._buffer) ? this._buffer : null\r\n );\r\n return;\r\n\r\n case InternalTextureSource.CubeRaw:\r\n proxy = this._engine.createRawCubeTexture(\r\n this._bufferViewArray!,\r\n this.width,\r\n this._originalFormat ?? this.format,\r\n this.type,\r\n this.generateMipMaps,\r\n this.invertY,\r\n this.samplingMode,\r\n this._compression\r\n );\r\n proxy._swapAndDie(this, false);\r\n this.isReady = true;\r\n break;\r\n\r\n case InternalTextureSource.CubeRawRGBD:\r\n // This case is being handeled by the environment texture tools and is not a part of the rebuild process.\r\n // To use CubeRawRGBD use updateRGBDAsync on the cube texture.\r\n return;\r\n\r\n case InternalTextureSource.CubePrefiltered:\r\n proxy = this._engine.createPrefilteredCubeTexture(\r\n this.url,\r\n null,\r\n this._lodGenerationScale,\r\n this._lodGenerationOffset,\r\n (proxy) => {\r\n if (proxy) {\r\n proxy._swapAndDie(this, false);\r\n }\r\n this.isReady = true;\r\n },\r\n null,\r\n this.format,\r\n this._extension\r\n );\r\n proxy._sphericalPolynomial = this._sphericalPolynomial;\r\n return;\r\n\r\n case InternalTextureSource.DepthStencil:\r\n case InternalTextureSource.Depth: {\r\n // Will be handled at the RenderTargetWrapper level\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _swapAndDie(target: InternalTexture, swapAll = true): void {\r\n // TODO what about refcount on target?\r\n\r\n this._hardwareTexture?.setUsage(target._source, this.generateMipMaps, this.is2DArray, this.isCube, this.is3D, this.width, this.height, this.depth);\r\n\r\n target._hardwareTexture = this._hardwareTexture;\r\n if (swapAll) {\r\n target._isRGBD = this._isRGBD;\r\n }\r\n\r\n if (this._lodTextureHigh) {\r\n if (target._lodTextureHigh) {\r\n target._lodTextureHigh.dispose();\r\n }\r\n target._lodTextureHigh = this._lodTextureHigh;\r\n }\r\n\r\n if (this._lodTextureMid) {\r\n if (target._lodTextureMid) {\r\n target._lodTextureMid.dispose();\r\n }\r\n target._lodTextureMid = this._lodTextureMid;\r\n }\r\n\r\n if (this._lodTextureLow) {\r\n if (target._lodTextureLow) {\r\n target._lodTextureLow.dispose();\r\n }\r\n target._lodTextureLow = this._lodTextureLow;\r\n }\r\n\r\n if (this._irradianceTexture) {\r\n if (target._irradianceTexture) {\r\n target._irradianceTexture.dispose();\r\n }\r\n target._irradianceTexture = this._irradianceTexture;\r\n }\r\n\r\n const cache = this._engine.getLoadedTexturesCache();\r\n let index = cache.indexOf(this);\r\n if (index !== -1) {\r\n cache.splice(index, 1);\r\n }\r\n\r\n index = cache.indexOf(target);\r\n if (index === -1) {\r\n cache.push(target);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the current allocated resources\r\n */\r\n public dispose(): void {\r\n this._references--;\r\n this.onLoadedObservable.clear();\r\n this.onErrorObservable.clear();\r\n if (this._references === 0) {\r\n this._engine._releaseTexture(this);\r\n this._hardwareTexture = null;\r\n this._dynamicTextureSource = null;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -15,7 +15,7 @@ export declare enum TranscodeTarget {
|
|
|
15
15
|
R8 = 9,
|
|
16
16
|
RG8 = 10
|
|
17
17
|
}
|
|
18
|
-
export declare enum EngineFormat {
|
|
18
|
+
export declare const enum EngineFormat {
|
|
19
19
|
COMPRESSED_RGBA_BPTC_UNORM_EXT = 36492,
|
|
20
20
|
COMPRESSED_RGBA_ASTC_4X4_KHR = 37808,
|
|
21
21
|
COMPRESSED_RGB_S3TC_DXT1_EXT = 33776,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ktx2decoderTypes.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/ktx2decoderTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC3B,+DAAK,CAAA;IACL,qEAAQ,CAAA;AACZ,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,QAG9B;AAED,MAAM,CAAN,IAAY,eAYX;AAZD,WAAY,eAAe;IACvB,uEAAa,CAAA;IACb,6DAAQ,CAAA;IACR,6DAAQ,CAAA;IACR,2DAAO,CAAA;IACP,uEAAa,CAAA;IACb,qEAAY,CAAA;IACZ,+DAAS,CAAA;IACT,6DAAQ,CAAA;IACR,yDAAM,CAAA;IACN,iDAAE,CAAA;IACF,oDAAG,CAAA;AACP,CAAC,EAZW,eAAe,KAAf,eAAe,QAY1B;AAED,MAAM,CAAN,
|
|
1
|
+
{"version":3,"file":"ktx2decoderTypes.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/ktx2decoderTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC3B,+DAAK,CAAA;IACL,qEAAQ,CAAA;AACZ,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,QAG9B;AAED,MAAM,CAAN,IAAY,eAYX;AAZD,WAAY,eAAe;IACvB,uEAAa,CAAA;IACb,6DAAQ,CAAA;IACR,6DAAQ,CAAA;IACR,2DAAO,CAAA;IACP,uEAAa,CAAA;IACb,qEAAY,CAAA;IACZ,+DAAS,CAAA;IACT,6DAAQ,CAAA;IACR,yDAAM,CAAA;IACN,iDAAE,CAAA;IACF,oDAAG,CAAA;AACP,CAAC,EAZW,eAAe,KAAf,eAAe,QAY1B;AAED,MAAM,CAAN,IAAkB,YAajB;AAbD,WAAkB,YAAY;IAC1B,uGAAuC,CAAA;IACvC,mGAAqC,CAAA;IACrC,mGAAqC,CAAA;IACrC,qGAAsC,CAAA;IACtC,2GAAyC,CAAA;IACzC,yGAAwC,CAAA;IACxC,6FAAkC,CAAA;IAClC,mFAA6B,CAAA;IAC7B,6FAAkC,CAAA;IAClC,iEAAoB,CAAA;IACpB,2DAAiB,CAAA;IACjB,6DAAkB,CAAA;AACtB,CAAC,EAbiB,YAAY,KAAZ,YAAY,QAa7B","sourcesContent":["export enum SourceTextureFormat {\r\n ETC1S,\r\n UASTC4x4,\r\n}\r\n\r\nexport enum TranscodeTarget {\r\n ASTC_4X4_RGBA,\r\n BC7_RGBA,\r\n BC3_RGBA,\r\n BC1_RGB,\r\n PVRTC1_4_RGBA,\r\n PVRTC1_4_RGB,\r\n ETC2_RGBA,\r\n ETC1_RGB,\r\n RGBA32,\r\n R8,\r\n RG8,\r\n}\r\n\r\nexport const enum EngineFormat {\r\n COMPRESSED_RGBA_BPTC_UNORM_EXT = 0x8e8c,\r\n COMPRESSED_RGBA_ASTC_4X4_KHR = 0x93b0,\r\n COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83f0,\r\n COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83f3,\r\n COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8c02,\r\n COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8c00,\r\n COMPRESSED_RGBA8_ETC2_EAC = 0x9278,\r\n COMPRESSED_RGB8_ETC2 = 0x9274,\r\n COMPRESSED_RGB_ETC1_WEBGL = 0x8d64,\r\n RGBA8Format = 0x8058,\r\n R8Format = 0x8229,\r\n RG8Format = 0x822b,\r\n}\r\n\r\n/**\r\n * Leaf node of a decision tree\r\n * It defines the transcoding format to use to transcode the texture as well as the corresponding format to use at the engine level when creating the texture\r\n */\r\nexport interface ILeaf {\r\n /**\r\n * The format to transcode to\r\n */\r\n transcodeFormat: TranscodeTarget;\r\n\r\n /**\r\n * The format to use when creating the texture at the engine level after it has been transcoded to transcodeFormat\r\n */\r\n engineFormat: EngineFormat;\r\n\r\n /**\r\n * Whether the texture must be rounded to a multiple of 4 (should normally be the case for all compressed formats). Default: true\r\n */\r\n roundToMultiple4?: boolean;\r\n}\r\n\r\n/**\r\n * Regular node of a decision tree\r\n *\r\n * Each property (except for \"yes\" and \"no\"), if not empty, will be checked in order to determine the next node to select.\r\n * If all checks are successful, the \"yes\" node will be selected, else the \"no\" node will be selected.\r\n */\r\nexport interface INode {\r\n /**\r\n * The name of the capability to check. Can be one of the following:\r\n * astc\r\n * bptc\r\n * s3tc\r\n * pvrtc\r\n * etc2\r\n * etc1\r\n */\r\n cap?: string;\r\n\r\n /**\r\n * The name of the option to check from the options object passed to the KTX2 decode function. {@link IKTX2DecoderOptions}\r\n */\r\n option?: string;\r\n\r\n /**\r\n * Checks if alpha is present in the texture\r\n */\r\n alpha?: boolean;\r\n\r\n /**\r\n * Checks the currently selected transcoding format.\r\n */\r\n transcodeFormat?: TranscodeTarget | TranscodeTarget[];\r\n\r\n /**\r\n * Checks that the texture is a power of two\r\n */\r\n needsPowerOfTwo?: boolean;\r\n\r\n /**\r\n * The node to select if all checks are successful\r\n */\r\n yes?: INode | ILeaf;\r\n\r\n /**\r\n * The node to select if at least one check is not successful\r\n */\r\n no?: INode | ILeaf;\r\n}\r\n\r\n/**\r\n * Decision tree used to determine the transcoding format to use for a given source texture format\r\n */\r\nexport interface IDecisionTree {\r\n /**\r\n * textureFormat can be either UASTC or ETC1S\r\n */\r\n [textureFormat: string]: INode;\r\n}\r\n\r\n/**\r\n * Result of the KTX2 decode function\r\n */\r\nexport interface IDecodedData {\r\n /**\r\n * Width of the texture\r\n */\r\n width: number;\r\n\r\n /**\r\n * Height of the texture\r\n */\r\n height: number;\r\n\r\n /**\r\n * The format to use when creating the texture at the engine level\r\n * This corresponds to the engineFormat property of the leaf node of the decision tree\r\n */\r\n transcodedFormat: number;\r\n\r\n /**\r\n * List of mipmap levels.\r\n * The first element is the base level, the last element is the smallest mipmap level (if more than one mipmap level is present)\r\n */\r\n mipmaps: Array<IMipmap>;\r\n\r\n /**\r\n * Whether the texture data is in gamma space or not\r\n */\r\n isInGammaSpace: boolean;\r\n\r\n /**\r\n * Whether the texture has an alpha channel or not\r\n */\r\n hasAlpha: boolean;\r\n\r\n /**\r\n * The name of the transcoder used to transcode the texture\r\n */\r\n transcoderName: string;\r\n\r\n /**\r\n * The errors (if any) encountered during the decoding process\r\n */\r\n errors?: string;\r\n}\r\n\r\n/**\r\n * Defines a mipmap level\r\n */\r\nexport interface IMipmap {\r\n /**\r\n * The data of the mipmap level\r\n */\r\n data: Uint8Array | null;\r\n\r\n /**\r\n * The width of the mipmap level\r\n */\r\n width: number;\r\n\r\n /**\r\n * The height of the mipmap level\r\n */\r\n height: number;\r\n}\r\n\r\n/**\r\n * The compressed texture formats supported by the browser\r\n */\r\nexport interface ICompressedFormatCapabilities {\r\n /**\r\n * Whether the browser supports ASTC\r\n */\r\n astc?: boolean;\r\n\r\n /**\r\n * Whether the browser supports BPTC\r\n */\r\n bptc?: boolean;\r\n\r\n /**\r\n * Whether the browser supports S3TC\r\n */\r\n s3tc?: boolean;\r\n\r\n /**\r\n * Whether the browser supports PVRTC\r\n */\r\n pvrtc?: boolean;\r\n\r\n /**\r\n * Whether the browser supports ETC2\r\n */\r\n etc2?: boolean;\r\n\r\n /**\r\n * Whether the browser supports ETC1\r\n */\r\n etc1?: boolean;\r\n}\r\n\r\n/**\r\n * Options passed to the KTX2 decode function\r\n */\r\nexport interface IKTX2DecoderOptions {\r\n /** use RGBA format if ASTC and BC7 are not available as transcoded format */\r\n useRGBAIfASTCBC7NotAvailableWhenUASTC?: boolean;\r\n\r\n /** force to always use (uncompressed) RGBA for transcoded format */\r\n forceRGBA?: boolean;\r\n\r\n /** force to always use (uncompressed) R8 for transcoded format */\r\n forceR8?: boolean;\r\n\r\n /** force to always use (uncompressed) RG8 for transcoded format */\r\n forceRG8?: boolean;\r\n\r\n /**\r\n * list of transcoders to bypass when looking for a suitable transcoder. The available transcoders are:\r\n * UniversalTranscoder_UASTC_ASTC\r\n * UniversalTranscoder_UASTC_BC7\r\n * UniversalTranscoder_UASTC_RGBA_UNORM\r\n * UniversalTranscoder_UASTC_RGBA_SRGB\r\n * UniversalTranscoder_UASTC_R8_UNORM\r\n * UniversalTranscoder_UASTC_RG8_UNORM\r\n * MSCTranscoder\r\n */\r\n bypassTranscoders?: string[];\r\n\r\n /**\r\n * Custom decision tree to apply after the default decision tree has selected a transcoding format.\r\n * Allows the user to override the default decision tree selection.\r\n * The decision tree can use the INode.transcodeFormat property to base its decision on the transcoding format selected by the default decision tree.\r\n */\r\n transcodeFormatDecisionTree?: IDecisionTree;\r\n}\r\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SerializationHelper } from "../../Misc/decorators.serialization.js";
|
|
2
2
|
import { _UpdateRGBDAsync as UpdateRGBDAsyncEnvTools } from "../../Misc/environmentTextureTools.js";
|
|
3
|
-
import { InternalTextureSource } from "./internalTexture.js";
|
|
4
3
|
import { CubeTexture } from "./cubeTexture.js";
|
|
5
4
|
|
|
6
5
|
import "../../Engines/Extensions/engine.rawTexture.js";
|
|
@@ -55,7 +54,7 @@ export class RawCubeTexture extends CubeTexture {
|
|
|
55
54
|
const scene = this.getScene();
|
|
56
55
|
const internalTexture = this._texture;
|
|
57
56
|
const texture = new RawCubeTexture(scene, internalTexture._bufferViewArray, internalTexture.width, internalTexture.format, internalTexture.type, internalTexture.generateMipMaps, internalTexture.invertY, internalTexture.samplingMode, internalTexture._compression);
|
|
58
|
-
if (internalTexture.source === InternalTextureSource.CubeRawRGBD) {
|
|
57
|
+
if (internalTexture.source === 13 /* InternalTextureSource.CubeRawRGBD */) {
|
|
59
58
|
texture.updateRGBDAsync(internalTexture._bufferViewArrayArray, internalTexture._sphericalPolynomial, internalTexture._lodGenerationScale, internalTexture._lodGenerationOffset);
|
|
60
59
|
}
|
|
61
60
|
return texture;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rawCubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/rawCubeTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,IAAI,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"rawCubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/rawCubeTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,IAAI,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAKjG,OAAO,EAAE,WAA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E;YAClC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAG,CAAC;YAC/B,MAAM,eAAe,GAAG,IAAI,CAAC,QAAS,CAAC;YAEvC,MAAM,OAAO,GAAG,IAAI,cAAc,CAC9B,KAAK,EACL,eAAe,CAAC,gBAAiB,EACjC,eAAe,CAAC,KAAK,EACrB,eAAe,CAAC,MAAM,EACtB,eAAe,CAAC,IAAI,EACpB,eAAe,CAAC,eAAe,EAC/B,eAAe,CAAC,OAAO,EACvB,eAAe,CAAC,YAAY,EAC5B,eAAe,CAAC,YAAY,CAC/B,CAAC;YAEF,IAAI,eAAe,CAAC,MAAM,+CAAsC,EAAE;gBAC9D,OAAO,CAAC,eAAe,CACnB,eAAe,CAAC,qBAAsB,EACtC,eAAe,CAAC,oBAAoB,EACpC,eAAe,CAAC,mBAAmB,EACnC,eAAe,CAAC,oBAAoB,CACvC,CAAC;aACL;YAED,OAAO,OAAO,CAAC;QACnB,CAAC,EAAE,IAAI,CAAC,CAAC;IACb,CAAC;CACJ","sourcesContent":["import { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { _UpdateRGBDAsync as UpdateRGBDAsyncEnvTools } from \"../../Misc/environmentTextureTools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { SphericalPolynomial } from \"../../Maths/sphericalPolynomial\";\r\nimport { InternalTextureSource } from \"./internalTexture\";\r\nimport { CubeTexture } from \"./cubeTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport \"../../Engines/Extensions/engine.rawTexture\";\r\nimport type { Engine } from \"../../Engines/engine\";\r\n\r\n/**\r\n * Raw cube texture where the raw buffers are passed in\r\n */\r\nexport class RawCubeTexture extends CubeTexture {\r\n /**\r\n * Creates a cube texture where the raw buffers are passed in.\r\n * @param scene defines the scene the texture is attached to\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n */\r\n constructor(\r\n scene: Scene,\r\n data: Nullable<ArrayBufferView[]>,\r\n size: number,\r\n format: number = Constants.TEXTUREFORMAT_RGBA,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n generateMipMaps: boolean = false,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n compression: Nullable<string> = null\r\n ) {\r\n super(\"\", scene);\r\n\r\n this._texture = scene.getEngine().createRawCubeTexture(data, size, format, type, generateMipMaps, invertY, samplingMode, compression);\r\n }\r\n\r\n /**\r\n * Updates the raw cube texture.\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n */\r\n public update(data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string> = null): void {\r\n (this._texture!.getEngine() as Engine).updateRawCubeTexture(this._texture!, data, format, type, invertY, compression);\r\n }\r\n\r\n /**\r\n * Updates a raw cube texture with RGBD encoded data.\r\n * @param data defines the array of data [mipmap][face] to use to create each face\r\n * @param sphericalPolynomial defines the spherical polynomial for irradiance\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @returns a promise that resolves when the operation is complete\r\n */\r\n public updateRGBDAsync(data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial> = null, lodScale: number = 0.8, lodOffset: number = 0): Promise<void> {\r\n return UpdateRGBDAsyncEnvTools(this._texture!, data, sphericalPolynomial, lodScale, lodOffset).then(() => {});\r\n }\r\n\r\n /**\r\n * Clones the raw cube texture.\r\n * @returns a new cube texture\r\n */\r\n public override clone(): CubeTexture {\r\n return SerializationHelper.Clone(() => {\r\n const scene = this.getScene()!;\r\n const internalTexture = this._texture!;\r\n\r\n const texture = new RawCubeTexture(\r\n scene,\r\n internalTexture._bufferViewArray!,\r\n internalTexture.width,\r\n internalTexture.format,\r\n internalTexture.type,\r\n internalTexture.generateMipMaps,\r\n internalTexture.invertY,\r\n internalTexture.samplingMode,\r\n internalTexture._compression\r\n );\r\n\r\n if (internalTexture.source === InternalTextureSource.CubeRawRGBD) {\r\n texture.updateRGBDAsync(\r\n internalTexture._bufferViewArrayArray!,\r\n internalTexture._sphericalPolynomial,\r\n internalTexture._lodGenerationScale,\r\n internalTexture._lodGenerationOffset\r\n );\r\n }\r\n\r\n return texture;\r\n }, this);\r\n }\r\n}\r\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { GetDOMTextContent, IsWindowObjectExist } from "../Misc/domManagement.js";
|
|
2
|
-
import { ShaderLanguage } from "./shaderLanguage.js";
|
|
3
2
|
import { getStateObject } from "../Engines/thinEngine.functions.js";
|
|
4
3
|
import { ShaderStore } from "../Engines/shaderStore.js";
|
|
5
4
|
import { Logger } from "../Misc/logger.js";
|
|
@@ -150,8 +149,8 @@ function _useFinalCode(migratedVertexCode, migratedFragmentCode, baseName, shade
|
|
|
150
149
|
const vertex = baseName.vertexElement || baseName.vertex || baseName.spectorName || baseName;
|
|
151
150
|
const fragment = baseName.fragmentElement || baseName.fragment || baseName.spectorName || baseName;
|
|
152
151
|
return {
|
|
153
|
-
vertexSourceCode: (shaderLanguage === ShaderLanguage.WGSL ? "//" : "") + "#define SHADER_NAME vertex:" + vertex + "\n" + migratedVertexCode,
|
|
154
|
-
fragmentSourceCode: (shaderLanguage === ShaderLanguage.WGSL ? "//" : "") + "#define SHADER_NAME fragment:" + fragment + "\n" + migratedFragmentCode,
|
|
152
|
+
vertexSourceCode: (shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? "//" : "") + "#define SHADER_NAME vertex:" + vertex + "\n" + migratedVertexCode,
|
|
153
|
+
fragmentSourceCode: (shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? "//" : "") + "#define SHADER_NAME fragment:" + fragment + "\n" + migratedFragmentCode,
|
|
155
154
|
};
|
|
156
155
|
}
|
|
157
156
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effect.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/effect.functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,iCAAgC;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,2CAA0C;AACnE,OAAO,EAAE,WAAW,EAAE,kCAAiC;AAIvD,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAC1C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,iDAAgD;AACxF,OAAO,EAAE,SAAS,EAAE,+CAA8C;AAoElE;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,OAAqB;IACjE,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAA0B;IAC1D,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC;IAC5B,MAAM,OAAO,GAAI,QAAiC,CAAC,OAAO,CAAC;IAC3D,IAAI,IAAI,IAAI,OAAO,EAAE;QACjB,MAAM,WAAW,GAAG,cAAc,CAAC,OAAQ,CAAC,CAAC;QAC7C,MAAM,cAAc,GAAG,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACzD,cAAc,EAAE,OAAO,EAAE,CAAC;Q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AAC;QAEF,oCAAoC,CAAC,eAAe,EAAE,GAAG,EAAE;YACvD,OAAO,CAAC,wBAAwB,EAAE,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,OAAO,eAAe,CAAC;KAC1B;IAAC,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QACvC,MAAM,CAAC,CAAC;KACX;AACL,CAAC,CAAC","sourcesContent":["import type { ProcessingOptions, ShaderCustomProcessingFunction, ShaderProcessingContext } from \"core/Engines/Processors/shaderProcessingOptions\";\r\nimport { GetDOMTextContent, IsWindowObjectExist } from \"core/Misc/domManagement\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { ShaderLanguage } from \"./shaderLanguage\";\r\nimport type { WebGLContext } from \"core/Engines/thinEngine.functions\";\r\nimport { getStateObject } from \"core/Engines/thinEngine.functions\";\r\nimport { ShaderStore } from \"core/Engines/shaderStore\";\r\nimport type { AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport type { Effect, IShaderPath } from \"./effect\";\r\nimport type { IPipelineContext } from \"core/Engines/IPipelineContext\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { Finalize, Initialize, Process } from \"core/Engines/Processors/shaderProcessor\";\r\nimport { _loadFile } from \"core/Engines/abstractEngine.functions\";\r\nimport type { WebGLPipelineContext } from \"core/Engines/WebGL/webGLPipelineContext\";\r\n\r\n/**\r\n * Options to be used when creating a pipeline\r\n */\r\nexport interface IPipelineGenerationOptions {\r\n /**\r\n * The definition of the shader content.\r\n * Can be either a unified name, name per vertex and frament or the shader code content itself\r\n */\r\n shaderNameOrContent: string | IShaderPath;\r\n /**\r\n * Unique key to identify the pipeline.\r\n * Note that though not mandatory, it's recommended to provide a key to be able to use the automated pipeline loading system.\r\n */\r\n key?: string;\r\n /**\r\n * The list of defines to be used in the shader\r\n */\r\n defines?: string[];\r\n\r\n /**\r\n * If true, the global defines will be added to the defines array\r\n */\r\n addGlobalDefines?: boolean;\r\n /**\r\n * The shader language.\r\n * Defaults to the language suiting the platform name (GLSL for WEBGL2, WGSL for WEBGPU)\r\n */\r\n shaderLanguage?: ShaderLanguage;\r\n\r\n /**\r\n * The name of the platform to be used when processing the shader\r\n * defaults to WEBGL2\r\n */\r\n platformName?: string /* \"WEBGL2\" | \"WEBGL1\" | \"WEBGPU\" */;\r\n\r\n /**\r\n * extend the processing options when running code processing\r\n */\r\n extendedProcessingOptions?: Partial<ProcessingOptions>;\r\n\r\n /**\r\n * extend the pipeline generation options\r\n */\r\n extendedCreatePipelineOptions?: Partial<ICreateAndPreparePipelineContextOptions>;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface ICreateAndPreparePipelineContextOptions {\r\n parallelShaderCompile?: { COMPLETION_STATUS_KHR: number };\r\n shaderProcessingContext: Nullable<ShaderProcessingContext>;\r\n existingPipelineContext?: Nullable<IPipelineContext>;\r\n name?: string;\r\n rebuildRebind?: (vertexSourceCode: string, fragmentSourceCode: string, onCompiled: (pipelineContext: IPipelineContext) => void, onError: (message: string) => void) => void;\r\n onRenderingStateCompiled?: (pipelineContext?: IPipelineContext) => void;\r\n context?: WebGL2RenderingContext | WebGLRenderingContext;\r\n // preparePipeline options\r\n createAsRaw?: boolean;\r\n vertex: string;\r\n fragment: string;\r\n defines: Nullable<string>;\r\n transformFeedbackVaryings: Nullable<string[]>;\r\n}\r\n\r\n/**\r\n * Get a cached pipeline context\r\n * @param name the pipeline name\r\n * @param context the context to be used when creating the pipeline\r\n * @returns the cached pipeline context if it exists\r\n * @internal\r\n */\r\nexport function getCachedPipeline(name: string, context: WebGLContext): IPipelineContext | undefined {\r\n const stateObject = getStateObject(context);\r\n return stateObject.cachedPipelines[name];\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function resetCachedPipeline(pipeline: IPipelineContext): void {\r\n const name = pipeline._name;\r\n const context = (pipeline as WebGLPipelineContext).context;\r\n if (name && context) {\r\n const stateObject = getStateObject(context!);\r\n const cachedPipeline = stateObject.cachedPipelines[name];\r\n cachedPipeline?.dispose();\r\n delete stateObject.cachedPipelines[name];\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function _processShaderCode(\r\n processorOptions: ProcessingOptions,\r\n baseName: any,\r\n processFinalCode?: Nullable<ShaderCustomProcessingFunction>,\r\n onFinalCodeReady?: (vertexCode: string, fragmentCode: string) => void,\r\n shaderLanguage?: ShaderLanguage,\r\n engine?: AbstractEngine,\r\n effectContext?: Effect\r\n) {\r\n let vertexSource: string | HTMLElement | IShaderPath;\r\n let fragmentSource: string | HTMLElement | IShaderPath;\r\n\r\n // const baseName = this.name;\r\n const hostDocument = IsWindowObjectExist() ? engine?.getHostDocument() : null;\r\n\r\n if (typeof baseName === \"string\") {\r\n vertexSource = baseName;\r\n } else if (baseName.vertexSource) {\r\n vertexSource = \"source:\" + baseName.vertexSource;\r\n } else if (baseName.vertexElement) {\r\n vertexSource = hostDocument?.getElementById(baseName.vertexElement) || baseName.vertexElement;\r\n } else {\r\n vertexSource = baseName.vertex || baseName;\r\n }\r\n if (typeof baseName === \"string\") {\r\n fragmentSource = baseName;\r\n } else if (baseName.fragmentSource) {\r\n fragmentSource = \"source:\" + baseName.fragmentSource;\r\n } else if (baseName.fragmentElement) {\r\n fragmentSource = hostDocument?.getElementById(baseName.fragmentElement) || baseName.fragmentElement;\r\n } else {\r\n fragmentSource = baseName.fragment || baseName;\r\n }\r\n\r\n const shaderCodes: [string | undefined, string | undefined] = [undefined, undefined];\r\n const shadersLoaded = () => {\r\n if (shaderCodes[0] && shaderCodes[1]) {\r\n processorOptions.isFragment = true;\r\n const [migratedVertexCode, fragmentCode] = shaderCodes;\r\n Process(\r\n fragmentCode,\r\n processorOptions,\r\n (migratedFragmentCode, codeBeforeMigration) => {\r\n if (effectContext) {\r\n effectContext._fragmentSourceCodeBeforeMigration = codeBeforeMigration;\r\n }\r\n if (processFinalCode) {\r\n migratedFragmentCode = processFinalCode(\"fragment\", migratedFragmentCode);\r\n }\r\n const finalShaders = Finalize(migratedVertexCode, migratedFragmentCode, processorOptions);\r\n processorOptions = null as any;\r\n const finalCode = _useFinalCode(finalShaders.vertexCode, finalShaders.fragmentCode, baseName, shaderLanguage);\r\n onFinalCodeReady?.(finalCode.vertexSourceCode, finalCode.fragmentSourceCode);\r\n },\r\n engine\r\n );\r\n }\r\n };\r\n _loadShader(\r\n vertexSource,\r\n \"Vertex\",\r\n \"\",\r\n (vertexCode) => {\r\n Initialize(processorOptions);\r\n Process(\r\n vertexCode,\r\n processorOptions,\r\n (migratedVertexCode, codeBeforeMigration) => {\r\n if (effectContext) {\r\n effectContext._rawVertexSourceCode = vertexCode;\r\n effectContext._vertexSourceCodeBeforeMigration = codeBeforeMigration;\r\n }\r\n if (processFinalCode) {\r\n migratedVertexCode = processFinalCode(\"vertex\", migratedVertexCode);\r\n }\r\n shaderCodes[0] = migratedVertexCode;\r\n shadersLoaded();\r\n },\r\n engine\r\n );\r\n },\r\n shaderLanguage\r\n );\r\n _loadShader(\r\n fragmentSource,\r\n \"Fragment\",\r\n \"Pixel\",\r\n (fragmentCode) => {\r\n if (effectContext) {\r\n effectContext._rawFragmentSourceCode = fragmentCode;\r\n }\r\n shaderCodes[1] = fragmentCode;\r\n shadersLoaded();\r\n },\r\n shaderLanguage\r\n );\r\n}\r\n\r\nfunction _loadShader(shader: any, key: string, optionalKey: string, callback: (data: any) => void, shaderLanguage?: ShaderLanguage, _loadFileInjection?: typeof _loadFile) {\r\n if (typeof HTMLElement !== \"undefined\") {\r\n // DOM element ?\r\n if (shader instanceof HTMLElement) {\r\n const shaderCode = GetDOMTextContent(shader);\r\n callback(shaderCode);\r\n return;\r\n }\r\n }\r\n\r\n // Direct source ?\r\n if (shader.substr(0, 7) === \"source:\") {\r\n callback(shader.substr(7));\r\n return;\r\n }\r\n\r\n // Base64 encoded ?\r\n if (shader.substr(0, 7) === \"base64:\") {\r\n const shaderBinary = window.atob(shader.substr(7));\r\n callback(shaderBinary);\r\n return;\r\n }\r\n\r\n const shaderStore = ShaderStore.GetShadersStore(shaderLanguage);\r\n\r\n // Is in local store ?\r\n if (shaderStore[shader + key + \"Shader\"]) {\r\n callback(shaderStore[shader + key + \"Shader\"]);\r\n return;\r\n }\r\n\r\n if (optionalKey && shaderStore[shader + optionalKey + \"Shader\"]) {\r\n callback(shaderStore[shader + optionalKey + \"Shader\"]);\r\n return;\r\n }\r\n\r\n let shaderUrl;\r\n\r\n if (shader[0] === \".\" || shader[0] === \"/\" || shader.indexOf(\"http\") > -1) {\r\n shaderUrl = shader;\r\n } else {\r\n shaderUrl = ShaderStore.GetShadersRepository(shaderLanguage) + shader;\r\n }\r\n _loadFileInjection = _loadFileInjection || _loadFile;\r\n if (!_loadFileInjection) {\r\n // we got to this point and loadFile was not injected - throw an error\r\n throw new Error(\"loadFileInjection is not defined\");\r\n }\r\n // Vertex shader\r\n _loadFileInjection(shaderUrl + \".\" + key.toLowerCase() + \".fx\", callback);\r\n}\r\n\r\nfunction _useFinalCode(migratedVertexCode: string, migratedFragmentCode: string, baseName: any, shaderLanguage?: ShaderLanguage) {\r\n if (baseName) {\r\n const vertex = baseName.vertexElement || baseName.vertex || baseName.spectorName || baseName;\r\n const fragment = baseName.fragmentElement || baseName.fragment || baseName.spectorName || baseName;\r\n\r\n return {\r\n vertexSourceCode: (shaderLanguage === ShaderLanguage.WGSL ? \"//\" : \"\") + \"#define SHADER_NAME vertex:\" + vertex + \"\\n\" + migratedVertexCode,\r\n fragmentSourceCode: (shaderLanguage === ShaderLanguage.WGSL ? \"//\" : \"\") + \"#define SHADER_NAME fragment:\" + fragment + \"\\n\" + migratedFragmentCode,\r\n };\r\n } else {\r\n return {\r\n vertexSourceCode: migratedVertexCode,\r\n fragmentSourceCode: migratedFragmentCode,\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Creates and prepares a pipeline context\r\n * @internal\r\n */\r\nexport const createAndPreparePipelineContext = (\r\n options: ICreateAndPreparePipelineContextOptions,\r\n createPipelineContext: typeof AbstractEngine.prototype.createPipelineContext,\r\n _preparePipelineContext: typeof AbstractEngine.prototype._preparePipelineContext,\r\n _executeWhenRenderingStateIsCompiled: typeof AbstractEngine.prototype._executeWhenRenderingStateIsCompiled\r\n) => {\r\n try {\r\n const pipelineContext: IPipelineContext = options.existingPipelineContext || createPipelineContext(options.shaderProcessingContext);\r\n pipelineContext._name = options.name;\r\n if (options.name && options.context) {\r\n const stateObject = getStateObject(options.context);\r\n stateObject.cachedPipelines[options.name] = pipelineContext;\r\n }\r\n\r\n _preparePipelineContext(\r\n pipelineContext,\r\n options.vertex,\r\n options.fragment,\r\n !!options.createAsRaw,\r\n \"\",\r\n \"\",\r\n options.rebuildRebind,\r\n options.defines,\r\n options.transformFeedbackVaryings,\r\n \"\"\r\n );\r\n\r\n _executeWhenRenderingStateIsCompiled(pipelineContext, () => {\r\n options.onRenderingStateCompiled?.(pipelineContext);\r\n });\r\n\r\n return pipelineContext;\r\n } catch (e) {\r\n Logger.Error(\"Error compiling effect\");\r\n throw e;\r\n }\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"effect.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/effect.functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,iCAAgC;AAIjF,OAAO,EAAE,cAAc,EAAE,2CAA0C;AACnE,OAAO,EAAE,WAAW,EAAE,kCAAiC;AAIvD,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAC1C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,iDAAgD;AACxF,OAAO,EAAE,SAAS,EAAE,+CAA8C;AAoElE;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,OAAqB;IACjE,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM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,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC;SAC/D;QAED,uBAAuB,CACnB,eAAe,EACf,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,QAAQ,EAChB,CAAC,CAAC,OAAO,CAAC,WAAW,EACrB,EAAE,EACF,EAAE,EACF,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,yBAAyB,EACjC,EAAE,CACL,CAAC;QAEF,oCAAoC,CAAC,eAAe,EAAE,GAAG,EAAE;YACvD,OAAO,CAAC,wBAAwB,EAAE,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,OAAO,eAAe,CAAC;KAC1B;IAAC,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QACvC,MAAM,CAAC,CAAC;KACX;AACL,CAAC,CAAC","sourcesContent":["import type { ProcessingOptions, ShaderCustomProcessingFunction, ShaderProcessingContext } from \"core/Engines/Processors/shaderProcessingOptions\";\r\nimport { GetDOMTextContent, IsWindowObjectExist } from \"core/Misc/domManagement\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { ShaderLanguage } from \"./shaderLanguage\";\r\nimport type { WebGLContext } from \"core/Engines/thinEngine.functions\";\r\nimport { getStateObject } from \"core/Engines/thinEngine.functions\";\r\nimport { ShaderStore } from \"core/Engines/shaderStore\";\r\nimport type { AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport type { Effect, IShaderPath } from \"./effect\";\r\nimport type { IPipelineContext } from \"core/Engines/IPipelineContext\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { Finalize, Initialize, Process } from \"core/Engines/Processors/shaderProcessor\";\r\nimport { _loadFile } from \"core/Engines/abstractEngine.functions\";\r\nimport type { WebGLPipelineContext } from \"core/Engines/WebGL/webGLPipelineContext\";\r\n\r\n/**\r\n * Options to be used when creating a pipeline\r\n */\r\nexport interface IPipelineGenerationOptions {\r\n /**\r\n * The definition of the shader content.\r\n * Can be either a unified name, name per vertex and frament or the shader code content itself\r\n */\r\n shaderNameOrContent: string | IShaderPath;\r\n /**\r\n * Unique key to identify the pipeline.\r\n * Note that though not mandatory, it's recommended to provide a key to be able to use the automated pipeline loading system.\r\n */\r\n key?: string;\r\n /**\r\n * The list of defines to be used in the shader\r\n */\r\n defines?: string[];\r\n\r\n /**\r\n * If true, the global defines will be added to the defines array\r\n */\r\n addGlobalDefines?: boolean;\r\n /**\r\n * The shader language.\r\n * Defaults to the language suiting the platform name (GLSL for WEBGL2, WGSL for WEBGPU)\r\n */\r\n shaderLanguage?: ShaderLanguage;\r\n\r\n /**\r\n * The name of the platform to be used when processing the shader\r\n * defaults to WEBGL2\r\n */\r\n platformName?: string /* \"WEBGL2\" | \"WEBGL1\" | \"WEBGPU\" */;\r\n\r\n /**\r\n * extend the processing options when running code processing\r\n */\r\n extendedProcessingOptions?: Partial<ProcessingOptions>;\r\n\r\n /**\r\n * extend the pipeline generation options\r\n */\r\n extendedCreatePipelineOptions?: Partial<ICreateAndPreparePipelineContextOptions>;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface ICreateAndPreparePipelineContextOptions {\r\n parallelShaderCompile?: { COMPLETION_STATUS_KHR: number };\r\n shaderProcessingContext: Nullable<ShaderProcessingContext>;\r\n existingPipelineContext?: Nullable<IPipelineContext>;\r\n name?: string;\r\n rebuildRebind?: (vertexSourceCode: string, fragmentSourceCode: string, onCompiled: (pipelineContext: IPipelineContext) => void, onError: (message: string) => void) => void;\r\n onRenderingStateCompiled?: (pipelineContext?: IPipelineContext) => void;\r\n context?: WebGL2RenderingContext | WebGLRenderingContext;\r\n // preparePipeline options\r\n createAsRaw?: boolean;\r\n vertex: string;\r\n fragment: string;\r\n defines: Nullable<string>;\r\n transformFeedbackVaryings: Nullable<string[]>;\r\n}\r\n\r\n/**\r\n * Get a cached pipeline context\r\n * @param name the pipeline name\r\n * @param context the context to be used when creating the pipeline\r\n * @returns the cached pipeline context if it exists\r\n * @internal\r\n */\r\nexport function getCachedPipeline(name: string, context: WebGLContext): IPipelineContext | undefined {\r\n const stateObject = getStateObject(context);\r\n return stateObject.cachedPipelines[name];\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function resetCachedPipeline(pipeline: IPipelineContext): void {\r\n const name = pipeline._name;\r\n const context = (pipeline as WebGLPipelineContext).context;\r\n if (name && context) {\r\n const stateObject = getStateObject(context!);\r\n const cachedPipeline = stateObject.cachedPipelines[name];\r\n cachedPipeline?.dispose();\r\n delete stateObject.cachedPipelines[name];\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function _processShaderCode(\r\n processorOptions: ProcessingOptions,\r\n baseName: any,\r\n processFinalCode?: Nullable<ShaderCustomProcessingFunction>,\r\n onFinalCodeReady?: (vertexCode: string, fragmentCode: string) => void,\r\n shaderLanguage?: ShaderLanguage,\r\n engine?: AbstractEngine,\r\n effectContext?: Effect\r\n) {\r\n let vertexSource: string | HTMLElement | IShaderPath;\r\n let fragmentSource: string | HTMLElement | IShaderPath;\r\n\r\n // const baseName = this.name;\r\n const hostDocument = IsWindowObjectExist() ? engine?.getHostDocument() : null;\r\n\r\n if (typeof baseName === \"string\") {\r\n vertexSource = baseName;\r\n } else if (baseName.vertexSource) {\r\n vertexSource = \"source:\" + baseName.vertexSource;\r\n } else if (baseName.vertexElement) {\r\n vertexSource = hostDocument?.getElementById(baseName.vertexElement) || baseName.vertexElement;\r\n } else {\r\n vertexSource = baseName.vertex || baseName;\r\n }\r\n if (typeof baseName === \"string\") {\r\n fragmentSource = baseName;\r\n } else if (baseName.fragmentSource) {\r\n fragmentSource = \"source:\" + baseName.fragmentSource;\r\n } else if (baseName.fragmentElement) {\r\n fragmentSource = hostDocument?.getElementById(baseName.fragmentElement) || baseName.fragmentElement;\r\n } else {\r\n fragmentSource = baseName.fragment || baseName;\r\n }\r\n\r\n const shaderCodes: [string | undefined, string | undefined] = [undefined, undefined];\r\n const shadersLoaded = () => {\r\n if (shaderCodes[0] && shaderCodes[1]) {\r\n processorOptions.isFragment = true;\r\n const [migratedVertexCode, fragmentCode] = shaderCodes;\r\n Process(\r\n fragmentCode,\r\n processorOptions,\r\n (migratedFragmentCode, codeBeforeMigration) => {\r\n if (effectContext) {\r\n effectContext._fragmentSourceCodeBeforeMigration = codeBeforeMigration;\r\n }\r\n if (processFinalCode) {\r\n migratedFragmentCode = processFinalCode(\"fragment\", migratedFragmentCode);\r\n }\r\n const finalShaders = Finalize(migratedVertexCode, migratedFragmentCode, processorOptions);\r\n processorOptions = null as any;\r\n const finalCode = _useFinalCode(finalShaders.vertexCode, finalShaders.fragmentCode, baseName, shaderLanguage);\r\n onFinalCodeReady?.(finalCode.vertexSourceCode, finalCode.fragmentSourceCode);\r\n },\r\n engine\r\n );\r\n }\r\n };\r\n _loadShader(\r\n vertexSource,\r\n \"Vertex\",\r\n \"\",\r\n (vertexCode) => {\r\n Initialize(processorOptions);\r\n Process(\r\n vertexCode,\r\n processorOptions,\r\n (migratedVertexCode, codeBeforeMigration) => {\r\n if (effectContext) {\r\n effectContext._rawVertexSourceCode = vertexCode;\r\n effectContext._vertexSourceCodeBeforeMigration = codeBeforeMigration;\r\n }\r\n if (processFinalCode) {\r\n migratedVertexCode = processFinalCode(\"vertex\", migratedVertexCode);\r\n }\r\n shaderCodes[0] = migratedVertexCode;\r\n shadersLoaded();\r\n },\r\n engine\r\n );\r\n },\r\n shaderLanguage\r\n );\r\n _loadShader(\r\n fragmentSource,\r\n \"Fragment\",\r\n \"Pixel\",\r\n (fragmentCode) => {\r\n if (effectContext) {\r\n effectContext._rawFragmentSourceCode = fragmentCode;\r\n }\r\n shaderCodes[1] = fragmentCode;\r\n shadersLoaded();\r\n },\r\n shaderLanguage\r\n );\r\n}\r\n\r\nfunction _loadShader(shader: any, key: string, optionalKey: string, callback: (data: any) => void, shaderLanguage?: ShaderLanguage, _loadFileInjection?: typeof _loadFile) {\r\n if (typeof HTMLElement !== \"undefined\") {\r\n // DOM element ?\r\n if (shader instanceof HTMLElement) {\r\n const shaderCode = GetDOMTextContent(shader);\r\n callback(shaderCode);\r\n return;\r\n }\r\n }\r\n\r\n // Direct source ?\r\n if (shader.substr(0, 7) === \"source:\") {\r\n callback(shader.substr(7));\r\n return;\r\n }\r\n\r\n // Base64 encoded ?\r\n if (shader.substr(0, 7) === \"base64:\") {\r\n const shaderBinary = window.atob(shader.substr(7));\r\n callback(shaderBinary);\r\n return;\r\n }\r\n\r\n const shaderStore = ShaderStore.GetShadersStore(shaderLanguage);\r\n\r\n // Is in local store ?\r\n if (shaderStore[shader + key + \"Shader\"]) {\r\n callback(shaderStore[shader + key + \"Shader\"]);\r\n return;\r\n }\r\n\r\n if (optionalKey && shaderStore[shader + optionalKey + \"Shader\"]) {\r\n callback(shaderStore[shader + optionalKey + \"Shader\"]);\r\n return;\r\n }\r\n\r\n let shaderUrl;\r\n\r\n if (shader[0] === \".\" || shader[0] === \"/\" || shader.indexOf(\"http\") > -1) {\r\n shaderUrl = shader;\r\n } else {\r\n shaderUrl = ShaderStore.GetShadersRepository(shaderLanguage) + shader;\r\n }\r\n _loadFileInjection = _loadFileInjection || _loadFile;\r\n if (!_loadFileInjection) {\r\n // we got to this point and loadFile was not injected - throw an error\r\n throw new Error(\"loadFileInjection is not defined\");\r\n }\r\n // Vertex shader\r\n _loadFileInjection(shaderUrl + \".\" + key.toLowerCase() + \".fx\", callback);\r\n}\r\n\r\nfunction _useFinalCode(migratedVertexCode: string, migratedFragmentCode: string, baseName: any, shaderLanguage?: ShaderLanguage) {\r\n if (baseName) {\r\n const vertex = baseName.vertexElement || baseName.vertex || baseName.spectorName || baseName;\r\n const fragment = baseName.fragmentElement || baseName.fragment || baseName.spectorName || baseName;\r\n\r\n return {\r\n vertexSourceCode: (shaderLanguage === ShaderLanguage.WGSL ? \"//\" : \"\") + \"#define SHADER_NAME vertex:\" + vertex + \"\\n\" + migratedVertexCode,\r\n fragmentSourceCode: (shaderLanguage === ShaderLanguage.WGSL ? \"//\" : \"\") + \"#define SHADER_NAME fragment:\" + fragment + \"\\n\" + migratedFragmentCode,\r\n };\r\n } else {\r\n return {\r\n vertexSourceCode: migratedVertexCode,\r\n fragmentSourceCode: migratedFragmentCode,\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Creates and prepares a pipeline context\r\n * @internal\r\n */\r\nexport const createAndPreparePipelineContext = (\r\n options: ICreateAndPreparePipelineContextOptions,\r\n createPipelineContext: typeof AbstractEngine.prototype.createPipelineContext,\r\n _preparePipelineContext: typeof AbstractEngine.prototype._preparePipelineContext,\r\n _executeWhenRenderingStateIsCompiled: typeof AbstractEngine.prototype._executeWhenRenderingStateIsCompiled\r\n) => {\r\n try {\r\n const pipelineContext: IPipelineContext = options.existingPipelineContext || createPipelineContext(options.shaderProcessingContext);\r\n pipelineContext._name = options.name;\r\n if (options.name && options.context) {\r\n const stateObject = getStateObject(options.context);\r\n stateObject.cachedPipelines[options.name] = pipelineContext;\r\n }\r\n\r\n _preparePipelineContext(\r\n pipelineContext,\r\n options.vertex,\r\n options.fragment,\r\n !!options.createAsRaw,\r\n \"\",\r\n \"\",\r\n options.rebuildRebind,\r\n options.defines,\r\n options.transformFeedbackVaryings,\r\n \"\"\r\n );\r\n\r\n _executeWhenRenderingStateIsCompiled(pipelineContext, () => {\r\n options.onRenderingStateCompiled?.(pipelineContext);\r\n });\r\n\r\n return pipelineContext;\r\n } catch (e) {\r\n Logger.Error(\"Error compiling effect\");\r\n throw e;\r\n }\r\n};\r\n"]}
|
package/Materials/effect.js
CHANGED
|
@@ -2,7 +2,6 @@ import { Observable } from "../Misc/observable.js";
|
|
|
2
2
|
|
|
3
3
|
import { Logger } from "../Misc/logger.js";
|
|
4
4
|
import { ShaderStore as EngineShaderStore } from "../Engines/shaderStore.js";
|
|
5
|
-
import { ShaderLanguage } from "./shaderLanguage.js";
|
|
6
5
|
import { _processShaderCode, getCachedPipeline, createAndPreparePipelineContext, resetCachedPipeline } from "./effect.functions.js";
|
|
7
6
|
/**
|
|
8
7
|
* Effect containing vertex and fragment shader that can be executed on an object.
|
|
@@ -48,7 +47,7 @@ export class Effect {
|
|
|
48
47
|
* @param key Effect Key identifying uniquely compiled shader variants
|
|
49
48
|
* @param shaderLanguage the language the shader is written in (default: GLSL)
|
|
50
49
|
*/
|
|
51
|
-
constructor(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers = null, engine, defines = null, fallbacks = null, onCompiled = null, onError = null, indexParameters, key = "", shaderLanguage = ShaderLanguage.GLSL) {
|
|
50
|
+
constructor(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers = null, engine, defines = null, fallbacks = null, onCompiled = null, onError = null, indexParameters, key = "", shaderLanguage = 0 /* ShaderLanguage.GLSL */) {
|
|
52
51
|
/**
|
|
53
52
|
* String container all the define statements that should be set on the shader.
|
|
54
53
|
*/
|
|
@@ -139,7 +138,7 @@ export class Effect {
|
|
|
139
138
|
this._indexParameters = options.indexParameters;
|
|
140
139
|
this._transformFeedbackVaryings = options.transformFeedbackVaryings || null;
|
|
141
140
|
this._multiTarget = !!options.multiTarget;
|
|
142
|
-
this._shaderLanguage = options.shaderLanguage ?? ShaderLanguage.GLSL
|
|
141
|
+
this._shaderLanguage = options.shaderLanguage ?? 0 /* ShaderLanguage.GLSL */;
|
|
143
142
|
if (options.uniformBuffersNames) {
|
|
144
143
|
this._uniformBuffersNamesList = options.uniformBuffersNames.slice();
|
|
145
144
|
for (let i = 0; i < options.uniformBuffersNames.length; i++) {
|
|
@@ -1131,7 +1130,7 @@ export class Effect {
|
|
|
1131
1130
|
* @param vertexShader optional vertex shader content
|
|
1132
1131
|
* @param shaderLanguage the language the shader is written in (default: GLSL)
|
|
1133
1132
|
*/
|
|
1134
|
-
static RegisterShader(name, pixelShader, vertexShader, shaderLanguage = ShaderLanguage.GLSL) {
|
|
1133
|
+
static RegisterShader(name, pixelShader, vertexShader, shaderLanguage = 0 /* ShaderLanguage.GLSL */) {
|
|
1135
1134
|
if (pixelShader) {
|
|
1136
1135
|
EngineShaderStore.GetShadersStore(shaderLanguage)[`${name}PixelShader`] = pixelShader;
|
|
1137
1136
|
}
|