@babylonjs/core 7.32.0 → 7.32.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/Behaviors/Cameras/autoRotationBehavior.js +1 -0
- package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
- package/Cameras/camera.d.ts +5 -2
- package/Cameras/camera.js +1 -0
- package/Cameras/camera.js.map +1 -1
- package/Decorators/nodeDecorator.d.ts +9 -1
- package/Decorators/nodeDecorator.js +8 -0
- package/Decorators/nodeDecorator.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js +40 -53
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +20 -8
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.debugging.js +16 -7
- package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js +43 -44
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +8 -6
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.d.ts +3 -3
- package/Engines/WebGPU/webgpuHardwareTexture.js +12 -9
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +25 -19
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +5 -3
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +6 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +6 -1
- package/Engines/constants.js +6 -1
- package/Engines/constants.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +7 -0
- package/Engines/renderTargetWrapper.js +15 -0
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +3 -1
- package/Engines/webgpuEngine.js +9 -8
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.d.ts +47 -0
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js +113 -0
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.d.ts +62 -0
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +171 -0
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.d.ts +51 -0
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js +127 -0
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.d.ts +67 -0
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js +187 -0
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.d.ts +77 -0
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js +232 -0
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.d.ts +47 -0
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js +113 -0
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/cullObjectsBlock.d.ts +41 -0
- package/FrameGraph/Node/Blocks/Rendering/cullObjectsBlock.js +79 -0
- package/FrameGraph/Node/Blocks/Rendering/cullObjectsBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +119 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +451 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.d.ts +63 -0
- package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js +154 -0
- package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Teleport/teleportInBlock.d.ts +59 -0
- package/FrameGraph/Node/Blocks/Teleport/teleportInBlock.js +131 -0
- package/FrameGraph/Node/Blocks/Teleport/teleportInBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Teleport/teleportOutBlock.d.ts +49 -0
- package/FrameGraph/Node/Blocks/Teleport/teleportOutBlock.js +107 -0
- package/FrameGraph/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +50 -0
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js +125 -0
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.d.ts +38 -0
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +71 -0
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.d.ts +34 -0
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js +59 -0
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/elbowBlock.d.ts +28 -0
- package/FrameGraph/Node/Blocks/elbowBlock.js +47 -0
- package/FrameGraph/Node/Blocks/elbowBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/index.d.ts +17 -0
- package/FrameGraph/Node/Blocks/index.js +18 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -0
- package/FrameGraph/Node/Blocks/inputBlock.d.ts +94 -0
- package/FrameGraph/Node/Blocks/inputBlock.js +270 -0
- package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/outputBlock.d.ts +30 -0
- package/FrameGraph/Node/Blocks/outputBlock.js +51 -0
- package/FrameGraph/Node/Blocks/outputBlock.js.map +1 -0
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +110 -0
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +78 -0
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -0
- package/FrameGraph/Node/nodeRenderGraph.d.ts +196 -0
- package/FrameGraph/Node/nodeRenderGraph.js +614 -0
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -0
- package/FrameGraph/Node/nodeRenderGraphBlock.d.ts +190 -0
- package/FrameGraph/Node/nodeRenderGraphBlock.js +495 -0
- package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -0
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.d.ts +143 -0
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +275 -0
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -0
- package/FrameGraph/Node/nodeRenderGraphBuildState.d.ts +21 -0
- package/FrameGraph/Node/nodeRenderGraphBuildState.js +35 -0
- package/FrameGraph/Node/nodeRenderGraphBuildState.js.map +1 -0
- package/FrameGraph/Passes/cullPass.d.ts +28 -0
- package/FrameGraph/Passes/cullPass.js +38 -0
- package/FrameGraph/Passes/cullPass.js.map +1 -0
- package/FrameGraph/Passes/pass.d.ts +14 -0
- package/FrameGraph/Passes/pass.js +20 -0
- package/FrameGraph/Passes/pass.js.map +1 -0
- package/FrameGraph/Passes/renderPass.d.ts +49 -0
- package/FrameGraph/Passes/renderPass.js +72 -0
- package/FrameGraph/Passes/renderPass.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.d.ts +16 -0
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js +17 -0
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.d.ts +12 -0
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js +21 -0
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +54 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +114 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/blurTask.d.ts +17 -0
- package/FrameGraph/Tasks/PostProcesses/blurTask.js +24 -0
- package/FrameGraph/Tasks/PostProcesses/blurTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.d.ts +30 -0
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js +35 -0
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.d.ts +12 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js +26 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.d.ts +12 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +29 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +65 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +134 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.d.ts +16 -0
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js +17 -0
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +41 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +64 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/cullObjectsTask.d.ts +28 -0
- package/FrameGraph/Tasks/Rendering/cullObjectsTask.js +52 -0
- package/FrameGraph/Tasks/Rendering/cullObjectsTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +145 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +259 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +66 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +127 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -0
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +34 -0
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +42 -0
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -0
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.d.ts +12 -0
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js +23 -0
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js.map +1 -0
- package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +26 -0
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +31 -0
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -0
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.d.ts +22 -0
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +34 -0
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -0
- package/FrameGraph/frameGraph.d.ts +143 -0
- package/FrameGraph/frameGraph.js +275 -0
- package/FrameGraph/frameGraph.js.map +1 -0
- package/FrameGraph/frameGraphContext.d.ts +5 -0
- package/FrameGraph/frameGraphContext.js +6 -0
- package/FrameGraph/frameGraphContext.js.map +1 -0
- package/FrameGraph/frameGraphObjectList.d.ts +15 -0
- package/FrameGraph/frameGraphObjectList.js +7 -0
- package/FrameGraph/frameGraphObjectList.js.map +1 -0
- package/FrameGraph/frameGraphRenderContext.d.ts +110 -0
- package/FrameGraph/frameGraphRenderContext.js +237 -0
- package/FrameGraph/frameGraphRenderContext.js.map +1 -0
- package/FrameGraph/frameGraphTask.d.ts +49 -0
- package/FrameGraph/frameGraphTask.js +117 -0
- package/FrameGraph/frameGraphTask.js.map +1 -0
- package/FrameGraph/frameGraphTextureManager.d.ts +50 -0
- package/FrameGraph/frameGraphTextureManager.js +277 -0
- package/FrameGraph/frameGraphTextureManager.js.map +1 -0
- package/FrameGraph/frameGraphTypes.d.ts +59 -0
- package/FrameGraph/frameGraphTypes.js +9 -0
- package/FrameGraph/frameGraphTypes.js.map +1 -0
- package/FrameGraph/index.d.ts +28 -0
- package/FrameGraph/index.js +30 -0
- package/FrameGraph/index.js.map +1 -0
- package/Gamepads/gamepadSceneComponent.d.ts +0 -1
- package/Gamepads/gamepadSceneComponent.js +1 -7
- package/Gamepads/gamepadSceneComponent.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.d.ts +7 -0
- package/Gizmos/boundingBoxGizmo.js +19 -6
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Inputs/scene.inputManager.d.ts +3 -1
- package/Inputs/scene.inputManager.js +20 -8
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Layers/layer.d.ts +1 -1
- package/Layers/layer.js +1 -1
- package/Layers/layer.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +4 -0
- package/Materials/PBR/pbrBaseMaterial.js +8 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/dynamicTexture.d.ts +32 -2
- package/Materials/Textures/dynamicTexture.js +13 -18
- package/Materials/Textures/dynamicTexture.js.map +1 -1
- package/Materials/Textures/index.d.ts +1 -0
- package/Materials/Textures/index.js +1 -0
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js +0 -6
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +20 -8
- package/Materials/Textures/multiRenderTarget.js +2 -0
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +8 -1
- package/Materials/Textures/renderTargetTexture.js +28 -10
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/textureCreationOptions.d.ts +20 -2
- package/Materials/Textures/textureCreationOptions.js +20 -1
- package/Materials/Textures/textureCreationOptions.js.map +1 -1
- package/Materials/effectRenderer.d.ts +132 -14
- package/Materials/effectRenderer.js +229 -33
- package/Materials/effectRenderer.js.map +1 -1
- package/Materials/index.d.ts +1 -0
- package/Materials/index.js +1 -0
- package/Materials/index.js.map +1 -1
- package/Materials/materialHelper.functions.js +2 -0
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/materialHelper.geometryrendering.d.ts +122 -0
- package/Materials/materialHelper.geometryrendering.js +259 -0
- package/Materials/materialHelper.geometryrendering.js.map +1 -0
- package/Materials/standardMaterial.d.ts +4 -0
- package/Materials/standardMaterial.js +8 -0
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/index.d.ts +1 -0
- package/Maths/index.js +1 -0
- package/Maths/index.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.d.ts +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +22 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js +39 -0
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
- package/Misc/copyTextureToTexture.d.ts +3 -2
- package/Misc/copyTextureToTexture.js +11 -5
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.d.ts +5 -3
- package/PostProcesses/blackAndWhitePostProcess.js +24 -19
- package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
- package/PostProcesses/bloomEffect.d.ts +7 -5
- package/PostProcesses/bloomEffect.js +49 -23
- package/PostProcesses/bloomEffect.js.map +1 -1
- package/PostProcesses/bloomMergePostProcess.d.ts +5 -5
- package/PostProcesses/bloomMergePostProcess.js +28 -19
- package/PostProcesses/bloomMergePostProcess.js.map +1 -1
- package/PostProcesses/blurPostProcess.d.ts +7 -43
- package/PostProcesses/blurPostProcess.js +47 -185
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/circleOfConfusionPostProcess.d.ts +13 -6
- package/PostProcesses/circleOfConfusionPostProcess.js +59 -38
- package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.d.ts +2 -6
- package/PostProcesses/depthOfFieldBlurPostProcess.js +14 -11
- package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldEffect.d.ts +5 -2
- package/PostProcesses/depthOfFieldEffect.js +53 -45
- package/PostProcesses/depthOfFieldEffect.js.map +1 -1
- package/PostProcesses/depthOfFieldMergePostProcess.d.ts +0 -1
- package/PostProcesses/depthOfFieldMergePostProcess.js +18 -12
- package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
- package/PostProcesses/extractHighlightsPostProcess.d.ts +8 -4
- package/PostProcesses/extractHighlightsPostProcess.js +35 -22
- package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
- package/PostProcesses/index.d.ts +6 -0
- package/PostProcesses/index.js +6 -0
- package/PostProcesses/index.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +15 -70
- package/PostProcesses/postProcess.js +80 -97
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/thinBlackAndWhitePostProcess.d.ts +28 -0
- package/PostProcesses/thinBlackAndWhitePostProcess.js +50 -0
- package/PostProcesses/thinBlackAndWhitePostProcess.js.map +1 -0
- package/PostProcesses/thinBloomEffect.d.ts +49 -0
- package/PostProcesses/thinBloomEffect.js +59 -0
- package/PostProcesses/thinBloomEffect.js.map +1 -0
- package/PostProcesses/thinBloomMergePostProcess.d.ts +15 -0
- package/PostProcesses/thinBloomMergePostProcess.js +38 -0
- package/PostProcesses/thinBloomMergePostProcess.js.map +1 -0
- package/PostProcesses/thinBlurPostProcess.d.ts +89 -0
- package/PostProcesses/thinBlurPostProcess.js +242 -0
- package/PostProcesses/thinBlurPostProcess.js.map +1 -0
- package/PostProcesses/thinCircleOfConfusionPostProcess.d.ts +62 -0
- package/PostProcesses/thinCircleOfConfusionPostProcess.js +81 -0
- package/PostProcesses/thinCircleOfConfusionPostProcess.js.map +1 -0
- package/PostProcesses/thinDepthOfFieldBlurPostProcess.d.ts +8 -0
- package/PostProcesses/thinDepthOfFieldBlurPostProcess.js +13 -0
- package/PostProcesses/thinDepthOfFieldBlurPostProcess.js.map +1 -0
- package/PostProcesses/thinDepthOfFieldEffect.d.ts +70 -0
- package/PostProcesses/thinDepthOfFieldEffect.js +115 -0
- package/PostProcesses/thinDepthOfFieldEffect.js.map +1 -0
- package/PostProcesses/thinDepthOfFieldMergePostProcess.d.ts +11 -0
- package/PostProcesses/thinDepthOfFieldMergePostProcess.js +30 -0
- package/PostProcesses/thinDepthOfFieldMergePostProcess.js.map +1 -0
- package/PostProcesses/thinExtractHighlightsPostProcess.d.ts +30 -0
- package/PostProcesses/thinExtractHighlightsPostProcess.js +55 -0
- package/PostProcesses/thinExtractHighlightsPostProcess.js.map +1 -0
- package/Rendering/depthPeelingRenderer.js +2 -2
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.js +4 -4
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockPrePass.d.ts +5 -0
- package/Shaders/ShadersInclude/pbrBlockPrePass.js +75 -0
- package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -0
- package/Shaders/ShadersInclude/prePassVertex.js +1 -2
- package/Shaders/ShadersInclude/prePassVertex.js.map +1 -1
- package/Shaders/circleOfConfusion.fragment.js +9 -1
- package/Shaders/circleOfConfusion.fragment.js.map +1 -1
- package/Shaders/colorCorrection.fragment.js +1 -0
- package/Shaders/colorCorrection.fragment.js.map +1 -1
- package/Shaders/default.fragment.js +17 -25
- package/Shaders/default.fragment.js.map +1 -1
- package/Shaders/default.vertex.js +4 -6
- package/Shaders/default.vertex.js.map +1 -1
- package/Shaders/pbr.fragment.d.ts +1 -0
- package/Shaders/pbr.fragment.js +2 -74
- package/Shaders/pbr.fragment.js.map +1 -1
- package/Shaders/pbr.vertex.js +3 -3
- package/Shaders/pbr.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +100 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/prePassVertex.js +1 -2
- package/ShadersWGSL/ShadersInclude/prePassVertex.js.map +1 -1
- package/ShadersWGSL/background.vertex.js +1 -1
- package/ShadersWGSL/background.vertex.js.map +1 -1
- package/ShadersWGSL/circleOfConfusion.fragment.js +10 -2
- package/ShadersWGSL/circleOfConfusion.fragment.js.map +1 -1
- package/ShadersWGSL/default.fragment.js +20 -31
- package/ShadersWGSL/default.fragment.js.map +1 -1
- package/ShadersWGSL/default.vertex.js +4 -5
- package/ShadersWGSL/default.vertex.js.map +1 -1
- package/ShadersWGSL/glowMapGeneration.fragment.js +1 -1
- package/ShadersWGSL/glowMapGeneration.fragment.js.map +1 -1
- package/ShadersWGSL/glowMapGeneration.vertex.js +1 -1
- package/ShadersWGSL/glowMapGeneration.vertex.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.d.ts +1 -0
- package/ShadersWGSL/pbr.fragment.js +2 -100
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/pbr.vertex.js +4 -2
- package/ShadersWGSL/pbr.vertex.js.map +1 -1
- package/XR/features/WebXRRawCameraAccess.js +1 -1
- package/XR/features/WebXRRawCameraAccess.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +19 -2
- package/scene.js +110 -13
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +0 -1
- package/sceneComponent.js +0 -1
- package/sceneComponent.js.map +1 -1
- package/types.d.ts +12 -0
- package/types.js.map +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { Nullable } from "../types";
|
|
1
|
+
import type { NonNullableFields, Nullable } from "../types";
|
|
2
2
|
import type { AbstractEngine } from "../Engines/abstractEngine";
|
|
3
3
|
import { Viewport } from "../Maths/math.viewport";
|
|
4
4
|
import { Observable } from "../Misc/observable";
|
|
5
|
+
import type { IShaderPath } from "./effect";
|
|
5
6
|
import { Effect } from "./effect";
|
|
6
7
|
import { DrawWrapper } from "./drawWrapper";
|
|
7
8
|
import type { IRenderTargetTexture, RenderTargetWrapper } from "../Engines/renderTargetWrapper";
|
|
8
|
-
import
|
|
9
|
+
import { ShaderLanguage } from "./shaderLanguage";
|
|
9
10
|
import "../Shaders/postprocess.vertex";
|
|
10
11
|
/**
|
|
11
12
|
* Effect Render Options
|
|
@@ -74,7 +75,7 @@ export declare class EffectRenderer {
|
|
|
74
75
|
/**
|
|
75
76
|
* renders one or more effects to a specified texture
|
|
76
77
|
* @param effectWrapper the effect to renderer
|
|
77
|
-
* @param outputTexture texture to draw to, if null it will render to the
|
|
78
|
+
* @param outputTexture texture to draw to, if null it will render to the currently bound frame buffer
|
|
78
79
|
*/
|
|
79
80
|
render(effectWrapper: EffectWrapper, outputTexture?: Nullable<RenderTargetWrapper | IRenderTargetTexture>): void;
|
|
80
81
|
/**
|
|
@@ -82,65 +83,160 @@ export declare class EffectRenderer {
|
|
|
82
83
|
*/
|
|
83
84
|
dispose(): void;
|
|
84
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Allows for custom processing of the shader code used by an effect wrapper
|
|
88
|
+
*/
|
|
89
|
+
export type EffectWrapperCustomShaderCodeProcessing = {
|
|
90
|
+
/**
|
|
91
|
+
* If provided, will be called two times with the vertex and fragment code so that this code can be updated after the #include have been processed
|
|
92
|
+
*/
|
|
93
|
+
processCodeAfterIncludes?: (postProcessName: string, shaderType: string, code: string) => string;
|
|
94
|
+
/**
|
|
95
|
+
* If provided, will be called two times with the vertex and fragment code so that this code can be updated before it is compiled by the GPU
|
|
96
|
+
*/
|
|
97
|
+
processFinalCode?: (postProcessName: string, shaderType: string, code: string) => string;
|
|
98
|
+
/**
|
|
99
|
+
* If provided, will be called before creating the effect to collect additional custom bindings (defines, uniforms, samplers)
|
|
100
|
+
*/
|
|
101
|
+
defineCustomBindings?: (postProcessName: string, defines: Nullable<string>, uniforms: string[], samplers: string[]) => Nullable<string>;
|
|
102
|
+
/**
|
|
103
|
+
* If provided, will be called when binding inputs to the shader code to allow the user to add custom bindings
|
|
104
|
+
*/
|
|
105
|
+
bindCustomBindings?: (postProcessName: string, effect: Effect) => void;
|
|
106
|
+
};
|
|
85
107
|
/**
|
|
86
108
|
* Options to create an EffectWrapper
|
|
87
109
|
*/
|
|
88
|
-
interface EffectWrapperCreationOptions {
|
|
110
|
+
export interface EffectWrapperCreationOptions {
|
|
89
111
|
/**
|
|
90
112
|
* Engine to use to create the effect
|
|
91
113
|
*/
|
|
92
|
-
engine
|
|
114
|
+
engine?: AbstractEngine;
|
|
93
115
|
/**
|
|
94
116
|
* Fragment shader for the effect
|
|
95
117
|
*/
|
|
96
|
-
fragmentShader
|
|
118
|
+
fragmentShader?: string;
|
|
97
119
|
/**
|
|
98
120
|
* Use the shader store instead of direct source code
|
|
99
121
|
*/
|
|
100
122
|
useShaderStore?: boolean;
|
|
101
123
|
/**
|
|
102
|
-
* Vertex shader for the effect
|
|
124
|
+
* Vertex shader for the effect (default: "postprocess")
|
|
103
125
|
*/
|
|
104
126
|
vertexShader?: string;
|
|
105
127
|
/**
|
|
106
|
-
*
|
|
128
|
+
* Alias for vertexShader
|
|
129
|
+
*/
|
|
130
|
+
vertexUrl?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Attributes to use in the shader (default: ["position"])
|
|
107
133
|
*/
|
|
108
134
|
attributeNames?: Array<string>;
|
|
109
135
|
/**
|
|
110
136
|
* Uniforms to use in the shader
|
|
111
137
|
*/
|
|
112
138
|
uniformNames?: Array<string>;
|
|
139
|
+
/**
|
|
140
|
+
* Alias for uniformNames. Note that if it is provided, it takes precedence over uniformNames.
|
|
141
|
+
*/
|
|
142
|
+
uniforms?: Nullable<string[]>;
|
|
113
143
|
/**
|
|
114
144
|
* Texture sampler names to use in the shader
|
|
115
145
|
*/
|
|
116
146
|
samplerNames?: Array<string>;
|
|
147
|
+
/**
|
|
148
|
+
* Alias for samplerNames. Note that if it is provided, it takes precedence over samplerNames.
|
|
149
|
+
*/
|
|
150
|
+
samplers?: Nullable<string[]>;
|
|
151
|
+
/**
|
|
152
|
+
* The list of uniform buffers used in the shader (if any)
|
|
153
|
+
*/
|
|
154
|
+
uniformBuffers?: Nullable<string[]>;
|
|
117
155
|
/**
|
|
118
156
|
* Defines to use in the shader
|
|
119
157
|
*/
|
|
120
|
-
defines?: Array<string
|
|
158
|
+
defines?: Nullable<string | Array<string>>;
|
|
159
|
+
/**
|
|
160
|
+
* The index parameters to be used for babylons include syntax "#include<kernelBlurVaryingDeclaration>[0..varyingCount]". (default: undefined)
|
|
161
|
+
* See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx
|
|
162
|
+
*/
|
|
163
|
+
indexParameters?: any;
|
|
164
|
+
/**
|
|
165
|
+
* If the shader should not be compiled immediately. (default: false)
|
|
166
|
+
*/
|
|
167
|
+
blockCompilation?: boolean;
|
|
121
168
|
/**
|
|
122
169
|
* Callback when effect is compiled
|
|
123
170
|
*/
|
|
124
171
|
onCompiled?: Nullable<(effect: Effect) => void>;
|
|
125
172
|
/**
|
|
126
|
-
* The friendly name of the effect
|
|
173
|
+
* The friendly name of the effect (default: "effectWrapper")
|
|
127
174
|
*/
|
|
128
175
|
name?: string;
|
|
129
176
|
/**
|
|
130
177
|
* The language the shader is written in (default: GLSL)
|
|
131
178
|
*/
|
|
132
179
|
shaderLanguage?: ShaderLanguage;
|
|
180
|
+
/**
|
|
181
|
+
* Defines additional code to call to prepare the shader code
|
|
182
|
+
*/
|
|
183
|
+
extraInitializations?: (useWebGPU: boolean, list: Promise<any>[]) => void;
|
|
133
184
|
/**
|
|
134
185
|
* Additional async code to run before preparing the effect
|
|
135
186
|
*/
|
|
136
187
|
extraInitializationsAsync?: () => Promise<void>;
|
|
188
|
+
/**
|
|
189
|
+
* If the effect should be used as a post process (default: false). If true, the effect will be created with a "scale" uniform and a "textureSampler" sampler
|
|
190
|
+
*/
|
|
191
|
+
useAsPostProcess?: boolean;
|
|
137
192
|
}
|
|
138
193
|
/**
|
|
139
194
|
* Wraps an effect to be used for rendering
|
|
140
195
|
*/
|
|
141
196
|
export declare class EffectWrapper {
|
|
142
197
|
/**
|
|
143
|
-
*
|
|
198
|
+
* Force code to compile to glsl even on WebGPU engines.
|
|
199
|
+
* False by default. This is mostly meant for backward compatibility.
|
|
200
|
+
*/
|
|
201
|
+
static ForceGLSL: boolean;
|
|
202
|
+
private static _CustomShaderCodeProcessing;
|
|
203
|
+
/**
|
|
204
|
+
* Registers a shader code processing with an effect wrapper name.
|
|
205
|
+
* @param effectWrapperName name of the effect wrapper. Use null for the fallback shader code processing. This is the shader code processing that will be used in case no specific shader code processing has been associated to an effect wrapper name
|
|
206
|
+
* @param customShaderCodeProcessing shader code processing to associate to the effect wrapper name
|
|
207
|
+
*/
|
|
208
|
+
static RegisterShaderCodeProcessing(effectWrapperName: Nullable<string>, customShaderCodeProcessing?: EffectWrapperCustomShaderCodeProcessing): void;
|
|
209
|
+
private static _GetShaderCodeProcessing;
|
|
210
|
+
/**
|
|
211
|
+
* Gets or sets the name of the effect wrapper
|
|
212
|
+
*/
|
|
213
|
+
get name(): string;
|
|
214
|
+
set name(value: string);
|
|
215
|
+
/**
|
|
216
|
+
* Type of alpha mode to use when applying the effect (default: Engine.ALPHA_DISABLE)
|
|
217
|
+
*/
|
|
218
|
+
alphaMode: number;
|
|
219
|
+
/**
|
|
220
|
+
* Executed when the effect is created
|
|
221
|
+
* @returns effect that was created for this effect wrapper
|
|
222
|
+
*/
|
|
223
|
+
onEffectCreatedObservable: Observable<Effect>;
|
|
224
|
+
/**
|
|
225
|
+
* Options used to create the effect wrapper
|
|
226
|
+
*/
|
|
227
|
+
readonly options: Required<NonNullableFields<EffectWrapperCreationOptions>>;
|
|
228
|
+
/**
|
|
229
|
+
* Get a value indicating if the effect is ready to be used
|
|
230
|
+
* @returns true if the post-process is ready (shader is compiled)
|
|
231
|
+
*/
|
|
232
|
+
isReady(): boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Get the draw wrapper associated with the effect wrapper
|
|
235
|
+
* @returns the draw wrapper associated with the effect wrapper
|
|
236
|
+
*/
|
|
237
|
+
get drawWrapper(): DrawWrapper;
|
|
238
|
+
/**
|
|
239
|
+
* Event that is fired (only when the EffectWrapper is used with an EffectRenderer) right before the effect is drawn (should be used to update uniforms)
|
|
144
240
|
*/
|
|
145
241
|
onApplyObservable: Observable<{}>;
|
|
146
242
|
/**
|
|
@@ -148,18 +244,40 @@ export declare class EffectWrapper {
|
|
|
148
244
|
*/
|
|
149
245
|
get effect(): Effect;
|
|
150
246
|
set effect(effect: Effect);
|
|
247
|
+
protected readonly _drawWrapper: DrawWrapper;
|
|
248
|
+
protected _shadersLoaded: boolean;
|
|
249
|
+
protected readonly _shaderPath: IShaderPath;
|
|
151
250
|
/** @internal */
|
|
152
|
-
|
|
251
|
+
_webGPUReady: boolean;
|
|
153
252
|
private _onContextRestoredObserver;
|
|
154
253
|
/**
|
|
155
|
-
* Creates an effect to be
|
|
254
|
+
* Creates an effect to be rendered
|
|
156
255
|
* @param creationOptions options to create the effect
|
|
157
256
|
*/
|
|
158
257
|
constructor(creationOptions: EffectWrapperCreationOptions);
|
|
258
|
+
protected _gatherImports(useWebGPU: boolean | undefined, list: Promise<any>[]): void;
|
|
259
|
+
private _importPromises;
|
|
260
|
+
/** @internal */
|
|
261
|
+
_postConstructor(blockCompilation: boolean, defines?: Nullable<string>, extraInitializations?: (useWebGPU: boolean, list: Promise<any>[]) => void, importPromises?: Array<Promise<any>>): void;
|
|
262
|
+
/**
|
|
263
|
+
* Updates the effect with the current effect wrapper compile time values and recompiles the shader.
|
|
264
|
+
* @param defines Define statements that should be added at the beginning of the shader. (default: null)
|
|
265
|
+
* @param uniforms Set of uniform variables that will be passed to the shader. (default: null)
|
|
266
|
+
* @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)
|
|
267
|
+
* @param indexParameters The index parameters to be used for babylons include syntax "#include<kernelBlurVaryingDeclaration>[0..varyingCount]". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx
|
|
268
|
+
* @param onCompiled Called when the shader has been compiled.
|
|
269
|
+
* @param onError Called if there is an error when compiling a shader.
|
|
270
|
+
* @param vertexUrl The url of the vertex shader to be used (default: the one given at construction time)
|
|
271
|
+
* @param fragmentUrl The url of the fragment shader to be used (default: the one given at construction time)
|
|
272
|
+
*/
|
|
273
|
+
updateEffect(defines?: Nullable<string>, uniforms?: Nullable<string[]>, samplers?: Nullable<string[]>, indexParameters?: any, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, vertexUrl?: string, fragmentUrl?: string): void;
|
|
274
|
+
/**
|
|
275
|
+
* Binds the data to the effect.
|
|
276
|
+
*/
|
|
277
|
+
bind(): void;
|
|
159
278
|
/**
|
|
160
279
|
* Disposes of the effect wrapper
|
|
161
280
|
* @param _ignored kept for backward compatibility
|
|
162
281
|
*/
|
|
163
282
|
dispose(_ignored?: boolean): void;
|
|
164
283
|
}
|
|
165
|
-
export {};
|
|
@@ -62,7 +62,7 @@ export class EffectRenderer {
|
|
|
62
62
|
this.engine.setState(true);
|
|
63
63
|
this.engine.depthCullingState.depthTest = false;
|
|
64
64
|
this.engine.stencilState.stencilTest = false;
|
|
65
|
-
this.engine.enableEffect(effectWrapper.
|
|
65
|
+
this.engine.enableEffect(effectWrapper.drawWrapper);
|
|
66
66
|
this.bindBuffers(effectWrapper.effect);
|
|
67
67
|
effectWrapper.onApplyObservable.notifyObservers({});
|
|
68
68
|
}
|
|
@@ -92,7 +92,7 @@ export class EffectRenderer {
|
|
|
92
92
|
/**
|
|
93
93
|
* renders one or more effects to a specified texture
|
|
94
94
|
* @param effectWrapper the effect to renderer
|
|
95
|
-
* @param outputTexture texture to draw to, if null it will render to the
|
|
95
|
+
* @param outputTexture texture to draw to, if null it will render to the currently bound frame buffer
|
|
96
96
|
*/
|
|
97
97
|
render(effectWrapper, outputTexture = null) {
|
|
98
98
|
// Ensure effect is ready
|
|
@@ -135,6 +135,44 @@ export class EffectRenderer {
|
|
|
135
135
|
* Wraps an effect to be used for rendering
|
|
136
136
|
*/
|
|
137
137
|
export class EffectWrapper {
|
|
138
|
+
/**
|
|
139
|
+
* Registers a shader code processing with an effect wrapper name.
|
|
140
|
+
* @param effectWrapperName name of the effect wrapper. Use null for the fallback shader code processing. This is the shader code processing that will be used in case no specific shader code processing has been associated to an effect wrapper name
|
|
141
|
+
* @param customShaderCodeProcessing shader code processing to associate to the effect wrapper name
|
|
142
|
+
*/
|
|
143
|
+
static RegisterShaderCodeProcessing(effectWrapperName, customShaderCodeProcessing) {
|
|
144
|
+
if (!customShaderCodeProcessing) {
|
|
145
|
+
delete EffectWrapper._CustomShaderCodeProcessing[effectWrapperName ?? ""];
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
EffectWrapper._CustomShaderCodeProcessing[effectWrapperName ?? ""] = customShaderCodeProcessing;
|
|
149
|
+
}
|
|
150
|
+
static _GetShaderCodeProcessing(effectWrapperName) {
|
|
151
|
+
return EffectWrapper._CustomShaderCodeProcessing[effectWrapperName] ?? EffectWrapper._CustomShaderCodeProcessing[""];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Gets or sets the name of the effect wrapper
|
|
155
|
+
*/
|
|
156
|
+
get name() {
|
|
157
|
+
return this.options.name;
|
|
158
|
+
}
|
|
159
|
+
set name(value) {
|
|
160
|
+
this.options.name = value;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get a value indicating if the effect is ready to be used
|
|
164
|
+
* @returns true if the post-process is ready (shader is compiled)
|
|
165
|
+
*/
|
|
166
|
+
isReady() {
|
|
167
|
+
return this._drawWrapper.effect?.isReady() ?? false;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get the draw wrapper associated with the effect wrapper
|
|
171
|
+
* @returns the draw wrapper associated with the effect wrapper
|
|
172
|
+
*/
|
|
173
|
+
get drawWrapper() {
|
|
174
|
+
return this._drawWrapper;
|
|
175
|
+
}
|
|
138
176
|
/**
|
|
139
177
|
* The underlying effect
|
|
140
178
|
*/
|
|
@@ -145,54 +183,205 @@ export class EffectWrapper {
|
|
|
145
183
|
this._drawWrapper.effect = effect;
|
|
146
184
|
}
|
|
147
185
|
/**
|
|
148
|
-
* Creates an effect to be
|
|
186
|
+
* Creates an effect to be rendered
|
|
149
187
|
* @param creationOptions options to create the effect
|
|
150
188
|
*/
|
|
151
189
|
constructor(creationOptions) {
|
|
152
190
|
/**
|
|
153
|
-
*
|
|
191
|
+
* Type of alpha mode to use when applying the effect (default: Engine.ALPHA_DISABLE)
|
|
192
|
+
*/
|
|
193
|
+
this.alphaMode = 0;
|
|
194
|
+
/**
|
|
195
|
+
* Executed when the effect is created
|
|
196
|
+
* @returns effect that was created for this effect wrapper
|
|
197
|
+
*/
|
|
198
|
+
this.onEffectCreatedObservable = new Observable(undefined, true);
|
|
199
|
+
/**
|
|
200
|
+
* Event that is fired (only when the EffectWrapper is used with an EffectRenderer) right before the effect is drawn (should be used to update uniforms)
|
|
154
201
|
*/
|
|
155
202
|
this.onApplyObservable = new Observable();
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
203
|
+
this._shadersLoaded = false;
|
|
204
|
+
/** @internal */
|
|
205
|
+
this._webGPUReady = false;
|
|
206
|
+
this._importPromises = [];
|
|
207
|
+
this.options = {
|
|
208
|
+
...creationOptions,
|
|
209
|
+
name: creationOptions.name || "effectWrapper",
|
|
210
|
+
engine: creationOptions.engine,
|
|
211
|
+
uniforms: creationOptions.uniforms || creationOptions.uniformNames || [],
|
|
212
|
+
uniformNames: undefined,
|
|
213
|
+
samplers: creationOptions.samplers || creationOptions.samplerNames || [],
|
|
214
|
+
samplerNames: undefined,
|
|
215
|
+
attributeNames: creationOptions.attributeNames || ["position"],
|
|
216
|
+
uniformBuffers: creationOptions.uniformBuffers || [],
|
|
217
|
+
defines: creationOptions.defines || "",
|
|
218
|
+
useShaderStore: creationOptions.useShaderStore || false,
|
|
219
|
+
vertexUrl: creationOptions.vertexUrl || creationOptions.vertexShader || "postprocess",
|
|
220
|
+
vertexShader: undefined,
|
|
221
|
+
fragmentShader: creationOptions.fragmentShader || "pass",
|
|
222
|
+
indexParameters: creationOptions.indexParameters,
|
|
223
|
+
blockCompilation: creationOptions.blockCompilation || false,
|
|
224
|
+
shaderLanguage: creationOptions.shaderLanguage || 0 /* ShaderLanguage.GLSL */,
|
|
225
|
+
onCompiled: creationOptions.onCompiled || undefined,
|
|
226
|
+
extraInitializations: creationOptions.extraInitializations || undefined,
|
|
227
|
+
extraInitializationsAsync: creationOptions.extraInitializationsAsync || undefined,
|
|
228
|
+
useAsPostProcess: creationOptions.useAsPostProcess ?? false,
|
|
229
|
+
};
|
|
230
|
+
this.options.uniformNames = this.options.uniforms;
|
|
231
|
+
this.options.samplerNames = this.options.samplers;
|
|
232
|
+
this.options.vertexShader = this.options.vertexUrl;
|
|
233
|
+
if (this.options.useAsPostProcess) {
|
|
234
|
+
if (this.options.samplers.indexOf("textureSampler") === -1) {
|
|
235
|
+
this.options.samplers.push("textureSampler");
|
|
236
|
+
}
|
|
237
|
+
if (this.options.uniforms.indexOf("scale") === -1) {
|
|
238
|
+
this.options.uniforms.push("scale");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (creationOptions.vertexUrl || creationOptions.vertexShader) {
|
|
242
|
+
this._shaderPath = {
|
|
243
|
+
vertexSource: this.options.vertexShader,
|
|
163
244
|
};
|
|
164
245
|
}
|
|
165
246
|
else {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
247
|
+
if (!this.options.useAsPostProcess) {
|
|
248
|
+
this.options.uniforms.push("scale");
|
|
249
|
+
this.onApplyObservable.add(() => {
|
|
250
|
+
this.effect.setFloat2("scale", 1, 1);
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
this._shaderPath = {
|
|
254
|
+
vertex: this.options.vertexShader,
|
|
172
255
|
};
|
|
173
|
-
// Sets the default scale to identity for the post process vertex shader.
|
|
174
|
-
this.onApplyObservable.add(() => {
|
|
175
|
-
this.effect.setFloat2("scale", 1, 1);
|
|
176
|
-
});
|
|
177
256
|
}
|
|
178
|
-
|
|
179
|
-
this.
|
|
180
|
-
if (
|
|
181
|
-
|
|
182
|
-
if (!
|
|
183
|
-
|
|
257
|
+
this._shaderPath.fragmentSource = this.options.fragmentShader;
|
|
258
|
+
this._shaderPath.spectorName = this.options.name;
|
|
259
|
+
if (this.options.useShaderStore) {
|
|
260
|
+
this._shaderPath.fragment = this._shaderPath.fragmentSource;
|
|
261
|
+
if (!this._shaderPath.vertex) {
|
|
262
|
+
this._shaderPath.vertex = this._shaderPath.vertexSource;
|
|
184
263
|
}
|
|
185
|
-
delete
|
|
186
|
-
delete
|
|
187
|
-
this.effect = creationOptions.engine.createEffect(shaderPath, creationOptions.attributeNames || ["position"], uniformNames, creationOptions.samplerNames, defines, undefined, creationOptions.onCompiled, undefined, undefined, creationOptions.shaderLanguage, creationOptions.extraInitializationsAsync);
|
|
264
|
+
delete this._shaderPath.fragmentSource;
|
|
265
|
+
delete this._shaderPath.vertexSource;
|
|
188
266
|
}
|
|
189
|
-
|
|
190
|
-
this.
|
|
191
|
-
|
|
267
|
+
this.onApplyObservable.add(() => {
|
|
268
|
+
this.bind();
|
|
269
|
+
});
|
|
270
|
+
if (!this.options.useShaderStore) {
|
|
271
|
+
this._onContextRestoredObserver = this.options.engine.onContextRestoredObservable.add(() => {
|
|
192
272
|
this.effect._pipelineContext = null; // because _prepareEffect will try to dispose this pipeline before recreating it and that would lead to webgl errors
|
|
193
273
|
this.effect._prepareEffect();
|
|
194
274
|
});
|
|
195
275
|
}
|
|
276
|
+
this._drawWrapper = new DrawWrapper(this.options.engine);
|
|
277
|
+
this._webGPUReady = this.options.shaderLanguage === 1 /* ShaderLanguage.WGSL */;
|
|
278
|
+
const defines = Array.isArray(this.options.defines) ? this.options.defines.join("\n") : this.options.defines;
|
|
279
|
+
this._postConstructor(this.options.blockCompilation, defines, this.options.extraInitializations);
|
|
280
|
+
}
|
|
281
|
+
_gatherImports(useWebGPU = false, list) {
|
|
282
|
+
if (!this.options.useAsPostProcess) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
// this._webGPUReady is used to detect when an effect wrapper is intended to be used with WebGPU
|
|
286
|
+
if (useWebGPU && this._webGPUReady) {
|
|
287
|
+
list.push(Promise.all([import("../ShadersWGSL/postprocess.vertex.js")]));
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
list.push(Promise.all([import("../Shaders/postprocess.vertex.js")]));
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/** @internal */
|
|
294
|
+
_postConstructor(blockCompilation, defines = null, extraInitializations, importPromises) {
|
|
295
|
+
this._importPromises.length = 0;
|
|
296
|
+
if (importPromises) {
|
|
297
|
+
this._importPromises.push(...importPromises);
|
|
298
|
+
}
|
|
299
|
+
const useWebGPU = this.options.engine.isWebGPU && !EffectWrapper.ForceGLSL;
|
|
300
|
+
this._gatherImports(useWebGPU, this._importPromises);
|
|
301
|
+
if (extraInitializations !== undefined) {
|
|
302
|
+
extraInitializations(useWebGPU, this._importPromises);
|
|
303
|
+
}
|
|
304
|
+
if (useWebGPU && this._webGPUReady) {
|
|
305
|
+
this.options.shaderLanguage = 1 /* ShaderLanguage.WGSL */;
|
|
306
|
+
}
|
|
307
|
+
if (!blockCompilation) {
|
|
308
|
+
this.updateEffect(defines);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Updates the effect with the current effect wrapper compile time values and recompiles the shader.
|
|
313
|
+
* @param defines Define statements that should be added at the beginning of the shader. (default: null)
|
|
314
|
+
* @param uniforms Set of uniform variables that will be passed to the shader. (default: null)
|
|
315
|
+
* @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)
|
|
316
|
+
* @param indexParameters The index parameters to be used for babylons include syntax "#include<kernelBlurVaryingDeclaration>[0..varyingCount]". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx
|
|
317
|
+
* @param onCompiled Called when the shader has been compiled.
|
|
318
|
+
* @param onError Called if there is an error when compiling a shader.
|
|
319
|
+
* @param vertexUrl The url of the vertex shader to be used (default: the one given at construction time)
|
|
320
|
+
* @param fragmentUrl The url of the fragment shader to be used (default: the one given at construction time)
|
|
321
|
+
*/
|
|
322
|
+
updateEffect(defines = null, uniforms = null, samplers = null, indexParameters, onCompiled, onError, vertexUrl, fragmentUrl) {
|
|
323
|
+
const customShaderCodeProcessing = EffectWrapper._GetShaderCodeProcessing(this.name);
|
|
324
|
+
if (customShaderCodeProcessing?.defineCustomBindings) {
|
|
325
|
+
const newUniforms = uniforms?.slice() ?? [];
|
|
326
|
+
newUniforms.push(...this.options.uniforms);
|
|
327
|
+
const newSamplers = samplers?.slice() ?? [];
|
|
328
|
+
newSamplers.push(...this.options.samplers);
|
|
329
|
+
defines = customShaderCodeProcessing.defineCustomBindings(this.name, defines, newUniforms, newSamplers);
|
|
330
|
+
uniforms = newUniforms;
|
|
331
|
+
samplers = newSamplers;
|
|
332
|
+
}
|
|
333
|
+
this.options.defines = defines || "";
|
|
334
|
+
const waitImportsLoaded = this._shadersLoaded || this._importPromises.length === 0
|
|
335
|
+
? undefined
|
|
336
|
+
: async () => {
|
|
337
|
+
await Promise.all(this._importPromises);
|
|
338
|
+
this._shadersLoaded = true;
|
|
339
|
+
};
|
|
340
|
+
let extraInitializationsAsync;
|
|
341
|
+
if (this.options.extraInitializationsAsync) {
|
|
342
|
+
extraInitializationsAsync = async () => {
|
|
343
|
+
waitImportsLoaded?.();
|
|
344
|
+
await this.options.extraInitializationsAsync;
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
extraInitializationsAsync = waitImportsLoaded;
|
|
349
|
+
}
|
|
350
|
+
if (this.options.useShaderStore) {
|
|
351
|
+
this._drawWrapper.effect = this.options.engine.createEffect({ vertex: vertexUrl ?? this._shaderPath.vertex, fragment: fragmentUrl ?? this._shaderPath.fragment }, {
|
|
352
|
+
attributes: this.options.attributeNames,
|
|
353
|
+
uniformsNames: uniforms || this.options.uniforms,
|
|
354
|
+
uniformBuffersNames: this.options.uniformBuffers,
|
|
355
|
+
samplers: samplers || this.options.samplers,
|
|
356
|
+
defines: defines !== null ? defines : "",
|
|
357
|
+
fallbacks: null,
|
|
358
|
+
onCompiled: onCompiled ?? this.options.onCompiled,
|
|
359
|
+
onError: onError ?? null,
|
|
360
|
+
indexParameters: indexParameters || this.options.indexParameters,
|
|
361
|
+
processCodeAfterIncludes: customShaderCodeProcessing?.processCodeAfterIncludes
|
|
362
|
+
? (shaderType, code) => customShaderCodeProcessing.processCodeAfterIncludes(this.name, shaderType, code)
|
|
363
|
+
: null,
|
|
364
|
+
processFinalCode: customShaderCodeProcessing?.processFinalCode
|
|
365
|
+
? (shaderType, code) => customShaderCodeProcessing.processFinalCode(this.name, shaderType, code)
|
|
366
|
+
: null,
|
|
367
|
+
shaderLanguage: this.options.shaderLanguage,
|
|
368
|
+
extraInitializationsAsync,
|
|
369
|
+
}, this.options.engine);
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
this._drawWrapper.effect = new Effect(this._shaderPath, this.options.attributeNames, uniforms || this.options.uniforms, samplers || this.options.samplerNames, this.options.engine, defines, undefined, onCompiled || this.options.onCompiled, undefined, undefined, undefined, this.options.shaderLanguage, extraInitializationsAsync);
|
|
373
|
+
}
|
|
374
|
+
this.onEffectCreatedObservable.notifyObservers(this._drawWrapper.effect);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Binds the data to the effect.
|
|
378
|
+
*/
|
|
379
|
+
bind() {
|
|
380
|
+
this.options.engine.setAlphaMode(this.alphaMode);
|
|
381
|
+
if (this.options.useAsPostProcess) {
|
|
382
|
+
this.drawWrapper.effect.setFloat2("scale", 1, 1);
|
|
383
|
+
}
|
|
384
|
+
EffectWrapper._GetShaderCodeProcessing(this.name)?.bindCustomBindings?.(this.name, this._drawWrapper.effect);
|
|
196
385
|
}
|
|
197
386
|
/**
|
|
198
387
|
* Disposes of the effect wrapper
|
|
@@ -203,7 +392,14 @@ export class EffectWrapper {
|
|
|
203
392
|
this.effect.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);
|
|
204
393
|
this._onContextRestoredObserver = null;
|
|
205
394
|
}
|
|
395
|
+
this.onEffectCreatedObservable.clear();
|
|
206
396
|
this.effect.dispose();
|
|
207
397
|
}
|
|
208
398
|
}
|
|
399
|
+
/**
|
|
400
|
+
* Force code to compile to glsl even on WebGPU engines.
|
|
401
|
+
* False by default. This is mostly meant for backward compatibility.
|
|
402
|
+
*/
|
|
403
|
+
EffectWrapper.ForceGLSL = false;
|
|
404
|
+
EffectWrapper._CustomShaderCodeProcessing = {};
|
|
209
405
|
//# sourceMappingURL=effectRenderer.js.map
|