@onerjs/core 8.53.5 → 8.53.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animationGroup.d.ts +0 -1
- package/Animations/animationGroup.js +0 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/animationGroup.pure.js +2 -0
- package/Animations/animationGroup.pure.js.map +1 -1
- package/Animations/runtimeAnimation.js +11 -0
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioSceneComponent.pure.js +1 -1
- package/AudioV2/abstractAudio/abstractSound.d.ts +2 -1
- package/AudioV2/abstractAudio/abstractSound.js +7 -2
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSoundInstance.d.ts +3 -1
- package/AudioV2/abstractAudio/abstractSoundInstance.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.d.ts +6 -0
- package/AudioV2/abstractAudio/staticSound.js +17 -1
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/staticSoundInstance.d.ts +4 -2
- package/AudioV2/abstractAudio/staticSoundInstance.js.map +1 -1
- package/AudioV2/abstractAudio/streamingSound.d.ts +6 -0
- package/AudioV2/abstractAudio/streamingSound.js +9 -1
- package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +7 -1
- package/AudioV2/webAudio/webAudioStaticSound.js +56 -8
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.d.ts +3 -1
- package/AudioV2/webAudio/webAudioStreamingSound.js +16 -4
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.d.ts +2 -2
- package/BakedVertexAnimation/bakedVertexAnimationManager.js +151 -121
- package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
- package/Behaviors/Cameras/interpolatingBehavior.d.ts +17 -2
- package/Behaviors/Cameras/interpolatingBehavior.js +53 -23
- package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
- package/Bones/bone.pure.js +3 -3
- package/Buffers/buffer.pure.js +0 -12
- package/Buffers/buffer.pure.js.map +1 -1
- package/Cameras/Inputs/BaseCameraMouseWheelInput.js +141 -126
- package/Cameras/Inputs/BaseCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.d.ts +2 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +290 -277
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraGamepadInput.js +115 -102
- package/Cameras/Inputs/arcRotateCameraGamepadInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.d.ts +3 -0
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js +334 -273
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +273 -258
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraPointersInput.js +237 -213
- package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraKeyboardInput.js +199 -168
- package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraMouseInput.js +243 -229
- package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/followCameraKeyboardMoveInput.js +311 -266
- package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/followCameraMouseWheelInput.js +139 -119
- package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/followCameraPointersInput.js +239 -203
- package/Cameras/Inputs/followCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraGamepadInput.js +127 -114
- package/Cameras/Inputs/freeCameraGamepadInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +278 -244
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js +216 -202
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseWheelInput.js +368 -353
- package/Cameras/Inputs/freeCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraTouchInput.js +185 -172
- package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraKeyboardInput.d.ts +2 -0
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js +291 -246
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +11 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.js +18 -2
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/orbitCameraPointersInput.js +112 -96
- package/Cameras/Inputs/orbitCameraPointersInput.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.d.ts +0 -2
- package/Cameras/VR/vrExperienceHelper.js +0 -2
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.pure.js +5 -0
- package/Cameras/VR/vrExperienceHelper.pure.js.map +1 -1
- package/Cameras/arcRotateCamera.pure.js +1559 -1479
- package/Cameras/arcRotateCamera.pure.js.map +1 -1
- package/Cameras/camera.pure.js +1225 -1178
- package/Cameras/camera.pure.js.map +1 -1
- package/Cameras/flyCamera.pure.js +369 -351
- package/Cameras/flyCamera.pure.js.map +1 -1
- package/Cameras/followCamera.pure.js +229 -192
- package/Cameras/followCamera.pure.js.map +1 -1
- package/Cameras/freeCamera.pure.js +373 -351
- package/Cameras/freeCamera.pure.js.map +1 -1
- package/Cameras/geospatialCamera.pure.d.ts +30 -7
- package/Cameras/geospatialCamera.pure.js +502 -457
- package/Cameras/geospatialCamera.pure.js.map +1 -1
- package/Cameras/geospatialCameraMovement.js +2 -2
- package/Cameras/geospatialCameraMovement.js.map +1 -1
- package/Cameras/targetCamera.pure.d.ts +7 -0
- package/Cameras/targetCamera.pure.js +550 -509
- package/Cameras/targetCamera.pure.js.map +1 -1
- package/Cameras/universalCamera.pure.js +98 -85
- package/Cameras/universalCamera.pure.js.map +1 -1
- package/Collisions/gpuPicker.d.ts +111 -4
- package/Collisions/gpuPicker.js +696 -119
- package/Collisions/gpuPicker.js.map +1 -1
- package/Compute/computeShader.pure.js +372 -355
- package/Compute/computeShader.pure.js.map +1 -1
- package/Culling/Helper/transformFeedbackBoundingHelper.pure.js +2 -2
- package/Decorators/nodeDecorator.d.ts +11 -1
- package/Decorators/nodeDecorator.js +43 -6
- package/Decorators/nodeDecorator.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.loadFile.pure.js +8 -0
- package/Engines/AbstractEngine/abstractEngine.loadFile.pure.js.map +1 -1
- package/Engines/Native/nativeHelpers.js +15 -0
- package/Engines/Native/nativeHelpers.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +7 -2
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.d.ts +5 -0
- package/Engines/Native/nativeRenderTargetWrapper.js +35 -1
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/Processors/shaderProcessor.js +5 -3
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js +16 -3
- package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.pure.js +7 -1
- package/Engines/WebGPU/webgpuClearQuad.pure.js.map +1 -1
- package/Engines/abstractEngine.functions.d.ts +8 -2
- package/Engines/abstractEngine.functions.js +12 -4
- package/Engines/abstractEngine.functions.js.map +1 -1
- package/Engines/abstractEngine.pure.d.ts +20 -1
- package/Engines/abstractEngine.pure.js +21 -134
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/engine.d.ts +208 -0
- package/Engines/engine.pure.js +0 -15
- package/Engines/engine.pure.js.map +1 -1
- package/Engines/nullEngine.pure.d.ts +66 -0
- package/Engines/nullEngine.pure.js +97 -0
- package/Engines/nullEngine.pure.js.map +1 -1
- package/Engines/thinEngine.pure.d.ts +0 -13
- package/Engines/thinEngine.pure.js +4 -23
- package/Engines/thinEngine.pure.js.map +1 -1
- package/Engines/thinNativeEngine.d.ts +0 -1
- package/Engines/thinNativeEngine.js +0 -1
- package/Engines/thinNativeEngine.js.map +1 -1
- package/Engines/thinNativeEngine.pure.d.ts +27 -0
- package/Engines/thinNativeEngine.pure.js +383 -17
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +1 -0
- package/Engines/webgpuEngine.js +1 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/Engines/webgpuEngine.pure.d.ts +9 -0
- package/Engines/webgpuEngine.pure.js +7 -0
- package/Engines/webgpuEngine.pure.js.map +1 -1
- package/FlowGraph/flowGraph.js +9 -0
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphContext.js +597 -584
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.pure.d.ts +14 -0
- package/FlowGraph/flowGraphDataConnection.pure.js +38 -1
- package/FlowGraph/flowGraphDataConnection.pure.js.map +1 -1
- package/FlowGraph/serialization.d.ts +11 -0
- package/FlowGraph/serialization.js +11 -1
- package/FlowGraph/serialization.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.pure.js +182 -170
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.pure.js +196 -184
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js +222 -210
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +123 -111
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +158 -146
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.pure.js +63 -51
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.pure.js +122 -110
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.pure.js +76 -64
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.pure.js +89 -77
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.pure.js +134 -122
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.pure.js +58 -46
- package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.pure.js +107 -95
- package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.pure.js +181 -169
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.pure.js +63 -51
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.pure.js +63 -51
- package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.pure.js +76 -64
- package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.pure.js +246 -234
- package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/motionBlurPostProcessBlock.pure.js +108 -96
- package/FrameGraph/Node/Blocks/PostProcesses/motionBlurPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.pure.js +87 -75
- package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.pure.js +76 -64
- package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.pure.js +313 -301
- package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.pure.js +502 -490
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.pure.js +147 -135
- package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.pure.js +90 -78
- package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.pure.js +179 -167
- package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +462 -451
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.js +265 -253
- package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.pure.js +204 -192
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js +611 -550
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/iblShadowsRendererBlock.pure.js +320 -308
- package/FrameGraph/Node/Blocks/Rendering/iblShadowsRendererBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.pure.js +87 -75
- package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/clearBlock.pure.js +154 -142
- package/FrameGraph/Node/Blocks/Textures/clearBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.pure.js +150 -138
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/inputBlock.pure.js +270 -256
- package/FrameGraph/Node/Blocks/inputBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/lightingVolumeBlock.pure.js +95 -83
- package/FrameGraph/Node/Blocks/lightingVolumeBlock.pure.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +715 -693
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlock.js +548 -533
- package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js +43 -51
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.d.ts +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.d.ts +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js +66 -35
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js.map +1 -1
- package/Helpers/environmentHelper.js +2 -2
- package/Helpers/environmentHelper.js.map +1 -1
- package/Layers/effectLayer.js +529 -519
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.pure.js +428 -413
- package/Layers/glowLayer.pure.js.map +1 -1
- package/Layers/highlightLayer.pure.js +473 -458
- package/Layers/highlightLayer.pure.js.map +1 -1
- package/Layers/selectionOutlineLayer.pure.js +360 -345
- package/Layers/selectionOutlineLayer.pure.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.d.ts +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.js +583 -558
- package/Lights/Clustered/clusteredLightContainer.pure.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +6 -1
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/areaLight.pure.js +61 -39
- package/Lights/areaLight.pure.js.map +1 -1
- package/Lights/directionalLight.pure.js +308 -284
- package/Lights/directionalLight.pure.js.map +1 -1
- package/Lights/hemisphericLight.pure.js +123 -104
- package/Lights/hemisphericLight.pure.js.map +1 -1
- package/Lights/light.d.ts +5 -3
- package/Lights/light.js +869 -827
- package/Lights/light.js.map +1 -1
- package/Lights/pointLight.pure.js +185 -174
- package/Lights/pointLight.pure.js.map +1 -1
- package/Lights/rectAreaLight.pure.d.ts +17 -0
- package/Lights/rectAreaLight.pure.js +238 -159
- package/Lights/rectAreaLight.pure.js.map +1 -1
- package/Lights/shadowLight.js +280 -268
- package/Lights/shadowLight.js.map +1 -1
- package/Lights/spotLight.pure.js +460 -427
- package/Lights/spotLight.pure.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.pure.js +17 -5
- package/Loading/Plugins/babylonFileLoader.pure.js.map +1 -1
- package/Loading/sceneLoader.d.ts +5 -1
- package/Loading/sceneLoader.js +299 -402
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Background/backgroundMaterial.pure.d.ts +18 -18
- package/Materials/Background/backgroundMaterial.pure.js +949 -794
- package/Materials/Background/backgroundMaterial.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.d.ts +15 -0
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js +34 -1
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +9 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +26 -2
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.d.ts +2 -1
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js +169 -149
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.pure.js +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.pure.js +442 -429
- package/Materials/Node/Blocks/Dual/lightBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js +396 -383
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.pure.js +237 -220
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.pure.js +1 -1
- package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.pure.js +150 -133
- package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js +265 -250
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.pure.js +159 -142
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js +214 -201
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.pure.js +419 -400
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js +3 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.pure.js +302 -289
- package/Materials/Node/Blocks/PBR/clearCoatBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +1327 -1272
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.pure.js +352 -337
- package/Materials/Node/Blocks/PBR/reflectionBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.pure.js +297 -277
- package/Materials/Node/Blocks/PBR/refractionBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.pure.js +146 -131
- package/Materials/Node/Blocks/PBR/sheenBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.pure.js +158 -145
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/clampBlock.pure.js +92 -77
- package/Materials/Node/Blocks/clampBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.pure.js +145 -132
- package/Materials/Node/Blocks/cloudBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/conditionalBlock.pure.js +182 -169
- package/Materials/Node/Blocks/conditionalBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/curveBlock.pure.js +259 -246
- package/Materials/Node/Blocks/curveBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/debugBlock.pure.js +119 -106
- package/Materials/Node/Blocks/debugBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/loopBlock.pure.js +123 -110
- package/Materials/Node/Blocks/loopBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.pure.js +185 -172
- package/Materials/Node/Blocks/meshAttributeExistsBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/remapBlock.pure.js +127 -112
- package/Materials/Node/Blocks/remapBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/transformBlock.pure.js +196 -185
- package/Materials/Node/Blocks/transformBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.pure.js +451 -438
- package/Materials/Node/Blocks/triPlanarBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/trigonometryBlock.pure.js +184 -171
- package/Materials/Node/Blocks/trigonometryBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/waveBlock.pure.js +97 -84
- package/Materials/Node/Blocks/waveBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.pure.js +276 -263
- package/Materials/Node/Blocks/worleyNoise3DBlock.pure.js.map +1 -1
- package/Materials/Node/nodeMaterial.pure.js +1765 -1737
- package/Materials/Node/nodeMaterial.pure.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
- package/Materials/PBR/openpbrMaterial.pure.d.ts +102 -102
- package/Materials/PBR/openpbrMaterial.pure.js +3115 -2243
- package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrAnisotropicConfiguration.d.ts +3 -3
- package/Materials/PBR/pbrAnisotropicConfiguration.js +255 -227
- package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBRDFConfiguration.d.ts +9 -9
- package/Materials/PBR/pbrBRDFConfiguration.js +203 -155
- package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.pure.d.ts +1 -1
- package/Materials/PBR/pbrBaseMaterial.pure.js +1751 -1736
- package/Materials/PBR/pbrBaseMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +13 -13
- package/Materials/PBR/pbrBaseSimpleMaterial.js +205 -117
- package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
- package/Materials/PBR/pbrClearCoatConfiguration.d.ts +9 -9
- package/Materials/PBR/pbrClearCoatConfiguration.js +464 -406
- package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
- package/Materials/PBR/pbrIridescenceConfiguration.d.ts +3 -3
- package/Materials/PBR/pbrIridescenceConfiguration.js +271 -239
- package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
- package/Materials/PBR/pbrMaterial.pure.d.ts +66 -66
- package/Materials/PBR/pbrMaterial.pure.js +1041 -685
- package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.d.ts +5 -5
- package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js +176 -115
- package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrSheenConfiguration.d.ts +7 -7
- package/Materials/PBR/pbrSheenConfiguration.js +314 -270
- package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.d.ts +5 -5
- package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js +172 -117
- package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +16 -16
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +864 -764
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.d.ts +43 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js +64 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js.map +1 -0
- package/Materials/Textures/HTML/htmlInteractionManager.d.ts +69 -0
- package/Materials/Textures/HTML/htmlInteractionManager.js +130 -0
- package/Materials/Textures/HTML/htmlInteractionManager.js.map +1 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.d.ts +84 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.js +246 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.js.map +1 -0
- package/Materials/Textures/HTML/htmlTexture.d.ts +148 -0
- package/Materials/Textures/HTML/htmlTexture.js +455 -0
- package/Materials/Textures/HTML/htmlTexture.js.map +1 -0
- package/Materials/Textures/HTML/index.d.ts +4 -0
- package/Materials/Textures/HTML/index.js +5 -0
- package/Materials/Textures/HTML/index.js.map +1 -0
- package/Materials/Textures/HTML/pure.d.ts +5 -0
- package/Materials/Textures/HTML/pure.js +6 -0
- package/Materials/Textures/HTML/pure.js.map +1 -0
- package/Materials/Textures/Procedurals/proceduralTexture.pure.js +671 -643
- package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
- package/Materials/Textures/baseTexture.pure.js +880 -825
- package/Materials/Textures/baseTexture.pure.js.map +1 -1
- package/Materials/Textures/cubeTexture.d.ts +0 -1
- package/Materials/Textures/cubeTexture.js +0 -1
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.pure.js +368 -333
- package/Materials/Textures/cubeTexture.pure.js.map +1 -1
- package/Materials/Textures/dynamicTexture.d.ts +0 -1
- package/Materials/Textures/dynamicTexture.js +0 -1
- package/Materials/Textures/dynamicTexture.js.map +1 -1
- package/Materials/Textures/dynamicTexture.pure.js +2 -0
- package/Materials/Textures/dynamicTexture.pure.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.d.ts +0 -2
- package/Materials/Textures/htmlElementTexture.js +0 -2
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.pure.js +4 -0
- package/Materials/Textures/htmlElementTexture.pure.js.map +1 -1
- package/Materials/Textures/index.d.ts +1 -0
- package/Materials/Textures/index.js +1 -1
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +0 -1
- package/Materials/Textures/multiRenderTarget.js +0 -1
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.pure.js +2 -0
- package/Materials/Textures/multiRenderTarget.pure.js.map +1 -1
- package/Materials/Textures/pure.d.ts +1 -0
- package/Materials/Textures/pure.js +1 -0
- package/Materials/Textures/pure.js.map +1 -1
- package/Materials/Textures/texture.pure.js +961 -923
- package/Materials/Textures/texture.pure.js.map +1 -1
- package/Materials/Textures/videoTexture.pure.d.ts +3 -0
- package/Materials/Textures/videoTexture.pure.js +450 -401
- package/Materials/Textures/videoTexture.pure.js.map +1 -1
- package/Materials/colorCurves.pure.js +510 -477
- package/Materials/colorCurves.pure.js.map +1 -1
- package/Materials/effect.pure.js +0 -7
- package/Materials/effect.pure.js.map +1 -1
- package/Materials/imageProcessing.js +12 -4
- package/Materials/imageProcessing.js.map +1 -1
- package/Materials/imageProcessingConfiguration.pure.js +647 -587
- package/Materials/imageProcessingConfiguration.pure.js.map +1 -1
- package/Materials/material.decalMapConfiguration.pure.d.ts +2 -2
- package/Materials/material.decalMapConfiguration.pure.js +149 -130
- package/Materials/material.decalMapConfiguration.pure.js.map +1 -1
- package/Materials/material.detailMapConfiguration.d.ts +3 -3
- package/Materials/material.detailMapConfiguration.js +213 -175
- package/Materials/material.detailMapConfiguration.js.map +1 -1
- package/Materials/material.pure.js +1815 -1721
- package/Materials/material.pure.js.map +1 -1
- package/Materials/materialPluginBase.pure.js +270 -249
- package/Materials/materialPluginBase.pure.js.map +1 -1
- package/Materials/materialPluginManager.pure.js +18 -8
- package/Materials/materialPluginManager.pure.js.map +1 -1
- package/Materials/materialStencilState.js +211 -200
- package/Materials/materialStencilState.js.map +1 -1
- package/Materials/meshDebugPluginMaterial.pure.d.ts +2 -2
- package/Materials/meshDebugPluginMaterial.pure.js +397 -275
- package/Materials/meshDebugPluginMaterial.pure.js.map +1 -1
- package/Materials/standardMaterial.pure.d.ts +32 -32
- package/Materials/standardMaterial.pure.js +1804 -1394
- package/Materials/standardMaterial.pure.js.map +1 -1
- package/Maths/math.color.pure.js +5 -5
- package/Maths/math.functions.js +38 -30
- package/Maths/math.functions.js.map +1 -1
- package/Maths/math.vector.pure.js +25 -25
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +18 -8
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +86 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +255 -104
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.d.ts +39 -0
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +322 -0
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -0
- package/Meshes/GreasedLine/greasedLineMesh.pure.js +4 -4
- package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +3 -3
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +107 -94
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.pure.js +276 -263
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.pure.js +247 -232
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js +299 -284
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/aggregatorBlock.pure.js +196 -181
- package/Meshes/Node/Blocks/Set/aggregatorBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/latticeBlock.pure.js +198 -179
- package/Meshes/Node/Blocks/Set/latticeBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setColorsBlock.pure.js +151 -138
- package/Meshes/Node/Blocks/Set/setColorsBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.pure.js +107 -94
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.pure.js +138 -125
- package/Meshes/Node/Blocks/Set/setNormalsBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setPositionsBlock.pure.js +213 -200
- package/Meshes/Node/Blocks/Set/setPositionsBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setTangentsBlock.pure.js +138 -125
- package/Meshes/Node/Blocks/Set/setTangentsBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.pure.js +179 -164
- package/Meshes/Node/Blocks/Set/setUVsBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.pure.js +183 -170
- package/Meshes/Node/Blocks/Sources/boxBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.pure.js +125 -112
- package/Meshes/Node/Blocks/Sources/capsuleBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.pure.js +153 -140
- package/Meshes/Node/Blocks/Sources/cylinderBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.pure.js +112 -99
- package/Meshes/Node/Blocks/Sources/discBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.pure.js +133 -120
- package/Meshes/Node/Blocks/Sources/gridBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.pure.js +128 -115
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.pure.js +116 -103
- package/Meshes/Node/Blocks/Sources/meshBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.pure.js +160 -147
- package/Meshes/Node/Blocks/Sources/planeBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.pure.js +144 -131
- package/Meshes/Node/Blocks/Sources/sphereBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.pure.js +112 -99
- package/Meshes/Node/Blocks/Sources/torusBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.pure.js +200 -185
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/bevelBlock.pure.js +111 -98
- package/Meshes/Node/Blocks/bevelBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/booleanGeometryBlock.pure.js +182 -165
- package/Meshes/Node/Blocks/booleanGeometryBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/cleanGeometryBlock.pure.js +89 -76
- package/Meshes/Node/Blocks/cleanGeometryBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/conditionBlock.pure.js +184 -169
- package/Meshes/Node/Blocks/conditionBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/extrudeGeometryBlock.pure.js +270 -255
- package/Meshes/Node/Blocks/extrudeGeometryBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCollectionBlock.pure.js +172 -159
- package/Meshes/Node/Blocks/geometryCollectionBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCurveBlock.pure.js +230 -217
- package/Meshes/Node/Blocks/geometryCurveBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/geometryEaseBlock.pure.js +256 -245
- package/Meshes/Node/Blocks/geometryEaseBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js +206 -189
- package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.pure.js +166 -153
- package/Meshes/Node/Blocks/geometryTransformBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.pure.js +221 -208
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/mappingBlock.pure.js +150 -137
- package/Meshes/Node/Blocks/mappingBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/mathBlock.pure.js +269 -256
- package/Meshes/Node/Blocks/mathBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.pure.js +141 -128
- package/Meshes/Node/Blocks/mergeGeometryBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.pure.js +161 -148
- package/Meshes/Node/Blocks/randomBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/subdivideBlock.pure.js +102 -87
- package/Meshes/Node/Blocks/subdivideBlock.pure.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +560 -538
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.js +473 -458
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/abstractMesh.pure.js +2218 -2207
- package/Meshes/abstractMesh.pure.js.map +1 -1
- package/Meshes/geometry.js +30 -15
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/mesh.pure.js +26 -14
- package/Meshes/mesh.pure.js.map +1 -1
- package/Meshes/mesh.vertexData.js +1665 -1655
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/transformNode.pure.js +1400 -1372
- package/Meshes/transformNode.pure.js.map +1 -1
- package/Misc/decorators.d.ts +34 -19
- package/Misc/decorators.functions.d.ts +33 -2
- package/Misc/decorators.functions.js +114 -35
- package/Misc/decorators.functions.js.map +1 -1
- package/Misc/decorators.js +96 -68
- package/Misc/decorators.js.map +1 -1
- package/Misc/decorators.serialization.js +47 -40
- package/Misc/decorators.serialization.js.map +1 -1
- package/Misc/decorators.serializationUtilities.d.ts +24 -0
- package/Misc/decorators.serializationUtilities.js +20 -0
- package/Misc/decorators.serializationUtilities.js.map +1 -0
- package/Misc/dumpTools.pure.js +43 -33
- package/Misc/dumpTools.pure.js.map +1 -1
- package/Misc/fileTools.pure.js +8 -0
- package/Misc/fileTools.pure.js.map +1 -1
- package/Misc/observable.pure.js +0 -7
- package/Misc/observable.pure.js.map +1 -1
- package/Misc/snapshotRenderingHelper.d.ts +4 -1
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Misc/symbolMetadataPolyfill.d.ts +11 -0
- package/Misc/symbolMetadataPolyfill.js +22 -0
- package/Misc/symbolMetadataPolyfill.js.map +1 -0
- package/Misc/tools.pure.js +2 -2
- package/Misc/tools.pure.js.map +1 -1
- package/Morph/morphTarget.js +382 -365
- package/Morph/morphTarget.js.map +1 -1
- package/Particles/Node/Blocks/Conditions/particleConditionBlock.pure.js +160 -145
- package/Particles/Node/Blocks/Conditions/particleConditionBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.pure.js +187 -174
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.pure.js +238 -219
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.pure.js +140 -115
- package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.pure.js +157 -144
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/Triggers/particleTriggerBlock.pure.js +133 -119
- package/Particles/Node/Blocks/Triggers/particleTriggerBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/Update/alignAngleBlock.pure.js +93 -80
- package/Particles/Node/Blocks/Update/alignAngleBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleDebugBlock.pure.js +117 -105
- package/Particles/Node/Blocks/particleDebugBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleFloatToIntBlock.pure.js +105 -92
- package/Particles/Node/Blocks/particleFloatToIntBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleGradientValueBlock.pure.js +82 -69
- package/Particles/Node/Blocks/particleGradientValueBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleLocalVariableBlock.pure.js +113 -101
- package/Particles/Node/Blocks/particleLocalVariableBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleMathBlock.pure.js +278 -265
- package/Particles/Node/Blocks/particleMathBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleNumberMathBlock.pure.js +155 -142
- package/Particles/Node/Blocks/particleNumberMathBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleRandomBlock.pure.js +156 -143
- package/Particles/Node/Blocks/particleRandomBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleTrigonometryBlock.pure.js +217 -204
- package/Particles/Node/Blocks/particleTrigonometryBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleVectorMathBlock.pure.js +106 -93
- package/Particles/Node/Blocks/particleVectorMathBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.pure.js +366 -330
- package/Particles/Node/Blocks/systemBlock.pure.js.map +1 -1
- package/Particles/Node/nodeParticleBlock.js +339 -324
- package/Particles/Node/nodeParticleBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.js +494 -473
- package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +0 -1
- package/Particles/gpuParticleSystem.js +0 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.pure.d.ts +4 -3
- package/Particles/gpuParticleSystem.pure.js +27 -16
- package/Particles/gpuParticleSystem.pure.js.map +1 -1
- package/Particles/particleSystem.pure.js +57 -2
- package/Particles/particleSystem.pure.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +0 -1
- package/Particles/thinParticleSystem.js +0 -1
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.pure.js +2 -0
- package/Particles/thinParticleSystem.pure.js.map +1 -1
- package/Particles/webgl2ParticleSystem.pure.js +2 -0
- package/Particles/webgl2ParticleSystem.pure.js.map +1 -1
- package/Physics/v1/physicsImpostor.pure.js +4 -4
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js +675 -656
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.d.ts +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js +521 -486
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.d.ts +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.pure.js +241 -220
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.pure.js +852 -835
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.pure.js +1135 -1073
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.pure.js +319 -303
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +212 -199
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.pure.js +67 -55
- package/PostProcesses/blackAndWhitePostProcess.pure.js.map +1 -1
- package/PostProcesses/bloomMergePostProcess.pure.js +74 -62
- package/PostProcesses/bloomMergePostProcess.pure.js.map +1 -1
- package/PostProcesses/blurPostProcess.pure.js +127 -115
- package/PostProcesses/blurPostProcess.pure.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.pure.js +130 -118
- package/PostProcesses/chromaticAberrationPostProcess.pure.js.map +1 -1
- package/PostProcesses/circleOfConfusionPostProcess.pure.js +115 -104
- package/PostProcesses/circleOfConfusionPostProcess.pure.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.pure.js +55 -43
- package/PostProcesses/colorCorrectionPostProcess.pure.js.map +1 -1
- package/PostProcesses/convolutionPostProcess.pure.js +96 -84
- package/PostProcesses/convolutionPostProcess.pure.js.map +1 -1
- package/PostProcesses/extractHighlightsPostProcess.pure.js +68 -57
- package/PostProcesses/extractHighlightsPostProcess.pure.js.map +1 -1
- package/PostProcesses/filterPostProcess.pure.js +66 -54
- package/PostProcesses/filterPostProcess.pure.js.map +1 -1
- package/PostProcesses/fxaaPostProcess.pure.js.map +1 -1
- package/PostProcesses/grainPostProcess.pure.js +82 -70
- package/PostProcesses/grainPostProcess.pure.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.js +334 -322
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.pure.js +246 -235
- package/PostProcesses/motionBlurPostProcess.pure.js.map +1 -1
- package/PostProcesses/passPostProcess.pure.js +75 -63
- package/PostProcesses/passPostProcess.pure.js.map +1 -1
- package/PostProcesses/postProcess.pure.js +899 -835
- package/PostProcesses/postProcess.pure.js.map +1 -1
- package/PostProcesses/refractionPostProcess.pure.js +114 -87
- package/PostProcesses/refractionPostProcess.pure.js.map +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js +108 -96
- package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.pure.js +241 -220
- package/PostProcesses/screenSpaceReflectionPostProcess.pure.js.map +1 -1
- package/PostProcesses/sharpenPostProcess.pure.js +86 -74
- package/PostProcesses/sharpenPostProcess.pure.js.map +1 -1
- package/PostProcesses/tonemapPostProcess.pure.js +82 -70
- package/PostProcesses/tonemapPostProcess.pure.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.pure.js +500 -465
- package/PostProcesses/volumetricLightScatteringPostProcess.pure.js.map +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.d.ts +0 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js +0 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js +2 -0
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js.map +1 -1
- package/Probes/reflectionProbe.pure.js +238 -224
- package/Probes/reflectionProbe.pure.js.map +1 -1
- package/Rendering/GlobalIllumination/giRSMManager.pure.d.ts +1 -1
- package/Rendering/GlobalIllumination/giRSMManager.pure.js +138 -105
- package/Rendering/GlobalIllumination/giRSMManager.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.d.ts +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js +155 -138
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +0 -2
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +0 -2
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +5 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +0 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +0 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.d.ts +1 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +34 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
- package/Rendering/edgesRenderer.pure.js.map +1 -1
- package/Rendering/prePassRenderer.d.ts +0 -2
- package/Rendering/prePassRenderer.js +0 -2
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.pure.js +2 -0
- package/Rendering/prePassRenderer.pure.js.map +1 -1
- package/Rendering/reflectiveShadowMap.pure.d.ts +1 -1
- package/Rendering/reflectiveShadowMap.pure.js +151 -130
- package/Rendering/reflectiveShadowMap.pure.js.map +1 -1
- package/Rendering/thinDepthPeelingRenderer.d.ts +0 -1
- package/Rendering/thinDepthPeelingRenderer.js +0 -1
- package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +1 -0
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +35 -5
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/Shaders/gaussianSplatting.fragment.js +17 -1
- package/Shaders/gaussianSplatting.fragment.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +1 -1
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/gaussianSplattingDepth.vertex.js +1 -1
- package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
- package/Shaders/picking.fragment.js +39 -3
- package/Shaders/picking.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +3 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/helperFunctions.js +2 -2
- package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +39 -7
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +4 -3
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.fragment.js +14 -1
- package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +2 -2
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js +2 -2
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
- package/ShadersWGSL/lightingVolume.compute.js +2 -2
- package/ShadersWGSL/lightingVolume.compute.js.map +1 -1
- package/ShadersWGSL/picking.fragment.js +22 -1
- package/ShadersWGSL/picking.fragment.js.map +1 -1
- package/XR/features/Layers/WebXRCompositionLayer.d.ts +3 -2
- package/XR/features/Layers/WebXRCompositionLayer.js +2 -2
- package/XR/features/Layers/WebXRCompositionLayer.js.map +1 -1
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +59 -0
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.js +120 -0
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -0
- package/XR/features/Layers/WebXRWebGPUProjectionLayer.d.ts +25 -0
- package/XR/features/Layers/WebXRWebGPUProjectionLayer.js +69 -0
- package/XR/features/Layers/WebXRWebGPUProjectionLayer.js.map +1 -0
- package/XR/features/WebXRLayers.pure.d.ts +8 -0
- package/XR/features/WebXRLayers.pure.js +43 -6
- package/XR/features/WebXRLayers.pure.js.map +1 -1
- package/XR/native/nativeXRRenderTarget.d.ts +2 -2
- package/XR/native/nativeXRRenderTarget.js +2 -2
- package/XR/native/nativeXRRenderTarget.js.map +1 -1
- package/XR/webXRExperienceHelper.js +10 -1
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRGraphicsBinding.d.ts +90 -0
- package/XR/webXRGraphicsBinding.js +85 -0
- package/XR/webXRGraphicsBinding.js.map +1 -0
- package/XR/webXRLayerRenderTargetTexture.d.ts +24 -0
- package/XR/webXRLayerRenderTargetTexture.js +30 -0
- package/XR/webXRLayerRenderTargetTexture.js.map +1 -0
- package/XR/webXRManagedOutputCanvas.d.ts +14 -0
- package/XR/webXRManagedOutputCanvas.js +24 -5
- package/XR/webXRManagedOutputCanvas.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.d.ts +25 -4
- package/XR/webXRRenderTargetTextureProvider.js +33 -35
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/XR/webXRSessionManager.d.ts +11 -0
- package/XR/webXRSessionManager.js +37 -0
- package/XR/webXRSessionManager.js.map +1 -1
- package/XR/webXRTypes.d.ts +9 -6
- package/XR/webXRTypes.js.map +1 -1
- package/XR/webXRWebGLLayer.d.ts +2 -2
- package/XR/webXRWebGLLayer.js +2 -2
- package/XR/webXRWebGLLayer.js.map +1 -1
- package/XR/webXRWebGLRenderTargetTextureProvider.d.ts +12 -0
- package/XR/webXRWebGLRenderTargetTextureProvider.js +58 -0
- package/XR/webXRWebGLRenderTargetTextureProvider.js.map +1 -0
- package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +69 -0
- package/XR/webXRWebGPURenderTargetTextureProvider.js +148 -0
- package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/node.js +878 -845
- package/node.js.map +1 -1
- package/package.json +8 -14
- package/scene.pure.d.ts +12 -0
- package/scene.pure.js +36 -0
- package/scene.pure.js.map +1 -1
- package/tslib.es6.js +304 -150
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** This file must only contain pure code and pure imports */
|
|
2
|
-
import {
|
|
2
|
+
import { __esDecorate, __runInitializers } from "../../../../tslib.es6.js";
|
|
3
3
|
import { NodeMaterialBlock } from "../../nodeMaterialBlock.js";
|
|
4
4
|
import { NodeMaterialBlockConnectionPointTypes } from "../../Enums/nodeMaterialBlockConnectionPointTypes.js";
|
|
5
5
|
import { NodeMaterialBlockTargets } from "../../Enums/nodeMaterialBlockTargets.js";
|
|
@@ -40,682 +40,752 @@ const MapOutputToVariable = {
|
|
|
40
40
|
* Block used to implement the PBR metallic/roughness model
|
|
41
41
|
* @see https://playground.babylonjs.com/#D8AK3Z#80
|
|
42
42
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
*/
|
|
123
|
-
this.realTimeFilteringQuality = 8;
|
|
124
|
-
/**
|
|
125
|
-
* Base Diffuse Model
|
|
126
|
-
*/
|
|
127
|
-
this.baseDiffuseModel = 0;
|
|
128
|
-
/**
|
|
129
|
-
* Defines if the material uses energy conservation.
|
|
130
|
-
*/
|
|
131
|
-
this.useEnergyConservation = true;
|
|
132
|
-
/**
|
|
133
|
-
* This parameters will enable/disable radiance occlusion by preventing the radiance to lit
|
|
134
|
-
* too much the area relying on ambient texture to define their ambient occlusion.
|
|
135
|
-
*/
|
|
136
|
-
this.useRadianceOcclusion = true;
|
|
137
|
-
/**
|
|
138
|
-
* This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
|
|
139
|
-
* makes the reflect vector face the model (under horizon).
|
|
140
|
-
*/
|
|
141
|
-
this.useHorizonOcclusion = true;
|
|
142
|
-
/**
|
|
143
|
-
* If set to true, no lighting calculations will be applied.
|
|
144
|
-
*/
|
|
145
|
-
this.unlit = false;
|
|
146
|
-
/**
|
|
147
|
-
* Force normal to face away from face.
|
|
148
|
-
*/
|
|
149
|
-
this.forceNormalForward = false;
|
|
150
|
-
/** Indicates that no code should be generated in the vertex shader. Can be useful in some specific circumstances (like when doing ray marching for eg) */
|
|
151
|
-
this.generateOnlyFragmentCode = false;
|
|
152
|
-
/**
|
|
153
|
-
* Defines the material debug mode.
|
|
154
|
-
* It helps seeing only some components of the material while troubleshooting.
|
|
155
|
-
*/
|
|
156
|
-
this.debugMode = 0;
|
|
157
|
-
/**
|
|
158
|
-
* Specify from where on screen the debug mode should start.
|
|
159
|
-
* The value goes from -1 (full screen) to 1 (not visible)
|
|
160
|
-
* It helps with side by side comparison against the final render
|
|
161
|
-
* This defaults to 0
|
|
162
|
-
*/
|
|
163
|
-
this.debugLimit = 0;
|
|
164
|
-
/**
|
|
165
|
-
* As the default viewing range might not be enough (if the ambient is really small for instance)
|
|
166
|
-
* You can use the factor to better multiply the final value.
|
|
167
|
-
*/
|
|
168
|
-
this.debugFactor = 1;
|
|
169
|
-
this._isUnique = true;
|
|
170
|
-
this.registerInput("worldPosition", NodeMaterialBlockConnectionPointTypes.Vector4, false, NodeMaterialBlockTargets.Vertex);
|
|
171
|
-
this.registerInput("worldNormal", NodeMaterialBlockConnectionPointTypes.Vector4, false, NodeMaterialBlockTargets.Vertex);
|
|
172
|
-
this.registerInput("view", NodeMaterialBlockConnectionPointTypes.Matrix, false);
|
|
173
|
-
this.registerInput("cameraPosition", NodeMaterialBlockConnectionPointTypes.Vector3, false, NodeMaterialBlockTargets.Fragment);
|
|
174
|
-
this.registerInput("perturbedNormal", NodeMaterialBlockConnectionPointTypes.Vector4, true, NodeMaterialBlockTargets.Fragment);
|
|
175
|
-
this.registerInput("baseColor", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);
|
|
176
|
-
this.registerInput("metallic", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Fragment);
|
|
177
|
-
this.registerInput("roughness", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Fragment);
|
|
178
|
-
this.registerInput("ambientOcc", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);
|
|
179
|
-
this.registerInput("opacity", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);
|
|
180
|
-
this.registerInput("indexOfRefraction", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);
|
|
181
|
-
this.registerInput("ambientColor", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);
|
|
182
|
-
this.registerInput("reflection", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject("reflection", this, 0 /* NodeMaterialConnectionPointDirection.Input */, ReflectionBlock, "ReflectionBlock"));
|
|
183
|
-
this.registerInput("clearcoat", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject("clearcoat", this, 0 /* NodeMaterialConnectionPointDirection.Input */, ClearCoatBlock, "ClearCoatBlock"));
|
|
184
|
-
this.registerInput("sheen", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject("sheen", this, 0 /* NodeMaterialConnectionPointDirection.Input */, SheenBlock, "SheenBlock"));
|
|
185
|
-
this.registerInput("subsurface", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject("subsurface", this, 0 /* NodeMaterialConnectionPointDirection.Input */, SubSurfaceBlock, "SubSurfaceBlock"));
|
|
186
|
-
this.registerInput("anisotropy", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject("anisotropy", this, 0 /* NodeMaterialConnectionPointDirection.Input */, AnisotropyBlock, "AnisotropyBlock"));
|
|
187
|
-
this.registerInput("iridescence", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject("iridescence", this, 0 /* NodeMaterialConnectionPointDirection.Input */, IridescenceBlock, "IridescenceBlock"));
|
|
188
|
-
this.registerOutput("ambientClr", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
189
|
-
this.registerOutput("diffuseDir", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
190
|
-
this.registerOutput("specularDir", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
191
|
-
this.registerOutput("clearcoatDir", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
192
|
-
this.registerOutput("sheenDir", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
193
|
-
this.registerOutput("diffuseInd", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
194
|
-
this.registerOutput("specularInd", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
195
|
-
this.registerOutput("clearcoatInd", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
196
|
-
this.registerOutput("sheenInd", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
197
|
-
this.registerOutput("refraction", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
198
|
-
this.registerOutput("lighting", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
199
|
-
this.registerOutput("shadow", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);
|
|
200
|
-
this.registerOutput("alpha", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Initialize the block and prepare the context for build
|
|
204
|
-
* @param state defines the state that will be used for the build
|
|
205
|
-
*/
|
|
206
|
-
initialize(state) {
|
|
207
|
-
state._excludeVariableName("vLightingIntensity");
|
|
208
|
-
state._excludeVariableName("geometricNormalW");
|
|
209
|
-
state._excludeVariableName("normalW");
|
|
210
|
-
state._excludeVariableName("faceNormal");
|
|
211
|
-
state._excludeVariableName("albedoOpacityOut");
|
|
212
|
-
state._excludeVariableName("surfaceAlbedo");
|
|
213
|
-
state._excludeVariableName("alpha");
|
|
214
|
-
state._excludeVariableName("aoOut");
|
|
215
|
-
state._excludeVariableName("baseColor");
|
|
216
|
-
state._excludeVariableName("reflectivityOut");
|
|
217
|
-
state._excludeVariableName("microSurface");
|
|
218
|
-
state._excludeVariableName("roughness");
|
|
219
|
-
state._excludeVariableName("vReflectivityColor");
|
|
220
|
-
state._excludeVariableName("NdotVUnclamped");
|
|
221
|
-
state._excludeVariableName("NdotV");
|
|
222
|
-
state._excludeVariableName("alphaG");
|
|
223
|
-
state._excludeVariableName("AARoughnessFactors");
|
|
224
|
-
state._excludeVariableName("environmentBrdf");
|
|
225
|
-
state._excludeVariableName("ambientMonochrome");
|
|
226
|
-
state._excludeVariableName("seo");
|
|
227
|
-
state._excludeVariableName("eho");
|
|
228
|
-
state._excludeVariableName("environmentRadiance");
|
|
229
|
-
state._excludeVariableName("irradianceVector");
|
|
230
|
-
state._excludeVariableName("environmentIrradiance");
|
|
231
|
-
state._excludeVariableName("diffuseBase");
|
|
232
|
-
state._excludeVariableName("specularBase");
|
|
233
|
-
state._excludeVariableName("preInfo");
|
|
234
|
-
state._excludeVariableName("info");
|
|
235
|
-
state._excludeVariableName("shadow");
|
|
236
|
-
state._excludeVariableName("finalDiffuse");
|
|
237
|
-
state._excludeVariableName("finalAmbient");
|
|
238
|
-
state._excludeVariableName("ambientOcclusionForDirectDiffuse");
|
|
239
|
-
state._excludeVariableName("finalColor");
|
|
240
|
-
state._excludeVariableName("vClipSpacePosition");
|
|
241
|
-
state._excludeVariableName("vDebugMode");
|
|
242
|
-
state._excludeVariableName("vViewDepth");
|
|
243
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
244
|
-
this._initShaderSourceAsync(state.shaderLanguage);
|
|
245
|
-
}
|
|
246
|
-
async _initShaderSourceAsync(shaderLanguage) {
|
|
247
|
-
this._codeIsReady = false;
|
|
248
|
-
if (shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
249
|
-
await Promise.all([import("../../../../ShadersWGSL/pbr.vertex.js"), import("../../../../ShadersWGSL/pbr.fragment.js")]);
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
await Promise.all([import("../../../../Shaders/pbr.vertex.js"), import("../../../../Shaders/pbr.fragment.js")]);
|
|
253
|
-
}
|
|
254
|
-
this._codeIsReady = true;
|
|
255
|
-
this.onCodeIsReadyObservable.notifyObservers(this);
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Gets the current class name
|
|
259
|
-
* @returns the class name
|
|
260
|
-
*/
|
|
261
|
-
getClassName() {
|
|
262
|
-
return "PBRMetallicRoughnessBlock";
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Gets the world position input component
|
|
266
|
-
*/
|
|
267
|
-
get worldPosition() {
|
|
268
|
-
return this._inputs[0];
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Gets the world normal input component
|
|
272
|
-
*/
|
|
273
|
-
get worldNormal() {
|
|
274
|
-
return this._inputs[1];
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Gets the view matrix parameter
|
|
278
|
-
*/
|
|
279
|
-
get view() {
|
|
280
|
-
return this._inputs[2];
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Gets the camera position input component
|
|
284
|
-
*/
|
|
285
|
-
get cameraPosition() {
|
|
286
|
-
return this._inputs[3];
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Gets the perturbed normal input component
|
|
290
|
-
*/
|
|
291
|
-
get perturbedNormal() {
|
|
292
|
-
return this._inputs[4];
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Gets the base color input component
|
|
296
|
-
*/
|
|
297
|
-
get baseColor() {
|
|
298
|
-
return this._inputs[5];
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Gets the metallic input component
|
|
302
|
-
*/
|
|
303
|
-
get metallic() {
|
|
304
|
-
return this._inputs[6];
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Gets the roughness input component
|
|
308
|
-
*/
|
|
309
|
-
get roughness() {
|
|
310
|
-
return this._inputs[7];
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Gets the ambient occlusion input component
|
|
314
|
-
*/
|
|
315
|
-
get ambientOcc() {
|
|
316
|
-
return this._inputs[8];
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Gets the opacity input component
|
|
320
|
-
*/
|
|
321
|
-
get opacity() {
|
|
322
|
-
return this._inputs[9];
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Gets the index of refraction input component
|
|
326
|
-
*/
|
|
327
|
-
get indexOfRefraction() {
|
|
328
|
-
return this._inputs[10];
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Gets the ambient color input component
|
|
332
|
-
*/
|
|
333
|
-
get ambientColor() {
|
|
334
|
-
return this._inputs[11];
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Gets the reflection object parameters
|
|
338
|
-
*/
|
|
339
|
-
get reflection() {
|
|
340
|
-
return this._inputs[12];
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Gets the clear coat object parameters
|
|
344
|
-
*/
|
|
345
|
-
get clearcoat() {
|
|
346
|
-
return this._inputs[13];
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Gets the sheen object parameters
|
|
350
|
-
*/
|
|
351
|
-
get sheen() {
|
|
352
|
-
return this._inputs[14];
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Gets the sub surface object parameters
|
|
356
|
-
*/
|
|
357
|
-
get subsurface() {
|
|
358
|
-
return this._inputs[15];
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Gets the anisotropy object parameters
|
|
362
|
-
*/
|
|
363
|
-
get anisotropy() {
|
|
364
|
-
return this._inputs[16];
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Gets the iridescence object parameters
|
|
368
|
-
*/
|
|
369
|
-
get iridescence() {
|
|
370
|
-
return this._inputs[17];
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Gets the ambient output component
|
|
374
|
-
*/
|
|
375
|
-
get ambientClr() {
|
|
376
|
-
return this._outputs[0];
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Gets the diffuse output component
|
|
380
|
-
*/
|
|
381
|
-
get diffuseDir() {
|
|
382
|
-
return this._outputs[1];
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* Gets the specular output component
|
|
386
|
-
*/
|
|
387
|
-
get specularDir() {
|
|
388
|
-
return this._outputs[2];
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Gets the clear coat output component
|
|
392
|
-
*/
|
|
393
|
-
get clearcoatDir() {
|
|
394
|
-
return this._outputs[3];
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Gets the sheen output component
|
|
398
|
-
*/
|
|
399
|
-
get sheenDir() {
|
|
400
|
-
return this._outputs[4];
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Gets the indirect diffuse output component
|
|
404
|
-
*/
|
|
405
|
-
get diffuseInd() {
|
|
406
|
-
return this._outputs[5];
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Gets the indirect specular output component
|
|
410
|
-
*/
|
|
411
|
-
get specularInd() {
|
|
412
|
-
return this._outputs[6];
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Gets the indirect clear coat output component
|
|
416
|
-
*/
|
|
417
|
-
get clearcoatInd() {
|
|
418
|
-
return this._outputs[7];
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Gets the indirect sheen output component
|
|
422
|
-
*/
|
|
423
|
-
get sheenInd() {
|
|
424
|
-
return this._outputs[8];
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Gets the refraction output component
|
|
428
|
-
*/
|
|
429
|
-
get refraction() {
|
|
430
|
-
return this._outputs[9];
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* Gets the global lighting output component
|
|
434
|
-
*/
|
|
435
|
-
get lighting() {
|
|
436
|
-
return this._outputs[10];
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Gets the shadow output component
|
|
440
|
-
*/
|
|
441
|
-
get shadow() {
|
|
442
|
-
return this._outputs[11];
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* Gets the alpha output component
|
|
446
|
-
*/
|
|
447
|
-
get alpha() {
|
|
448
|
-
return this._outputs[12];
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Auto configure the block based on the material
|
|
452
|
-
* @param material - the node material
|
|
453
|
-
* @param additionalFilteringInfo - additional filtering info
|
|
454
|
-
*/
|
|
455
|
-
autoConfigure(material, additionalFilteringInfo = () => true) {
|
|
456
|
-
if (!this.cameraPosition.isConnected) {
|
|
457
|
-
let cameraPositionInput = material.getInputBlockByPredicate((b) => b.systemValue === NodeMaterialSystemValues.CameraPosition && additionalFilteringInfo(b));
|
|
458
|
-
if (!cameraPositionInput) {
|
|
459
|
-
cameraPositionInput = new InputBlock("cameraPosition");
|
|
460
|
-
cameraPositionInput.setAsSystemValue(NodeMaterialSystemValues.CameraPosition);
|
|
43
|
+
let PBRMetallicRoughnessBlock = (() => {
|
|
44
|
+
var _a;
|
|
45
|
+
let _classSuper = NodeMaterialBlock;
|
|
46
|
+
let _directIntensity_decorators;
|
|
47
|
+
let _directIntensity_initializers = [];
|
|
48
|
+
let _directIntensity_extraInitializers = [];
|
|
49
|
+
let _environmentIntensity_decorators;
|
|
50
|
+
let _environmentIntensity_initializers = [];
|
|
51
|
+
let _environmentIntensity_extraInitializers = [];
|
|
52
|
+
let _specularIntensity_decorators;
|
|
53
|
+
let _specularIntensity_initializers = [];
|
|
54
|
+
let _specularIntensity_extraInitializers = [];
|
|
55
|
+
let _lightFalloff_decorators;
|
|
56
|
+
let _lightFalloff_initializers = [];
|
|
57
|
+
let _lightFalloff_extraInitializers = [];
|
|
58
|
+
let _useAlphaTest_decorators;
|
|
59
|
+
let _useAlphaTest_initializers = [];
|
|
60
|
+
let _useAlphaTest_extraInitializers = [];
|
|
61
|
+
let _alphaTestCutoff_decorators;
|
|
62
|
+
let _alphaTestCutoff_initializers = [];
|
|
63
|
+
let _alphaTestCutoff_extraInitializers = [];
|
|
64
|
+
let _useAlphaBlending_decorators;
|
|
65
|
+
let _useAlphaBlending_initializers = [];
|
|
66
|
+
let _useAlphaBlending_extraInitializers = [];
|
|
67
|
+
let _useRadianceOverAlpha_decorators;
|
|
68
|
+
let _useRadianceOverAlpha_initializers = [];
|
|
69
|
+
let _useRadianceOverAlpha_extraInitializers = [];
|
|
70
|
+
let _useSpecularOverAlpha_decorators;
|
|
71
|
+
let _useSpecularOverAlpha_initializers = [];
|
|
72
|
+
let _useSpecularOverAlpha_extraInitializers = [];
|
|
73
|
+
let _enableSpecularAntiAliasing_decorators;
|
|
74
|
+
let _enableSpecularAntiAliasing_initializers = [];
|
|
75
|
+
let _enableSpecularAntiAliasing_extraInitializers = [];
|
|
76
|
+
let _realTimeFiltering_decorators;
|
|
77
|
+
let _realTimeFiltering_initializers = [];
|
|
78
|
+
let _realTimeFiltering_extraInitializers = [];
|
|
79
|
+
let _realTimeFilteringQuality_decorators;
|
|
80
|
+
let _realTimeFilteringQuality_initializers = [];
|
|
81
|
+
let _realTimeFilteringQuality_extraInitializers = [];
|
|
82
|
+
let _baseDiffuseModel_decorators;
|
|
83
|
+
let _baseDiffuseModel_initializers = [];
|
|
84
|
+
let _baseDiffuseModel_extraInitializers = [];
|
|
85
|
+
let _useEnergyConservation_decorators;
|
|
86
|
+
let _useEnergyConservation_initializers = [];
|
|
87
|
+
let _useEnergyConservation_extraInitializers = [];
|
|
88
|
+
let _useRadianceOcclusion_decorators;
|
|
89
|
+
let _useRadianceOcclusion_initializers = [];
|
|
90
|
+
let _useRadianceOcclusion_extraInitializers = [];
|
|
91
|
+
let _useHorizonOcclusion_decorators;
|
|
92
|
+
let _useHorizonOcclusion_initializers = [];
|
|
93
|
+
let _useHorizonOcclusion_extraInitializers = [];
|
|
94
|
+
let _unlit_decorators;
|
|
95
|
+
let _unlit_initializers = [];
|
|
96
|
+
let _unlit_extraInitializers = [];
|
|
97
|
+
let _forceNormalForward_decorators;
|
|
98
|
+
let _forceNormalForward_initializers = [];
|
|
99
|
+
let _forceNormalForward_extraInitializers = [];
|
|
100
|
+
let _generateOnlyFragmentCode_decorators;
|
|
101
|
+
let _generateOnlyFragmentCode_initializers = [];
|
|
102
|
+
let _generateOnlyFragmentCode_extraInitializers = [];
|
|
103
|
+
let _debugMode_decorators;
|
|
104
|
+
let _debugMode_initializers = [];
|
|
105
|
+
let _debugMode_extraInitializers = [];
|
|
106
|
+
let _debugLimit_decorators;
|
|
107
|
+
let _debugLimit_initializers = [];
|
|
108
|
+
let _debugLimit_extraInitializers = [];
|
|
109
|
+
let _debugFactor_decorators;
|
|
110
|
+
let _debugFactor_initializers = [];
|
|
111
|
+
let _debugFactor_extraInitializers = [];
|
|
112
|
+
return _a = class PBRMetallicRoughnessBlock extends _classSuper {
|
|
113
|
+
static _OnGenerateOnlyFragmentCodeChanged(block, _propertyName) {
|
|
114
|
+
const that = block;
|
|
115
|
+
if (that.worldPosition.isConnected || that.worldNormal.isConnected) {
|
|
116
|
+
that.generateOnlyFragmentCode = !that.generateOnlyFragmentCode;
|
|
117
|
+
Logger.Error("The worldPosition and worldNormal inputs must not be connected to be able to switch!");
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
that._setTarget();
|
|
121
|
+
return true;
|
|
461
122
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
if (!viewInput) {
|
|
467
|
-
viewInput = new InputBlock("view");
|
|
468
|
-
viewInput.setAsSystemValue(NodeMaterialSystemValues.View);
|
|
123
|
+
_setTarget() {
|
|
124
|
+
this._setInitialTarget(this.generateOnlyFragmentCode ? NodeMaterialBlockTargets.Fragment : NodeMaterialBlockTargets.VertexAndFragment);
|
|
125
|
+
this.getInputByName("worldPosition").target = this.generateOnlyFragmentCode ? NodeMaterialBlockTargets.Fragment : NodeMaterialBlockTargets.Vertex;
|
|
126
|
+
this.getInputByName("worldNormal").target = this.generateOnlyFragmentCode ? NodeMaterialBlockTargets.Fragment : NodeMaterialBlockTargets.Vertex;
|
|
469
127
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Create a new ReflectionBlock
|
|
130
|
+
* @param name defines the block name
|
|
131
|
+
*/
|
|
132
|
+
constructor(name) {
|
|
133
|
+
super(name, NodeMaterialBlockTargets.VertexAndFragment);
|
|
134
|
+
this._environmentBRDFTexture = null;
|
|
135
|
+
this._metallicReflectanceColor = Color3.White();
|
|
136
|
+
this._metallicF0Factor = 1;
|
|
137
|
+
/**
|
|
138
|
+
* Intensity of the direct lights e.g. the four lights available in your scene.
|
|
139
|
+
* This impacts both the direct diffuse and specular highlights.
|
|
140
|
+
*/
|
|
141
|
+
this.directIntensity = __runInitializers(this, _directIntensity_initializers, 1.0);
|
|
142
|
+
/**
|
|
143
|
+
* Intensity of the environment e.g. how much the environment will light the object
|
|
144
|
+
* either through harmonics for rough material or through the reflection for shiny ones.
|
|
145
|
+
*/
|
|
146
|
+
this.environmentIntensity = (__runInitializers(this, _directIntensity_extraInitializers), __runInitializers(this, _environmentIntensity_initializers, 1.0));
|
|
147
|
+
/**
|
|
148
|
+
* This is a special control allowing the reduction of the specular highlights coming from the
|
|
149
|
+
* four lights of the scene. Those highlights may not be needed in full environment lighting.
|
|
150
|
+
*/
|
|
151
|
+
this.specularIntensity = (__runInitializers(this, _environmentIntensity_extraInitializers), __runInitializers(this, _specularIntensity_initializers, 1.0));
|
|
152
|
+
/**
|
|
153
|
+
* Defines the falloff type used in this material.
|
|
154
|
+
* It by default is Physical.
|
|
155
|
+
*/
|
|
156
|
+
this.lightFalloff = (__runInitializers(this, _specularIntensity_extraInitializers), __runInitializers(this, _lightFalloff_initializers, 0));
|
|
157
|
+
/**
|
|
158
|
+
* Specifies that alpha test should be used
|
|
159
|
+
*/
|
|
160
|
+
this.useAlphaTest = (__runInitializers(this, _lightFalloff_extraInitializers), __runInitializers(this, _useAlphaTest_initializers, false));
|
|
161
|
+
/**
|
|
162
|
+
* Defines the alpha limits in alpha test mode.
|
|
163
|
+
*/
|
|
164
|
+
this.alphaTestCutoff = (__runInitializers(this, _useAlphaTest_extraInitializers), __runInitializers(this, _alphaTestCutoff_initializers, 0.5));
|
|
165
|
+
/**
|
|
166
|
+
* Specifies that alpha blending should be used
|
|
167
|
+
*/
|
|
168
|
+
this.useAlphaBlending = (__runInitializers(this, _alphaTestCutoff_extraInitializers), __runInitializers(this, _useAlphaBlending_initializers, false));
|
|
169
|
+
/**
|
|
170
|
+
* Specifies that the material will keeps the reflection highlights over a transparent surface (only the most luminous ones).
|
|
171
|
+
* A car glass is a good example of that. When the street lights reflects on it you can not see what is behind.
|
|
172
|
+
*/
|
|
173
|
+
this.useRadianceOverAlpha = (__runInitializers(this, _useAlphaBlending_extraInitializers), __runInitializers(this, _useRadianceOverAlpha_initializers, true));
|
|
174
|
+
/**
|
|
175
|
+
* Specifies that the material will keeps the specular highlights over a transparent surface (only the most luminous ones).
|
|
176
|
+
* A car glass is a good example of that. When sun reflects on it you can not see what is behind.
|
|
177
|
+
*/
|
|
178
|
+
this.useSpecularOverAlpha = (__runInitializers(this, _useRadianceOverAlpha_extraInitializers), __runInitializers(this, _useSpecularOverAlpha_initializers, true));
|
|
179
|
+
/**
|
|
180
|
+
* Enables specular anti aliasing in the PBR shader.
|
|
181
|
+
* It will both interacts on the Geometry for analytical and IBL lighting.
|
|
182
|
+
* It also prefilter the roughness map based on the bump values.
|
|
183
|
+
*/
|
|
184
|
+
this.enableSpecularAntiAliasing = (__runInitializers(this, _useSpecularOverAlpha_extraInitializers), __runInitializers(this, _enableSpecularAntiAliasing_initializers, false));
|
|
185
|
+
/**
|
|
186
|
+
* Enables realtime filtering on the texture.
|
|
187
|
+
*/
|
|
188
|
+
this.realTimeFiltering = (__runInitializers(this, _enableSpecularAntiAliasing_extraInitializers), __runInitializers(this, _realTimeFiltering_initializers, false));
|
|
189
|
+
/**
|
|
190
|
+
* Quality switch for realtime filtering
|
|
191
|
+
*/
|
|
192
|
+
this.realTimeFilteringQuality = (__runInitializers(this, _realTimeFiltering_extraInitializers), __runInitializers(this, _realTimeFilteringQuality_initializers, 8));
|
|
193
|
+
/**
|
|
194
|
+
* Base Diffuse Model
|
|
195
|
+
*/
|
|
196
|
+
this.baseDiffuseModel = (__runInitializers(this, _realTimeFilteringQuality_extraInitializers), __runInitializers(this, _baseDiffuseModel_initializers, 0));
|
|
197
|
+
/**
|
|
198
|
+
* Defines if the material uses energy conservation.
|
|
199
|
+
*/
|
|
200
|
+
this.useEnergyConservation = (__runInitializers(this, _baseDiffuseModel_extraInitializers), __runInitializers(this, _useEnergyConservation_initializers, true));
|
|
201
|
+
/**
|
|
202
|
+
* This parameters will enable/disable radiance occlusion by preventing the radiance to lit
|
|
203
|
+
* too much the area relying on ambient texture to define their ambient occlusion.
|
|
204
|
+
*/
|
|
205
|
+
this.useRadianceOcclusion = (__runInitializers(this, _useEnergyConservation_extraInitializers), __runInitializers(this, _useRadianceOcclusion_initializers, true));
|
|
206
|
+
/**
|
|
207
|
+
* This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
|
|
208
|
+
* makes the reflect vector face the model (under horizon).
|
|
209
|
+
*/
|
|
210
|
+
this.useHorizonOcclusion = (__runInitializers(this, _useRadianceOcclusion_extraInitializers), __runInitializers(this, _useHorizonOcclusion_initializers, true));
|
|
211
|
+
/**
|
|
212
|
+
* If set to true, no lighting calculations will be applied.
|
|
213
|
+
*/
|
|
214
|
+
this.unlit = (__runInitializers(this, _useHorizonOcclusion_extraInitializers), __runInitializers(this, _unlit_initializers, false));
|
|
215
|
+
/**
|
|
216
|
+
* Force normal to face away from face.
|
|
217
|
+
*/
|
|
218
|
+
this.forceNormalForward = (__runInitializers(this, _unlit_extraInitializers), __runInitializers(this, _forceNormalForward_initializers, false));
|
|
219
|
+
/** Indicates that no code should be generated in the vertex shader. Can be useful in some specific circumstances (like when doing ray marching for eg) */
|
|
220
|
+
this.generateOnlyFragmentCode = (__runInitializers(this, _forceNormalForward_extraInitializers), __runInitializers(this, _generateOnlyFragmentCode_initializers, false));
|
|
221
|
+
/**
|
|
222
|
+
* Defines the material debug mode.
|
|
223
|
+
* It helps seeing only some components of the material while troubleshooting.
|
|
224
|
+
*/
|
|
225
|
+
this.debugMode = (__runInitializers(this, _generateOnlyFragmentCode_extraInitializers), __runInitializers(this, _debugMode_initializers, 0));
|
|
226
|
+
/**
|
|
227
|
+
* Specify from where on screen the debug mode should start.
|
|
228
|
+
* The value goes from -1 (full screen) to 1 (not visible)
|
|
229
|
+
* It helps with side by side comparison against the final render
|
|
230
|
+
* This defaults to 0
|
|
231
|
+
*/
|
|
232
|
+
this.debugLimit = (__runInitializers(this, _debugMode_extraInitializers), __runInitializers(this, _debugLimit_initializers, 0));
|
|
233
|
+
/**
|
|
234
|
+
* As the default viewing range might not be enough (if the ambient is really small for instance)
|
|
235
|
+
* You can use the factor to better multiply the final value.
|
|
236
|
+
*/
|
|
237
|
+
this.debugFactor = (__runInitializers(this, _debugLimit_extraInitializers), __runInitializers(this, _debugFactor_initializers, 1));
|
|
238
|
+
__runInitializers(this, _debugFactor_extraInitializers);
|
|
239
|
+
this._isUnique = true;
|
|
240
|
+
this.registerInput("worldPosition", NodeMaterialBlockConnectionPointTypes.Vector4, false, NodeMaterialBlockTargets.Vertex);
|
|
241
|
+
this.registerInput("worldNormal", NodeMaterialBlockConnectionPointTypes.Vector4, false, NodeMaterialBlockTargets.Vertex);
|
|
242
|
+
this.registerInput("view", NodeMaterialBlockConnectionPointTypes.Matrix, false);
|
|
243
|
+
this.registerInput("cameraPosition", NodeMaterialBlockConnectionPointTypes.Vector3, false, NodeMaterialBlockTargets.Fragment);
|
|
244
|
+
this.registerInput("perturbedNormal", NodeMaterialBlockConnectionPointTypes.Vector4, true, NodeMaterialBlockTargets.Fragment);
|
|
245
|
+
this.registerInput("baseColor", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);
|
|
246
|
+
this.registerInput("metallic", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Fragment);
|
|
247
|
+
this.registerInput("roughness", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Fragment);
|
|
248
|
+
this.registerInput("ambientOcc", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);
|
|
249
|
+
this.registerInput("opacity", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);
|
|
250
|
+
this.registerInput("indexOfRefraction", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);
|
|
251
|
+
this.registerInput("ambientColor", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);
|
|
252
|
+
this.registerInput("reflection", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject("reflection", this, 0 /* NodeMaterialConnectionPointDirection.Input */, ReflectionBlock, "ReflectionBlock"));
|
|
253
|
+
this.registerInput("clearcoat", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject("clearcoat", this, 0 /* NodeMaterialConnectionPointDirection.Input */, ClearCoatBlock, "ClearCoatBlock"));
|
|
254
|
+
this.registerInput("sheen", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject("sheen", this, 0 /* NodeMaterialConnectionPointDirection.Input */, SheenBlock, "SheenBlock"));
|
|
255
|
+
this.registerInput("subsurface", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject("subsurface", this, 0 /* NodeMaterialConnectionPointDirection.Input */, SubSurfaceBlock, "SubSurfaceBlock"));
|
|
256
|
+
this.registerInput("anisotropy", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject("anisotropy", this, 0 /* NodeMaterialConnectionPointDirection.Input */, AnisotropyBlock, "AnisotropyBlock"));
|
|
257
|
+
this.registerInput("iridescence", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject("iridescence", this, 0 /* NodeMaterialConnectionPointDirection.Input */, IridescenceBlock, "IridescenceBlock"));
|
|
258
|
+
this.registerOutput("ambientClr", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
259
|
+
this.registerOutput("diffuseDir", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
260
|
+
this.registerOutput("specularDir", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
261
|
+
this.registerOutput("clearcoatDir", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
262
|
+
this.registerOutput("sheenDir", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
263
|
+
this.registerOutput("diffuseInd", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
264
|
+
this.registerOutput("specularInd", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
265
|
+
this.registerOutput("clearcoatInd", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
266
|
+
this.registerOutput("sheenInd", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
267
|
+
this.registerOutput("refraction", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
268
|
+
this.registerOutput("lighting", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
|
|
269
|
+
this.registerOutput("shadow", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);
|
|
270
|
+
this.registerOutput("alpha", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);
|
|
577
271
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Initialize the block and prepare the context for build
|
|
274
|
+
* @param state defines the state that will be used for the build
|
|
275
|
+
*/
|
|
276
|
+
initialize(state) {
|
|
277
|
+
state._excludeVariableName("vLightingIntensity");
|
|
278
|
+
state._excludeVariableName("geometricNormalW");
|
|
279
|
+
state._excludeVariableName("normalW");
|
|
280
|
+
state._excludeVariableName("faceNormal");
|
|
281
|
+
state._excludeVariableName("albedoOpacityOut");
|
|
282
|
+
state._excludeVariableName("surfaceAlbedo");
|
|
283
|
+
state._excludeVariableName("alpha");
|
|
284
|
+
state._excludeVariableName("aoOut");
|
|
285
|
+
state._excludeVariableName("baseColor");
|
|
286
|
+
state._excludeVariableName("reflectivityOut");
|
|
287
|
+
state._excludeVariableName("microSurface");
|
|
288
|
+
state._excludeVariableName("roughness");
|
|
289
|
+
state._excludeVariableName("vReflectivityColor");
|
|
290
|
+
state._excludeVariableName("NdotVUnclamped");
|
|
291
|
+
state._excludeVariableName("NdotV");
|
|
292
|
+
state._excludeVariableName("alphaG");
|
|
293
|
+
state._excludeVariableName("AARoughnessFactors");
|
|
294
|
+
state._excludeVariableName("environmentBrdf");
|
|
295
|
+
state._excludeVariableName("ambientMonochrome");
|
|
296
|
+
state._excludeVariableName("seo");
|
|
297
|
+
state._excludeVariableName("eho");
|
|
298
|
+
state._excludeVariableName("environmentRadiance");
|
|
299
|
+
state._excludeVariableName("irradianceVector");
|
|
300
|
+
state._excludeVariableName("environmentIrradiance");
|
|
301
|
+
state._excludeVariableName("diffuseBase");
|
|
302
|
+
state._excludeVariableName("specularBase");
|
|
303
|
+
state._excludeVariableName("preInfo");
|
|
304
|
+
state._excludeVariableName("info");
|
|
305
|
+
state._excludeVariableName("shadow");
|
|
306
|
+
state._excludeVariableName("finalDiffuse");
|
|
307
|
+
state._excludeVariableName("finalAmbient");
|
|
308
|
+
state._excludeVariableName("ambientOcclusionForDirectDiffuse");
|
|
309
|
+
state._excludeVariableName("finalColor");
|
|
310
|
+
state._excludeVariableName("vClipSpacePosition");
|
|
311
|
+
state._excludeVariableName("vDebugMode");
|
|
312
|
+
state._excludeVariableName("vViewDepth");
|
|
313
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
314
|
+
this._initShaderSourceAsync(state.shaderLanguage);
|
|
591
315
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
*/
|
|
603
|
-
isReady(mesh, nodeMaterial, defines) {
|
|
604
|
-
if (this._environmentBRDFTexture && !this._environmentBRDFTexture.isReady()) {
|
|
605
|
-
return false;
|
|
606
|
-
}
|
|
607
|
-
if (defines._areImageProcessingDirty && nodeMaterial.imageProcessingConfiguration) {
|
|
608
|
-
if (!nodeMaterial.imageProcessingConfiguration.isReady()) {
|
|
609
|
-
return false;
|
|
316
|
+
async _initShaderSourceAsync(shaderLanguage) {
|
|
317
|
+
this._codeIsReady = false;
|
|
318
|
+
if (shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
319
|
+
await Promise.all([import("../../../../ShadersWGSL/pbr.vertex.js"), import("../../../../ShadersWGSL/pbr.fragment.js")]);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
await Promise.all([import("../../../../Shaders/pbr.vertex.js"), import("../../../../Shaders/pbr.fragment.js")]);
|
|
323
|
+
}
|
|
324
|
+
this._codeIsReady = true;
|
|
325
|
+
this.onCodeIsReadyObservable.notifyObservers(this);
|
|
610
326
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
/**
|
|
618
|
-
* Bind data to effect
|
|
619
|
-
* @param effect - the effect to bind data to
|
|
620
|
-
* @param nodeMaterial - the node material
|
|
621
|
-
* @param mesh - the mesh to bind data for
|
|
622
|
-
*/
|
|
623
|
-
bind(effect, nodeMaterial, mesh) {
|
|
624
|
-
if (!mesh) {
|
|
625
|
-
return;
|
|
626
|
-
}
|
|
627
|
-
const scene = mesh.getScene();
|
|
628
|
-
if (!this.light) {
|
|
629
|
-
BindLights(scene, mesh, effect, true, nodeMaterial.maxSimultaneousLights);
|
|
630
|
-
}
|
|
631
|
-
else {
|
|
632
|
-
BindLight(this.light, this._lightId, scene, effect, true);
|
|
633
|
-
}
|
|
634
|
-
effect.setTexture(this._environmentBrdfSamplerName, this._environmentBRDFTexture);
|
|
635
|
-
effect.setFloat2("vDebugMode", this.debugLimit, this.debugFactor);
|
|
636
|
-
const ambientScene = this._scene.ambientColor;
|
|
637
|
-
if (ambientScene) {
|
|
638
|
-
effect.setColor3("ambientFromScene", ambientScene);
|
|
639
|
-
}
|
|
640
|
-
const invertNormal = scene.useRightHandedSystem === (scene._mirroredCameraPosition != null);
|
|
641
|
-
effect.setFloat(this._invertNormalName, invertNormal ? -1 : 1);
|
|
642
|
-
effect.setFloat4("vLightingIntensity", this.directIntensity, 1, this.environmentIntensity * this._scene.environmentIntensity, this.specularIntensity);
|
|
643
|
-
// reflectivity bindings
|
|
644
|
-
const metallicF90 = this._metallicF0Factor;
|
|
645
|
-
effect.setColor4(this._vMetallicReflectanceFactorsName, this._metallicReflectanceColor, metallicF90);
|
|
646
|
-
if (nodeMaterial.imageProcessingConfiguration) {
|
|
647
|
-
nodeMaterial.imageProcessingConfiguration.bind(effect);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
_injectVertexCode(state) {
|
|
651
|
-
const worldPos = this.worldPosition;
|
|
652
|
-
const worldNormal = this.worldNormal;
|
|
653
|
-
const comments = `//${this.name}`;
|
|
654
|
-
const isWebGPU = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;
|
|
655
|
-
const scene = state.sharedData.nodeMaterial.getScene();
|
|
656
|
-
// Declaration
|
|
657
|
-
if (!this.light) {
|
|
658
|
-
// Emit for all lights
|
|
659
|
-
state._emitFunctionFromInclude(state.supportUniformBuffers ? "lightVxUboDeclaration" : "lightVxFragmentDeclaration", comments, {
|
|
660
|
-
repeatKey: "maxSimultaneousLights",
|
|
661
|
-
});
|
|
662
|
-
this._lightId = 0;
|
|
663
|
-
state.sharedData.dynamicUniformBlocks.push(this);
|
|
664
|
-
}
|
|
665
|
-
else {
|
|
666
|
-
this._lightId = (state.counters["lightCounter"] !== undefined ? state.counters["lightCounter"] : -1) + 1;
|
|
667
|
-
state.counters["lightCounter"] = this._lightId;
|
|
668
|
-
state._emitFunctionFromInclude(state.supportUniformBuffers ? "lightVxUboDeclaration" : "lightVxFragmentDeclaration", comments, {
|
|
669
|
-
replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }],
|
|
670
|
-
}, this._lightId.toString());
|
|
671
|
-
}
|
|
672
|
-
// Inject code in vertex
|
|
673
|
-
const worldPosVaryingName = "v_" + worldPos.associatedVariableName;
|
|
674
|
-
if (state._emitVaryingFromString(worldPosVaryingName, NodeMaterialBlockConnectionPointTypes.Vector4)) {
|
|
675
|
-
state.compilationString += (isWebGPU ? "vertexOutputs." : "") + `${worldPosVaryingName} = ${worldPos.associatedVariableName};\n`;
|
|
676
|
-
}
|
|
677
|
-
const worldNormalVaryingName = "v_" + worldNormal.associatedVariableName;
|
|
678
|
-
if (state._emitVaryingFromString(worldNormalVaryingName, NodeMaterialBlockConnectionPointTypes.Vector4)) {
|
|
679
|
-
state.compilationString += (isWebGPU ? "vertexOutputs." : "") + `${worldNormalVaryingName} = ${worldNormal.associatedVariableName};\n`;
|
|
680
|
-
}
|
|
681
|
-
const reflectionBlock = this.reflection.isConnected ? this.reflection.connectedPoint?.ownerBlock : null;
|
|
682
|
-
if (reflectionBlock) {
|
|
683
|
-
reflectionBlock.viewConnectionPoint = this.view;
|
|
684
|
-
}
|
|
685
|
-
state.compilationString += reflectionBlock?.handleVertexSide(state) ?? "";
|
|
686
|
-
if (state._emitVaryingFromString("vClipSpacePosition", NodeMaterialBlockConnectionPointTypes.Vector4, "defined(IGNORE) || DEBUGMODE > 0")) {
|
|
687
|
-
state._injectAtEnd += `#if DEBUGMODE > 0\n`;
|
|
688
|
-
state._injectAtEnd += (isWebGPU ? "vertexOutputs." : "") + `vClipSpacePosition = ${isWebGPU ? "vertexOutputs.position" : "gl_Position"};\n`;
|
|
689
|
-
state._injectAtEnd += `#endif\n`;
|
|
690
|
-
}
|
|
691
|
-
if (this.light) {
|
|
692
|
-
state.compilationString += state._emitCodeFromInclude("shadowsVertex", comments, {
|
|
693
|
-
replaceStrings: [
|
|
694
|
-
{ search: /{X}/g, replace: this._lightId.toString() },
|
|
695
|
-
{ search: /worldPos/g, replace: worldPos.associatedVariableName },
|
|
696
|
-
],
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
else {
|
|
700
|
-
state.compilationString += `${state._declareLocalVar("worldPos", NodeMaterialBlockConnectionPointTypes.Vector4)} = ${worldPos.associatedVariableName};\n`;
|
|
701
|
-
if (this.view.isConnected) {
|
|
702
|
-
state.compilationString += `${state._declareLocalVar("view", NodeMaterialBlockConnectionPointTypes.Matrix)} = ${this.view.associatedVariableName};\n`;
|
|
703
|
-
state._emitVaryingFromString("vViewDepth", NodeMaterialBlockConnectionPointTypes.Float);
|
|
704
|
-
state.compilationString +=
|
|
705
|
-
(state.shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? "vertexOutputs." : "") +
|
|
706
|
-
`vViewDepth = ${scene.useRightHandedSystem ? "-" : ""}(${this.view.associatedVariableName} * ${worldPos.associatedVariableName}).z;\n`;
|
|
327
|
+
/**
|
|
328
|
+
* Gets the current class name
|
|
329
|
+
* @returns the class name
|
|
330
|
+
*/
|
|
331
|
+
getClassName() {
|
|
332
|
+
return "PBRMetallicRoughnessBlock";
|
|
707
333
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
334
|
+
/**
|
|
335
|
+
* Gets the world position input component
|
|
336
|
+
*/
|
|
337
|
+
get worldPosition() {
|
|
338
|
+
return this._inputs[0];
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Gets the world normal input component
|
|
342
|
+
*/
|
|
343
|
+
get worldNormal() {
|
|
344
|
+
return this._inputs[1];
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Gets the view matrix parameter
|
|
348
|
+
*/
|
|
349
|
+
get view() {
|
|
350
|
+
return this._inputs[2];
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Gets the camera position input component
|
|
354
|
+
*/
|
|
355
|
+
get cameraPosition() {
|
|
356
|
+
return this._inputs[3];
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Gets the perturbed normal input component
|
|
360
|
+
*/
|
|
361
|
+
get perturbedNormal() {
|
|
362
|
+
return this._inputs[4];
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Gets the base color input component
|
|
366
|
+
*/
|
|
367
|
+
get baseColor() {
|
|
368
|
+
return this._inputs[5];
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Gets the metallic input component
|
|
372
|
+
*/
|
|
373
|
+
get metallic() {
|
|
374
|
+
return this._inputs[6];
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Gets the roughness input component
|
|
378
|
+
*/
|
|
379
|
+
get roughness() {
|
|
380
|
+
return this._inputs[7];
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Gets the ambient occlusion input component
|
|
384
|
+
*/
|
|
385
|
+
get ambientOcc() {
|
|
386
|
+
return this._inputs[8];
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Gets the opacity input component
|
|
390
|
+
*/
|
|
391
|
+
get opacity() {
|
|
392
|
+
return this._inputs[9];
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Gets the index of refraction input component
|
|
396
|
+
*/
|
|
397
|
+
get indexOfRefraction() {
|
|
398
|
+
return this._inputs[10];
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Gets the ambient color input component
|
|
402
|
+
*/
|
|
403
|
+
get ambientColor() {
|
|
404
|
+
return this._inputs[11];
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Gets the reflection object parameters
|
|
408
|
+
*/
|
|
409
|
+
get reflection() {
|
|
410
|
+
return this._inputs[12];
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Gets the clear coat object parameters
|
|
414
|
+
*/
|
|
415
|
+
get clearcoat() {
|
|
416
|
+
return this._inputs[13];
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Gets the sheen object parameters
|
|
420
|
+
*/
|
|
421
|
+
get sheen() {
|
|
422
|
+
return this._inputs[14];
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Gets the sub surface object parameters
|
|
426
|
+
*/
|
|
427
|
+
get subsurface() {
|
|
428
|
+
return this._inputs[15];
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Gets the anisotropy object parameters
|
|
432
|
+
*/
|
|
433
|
+
get anisotropy() {
|
|
434
|
+
return this._inputs[16];
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Gets the iridescence object parameters
|
|
438
|
+
*/
|
|
439
|
+
get iridescence() {
|
|
440
|
+
return this._inputs[17];
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Gets the ambient output component
|
|
444
|
+
*/
|
|
445
|
+
get ambientClr() {
|
|
446
|
+
return this._outputs[0];
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Gets the diffuse output component
|
|
450
|
+
*/
|
|
451
|
+
get diffuseDir() {
|
|
452
|
+
return this._outputs[1];
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Gets the specular output component
|
|
456
|
+
*/
|
|
457
|
+
get specularDir() {
|
|
458
|
+
return this._outputs[2];
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Gets the clear coat output component
|
|
462
|
+
*/
|
|
463
|
+
get clearcoatDir() {
|
|
464
|
+
return this._outputs[3];
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Gets the sheen output component
|
|
468
|
+
*/
|
|
469
|
+
get sheenDir() {
|
|
470
|
+
return this._outputs[4];
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Gets the indirect diffuse output component
|
|
474
|
+
*/
|
|
475
|
+
get diffuseInd() {
|
|
476
|
+
return this._outputs[5];
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Gets the indirect specular output component
|
|
480
|
+
*/
|
|
481
|
+
get specularInd() {
|
|
482
|
+
return this._outputs[6];
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Gets the indirect clear coat output component
|
|
486
|
+
*/
|
|
487
|
+
get clearcoatInd() {
|
|
488
|
+
return this._outputs[7];
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Gets the indirect sheen output component
|
|
492
|
+
*/
|
|
493
|
+
get sheenInd() {
|
|
494
|
+
return this._outputs[8];
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Gets the refraction output component
|
|
498
|
+
*/
|
|
499
|
+
get refraction() {
|
|
500
|
+
return this._outputs[9];
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Gets the global lighting output component
|
|
504
|
+
*/
|
|
505
|
+
get lighting() {
|
|
506
|
+
return this._outputs[10];
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Gets the shadow output component
|
|
510
|
+
*/
|
|
511
|
+
get shadow() {
|
|
512
|
+
return this._outputs[11];
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Gets the alpha output component
|
|
516
|
+
*/
|
|
517
|
+
get alpha() {
|
|
518
|
+
return this._outputs[12];
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Auto configure the block based on the material
|
|
522
|
+
* @param material - the node material
|
|
523
|
+
* @param additionalFilteringInfo - additional filtering info
|
|
524
|
+
*/
|
|
525
|
+
autoConfigure(material, additionalFilteringInfo = () => true) {
|
|
526
|
+
if (!this.cameraPosition.isConnected) {
|
|
527
|
+
let cameraPositionInput = material.getInputBlockByPredicate((b) => b.systemValue === NodeMaterialSystemValues.CameraPosition && additionalFilteringInfo(b));
|
|
528
|
+
if (!cameraPositionInput) {
|
|
529
|
+
cameraPositionInput = new InputBlock("cameraPosition");
|
|
530
|
+
cameraPositionInput.setAsSystemValue(NodeMaterialSystemValues.CameraPosition);
|
|
531
|
+
}
|
|
532
|
+
cameraPositionInput.output.connectTo(this.cameraPosition);
|
|
533
|
+
}
|
|
534
|
+
if (!this.view.isConnected) {
|
|
535
|
+
let viewInput = material.getInputBlockByPredicate((b) => b.systemValue === NodeMaterialSystemValues.View && additionalFilteringInfo(b));
|
|
536
|
+
if (!viewInput) {
|
|
537
|
+
viewInput = new InputBlock("view");
|
|
538
|
+
viewInput.setAsSystemValue(NodeMaterialSystemValues.View);
|
|
539
|
+
}
|
|
540
|
+
viewInput.output.connectTo(this.view);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Prepare the list of defines
|
|
545
|
+
* @param defines - the list of defines to update
|
|
546
|
+
* @param nodeMaterial - the node material
|
|
547
|
+
* @param mesh - the mesh to prepare defines for
|
|
548
|
+
*/
|
|
549
|
+
prepareDefines(defines, nodeMaterial, mesh) {
|
|
550
|
+
if (!mesh) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
// General
|
|
554
|
+
defines.setValue("PBR", true);
|
|
555
|
+
defines.setValue("METALLICWORKFLOW", true);
|
|
556
|
+
defines.setValue("DEBUGMODE", this.debugMode, true);
|
|
557
|
+
defines.setValue("DEBUGMODE_FORCERETURN", true);
|
|
558
|
+
defines.setValue("NORMALXYSCALE", true);
|
|
559
|
+
defines.setValue("BUMP", this.perturbedNormal.isConnected, true);
|
|
560
|
+
defines.setValue("LODBASEDMICROSFURACE", this._scene.getEngine().getCaps().textureLOD);
|
|
561
|
+
// Albedo & Opacity
|
|
562
|
+
defines.setValue("ALBEDO", false, true);
|
|
563
|
+
defines.setValue("OPACITY", this.opacity.isConnected, true);
|
|
564
|
+
// Ambient occlusion
|
|
565
|
+
defines.setValue("AMBIENT", true, true);
|
|
566
|
+
defines.setValue("AMBIENTINGRAYSCALE", false, true);
|
|
567
|
+
// Reflectivity
|
|
568
|
+
defines.setValue("REFLECTIVITY", false, true);
|
|
569
|
+
defines.setValue("AOSTOREINMETALMAPRED", false, true);
|
|
570
|
+
defines.setValue("METALLNESSSTOREINMETALMAPBLUE", false, true);
|
|
571
|
+
defines.setValue("ROUGHNESSSTOREINMETALMAPALPHA", false, true);
|
|
572
|
+
defines.setValue("ROUGHNESSSTOREINMETALMAPGREEN", false, true);
|
|
573
|
+
// Lighting & colors
|
|
574
|
+
if (this.lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_STANDARD) {
|
|
575
|
+
defines.setValue("USEPHYSICALLIGHTFALLOFF", false);
|
|
576
|
+
defines.setValue("USEGLTFLIGHTFALLOFF", false);
|
|
577
|
+
}
|
|
578
|
+
else if (this.lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF) {
|
|
579
|
+
defines.setValue("USEPHYSICALLIGHTFALLOFF", false);
|
|
580
|
+
defines.setValue("USEGLTFLIGHTFALLOFF", true);
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
defines.setValue("USEPHYSICALLIGHTFALLOFF", true);
|
|
584
|
+
defines.setValue("USEGLTFLIGHTFALLOFF", false);
|
|
585
|
+
}
|
|
586
|
+
// Transparency
|
|
587
|
+
const alphaTestCutOffString = this.alphaTestCutoff.toString();
|
|
588
|
+
defines.setValue("ALPHABLEND", this.useAlphaBlending, true);
|
|
589
|
+
defines.setValue("ALPHAFROMALBEDO", false, true);
|
|
590
|
+
defines.setValue("ALPHATEST", this.useAlphaTest, true);
|
|
591
|
+
defines.setValue("ALPHATESTVALUE", alphaTestCutOffString.indexOf(".") < 0 ? alphaTestCutOffString + "." : alphaTestCutOffString, true);
|
|
592
|
+
defines.setValue("OPACITYRGB", false, true);
|
|
593
|
+
// Rendering
|
|
594
|
+
defines.setValue("RADIANCEOVERALPHA", this.useRadianceOverAlpha, true);
|
|
595
|
+
defines.setValue("SPECULAROVERALPHA", this.useSpecularOverAlpha, true);
|
|
596
|
+
defines.setValue("SPECULARAA", this._scene.getEngine().getCaps().standardDerivatives && this.enableSpecularAntiAliasing, true);
|
|
597
|
+
defines.setValue("REALTIME_FILTERING", this.realTimeFiltering, true);
|
|
598
|
+
const scene = mesh.getScene();
|
|
599
|
+
const engine = scene.getEngine();
|
|
600
|
+
if (engine._features.needTypeSuffixInShaderConstants) {
|
|
601
|
+
defines.setValue("NUM_SAMPLES", this.realTimeFilteringQuality + "u", true);
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
defines.setValue("NUM_SAMPLES", "" + this.realTimeFilteringQuality, true);
|
|
605
|
+
}
|
|
606
|
+
defines.setValue("BASE_DIFFUSE_MODEL", this.baseDiffuseModel, true);
|
|
607
|
+
// Advanced
|
|
608
|
+
defines.setValue("BRDF_V_HEIGHT_CORRELATED", true);
|
|
609
|
+
defines.setValue("LEGACY_SPECULAR_ENERGY_CONSERVATION", true);
|
|
610
|
+
defines.setValue("MS_BRDF_ENERGY_CONSERVATION", this.useEnergyConservation, true);
|
|
611
|
+
defines.setValue("RADIANCEOCCLUSION", this.useRadianceOcclusion, true);
|
|
612
|
+
defines.setValue("HORIZONOCCLUSION", this.useHorizonOcclusion, true);
|
|
613
|
+
defines.setValue("UNLIT", this.unlit, true);
|
|
614
|
+
defines.setValue("FORCENORMALFORWARD", this.forceNormalForward, true);
|
|
615
|
+
if (this._environmentBRDFTexture && MaterialFlags.ReflectionTextureEnabled) {
|
|
616
|
+
defines.setValue("ENVIRONMENTBRDF", true);
|
|
617
|
+
defines.setValue("ENVIRONMENTBRDF_RGBD", this._environmentBRDFTexture.isRGBD, true);
|
|
618
|
+
}
|
|
619
|
+
else {
|
|
620
|
+
defines.setValue("ENVIRONMENTBRDF", false);
|
|
621
|
+
defines.setValue("ENVIRONMENTBRDF_RGBD", false);
|
|
622
|
+
}
|
|
623
|
+
if (defines._areImageProcessingDirty && nodeMaterial.imageProcessingConfiguration) {
|
|
624
|
+
nodeMaterial.imageProcessingConfiguration.prepareDefines(defines);
|
|
625
|
+
}
|
|
626
|
+
if (!defines._areLightsDirty) {
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
if (!this.light) {
|
|
630
|
+
// Lights
|
|
631
|
+
PrepareDefinesForLights(scene, mesh, defines, true, nodeMaterial.maxSimultaneousLights);
|
|
632
|
+
defines._needNormals = true;
|
|
633
|
+
// Multiview
|
|
634
|
+
PrepareDefinesForMultiview(scene, defines);
|
|
635
|
+
}
|
|
636
|
+
else {
|
|
637
|
+
const state = {
|
|
638
|
+
needNormals: false,
|
|
639
|
+
needRebuild: false,
|
|
640
|
+
lightmapMode: false,
|
|
641
|
+
shadowEnabled: false,
|
|
642
|
+
specularEnabled: false,
|
|
643
|
+
};
|
|
644
|
+
PrepareDefinesForLight(scene, mesh, this.light, this._lightId, defines, true, state);
|
|
645
|
+
if (state.needRebuild) {
|
|
646
|
+
defines.rebuild();
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Update the uniforms and samples
|
|
652
|
+
* @param state - the build state
|
|
653
|
+
* @param nodeMaterial - the node material
|
|
654
|
+
* @param defines - the list of defines
|
|
655
|
+
* @param uniformBuffers - the uniform buffers
|
|
656
|
+
*/
|
|
657
|
+
updateUniformsAndSamples(state, nodeMaterial, defines, uniformBuffers) {
|
|
658
|
+
for (let lightIndex = 0; lightIndex < nodeMaterial.maxSimultaneousLights; lightIndex++) {
|
|
659
|
+
if (!defines["LIGHT" + lightIndex]) {
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
const onlyUpdateBuffersList = state.uniforms.indexOf("vLightData" + lightIndex) >= 0;
|
|
663
|
+
PrepareUniformsAndSamplersForLight(lightIndex, state.uniforms, state.samplers, defines["PROJECTEDLIGHTTEXTURE" + lightIndex], uniformBuffers, onlyUpdateBuffersList, defines["IESLIGHTTEXTURE" + lightIndex], defines["CLUSTLIGHT" + lightIndex], defines["RECTAREALIGHTEMISSIONTEXTURE" + lightIndex], state.shaderLanguage === 1 /* ShaderLanguage.WGSL */);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Checks if the block is ready
|
|
668
|
+
* @param mesh - the mesh to check
|
|
669
|
+
* @param nodeMaterial - the node material
|
|
670
|
+
* @param defines - the list of defines
|
|
671
|
+
* @returns true if ready
|
|
672
|
+
*/
|
|
673
|
+
isReady(mesh, nodeMaterial, defines) {
|
|
674
|
+
if (this._environmentBRDFTexture && !this._environmentBRDFTexture.isReady()) {
|
|
675
|
+
return false;
|
|
676
|
+
}
|
|
677
|
+
if (defines._areImageProcessingDirty && nodeMaterial.imageProcessingConfiguration) {
|
|
678
|
+
if (!nodeMaterial.imageProcessingConfiguration.isReady()) {
|
|
679
|
+
return false;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
if (this.light && !this.light.areLightTexturesReady()) {
|
|
683
|
+
return false;
|
|
684
|
+
}
|
|
685
|
+
return true;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Bind data to effect
|
|
689
|
+
* @param effect - the effect to bind data to
|
|
690
|
+
* @param nodeMaterial - the node material
|
|
691
|
+
* @param mesh - the mesh to bind data for
|
|
692
|
+
*/
|
|
693
|
+
bind(effect, nodeMaterial, mesh) {
|
|
694
|
+
if (!mesh) {
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
const scene = mesh.getScene();
|
|
698
|
+
if (!this.light) {
|
|
699
|
+
BindLights(scene, mesh, effect, true, nodeMaterial.maxSimultaneousLights);
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
BindLight(this.light, this._lightId, scene, effect, true);
|
|
703
|
+
}
|
|
704
|
+
effect.setTexture(this._environmentBrdfSamplerName, this._environmentBRDFTexture);
|
|
705
|
+
effect.setFloat2("vDebugMode", this.debugLimit, this.debugFactor);
|
|
706
|
+
const ambientScene = this._scene.ambientColor;
|
|
707
|
+
if (ambientScene) {
|
|
708
|
+
effect.setColor3("ambientFromScene", ambientScene);
|
|
709
|
+
}
|
|
710
|
+
const invertNormal = scene.useRightHandedSystem === (scene._mirroredCameraPosition != null);
|
|
711
|
+
effect.setFloat(this._invertNormalName, invertNormal ? -1 : 1);
|
|
712
|
+
effect.setFloat4("vLightingIntensity", this.directIntensity, 1, this.environmentIntensity * this._scene.environmentIntensity, this.specularIntensity);
|
|
713
|
+
// reflectivity bindings
|
|
714
|
+
const metallicF90 = this._metallicF0Factor;
|
|
715
|
+
effect.setColor4(this._vMetallicReflectanceFactorsName, this._metallicReflectanceColor, metallicF90);
|
|
716
|
+
if (nodeMaterial.imageProcessingConfiguration) {
|
|
717
|
+
nodeMaterial.imageProcessingConfiguration.bind(effect);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
_injectVertexCode(state) {
|
|
721
|
+
const worldPos = this.worldPosition;
|
|
722
|
+
const worldNormal = this.worldNormal;
|
|
723
|
+
const comments = `//${this.name}`;
|
|
724
|
+
const isWebGPU = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;
|
|
725
|
+
const scene = state.sharedData.nodeMaterial.getScene();
|
|
726
|
+
// Declaration
|
|
727
|
+
if (!this.light) {
|
|
728
|
+
// Emit for all lights
|
|
729
|
+
state._emitFunctionFromInclude(state.supportUniformBuffers ? "lightVxUboDeclaration" : "lightVxFragmentDeclaration", comments, {
|
|
730
|
+
repeatKey: "maxSimultaneousLights",
|
|
731
|
+
});
|
|
732
|
+
this._lightId = 0;
|
|
733
|
+
state.sharedData.dynamicUniformBlocks.push(this);
|
|
734
|
+
}
|
|
735
|
+
else {
|
|
736
|
+
this._lightId = (state.counters["lightCounter"] !== undefined ? state.counters["lightCounter"] : -1) + 1;
|
|
737
|
+
state.counters["lightCounter"] = this._lightId;
|
|
738
|
+
state._emitFunctionFromInclude(state.supportUniformBuffers ? "lightVxUboDeclaration" : "lightVxFragmentDeclaration", comments, {
|
|
739
|
+
replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }],
|
|
740
|
+
}, this._lightId.toString());
|
|
741
|
+
}
|
|
742
|
+
// Inject code in vertex
|
|
743
|
+
const worldPosVaryingName = "v_" + worldPos.associatedVariableName;
|
|
744
|
+
if (state._emitVaryingFromString(worldPosVaryingName, NodeMaterialBlockConnectionPointTypes.Vector4)) {
|
|
745
|
+
state.compilationString += (isWebGPU ? "vertexOutputs." : "") + `${worldPosVaryingName} = ${worldPos.associatedVariableName};\n`;
|
|
746
|
+
}
|
|
747
|
+
const worldNormalVaryingName = "v_" + worldNormal.associatedVariableName;
|
|
748
|
+
if (state._emitVaryingFromString(worldNormalVaryingName, NodeMaterialBlockConnectionPointTypes.Vector4)) {
|
|
749
|
+
state.compilationString += (isWebGPU ? "vertexOutputs." : "") + `${worldNormalVaryingName} = ${worldNormal.associatedVariableName};\n`;
|
|
750
|
+
}
|
|
751
|
+
const reflectionBlock = this.reflection.isConnected ? this.reflection.connectedPoint?.ownerBlock : null;
|
|
752
|
+
if (reflectionBlock) {
|
|
753
|
+
reflectionBlock.viewConnectionPoint = this.view;
|
|
754
|
+
}
|
|
755
|
+
state.compilationString += reflectionBlock?.handleVertexSide(state) ?? "";
|
|
756
|
+
if (state._emitVaryingFromString("vClipSpacePosition", NodeMaterialBlockConnectionPointTypes.Vector4, "defined(IGNORE) || DEBUGMODE > 0")) {
|
|
757
|
+
state._injectAtEnd += `#if DEBUGMODE > 0\n`;
|
|
758
|
+
state._injectAtEnd += (isWebGPU ? "vertexOutputs." : "") + `vClipSpacePosition = ${isWebGPU ? "vertexOutputs.position" : "gl_Position"};\n`;
|
|
759
|
+
state._injectAtEnd += `#endif\n`;
|
|
760
|
+
}
|
|
761
|
+
if (this.light) {
|
|
762
|
+
state.compilationString += state._emitCodeFromInclude("shadowsVertex", comments, {
|
|
763
|
+
replaceStrings: [
|
|
764
|
+
{ search: /{X}/g, replace: this._lightId.toString() },
|
|
765
|
+
{ search: /worldPos/g, replace: worldPos.associatedVariableName },
|
|
766
|
+
],
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
else {
|
|
770
|
+
state.compilationString += `${state._declareLocalVar("worldPos", NodeMaterialBlockConnectionPointTypes.Vector4)} = ${worldPos.associatedVariableName};\n`;
|
|
771
|
+
if (this.view.isConnected) {
|
|
772
|
+
state.compilationString += `${state._declareLocalVar("view", NodeMaterialBlockConnectionPointTypes.Matrix)} = ${this.view.associatedVariableName};\n`;
|
|
773
|
+
state._emitVaryingFromString("vViewDepth", NodeMaterialBlockConnectionPointTypes.Float);
|
|
774
|
+
state.compilationString +=
|
|
775
|
+
(state.shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? "vertexOutputs." : "") +
|
|
776
|
+
`vViewDepth = ${scene.useRightHandedSystem ? "-" : ""}(${this.view.associatedVariableName} * ${worldPos.associatedVariableName}).z;\n`;
|
|
777
|
+
}
|
|
778
|
+
state.compilationString += state._emitCodeFromInclude("shadowsVertex", comments, {
|
|
779
|
+
repeatKey: "maxSimultaneousLights",
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
_getAlbedoOpacityCode(state) {
|
|
784
|
+
const isWebGPU = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;
|
|
785
|
+
let code = isWebGPU ? "var albedoOpacityOut: albedoOpacityOutParams;\n" : `albedoOpacityOutParams albedoOpacityOut;\n`;
|
|
786
|
+
const albedoColor = this.baseColor.isConnected ? this.baseColor.associatedVariableName : "vec3(1.)";
|
|
787
|
+
const opacity = this.opacity.isConnected ? this.opacity.associatedVariableName : "1.";
|
|
788
|
+
code += `albedoOpacityOut = albedoOpacityBlock(
|
|
719
789
|
vec4${state.fSuffix}(${albedoColor}, 1.)
|
|
720
790
|
#ifdef ALBEDO
|
|
721
791
|
,vec4${state.fSuffix}(1.)
|
|
@@ -730,34 +800,34 @@ export class PBRMetallicRoughnessBlock extends NodeMaterialBlock {
|
|
|
730
800
|
|
|
731
801
|
${state._declareLocalVar("surfaceAlbedo", NodeMaterialBlockConnectionPointTypes.Vector3)} = albedoOpacityOut.surfaceAlbedo;
|
|
732
802
|
${state._declareLocalVar("alpha", NodeMaterialBlockConnectionPointTypes.Float)} = albedoOpacityOut.alpha;\n`;
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
803
|
+
return code;
|
|
804
|
+
}
|
|
805
|
+
_getAmbientOcclusionCode(state) {
|
|
806
|
+
const isWebGPU = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;
|
|
807
|
+
let code = isWebGPU ? "var aoOut: ambientOcclusionOutParams;\n" : `ambientOcclusionOutParams aoOut;\n`;
|
|
808
|
+
const ao = this.ambientOcc.isConnected ? this.ambientOcc.associatedVariableName : "1.";
|
|
809
|
+
code += `aoOut = ambientOcclusionBlock(
|
|
740
810
|
#ifdef AMBIENT
|
|
741
811
|
vec3${state.fSuffix}(${ao}),
|
|
742
812
|
vec4${state.fSuffix}(0., 1.0, 1.0, 0.)
|
|
743
813
|
#endif
|
|
744
814
|
);\n`;
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
815
|
+
return code;
|
|
816
|
+
}
|
|
817
|
+
_getReflectivityCode(state) {
|
|
818
|
+
const isWebGPU = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;
|
|
819
|
+
let code = isWebGPU ? "var reflectivityOut: reflectivityOutParams;\n" : `reflectivityOutParams reflectivityOut;\n`;
|
|
820
|
+
const aoIntensity = "1.";
|
|
821
|
+
this._vMetallicReflectanceFactorsName = state._getFreeVariableName("vMetallicReflectanceFactors");
|
|
822
|
+
state._emitUniformFromString(this._vMetallicReflectanceFactorsName, NodeMaterialBlockConnectionPointTypes.Vector4);
|
|
823
|
+
this._baseDiffuseRoughnessName = state._getFreeVariableName("baseDiffuseRoughness");
|
|
824
|
+
state._emitUniformFromString(this._baseDiffuseRoughnessName, NodeMaterialBlockConnectionPointTypes.Float);
|
|
825
|
+
const outsideIOR = 1; // consider air as clear coat and other layers would remap in the shader.
|
|
826
|
+
const ior = this.indexOfRefraction.connectInputBlock?.value ?? 1.5;
|
|
827
|
+
// Based of the schlick fresnel approximation model
|
|
828
|
+
// for dielectrics.
|
|
829
|
+
const f0 = Math.pow((ior - outsideIOR) / (ior + outsideIOR), 2);
|
|
830
|
+
code += `${state._declareLocalVar("baseColor", NodeMaterialBlockConnectionPointTypes.Vector3)} = surfaceAlbedo;
|
|
761
831
|
${isWebGPU ? "let" : `vec4${state.fSuffix}`} vReflectivityColor = vec4${state.fSuffix}(${this.metallic.associatedVariableName}, ${this.roughness.associatedVariableName}, ${this.indexOfRefraction.associatedVariableName || "1.5"}, ${f0});
|
|
762
832
|
reflectivityOut = reflectivityBlock(
|
|
763
833
|
vReflectivityColor
|
|
@@ -792,593 +862,578 @@ export class PBRMetallicRoughnessBlock extends NodeMaterialBlock {
|
|
|
792
862
|
#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)
|
|
793
863
|
aoOut.ambientOcclusionColor = reflectivityOut.ambientOcclusionColor;
|
|
794
864
|
#endif\n`;
|
|
795
|
-
|
|
796
|
-
}
|
|
797
|
-
_buildBlock(state) {
|
|
798
|
-
super._buildBlock(state);
|
|
799
|
-
this._scene = state.sharedData.scene;
|
|
800
|
-
const isWebGPU = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;
|
|
801
|
-
if (!this._environmentBRDFTexture) {
|
|
802
|
-
this._environmentBRDFTexture = GetEnvironmentBRDFTexture(this._scene);
|
|
803
|
-
}
|
|
804
|
-
const reflectionBlock = this.reflection.isConnected ? this.reflection.connectedPoint?.ownerBlock : null;
|
|
805
|
-
if (reflectionBlock) {
|
|
806
|
-
// Need those variables to be setup when calling _injectVertexCode
|
|
807
|
-
reflectionBlock.worldPositionConnectionPoint = this.worldPosition;
|
|
808
|
-
reflectionBlock.cameraPositionConnectionPoint = this.cameraPosition;
|
|
809
|
-
reflectionBlock.worldNormalConnectionPoint = this.worldNormal;
|
|
810
|
-
reflectionBlock.viewConnectionPoint = this.view;
|
|
811
|
-
}
|
|
812
|
-
if (state.target !== NodeMaterialBlockTargets.Fragment) {
|
|
813
|
-
// Vertex
|
|
814
|
-
this._injectVertexCode(state);
|
|
815
|
-
return this;
|
|
816
|
-
}
|
|
817
|
-
// Fragment
|
|
818
|
-
state.sharedData.forcedBindableBlocks.push(this);
|
|
819
|
-
state.sharedData.blocksWithDefines.push(this);
|
|
820
|
-
state.sharedData.blockingBlocks.push(this);
|
|
821
|
-
if (this.generateOnlyFragmentCode) {
|
|
822
|
-
state.sharedData.dynamicUniformBlocks.push(this);
|
|
823
|
-
}
|
|
824
|
-
const comments = `//${this.name}`;
|
|
825
|
-
const normalShading = this.perturbedNormal;
|
|
826
|
-
let worldPosVarName = this.worldPosition.associatedVariableName;
|
|
827
|
-
let worldPosVarName4 = this.worldPosition.associatedVariableName;
|
|
828
|
-
let worldNormalVarName = this.worldNormal.associatedVariableName;
|
|
829
|
-
if (this.generateOnlyFragmentCode) {
|
|
830
|
-
worldPosVarName = state._getFreeVariableName("globalWorldPos");
|
|
831
|
-
state._emitFunction("pbr_globalworldpos", `${state._declareLocalVar(worldPosVarName, NodeMaterialBlockConnectionPointTypes.Vector3, false, true)};\n`, comments);
|
|
832
|
-
state.compilationString += `${worldPosVarName} = ${this.worldPosition.associatedVariableName}.xyz;\n`;
|
|
833
|
-
worldPosVarName4 = state._getFreeVariableName("globalWorldPos4");
|
|
834
|
-
state._emitFunction("pbr_globalworldpos4", `${state._declareLocalVar(worldPosVarName4, NodeMaterialBlockConnectionPointTypes.Vector4, false, true)};\n`, comments);
|
|
835
|
-
state.compilationString += `${worldPosVarName4} = ${this.worldPosition.associatedVariableName};\n`;
|
|
836
|
-
worldNormalVarName = state._getFreeVariableName("globalWorldNormal");
|
|
837
|
-
state._emitFunction("pbr_globalworldnorm", `${state._declareLocalVar(worldNormalVarName, NodeMaterialBlockConnectionPointTypes.Vector4, false, true)};\n`, comments);
|
|
838
|
-
state.compilationString += `${worldNormalVarName} = ${this.worldNormal.associatedVariableName};\n`;
|
|
839
|
-
state.compilationString += state._emitCodeFromInclude("shadowsVertex", comments, {
|
|
840
|
-
repeatKey: "maxSimultaneousLights",
|
|
841
|
-
substitutionVars: `worldPos,${this.worldPosition.associatedVariableName}`,
|
|
842
|
-
});
|
|
843
|
-
state.compilationString += `#if DEBUGMODE > 0\n`;
|
|
844
|
-
state.compilationString += `${state._declareLocalVar("vClipSpacePosition", NodeMaterialBlockConnectionPointTypes.Vector4)} = vec4${state.fSuffix}((vec2${state.fSuffix}(${isWebGPU ? "fragmentInputs.position" : "gl_FragCoord.xy"}) / vec2${state.fSuffix}(1.0)) * 2.0 - 1.0, 0.0, 1.0);\n`;
|
|
845
|
-
state.compilationString += `#endif\n`;
|
|
846
|
-
}
|
|
847
|
-
else {
|
|
848
|
-
worldPosVarName = (isWebGPU ? "input." : "") + "v_" + worldPosVarName;
|
|
849
|
-
worldNormalVarName = (isWebGPU ? "input." : "") + "v_" + worldNormalVarName;
|
|
850
|
-
}
|
|
851
|
-
this._environmentBrdfSamplerName = state._getFreeVariableName("environmentBrdfSampler");
|
|
852
|
-
state._emit2DSampler(this._environmentBrdfSamplerName);
|
|
853
|
-
state.sharedData.hints.needAlphaBlending = state.sharedData.hints.needAlphaBlending || this.useAlphaBlending;
|
|
854
|
-
state.sharedData.hints.needAlphaTesting = state.sharedData.hints.needAlphaTesting || this.useAlphaTest;
|
|
855
|
-
state._emitExtension("lod", "#extension GL_EXT_shader_texture_lod : enable", "defined(LODBASEDMICROSFURACE)");
|
|
856
|
-
state._emitExtension("derivatives", "#extension GL_OES_standard_derivatives : enable");
|
|
857
|
-
state._emitUniformFromString("vDebugMode", NodeMaterialBlockConnectionPointTypes.Vector2, "defined(IGNORE) || DEBUGMODE > 0");
|
|
858
|
-
state._emitUniformFromString("ambientFromScene", NodeMaterialBlockConnectionPointTypes.Vector3);
|
|
859
|
-
// Image processing uniforms
|
|
860
|
-
state.uniforms.push("exposureLinear");
|
|
861
|
-
state.uniforms.push("contrast");
|
|
862
|
-
state.uniforms.push("vInverseScreenSize");
|
|
863
|
-
state.uniforms.push("vignetteSettings1");
|
|
864
|
-
state.uniforms.push("vignetteSettings2");
|
|
865
|
-
state.uniforms.push("vCameraColorCurveNegative");
|
|
866
|
-
state.uniforms.push("vCameraColorCurveNeutral");
|
|
867
|
-
state.uniforms.push("vCameraColorCurvePositive");
|
|
868
|
-
state.uniforms.push("txColorTransform");
|
|
869
|
-
state.uniforms.push("colorTransformSettings");
|
|
870
|
-
state.uniforms.push("ditherIntensity");
|
|
871
|
-
//
|
|
872
|
-
// Includes
|
|
873
|
-
//
|
|
874
|
-
if (!this.light) {
|
|
875
|
-
if (this.generateOnlyFragmentCode && this.view.isConnected) {
|
|
876
|
-
state.compilationString += `${state._declareLocalVar("vViewDepth", NodeMaterialBlockConnectionPointTypes.Float)} = (${this.view.associatedVariableName} * ${worldPosVarName4}).z;\n`;
|
|
865
|
+
return code;
|
|
877
866
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
state._emitFunctionFromInclude("pbrDirectLightingFunctions", comments);
|
|
903
|
-
}
|
|
904
|
-
state._emitFunctionFromInclude("pbrIBLFunctions", comments);
|
|
905
|
-
state._emitFunctionFromInclude("pbrBlockAlbedoOpacity", comments);
|
|
906
|
-
state._emitFunctionFromInclude("pbrBlockReflectivity", comments);
|
|
907
|
-
state._emitFunctionFromInclude("pbrBlockAmbientOcclusion", comments);
|
|
908
|
-
state._emitFunctionFromInclude("pbrBlockAlphaFresnel", comments);
|
|
909
|
-
state._emitFunctionFromInclude("pbrBlockAnisotropic", comments);
|
|
910
|
-
//
|
|
911
|
-
// code
|
|
912
|
-
//
|
|
913
|
-
state._emitUniformFromString("vLightingIntensity", NodeMaterialBlockConnectionPointTypes.Vector4);
|
|
914
|
-
if (reflectionBlock?.generateOnlyFragmentCode) {
|
|
915
|
-
state.compilationString += reflectionBlock.handleVertexSide(state);
|
|
916
|
-
}
|
|
917
|
-
// _____________________________ Geometry Information ____________________________
|
|
918
|
-
this._vNormalWName = state._getFreeVariableName("vNormalW");
|
|
919
|
-
state.compilationString += `${state._declareLocalVar(this._vNormalWName, NodeMaterialBlockConnectionPointTypes.Vector4)} = normalize(${worldNormalVarName});\n`;
|
|
920
|
-
if (state._registerTempVariable("viewDirectionW")) {
|
|
921
|
-
state.compilationString += `${state._declareLocalVar("viewDirectionW", NodeMaterialBlockConnectionPointTypes.Vector3)} = normalize(${this.cameraPosition.associatedVariableName} - ${worldPosVarName}.xyz);\n`;
|
|
922
|
-
}
|
|
923
|
-
state.compilationString += `${state._declareLocalVar("geometricNormalW", NodeMaterialBlockConnectionPointTypes.Vector3)} = ${this._vNormalWName}.xyz;\n`;
|
|
924
|
-
state.compilationString += `${state._declareLocalVar("normalW", NodeMaterialBlockConnectionPointTypes.Vector3)} = ${normalShading.isConnected ? "normalize(" + normalShading.associatedVariableName + ".xyz)" : "geometricNormalW"};\n`;
|
|
925
|
-
this._invertNormalName = state._getFreeVariableName("invertNormal");
|
|
926
|
-
state._emitUniformFromString(this._invertNormalName, NodeMaterialBlockConnectionPointTypes.Float);
|
|
927
|
-
state.compilationString += state._emitCodeFromInclude("pbrBlockNormalFinal", comments, {
|
|
928
|
-
replaceStrings: [
|
|
929
|
-
{ search: /vPositionW/g, replace: worldPosVarName + ".xyz" },
|
|
930
|
-
{ search: /vEyePosition.w/g, replace: this._invertNormalName },
|
|
931
|
-
],
|
|
932
|
-
});
|
|
933
|
-
// _____________________________ Albedo & Opacity ______________________________
|
|
934
|
-
state.compilationString += this._getAlbedoOpacityCode(state);
|
|
935
|
-
state.compilationString += state._emitCodeFromInclude("depthPrePass", comments);
|
|
936
|
-
// _____________________________ AO _______________________________
|
|
937
|
-
state.compilationString += this._getAmbientOcclusionCode(state);
|
|
938
|
-
state.compilationString += state._emitCodeFromInclude("pbrBlockLightmapInit", comments);
|
|
939
|
-
// _____________________________ UNLIT _______________________________
|
|
940
|
-
state.compilationString += `#ifdef UNLIT
|
|
941
|
-
${state._declareLocalVar("diffuseBase", NodeMaterialBlockConnectionPointTypes.Vector3)} = vec3${state.fSuffix}(1., 1., 1.);
|
|
942
|
-
#else\n`;
|
|
943
|
-
// _____________________________ Reflectivity _______________________________
|
|
944
|
-
state.compilationString += this._getReflectivityCode(state);
|
|
945
|
-
// _____________________________ Geometry info _________________________________
|
|
946
|
-
state.compilationString += state._emitCodeFromInclude("pbrBlockGeometryInfo", comments, {
|
|
947
|
-
replaceStrings: [
|
|
948
|
-
{ search: /REFLECTIONMAP_SKYBOX/g, replace: reflectionBlock?._defineSkyboxName ?? "REFLECTIONMAP_SKYBOX" },
|
|
949
|
-
{ search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
|
|
950
|
-
],
|
|
951
|
-
});
|
|
952
|
-
// _____________________________ Anisotropy _______________________________________
|
|
953
|
-
const anisotropyBlock = this.anisotropy.isConnected ? this.anisotropy.connectedPoint?.ownerBlock : null;
|
|
954
|
-
if (anisotropyBlock) {
|
|
955
|
-
anisotropyBlock.worldPositionConnectionPoint = this.worldPosition;
|
|
956
|
-
anisotropyBlock.worldNormalConnectionPoint = this.worldNormal;
|
|
957
|
-
state.compilationString += anisotropyBlock.getCode(state, !this.perturbedNormal.isConnected);
|
|
958
|
-
}
|
|
959
|
-
// _____________________________ Reflection _______________________________________
|
|
960
|
-
if (reflectionBlock && reflectionBlock.hasTexture) {
|
|
961
|
-
state.compilationString += reflectionBlock.getCode(state, anisotropyBlock ? "anisotropicOut.anisotropicNormal" : "normalW");
|
|
962
|
-
}
|
|
963
|
-
state._emitFunctionFromInclude("pbrBlockReflection", comments, {
|
|
964
|
-
replaceStrings: [
|
|
965
|
-
{ search: /computeReflectionCoords/g, replace: "computeReflectionCoordsPBR" },
|
|
966
|
-
{ search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
|
|
967
|
-
{ search: /REFLECTIONMAP_OPPOSITEZ/g, replace: reflectionBlock?._defineOppositeZ ?? "REFLECTIONMAP_OPPOSITEZ" },
|
|
968
|
-
{ search: /REFLECTIONMAP_PROJECTION/g, replace: reflectionBlock?._defineProjectionName ?? "REFLECTIONMAP_PROJECTION" },
|
|
969
|
-
{ search: /REFLECTIONMAP_SKYBOX/g, replace: reflectionBlock?._defineSkyboxName ?? "REFLECTIONMAP_SKYBOX" },
|
|
970
|
-
{ search: /LODINREFLECTIONALPHA/g, replace: reflectionBlock?._defineLODReflectionAlpha ?? "LODINREFLECTIONALPHA" },
|
|
971
|
-
{ search: /LINEARSPECULARREFLECTION/g, replace: reflectionBlock?._defineLinearSpecularReflection ?? "LINEARSPECULARREFLECTION" },
|
|
972
|
-
{ search: /vReflectionFilteringInfo/g, replace: reflectionBlock?._vReflectionFilteringInfoName ?? "vReflectionFilteringInfo" },
|
|
973
|
-
],
|
|
974
|
-
});
|
|
975
|
-
// ___________________ Compute Reflectance aka R0 F0 info _________________________
|
|
976
|
-
state.compilationString += state._emitCodeFromInclude("pbrBlockReflectance0", comments, {
|
|
977
|
-
replaceStrings: [{ search: /metallicReflectanceFactors/g, replace: (isWebGPU ? "uniforms." : "") + this._vMetallicReflectanceFactorsName }],
|
|
978
|
-
});
|
|
979
|
-
// ________________________________ Sheen ______________________________
|
|
980
|
-
const sheenBlock = this.sheen.isConnected ? this.sheen.connectedPoint?.ownerBlock : null;
|
|
981
|
-
if (sheenBlock) {
|
|
982
|
-
state.compilationString += sheenBlock.getCode(reflectionBlock, state);
|
|
983
|
-
}
|
|
984
|
-
state._emitFunctionFromInclude("pbrBlockSheen", comments, {
|
|
985
|
-
replaceStrings: [
|
|
986
|
-
{ search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
|
|
987
|
-
{ search: /REFLECTIONMAP_SKYBOX/g, replace: reflectionBlock?._defineSkyboxName ?? "REFLECTIONMAP_SKYBOX" },
|
|
988
|
-
{ search: /LODINREFLECTIONALPHA/g, replace: reflectionBlock?._defineLODReflectionAlpha ?? "LODINREFLECTIONALPHA" },
|
|
989
|
-
{ search: /LINEARSPECULARREFLECTION/g, replace: reflectionBlock?._defineLinearSpecularReflection ?? "LINEARSPECULARREFLECTION" },
|
|
990
|
-
],
|
|
991
|
-
});
|
|
992
|
-
// ____________________ Clear Coat Initialization Code _____________________
|
|
993
|
-
const clearcoatBlock = this.clearcoat.isConnected ? this.clearcoat.connectedPoint?.ownerBlock : null;
|
|
994
|
-
state.compilationString += ClearCoatBlock._GetInitializationCode(state, clearcoatBlock);
|
|
995
|
-
// _____________________________ Iridescence _______________________________
|
|
996
|
-
const iridescenceBlock = this.iridescence.isConnected ? this.iridescence.connectedPoint?.ownerBlock : null;
|
|
997
|
-
state.compilationString += IridescenceBlock.GetCode(iridescenceBlock, state);
|
|
998
|
-
state._emitFunctionFromInclude("pbrBlockIridescence", comments, {
|
|
999
|
-
replaceStrings: [],
|
|
1000
|
-
});
|
|
1001
|
-
// _____________________________ Clear Coat ____________________________
|
|
1002
|
-
const generateTBNSpace = !this.perturbedNormal.isConnected && !this.anisotropy.isConnected;
|
|
1003
|
-
const isTangentConnectedToPerturbNormal = this.perturbedNormal.isConnected && (this.perturbedNormal.connectedPoint?.ownerBlock).worldTangent?.isConnected;
|
|
1004
|
-
const isTangentConnectedToAnisotropy = this.anisotropy.isConnected && (this.anisotropy.connectedPoint?.ownerBlock).worldTangent.isConnected;
|
|
1005
|
-
let vTBNAvailable = isTangentConnectedToPerturbNormal || (!this.perturbedNormal.isConnected && isTangentConnectedToAnisotropy);
|
|
1006
|
-
state.compilationString += ClearCoatBlock.GetCode(state, clearcoatBlock, reflectionBlock, worldPosVarName, generateTBNSpace, vTBNAvailable, worldNormalVarName);
|
|
1007
|
-
if (generateTBNSpace) {
|
|
1008
|
-
vTBNAvailable = clearcoatBlock?.worldTangent.isConnected ?? false;
|
|
1009
|
-
}
|
|
1010
|
-
state._emitFunctionFromInclude("pbrBlockClearcoat", comments, {
|
|
1011
|
-
replaceStrings: [
|
|
1012
|
-
{ search: /computeReflectionCoords/g, replace: "computeReflectionCoordsPBR" },
|
|
1013
|
-
{ search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
|
|
1014
|
-
{ search: /REFLECTIONMAP_OPPOSITEZ/g, replace: reflectionBlock?._defineOppositeZ ?? "REFLECTIONMAP_OPPOSITEZ" },
|
|
1015
|
-
{ search: /REFLECTIONMAP_PROJECTION/g, replace: reflectionBlock?._defineProjectionName ?? "REFLECTIONMAP_PROJECTION" },
|
|
1016
|
-
{ search: /REFLECTIONMAP_SKYBOX/g, replace: reflectionBlock?._defineSkyboxName ?? "REFLECTIONMAP_SKYBOX" },
|
|
1017
|
-
{ search: /LODINREFLECTIONALPHA/g, replace: reflectionBlock?._defineLODReflectionAlpha ?? "LODINREFLECTIONALPHA" },
|
|
1018
|
-
{ search: /LINEARSPECULARREFLECTION/g, replace: reflectionBlock?._defineLinearSpecularReflection ?? "LINEARSPECULARREFLECTION" },
|
|
1019
|
-
{ search: /defined\(TANGENT\)/g, replace: vTBNAvailable ? "defined(TANGENT)" : "defined(IGNORE)" },
|
|
1020
|
-
],
|
|
1021
|
-
});
|
|
1022
|
-
// _________________________ Specular Environment Reflectance __________________________
|
|
1023
|
-
state.compilationString += state._emitCodeFromInclude("pbrBlockReflectance", comments, {
|
|
1024
|
-
replaceStrings: [
|
|
1025
|
-
{ search: /REFLECTIONMAP_SKYBOX/g, replace: reflectionBlock?._defineSkyboxName ?? "REFLECTIONMAP_SKYBOX" },
|
|
1026
|
-
{ search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
|
|
1027
|
-
{ search: /uniforms\.vReflectivityColor/g, replace: "vReflectivityColor" },
|
|
1028
|
-
],
|
|
1029
|
-
});
|
|
1030
|
-
// ___________________________________ SubSurface ______________________________________
|
|
1031
|
-
const subsurfaceBlock = this.subsurface.isConnected ? this.subsurface.connectedPoint?.ownerBlock : null;
|
|
1032
|
-
const refractionBlock = this.subsurface.isConnected
|
|
1033
|
-
? (this.subsurface.connectedPoint?.ownerBlock).refraction.connectedPoint?.ownerBlock
|
|
1034
|
-
: null;
|
|
1035
|
-
if (refractionBlock) {
|
|
1036
|
-
refractionBlock.viewConnectionPoint = this.view;
|
|
1037
|
-
refractionBlock.indexOfRefractionConnectionPoint = this.indexOfRefraction;
|
|
1038
|
-
}
|
|
1039
|
-
state.compilationString += SubSurfaceBlock.GetCode(state, subsurfaceBlock, reflectionBlock, worldPosVarName);
|
|
1040
|
-
state._emitFunctionFromInclude("pbrBlockSubSurface", comments, {
|
|
1041
|
-
replaceStrings: [
|
|
1042
|
-
{ search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
|
|
1043
|
-
{ search: /REFLECTIONMAP_OPPOSITEZ/g, replace: reflectionBlock?._defineOppositeZ ?? "REFLECTIONMAP_OPPOSITEZ" },
|
|
1044
|
-
{ search: /REFLECTIONMAP_PROJECTION/g, replace: reflectionBlock?._defineProjectionName ?? "REFLECTIONMAP_PROJECTION" },
|
|
1045
|
-
{ search: /SS_REFRACTIONMAP_3D/g, replace: refractionBlock?._define3DName ?? "SS_REFRACTIONMAP_3D" },
|
|
1046
|
-
{ search: /SS_LODINREFRACTIONALPHA/g, replace: refractionBlock?._defineLODRefractionAlpha ?? "SS_LODINREFRACTIONALPHA" },
|
|
1047
|
-
{ search: /SS_LINEARSPECULARREFRACTION/g, replace: refractionBlock?._defineLinearSpecularRefraction ?? "SS_LINEARSPECULARREFRACTION" },
|
|
1048
|
-
{ search: /SS_REFRACTIONMAP_OPPOSITEZ/g, replace: refractionBlock?._defineOppositeZ ?? "SS_REFRACTIONMAP_OPPOSITEZ" },
|
|
1049
|
-
],
|
|
1050
|
-
});
|
|
1051
|
-
if (isWebGPU) {
|
|
1052
|
-
state._emitFunctionFromInclude("pbrDirectLightingFunctions", comments);
|
|
1053
|
-
}
|
|
1054
|
-
if (!isWebGPU) {
|
|
1055
|
-
// In WebGPU, those functions are part of pbrDirectLightingFunctions
|
|
1056
|
-
state._emitFunctionFromInclude("pbrClusteredLightingFunctions", comments);
|
|
1057
|
-
}
|
|
1058
|
-
// _____________________________ Direct Lighting Info __________________________________
|
|
1059
|
-
state.compilationString += state._emitCodeFromInclude("pbrBlockDirectLighting", comments);
|
|
1060
|
-
if (this.light) {
|
|
1061
|
-
state.compilationString += state._emitCodeFromInclude("lightFragment", comments, {
|
|
1062
|
-
replaceStrings: [
|
|
1063
|
-
{ search: /{X}/g, replace: this._lightId.toString() },
|
|
1064
|
-
{ search: new RegExp(`${isWebGPU ? "fragmentInputs." : ""}vPositionW`, "g"), replace: worldPosVarName + ".xyz" },
|
|
1065
|
-
{ search: /uniforms\.vReflectivityColor/g, replace: "vReflectivityColor" },
|
|
1066
|
-
],
|
|
1067
|
-
});
|
|
1068
|
-
}
|
|
1069
|
-
else {
|
|
1070
|
-
let substitutionVars = `vPositionW,${worldPosVarName}.xyz`;
|
|
1071
|
-
if (isWebGPU) {
|
|
1072
|
-
substitutionVars = "fragmentInputs." + substitutionVars;
|
|
867
|
+
_buildBlock(state) {
|
|
868
|
+
super._buildBlock(state);
|
|
869
|
+
this._scene = state.sharedData.scene;
|
|
870
|
+
const isWebGPU = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;
|
|
871
|
+
if (!this._environmentBRDFTexture) {
|
|
872
|
+
this._environmentBRDFTexture = GetEnvironmentBRDFTexture(this._scene);
|
|
873
|
+
}
|
|
874
|
+
const reflectionBlock = this.reflection.isConnected ? this.reflection.connectedPoint?.ownerBlock : null;
|
|
875
|
+
if (reflectionBlock) {
|
|
876
|
+
// Need those variables to be setup when calling _injectVertexCode
|
|
877
|
+
reflectionBlock.worldPositionConnectionPoint = this.worldPosition;
|
|
878
|
+
reflectionBlock.cameraPositionConnectionPoint = this.cameraPosition;
|
|
879
|
+
reflectionBlock.worldNormalConnectionPoint = this.worldNormal;
|
|
880
|
+
reflectionBlock.viewConnectionPoint = this.view;
|
|
881
|
+
}
|
|
882
|
+
if (state.target !== NodeMaterialBlockTargets.Fragment) {
|
|
883
|
+
// Vertex
|
|
884
|
+
this._injectVertexCode(state);
|
|
885
|
+
return this;
|
|
886
|
+
}
|
|
887
|
+
// Fragment
|
|
888
|
+
state.sharedData.forcedBindableBlocks.push(this);
|
|
889
|
+
state.sharedData.blocksWithDefines.push(this);
|
|
890
|
+
state.sharedData.blockingBlocks.push(this);
|
|
1073
891
|
if (this.generateOnlyFragmentCode) {
|
|
1074
|
-
|
|
892
|
+
state.sharedData.dynamicUniformBlocks.push(this);
|
|
1075
893
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
replaceStrings: replaceStrings,
|
|
1130
|
-
});
|
|
1131
|
-
// _____________________________ Generate end points ________________________
|
|
1132
|
-
for (const output of this._outputs) {
|
|
1133
|
-
if (output.hasEndpoints) {
|
|
1134
|
-
const remap = MapOutputToVariable[output.name];
|
|
1135
|
-
if (remap) {
|
|
1136
|
-
const [varName, conditions] = remap;
|
|
1137
|
-
if (conditions) {
|
|
1138
|
-
state.compilationString += `#if ${conditions}\n`;
|
|
894
|
+
const comments = `//${this.name}`;
|
|
895
|
+
const normalShading = this.perturbedNormal;
|
|
896
|
+
let worldPosVarName = this.worldPosition.associatedVariableName;
|
|
897
|
+
let worldPosVarName4 = this.worldPosition.associatedVariableName;
|
|
898
|
+
let worldNormalVarName = this.worldNormal.associatedVariableName;
|
|
899
|
+
if (this.generateOnlyFragmentCode) {
|
|
900
|
+
worldPosVarName = state._getFreeVariableName("globalWorldPos");
|
|
901
|
+
state._emitFunction("pbr_globalworldpos", `${state._declareLocalVar(worldPosVarName, NodeMaterialBlockConnectionPointTypes.Vector3, false, true)};\n`, comments);
|
|
902
|
+
state.compilationString += `${worldPosVarName} = ${this.worldPosition.associatedVariableName}.xyz;\n`;
|
|
903
|
+
worldPosVarName4 = state._getFreeVariableName("globalWorldPos4");
|
|
904
|
+
state._emitFunction("pbr_globalworldpos4", `${state._declareLocalVar(worldPosVarName4, NodeMaterialBlockConnectionPointTypes.Vector4, false, true)};\n`, comments);
|
|
905
|
+
state.compilationString += `${worldPosVarName4} = ${this.worldPosition.associatedVariableName};\n`;
|
|
906
|
+
worldNormalVarName = state._getFreeVariableName("globalWorldNormal");
|
|
907
|
+
state._emitFunction("pbr_globalworldnorm", `${state._declareLocalVar(worldNormalVarName, NodeMaterialBlockConnectionPointTypes.Vector4, false, true)};\n`, comments);
|
|
908
|
+
state.compilationString += `${worldNormalVarName} = ${this.worldNormal.associatedVariableName};\n`;
|
|
909
|
+
state.compilationString += state._emitCodeFromInclude("shadowsVertex", comments, {
|
|
910
|
+
repeatKey: "maxSimultaneousLights",
|
|
911
|
+
substitutionVars: `worldPos,${this.worldPosition.associatedVariableName}`,
|
|
912
|
+
});
|
|
913
|
+
state.compilationString += `#if DEBUGMODE > 0\n`;
|
|
914
|
+
state.compilationString += `${state._declareLocalVar("vClipSpacePosition", NodeMaterialBlockConnectionPointTypes.Vector4)} = vec4${state.fSuffix}((vec2${state.fSuffix}(${isWebGPU ? "fragmentInputs.position" : "gl_FragCoord.xy"}) / vec2${state.fSuffix}(1.0)) * 2.0 - 1.0, 0.0, 1.0);\n`;
|
|
915
|
+
state.compilationString += `#endif\n`;
|
|
916
|
+
}
|
|
917
|
+
else {
|
|
918
|
+
worldPosVarName = (isWebGPU ? "input." : "") + "v_" + worldPosVarName;
|
|
919
|
+
worldNormalVarName = (isWebGPU ? "input." : "") + "v_" + worldNormalVarName;
|
|
920
|
+
}
|
|
921
|
+
this._environmentBrdfSamplerName = state._getFreeVariableName("environmentBrdfSampler");
|
|
922
|
+
state._emit2DSampler(this._environmentBrdfSamplerName);
|
|
923
|
+
state.sharedData.hints.needAlphaBlending = state.sharedData.hints.needAlphaBlending || this.useAlphaBlending;
|
|
924
|
+
state.sharedData.hints.needAlphaTesting = state.sharedData.hints.needAlphaTesting || this.useAlphaTest;
|
|
925
|
+
state._emitExtension("lod", "#extension GL_EXT_shader_texture_lod : enable", "defined(LODBASEDMICROSFURACE)");
|
|
926
|
+
state._emitExtension("derivatives", "#extension GL_OES_standard_derivatives : enable");
|
|
927
|
+
state._emitUniformFromString("vDebugMode", NodeMaterialBlockConnectionPointTypes.Vector2, "defined(IGNORE) || DEBUGMODE > 0");
|
|
928
|
+
state._emitUniformFromString("ambientFromScene", NodeMaterialBlockConnectionPointTypes.Vector3);
|
|
929
|
+
// Image processing uniforms
|
|
930
|
+
state.uniforms.push("exposureLinear");
|
|
931
|
+
state.uniforms.push("contrast");
|
|
932
|
+
state.uniforms.push("vInverseScreenSize");
|
|
933
|
+
state.uniforms.push("vignetteSettings1");
|
|
934
|
+
state.uniforms.push("vignetteSettings2");
|
|
935
|
+
state.uniforms.push("vCameraColorCurveNegative");
|
|
936
|
+
state.uniforms.push("vCameraColorCurveNeutral");
|
|
937
|
+
state.uniforms.push("vCameraColorCurvePositive");
|
|
938
|
+
state.uniforms.push("txColorTransform");
|
|
939
|
+
state.uniforms.push("colorTransformSettings");
|
|
940
|
+
state.uniforms.push("ditherIntensity");
|
|
941
|
+
//
|
|
942
|
+
// Includes
|
|
943
|
+
//
|
|
944
|
+
if (!this.light) {
|
|
945
|
+
if (this.generateOnlyFragmentCode && this.view.isConnected) {
|
|
946
|
+
state.compilationString += `${state._declareLocalVar("vViewDepth", NodeMaterialBlockConnectionPointTypes.Float)} = (${this.view.associatedVariableName} * ${worldPosVarName4}).z;\n`;
|
|
1139
947
|
}
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
948
|
+
// Emit for all lights
|
|
949
|
+
state._emitFunctionFromInclude(state.supportUniformBuffers ? "lightUboDeclaration" : "lightFragmentDeclaration", comments, {
|
|
950
|
+
repeatKey: "maxSimultaneousLights",
|
|
951
|
+
substitutionVars: this.generateOnlyFragmentCode ? "varying," : undefined,
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
else {
|
|
955
|
+
state._emitFunctionFromInclude(state.supportUniformBuffers ? "lightUboDeclaration" : "lightFragmentDeclaration", comments, {
|
|
956
|
+
replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }],
|
|
957
|
+
}, this._lightId.toString());
|
|
958
|
+
}
|
|
959
|
+
state._emitFunctionFromInclude("helperFunctions", comments);
|
|
960
|
+
state._emitFunctionFromInclude("importanceSampling", comments);
|
|
961
|
+
state._emitFunctionFromInclude("pbrHelperFunctions", comments);
|
|
962
|
+
state._emitFunctionFromInclude("imageProcessingDeclaration", comments);
|
|
963
|
+
state._emitFunctionFromInclude("imageProcessingFunctions", comments);
|
|
964
|
+
state._emitFunctionFromInclude("shadowsFragmentFunctions", comments);
|
|
965
|
+
state._emitFunctionFromInclude("pbrDirectLightingSetupFunctions", comments);
|
|
966
|
+
state._emitFunctionFromInclude("pbrDirectLightingFalloffFunctions", comments);
|
|
967
|
+
state._emitFunctionFromInclude("pbrBRDFFunctions", comments, {
|
|
968
|
+
replaceStrings: [{ search: /REFLECTIONMAP_SKYBOX/g, replace: reflectionBlock?._defineSkyboxName ?? "REFLECTIONMAP_SKYBOX" }],
|
|
969
|
+
});
|
|
970
|
+
state._emitFunctionFromInclude("hdrFilteringFunctions", comments);
|
|
971
|
+
if (!isWebGPU) {
|
|
972
|
+
state._emitFunctionFromInclude("pbrDirectLightingFunctions", comments);
|
|
973
|
+
}
|
|
974
|
+
state._emitFunctionFromInclude("pbrIBLFunctions", comments);
|
|
975
|
+
state._emitFunctionFromInclude("pbrBlockAlbedoOpacity", comments);
|
|
976
|
+
state._emitFunctionFromInclude("pbrBlockReflectivity", comments);
|
|
977
|
+
state._emitFunctionFromInclude("pbrBlockAmbientOcclusion", comments);
|
|
978
|
+
state._emitFunctionFromInclude("pbrBlockAlphaFresnel", comments);
|
|
979
|
+
state._emitFunctionFromInclude("pbrBlockAnisotropic", comments);
|
|
980
|
+
//
|
|
981
|
+
// code
|
|
982
|
+
//
|
|
983
|
+
state._emitUniformFromString("vLightingIntensity", NodeMaterialBlockConnectionPointTypes.Vector4);
|
|
984
|
+
if (reflectionBlock?.generateOnlyFragmentCode) {
|
|
985
|
+
state.compilationString += reflectionBlock.handleVertexSide(state);
|
|
986
|
+
}
|
|
987
|
+
// _____________________________ Geometry Information ____________________________
|
|
988
|
+
this._vNormalWName = state._getFreeVariableName("vNormalW");
|
|
989
|
+
state.compilationString += `${state._declareLocalVar(this._vNormalWName, NodeMaterialBlockConnectionPointTypes.Vector4)} = normalize(${worldNormalVarName});\n`;
|
|
990
|
+
if (state._registerTempVariable("viewDirectionW")) {
|
|
991
|
+
state.compilationString += `${state._declareLocalVar("viewDirectionW", NodeMaterialBlockConnectionPointTypes.Vector3)} = normalize(${this.cameraPosition.associatedVariableName} - ${worldPosVarName}.xyz);\n`;
|
|
992
|
+
}
|
|
993
|
+
state.compilationString += `${state._declareLocalVar("geometricNormalW", NodeMaterialBlockConnectionPointTypes.Vector3)} = ${this._vNormalWName}.xyz;\n`;
|
|
994
|
+
state.compilationString += `${state._declareLocalVar("normalW", NodeMaterialBlockConnectionPointTypes.Vector3)} = ${normalShading.isConnected ? "normalize(" + normalShading.associatedVariableName + ".xyz)" : "geometricNormalW"};\n`;
|
|
995
|
+
this._invertNormalName = state._getFreeVariableName("invertNormal");
|
|
996
|
+
state._emitUniformFromString(this._invertNormalName, NodeMaterialBlockConnectionPointTypes.Float);
|
|
997
|
+
state.compilationString += state._emitCodeFromInclude("pbrBlockNormalFinal", comments, {
|
|
998
|
+
replaceStrings: [
|
|
999
|
+
{ search: /vPositionW/g, replace: worldPosVarName + ".xyz" },
|
|
1000
|
+
{ search: /vEyePosition.w/g, replace: this._invertNormalName },
|
|
1001
|
+
],
|
|
1002
|
+
});
|
|
1003
|
+
// _____________________________ Albedo & Opacity ______________________________
|
|
1004
|
+
state.compilationString += this._getAlbedoOpacityCode(state);
|
|
1005
|
+
state.compilationString += state._emitCodeFromInclude("depthPrePass", comments);
|
|
1006
|
+
// _____________________________ AO _______________________________
|
|
1007
|
+
state.compilationString += this._getAmbientOcclusionCode(state);
|
|
1008
|
+
state.compilationString += state._emitCodeFromInclude("pbrBlockLightmapInit", comments);
|
|
1009
|
+
// _____________________________ UNLIT _______________________________
|
|
1010
|
+
state.compilationString += `#ifdef UNLIT
|
|
1011
|
+
${state._declareLocalVar("diffuseBase", NodeMaterialBlockConnectionPointTypes.Vector3)} = vec3${state.fSuffix}(1., 1., 1.);
|
|
1012
|
+
#else\n`;
|
|
1013
|
+
// _____________________________ Reflectivity _______________________________
|
|
1014
|
+
state.compilationString += this._getReflectivityCode(state);
|
|
1015
|
+
// _____________________________ Geometry info _________________________________
|
|
1016
|
+
state.compilationString += state._emitCodeFromInclude("pbrBlockGeometryInfo", comments, {
|
|
1017
|
+
replaceStrings: [
|
|
1018
|
+
{ search: /REFLECTIONMAP_SKYBOX/g, replace: reflectionBlock?._defineSkyboxName ?? "REFLECTIONMAP_SKYBOX" },
|
|
1019
|
+
{ search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
|
|
1020
|
+
],
|
|
1021
|
+
});
|
|
1022
|
+
// _____________________________ Anisotropy _______________________________________
|
|
1023
|
+
const anisotropyBlock = this.anisotropy.isConnected ? this.anisotropy.connectedPoint?.ownerBlock : null;
|
|
1024
|
+
if (anisotropyBlock) {
|
|
1025
|
+
anisotropyBlock.worldPositionConnectionPoint = this.worldPosition;
|
|
1026
|
+
anisotropyBlock.worldNormalConnectionPoint = this.worldNormal;
|
|
1027
|
+
state.compilationString += anisotropyBlock.getCode(state, !this.perturbedNormal.isConnected);
|
|
1028
|
+
}
|
|
1029
|
+
// _____________________________ Reflection _______________________________________
|
|
1030
|
+
if (reflectionBlock && reflectionBlock.hasTexture) {
|
|
1031
|
+
state.compilationString += reflectionBlock.getCode(state, anisotropyBlock ? "anisotropicOut.anisotropicNormal" : "normalW");
|
|
1032
|
+
}
|
|
1033
|
+
state._emitFunctionFromInclude("pbrBlockReflection", comments, {
|
|
1034
|
+
replaceStrings: [
|
|
1035
|
+
{ search: /computeReflectionCoords/g, replace: "computeReflectionCoordsPBR" },
|
|
1036
|
+
{ search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
|
|
1037
|
+
{ search: /REFLECTIONMAP_OPPOSITEZ/g, replace: reflectionBlock?._defineOppositeZ ?? "REFLECTIONMAP_OPPOSITEZ" },
|
|
1038
|
+
{ search: /REFLECTIONMAP_PROJECTION/g, replace: reflectionBlock?._defineProjectionName ?? "REFLECTIONMAP_PROJECTION" },
|
|
1039
|
+
{ search: /REFLECTIONMAP_SKYBOX/g, replace: reflectionBlock?._defineSkyboxName ?? "REFLECTIONMAP_SKYBOX" },
|
|
1040
|
+
{ search: /LODINREFLECTIONALPHA/g, replace: reflectionBlock?._defineLODReflectionAlpha ?? "LODINREFLECTIONALPHA" },
|
|
1041
|
+
{ search: /LINEARSPECULARREFLECTION/g, replace: reflectionBlock?._defineLinearSpecularReflection ?? "LINEARSPECULARREFLECTION" },
|
|
1042
|
+
{ search: /vReflectionFilteringInfo/g, replace: reflectionBlock?._vReflectionFilteringInfoName ?? "vReflectionFilteringInfo" },
|
|
1043
|
+
],
|
|
1044
|
+
});
|
|
1045
|
+
// ___________________ Compute Reflectance aka R0 F0 info _________________________
|
|
1046
|
+
state.compilationString += state._emitCodeFromInclude("pbrBlockReflectance0", comments, {
|
|
1047
|
+
replaceStrings: [{ search: /metallicReflectanceFactors/g, replace: (isWebGPU ? "uniforms." : "") + this._vMetallicReflectanceFactorsName }],
|
|
1048
|
+
});
|
|
1049
|
+
// ________________________________ Sheen ______________________________
|
|
1050
|
+
const sheenBlock = this.sheen.isConnected ? this.sheen.connectedPoint?.ownerBlock : null;
|
|
1051
|
+
if (sheenBlock) {
|
|
1052
|
+
state.compilationString += sheenBlock.getCode(reflectionBlock, state);
|
|
1053
|
+
}
|
|
1054
|
+
state._emitFunctionFromInclude("pbrBlockSheen", comments, {
|
|
1055
|
+
replaceStrings: [
|
|
1056
|
+
{ search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
|
|
1057
|
+
{ search: /REFLECTIONMAP_SKYBOX/g, replace: reflectionBlock?._defineSkyboxName ?? "REFLECTIONMAP_SKYBOX" },
|
|
1058
|
+
{ search: /LODINREFLECTIONALPHA/g, replace: reflectionBlock?._defineLODReflectionAlpha ?? "LODINREFLECTIONALPHA" },
|
|
1059
|
+
{ search: /LINEARSPECULARREFLECTION/g, replace: reflectionBlock?._defineLinearSpecularReflection ?? "LINEARSPECULARREFLECTION" },
|
|
1060
|
+
],
|
|
1061
|
+
});
|
|
1062
|
+
// ____________________ Clear Coat Initialization Code _____________________
|
|
1063
|
+
const clearcoatBlock = this.clearcoat.isConnected ? this.clearcoat.connectedPoint?.ownerBlock : null;
|
|
1064
|
+
state.compilationString += ClearCoatBlock._GetInitializationCode(state, clearcoatBlock);
|
|
1065
|
+
// _____________________________ Iridescence _______________________________
|
|
1066
|
+
const iridescenceBlock = this.iridescence.isConnected ? this.iridescence.connectedPoint?.ownerBlock : null;
|
|
1067
|
+
state.compilationString += IridescenceBlock.GetCode(iridescenceBlock, state);
|
|
1068
|
+
state._emitFunctionFromInclude("pbrBlockIridescence", comments, {
|
|
1069
|
+
replaceStrings: [],
|
|
1070
|
+
});
|
|
1071
|
+
// _____________________________ Clear Coat ____________________________
|
|
1072
|
+
const generateTBNSpace = !this.perturbedNormal.isConnected && !this.anisotropy.isConnected;
|
|
1073
|
+
const isTangentConnectedToPerturbNormal = this.perturbedNormal.isConnected && (this.perturbedNormal.connectedPoint?.ownerBlock).worldTangent?.isConnected;
|
|
1074
|
+
const isTangentConnectedToAnisotropy = this.anisotropy.isConnected && (this.anisotropy.connectedPoint?.ownerBlock).worldTangent.isConnected;
|
|
1075
|
+
let vTBNAvailable = isTangentConnectedToPerturbNormal || (!this.perturbedNormal.isConnected && isTangentConnectedToAnisotropy);
|
|
1076
|
+
state.compilationString += ClearCoatBlock.GetCode(state, clearcoatBlock, reflectionBlock, worldPosVarName, generateTBNSpace, vTBNAvailable, worldNormalVarName);
|
|
1077
|
+
if (generateTBNSpace) {
|
|
1078
|
+
vTBNAvailable = clearcoatBlock?.worldTangent.isConnected ?? false;
|
|
1079
|
+
}
|
|
1080
|
+
state._emitFunctionFromInclude("pbrBlockClearcoat", comments, {
|
|
1081
|
+
replaceStrings: [
|
|
1082
|
+
{ search: /computeReflectionCoords/g, replace: "computeReflectionCoordsPBR" },
|
|
1083
|
+
{ search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
|
|
1084
|
+
{ search: /REFLECTIONMAP_OPPOSITEZ/g, replace: reflectionBlock?._defineOppositeZ ?? "REFLECTIONMAP_OPPOSITEZ" },
|
|
1085
|
+
{ search: /REFLECTIONMAP_PROJECTION/g, replace: reflectionBlock?._defineProjectionName ?? "REFLECTIONMAP_PROJECTION" },
|
|
1086
|
+
{ search: /REFLECTIONMAP_SKYBOX/g, replace: reflectionBlock?._defineSkyboxName ?? "REFLECTIONMAP_SKYBOX" },
|
|
1087
|
+
{ search: /LODINREFLECTIONALPHA/g, replace: reflectionBlock?._defineLODReflectionAlpha ?? "LODINREFLECTIONALPHA" },
|
|
1088
|
+
{ search: /LINEARSPECULARREFLECTION/g, replace: reflectionBlock?._defineLinearSpecularReflection ?? "LINEARSPECULARREFLECTION" },
|
|
1089
|
+
{ search: /defined\(TANGENT\)/g, replace: vTBNAvailable ? "defined(TANGENT)" : "defined(IGNORE)" },
|
|
1090
|
+
],
|
|
1091
|
+
});
|
|
1092
|
+
// _________________________ Specular Environment Reflectance __________________________
|
|
1093
|
+
state.compilationString += state._emitCodeFromInclude("pbrBlockReflectance", comments, {
|
|
1094
|
+
replaceStrings: [
|
|
1095
|
+
{ search: /REFLECTIONMAP_SKYBOX/g, replace: reflectionBlock?._defineSkyboxName ?? "REFLECTIONMAP_SKYBOX" },
|
|
1096
|
+
{ search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
|
|
1097
|
+
{ search: /uniforms\.vReflectivityColor/g, replace: "vReflectivityColor" },
|
|
1098
|
+
],
|
|
1099
|
+
});
|
|
1100
|
+
// ___________________________________ SubSurface ______________________________________
|
|
1101
|
+
const subsurfaceBlock = this.subsurface.isConnected ? this.subsurface.connectedPoint?.ownerBlock : null;
|
|
1102
|
+
const refractionBlock = this.subsurface.isConnected
|
|
1103
|
+
? (this.subsurface.connectedPoint?.ownerBlock).refraction.connectedPoint?.ownerBlock
|
|
1104
|
+
: null;
|
|
1105
|
+
if (refractionBlock) {
|
|
1106
|
+
refractionBlock.viewConnectionPoint = this.view;
|
|
1107
|
+
refractionBlock.indexOfRefractionConnectionPoint = this.indexOfRefraction;
|
|
1108
|
+
}
|
|
1109
|
+
state.compilationString += SubSurfaceBlock.GetCode(state, subsurfaceBlock, reflectionBlock, worldPosVarName);
|
|
1110
|
+
state._emitFunctionFromInclude("pbrBlockSubSurface", comments, {
|
|
1111
|
+
replaceStrings: [
|
|
1112
|
+
{ search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
|
|
1113
|
+
{ search: /REFLECTIONMAP_OPPOSITEZ/g, replace: reflectionBlock?._defineOppositeZ ?? "REFLECTIONMAP_OPPOSITEZ" },
|
|
1114
|
+
{ search: /REFLECTIONMAP_PROJECTION/g, replace: reflectionBlock?._defineProjectionName ?? "REFLECTIONMAP_PROJECTION" },
|
|
1115
|
+
{ search: /SS_REFRACTIONMAP_3D/g, replace: refractionBlock?._define3DName ?? "SS_REFRACTIONMAP_3D" },
|
|
1116
|
+
{ search: /SS_LODINREFRACTIONALPHA/g, replace: refractionBlock?._defineLODRefractionAlpha ?? "SS_LODINREFRACTIONALPHA" },
|
|
1117
|
+
{ search: /SS_LINEARSPECULARREFRACTION/g, replace: refractionBlock?._defineLinearSpecularRefraction ?? "SS_LINEARSPECULARREFRACTION" },
|
|
1118
|
+
{ search: /SS_REFRACTIONMAP_OPPOSITEZ/g, replace: refractionBlock?._defineOppositeZ ?? "SS_REFRACTIONMAP_OPPOSITEZ" },
|
|
1119
|
+
],
|
|
1120
|
+
});
|
|
1121
|
+
if (isWebGPU) {
|
|
1122
|
+
state._emitFunctionFromInclude("pbrDirectLightingFunctions", comments);
|
|
1123
|
+
}
|
|
1124
|
+
if (!isWebGPU) {
|
|
1125
|
+
// In WebGPU, those functions are part of pbrDirectLightingFunctions
|
|
1126
|
+
state._emitFunctionFromInclude("pbrClusteredLightingFunctions", comments);
|
|
1127
|
+
}
|
|
1128
|
+
// _____________________________ Direct Lighting Info __________________________________
|
|
1129
|
+
state.compilationString += state._emitCodeFromInclude("pbrBlockDirectLighting", comments);
|
|
1130
|
+
if (this.light) {
|
|
1131
|
+
state.compilationString += state._emitCodeFromInclude("lightFragment", comments, {
|
|
1132
|
+
replaceStrings: [
|
|
1133
|
+
{ search: /{X}/g, replace: this._lightId.toString() },
|
|
1134
|
+
{ search: new RegExp(`${isWebGPU ? "fragmentInputs." : ""}vPositionW`, "g"), replace: worldPosVarName + ".xyz" },
|
|
1135
|
+
{ search: /uniforms\.vReflectivityColor/g, replace: "vReflectivityColor" },
|
|
1136
|
+
],
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
else {
|
|
1140
|
+
let substitutionVars = `vPositionW,${worldPosVarName}.xyz`;
|
|
1141
|
+
if (isWebGPU) {
|
|
1142
|
+
substitutionVars = "fragmentInputs." + substitutionVars;
|
|
1143
|
+
if (this.generateOnlyFragmentCode) {
|
|
1144
|
+
substitutionVars += `,fragmentInputs.vViewDepth,vViewDepth`;
|
|
1145
|
+
}
|
|
1145
1146
|
}
|
|
1147
|
+
state.compilationString += state._emitCodeFromInclude("lightFragment", comments, {
|
|
1148
|
+
repeatKey: "maxSimultaneousLights",
|
|
1149
|
+
substitutionVars: substitutionVars + ",uniforms.vReflectivityColor,vReflectivityColor",
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
// _____________________________ Compute Final Lit Components ________________________
|
|
1153
|
+
state.compilationString += state._emitCodeFromInclude("pbrBlockFinalLitComponents", comments);
|
|
1154
|
+
// _____________________________ UNLIT (2) ________________________
|
|
1155
|
+
state.compilationString += `#endif\n`; // UNLIT
|
|
1156
|
+
// _____________________________ Compute Final Unlit Components ________________________
|
|
1157
|
+
const aoColor = this.ambientColor.isConnected ? this.ambientColor.associatedVariableName : `vec3${state.fSuffix}(0., 0., 0.)`;
|
|
1158
|
+
let aoDirectLightIntensity = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS.toString();
|
|
1159
|
+
if (aoDirectLightIntensity.indexOf(".") === -1) {
|
|
1160
|
+
aoDirectLightIntensity += ".";
|
|
1161
|
+
}
|
|
1162
|
+
let replaceStrings = [
|
|
1163
|
+
{ search: /vec3 finalEmissive[\s\S]*?finalEmissive\*=vLightingIntensity\.y;/g, replace: "" },
|
|
1164
|
+
{ search: new RegExp(`${isWebGPU ? "uniforms." : ""}vAmbientColor`, "g"), replace: aoColor + ` * ${isWebGPU ? "uniforms." : ""}ambientFromScene` },
|
|
1165
|
+
{ search: new RegExp(`${isWebGPU ? "uniforms." : ""}vAmbientInfos.w`, "g"), replace: aoDirectLightIntensity },
|
|
1166
|
+
];
|
|
1167
|
+
if (isWebGPU) {
|
|
1168
|
+
replaceStrings[0] = { search: /var finalEmissive[\s\S]*?finalEmissive\*=uniforms.vLightingIntensity\.y;/g, replace: "" };
|
|
1169
|
+
}
|
|
1170
|
+
state.compilationString += state._emitCodeFromInclude("pbrBlockFinalUnlitComponents", comments, {
|
|
1171
|
+
replaceStrings: replaceStrings,
|
|
1172
|
+
});
|
|
1173
|
+
// _____________________________ Output Final Color Composition ________________________
|
|
1174
|
+
state.compilationString += state._emitCodeFromInclude("pbrBlockFinalColorComposition", comments, {
|
|
1175
|
+
replaceStrings: [{ search: /finalEmissive/g, replace: `vec3${state.fSuffix}(0.)` }],
|
|
1176
|
+
});
|
|
1177
|
+
// _____________________________ Apply image processing ________________________
|
|
1178
|
+
if (isWebGPU) {
|
|
1179
|
+
replaceStrings = [{ search: /mesh.visibility/g, replace: "1." }];
|
|
1146
1180
|
}
|
|
1147
1181
|
else {
|
|
1148
|
-
|
|
1182
|
+
replaceStrings = [{ search: /visibility/g, replace: "1." }];
|
|
1183
|
+
}
|
|
1184
|
+
state.compilationString += state._emitCodeFromInclude("pbrBlockImageProcessing", comments, {
|
|
1185
|
+
replaceStrings: replaceStrings,
|
|
1186
|
+
});
|
|
1187
|
+
// _____________________________ Generate debug code ________________________
|
|
1188
|
+
const colorOutput = isWebGPU ? "fragmentOutputs.color" : "gl_FragColor";
|
|
1189
|
+
replaceStrings = [
|
|
1190
|
+
{ search: new RegExp(`${isWebGPU ? "fragmentInputs." : ""}vNormalW`, "g"), replace: this._vNormalWName },
|
|
1191
|
+
{ search: new RegExp(`${isWebGPU ? "fragmentInputs." : ""}vPositionW`, "g"), replace: worldPosVarName },
|
|
1192
|
+
{ search: /uniforms\.vReflectivityColor/g, replace: "vReflectivityColor" },
|
|
1193
|
+
{
|
|
1194
|
+
search: /albedoTexture\.rgb;/g,
|
|
1195
|
+
replace: `vec3${state.fSuffix}(1.);\n${colorOutput}.rgb = toGammaSpace(${colorOutput}.rgb);\n`,
|
|
1196
|
+
},
|
|
1197
|
+
];
|
|
1198
|
+
state.compilationString += state._emitCodeFromInclude("pbrDebug", comments, {
|
|
1199
|
+
replaceStrings: replaceStrings,
|
|
1200
|
+
});
|
|
1201
|
+
// _____________________________ Generate end points ________________________
|
|
1202
|
+
for (const output of this._outputs) {
|
|
1203
|
+
if (output.hasEndpoints) {
|
|
1204
|
+
const remap = MapOutputToVariable[output.name];
|
|
1205
|
+
if (remap) {
|
|
1206
|
+
const [varName, conditions] = remap;
|
|
1207
|
+
if (conditions) {
|
|
1208
|
+
state.compilationString += `#if ${conditions}\n`;
|
|
1209
|
+
}
|
|
1210
|
+
state.compilationString += `${state._declareOutput(output)} = ${varName};\n`;
|
|
1211
|
+
if (conditions) {
|
|
1212
|
+
state.compilationString += `#else\n`;
|
|
1213
|
+
state.compilationString += `${state._declareOutput(output)} = vec3${state.fSuffix}(0.);\n`;
|
|
1214
|
+
state.compilationString += `#endif\n`;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
else {
|
|
1218
|
+
state.sharedData.raiseBuildError(`There's no remapping for the ${output.name} end point! No code generated`);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1149
1221
|
}
|
|
1222
|
+
return this;
|
|
1150
1223
|
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
],
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
]
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
]
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
{
|
|
1341
|
-
{
|
|
1342
|
-
{
|
|
1343
|
-
|
|
1344
|
-
{
|
|
1345
|
-
{
|
|
1346
|
-
{
|
|
1347
|
-
{
|
|
1348
|
-
{
|
|
1349
|
-
|
|
1350
|
-
{
|
|
1351
|
-
{
|
|
1352
|
-
{
|
|
1353
|
-
{
|
|
1354
|
-
{
|
|
1355
|
-
{
|
|
1356
|
-
{
|
|
1357
|
-
{
|
|
1358
|
-
{
|
|
1359
|
-
{
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
{ label: "EHO", value: 81 },
|
|
1365
|
-
{ label: "Energy Factor", value: 82 },
|
|
1366
|
-
{ label: "Specular Reflectance", value: 83 },
|
|
1367
|
-
{ label: "Clear Coat Reflectance", value: 84 },
|
|
1368
|
-
{ label: "Sheen Reflectance", value: 85 },
|
|
1369
|
-
{ label: "Luminance Over Alpha", value: 86 },
|
|
1370
|
-
{ label: "Alpha", value: 87 },
|
|
1371
|
-
{ label: "Albedo color", value: 88 },
|
|
1372
|
-
{ label: "Ambient occlusion color", value: 89 },
|
|
1373
|
-
],
|
|
1374
|
-
})
|
|
1375
|
-
], PBRMetallicRoughnessBlock.prototype, "debugMode", void 0);
|
|
1376
|
-
__decorate([
|
|
1377
|
-
editableInPropertyPage("Split position", 1 /* PropertyTypeForEdition.Float */, "DEBUG", { min: -1, max: 1, notifiers: { update: true } })
|
|
1378
|
-
], PBRMetallicRoughnessBlock.prototype, "debugLimit", void 0);
|
|
1379
|
-
__decorate([
|
|
1380
|
-
editableInPropertyPage("Output factor", 1 /* PropertyTypeForEdition.Float */, "DEBUG", { min: 0, max: 5, notifiers: { update: true } })
|
|
1381
|
-
], PBRMetallicRoughnessBlock.prototype, "debugFactor", void 0);
|
|
1224
|
+
_dumpPropertiesCode() {
|
|
1225
|
+
let codeString = super._dumpPropertiesCode();
|
|
1226
|
+
codeString += `${this._codeVariableName}.lightFalloff = ${this.lightFalloff};\n`;
|
|
1227
|
+
codeString += `${this._codeVariableName}.useAlphaTest = ${this.useAlphaTest};\n`;
|
|
1228
|
+
codeString += `${this._codeVariableName}.alphaTestCutoff = ${this.alphaTestCutoff};\n`;
|
|
1229
|
+
codeString += `${this._codeVariableName}.useAlphaBlending = ${this.useAlphaBlending};\n`;
|
|
1230
|
+
codeString += `${this._codeVariableName}.useRadianceOverAlpha = ${this.useRadianceOverAlpha};\n`;
|
|
1231
|
+
codeString += `${this._codeVariableName}.useSpecularOverAlpha = ${this.useSpecularOverAlpha};\n`;
|
|
1232
|
+
codeString += `${this._codeVariableName}.enableSpecularAntiAliasing = ${this.enableSpecularAntiAliasing};\n`;
|
|
1233
|
+
codeString += `${this._codeVariableName}.realTimeFiltering = ${this.realTimeFiltering};\n`;
|
|
1234
|
+
codeString += `${this._codeVariableName}.realTimeFilteringQuality = ${this.realTimeFilteringQuality};\n`;
|
|
1235
|
+
codeString += `${this._codeVariableName}.useEnergyConservation = ${this.useEnergyConservation};\n`;
|
|
1236
|
+
codeString += `${this._codeVariableName}.useRadianceOcclusion = ${this.useRadianceOcclusion};\n`;
|
|
1237
|
+
codeString += `${this._codeVariableName}.useHorizonOcclusion = ${this.useHorizonOcclusion};\n`;
|
|
1238
|
+
codeString += `${this._codeVariableName}.unlit = ${this.unlit};\n`;
|
|
1239
|
+
codeString += `${this._codeVariableName}.forceNormalForward = ${this.forceNormalForward};\n`;
|
|
1240
|
+
codeString += `${this._codeVariableName}.debugMode = ${this.debugMode};\n`;
|
|
1241
|
+
codeString += `${this._codeVariableName}.debugLimit = ${this.debugLimit};\n`;
|
|
1242
|
+
codeString += `${this._codeVariableName}.debugFactor = ${this.debugFactor};\n`;
|
|
1243
|
+
return codeString;
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* Serializes the block
|
|
1247
|
+
* @returns the serialized object
|
|
1248
|
+
*/
|
|
1249
|
+
serialize() {
|
|
1250
|
+
const serializationObject = super.serialize();
|
|
1251
|
+
if (this.light) {
|
|
1252
|
+
serializationObject.lightId = this.light.id;
|
|
1253
|
+
}
|
|
1254
|
+
serializationObject.lightFalloff = this.lightFalloff;
|
|
1255
|
+
serializationObject.useAlphaTest = this.useAlphaTest;
|
|
1256
|
+
serializationObject.alphaTestCutoff = this.alphaTestCutoff;
|
|
1257
|
+
serializationObject.useAlphaBlending = this.useAlphaBlending;
|
|
1258
|
+
serializationObject.useRadianceOverAlpha = this.useRadianceOverAlpha;
|
|
1259
|
+
serializationObject.useSpecularOverAlpha = this.useSpecularOverAlpha;
|
|
1260
|
+
serializationObject.enableSpecularAntiAliasing = this.enableSpecularAntiAliasing;
|
|
1261
|
+
serializationObject.realTimeFiltering = this.realTimeFiltering;
|
|
1262
|
+
serializationObject.realTimeFilteringQuality = this.realTimeFilteringQuality;
|
|
1263
|
+
serializationObject.useEnergyConservation = this.useEnergyConservation;
|
|
1264
|
+
serializationObject.useRadianceOcclusion = this.useRadianceOcclusion;
|
|
1265
|
+
serializationObject.useHorizonOcclusion = this.useHorizonOcclusion;
|
|
1266
|
+
serializationObject.unlit = this.unlit;
|
|
1267
|
+
serializationObject.forceNormalForward = this.forceNormalForward;
|
|
1268
|
+
serializationObject.debugMode = this.debugMode;
|
|
1269
|
+
serializationObject.debugLimit = this.debugLimit;
|
|
1270
|
+
serializationObject.debugFactor = this.debugFactor;
|
|
1271
|
+
serializationObject.generateOnlyFragmentCode = this.generateOnlyFragmentCode;
|
|
1272
|
+
return serializationObject;
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Deserializes the block
|
|
1276
|
+
* @param serializationObject - the object to deserialize from
|
|
1277
|
+
* @param scene - the scene to deserialize in
|
|
1278
|
+
* @param rootUrl - the root URL for assets
|
|
1279
|
+
*/
|
|
1280
|
+
_deserialize(serializationObject, scene, rootUrl) {
|
|
1281
|
+
super._deserialize(serializationObject, scene, rootUrl);
|
|
1282
|
+
if (serializationObject.lightId) {
|
|
1283
|
+
this.light = scene.getLightById(serializationObject.lightId);
|
|
1284
|
+
}
|
|
1285
|
+
this.lightFalloff = serializationObject.lightFalloff ?? 0;
|
|
1286
|
+
this.useAlphaTest = serializationObject.useAlphaTest;
|
|
1287
|
+
this.alphaTestCutoff = serializationObject.alphaTestCutoff;
|
|
1288
|
+
this.useAlphaBlending = serializationObject.useAlphaBlending;
|
|
1289
|
+
this.useRadianceOverAlpha = serializationObject.useRadianceOverAlpha;
|
|
1290
|
+
this.useSpecularOverAlpha = serializationObject.useSpecularOverAlpha;
|
|
1291
|
+
this.enableSpecularAntiAliasing = serializationObject.enableSpecularAntiAliasing;
|
|
1292
|
+
this.realTimeFiltering = !!serializationObject.realTimeFiltering;
|
|
1293
|
+
this.realTimeFilteringQuality = serializationObject.realTimeFilteringQuality ?? 8;
|
|
1294
|
+
this.useEnergyConservation = serializationObject.useEnergyConservation;
|
|
1295
|
+
this.useRadianceOcclusion = serializationObject.useRadianceOcclusion;
|
|
1296
|
+
this.useHorizonOcclusion = serializationObject.useHorizonOcclusion;
|
|
1297
|
+
this.unlit = serializationObject.unlit;
|
|
1298
|
+
this.forceNormalForward = !!serializationObject.forceNormalForward;
|
|
1299
|
+
this.debugMode = serializationObject.debugMode;
|
|
1300
|
+
this.debugLimit = serializationObject.debugLimit;
|
|
1301
|
+
this.debugFactor = serializationObject.debugFactor;
|
|
1302
|
+
this.generateOnlyFragmentCode = !!serializationObject.generateOnlyFragmentCode;
|
|
1303
|
+
this._setTarget();
|
|
1304
|
+
}
|
|
1305
|
+
},
|
|
1306
|
+
(() => {
|
|
1307
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1308
|
+
_directIntensity_decorators = [editableInPropertyPage("Direct lights", 1 /* PropertyTypeForEdition.Float */, "INTENSITY", { min: 0, max: 1, notifiers: { update: true } })];
|
|
1309
|
+
_environmentIntensity_decorators = [editableInPropertyPage("Environment lights", 1 /* PropertyTypeForEdition.Float */, "INTENSITY", { min: 0, max: 1, notifiers: { update: true } })];
|
|
1310
|
+
_specularIntensity_decorators = [editableInPropertyPage("Specular highlights", 1 /* PropertyTypeForEdition.Float */, "INTENSITY", { min: 0, max: 1, notifiers: { update: true } })];
|
|
1311
|
+
_lightFalloff_decorators = [editableInPropertyPage("Light falloff", 5 /* PropertyTypeForEdition.List */, "LIGHTING & COLORS", {
|
|
1312
|
+
notifiers: { update: true },
|
|
1313
|
+
options: [
|
|
1314
|
+
{ label: "Physical", value: PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL },
|
|
1315
|
+
{ label: "GLTF", value: PBRBaseMaterial.LIGHTFALLOFF_GLTF },
|
|
1316
|
+
{ label: "Standard", value: PBRBaseMaterial.LIGHTFALLOFF_STANDARD },
|
|
1317
|
+
],
|
|
1318
|
+
})];
|
|
1319
|
+
_useAlphaTest_decorators = [editableInPropertyPage("Alpha Testing", 0 /* PropertyTypeForEdition.Boolean */, "OPACITY")];
|
|
1320
|
+
_alphaTestCutoff_decorators = [editableInPropertyPage("Alpha CutOff", 1 /* PropertyTypeForEdition.Float */, "OPACITY", { min: 0, max: 1, notifiers: { update: true } })];
|
|
1321
|
+
_useAlphaBlending_decorators = [editableInPropertyPage("Alpha blending", 0 /* PropertyTypeForEdition.Boolean */, "OPACITY")];
|
|
1322
|
+
_useRadianceOverAlpha_decorators = [editableInPropertyPage("Radiance over alpha", 0 /* PropertyTypeForEdition.Boolean */, "RENDERING", { notifiers: { update: true } })];
|
|
1323
|
+
_useSpecularOverAlpha_decorators = [editableInPropertyPage("Specular over alpha", 0 /* PropertyTypeForEdition.Boolean */, "RENDERING", { notifiers: { update: true } })];
|
|
1324
|
+
_enableSpecularAntiAliasing_decorators = [editableInPropertyPage("Specular anti-aliasing", 0 /* PropertyTypeForEdition.Boolean */, "RENDERING", { notifiers: { update: true } })];
|
|
1325
|
+
_realTimeFiltering_decorators = [editableInPropertyPage("Realtime filtering", 0 /* PropertyTypeForEdition.Boolean */, "RENDERING", { notifiers: { update: true } })];
|
|
1326
|
+
_realTimeFilteringQuality_decorators = [editableInPropertyPage("Realtime filtering quality", 5 /* PropertyTypeForEdition.List */, "RENDERING", {
|
|
1327
|
+
notifiers: { update: true },
|
|
1328
|
+
options: [
|
|
1329
|
+
{ label: "Low", value: 8 },
|
|
1330
|
+
{ label: "Medium", value: 16 },
|
|
1331
|
+
{ label: "High", value: 64 },
|
|
1332
|
+
],
|
|
1333
|
+
})];
|
|
1334
|
+
_baseDiffuseModel_decorators = [editableInPropertyPage("Diffuse Model", 5 /* PropertyTypeForEdition.List */, "RENDERING", {
|
|
1335
|
+
notifiers: { update: true },
|
|
1336
|
+
options: [
|
|
1337
|
+
{ label: "Lambert", value: 2 },
|
|
1338
|
+
{ label: "Burley", value: 1 },
|
|
1339
|
+
{ label: "Oren-Nayar", value: 0 },
|
|
1340
|
+
{ label: "Legacy", value: 3 },
|
|
1341
|
+
],
|
|
1342
|
+
})];
|
|
1343
|
+
_useEnergyConservation_decorators = [editableInPropertyPage("Energy Conservation", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { notifiers: { update: true } })];
|
|
1344
|
+
_useRadianceOcclusion_decorators = [editableInPropertyPage("Radiance occlusion", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { notifiers: { update: true } })];
|
|
1345
|
+
_useHorizonOcclusion_decorators = [editableInPropertyPage("Horizon occlusion", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { notifiers: { update: true } })];
|
|
1346
|
+
_unlit_decorators = [editableInPropertyPage("Unlit", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { notifiers: { update: true } })];
|
|
1347
|
+
_forceNormalForward_decorators = [editableInPropertyPage("Force normal forward", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { notifiers: { update: true } })];
|
|
1348
|
+
_generateOnlyFragmentCode_decorators = [editableInPropertyPage("Generate only fragment code", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", {
|
|
1349
|
+
notifiers: { rebuild: true, update: true, onValidation: (block, prop) => PBRMetallicRoughnessBlock._OnGenerateOnlyFragmentCodeChanged(block, prop) },
|
|
1350
|
+
})];
|
|
1351
|
+
_debugMode_decorators = [editableInPropertyPage("Debug mode", 5 /* PropertyTypeForEdition.List */, "DEBUG", {
|
|
1352
|
+
notifiers: { update: true },
|
|
1353
|
+
options: [
|
|
1354
|
+
{ label: "None", value: 0 },
|
|
1355
|
+
// Geometry
|
|
1356
|
+
{ label: "Normalized position", value: 1 },
|
|
1357
|
+
{ label: "Normals", value: 2 },
|
|
1358
|
+
{ label: "Tangents", value: 3 },
|
|
1359
|
+
{ label: "Bitangents", value: 4 },
|
|
1360
|
+
{ label: "Bump Normals", value: 5 },
|
|
1361
|
+
//{ label: "UV1", value: 6 },
|
|
1362
|
+
//{ label: "UV2", value: 7 },
|
|
1363
|
+
{ label: "ClearCoat Normals", value: 8 },
|
|
1364
|
+
{ label: "ClearCoat Tangents", value: 9 },
|
|
1365
|
+
{ label: "ClearCoat Bitangents", value: 10 },
|
|
1366
|
+
{ label: "Anisotropic Normals", value: 11 },
|
|
1367
|
+
{ label: "Anisotropic Tangents", value: 12 },
|
|
1368
|
+
{ label: "Anisotropic Bitangents", value: 13 },
|
|
1369
|
+
// Maps
|
|
1370
|
+
//{ label: "Emissive Map", value: 23 },
|
|
1371
|
+
//{ label: "Light Map", value: 24 },
|
|
1372
|
+
// Env
|
|
1373
|
+
{ label: "Env Refraction", value: 40 },
|
|
1374
|
+
{ label: "Env Reflection", value: 41 },
|
|
1375
|
+
{ label: "Env Clear Coat", value: 42 },
|
|
1376
|
+
// Lighting
|
|
1377
|
+
{ label: "Direct Diffuse", value: 50 },
|
|
1378
|
+
{ label: "Direct Specular", value: 51 },
|
|
1379
|
+
{ label: "Direct Clear Coat", value: 52 },
|
|
1380
|
+
{ label: "Direct Sheen", value: 53 },
|
|
1381
|
+
{ label: "Env Irradiance", value: 54 },
|
|
1382
|
+
// Lighting Params
|
|
1383
|
+
{ label: "Surface Albedo", value: 60 },
|
|
1384
|
+
{ label: "Reflectance 0", value: 61 },
|
|
1385
|
+
{ label: "Metallic", value: 62 },
|
|
1386
|
+
{ label: "Metallic F0", value: 71 },
|
|
1387
|
+
{ label: "Roughness", value: 63 },
|
|
1388
|
+
{ label: "AlphaG", value: 64 },
|
|
1389
|
+
{ label: "NdotV", value: 65 },
|
|
1390
|
+
{ label: "ClearCoat Color", value: 66 },
|
|
1391
|
+
{ label: "ClearCoat Roughness", value: 67 },
|
|
1392
|
+
{ label: "ClearCoat NdotV", value: 68 },
|
|
1393
|
+
{ label: "Transmittance", value: 69 },
|
|
1394
|
+
{ label: "Refraction Transmittance", value: 70 },
|
|
1395
|
+
// Misc
|
|
1396
|
+
{ label: "SEO", value: 80 },
|
|
1397
|
+
{ label: "EHO", value: 81 },
|
|
1398
|
+
{ label: "Energy Factor", value: 82 },
|
|
1399
|
+
{ label: "Specular Reflectance", value: 83 },
|
|
1400
|
+
{ label: "Clear Coat Reflectance", value: 84 },
|
|
1401
|
+
{ label: "Sheen Reflectance", value: 85 },
|
|
1402
|
+
{ label: "Luminance Over Alpha", value: 86 },
|
|
1403
|
+
{ label: "Alpha", value: 87 },
|
|
1404
|
+
{ label: "Albedo color", value: 88 },
|
|
1405
|
+
{ label: "Ambient occlusion color", value: 89 },
|
|
1406
|
+
],
|
|
1407
|
+
})];
|
|
1408
|
+
_debugLimit_decorators = [editableInPropertyPage("Split position", 1 /* PropertyTypeForEdition.Float */, "DEBUG", { min: -1, max: 1, notifiers: { update: true } })];
|
|
1409
|
+
_debugFactor_decorators = [editableInPropertyPage("Output factor", 1 /* PropertyTypeForEdition.Float */, "DEBUG", { min: 0, max: 5, notifiers: { update: true } })];
|
|
1410
|
+
__esDecorate(null, null, _directIntensity_decorators, { kind: "field", name: "directIntensity", static: false, private: false, access: { has: obj => "directIntensity" in obj, get: obj => obj.directIntensity, set: (obj, value) => { obj.directIntensity = value; } }, metadata: _metadata }, _directIntensity_initializers, _directIntensity_extraInitializers);
|
|
1411
|
+
__esDecorate(null, null, _environmentIntensity_decorators, { kind: "field", name: "environmentIntensity", static: false, private: false, access: { has: obj => "environmentIntensity" in obj, get: obj => obj.environmentIntensity, set: (obj, value) => { obj.environmentIntensity = value; } }, metadata: _metadata }, _environmentIntensity_initializers, _environmentIntensity_extraInitializers);
|
|
1412
|
+
__esDecorate(null, null, _specularIntensity_decorators, { kind: "field", name: "specularIntensity", static: false, private: false, access: { has: obj => "specularIntensity" in obj, get: obj => obj.specularIntensity, set: (obj, value) => { obj.specularIntensity = value; } }, metadata: _metadata }, _specularIntensity_initializers, _specularIntensity_extraInitializers);
|
|
1413
|
+
__esDecorate(null, null, _lightFalloff_decorators, { kind: "field", name: "lightFalloff", static: false, private: false, access: { has: obj => "lightFalloff" in obj, get: obj => obj.lightFalloff, set: (obj, value) => { obj.lightFalloff = value; } }, metadata: _metadata }, _lightFalloff_initializers, _lightFalloff_extraInitializers);
|
|
1414
|
+
__esDecorate(null, null, _useAlphaTest_decorators, { kind: "field", name: "useAlphaTest", static: false, private: false, access: { has: obj => "useAlphaTest" in obj, get: obj => obj.useAlphaTest, set: (obj, value) => { obj.useAlphaTest = value; } }, metadata: _metadata }, _useAlphaTest_initializers, _useAlphaTest_extraInitializers);
|
|
1415
|
+
__esDecorate(null, null, _alphaTestCutoff_decorators, { kind: "field", name: "alphaTestCutoff", static: false, private: false, access: { has: obj => "alphaTestCutoff" in obj, get: obj => obj.alphaTestCutoff, set: (obj, value) => { obj.alphaTestCutoff = value; } }, metadata: _metadata }, _alphaTestCutoff_initializers, _alphaTestCutoff_extraInitializers);
|
|
1416
|
+
__esDecorate(null, null, _useAlphaBlending_decorators, { kind: "field", name: "useAlphaBlending", static: false, private: false, access: { has: obj => "useAlphaBlending" in obj, get: obj => obj.useAlphaBlending, set: (obj, value) => { obj.useAlphaBlending = value; } }, metadata: _metadata }, _useAlphaBlending_initializers, _useAlphaBlending_extraInitializers);
|
|
1417
|
+
__esDecorate(null, null, _useRadianceOverAlpha_decorators, { kind: "field", name: "useRadianceOverAlpha", static: false, private: false, access: { has: obj => "useRadianceOverAlpha" in obj, get: obj => obj.useRadianceOverAlpha, set: (obj, value) => { obj.useRadianceOverAlpha = value; } }, metadata: _metadata }, _useRadianceOverAlpha_initializers, _useRadianceOverAlpha_extraInitializers);
|
|
1418
|
+
__esDecorate(null, null, _useSpecularOverAlpha_decorators, { kind: "field", name: "useSpecularOverAlpha", static: false, private: false, access: { has: obj => "useSpecularOverAlpha" in obj, get: obj => obj.useSpecularOverAlpha, set: (obj, value) => { obj.useSpecularOverAlpha = value; } }, metadata: _metadata }, _useSpecularOverAlpha_initializers, _useSpecularOverAlpha_extraInitializers);
|
|
1419
|
+
__esDecorate(null, null, _enableSpecularAntiAliasing_decorators, { kind: "field", name: "enableSpecularAntiAliasing", static: false, private: false, access: { has: obj => "enableSpecularAntiAliasing" in obj, get: obj => obj.enableSpecularAntiAliasing, set: (obj, value) => { obj.enableSpecularAntiAliasing = value; } }, metadata: _metadata }, _enableSpecularAntiAliasing_initializers, _enableSpecularAntiAliasing_extraInitializers);
|
|
1420
|
+
__esDecorate(null, null, _realTimeFiltering_decorators, { kind: "field", name: "realTimeFiltering", static: false, private: false, access: { has: obj => "realTimeFiltering" in obj, get: obj => obj.realTimeFiltering, set: (obj, value) => { obj.realTimeFiltering = value; } }, metadata: _metadata }, _realTimeFiltering_initializers, _realTimeFiltering_extraInitializers);
|
|
1421
|
+
__esDecorate(null, null, _realTimeFilteringQuality_decorators, { kind: "field", name: "realTimeFilteringQuality", static: false, private: false, access: { has: obj => "realTimeFilteringQuality" in obj, get: obj => obj.realTimeFilteringQuality, set: (obj, value) => { obj.realTimeFilteringQuality = value; } }, metadata: _metadata }, _realTimeFilteringQuality_initializers, _realTimeFilteringQuality_extraInitializers);
|
|
1422
|
+
__esDecorate(null, null, _baseDiffuseModel_decorators, { kind: "field", name: "baseDiffuseModel", static: false, private: false, access: { has: obj => "baseDiffuseModel" in obj, get: obj => obj.baseDiffuseModel, set: (obj, value) => { obj.baseDiffuseModel = value; } }, metadata: _metadata }, _baseDiffuseModel_initializers, _baseDiffuseModel_extraInitializers);
|
|
1423
|
+
__esDecorate(null, null, _useEnergyConservation_decorators, { kind: "field", name: "useEnergyConservation", static: false, private: false, access: { has: obj => "useEnergyConservation" in obj, get: obj => obj.useEnergyConservation, set: (obj, value) => { obj.useEnergyConservation = value; } }, metadata: _metadata }, _useEnergyConservation_initializers, _useEnergyConservation_extraInitializers);
|
|
1424
|
+
__esDecorate(null, null, _useRadianceOcclusion_decorators, { kind: "field", name: "useRadianceOcclusion", static: false, private: false, access: { has: obj => "useRadianceOcclusion" in obj, get: obj => obj.useRadianceOcclusion, set: (obj, value) => { obj.useRadianceOcclusion = value; } }, metadata: _metadata }, _useRadianceOcclusion_initializers, _useRadianceOcclusion_extraInitializers);
|
|
1425
|
+
__esDecorate(null, null, _useHorizonOcclusion_decorators, { kind: "field", name: "useHorizonOcclusion", static: false, private: false, access: { has: obj => "useHorizonOcclusion" in obj, get: obj => obj.useHorizonOcclusion, set: (obj, value) => { obj.useHorizonOcclusion = value; } }, metadata: _metadata }, _useHorizonOcclusion_initializers, _useHorizonOcclusion_extraInitializers);
|
|
1426
|
+
__esDecorate(null, null, _unlit_decorators, { kind: "field", name: "unlit", static: false, private: false, access: { has: obj => "unlit" in obj, get: obj => obj.unlit, set: (obj, value) => { obj.unlit = value; } }, metadata: _metadata }, _unlit_initializers, _unlit_extraInitializers);
|
|
1427
|
+
__esDecorate(null, null, _forceNormalForward_decorators, { kind: "field", name: "forceNormalForward", static: false, private: false, access: { has: obj => "forceNormalForward" in obj, get: obj => obj.forceNormalForward, set: (obj, value) => { obj.forceNormalForward = value; } }, metadata: _metadata }, _forceNormalForward_initializers, _forceNormalForward_extraInitializers);
|
|
1428
|
+
__esDecorate(null, null, _generateOnlyFragmentCode_decorators, { kind: "field", name: "generateOnlyFragmentCode", static: false, private: false, access: { has: obj => "generateOnlyFragmentCode" in obj, get: obj => obj.generateOnlyFragmentCode, set: (obj, value) => { obj.generateOnlyFragmentCode = value; } }, metadata: _metadata }, _generateOnlyFragmentCode_initializers, _generateOnlyFragmentCode_extraInitializers);
|
|
1429
|
+
__esDecorate(null, null, _debugMode_decorators, { kind: "field", name: "debugMode", static: false, private: false, access: { has: obj => "debugMode" in obj, get: obj => obj.debugMode, set: (obj, value) => { obj.debugMode = value; } }, metadata: _metadata }, _debugMode_initializers, _debugMode_extraInitializers);
|
|
1430
|
+
__esDecorate(null, null, _debugLimit_decorators, { kind: "field", name: "debugLimit", static: false, private: false, access: { has: obj => "debugLimit" in obj, get: obj => obj.debugLimit, set: (obj, value) => { obj.debugLimit = value; } }, metadata: _metadata }, _debugLimit_initializers, _debugLimit_extraInitializers);
|
|
1431
|
+
__esDecorate(null, null, _debugFactor_decorators, { kind: "field", name: "debugFactor", static: false, private: false, access: { has: obj => "debugFactor" in obj, get: obj => obj.debugFactor, set: (obj, value) => { obj.debugFactor = value; } }, metadata: _metadata }, _debugFactor_initializers, _debugFactor_extraInitializers);
|
|
1432
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1433
|
+
})(),
|
|
1434
|
+
_a;
|
|
1435
|
+
})();
|
|
1436
|
+
export { PBRMetallicRoughnessBlock };
|
|
1382
1437
|
let _Registered = false;
|
|
1383
1438
|
/**
|
|
1384
1439
|
* Register side effects for pbrMetallicRoughnessBlock.
|