@onerjs/core 8.56.4 → 9.0.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/animatable.core.js +36 -0
- package/Animations/animatable.core.js.map +1 -1
- package/Animations/animationGroup.pure.d.ts +61 -1
- package/Animations/animationGroup.pure.js +191 -2
- package/Animations/animationGroup.pure.js.map +1 -1
- package/Animations/index.d.ts +1 -0
- package/Animations/index.js +1 -0
- package/Animations/index.js.map +1 -1
- package/Animations/pure.d.ts +1 -0
- package/Animations/pure.js +1 -0
- package/Animations/pure.js.map +1 -1
- package/Animations/rootMotion.d.ts +560 -0
- package/Animations/rootMotion.js +1709 -0
- package/Animations/rootMotion.js.map +1 -0
- package/Animations/runtimeAnimation.d.ts +57 -0
- package/Animations/runtimeAnimation.js +127 -3
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Cameras/arcRotateCamera.pure.d.ts +2 -0
- package/Cameras/arcRotateCamera.pure.js +2 -0
- package/Cameras/arcRotateCamera.pure.js.map +1 -1
- package/Cameras/targetCamera.pure.d.ts +2 -0
- package/Cameras/targetCamera.pure.js +13 -2
- package/Cameras/targetCamera.pure.js.map +1 -1
- package/Collisions/gpuPicker.js +5 -5
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.query.pure.js +4 -2
- package/Engines/AbstractEngine/abstractEngine.query.pure.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.query.types.d.ts +11 -2
- package/Engines/AbstractEngine/abstractEngine.query.types.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.renderPass.pure.js +1 -0
- package/Engines/AbstractEngine/abstractEngine.renderPass.pure.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.pure.js +63 -0
- package/Engines/Extensions/engine.multiRender.pure.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.types.d.ts +13 -0
- package/Engines/Extensions/engine.multiRender.types.js.map +1 -1
- package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js +2 -2
- package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js.map +1 -1
- package/Engines/Extensions/engine.prefilteredCubeTexture.types.d.ts +2 -1
- package/Engines/Extensions/engine.prefilteredCubeTexture.types.js.map +1 -1
- package/Engines/Extensions/index.d.ts +1 -0
- package/Engines/Extensions/index.js +1 -0
- package/Engines/Extensions/index.js.map +1 -1
- package/Engines/Extensions/pure.d.ts +1 -1
- package/Engines/Extensions/pure.js +1 -1
- package/Engines/Extensions/pure.js.map +1 -1
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js +88 -39
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js.map +1 -1
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.types.d.ts +20 -2
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.types.js.map +1 -1
- package/Engines/Native/nativeHardwareTexture.d.ts +8 -1
- package/Engines/Native/nativeHardwareTexture.js +7 -0
- package/Engines/Native/nativeHardwareTexture.js.map +1 -1
- package/Engines/Native/nativeHelpers.js +56 -1
- package/Engines/Native/nativeHelpers.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +37 -8
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.d.ts +40 -0
- package/Engines/Native/nativeRenderTargetWrapper.js +265 -5
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/Processors/shaderCodeCursor.d.ts +1 -0
- package/Engines/Processors/shaderCodeCursor.js +40 -3
- package/Engines/Processors/shaderCodeCursor.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.pure.js +4 -0
- package/Engines/WebGPU/Extensions/engine.multiRender.pure.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.types.d.ts +13 -0
- package/Engines/WebGPU/Extensions/engine.multiRender.types.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.query.pure.js +11 -3
- package/Engines/WebGPU/Extensions/engine.query.pure.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.pure.js +1 -0
- package/Engines/WebGPU/Extensions/engine.renderTarget.pure.js.map +1 -1
- package/Engines/WebGPU/Extensions/index.d.ts +1 -0
- package/Engines/WebGPU/Extensions/index.js +1 -0
- package/Engines/WebGPU/Extensions/index.js.map +1 -1
- package/Engines/WebGPU/Extensions/pure.d.ts +1 -1
- package/Engines/WebGPU/Extensions/pure.js +1 -1
- package/Engines/WebGPU/Extensions/pure.js.map +1 -1
- package/Engines/WebGPU/webgpuBundleList.d.ts +2 -0
- package/Engines/WebGPU/webgpuBundleList.js +4 -0
- package/Engines/WebGPU/webgpuBundleList.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +5 -2
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +3 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -1
- package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
- package/Engines/WebGPU/webgpuSnapshotRendering.d.ts +4 -0
- package/Engines/WebGPU/webgpuSnapshotRendering.js +40 -7
- package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.d.ts +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +2 -2
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.d.ts +2 -0
- package/Engines/WebGPU/webgpuTextureManager.js +286 -13
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.pure.d.ts +17 -1
- package/Engines/abstractEngine.pure.js +17 -5
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/constants.d.ts +4 -0
- package/Engines/constants.js +4 -0
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.pure.d.ts +0 -1
- package/Engines/engine.pure.js +0 -7
- package/Engines/engine.pure.js.map +1 -1
- package/Engines/nativeEngine.pure.js +1 -1
- package/Engines/nativeEngine.pure.js.map +1 -1
- package/Engines/thinEngine.pure.d.ts +15 -0
- package/Engines/thinEngine.pure.js +61 -14
- package/Engines/thinEngine.pure.js.map +1 -1
- package/Engines/thinNativeEngine.pure.d.ts +218 -17
- package/Engines/thinNativeEngine.pure.js +1438 -165
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/Engines/thinWebGPUEngine.d.ts +4 -0
- package/Engines/thinWebGPUEngine.js +16 -2
- package/Engines/thinWebGPUEngine.js.map +1 -1
- package/Engines/webgpuEngine.pure.d.ts +17 -3
- package/Engines/webgpuEngine.pure.js +56 -13
- package/Engines/webgpuEngine.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +2 -2
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.d.ts +10 -0
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js +24 -12
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.d.ts +11 -2
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +1 -1
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.pure.d.ts +7 -0
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.pure.js +43 -0
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.d.ts +9 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.js +6 -8
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.d.ts +2 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.js +5 -1
- package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.d.ts +2 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.js +5 -1
- package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +9 -0
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +34 -9
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +2 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +4 -0
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +18 -4
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +24 -6
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.pure.js +19 -7
- package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.pure.js +3 -3
- package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +20 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +85 -25
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.d.ts +16 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +64 -14
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.d.ts +12 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js +8 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js +4 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.pure.d.ts +12 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.pure.js +5 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.pure.js +64 -16
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.pure.d.ts +2 -0
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.pure.js +14 -2
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.pure.d.ts +5 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.pure.js +23 -8
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.pure.js.map +1 -1
- package/FlowGraph/CustomTypes/flowGraphInteger.pure.d.ts +5 -0
- package/FlowGraph/CustomTypes/flowGraphInteger.pure.js +7 -0
- package/FlowGraph/CustomTypes/flowGraphInteger.pure.js.map +1 -1
- package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +10 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.js +14 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +6 -1
- package/FlowGraph/flowGraph.js +41 -9
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphAnimationHelpers.d.ts +24 -0
- package/FlowGraph/flowGraphAnimationHelpers.js +21 -0
- package/FlowGraph/flowGraphAnimationHelpers.js.map +1 -0
- package/FlowGraph/flowGraphBlock.js +3 -0
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +7 -0
- package/FlowGraph/flowGraphConnection.js +7 -0
- package/FlowGraph/flowGraphConnection.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +2 -1
- package/FlowGraph/flowGraphContext.js +5 -3
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +15 -1
- package/FlowGraph/flowGraphCoordinator.js +47 -16
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphEventBlock.d.ts +5 -0
- package/FlowGraph/flowGraphEventBlock.js +7 -0
- package/FlowGraph/flowGraphEventBlock.js.map +1 -1
- package/FlowGraph/flowGraphHostResolver.d.ts +2 -1
- package/FlowGraph/flowGraphHostResolver.js.map +1 -1
- package/FlowGraph/flowGraphParser.js +60 -2
- package/FlowGraph/flowGraphParser.js.map +1 -1
- package/FlowGraph/flowGraphValidator.js +0 -4
- package/FlowGraph/flowGraphValidator.js.map +1 -1
- package/FlowGraph/index.d.ts +2 -0
- package/FlowGraph/index.js +2 -0
- package/FlowGraph/index.js.map +1 -1
- package/FlowGraph/pure.d.ts +2 -0
- package/FlowGraph/pure.js +2 -0
- package/FlowGraph/pure.js.map +1 -1
- package/FlowGraph/serialization.d.ts +4 -2
- package/FlowGraph/serialization.js +12 -24
- package/FlowGraph/serialization.js.map +1 -1
- package/FlowGraph/typeDefinitions.d.ts +9 -1
- package/FlowGraph/typeDefinitions.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.d.ts +5 -0
- package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.js +8 -0
- package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.d.ts +87 -0
- package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.js +295 -0
- package/FrameGraph/Node/Blocks/PostProcesses/meshBlendingPostProcessBlock.pure.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/pure.d.ts +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/pure.js +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +4 -4
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.d.ts +5 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js +13 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/minMaxReducerBlock.d.ts +1 -0
- package/FrameGraph/Node/Blocks/Textures/minMaxReducerBlock.js +4 -0
- package/FrameGraph/Node/Blocks/Textures/minMaxReducerBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Textures/minMaxReducerBlock.pure.d.ts +54 -0
- package/FrameGraph/Node/Blocks/Textures/minMaxReducerBlock.pure.js +155 -0
- package/FrameGraph/Node/Blocks/Textures/minMaxReducerBlock.pure.js.map +1 -0
- package/FrameGraph/Node/Blocks/Textures/pure.d.ts +1 -0
- package/FrameGraph/Node/Blocks/Textures/pure.js +1 -0
- package/FrameGraph/Node/Blocks/Textures/pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/allBlocks.pure.js +4 -0
- package/FrameGraph/Node/Blocks/allBlocks.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +2 -0
- package/FrameGraph/Node/Blocks/index.js +2 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/Blocks/inputBlock.pure.js +20 -1
- package/FrameGraph/Node/Blocks/inputBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/pure.d.ts +2 -0
- package/FrameGraph/Node/Blocks/pure.js +2 -0
- package/FrameGraph/Node/Blocks/pure.js.map +1 -1
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +4 -2
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +4 -2
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js +1 -0
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js +5 -1
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.js +1 -0
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/minMaxReducerTask.d.ts +62 -0
- package/FrameGraph/Tasks/Misc/minMaxReducerTask.js +159 -0
- package/FrameGraph/Tasks/Misc/minMaxReducerTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.d.ts +69 -0
- package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.js +223 -0
- package/FrameGraph/Tasks/PostProcesses/meshBlendingTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +25 -3
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +72 -34
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +3 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +4 -0
- package/FrameGraph/frameGraph.js +14 -0
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphObjectList.d.ts +6 -1
- package/FrameGraph/frameGraphObjectList.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +3 -1
- package/FrameGraph/frameGraphRenderContext.js +5 -5
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/index.d.ts +2 -0
- package/FrameGraph/index.js +2 -0
- package/FrameGraph/index.js.map +1 -1
- package/FrameGraph/pure.d.ts +2 -0
- package/FrameGraph/pure.js +2 -0
- package/FrameGraph/pure.js.map +1 -1
- package/Inputs/scene.inputManager.d.ts +4 -0
- package/Inputs/scene.inputManager.js +50 -8
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Lights/Clustered/clusteredLightingSceneComponent.pure.d.ts +5 -0
- package/Lights/Clustered/clusteredLightingSceneComponent.pure.js +22 -1
- package/Lights/Clustered/clusteredLightingSceneComponent.pure.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.pure.js +7 -3
- package/Lights/Shadows/cascadedShadowGenerator.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianPointSplattingBlitMaterial.d.ts +7 -0
- package/Materials/GaussianSplatting/gaussianPointSplattingBlitMaterial.js +8 -0
- package/Materials/GaussianSplatting/gaussianPointSplattingBlitMaterial.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianPointSplattingBlitMaterial.pure.d.ts +54 -0
- package/Materials/GaussianSplatting/gaussianPointSplattingBlitMaterial.pure.js +81 -0
- package/Materials/GaussianSplatting/gaussianPointSplattingBlitMaterial.pure.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianPointSplattingDepthBlitMaterial.d.ts +7 -0
- package/Materials/GaussianSplatting/gaussianPointSplattingDepthBlitMaterial.js +8 -0
- package/Materials/GaussianSplatting/gaussianPointSplattingDepthBlitMaterial.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianPointSplattingDepthBlitMaterial.pure.d.ts +60 -0
- package/Materials/GaussianSplatting/gaussianPointSplattingDepthBlitMaterial.pure.js +90 -0
- package/Materials/GaussianSplatting/gaussianPointSplattingDepthBlitMaterial.pure.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.d.ts +31 -0
- package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.js +103 -5
- package/Materials/GaussianSplatting/gaussianSplattingDebugMaterialPlugin.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js +6 -6
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +26 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +153 -49
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingOverdrawMaterialPlugin.d.ts +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingOverdrawMaterialPlugin.js +4 -0
- package/Materials/GaussianSplatting/gaussianSplattingOverdrawMaterialPlugin.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingOverdrawMaterialPlugin.pure.d.ts +83 -0
- package/Materials/GaussianSplatting/gaussianSplattingOverdrawMaterialPlugin.pure.js +191 -0
- package/Materials/GaussianSplatting/gaussianSplattingOverdrawMaterialPlugin.pure.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingSizeMaterialPlugin.d.ts +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingSizeMaterialPlugin.js +4 -0
- package/Materials/GaussianSplatting/gaussianSplattingSizeMaterialPlugin.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingSizeMaterialPlugin.pure.d.ts +62 -0
- package/Materials/GaussianSplatting/gaussianSplattingSizeMaterialPlugin.pure.js +125 -0
- package/Materials/GaussianSplatting/gaussianSplattingSizeMaterialPlugin.pure.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js +5 -5
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js.map +1 -1
- package/Materials/GaussianSplatting/pure.d.ts +4 -0
- package/Materials/GaussianSplatting/pure.js +4 -0
- package/Materials/GaussianSplatting/pure.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.pure.d.ts +1 -0
- package/Materials/Node/Blocks/Dual/imageSourceBlock.pure.js +12 -0
- package/Materials/Node/Blocks/Dual/imageSourceBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js +11 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js +17 -2
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js +2 -2
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js.map +1 -1
- package/Materials/Node/nodeMaterial.pure.d.ts +4 -0
- package/Materials/Node/nodeMaterial.pure.js +4 -0
- package/Materials/Node/nodeMaterial.pure.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +25 -3
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.pure.d.ts +2 -0
- package/Materials/PBR/pbrBaseMaterial.pure.d.ts +2 -0
- package/Materials/Textures/Procedurals/proceduralTexture.pure.d.ts +14 -14
- package/Materials/Textures/Procedurals/proceduralTexture.pure.js +37 -13
- package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
- package/Materials/Textures/baseTexture.pure.js +3 -0
- package/Materials/Textures/baseTexture.pure.js.map +1 -1
- package/Materials/Textures/cubeTexture.pure.js +1 -1
- package/Materials/Textures/cubeTexture.pure.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +8 -1
- package/Materials/Textures/internalTexture.js +9 -2
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/mirrorTexture.pure.js +3 -1
- package/Materials/Textures/mirrorTexture.pure.js.map +1 -1
- package/Materials/Textures/rawTexture2DArray.functions.d.ts +3 -3
- package/Materials/Textures/rawTexture2DArray.functions.js.map +1 -1
- package/Materials/Textures/rawTexture3D.d.ts +1 -1
- package/Materials/Textures/rawTexture3D.js +1 -1
- package/Materials/Textures/rawTexture3D.js.map +1 -1
- package/Materials/Textures/texture.pure.js +1 -1
- package/Materials/Textures/texture.pure.js.map +1 -1
- package/Materials/Textures/textureHelper.functions.d.ts +14 -0
- package/Materials/Textures/textureHelper.functions.js +24 -0
- package/Materials/Textures/textureHelper.functions.js.map +1 -1
- package/Materials/ditheredTileFadeMaterialPlugin.d.ts +210 -0
- package/Materials/ditheredTileFadeMaterialPlugin.js +509 -0
- package/Materials/ditheredTileFadeMaterialPlugin.js.map +1 -0
- package/Materials/effectRenderer.pure.d.ts +4 -0
- package/Materials/effectRenderer.pure.js +3 -2
- package/Materials/effectRenderer.pure.js.map +1 -1
- package/Materials/index.d.ts +5 -0
- package/Materials/index.js +5 -0
- package/Materials/index.js.map +1 -1
- package/Materials/material.pure.js +25 -12
- package/Materials/material.pure.js.map +1 -1
- package/Materials/materialHelper.geometryrendering.d.ts +46 -1
- package/Materials/materialHelper.geometryrendering.js +105 -8
- package/Materials/materialHelper.geometryrendering.js.map +1 -1
- package/Materials/prepass.defines.d.ts +2 -0
- package/Materials/prepass.defines.js +2 -0
- package/Materials/prepass.defines.js.map +1 -1
- package/Materials/pure.d.ts +5 -0
- package/Materials/pure.js +5 -0
- package/Materials/pure.js.map +1 -1
- package/Materials/standardMaterial.pure.d.ts +10 -0
- package/Materials/standardMaterial.pure.js +30 -5
- package/Materials/standardMaterial.pure.js.map +1 -1
- package/Meshes/Builders/polygonBuilder.pure.d.ts +4 -0
- package/Meshes/Builders/polygonBuilder.pure.js +3 -0
- package/Meshes/Builders/polygonBuilder.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianPointSplattingController.d.ts +8 -0
- package/Meshes/GaussianSplatting/gaussianPointSplattingController.js +11 -0
- package/Meshes/GaussianSplatting/gaussianPointSplattingController.js.map +1 -0
- package/Meshes/GaussianSplatting/gaussianPointSplattingController.pure.d.ts +231 -0
- package/Meshes/GaussianSplatting/gaussianPointSplattingController.pure.js +1212 -0
- package/Meshes/GaussianSplatting/gaussianPointSplattingController.pure.js.map +1 -0
- package/Meshes/GaussianSplatting/gaussianPointSplattingRenderer.d.ts +14 -0
- package/Meshes/GaussianSplatting/gaussianPointSplattingRenderer.js +15 -0
- package/Meshes/GaussianSplatting/gaussianPointSplattingRenderer.js.map +1 -0
- package/Meshes/GaussianSplatting/gaussianPointSplattingRenderer.pure.d.ts +285 -0
- package/Meshes/GaussianSplatting/gaussianPointSplattingRenderer.pure.js +812 -0
- package/Meshes/GaussianSplatting/gaussianPointSplattingRenderer.pure.js.map +1 -0
- package/Meshes/GaussianSplatting/gaussianSplatting.functions.d.ts +19 -0
- package/Meshes/GaussianSplatting/gaussianSplatting.functions.js +23 -0
- package/Meshes/GaussianSplatting/gaussianSplatting.functions.js.map +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +2 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +163 -14
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +239 -24
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +34 -4
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +125 -25
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/pure.d.ts +2 -0
- package/Meshes/GaussianSplatting/pure.js +2 -0
- package/Meshes/GaussianSplatting/pure.js.map +1 -1
- package/Meshes/Node/Blocks/booleanGeometryBlock.pure.js +25 -11
- package/Meshes/Node/Blocks/booleanGeometryBlock.pure.js.map +1 -1
- package/Meshes/abstractMesh.pure.d.ts +30 -0
- package/Meshes/abstractMesh.pure.js +54 -0
- package/Meshes/abstractMesh.pure.js.map +1 -1
- package/Meshes/index.d.ts +2 -0
- package/Meshes/index.js +2 -0
- package/Meshes/index.js.map +1 -1
- package/Meshes/instancedMesh.pure.d.ts +5 -0
- package/Meshes/instancedMesh.pure.js +12 -0
- package/Meshes/instancedMesh.pure.js.map +1 -1
- package/Meshes/mesh.pure.js +23 -8
- package/Meshes/mesh.pure.js.map +1 -1
- package/Meshes/meshBlendingTag.d.ts +47 -0
- package/Meshes/meshBlendingTag.js +64 -0
- package/Meshes/meshBlendingTag.js.map +1 -0
- package/Meshes/polygonMesh.js +2 -2
- package/Meshes/polygonMesh.js.map +1 -1
- package/Meshes/pure.d.ts +2 -0
- package/Meshes/pure.js +2 -0
- package/Meshes/pure.js.map +1 -1
- package/Meshes/subMesh.pure.d.ts +11 -2
- package/Meshes/subMesh.pure.js +20 -5
- package/Meshes/subMesh.pure.js.map +1 -1
- package/Meshes/thinInstanceMesh.pure.js +1 -0
- package/Meshes/thinInstanceMesh.pure.js.map +1 -1
- package/Misc/andOrNotEvaluator.js +4 -0
- package/Misc/andOrNotEvaluator.js.map +1 -1
- package/Misc/fileTools.pure.js +21 -0
- package/Misc/fileTools.pure.js.map +1 -1
- package/Misc/minMaxReducer.pure.d.ts +6 -0
- package/Misc/minMaxReducer.pure.js +10 -0
- package/Misc/minMaxReducer.pure.js.map +1 -1
- package/Misc/snapshotRenderingHelper.js +2 -2
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Misc/thinMinMaxReducer.d.ts +19 -2
- package/Misc/thinMinMaxReducer.js +74 -21
- package/Misc/thinMinMaxReducer.js.map +1 -1
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateNoiseBlock.pure.js +19 -7
- package/Particles/Node/Blocks/Update/updateNoiseBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.pure.js +3 -2
- package/Particles/Node/Blocks/particleSourceTextureBlock.pure.js.map +1 -1
- package/Particles/gpuParticleSystem.pure.d.ts +4 -0
- package/Particles/gpuParticleSystem.pure.js +101 -32
- package/Particles/gpuParticleSystem.pure.js.map +1 -1
- package/Particles/particle.js +3 -2
- package/Particles/particle.js.map +1 -1
- package/Particles/solidParticleSystem.js +7 -1
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.function.d.ts +6 -0
- package/Particles/thinParticleSystem.function.js +144 -88
- package/Particles/thinParticleSystem.function.js.map +1 -1
- package/Particles/thinParticleSystem.pure.d.ts +8 -0
- package/Particles/thinParticleSystem.pure.js +154 -28
- package/Particles/thinParticleSystem.pure.js.map +1 -1
- package/Particles/webgl2ParticleSystem.pure.d.ts +1 -0
- package/Particles/webgl2ParticleSystem.pure.js +12 -4
- package/Particles/webgl2ParticleSystem.pure.js.map +1 -1
- package/Physics/v2/ragdoll.d.ts +2 -4
- package/Physics/v2/ragdoll.js +11 -4
- package/Physics/v2/ragdoll.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.pure.js +7 -0
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/index.d.ts +2 -0
- package/PostProcesses/index.js +2 -0
- package/PostProcesses/index.js.map +1 -1
- package/PostProcesses/meshBlendingBlueNoise.d.ts +15 -0
- package/PostProcesses/meshBlendingBlueNoise.js +77 -0
- package/PostProcesses/meshBlendingBlueNoise.js.map +1 -0
- package/PostProcesses/meshBlendingPostProcess.d.ts +131 -0
- package/PostProcesses/meshBlendingPostProcess.js +315 -0
- package/PostProcesses/meshBlendingPostProcess.js.map +1 -0
- package/PostProcesses/pure.d.ts +2 -0
- package/PostProcesses/pure.js +2 -0
- package/PostProcesses/pure.js.map +1 -1
- package/PostProcesses/thinMeshBlendingPostProcess.d.ts +339 -0
- package/PostProcesses/thinMeshBlendingPostProcess.js +771 -0
- package/PostProcesses/thinMeshBlendingPostProcess.js.map +1 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +6 -6
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.d.ts +12 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +50 -25
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
- package/Rendering/boundingBoxRenderer.pure.js +2 -1
- package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
- package/Rendering/depthRenderer.pure.d.ts +9 -0
- package/Rendering/depthRenderer.pure.js +15 -4
- package/Rendering/depthRenderer.pure.js.map +1 -1
- package/Rendering/edgesRenderer.pure.d.ts +4 -2
- package/Rendering/edgesRenderer.pure.js +11 -2
- package/Rendering/edgesRenderer.pure.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +14 -0
- package/Rendering/fluidRenderer/fluidRenderingObject.js +26 -0
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +13 -3
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +22 -9
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +3 -0
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.pure.d.ts +38 -4
- package/Rendering/geometryBufferRenderer.pure.js +130 -18
- package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +7 -1
- package/Rendering/objectRenderer.js +45 -7
- package/Rendering/objectRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.pure.js +6 -2
- package/Rendering/outlineRenderer.pure.js.map +1 -1
- package/Rendering/prePassRenderer.pure.js +3 -3
- package/Rendering/prePassRenderer.pure.js.map +1 -1
- package/Rendering/renderingManager.d.ts +1 -1
- package/Rendering/renderingManager.js +5 -4
- package/Rendering/renderingManager.js.map +1 -1
- package/Shaders/ShadersInclude/defaultFragmentAlpha.d.ts +5 -0
- package/Shaders/ShadersInclude/defaultFragmentAlpha.js +34 -0
- package/Shaders/ShadersInclude/defaultFragmentAlpha.js.map +1 -0
- package/Shaders/ShadersInclude/gaussianSplatting.js +3 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +5 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/geometryRenderingFragment.d.ts +5 -0
- package/Shaders/ShadersInclude/geometryRenderingFragment.js +74 -0
- package/Shaders/ShadersInclude/geometryRenderingFragment.js.map +1 -0
- package/Shaders/ShadersInclude/lightsFragmentFunctions.js +27 -3
- package/Shaders/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/mrtFragmentDeclaration.js +89 -0
- package/Shaders/ShadersInclude/mrtFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/oitDeclaration.js +1 -1
- package/Shaders/ShadersInclude/oitDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrBlockPrePass.js +24 -17
- package/Shaders/ShadersInclude/openpbrBlockPrePass.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockPrePass.js +27 -20
- package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDebug.js +6 -2
- package/Shaders/ShadersInclude/pbrDebug.js.map +1 -1
- package/Shaders/ShadersInclude/prePassDeclaration.js +95 -2
- package/Shaders/ShadersInclude/prePassDeclaration.js.map +1 -1
- package/Shaders/default.fragment.js +31 -40
- package/Shaders/default.fragment.js.map +1 -1
- package/Shaders/depthOfField.fragment.js +13 -9
- package/Shaders/depthOfField.fragment.js.map +1 -1
- package/Shaders/fluidRenderingParticleDepth.vertex.js +16 -1
- package/Shaders/fluidRenderingParticleDepth.vertex.js.map +1 -1
- package/Shaders/fluidRenderingParticleThickness.vertex.js +16 -1
- package/Shaders/fluidRenderingParticleThickness.vertex.js.map +1 -1
- package/Shaders/gaussianSplatting.fragment.js +63 -3
- package/Shaders/gaussianSplatting.fragment.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +80 -0
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/geometry.fragment.js +17 -11
- package/Shaders/geometry.fragment.js.map +1 -1
- package/Shaders/gpuRenderParticles.fragment.js +43 -1
- package/Shaders/gpuRenderParticles.fragment.js.map +1 -1
- package/Shaders/gpuRenderParticles.vertex.js +96 -16
- package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
- package/Shaders/meshBlending.fragment.d.ts +5 -0
- package/Shaders/meshBlending.fragment.js +519 -0
- package/Shaders/meshBlending.fragment.js.map +1 -0
- package/Shaders/minmaxRedux.fragment.js +6 -1
- package/Shaders/minmaxRedux.fragment.js.map +1 -1
- package/Shaders/particles.fragment.js +43 -1
- package/Shaders/particles.fragment.js.map +1 -1
- package/Shaders/particles.vertex.js +84 -3
- package/Shaders/particles.vertex.js.map +1 -1
- package/Shaders/sprites.fragment.js +52 -2
- package/Shaders/sprites.fragment.js.map +1 -1
- package/Shaders/sprites.vertex.js +62 -1
- package/Shaders/sprites.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.js +33 -0
- package/ShadersWGSL/ShadersInclude/defaultFragmentAlpha.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/gaussianPointSplatting.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/gaussianPointSplatting.js +65 -0
- package/ShadersWGSL/ShadersInclude/gaussianPointSplatting.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/gaussianPointSplattingScan.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/gaussianPointSplattingScan.js +17 -0
- package/ShadersWGSL/ShadersInclude/gaussianPointSplattingScan.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.d.ts +1 -0
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +6 -78
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplattingFragmentDeclaration.js +2 -2
- package/ShadersWGSL/ShadersInclude/gaussianSplattingFragmentDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplattingShared.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/gaussianSplattingShared.js +79 -0
- package/ShadersWGSL/ShadersInclude/gaussianSplattingShared.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.d.ts +6 -0
- package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.js +76 -0
- package/ShadersWGSL/ShadersInclude/geometryRenderingFragment.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/lightFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +27 -3
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.js +18 -0
- package/ShadersWGSL/ShadersInclude/meshBlendTagFragmentOutput.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.d.ts +1 -0
- package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js +11 -25
- package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.d.ts +1 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +11 -25
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDebug.js +5 -1
- package/ShadersWGSL/ShadersInclude/pbrDebug.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/prePassDeclaration.js +6 -1
- package/ShadersWGSL/ShadersInclude/prePassDeclaration.js.map +1 -1
- package/ShadersWGSL/default.fragment.js +17 -48
- package/ShadersWGSL/default.fragment.js.map +1 -1
- package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js +15 -2
- package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js.map +1 -1
- package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js +15 -2
- package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianPointSplattingBlit.fragment.d.ts +5 -0
- package/ShadersWGSL/gaussianPointSplattingBlit.fragment.js +22 -0
- package/ShadersWGSL/gaussianPointSplattingBlit.fragment.js.map +1 -0
- package/ShadersWGSL/gaussianPointSplattingBlit.vertex.d.ts +5 -0
- package/ShadersWGSL/gaussianPointSplattingBlit.vertex.js +19 -0
- package/ShadersWGSL/gaussianPointSplattingBlit.vertex.js.map +1 -0
- package/ShadersWGSL/gaussianPointSplattingDepthBlit.fragment.d.ts +5 -0
- package/ShadersWGSL/gaussianPointSplattingDepthBlit.fragment.js +21 -0
- package/ShadersWGSL/gaussianPointSplattingDepthBlit.fragment.js.map +1 -0
- package/ShadersWGSL/gaussianSplatting.fragment.js +63 -2
- package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +82 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js +2 -1
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingVoxel.vertex.js +2 -1
- package/ShadersWGSL/gaussianSplattingVoxel.vertex.js.map +1 -1
- package/ShadersWGSL/geometry.fragment.js +37 -2
- package/ShadersWGSL/geometry.fragment.js.map +1 -1
- package/ShadersWGSL/gpsHiZBuild.compute.d.ts +5 -0
- package/ShadersWGSL/gpsHiZBuild.compute.js +16 -0
- package/ShadersWGSL/gpsHiZBuild.compute.js.map +1 -0
- package/ShadersWGSL/gpsPartition.compute.d.ts +5 -0
- package/ShadersWGSL/gpsPartition.compute.js +27 -0
- package/ShadersWGSL/gpsPartition.compute.js.map +1 -0
- package/ShadersWGSL/gpsPreprocess.compute.d.ts +5 -0
- package/ShadersWGSL/gpsPreprocess.compute.js +86 -0
- package/ShadersWGSL/gpsPreprocess.compute.js.map +1 -0
- package/ShadersWGSL/gpsResolve.compute.d.ts +5 -0
- package/ShadersWGSL/gpsResolve.compute.js +41 -0
- package/ShadersWGSL/gpsResolve.compute.js.map +1 -0
- package/ShadersWGSL/gpsScanAdd.compute.d.ts +5 -0
- package/ShadersWGSL/gpsScanAdd.compute.js +22 -0
- package/ShadersWGSL/gpsScanAdd.compute.js.map +1 -0
- package/ShadersWGSL/gpsScanBlocks.compute.d.ts +5 -0
- package/ShadersWGSL/gpsScanBlocks.compute.js +23 -0
- package/ShadersWGSL/gpsScanBlocks.compute.js.map +1 -0
- package/ShadersWGSL/gpsScanSums.compute.d.ts +5 -0
- package/ShadersWGSL/gpsScanSums.compute.js +30 -0
- package/ShadersWGSL/gpsScanSums.compute.js.map +1 -0
- package/ShadersWGSL/gpsSplat.compute.d.ts +5 -0
- package/ShadersWGSL/gpsSplat.compute.js +37 -0
- package/ShadersWGSL/gpsSplat.compute.js.map +1 -0
- package/ShadersWGSL/gpuRenderParticles.fragment.js +47 -2
- package/ShadersWGSL/gpuRenderParticles.fragment.js.map +1 -1
- package/ShadersWGSL/gpuRenderParticles.vertex.js +110 -7
- package/ShadersWGSL/gpuRenderParticles.vertex.js.map +1 -1
- package/ShadersWGSL/meshBlending.fragment.d.ts +5 -0
- package/ShadersWGSL/meshBlending.fragment.js +576 -0
- package/ShadersWGSL/meshBlending.fragment.js.map +1 -0
- package/ShadersWGSL/minmaxRedux.fragment.js +20 -3
- package/ShadersWGSL/minmaxRedux.fragment.js.map +1 -1
- package/ShadersWGSL/openpbr.fragment.js +2 -1
- package/ShadersWGSL/openpbr.fragment.js.map +1 -1
- package/ShadersWGSL/particles.fragment.js +45 -1
- package/ShadersWGSL/particles.fragment.js.map +1 -1
- package/ShadersWGSL/particles.vertex.js +86 -4
- package/ShadersWGSL/particles.vertex.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +2 -1
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/sprites.fragment.js +56 -2
- package/ShadersWGSL/sprites.fragment.js.map +1 -1
- package/ShadersWGSL/sprites.vertex.js +62 -1
- package/ShadersWGSL/sprites.vertex.js.map +1 -1
- package/Sprites/spriteManager.d.ts +13 -0
- package/Sprites/spriteManager.js +15 -0
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteRenderer.d.ts +24 -1
- package/Sprites/spriteRenderer.js +368 -50
- package/Sprites/spriteRenderer.js.map +1 -1
- package/Sprites/thinSprite.d.ts +4 -0
- package/Sprites/thinSprite.js +4 -0
- package/Sprites/thinSprite.js.map +1 -1
- package/States/alphaCullingState.d.ts +3 -1
- package/States/alphaCullingState.js +18 -3
- package/States/alphaCullingState.js.map +1 -1
- package/XR/features/WebXRSpaceWarp.pure.js +2 -1
- package/XR/features/WebXRSpaceWarp.pure.js.map +1 -1
- package/XR/webXRDefaultExperience.d.ts +5 -1
- package/XR/webXRDefaultExperience.js.map +1 -1
- package/XR/webXREnterExitUI.d.ts +2 -1
- package/XR/webXREnterExitUI.js.map +1 -1
- package/assetContainer.d.ts +1 -0
- package/assetContainer.js +5 -1
- package/assetContainer.js.map +1 -1
- package/package.json +1 -1
- package/scene.pure.d.ts +36 -2
- package/scene.pure.js +63 -4
- package/scene.pure.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotRenderingHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/snapshotRenderingHelper.ts"],"names":[],"mappings":"AAUA,OAAO,EAA8B,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AAOpI,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,UAAU,EAAe,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAiBhE;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAmBhC;;;;;;OAMG;IACH,YAAY,KAAY,EAAE,OAAyC;QAnB3D,8BAAyB,GAAG,CAAC,CAAC;QAC9B,oCAA+B,uDAA+C;QAE9E,gBAAW,GAAG,KAAK,CAAC;QACpB,2BAAsB,GAAgC,IAAI,GAAG,EAAE,CAAC,CAAC,yEAAyE;QAC1I,4BAAuB,GAAgC,IAAI,GAAG,EAAE,CAAC,CAAC,gBAAgB;QAE1F;;WAEG;QACI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AAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACpG,CAAC;IACL,CAAC;IAEO,IAAI,CAAC,QAAgB,EAAE,OAAe;QAC1C,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,MAAM,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,OAAO,6BAA6B,QAAQ,MAAM,OAAO,EAAE,CAAC,CAAC;QACpG,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { type AbstractEngine } from \"core/Engines/abstractEngine.pure\";\r\nimport { type AbstractMesh } from \"core/Meshes/abstractMesh.pure\";\r\nimport { type EffectLayer } from \"core/Layers/effectLayer\";\r\nimport { type Mesh } from \"core/Meshes/mesh.pure\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { type Observer } from \"core/Misc/observable.pure\";\r\nimport { type Scene, ScenePerformancePriority } from \"core/scene.pure\";\r\nimport { type WebGPUDrawContext } from \"core/Engines/WebGPU/webgpuDrawContext\";\r\nimport { type WebGPUShaderProcessor } from \"core/Engines/WebGPU/webgpuShaderProcessor\";\r\nimport { type WebGPUPipelineContext } from \"core/Engines/WebGPU/webgpuPipelineContext\";\r\nimport { type GaussianSplattingMesh, IsGaussianSplattingClassName } from \"core/Meshes/GaussianSplatting/gaussianSplattingMesh.pure\";\r\nimport { type DrawWrapper } from \"core/Materials/drawWrapper\";\r\nimport { type Camera } from \"core/Cameras/camera.pure\";\r\nimport { type SpriteManager } from \"core/Sprites/spriteManager\";\r\nimport { type IParticleSystem } from \"core/Particles/IParticleSystem\";\r\nimport { type ParticleSystem } from \"core/Particles/particleSystem.pure\";\r\n\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { BindMorphTargetParameters } from \"core/Materials/materialHelper.functions\";\r\nimport { TmpVectors, type Matrix } from \"core/Maths/math.vector.pure\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { FrameGraphBaseLayerTask } from \"../FrameGraph/Tasks/Layers/baseLayerTask\";\r\nimport { FrameGraphUtils } from \"../FrameGraph/frameGraphUtils\";\r\n\r\n/**\r\n * Options for the snapshot rendering helper\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface SnapshotRenderingHelpersOptions {\r\n /**\r\n * Maximum number of influences for morph target managers\r\n * In FAST snapshot mode, the number of influences must be fixed and cannot change from one frame to the next.\r\n * morphTargetsNumMaxInfluences is the maximum number of non-zero influences allowed in a morph target manager.\r\n * The final value defined for a morph target manager is: Math.min(morphTargetManager.numTargets, morphTargetsNumMaxInfluences)\r\n * Default: 20\r\n */\r\n morphTargetsNumMaxInfluences?: number;\r\n}\r\n\r\n/**\r\n * A helper class to simplify work with FAST snapshot mode (WebGPU only - can be used in WebGL too, but won't do anything).\r\n */\r\nexport class SnapshotRenderingHelper {\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _options: SnapshotRenderingHelpersOptions;\r\n private readonly _onBeforeRenderObserver: Nullable<Observer<Scene>>;\r\n private _onBeforeRenderObserverUpdateLayer: Nullable<Observer<Scene>>;\r\n private readonly _onResizeObserver: Nullable<Observer<AbstractEngine>>;\r\n private _disableRenderingRefCount = 0;\r\n private _currentPerformancePriorityMode = ScenePerformancePriority.BackwardCompatible;\r\n private _pendingCurrentPerformancePriorityMode?: ScenePerformancePriority;\r\n private _isEnabling = false;\r\n private _enableCancelFunctions: Map<() => void, () => void> = new Map(); // first function is the callback, second function is the cancel function\r\n private _disableCancelFunctions: Map<() => void, () => void> = new Map(); // same as above\r\n\r\n /**\r\n * Indicates if debug logs should be displayed\r\n */\r\n public showDebugLogs = false;\r\n\r\n /**\r\n * Creates a new snapshot rendering helper\r\n * Note that creating an instance of the helper will set the snapshot rendering mode to SNAPSHOTRENDERING_FAST but will not enable snapshot rendering (engine.snapshotRendering is not updated).\r\n * Note also that fixMeshes() is called as part of the construction\r\n * @param scene The scene to use the helper in\r\n * @param options The options for the helper\r\n */\r\n constructor(scene: Scene, options?: SnapshotRenderingHelpersOptions) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._options = {\r\n morphTargetsNumMaxInfluences: 20,\r\n ...options,\r\n };\r\n\r\n this._engine.snapshotRenderingMode = Constants.SNAPSHOTRENDERING_FAST;\r\n\r\n this.fixMeshes();\r\n\r\n this._onResizeObserver = this._engine.onResizeObservable.add(() => {\r\n this._log(\"onResize\", \"start\");\r\n\r\n // enableSnapshotRendering() will delay the actual enabling of snapshot rendering by at least a frame, so these two lines are not redundant!\r\n if (this._fastSnapshotRenderingEnabled) {\r\n this.disableSnapshotRendering();\r\n this.enableSnapshotRendering();\r\n } else if (this._isEnabling) {\r\n // We are in the process of enabling snapshot rendering, but the engine got resized before we could actually enable it:\r\n // * cancel all \"enable\" pending callbacks\r\n // * increase the ref count to balance the decrease that enableSnapshotRendering() will do\r\n // * call enableSnapshotRendering() again to restart the enabling process\r\n this._enableCancelFunctions.forEach((cancel) => cancel());\r\n this._enableCancelFunctions.clear();\r\n this._disableRenderingRefCount++;\r\n this.enableSnapshotRendering();\r\n }\r\n\r\n this._log(\"onResize\", \"end\");\r\n });\r\n\r\n this._onBeforeRenderObserver = this._scene.onBeforeRenderObservable.add(() => {\r\n if (!this._fastSnapshotRenderingEnabled) {\r\n return;\r\n }\r\n\r\n // Animates skeletons\r\n for (const skeleton of scene.skeletons) {\r\n skeleton.prepare(true);\r\n }\r\n\r\n // Handles meshes\r\n for (const mesh of scene.meshes) {\r\n if (mesh.infiniteDistance) {\r\n mesh.transferToEffect(mesh.computeWorldMatrix(true));\r\n }\r\n\r\n if (mesh.skeleton) {\r\n mesh.transferToEffect(mesh.computeWorldMatrix(true));\r\n }\r\n\r\n if (IsGaussianSplattingClassName(mesh.getClassName())) {\r\n (mesh as GaussianSplattingMesh)._postToWorker();\r\n }\r\n\r\n if (mesh.morphTargetManager && mesh.subMeshes) {\r\n // Make sure morph target animations work\r\n for (const subMesh of mesh.subMeshes) {\r\n const dw = subMesh._drawWrapper;\r\n const effect = dw.effect;\r\n if (effect) {\r\n const dataBuffer = (dw.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (dataBuffer && ubLeftOver && ubLeftOver.setDataBuffer(dataBuffer)) {\r\n mesh.morphTargetManager._bind(effect);\r\n BindMorphTargetParameters(mesh, effect);\r\n ubLeftOver.update();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Handles sprite renderers\r\n let camera = scene.activeCamera;\r\n if (scene.frameGraph) {\r\n camera = FrameGraphUtils.FindMainCamera(scene.frameGraph) || camera;\r\n }\r\n if (scene.spriteManagers && camera) {\r\n for (const imanager of scene.spriteManagers) {\r\n const manager = imanager as SpriteManager;\r\n const renderer = manager.spriteRenderer;\r\n\r\n this._spriteRendererUpdateEffects(renderer._drawWrapperBase, renderer._drawWrapperDepth, camera);\r\n }\r\n }\r\n\r\n // Handles fixed-capacity particle systems\r\n if (scene.particleSystems && camera) {\r\n for (const ps of scene.particleSystems) {\r\n const particleSystem = ps as ParticleSystem;\r\n if (particleSystem._useFixedCapacityForSnapshot) {\r\n this._updateFixedCapacityParticleSystem(particleSystem, camera);\r\n }\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Gets a value indicating if the helper is in a steady state (not in the process of enabling snapshot rendering).\r\n */\r\n public get isReady() {\r\n return !this._isEnabling;\r\n }\r\n\r\n /**\r\n * Enable snapshot rendering\r\n * Use this method instead of engine.snapshotRendering=true, to make sure everything is ready before enabling snapshot rendering.\r\n * Note that this method is ref-counted and works in pair with disableSnapshotRendering(): you should call enableSnapshotRendering() as many times as you call disableSnapshotRendering().\r\n * @param debugMessage An optional message to display in debug logs to help identify the context of the call to enableSnapshotRendering\r\n */\r\n public enableSnapshotRendering(debugMessage?: string) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._log(\"enableSnapshotRendering\", `called (refCount: ${this._disableRenderingRefCount - 1})${debugMessage ? ` - ${debugMessage}` : \"\"}`);\r\n\r\n if (--this._disableRenderingRefCount > 0) {\r\n return;\r\n }\r\n\r\n this._log(\"enableSnapshotRendering\", `execute`);\r\n\r\n if (this._disableCancelFunctions.size > 0) {\r\n this._log(\"enableSnapshotRendering\", `cancelling ${this._disableCancelFunctions.size} \"disable\" callbacks`);\r\n }\r\n\r\n this._disableCancelFunctions.forEach((cancel) => cancel());\r\n this._disableCancelFunctions.clear();\r\n\r\n this._isEnabling = true;\r\n this._disableRenderingRefCount = 0;\r\n\r\n this._currentPerformancePriorityMode = this._pendingCurrentPerformancePriorityMode ?? this._scene.performancePriority;\r\n this._pendingCurrentPerformancePriorityMode = undefined;\r\n this._scene.performancePriority = ScenePerformancePriority.BackwardCompatible;\r\n\r\n const callbackWhenSceneReady = () => {\r\n this._enableCancelFunctions.delete(callbackWhenSceneReady);\r\n\r\n // Make sure a full frame is rendered before enabling snapshot rendering, so use \"+2\" instead of \"+1\"\r\n const targetFrameId = this._engine.frameId + 2;\r\n\r\n this._log(\"enableSnapshotRendering\", `scene ready, add callbacks for frames ${targetFrameId} and ${targetFrameId + 1}`);\r\n\r\n this._executeAtFrame(targetFrameId, () => {\r\n this._log(\"enableSnapshotRendering\", `callback #1, enable snapshot rendering at the engine level`);\r\n this._engine.snapshotRendering = true;\r\n });\r\n\r\n // Render one frame with snapshot rendering enabled to make sure everything is ready\r\n this._executeAtFrame(targetFrameId + 1, () => {\r\n this._log(\"enableSnapshotRendering\", `callback #2, signals that snapshot rendering helper is ready`);\r\n this._isEnabling = false;\r\n });\r\n };\r\n\r\n this._enableCancelFunctions.set(callbackWhenSceneReady, () => this._scene.onReadyObservable.removeCallback(callbackWhenSceneReady));\r\n\r\n this._scene.executeWhenReady(callbackWhenSceneReady);\r\n }\r\n\r\n /**\r\n * Disable snapshot rendering\r\n * Note that this method is ref-counted and works in pair with enableSnapshotRendering(): you should call enableSnapshotRendering() as many times as you call disableSnapshotRendering().\r\n * @param debugMessage An optional message to display in debug logs to help identify the context of the call to disableSnapshotRendering\r\n */\r\n public disableSnapshotRendering(debugMessage?: string) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._log(\r\n \"disableSnapshotRendering\",\r\n `called (refCount: ${this._disableRenderingRefCount === 0 ? 0 : this._disableRenderingRefCount + 1})${debugMessage ? ` - ${debugMessage}` : \"\"}`\r\n );\r\n\r\n if (this._disableRenderingRefCount === 0) {\r\n this._log(\"disableSnapshotRendering\", `execute (refCount set to 1 after execution)`);\r\n\r\n if (this._enableCancelFunctions.size > 0) {\r\n this._log(\"disableSnapshotRendering\", `cancelling ${this._enableCancelFunctions.size} \"enable\" callbacks`);\r\n }\r\n\r\n this._enableCancelFunctions.forEach((cancel) => cancel());\r\n this._enableCancelFunctions.clear();\r\n\r\n this._isEnabling = false;\r\n\r\n // Snapshot rendering switches from enabled to disabled\r\n // We reset the performance priority mode to that which it was before enabling snapshot rendering, but first set it to “BackwardCompatible” to allow the system to regenerate resources that may have been optimized for snapshot rendering.\r\n // We'll then restore the original mode at the next frame.\r\n this._scene.performancePriority = ScenePerformancePriority.BackwardCompatible;\r\n if (this._currentPerformancePriorityMode !== ScenePerformancePriority.BackwardCompatible) {\r\n this._log(\r\n \"disableSnapshotRendering\",\r\n `makes sure that the scene is rendered once in BackwardCompatible mode (code: ${ScenePerformancePriority.BackwardCompatible}) before switching to mode ${this._currentPerformancePriorityMode}`\r\n );\r\n\r\n this._pendingCurrentPerformancePriorityMode = this._currentPerformancePriorityMode;\r\n\r\n const callbackWhenSceneReady = () => {\r\n this._log(\"disableSnapshotRendering\", `scene ready, add callback for frame ${this._engine.frameId + 2}`);\r\n\r\n this._executeAtFrame(\r\n this._engine.frameId + 2,\r\n () => {\r\n this._log(\"disableSnapshotRendering\", `switching to performance priority mode ${this._pendingCurrentPerformancePriorityMode}`);\r\n this._scene.performancePriority = this._pendingCurrentPerformancePriorityMode!;\r\n this._pendingCurrentPerformancePriorityMode = undefined;\r\n },\r\n \"whenDisabled\"\r\n );\r\n };\r\n\r\n this._disableCancelFunctions.set(callbackWhenSceneReady, () => this._scene.onReadyObservable.removeCallback(callbackWhenSceneReady));\r\n\r\n this._scene.executeWhenReady(callbackWhenSceneReady);\r\n }\r\n }\r\n\r\n this._engine.snapshotRendering = false;\r\n this._disableRenderingRefCount++;\r\n }\r\n\r\n /**\r\n * Fix meshes for snapshot rendering.\r\n * This method will make sure that some features are disabled or fixed to make sure snapshot rendering works correctly.\r\n * @param meshes List of meshes to fix. If not provided, all meshes in the scene will be fixed.\r\n */\r\n public fixMeshes(meshes?: AbstractMesh[]) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n meshes = meshes || this._scene.meshes;\r\n\r\n for (const mesh of meshes) {\r\n (mesh as Mesh).ignoreCameraMaxZ = false;\r\n if (mesh.morphTargetManager) {\r\n mesh.morphTargetManager.numMaxInfluencers = Math.min(mesh.morphTargetManager.numTargets, this._options.morphTargetsNumMaxInfluences!);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call this method to update a mesh on the GPU after some properties have changed (position, rotation, scaling).\r\n * Note: in FAST snapshot mode the GPU bundle is recorded once and replayed every frame, so draw calls\r\n * (including instance counts) are baked in. This method updates per-mesh GPU data such as transforms and\r\n * `mesh.visibility`, but it cannot change whether a recorded draw call is emitted. To apply changes such as\r\n * `mesh.isVisible`, `setEnabled(false)`, or per-instance visibility/state changes that affect instance counts,\r\n * wrap the change in a disableSnapshotRendering() / enableSnapshotRendering() pair so the snapshot is\r\n * re-recorded.\r\n * @param mesh The mesh to update. Can be a single mesh or an array of meshes to update.\r\n * @param updateInstancedMeshes If true, the method will also update instanced meshes. Default is true. If you know instanced meshes won't move (or you don't have instanced meshes), you can set this to false to save some CPU time.\r\n */\r\n public updateMesh(mesh: AbstractMesh | AbstractMesh[], updateInstancedMeshes = true) {\r\n if (!this._fastSnapshotRenderingEnabled) {\r\n return;\r\n }\r\n\r\n if (Array.isArray(mesh)) {\r\n for (const m of mesh) {\r\n if (!updateInstancedMeshes || !this._updateInstancedMesh(m)) {\r\n m.transferToEffect(m.computeWorldMatrix());\r\n }\r\n }\r\n return;\r\n }\r\n\r\n if (!updateInstancedMeshes || !this._updateInstancedMesh(mesh)) {\r\n mesh.transferToEffect(mesh.computeWorldMatrix());\r\n }\r\n }\r\n\r\n private _updateInstancedMesh(mesh: AbstractMesh) {\r\n if (mesh.hasInstances) {\r\n if (mesh.subMeshes) {\r\n const sourceMesh = mesh as Mesh;\r\n for (const subMesh of sourceMesh.subMeshes) {\r\n const batch = sourceMesh._getInstancesRenderList(subMesh._id);\r\n sourceMesh._updateInstancedBuffers(subMesh, batch, batch.parent.instancesBufferSize, this._engine);\r\n }\r\n }\r\n return true;\r\n } else if (mesh.isAnInstance) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Update the meshes used in an effect layer to ensure that snapshot rendering works correctly for these meshes in this layer.\r\n * @param layer The effect layer or frame graph layer\r\n * @param autoUpdate If true, the helper will automatically update the meshes of the layer with each frame. If false, you'll need to call this method manually when the camera or layer meshes move or rotate.\r\n */\r\n public updateMeshesForEffectLayer(layer: EffectLayer | FrameGraphBaseLayerTask, autoUpdate = true) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n const renderPassId = layer instanceof FrameGraphBaseLayerTask ? layer.objectRendererForLayer.objectRenderer.renderPassId : layer.mainTexture.renderPassId;\r\n\r\n if (autoUpdate) {\r\n this._onBeforeRenderObserverUpdateLayer = this._scene.onBeforeRenderObservable.add(() => {\r\n this._updateMeshMatricesForRenderPassId(renderPassId);\r\n });\r\n } else {\r\n this._updateMeshMatricesForRenderPassId(renderPassId);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the helper\r\n */\r\n public dispose() {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserverUpdateLayer);\r\n this._engine.onResizeObservable.remove(this._onResizeObserver);\r\n }\r\n\r\n private get _fastSnapshotRenderingEnabled() {\r\n return this._engine.snapshotRendering && this._engine.snapshotRenderingMode === Constants.SNAPSHOTRENDERING_FAST;\r\n }\r\n\r\n private _updateMeshMatricesForRenderPassId(renderPassId: number) {\r\n if (!this._fastSnapshotRenderingEnabled) {\r\n return;\r\n }\r\n\r\n const sceneTransformationMatrix =\r\n this._scene.objectRenderers.find((renderer) => renderer.renderPassId === renderPassId)?.activeCamera?.getTransformationMatrix() ?? this._scene.getTransformMatrix();\r\n\r\n for (let i = 0; i < this._scene.meshes.length; ++i) {\r\n const mesh = this._scene.meshes[i];\r\n if (!mesh.subMeshes) {\r\n continue;\r\n }\r\n\r\n for (let j = 0; j < mesh.subMeshes.length; ++j) {\r\n const dw = mesh.subMeshes[j]._getDrawWrapper(renderPassId);\r\n const effect = dw?.effect;\r\n if (effect) {\r\n const dataBuffer = (dw.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (dataBuffer && ubLeftOver && ubLeftOver.setDataBuffer(dataBuffer)) {\r\n effect.setMatrix(\"viewProjection\", sceneTransformationMatrix);\r\n effect.setMatrix(\"world\", mesh.computeWorldMatrix());\r\n ubLeftOver.update();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _spriteRendererDirectMatrixUpdate(dw: DrawWrapper, camera: Camera) {\r\n const effect = dw?.effect;\r\n if (effect) {\r\n const dataBuffer = (dw.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (dataBuffer && ubLeftOver && ubLeftOver.setDataBuffer(dataBuffer)) {\r\n effect.setMatrix(\"view\", camera.getViewMatrix());\r\n effect.setMatrix(\"projection\", camera.getProjectionMatrix());\r\n ubLeftOver.update();\r\n }\r\n }\r\n }\r\n\r\n private _spriteRendererUpdateEffects(drawWrapperBase: DrawWrapper, drawWrapperDepth: DrawWrapper, camera: Camera) {\r\n this._spriteRendererDirectMatrixUpdate(drawWrapperBase, camera);\r\n this._spriteRendererDirectMatrixUpdate(drawWrapperDepth, camera);\r\n }\r\n\r\n /**\r\n * Make a CPU particle system compatible with FAST snapshot rendering.\r\n * The particle system will always render at full capacity (`getCapacity()` quads), with inactive slots collapsed\r\n * to degenerate triangles via zero-fill. This keeps the recorded GPU bundle's draw call valid every frame, while\r\n * the live particle data is uploaded to the bundle-referenced vertex buffer through the normal `animate()` path.\r\n *\r\n * The helper additionally advances the particle simulation and updates view/projection (and `eyePosition`/`invView`\r\n * for billboard modes) into the particle system's draw wrappers each frame, because FAST snapshot replay skips the\r\n * normal scene particle evaluation path after the bundle is recorded.\r\n *\r\n * Notes:\r\n * - Call this BEFORE `enableSnapshotRendering()` so the recording sees the correct draw count.\r\n * - GPU particle systems (`GPUParticleSystem`) are not supported by this method.\r\n * - Vertex shader cost scales with `getCapacity()` rather than the live particle count, so size capacity realistically.\r\n * - Per-frame uniforms other than camera matrices (e.g. `textureMask`, `translationPivot`, clip planes, fog) are\r\n * baked at recording time and will not update during snapshot replay.\r\n * @param particleSystem The particle system to fix\r\n */\r\n public fixParticleSystem(particleSystem: IParticleSystem): void {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n if (particleSystem.getClassName() !== \"ParticleSystem\") {\r\n this._log(\"fixParticleSystem\", `skipping ${particleSystem.name}: only CPU ParticleSystem is supported (got ${particleSystem.getClassName()})`);\r\n return;\r\n }\r\n\r\n const ps = particleSystem as ParticleSystem;\r\n const fixedCapacityInitialized = ps._initFixedCapacitySnapshotData();\r\n\r\n // The recorded bundle bakes in the draw-call vertex/instance count. If snapshot rendering is already active\r\n // (or in the process of being enabled) when we flip the flag, the bundle was recorded with the live particle\r\n // count and is now stale. Cycle disable/enable so the next recording picks up the fixed-capacity draw count.\r\n if (fixedCapacityInitialized && (this._fastSnapshotRenderingEnabled || this._isEnabling)) {\r\n Logger.Warn(\r\n `SnapshotRenderingHelper.fixParticleSystem(\"${particleSystem.name}\") was called after snapshot rendering was enabled. ` +\r\n `Forcing a re-record so the bundle uses the fixed-capacity draw count. Call fixParticleSystem before enableSnapshotRendering to avoid this.`\r\n );\r\n this.disableSnapshotRendering(\"fixParticleSystem auto-recover\");\r\n this.enableSnapshotRendering(\"fixParticleSystem auto-recover\");\r\n }\r\n }\r\n\r\n private _updateFixedCapacityParticleSystem(ps: ParticleSystem, camera: Camera): void {\r\n if (!this._scene.particlesEnabled || !ps.isStarted() || !ps.emitter) {\r\n ps._clearFixedCapacitySnapshotData();\r\n return;\r\n }\r\n\r\n const emitter = ps.emitter as { position?: unknown; isEnabled?: () => boolean };\r\n if (!emitter.position || emitter.isEnabled?.()) {\r\n ps.animate();\r\n this._particleSystemUpdateEffects(ps, camera);\r\n } else {\r\n ps._clearFixedCapacitySnapshotData();\r\n }\r\n }\r\n\r\n private _particleSystemUpdateEffects(ps: ParticleSystem, camera: Camera) {\r\n const drawWrappers = (ps as unknown as { _drawWrappers: DrawWrapper[][] })._drawWrappers;\r\n if (!drawWrappers) {\r\n return;\r\n }\r\n\r\n const viewMatrix = ps.defaultViewMatrix ?? camera.getViewMatrix();\r\n const projectionMatrix = ps.defaultProjectionMatrix ?? camera.getProjectionMatrix();\r\n // Compute invView lazily once per system per frame, only if any draw wrapper actually needs it.\r\n let invViewMatrix: Nullable<Matrix> = null;\r\n\r\n for (const perPass of drawWrappers) {\r\n if (!perPass) {\r\n continue;\r\n }\r\n for (const dw of perPass) {\r\n invViewMatrix = this._particleSystemDirectMatrixUpdate(dw, viewMatrix, projectionMatrix, camera, invViewMatrix);\r\n }\r\n }\r\n }\r\n\r\n private _particleSystemBillboardFlags = new WeakMap<object, { billboard: boolean; billboardAll: boolean }>();\r\n\r\n private _particleSystemDirectMatrixUpdate(\r\n dw: Nullable<DrawWrapper>,\r\n viewMatrix: Matrix,\r\n projectionMatrix: Matrix,\r\n camera: Camera,\r\n invViewMatrix: Nullable<Matrix>\r\n ): Nullable<Matrix> {\r\n const effect = dw?.effect;\r\n if (!effect) {\r\n return invViewMatrix;\r\n }\r\n const dataBuffer = (dw!.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (!dataBuffer || !ubLeftOver || !ubLeftOver.setDataBuffer(dataBuffer)) {\r\n return invViewMatrix;\r\n }\r\n effect.setMatrix(\"view\", viewMatrix);\r\n effect.setMatrix(\"projection\", projectionMatrix);\r\n let flags = this._particleSystemBillboardFlags.get(effect);\r\n if (!flags) {\r\n const defines = effect.defines ?? \"\";\r\n flags = { billboard: defines.indexOf(\"#define BILLBOARD\") >= 0, billboardAll: defines.indexOf(\"#define BILLBOARDMODE_ALL\") >= 0 };\r\n this._particleSystemBillboardFlags.set(effect, flags);\r\n }\r\n if (flags.billboard) {\r\n effect.setVector3(\"eyePosition\", camera.globalPosition);\r\n }\r\n if (flags.billboardAll) {\r\n if (!invViewMatrix) {\r\n invViewMatrix = TmpVectors.Matrix[0];\r\n viewMatrix.invertToRef(invViewMatrix);\r\n }\r\n effect.setMatrix(\"invView\", invViewMatrix);\r\n }\r\n ubLeftOver.update();\r\n\r\n return invViewMatrix;\r\n }\r\n\r\n private _executeAtFrame(frameId: number, func: () => void, mode: \"whenEnabled\" | \"whenDisabled\" = \"whenEnabled\") {\r\n const callback = () => {\r\n if (this._engine.frameId >= frameId) {\r\n this._engine.onEndFrameObservable.remove(obs);\r\n if (mode === \"whenEnabled\") {\r\n this._enableCancelFunctions.delete(callback);\r\n } else {\r\n this._disableCancelFunctions.delete(callback);\r\n }\r\n func();\r\n }\r\n };\r\n\r\n const obs = this._engine.onEndFrameObservable.add(callback);\r\n if (mode === \"whenEnabled\") {\r\n this._enableCancelFunctions.set(callback, () => this._engine.onEndFrameObservable.remove(obs));\r\n } else {\r\n this._disableCancelFunctions.set(callback, () => this._engine.onEndFrameObservable.remove(obs));\r\n }\r\n }\r\n\r\n private _log(funcName: string, message: string) {\r\n if (this.showDebugLogs) {\r\n Logger.Log(`[Frame: ${this._engine.frameId}] SnapshotRenderingHelper:${funcName} - ${message}`);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"snapshotRenderingHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/snapshotRenderingHelper.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,wBAAwB,EAAE,MAAM,2DAA2D,CAAC;AAOrG,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,UAAU,EAAe,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAiBhE;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAmBhC;;;;;;OAMG;IACH,YAAY,KAAY,EAAE,OAAyC;QAnB3D,8BAAyB,GAAG,CAAC,CAAC;QAC9B,oCAA+B,uDAA+C;QAE9E,gBAAW,GAAG,KAAK,CAAC;QACpB,2BAAsB,GAAgC,IAAI,GAAG,EAAE,CAAC,CAAC,yEAAyE;QAC1I,4BAAuB,GAAgC,IAAI,GAAG,EAAE,CAAC,CAAC,gBAAgB;QAE1F;;WAEG;QACI,kB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,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACpG,CAAC;IACL,CAAC;IAEO,IAAI,CAAC,QAAgB,EAAE,OAAe;QAC1C,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,MAAM,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,OAAO,6BAA6B,QAAQ,MAAM,OAAO,EAAE,CAAC,CAAC;QACpG,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { type AbstractEngine } from \"core/Engines/abstractEngine.pure\";\r\nimport { type AbstractMesh } from \"core/Meshes/abstractMesh.pure\";\r\nimport { type EffectLayer } from \"core/Layers/effectLayer\";\r\nimport { type Mesh } from \"core/Meshes/mesh.pure\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { type Observer } from \"core/Misc/observable.pure\";\r\nimport { type Scene, ScenePerformancePriority } from \"core/scene.pure\";\r\nimport { type WebGPUDrawContext } from \"core/Engines/WebGPU/webgpuDrawContext\";\r\nimport { type WebGPUShaderProcessor } from \"core/Engines/WebGPU/webgpuShaderProcessor\";\r\nimport { type WebGPUPipelineContext } from \"core/Engines/WebGPU/webgpuPipelineContext\";\r\nimport { type GaussianSplattingMesh } from \"core/Meshes/GaussianSplatting/gaussianSplattingMesh.pure\";\r\nimport { _IsGaussianSplattingMesh } from \"core/Meshes/GaussianSplatting/gaussianSplatting.functions\";\r\nimport { type DrawWrapper } from \"core/Materials/drawWrapper\";\r\nimport { type Camera } from \"core/Cameras/camera.pure\";\r\nimport { type SpriteManager } from \"core/Sprites/spriteManager\";\r\nimport { type IParticleSystem } from \"core/Particles/IParticleSystem\";\r\nimport { type ParticleSystem } from \"core/Particles/particleSystem.pure\";\r\n\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { BindMorphTargetParameters } from \"core/Materials/materialHelper.functions\";\r\nimport { TmpVectors, type Matrix } from \"core/Maths/math.vector.pure\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { FrameGraphBaseLayerTask } from \"../FrameGraph/Tasks/Layers/baseLayerTask\";\r\nimport { FrameGraphUtils } from \"../FrameGraph/frameGraphUtils\";\r\n\r\n/**\r\n * Options for the snapshot rendering helper\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface SnapshotRenderingHelpersOptions {\r\n /**\r\n * Maximum number of influences for morph target managers\r\n * In FAST snapshot mode, the number of influences must be fixed and cannot change from one frame to the next.\r\n * morphTargetsNumMaxInfluences is the maximum number of non-zero influences allowed in a morph target manager.\r\n * The final value defined for a morph target manager is: Math.min(morphTargetManager.numTargets, morphTargetsNumMaxInfluences)\r\n * Default: 20\r\n */\r\n morphTargetsNumMaxInfluences?: number;\r\n}\r\n\r\n/**\r\n * A helper class to simplify work with FAST snapshot mode (WebGPU only - can be used in WebGL too, but won't do anything).\r\n */\r\nexport class SnapshotRenderingHelper {\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _options: SnapshotRenderingHelpersOptions;\r\n private readonly _onBeforeRenderObserver: Nullable<Observer<Scene>>;\r\n private _onBeforeRenderObserverUpdateLayer: Nullable<Observer<Scene>>;\r\n private readonly _onResizeObserver: Nullable<Observer<AbstractEngine>>;\r\n private _disableRenderingRefCount = 0;\r\n private _currentPerformancePriorityMode = ScenePerformancePriority.BackwardCompatible;\r\n private _pendingCurrentPerformancePriorityMode?: ScenePerformancePriority;\r\n private _isEnabling = false;\r\n private _enableCancelFunctions: Map<() => void, () => void> = new Map(); // first function is the callback, second function is the cancel function\r\n private _disableCancelFunctions: Map<() => void, () => void> = new Map(); // same as above\r\n\r\n /**\r\n * Indicates if debug logs should be displayed\r\n */\r\n public showDebugLogs = false;\r\n\r\n /**\r\n * Creates a new snapshot rendering helper\r\n * Note that creating an instance of the helper will set the snapshot rendering mode to SNAPSHOTRENDERING_FAST but will not enable snapshot rendering (engine.snapshotRendering is not updated).\r\n * Note also that fixMeshes() is called as part of the construction\r\n * @param scene The scene to use the helper in\r\n * @param options The options for the helper\r\n */\r\n constructor(scene: Scene, options?: SnapshotRenderingHelpersOptions) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._options = {\r\n morphTargetsNumMaxInfluences: 20,\r\n ...options,\r\n };\r\n\r\n this._engine.snapshotRenderingMode = Constants.SNAPSHOTRENDERING_FAST;\r\n\r\n this.fixMeshes();\r\n\r\n this._onResizeObserver = this._engine.onResizeObservable.add(() => {\r\n this._log(\"onResize\", \"start\");\r\n\r\n // enableSnapshotRendering() will delay the actual enabling of snapshot rendering by at least a frame, so these two lines are not redundant!\r\n if (this._fastSnapshotRenderingEnabled) {\r\n this.disableSnapshotRendering();\r\n this.enableSnapshotRendering();\r\n } else if (this._isEnabling) {\r\n // We are in the process of enabling snapshot rendering, but the engine got resized before we could actually enable it:\r\n // * cancel all \"enable\" pending callbacks\r\n // * increase the ref count to balance the decrease that enableSnapshotRendering() will do\r\n // * call enableSnapshotRendering() again to restart the enabling process\r\n this._enableCancelFunctions.forEach((cancel) => cancel());\r\n this._enableCancelFunctions.clear();\r\n this._disableRenderingRefCount++;\r\n this.enableSnapshotRendering();\r\n }\r\n\r\n this._log(\"onResize\", \"end\");\r\n });\r\n\r\n this._onBeforeRenderObserver = this._scene.onBeforeRenderObservable.add(() => {\r\n if (!this._fastSnapshotRenderingEnabled) {\r\n return;\r\n }\r\n\r\n // Animates skeletons\r\n for (const skeleton of scene.skeletons) {\r\n skeleton.prepare(true);\r\n }\r\n\r\n // Handles meshes\r\n for (const mesh of scene.meshes) {\r\n if (mesh.infiniteDistance) {\r\n mesh.transferToEffect(mesh.computeWorldMatrix(true));\r\n }\r\n\r\n if (mesh.skeleton) {\r\n mesh.transferToEffect(mesh.computeWorldMatrix(true));\r\n }\r\n\r\n if (_IsGaussianSplattingMesh(mesh)) {\r\n (mesh as GaussianSplattingMesh)._postToWorker();\r\n }\r\n\r\n if (mesh.morphTargetManager && mesh.subMeshes) {\r\n // Make sure morph target animations work\r\n for (const subMesh of mesh.subMeshes) {\r\n const dw = subMesh._drawWrapper;\r\n const effect = dw.effect;\r\n if (effect) {\r\n const dataBuffer = (dw.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (dataBuffer && ubLeftOver && ubLeftOver.setDataBuffer(dataBuffer)) {\r\n mesh.morphTargetManager._bind(effect);\r\n BindMorphTargetParameters(mesh, effect);\r\n ubLeftOver.update();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Handles sprite renderers\r\n let camera = scene.activeCamera;\r\n if (scene.frameGraph) {\r\n camera = FrameGraphUtils.FindMainCamera(scene.frameGraph) || camera;\r\n }\r\n if (scene.spriteManagers && camera) {\r\n for (const imanager of scene.spriteManagers) {\r\n const manager = imanager as SpriteManager;\r\n const renderer = manager.spriteRenderer;\r\n\r\n this._spriteRendererUpdateEffects(renderer._drawWrapperBase, renderer._drawWrapperDepth, camera);\r\n }\r\n }\r\n\r\n // Handles fixed-capacity particle systems\r\n if (scene.particleSystems && camera) {\r\n for (const ps of scene.particleSystems) {\r\n const particleSystem = ps as ParticleSystem;\r\n if (particleSystem._useFixedCapacityForSnapshot) {\r\n this._updateFixedCapacityParticleSystem(particleSystem, camera);\r\n }\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Gets a value indicating if the helper is in a steady state (not in the process of enabling snapshot rendering).\r\n */\r\n public get isReady() {\r\n return !this._isEnabling;\r\n }\r\n\r\n /**\r\n * Enable snapshot rendering\r\n * Use this method instead of engine.snapshotRendering=true, to make sure everything is ready before enabling snapshot rendering.\r\n * Note that this method is ref-counted and works in pair with disableSnapshotRendering(): you should call enableSnapshotRendering() as many times as you call disableSnapshotRendering().\r\n * @param debugMessage An optional message to display in debug logs to help identify the context of the call to enableSnapshotRendering\r\n */\r\n public enableSnapshotRendering(debugMessage?: string) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._log(\"enableSnapshotRendering\", `called (refCount: ${this._disableRenderingRefCount - 1})${debugMessage ? ` - ${debugMessage}` : \"\"}`);\r\n\r\n if (--this._disableRenderingRefCount > 0) {\r\n return;\r\n }\r\n\r\n this._log(\"enableSnapshotRendering\", `execute`);\r\n\r\n if (this._disableCancelFunctions.size > 0) {\r\n this._log(\"enableSnapshotRendering\", `cancelling ${this._disableCancelFunctions.size} \"disable\" callbacks`);\r\n }\r\n\r\n this._disableCancelFunctions.forEach((cancel) => cancel());\r\n this._disableCancelFunctions.clear();\r\n\r\n this._isEnabling = true;\r\n this._disableRenderingRefCount = 0;\r\n\r\n this._currentPerformancePriorityMode = this._pendingCurrentPerformancePriorityMode ?? this._scene.performancePriority;\r\n this._pendingCurrentPerformancePriorityMode = undefined;\r\n this._scene.performancePriority = ScenePerformancePriority.BackwardCompatible;\r\n\r\n const callbackWhenSceneReady = () => {\r\n this._enableCancelFunctions.delete(callbackWhenSceneReady);\r\n\r\n // Make sure a full frame is rendered before enabling snapshot rendering, so use \"+2\" instead of \"+1\"\r\n const targetFrameId = this._engine.frameId + 2;\r\n\r\n this._log(\"enableSnapshotRendering\", `scene ready, add callbacks for frames ${targetFrameId} and ${targetFrameId + 1}`);\r\n\r\n this._executeAtFrame(targetFrameId, () => {\r\n this._log(\"enableSnapshotRendering\", `callback #1, enable snapshot rendering at the engine level`);\r\n this._engine.snapshotRendering = true;\r\n });\r\n\r\n // Render one frame with snapshot rendering enabled to make sure everything is ready\r\n this._executeAtFrame(targetFrameId + 1, () => {\r\n this._log(\"enableSnapshotRendering\", `callback #2, signals that snapshot rendering helper is ready`);\r\n this._isEnabling = false;\r\n });\r\n };\r\n\r\n this._enableCancelFunctions.set(callbackWhenSceneReady, () => this._scene.onReadyObservable.removeCallback(callbackWhenSceneReady));\r\n\r\n this._scene.executeWhenReady(callbackWhenSceneReady);\r\n }\r\n\r\n /**\r\n * Disable snapshot rendering\r\n * Note that this method is ref-counted and works in pair with enableSnapshotRendering(): you should call enableSnapshotRendering() as many times as you call disableSnapshotRendering().\r\n * @param debugMessage An optional message to display in debug logs to help identify the context of the call to disableSnapshotRendering\r\n */\r\n public disableSnapshotRendering(debugMessage?: string) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._log(\r\n \"disableSnapshotRendering\",\r\n `called (refCount: ${this._disableRenderingRefCount === 0 ? 0 : this._disableRenderingRefCount + 1})${debugMessage ? ` - ${debugMessage}` : \"\"}`\r\n );\r\n\r\n if (this._disableRenderingRefCount === 0) {\r\n this._log(\"disableSnapshotRendering\", `execute (refCount set to 1 after execution)`);\r\n\r\n if (this._enableCancelFunctions.size > 0) {\r\n this._log(\"disableSnapshotRendering\", `cancelling ${this._enableCancelFunctions.size} \"enable\" callbacks`);\r\n }\r\n\r\n this._enableCancelFunctions.forEach((cancel) => cancel());\r\n this._enableCancelFunctions.clear();\r\n\r\n this._isEnabling = false;\r\n\r\n // Snapshot rendering switches from enabled to disabled\r\n // We reset the performance priority mode to that which it was before enabling snapshot rendering, but first set it to “BackwardCompatible” to allow the system to regenerate resources that may have been optimized for snapshot rendering.\r\n // We'll then restore the original mode at the next frame.\r\n this._scene.performancePriority = ScenePerformancePriority.BackwardCompatible;\r\n if (this._currentPerformancePriorityMode !== ScenePerformancePriority.BackwardCompatible) {\r\n this._log(\r\n \"disableSnapshotRendering\",\r\n `makes sure that the scene is rendered once in BackwardCompatible mode (code: ${ScenePerformancePriority.BackwardCompatible}) before switching to mode ${this._currentPerformancePriorityMode}`\r\n );\r\n\r\n this._pendingCurrentPerformancePriorityMode = this._currentPerformancePriorityMode;\r\n\r\n const callbackWhenSceneReady = () => {\r\n this._log(\"disableSnapshotRendering\", `scene ready, add callback for frame ${this._engine.frameId + 2}`);\r\n\r\n this._executeAtFrame(\r\n this._engine.frameId + 2,\r\n () => {\r\n this._log(\"disableSnapshotRendering\", `switching to performance priority mode ${this._pendingCurrentPerformancePriorityMode}`);\r\n this._scene.performancePriority = this._pendingCurrentPerformancePriorityMode!;\r\n this._pendingCurrentPerformancePriorityMode = undefined;\r\n },\r\n \"whenDisabled\"\r\n );\r\n };\r\n\r\n this._disableCancelFunctions.set(callbackWhenSceneReady, () => this._scene.onReadyObservable.removeCallback(callbackWhenSceneReady));\r\n\r\n this._scene.executeWhenReady(callbackWhenSceneReady);\r\n }\r\n }\r\n\r\n this._engine.snapshotRendering = false;\r\n this._disableRenderingRefCount++;\r\n }\r\n\r\n /**\r\n * Fix meshes for snapshot rendering.\r\n * This method will make sure that some features are disabled or fixed to make sure snapshot rendering works correctly.\r\n * @param meshes List of meshes to fix. If not provided, all meshes in the scene will be fixed.\r\n */\r\n public fixMeshes(meshes?: AbstractMesh[]) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n meshes = meshes || this._scene.meshes;\r\n\r\n for (const mesh of meshes) {\r\n (mesh as Mesh).ignoreCameraMaxZ = false;\r\n if (mesh.morphTargetManager) {\r\n mesh.morphTargetManager.numMaxInfluencers = Math.min(mesh.morphTargetManager.numTargets, this._options.morphTargetsNumMaxInfluences!);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call this method to update a mesh on the GPU after some properties have changed (position, rotation, scaling).\r\n * Note: in FAST snapshot mode the GPU bundle is recorded once and replayed every frame, so draw calls\r\n * (including instance counts) are baked in. This method updates per-mesh GPU data such as transforms and\r\n * `mesh.visibility`, but it cannot change whether a recorded draw call is emitted. To apply changes such as\r\n * `mesh.isVisible`, `setEnabled(false)`, or per-instance visibility/state changes that affect instance counts,\r\n * wrap the change in a disableSnapshotRendering() / enableSnapshotRendering() pair so the snapshot is\r\n * re-recorded.\r\n * @param mesh The mesh to update. Can be a single mesh or an array of meshes to update.\r\n * @param updateInstancedMeshes If true, the method will also update instanced meshes. Default is true. If you know instanced meshes won't move (or you don't have instanced meshes), you can set this to false to save some CPU time.\r\n */\r\n public updateMesh(mesh: AbstractMesh | AbstractMesh[], updateInstancedMeshes = true) {\r\n if (!this._fastSnapshotRenderingEnabled) {\r\n return;\r\n }\r\n\r\n if (Array.isArray(mesh)) {\r\n for (const m of mesh) {\r\n if (!updateInstancedMeshes || !this._updateInstancedMesh(m)) {\r\n m.transferToEffect(m.computeWorldMatrix());\r\n }\r\n }\r\n return;\r\n }\r\n\r\n if (!updateInstancedMeshes || !this._updateInstancedMesh(mesh)) {\r\n mesh.transferToEffect(mesh.computeWorldMatrix());\r\n }\r\n }\r\n\r\n private _updateInstancedMesh(mesh: AbstractMesh) {\r\n if (mesh.hasInstances) {\r\n if (mesh.subMeshes) {\r\n const sourceMesh = mesh as Mesh;\r\n for (const subMesh of sourceMesh.subMeshes) {\r\n const batch = sourceMesh._getInstancesRenderList(subMesh._id);\r\n sourceMesh._updateInstancedBuffers(subMesh, batch, batch.parent.instancesBufferSize, this._engine);\r\n }\r\n }\r\n return true;\r\n } else if (mesh.isAnInstance) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Update the meshes used in an effect layer to ensure that snapshot rendering works correctly for these meshes in this layer.\r\n * @param layer The effect layer or frame graph layer\r\n * @param autoUpdate If true, the helper will automatically update the meshes of the layer with each frame. If false, you'll need to call this method manually when the camera or layer meshes move or rotate.\r\n */\r\n public updateMeshesForEffectLayer(layer: EffectLayer | FrameGraphBaseLayerTask, autoUpdate = true) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n const renderPassId = layer instanceof FrameGraphBaseLayerTask ? layer.objectRendererForLayer.objectRenderer.renderPassId : layer.mainTexture.renderPassId;\r\n\r\n if (autoUpdate) {\r\n this._onBeforeRenderObserverUpdateLayer = this._scene.onBeforeRenderObservable.add(() => {\r\n this._updateMeshMatricesForRenderPassId(renderPassId);\r\n });\r\n } else {\r\n this._updateMeshMatricesForRenderPassId(renderPassId);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the helper\r\n */\r\n public dispose() {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserverUpdateLayer);\r\n this._engine.onResizeObservable.remove(this._onResizeObserver);\r\n }\r\n\r\n private get _fastSnapshotRenderingEnabled() {\r\n return this._engine.snapshotRendering && this._engine.snapshotRenderingMode === Constants.SNAPSHOTRENDERING_FAST;\r\n }\r\n\r\n private _updateMeshMatricesForRenderPassId(renderPassId: number) {\r\n if (!this._fastSnapshotRenderingEnabled) {\r\n return;\r\n }\r\n\r\n const sceneTransformationMatrix =\r\n this._scene.objectRenderers.find((renderer) => renderer.renderPassId === renderPassId)?.activeCamera?.getTransformationMatrix() ?? this._scene.getTransformMatrix();\r\n\r\n for (let i = 0; i < this._scene.meshes.length; ++i) {\r\n const mesh = this._scene.meshes[i];\r\n if (!mesh.subMeshes) {\r\n continue;\r\n }\r\n\r\n for (let j = 0; j < mesh.subMeshes.length; ++j) {\r\n const dw = mesh.subMeshes[j]._getDrawWrapper(renderPassId);\r\n const effect = dw?.effect;\r\n if (effect) {\r\n const dataBuffer = (dw.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (dataBuffer && ubLeftOver && ubLeftOver.setDataBuffer(dataBuffer)) {\r\n effect.setMatrix(\"viewProjection\", sceneTransformationMatrix);\r\n effect.setMatrix(\"world\", mesh.computeWorldMatrix());\r\n ubLeftOver.update();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _spriteRendererDirectMatrixUpdate(dw: DrawWrapper, camera: Camera) {\r\n const effect = dw?.effect;\r\n if (effect) {\r\n const dataBuffer = (dw.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (dataBuffer && ubLeftOver && ubLeftOver.setDataBuffer(dataBuffer)) {\r\n effect.setMatrix(\"view\", camera.getViewMatrix());\r\n effect.setMatrix(\"projection\", camera.getProjectionMatrix());\r\n ubLeftOver.update();\r\n }\r\n }\r\n }\r\n\r\n private _spriteRendererUpdateEffects(drawWrapperBase: DrawWrapper, drawWrapperDepth: DrawWrapper, camera: Camera) {\r\n this._spriteRendererDirectMatrixUpdate(drawWrapperBase, camera);\r\n this._spriteRendererDirectMatrixUpdate(drawWrapperDepth, camera);\r\n }\r\n\r\n /**\r\n * Make a CPU particle system compatible with FAST snapshot rendering.\r\n * The particle system will always render at full capacity (`getCapacity()` quads), with inactive slots collapsed\r\n * to degenerate triangles via zero-fill. This keeps the recorded GPU bundle's draw call valid every frame, while\r\n * the live particle data is uploaded to the bundle-referenced vertex buffer through the normal `animate()` path.\r\n *\r\n * The helper additionally advances the particle simulation and updates view/projection (and `eyePosition`/`invView`\r\n * for billboard modes) into the particle system's draw wrappers each frame, because FAST snapshot replay skips the\r\n * normal scene particle evaluation path after the bundle is recorded.\r\n *\r\n * Notes:\r\n * - Call this BEFORE `enableSnapshotRendering()` so the recording sees the correct draw count.\r\n * - GPU particle systems (`GPUParticleSystem`) are not supported by this method.\r\n * - Vertex shader cost scales with `getCapacity()` rather than the live particle count, so size capacity realistically.\r\n * - Per-frame uniforms other than camera matrices (e.g. `textureMask`, `translationPivot`, clip planes, fog) are\r\n * baked at recording time and will not update during snapshot replay.\r\n * @param particleSystem The particle system to fix\r\n */\r\n public fixParticleSystem(particleSystem: IParticleSystem): void {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n if (particleSystem.getClassName() !== \"ParticleSystem\") {\r\n this._log(\"fixParticleSystem\", `skipping ${particleSystem.name}: only CPU ParticleSystem is supported (got ${particleSystem.getClassName()})`);\r\n return;\r\n }\r\n\r\n const ps = particleSystem as ParticleSystem;\r\n const fixedCapacityInitialized = ps._initFixedCapacitySnapshotData();\r\n\r\n // The recorded bundle bakes in the draw-call vertex/instance count. If snapshot rendering is already active\r\n // (or in the process of being enabled) when we flip the flag, the bundle was recorded with the live particle\r\n // count and is now stale. Cycle disable/enable so the next recording picks up the fixed-capacity draw count.\r\n if (fixedCapacityInitialized && (this._fastSnapshotRenderingEnabled || this._isEnabling)) {\r\n Logger.Warn(\r\n `SnapshotRenderingHelper.fixParticleSystem(\"${particleSystem.name}\") was called after snapshot rendering was enabled. ` +\r\n `Forcing a re-record so the bundle uses the fixed-capacity draw count. Call fixParticleSystem before enableSnapshotRendering to avoid this.`\r\n );\r\n this.disableSnapshotRendering(\"fixParticleSystem auto-recover\");\r\n this.enableSnapshotRendering(\"fixParticleSystem auto-recover\");\r\n }\r\n }\r\n\r\n private _updateFixedCapacityParticleSystem(ps: ParticleSystem, camera: Camera): void {\r\n if (!this._scene.particlesEnabled || !ps.isStarted() || !ps.emitter) {\r\n ps._clearFixedCapacitySnapshotData();\r\n return;\r\n }\r\n\r\n const emitter = ps.emitter as { position?: unknown; isEnabled?: () => boolean };\r\n if (!emitter.position || emitter.isEnabled?.()) {\r\n ps.animate();\r\n this._particleSystemUpdateEffects(ps, camera);\r\n } else {\r\n ps._clearFixedCapacitySnapshotData();\r\n }\r\n }\r\n\r\n private _particleSystemUpdateEffects(ps: ParticleSystem, camera: Camera) {\r\n const drawWrappers = (ps as unknown as { _drawWrappers: DrawWrapper[][] })._drawWrappers;\r\n if (!drawWrappers) {\r\n return;\r\n }\r\n\r\n const viewMatrix = ps.defaultViewMatrix ?? camera.getViewMatrix();\r\n const projectionMatrix = ps.defaultProjectionMatrix ?? camera.getProjectionMatrix();\r\n // Compute invView lazily once per system per frame, only if any draw wrapper actually needs it.\r\n let invViewMatrix: Nullable<Matrix> = null;\r\n\r\n for (const perPass of drawWrappers) {\r\n if (!perPass) {\r\n continue;\r\n }\r\n for (const dw of perPass) {\r\n invViewMatrix = this._particleSystemDirectMatrixUpdate(dw, viewMatrix, projectionMatrix, camera, invViewMatrix);\r\n }\r\n }\r\n }\r\n\r\n private _particleSystemBillboardFlags = new WeakMap<object, { billboard: boolean; billboardAll: boolean }>();\r\n\r\n private _particleSystemDirectMatrixUpdate(\r\n dw: Nullable<DrawWrapper>,\r\n viewMatrix: Matrix,\r\n projectionMatrix: Matrix,\r\n camera: Camera,\r\n invViewMatrix: Nullable<Matrix>\r\n ): Nullable<Matrix> {\r\n const effect = dw?.effect;\r\n if (!effect) {\r\n return invViewMatrix;\r\n }\r\n const dataBuffer = (dw!.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (!dataBuffer || !ubLeftOver || !ubLeftOver.setDataBuffer(dataBuffer)) {\r\n return invViewMatrix;\r\n }\r\n effect.setMatrix(\"view\", viewMatrix);\r\n effect.setMatrix(\"projection\", projectionMatrix);\r\n let flags = this._particleSystemBillboardFlags.get(effect);\r\n if (!flags) {\r\n const defines = effect.defines ?? \"\";\r\n flags = { billboard: defines.indexOf(\"#define BILLBOARD\") >= 0, billboardAll: defines.indexOf(\"#define BILLBOARDMODE_ALL\") >= 0 };\r\n this._particleSystemBillboardFlags.set(effect, flags);\r\n }\r\n if (flags.billboard) {\r\n effect.setVector3(\"eyePosition\", camera.globalPosition);\r\n }\r\n if (flags.billboardAll) {\r\n if (!invViewMatrix) {\r\n invViewMatrix = TmpVectors.Matrix[0];\r\n viewMatrix.invertToRef(invViewMatrix);\r\n }\r\n effect.setMatrix(\"invView\", invViewMatrix);\r\n }\r\n ubLeftOver.update();\r\n\r\n return invViewMatrix;\r\n }\r\n\r\n private _executeAtFrame(frameId: number, func: () => void, mode: \"whenEnabled\" | \"whenDisabled\" = \"whenEnabled\") {\r\n const callback = () => {\r\n if (this._engine.frameId >= frameId) {\r\n this._engine.onEndFrameObservable.remove(obs);\r\n if (mode === \"whenEnabled\") {\r\n this._enableCancelFunctions.delete(callback);\r\n } else {\r\n this._disableCancelFunctions.delete(callback);\r\n }\r\n func();\r\n }\r\n };\r\n\r\n const obs = this._engine.onEndFrameObservable.add(callback);\r\n if (mode === \"whenEnabled\") {\r\n this._enableCancelFunctions.set(callback, () => this._engine.onEndFrameObservable.remove(obs));\r\n } else {\r\n this._disableCancelFunctions.set(callback, () => this._engine.onEndFrameObservable.remove(obs));\r\n }\r\n }\r\n\r\n private _log(funcName: string, message: string) {\r\n if (this.showDebugLogs) {\r\n Logger.Log(`[Frame: ${this._engine.frameId}] SnapshotRenderingHelper:${funcName} - ${message}`);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -18,6 +18,7 @@ export declare class ThinMinMaxReducerPostProcess extends EffectWrapper {
|
|
|
18
18
|
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
19
19
|
textureWidth: number;
|
|
20
20
|
textureHeight: number;
|
|
21
|
+
useIntegerTextureSize: boolean;
|
|
21
22
|
constructor(name: string, engine?: Nullable<AbstractEngine>, defines?: string, options?: EffectWrapperCreationOptions);
|
|
22
23
|
bind(noDefaultBindings?: boolean): void;
|
|
23
24
|
}
|
|
@@ -30,8 +31,22 @@ export declare class ThinMinMaxReducer {
|
|
|
30
31
|
max: number;
|
|
31
32
|
}>;
|
|
32
33
|
readonly reductionSteps: Array<ThinMinMaxReducerPostProcess>;
|
|
34
|
+
/**
|
|
35
|
+
* Wait for WebGPU readback before notifying observers (default: false).
|
|
36
|
+
* Notifications are asynchronous in this mode; WebGL readback remains synchronous.
|
|
37
|
+
*/
|
|
38
|
+
waitForReadback: boolean;
|
|
33
39
|
private _depthRedux;
|
|
34
40
|
private _depthTextureType;
|
|
41
|
+
private _sourceIsDepthTexture;
|
|
42
|
+
private _waitBufferFloat?;
|
|
43
|
+
private _waitBufferUint8?;
|
|
44
|
+
private _waitMinMax?;
|
|
45
|
+
private _defaultBufferFloat?;
|
|
46
|
+
private _defaultBufferUint8?;
|
|
47
|
+
private _defaultMinMax?;
|
|
48
|
+
private _readbackPending;
|
|
49
|
+
private _readbackGeneration;
|
|
35
50
|
get depthRedux(): boolean;
|
|
36
51
|
set depthRedux(value: boolean);
|
|
37
52
|
protected readonly _scene: Scene;
|
|
@@ -40,8 +55,10 @@ export declare class ThinMinMaxReducer {
|
|
|
40
55
|
get textureWidth(): number;
|
|
41
56
|
get textureHeight(): number;
|
|
42
57
|
constructor(scene: Scene, depthRedux?: boolean);
|
|
43
|
-
setTextureDimensions(width: number, height: number, depthTextureType?: DepthTextureType): boolean;
|
|
44
|
-
readMinMax(texture: InternalTexture): void;
|
|
58
|
+
setTextureDimensions(width: number, height: number, depthTextureType?: DepthTextureType, sourceIsDepthTexture?: boolean): boolean;
|
|
59
|
+
readMinMax(texture: InternalTexture, fallbackToFullRange?: boolean): void;
|
|
60
|
+
private _completeReadbackAsync;
|
|
61
|
+
private _notifyMinMax;
|
|
45
62
|
dispose(disposeAll?: boolean): void;
|
|
46
63
|
private _recreatePostProcesses;
|
|
47
64
|
}
|
|
@@ -2,6 +2,7 @@ import { Observable } from "./observable.js";
|
|
|
2
2
|
import { EffectWrapper } from "../Materials/effectRenderer.pure.js";
|
|
3
3
|
import { EngineStore } from "../Engines/engineStore.js";
|
|
4
4
|
|
|
5
|
+
import { Logger } from "./logger.js";
|
|
5
6
|
/**
|
|
6
7
|
* @internal
|
|
7
8
|
*/
|
|
@@ -37,11 +38,12 @@ export class ThinMinMaxReducerPostProcess extends EffectWrapper {
|
|
|
37
38
|
});
|
|
38
39
|
this.textureWidth = 0;
|
|
39
40
|
this.textureHeight = 0;
|
|
41
|
+
this.useIntegerTextureSize = false;
|
|
40
42
|
}
|
|
41
43
|
bind(noDefaultBindings = false) {
|
|
42
44
|
super.bind(noDefaultBindings);
|
|
43
45
|
const effect = this.drawWrapper.effect;
|
|
44
|
-
if (this.
|
|
46
|
+
if (this.useIntegerTextureSize) {
|
|
45
47
|
effect.setInt2("texSize", this.textureWidth, this.textureHeight);
|
|
46
48
|
}
|
|
47
49
|
else {
|
|
@@ -76,45 +78,91 @@ export class ThinMinMaxReducer {
|
|
|
76
78
|
}
|
|
77
79
|
constructor(scene, depthRedux = true) {
|
|
78
80
|
this.onAfterReductionPerformed = new Observable();
|
|
81
|
+
/**
|
|
82
|
+
* Wait for WebGPU readback before notifying observers (default: false).
|
|
83
|
+
* Notifications are asynchronous in this mode; WebGL readback remains synchronous.
|
|
84
|
+
*/
|
|
85
|
+
this.waitForReadback = false;
|
|
86
|
+
this._sourceIsDepthTexture = false;
|
|
87
|
+
this._readbackPending = false;
|
|
88
|
+
this._readbackGeneration = 0;
|
|
79
89
|
this._textureWidth = 0;
|
|
80
90
|
this._textureHeight = 0;
|
|
81
91
|
this._scene = scene;
|
|
82
92
|
this._depthRedux = depthRedux;
|
|
83
93
|
this.reductionSteps = [];
|
|
84
94
|
}
|
|
85
|
-
setTextureDimensions(width, height, depthTextureType = 0 /* DepthTextureType.NormalizedViewDepth
|
|
86
|
-
if (width === this._textureWidth && height === this._textureHeight && depthTextureType === this._depthTextureType) {
|
|
95
|
+
setTextureDimensions(width, height, depthTextureType = 0 /* DepthTextureType.NormalizedViewDepth */, sourceIsDepthTexture = false) {
|
|
96
|
+
if (width === this._textureWidth && height === this._textureHeight && depthTextureType === this._depthTextureType && sourceIsDepthTexture === this._sourceIsDepthTexture) {
|
|
87
97
|
return false;
|
|
88
98
|
}
|
|
89
99
|
this._textureWidth = width;
|
|
90
100
|
this._textureHeight = height;
|
|
91
101
|
this._depthTextureType = depthTextureType;
|
|
102
|
+
this._sourceIsDepthTexture = sourceIsDepthTexture;
|
|
92
103
|
this._recreatePostProcesses();
|
|
93
104
|
return true;
|
|
94
105
|
}
|
|
95
|
-
readMinMax(texture) {
|
|
96
|
-
// Note that we should normally await the call to _readTexturePixels!
|
|
97
|
-
// But because WebGL does the read synchronously, we know the values will be updated without waiting for the promise to be resolved, which will let us get the updated values
|
|
98
|
-
// in the current frame, whereas in WebGPU, the read is asynchronous and we should normally wait for the promise to be resolved to get the updated values.
|
|
99
|
-
// However, it's safe to avoid waiting for the promise to be resolved in WebGPU as well, because we will simply use the current values until "buffer" is updated later on.
|
|
100
|
-
// Note that it means we can suffer some rendering artifacts in WebGPU because we may use previous min/max values for the current frame.
|
|
106
|
+
readMinMax(texture, fallbackToFullRange = true) {
|
|
101
107
|
const isFloat = texture.type === 1 || texture.type === 2;
|
|
102
|
-
const
|
|
108
|
+
const engine = this._scene.getEngine();
|
|
109
|
+
const isWebGPU = engine.isWebGPU;
|
|
110
|
+
if (this.waitForReadback && isWebGPU) {
|
|
111
|
+
if (this._readbackPending) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const buffer = isFloat ? (this._waitBufferFloat ?? (this._waitBufferFloat = new Float32Array(4))) : (this._waitBufferUint8 ?? (this._waitBufferUint8 = new Uint8Array(4)));
|
|
115
|
+
const result = (this._waitMinMax ?? (this._waitMinMax = { min: 0, max: 0 }));
|
|
116
|
+
const generation = this._readbackGeneration;
|
|
117
|
+
// Submit the reduction before copying: the frame graph may reuse this texture later in the frame.
|
|
118
|
+
const readback = engine._readTexturePixels(texture, 1, 1, -1, 0, buffer, true);
|
|
119
|
+
this._readbackPending = true;
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
121
|
+
this._completeReadbackAsync(readback, buffer, isFloat, fallbackToFullRange, generation, result);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
// WebGL updates the buffer synchronously. WebGPU notifies with previous values, but
|
|
125
|
+
// still needs to submit this reduction before another graph task can reuse its texture.
|
|
126
|
+
let buffer;
|
|
127
|
+
if (isWebGPU) {
|
|
128
|
+
buffer = isFloat ? (this._defaultBufferFloat ?? (this._defaultBufferFloat = new Float32Array(4))) : (this._defaultBufferUint8 ?? (this._defaultBufferUint8 = new Uint8Array(4)));
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
buffer = isFloat ? BufferFloat : BufferUint8;
|
|
132
|
+
}
|
|
103
133
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
134
|
+
engine._readTexturePixels(texture, 1, 1, -1, 0, buffer, isWebGPU);
|
|
135
|
+
this._notifyMinMax(buffer, isFloat, fallbackToFullRange, isWebGPU ? (this._defaultMinMax ?? (this._defaultMinMax = { min: 0, max: 0 })) : MinMax);
|
|
136
|
+
}
|
|
137
|
+
async _completeReadbackAsync(readback, buffer, isFloat, fallbackToFullRange, generation, result) {
|
|
138
|
+
try {
|
|
139
|
+
await readback;
|
|
140
|
+
if (generation === this._readbackGeneration && this.waitForReadback) {
|
|
141
|
+
this._notifyMinMax(buffer, isFloat, fallbackToFullRange, result);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
Logger.Error(`ThinMinMaxReducer: Failed to complete min/max readback: ${error}`);
|
|
146
|
+
}
|
|
147
|
+
finally {
|
|
148
|
+
this._readbackPending = false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
_notifyMinMax(buffer, isFloat, fallbackToFullRange, result) {
|
|
152
|
+
result.min = buffer[0];
|
|
153
|
+
result.max = buffer[1];
|
|
107
154
|
if (!isFloat) {
|
|
108
|
-
|
|
109
|
-
|
|
155
|
+
result.min /= 255.0;
|
|
156
|
+
result.max /= 255.0;
|
|
110
157
|
}
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
|
|
158
|
+
if (fallbackToFullRange && result.min >= result.max) {
|
|
159
|
+
result.min = 0;
|
|
160
|
+
result.max = 1;
|
|
114
161
|
}
|
|
115
|
-
this.onAfterReductionPerformed.notifyObservers(
|
|
162
|
+
this.onAfterReductionPerformed.notifyObservers(result);
|
|
116
163
|
}
|
|
117
164
|
dispose(disposeAll = true) {
|
|
165
|
+
this._readbackGeneration++;
|
|
118
166
|
if (disposeAll) {
|
|
119
167
|
this.onAfterReductionPerformed.clear();
|
|
120
168
|
this._textureWidth = 0;
|
|
@@ -129,18 +177,23 @@ export class ThinMinMaxReducer {
|
|
|
129
177
|
this.dispose(false);
|
|
130
178
|
const scene = this._scene;
|
|
131
179
|
let w = this.textureWidth, h = this.textureHeight;
|
|
132
|
-
const reductionInitial = new ThinMinMaxReducerPostProcess("Initial reduction phase", scene.getEngine(), "#define INITIAL" +
|
|
180
|
+
const reductionInitial = new ThinMinMaxReducerPostProcess("Initial reduction phase", scene.getEngine(), "#define INITIAL" +
|
|
181
|
+
(w === 1 || h === 1 ? "\n#define CLAMP_REDUCTION_COORDS" : "") +
|
|
182
|
+
(this._sourceIsDepthTexture ? "\n#define DEPTH_TEXTURE" : "") +
|
|
183
|
+
(this._depthRedux ? "\n#define DEPTH_REDUX" : "") +
|
|
184
|
+
(this._depthTextureType === 1 /* DepthTextureType.ViewDepth */ ? "\n#define VIEW_DEPTH" : ""));
|
|
133
185
|
reductionInitial.textureWidth = w;
|
|
134
186
|
reductionInitial.textureHeight = h;
|
|
135
187
|
this.reductionSteps.push(reductionInitial);
|
|
136
188
|
let index = 1;
|
|
137
189
|
// create the additional steps
|
|
138
|
-
while (w > 1 || h > 1) {
|
|
190
|
+
while (w > 1 || h > 1 || (w === 1 && h === 1 && index === 1)) {
|
|
139
191
|
w = Math.max(Math.round(w / 2), 1);
|
|
140
192
|
h = Math.max(Math.round(h / 2), 1);
|
|
141
193
|
const reduction = new ThinMinMaxReducerPostProcess("Reduction phase " + index, scene.getEngine(), "#define " + (w == 1 && h == 1 ? "LAST" : w == 1 || h == 1 ? "ONEBEFORELAST" : "MAIN"));
|
|
142
194
|
reduction.textureWidth = w;
|
|
143
195
|
reduction.textureHeight = h;
|
|
196
|
+
reduction.useIntegerTextureSize = w === 1 || h === 1;
|
|
144
197
|
this.reductionSteps.push(reduction);
|
|
145
198
|
index++;
|
|
146
199
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thinMinMax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,KAAK,EAAE,CAAC;QACZ,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { type Nullable, type EffectWrapperCreationOptions, type AbstractEngine, type InternalTexture, type Scene } from \"core/index\";\r\nimport { Observable } from \"./observable\";\r\nimport { EffectWrapper } from \"../Materials/effectRenderer.pure\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport const enum DepthTextureType {\r\n NormalizedViewDepth = 0,\r\n ViewDepth = 1,\r\n ScreenDepth = 2,\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class ThinMinMaxReducerPostProcess extends EffectWrapper {\r\n public static readonly FragmentUrl = \"minmaxRedux\";\r\n\r\n public static readonly Uniforms = [\"texSize\"];\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/minmaxRedux.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/minmaxRedux.fragment\"));\r\n }\r\n }\r\n\r\n public textureWidth = 0;\r\n\r\n public textureHeight = 0;\r\n\r\n constructor(name: string, engine: Nullable<AbstractEngine> = null, defines = \"\", options?: EffectWrapperCreationOptions) {\r\n super({\r\n ...options,\r\n name,\r\n engine: engine || EngineStore.LastCreatedEngine!,\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n fragmentShader: ThinMinMaxReducerPostProcess.FragmentUrl,\r\n uniforms: ThinMinMaxReducerPostProcess.Uniforms,\r\n defines,\r\n });\r\n }\r\n\r\n public override bind(noDefaultBindings = false) {\r\n super.bind(noDefaultBindings);\r\n\r\n const effect = this.drawWrapper.effect!;\r\n\r\n if (this.textureWidth === 1 || this.textureHeight === 1) {\r\n effect.setInt2(\"texSize\", this.textureWidth, this.textureHeight);\r\n } else {\r\n effect.setFloat2(\"texSize\", this.textureWidth, this.textureHeight);\r\n }\r\n }\r\n}\r\n\r\nconst BufferFloat = new Float32Array(4 * 1 * 1);\r\nconst BufferUint8 = new Uint8Array(4 * 1 * 1);\r\nconst MinMax = { min: 0, max: 0 };\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class ThinMinMaxReducer {\r\n public readonly onAfterReductionPerformed = new Observable<{ min: number; max: number }>();\r\n\r\n public readonly reductionSteps: Array<ThinMinMaxReducerPostProcess>;\r\n\r\n private _depthRedux: boolean;\r\n private _depthTextureType: DepthTextureType;\r\n\r\n public get depthRedux() {\r\n return this._depthRedux;\r\n }\r\n\r\n public set depthRedux(value: boolean) {\r\n if (this._depthRedux === value) {\r\n return;\r\n }\r\n\r\n this._depthRedux = value;\r\n\r\n this._recreatePostProcesses();\r\n }\r\n\r\n protected readonly _scene: Scene;\r\n\r\n private _textureWidth = 0;\r\n private _textureHeight = 0;\r\n\r\n public get textureWidth() {\r\n return this._textureWidth;\r\n }\r\n\r\n public get textureHeight() {\r\n return this._textureHeight;\r\n }\r\n\r\n constructor(scene: Scene, depthRedux = true) {\r\n this._scene = scene;\r\n this._depthRedux = depthRedux;\r\n this.reductionSteps = [];\r\n }\r\n\r\n public setTextureDimensions(width: number, height: number, depthTextureType: DepthTextureType = DepthTextureType.NormalizedViewDepth) {\r\n if (width === this._textureWidth && height === this._textureHeight && depthTextureType === this._depthTextureType) {\r\n return false;\r\n }\r\n\r\n this._textureWidth = width;\r\n this._textureHeight = height;\r\n this._depthTextureType = depthTextureType;\r\n\r\n this._recreatePostProcesses();\r\n\r\n return true;\r\n }\r\n\r\n public readMinMax(texture: InternalTexture) {\r\n // Note that we should normally await the call to _readTexturePixels!\r\n // But because WebGL does the read synchronously, we know the values will be updated without waiting for the promise to be resolved, which will let us get the updated values\r\n // in the current frame, whereas in WebGPU, the read is asynchronous and we should normally wait for the promise to be resolved to get the updated values.\r\n // However, it's safe to avoid waiting for the promise to be resolved in WebGPU as well, because we will simply use the current values until \"buffer\" is updated later on.\r\n // Note that it means we can suffer some rendering artifacts in WebGPU because we may use previous min/max values for the current frame.\r\n const isFloat = texture.type === Constants.TEXTURETYPE_FLOAT || texture.type === Constants.TEXTURETYPE_HALF_FLOAT;\r\n const buffer = isFloat ? BufferFloat : BufferUint8;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._scene.getEngine()._readTexturePixels(texture, 1, 1, -1, 0, buffer, false);\r\n\r\n MinMax.min = buffer[0];\r\n MinMax.max = buffer[1];\r\n\r\n if (!isFloat) {\r\n MinMax.min = MinMax.min / 255.0;\r\n MinMax.max = MinMax.max / 255.0;\r\n }\r\n\r\n if (MinMax.min >= MinMax.max) {\r\n MinMax.min = 0;\r\n MinMax.max = 1;\r\n }\r\n\r\n this.onAfterReductionPerformed.notifyObservers(MinMax);\r\n }\r\n\r\n public dispose(disposeAll = true): void {\r\n if (disposeAll) {\r\n this.onAfterReductionPerformed.clear();\r\n this._textureWidth = 0;\r\n this._textureHeight = 0;\r\n }\r\n\r\n for (let i = 0; i < this.reductionSteps.length; ++i) {\r\n this.reductionSteps[i].dispose();\r\n }\r\n this.reductionSteps.length = 0;\r\n }\r\n\r\n private _recreatePostProcesses() {\r\n this.dispose(false);\r\n\r\n const scene = this._scene;\r\n\r\n let w = this.textureWidth,\r\n h = this.textureHeight;\r\n\r\n const reductionInitial = new ThinMinMaxReducerPostProcess(\r\n \"Initial reduction phase\",\r\n scene.getEngine(),\r\n \"#define INITIAL\" + (this._depthRedux ? \"\\n#define DEPTH_REDUX\" : \"\") + (this._depthTextureType === DepthTextureType.ViewDepth ? \"\\n#define VIEW_DEPTH\" : \"\")\r\n );\r\n\r\n reductionInitial.textureWidth = w;\r\n reductionInitial.textureHeight = h;\r\n\r\n this.reductionSteps.push(reductionInitial);\r\n\r\n let index = 1;\r\n\r\n // create the additional steps\r\n while (w > 1 || h > 1) {\r\n w = Math.max(Math.round(w / 2), 1);\r\n h = Math.max(Math.round(h / 2), 1);\r\n\r\n const reduction = new ThinMinMaxReducerPostProcess(\r\n \"Reduction phase \" + index,\r\n scene.getEngine(),\r\n \"#define \" + (w == 1 && h == 1 ? \"LAST\" : w == 1 || h == 1 ? \"ONEBEFORELAST\" : \"MAIN\")\r\n );\r\n\r\n reduction.textureWidth = w;\r\n reduction.textureHeight = h;\r\n\r\n this.reductionSteps.push(reduction);\r\n\r\n index++;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"thinMinMaxReducer.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/thinMinMaxReducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;GAEG;AACH,MAAM,CAAN,IAAkB,gBAIjB;AAJD,WAAkB,gBAAgB;IAC9B,qFAAuB,CAAA;IACvB,iEAAa,CAAA;IACb,qEAAe,CAAA;AACnB,CAAC,EAJiB,gBAAgB,KAAhB,gBAAgB,QAIjC;AAED;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,aAAa;IAKxC,cAAc,CAAC,SAAkB,EAAE,IAAoB;QACtE,IAAI,SAAS,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qCAAqC,CAAC,CAAC,CAAC;QAC7D,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iCAAiC,CAAC,CAAC,CAAC;QACzD,CAAC;IACL,CAAC;IAQD,YAAY,IAAY,EAAE,SAAmC,IAAI,EAAE,OAAO,GAAG,EAAE,EAAE,OAAsC;QACnH,KAAK,CAAC;YACF,GAAG,OAAO;YACV,IAAI;YACJ,MAAM,EAAE,MAA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AC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAEnC,MAAM,SAAS,GAAG,IAAI,4BAA4B,CAC9C,kBAAkB,GAAG,KAAK,EAC1B,KAAK,CAAC,SAAS,EAAE,EACjB,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CACzF,CAAC;YAEF,SAAS,CAAC,YAAY,GAAG,CAAC,CAAC;YAC3B,SAAS,CAAC,aAAa,GAAG,CAAC,CAAC;YAC5B,SAAS,CAAC,qBAAqB,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAErD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAEpC,KAAK,EAAE,CAAC;QACZ,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { type Nullable, type EffectWrapperCreationOptions, type AbstractEngine, type InternalTexture, type Scene } from \"core/index\";\r\nimport { Observable } from \"./observable\";\r\nimport { EffectWrapper } from \"../Materials/effectRenderer.pure\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { Logger } from \"./logger\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport const enum DepthTextureType {\r\n NormalizedViewDepth = 0,\r\n ViewDepth = 1,\r\n ScreenDepth = 2,\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class ThinMinMaxReducerPostProcess extends EffectWrapper {\r\n public static readonly FragmentUrl = \"minmaxRedux\";\r\n\r\n public static readonly Uniforms = [\"texSize\"];\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/minmaxRedux.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/minmaxRedux.fragment\"));\r\n }\r\n }\r\n\r\n public textureWidth = 0;\r\n\r\n public textureHeight = 0;\r\n\r\n public useIntegerTextureSize = false;\r\n\r\n constructor(name: string, engine: Nullable<AbstractEngine> = null, defines = \"\", options?: EffectWrapperCreationOptions) {\r\n super({\r\n ...options,\r\n name,\r\n engine: engine || EngineStore.LastCreatedEngine!,\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n fragmentShader: ThinMinMaxReducerPostProcess.FragmentUrl,\r\n uniforms: ThinMinMaxReducerPostProcess.Uniforms,\r\n defines,\r\n });\r\n }\r\n\r\n public override bind(noDefaultBindings = false) {\r\n super.bind(noDefaultBindings);\r\n\r\n const effect = this.drawWrapper.effect!;\r\n\r\n if (this.useIntegerTextureSize) {\r\n effect.setInt2(\"texSize\", this.textureWidth, this.textureHeight);\r\n } else {\r\n effect.setFloat2(\"texSize\", this.textureWidth, this.textureHeight);\r\n }\r\n }\r\n}\r\n\r\nconst BufferFloat = new Float32Array(4 * 1 * 1);\r\nconst BufferUint8 = new Uint8Array(4 * 1 * 1);\r\nconst MinMax = { min: 0, max: 0 };\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class ThinMinMaxReducer {\r\n public readonly onAfterReductionPerformed = new Observable<{ min: number; max: number }>();\r\n\r\n public readonly reductionSteps: Array<ThinMinMaxReducerPostProcess>;\r\n\r\n /**\r\n * Wait for WebGPU readback before notifying observers (default: false).\r\n * Notifications are asynchronous in this mode; WebGL readback remains synchronous.\r\n */\r\n public waitForReadback = false;\r\n\r\n private _depthRedux: boolean;\r\n private _depthTextureType: DepthTextureType;\r\n private _sourceIsDepthTexture = false;\r\n private _waitBufferFloat?: Float32Array;\r\n private _waitBufferUint8?: Uint8Array;\r\n private _waitMinMax?: { min: number; max: number };\r\n private _defaultBufferFloat?: Float32Array;\r\n private _defaultBufferUint8?: Uint8Array;\r\n private _defaultMinMax?: { min: number; max: number };\r\n private _readbackPending = false;\r\n private _readbackGeneration = 0;\r\n\r\n public get depthRedux() {\r\n return this._depthRedux;\r\n }\r\n\r\n public set depthRedux(value: boolean) {\r\n if (this._depthRedux === value) {\r\n return;\r\n }\r\n\r\n this._depthRedux = value;\r\n\r\n this._recreatePostProcesses();\r\n }\r\n\r\n protected readonly _scene: Scene;\r\n\r\n private _textureWidth = 0;\r\n private _textureHeight = 0;\r\n\r\n public get textureWidth() {\r\n return this._textureWidth;\r\n }\r\n\r\n public get textureHeight() {\r\n return this._textureHeight;\r\n }\r\n\r\n constructor(scene: Scene, depthRedux = true) {\r\n this._scene = scene;\r\n this._depthRedux = depthRedux;\r\n this.reductionSteps = [];\r\n }\r\n\r\n public setTextureDimensions(width: number, height: number, depthTextureType: DepthTextureType = DepthTextureType.NormalizedViewDepth, sourceIsDepthTexture = false) {\r\n if (width === this._textureWidth && height === this._textureHeight && depthTextureType === this._depthTextureType && sourceIsDepthTexture === this._sourceIsDepthTexture) {\r\n return false;\r\n }\r\n\r\n this._textureWidth = width;\r\n this._textureHeight = height;\r\n this._depthTextureType = depthTextureType;\r\n this._sourceIsDepthTexture = sourceIsDepthTexture;\r\n\r\n this._recreatePostProcesses();\r\n\r\n return true;\r\n }\r\n\r\n public readMinMax(texture: InternalTexture, fallbackToFullRange = true) {\r\n const isFloat = texture.type === Constants.TEXTURETYPE_FLOAT || texture.type === Constants.TEXTURETYPE_HALF_FLOAT;\r\n const engine = this._scene.getEngine();\r\n const isWebGPU = engine.isWebGPU;\r\n\r\n if (this.waitForReadback && isWebGPU) {\r\n if (this._readbackPending) {\r\n return;\r\n }\r\n\r\n const buffer = isFloat ? (this._waitBufferFloat ??= new Float32Array(4)) : (this._waitBufferUint8 ??= new Uint8Array(4));\r\n const result = (this._waitMinMax ??= { min: 0, max: 0 });\r\n const generation = this._readbackGeneration;\r\n // Submit the reduction before copying: the frame graph may reuse this texture later in the frame.\r\n const readback = engine._readTexturePixels(texture, 1, 1, -1, 0, buffer, true);\r\n this._readbackPending = true;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._completeReadbackAsync(readback, buffer, isFloat, fallbackToFullRange, generation, result);\r\n return;\r\n }\r\n\r\n // WebGL updates the buffer synchronously. WebGPU notifies with previous values, but\r\n // still needs to submit this reduction before another graph task can reuse its texture.\r\n let buffer: Float32Array | Uint8Array;\r\n if (isWebGPU) {\r\n buffer = isFloat ? (this._defaultBufferFloat ??= new Float32Array(4)) : (this._defaultBufferUint8 ??= new Uint8Array(4));\r\n } else {\r\n buffer = isFloat ? BufferFloat : BufferUint8;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n engine._readTexturePixels(texture, 1, 1, -1, 0, buffer, isWebGPU);\r\n\r\n this._notifyMinMax(buffer, isFloat, fallbackToFullRange, isWebGPU ? (this._defaultMinMax ??= { min: 0, max: 0 }) : MinMax);\r\n }\r\n\r\n private async _completeReadbackAsync(\r\n readback: Promise<ArrayBufferView>,\r\n buffer: Float32Array | Uint8Array,\r\n isFloat: boolean,\r\n fallbackToFullRange: boolean,\r\n generation: number,\r\n result: { min: number; max: number }\r\n ): Promise<void> {\r\n try {\r\n await readback;\r\n if (generation === this._readbackGeneration && this.waitForReadback) {\r\n this._notifyMinMax(buffer, isFloat, fallbackToFullRange, result);\r\n }\r\n } catch (error) {\r\n Logger.Error(`ThinMinMaxReducer: Failed to complete min/max readback: ${error}`);\r\n } finally {\r\n this._readbackPending = false;\r\n }\r\n }\r\n\r\n private _notifyMinMax(buffer: Float32Array | Uint8Array, isFloat: boolean, fallbackToFullRange: boolean, result: { min: number; max: number }) {\r\n result.min = buffer[0];\r\n result.max = buffer[1];\r\n\r\n if (!isFloat) {\r\n result.min /= 255.0;\r\n result.max /= 255.0;\r\n }\r\n\r\n if (fallbackToFullRange && result.min >= result.max) {\r\n result.min = 0;\r\n result.max = 1;\r\n }\r\n\r\n this.onAfterReductionPerformed.notifyObservers(result);\r\n }\r\n\r\n public dispose(disposeAll = true): void {\r\n this._readbackGeneration++;\r\n if (disposeAll) {\r\n this.onAfterReductionPerformed.clear();\r\n this._textureWidth = 0;\r\n this._textureHeight = 0;\r\n }\r\n\r\n for (let i = 0; i < this.reductionSteps.length; ++i) {\r\n this.reductionSteps[i].dispose();\r\n }\r\n this.reductionSteps.length = 0;\r\n }\r\n\r\n private _recreatePostProcesses() {\r\n this.dispose(false);\r\n\r\n const scene = this._scene;\r\n\r\n let w = this.textureWidth,\r\n h = this.textureHeight;\r\n\r\n const reductionInitial = new ThinMinMaxReducerPostProcess(\r\n \"Initial reduction phase\",\r\n scene.getEngine(),\r\n \"#define INITIAL\" +\r\n (w === 1 || h === 1 ? \"\\n#define CLAMP_REDUCTION_COORDS\" : \"\") +\r\n (this._sourceIsDepthTexture ? \"\\n#define DEPTH_TEXTURE\" : \"\") +\r\n (this._depthRedux ? \"\\n#define DEPTH_REDUX\" : \"\") +\r\n (this._depthTextureType === DepthTextureType.ViewDepth ? \"\\n#define VIEW_DEPTH\" : \"\")\r\n );\r\n\r\n reductionInitial.textureWidth = w;\r\n reductionInitial.textureHeight = h;\r\n\r\n this.reductionSteps.push(reductionInitial);\r\n\r\n let index = 1;\r\n\r\n // create the additional steps\r\n while (w > 1 || h > 1 || (w === 1 && h === 1 && index === 1)) {\r\n w = Math.max(Math.round(w / 2), 1);\r\n h = Math.max(Math.round(h / 2), 1);\r\n\r\n const reduction = new ThinMinMaxReducerPostProcess(\r\n \"Reduction phase \" + index,\r\n scene.getEngine(),\r\n \"#define \" + (w == 1 && h == 1 ? \"LAST\" : w == 1 || h == 1 ? \"ONEBEFORELAST\" : \"MAIN\")\r\n );\r\n\r\n reduction.textureWidth = w;\r\n reduction.textureHeight = h;\r\n reduction.useIntegerTextureSize = w === 1 || h === 1;\r\n\r\n this.reductionSteps.push(reduction);\r\n\r\n index++;\r\n }\r\n }\r\n}\r\n"]}
|
package/Misc/tools.pure.js
CHANGED
|
@@ -1241,7 +1241,7 @@ Tools._DefaultCdnUrl = "https://cdn.babylonjs.com";
|
|
|
1241
1241
|
* When set, unversioned CDN URLs will be rewritten to include this version prefix.
|
|
1242
1242
|
* @internal
|
|
1243
1243
|
*/
|
|
1244
|
-
Tools._CdnVersion = "9.
|
|
1244
|
+
Tools._CdnVersion = "9.32.0";
|
|
1245
1245
|
/**
|
|
1246
1246
|
* @internal
|
|
1247
1247
|
*/
|