@babylonjs/core 7.18.0 → 7.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animationGroup.js +10 -2
- package/Animations/animationGroup.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +1 -58
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +26 -75
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Materials/Background/backgroundMaterial.d.ts +5 -3
- package/Materials/Background/backgroundMaterial.js +26 -3
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Background/index.d.ts +4 -0
- package/Materials/Background/index.js +6 -0
- package/Materials/Background/index.js.map +1 -1
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +3 -1
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js +3 -1
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +1 -0
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +22 -0
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.d.ts +2 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js +14 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/index.d.ts +28 -0
- package/Materials/Node/Blocks/Dual/index.js +33 -0
- package/Materials/Node/Blocks/Dual/index.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.d.ts +2 -9
- package/Materials/Node/Blocks/Dual/lightBlock.js +32 -9
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +2 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +14 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.d.ts +1 -3
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +20 -3
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/index.d.ts +18 -0
- package/Materials/Node/Blocks/Fragment/index.js +22 -0
- package/Materials/Node/Blocks/Fragment/index.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +2 -3
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +65 -35
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/shadowMapBlock.d.ts +1 -0
- package/Materials/Node/Blocks/Fragment/shadowMapBlock.js +20 -0
- package/Materials/Node/Blocks/Fragment/shadowMapBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js +8 -7
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +9 -6
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +1 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +28 -18
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js +14 -12
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/bonesBlock.d.ts +1 -2
- package/Materials/Node/Blocks/Vertex/bonesBlock.js +12 -2
- package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/index.d.ts +12 -0
- package/Materials/Node/Blocks/Vertex/index.js +15 -0
- package/Materials/Node/Blocks/Vertex/index.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.d.ts +1 -2
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +22 -2
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +2 -0
- package/Materials/Node/nodeMaterial.js +26 -0
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.d.ts +10 -0
- package/Materials/Node/nodeMaterialBlock.js +13 -0
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/PBR/index.d.ts +4 -0
- package/Materials/PBR/index.js +5 -0
- package/Materials/PBR/index.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +12 -3
- package/Materials/PBR/pbrBaseMaterial.js +62 -20
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrMaterial.d.ts +2 -1
- package/Materials/PBR/pbrMaterial.js +3 -2
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/index.d.ts +4 -0
- package/Materials/index.js +6 -0
- package/Materials/index.js.map +1 -1
- package/Materials/material.d.ts +7 -0
- package/Materials/material.js +8 -0
- package/Materials/material.js.map +1 -1
- package/Materials/materialPluginManager.js +19 -1
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/standardMaterial.d.ts +9 -3
- package/Materials/standardMaterial.js +30 -3
- package/Materials/standardMaterial.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.js +2 -2
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/Builders/linesBuilder.js +1 -0
- package/Meshes/Builders/linesBuilder.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/backgroundUboDeclaration.d.ts +6 -0
- package/ShadersWGSL/ShadersInclude/backgroundUboDeclaration.js +12 -0
- package/ShadersWGSL/ShadersInclude/backgroundUboDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/bakedVertexAnimation.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/bakedVertexAnimation.js +1 -1
- package/ShadersWGSL/ShadersInclude/bakedVertexAnimation.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bakedVertexAnimationDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/bakedVertexAnimationDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/bakedVertexAnimationDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bonesDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/bonesDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/bonesDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bonesVertex.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/bonesVertex.js +1 -1
- package/ShadersWGSL/ShadersInclude/bonesVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bumpFragment.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/bumpFragment.js +17 -17
- package/ShadersWGSL/ShadersInclude/bumpFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bumpFragmentFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/bumpFragmentFunctions.js +3 -3
- package/ShadersWGSL/ShadersInclude/bumpFragmentFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js +22 -42
- package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bumpVertex.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/bumpVertex.js +14 -0
- package/ShadersWGSL/ShadersInclude/bumpVertex.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/bumpVertexDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/bumpVertexDeclaration.js +14 -0
- package/ShadersWGSL/ShadersInclude/bumpVertexDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/clipPlaneFragment.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/clipPlaneFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/clipPlaneFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/clipPlaneVertex.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/clipPlaneVertex.js +1 -1
- package/ShadersWGSL/ShadersInclude/clipPlaneVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/clipPlaneVertexDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/clipPlaneVertexDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/clipPlaneVertexDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/decalFragment.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/decalFragment.js +5 -4
- package/ShadersWGSL/ShadersInclude/decalFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/decalFragmentDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/decalFragmentDeclaration.js +12 -0
- package/ShadersWGSL/ShadersInclude/decalFragmentDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/decalVertexDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/decalVertexDeclaration.js +12 -0
- package/ShadersWGSL/ShadersInclude/decalVertexDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.d.ts +7 -0
- package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js +15 -0
- package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/depthPrePass.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/depthPrePass.js +1 -1
- package/ShadersWGSL/ShadersInclude/depthPrePass.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/fogFragment.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/fogFragment.js +16 -0
- package/ShadersWGSL/ShadersInclude/fogFragment.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/fogFragmentDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/fogFragmentDeclaration.js +2 -3
- package/ShadersWGSL/ShadersInclude/fogFragmentDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/fogVertex.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/fogVertex.js +2 -2
- package/ShadersWGSL/ShadersInclude/fogVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/fogVertexDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/fogVertexDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/fogVertexDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/fresnelFunction.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/fresnelFunction.js +1 -1
- package/ShadersWGSL/ShadersInclude/fresnelFunction.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/harmonicsFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/harmonicsFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/harmonicsFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/helperFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/helperFunctions.js +15 -6
- package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js +3 -3
- package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js +5 -5
- package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/importanceSampling.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/importanceSampling.js +1 -1
- package/ShadersWGSL/ShadersInclude/importanceSampling.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/instancesDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/instancesDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/instancesDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/instancesVertex.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/instancesVertex.js +4 -4
- package/ShadersWGSL/ShadersInclude/instancesVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js +8 -8
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightUboDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +2 -2
- package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightVxFragmentDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/lightVxFragmentDeclaration.js +33 -0
- package/ShadersWGSL/ShadersInclude/lightVxFragmentDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +3 -3
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/logDepthDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/logDepthDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/logDepthDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/logDepthFragment.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/logDepthFragment.js +12 -0
- package/ShadersWGSL/ShadersInclude/logDepthFragment.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/logDepthVertex.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/logDepthVertex.js +2 -2
- package/ShadersWGSL/ShadersInclude/logDepthVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/mainUVVaryingDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/mainUVVaryingDeclaration.js +12 -0
- package/ShadersWGSL/ShadersInclude/mainUVVaryingDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/meshUboDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/meshUboDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/meshUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertex.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js +6 -6
- package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexGlobal.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexGlobal.js +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexGlobal.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexGlobalDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexGlobalDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexGlobalDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/oitDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/oitDeclaration.js +13 -0
- package/ShadersWGSL/ShadersInclude/oitDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/oitFragment.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/oitFragment.js +34 -0
- package/ShadersWGSL/ShadersInclude/oitFragment.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/packingFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/packingFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/packingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +12 -8
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.js +5 -6
- package/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockAlphaFresnel.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockAlphaFresnel.js +7 -8
- package/ShadersWGSL/ShadersInclude/pbrBlockAlphaFresnel.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockAmbientOcclusion.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockAmbientOcclusion.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockAmbientOcclusion.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockAnisotropic.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockAnisotropic.js +5 -5
- package/ShadersWGSL/ShadersInclude/pbrBlockAnisotropic.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockClearcoat.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockClearcoat.js +5 -5
- package/ShadersWGSL/ShadersInclude/pbrBlockClearcoat.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockDirectLighting.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockDirectLighting.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockDirectLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalColorComposition.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalColorComposition.js +3 -3
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalColorComposition.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js +6 -6
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js +7 -7
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockGeometryInfo.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockGeometryInfo.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockGeometryInfo.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockImageProcessing.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockImageProcessing.js +4 -4
- package/ShadersWGSL/ShadersInclude/pbrBlockImageProcessing.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockIridescence.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockIridescence.js +3 -5
- package/ShadersWGSL/ShadersInclude/pbrBlockIridescence.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockLightmapInit.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockLightmapInit.js +5 -5
- package/ShadersWGSL/ShadersInclude/pbrBlockLightmapInit.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js +4 -4
- package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockNormalGeometric.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockNormalGeometric.js +19 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockNormalGeometric.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectance0.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectance0.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectance0.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +6 -6
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSheen.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSheen.js +4 -4
- package/ShadersWGSL/ShadersInclude/pbrBlockSheen.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +4 -4
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDebug.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDebug.js +10 -10
- package/ShadersWGSL/ShadersInclude/pbrDebug.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFalloffFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFalloffFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFalloffFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrFragmentExtraDeclaration.d.ts +6 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentExtraDeclaration.js +24 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentExtraDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.d.ts +7 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +96 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js +3 -3
- package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js +3 -3
- package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.d.ts +7 -0
- package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +15 -0
- package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/prePassDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/prePassDeclaration.js +17 -0
- package/ShadersWGSL/ShadersInclude/prePassDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/prePassVertex.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/prePassVertex.js +42 -0
- package/ShadersWGSL/ShadersInclude/prePassVertex.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js +17 -0
- package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/reflectionFunction.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/reflectionFunction.js +12 -10
- package/ShadersWGSL/ShadersInclude/reflectionFunction.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/samplerFragmentAlternateDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/samplerFragmentAlternateDeclaration.js +26 -0
- package/ShadersWGSL/ShadersInclude/samplerFragmentAlternateDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/samplerFragmentDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/samplerFragmentDeclaration.js +2 -2
- package/ShadersWGSL/ShadersInclude/samplerFragmentDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/samplerVertexDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/samplerVertexDeclaration.js +12 -0
- package/ShadersWGSL/ShadersInclude/samplerVertexDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/samplerVertexImplementation.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/samplerVertexImplementation.js +33 -0
- package/ShadersWGSL/ShadersInclude/samplerVertexImplementation.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowMapFragment.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/shadowMapFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/shadowMapFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowMapVertexMetric.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/shadowMapVertexMetric.js +1 -1
- package/ShadersWGSL/ShadersInclude/shadowMapVertexMetric.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsVertex.d.ts +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsVertex.js +2 -2
- package/ShadersWGSL/ShadersInclude/shadowsVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/subSurfaceScatteringFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/subSurfaceScatteringFunctions.js +10 -0
- package/ShadersWGSL/ShadersInclude/subSurfaceScatteringFunctions.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/uvAttributeDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/uvAttributeDeclaration.js +12 -0
- package/ShadersWGSL/ShadersInclude/uvAttributeDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/uvVariableDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/uvVariableDeclaration.js +17 -0
- package/ShadersWGSL/ShadersInclude/uvVariableDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/vertexColorMixing.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/vertexColorMixing.js +22 -0
- package/ShadersWGSL/ShadersInclude/vertexColorMixing.js.map +1 -0
- package/ShadersWGSL/background.fragment.d.ts +20 -0
- package/ShadersWGSL/background.fragment.js +225 -0
- package/ShadersWGSL/background.fragment.js.map +1 -0
- package/ShadersWGSL/background.vertex.d.ts +21 -0
- package/ShadersWGSL/background.vertex.js +123 -0
- package/ShadersWGSL/background.vertex.js.map +1 -0
- package/ShadersWGSL/boundingInfo.compute.d.ts +1 -1
- package/ShadersWGSL/boundingInfo.compute.js +1 -1
- package/ShadersWGSL/boundingInfo.compute.js.map +1 -1
- package/ShadersWGSL/clearQuad.fragment.d.ts +1 -1
- package/ShadersWGSL/clearQuad.fragment.js +1 -1
- package/ShadersWGSL/clearQuad.fragment.js.map +1 -1
- package/ShadersWGSL/clearQuad.vertex.d.ts +1 -1
- package/ShadersWGSL/clearQuad.vertex.js +1 -1
- package/ShadersWGSL/clearQuad.vertex.js.map +1 -1
- package/ShadersWGSL/default.fragment.d.ts +31 -0
- package/ShadersWGSL/default.fragment.js +381 -0
- package/ShadersWGSL/default.fragment.js.map +1 -0
- package/ShadersWGSL/default.vertex.d.ts +36 -0
- package/ShadersWGSL/default.vertex.js +169 -0
- package/ShadersWGSL/default.vertex.js.map +1 -0
- package/ShadersWGSL/gpuUpdateParticles.compute.d.ts +1 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js +1 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
- package/ShadersWGSL/particles.vertex.d.ts +1 -1
- package/ShadersWGSL/particles.vertex.js +1 -1
- package/ShadersWGSL/particles.vertex.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.d.ts +60 -0
- package/ShadersWGSL/pbr.fragment.js +667 -0
- package/ShadersWGSL/pbr.fragment.js.map +1 -0
- package/ShadersWGSL/pbr.vertex.d.ts +36 -0
- package/ShadersWGSL/pbr.vertex.js +232 -0
- package/ShadersWGSL/pbr.vertex.js.map +1 -0
- package/ShadersWGSL/postprocess.vertex.d.ts +1 -1
- package/ShadersWGSL/postprocess.vertex.js +1 -1
- package/ShadersWGSL/postprocess.vertex.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLineMaterialInterfaces.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLineMaterialInterfaces.ts"],"names":[],"mappings":"AAiHA;;;GAGG;AACH,MAAM,CAAN,IAAkB,
|
|
1
|
+
{"version":3,"file":"greasedLineMaterialInterfaces.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLineMaterialInterfaces.ts"],"names":[],"mappings":"AAiHA;;;GAGG;AACH,MAAM,CAAN,IAAkB,2BAejB;AAfD,WAAkB,2BAA2B;IACzC;;OAEG;IACH,iHAA0B,CAAA;IAC1B;;OAEG;IACH,uGAAqB,CAAA;IACrB;;;;OAIG;IACH,6GAAwB,CAAA;AAC5B,CAAC,EAfiB,2BAA2B,KAA3B,2BAA2B,QAe5C;AAED;;;GAGG;AACH,MAAM,CAAN,IAAkB,wBAajB;AAbD,WAAkB,wBAAwB;IACtC;;OAEG;IACH,2FAAkB,CAAA;IAClB;;OAEG;IACH,2FAAkB,CAAA;IAClB;;OAEG;IACH,qGAAuB,CAAA;AAC3B,CAAC,EAbiB,wBAAwB,KAAxB,wBAAwB,QAazC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAkB,oCASjB;AATD,WAAkB,oCAAoC;IAClD;;OAEG;IACH,qJAAmC,CAAA;IACnC;;OAEG;IACH,+IAAgC,CAAA;AACpC,CAAC,EATiB,oCAAoC,KAApC,oCAAoC,QASrD","sourcesContent":["import type { RawTexture } from \"../Textures/rawTexture\";\r\nimport type { Vector2 } from \"../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\n/**\r\n * Interface which defines the available methods for a GreasedLineMaterial\r\n */\r\nexport interface IGreasedLineMaterial {\r\n /**\r\n * Normalized value of how much of the line will be visible\r\n * 0 - 0% of the line will be visible\r\n * 1 - 100% of the line will be visible\r\n */\r\n visibility: number;\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n width: number;\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n useDash: boolean;\r\n\r\n /**\r\n * @see GreasedLinePluginMaterial.setDashCount\r\n * Number of dashes in the line.\r\n * Defaults to 1.\r\n */\r\n dashCount: number;\r\n\r\n /**\r\n * Dash offset\r\n */\r\n dashOffset: number;\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n dashRatio: number;\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n useColors: boolean;\r\n\r\n /**\r\n * The mixing mode of the color paramater. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * MATERIAL_TYPE_STANDARD and MATERIAL_TYPE_PBR mixes the color from the base material with the color and/or colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n colorMode: GreasedLineMeshColorMode;\r\n\r\n /**\r\n * Colors of the line segments.\r\n * Defaults to empty.\r\n */\r\n colors: Nullable<Color3[]>;\r\n\r\n /**\r\n * If false then width units = scene units. If true then line will width be reduced.\r\n * Defaults to false.\r\n */\r\n sizeAttenuation: boolean;\r\n\r\n /**\r\n * Color of the line. Applies to all line segments.\r\n * Defaults to White.\r\n */\r\n color: Nullable<Color3>;\r\n\r\n /**\r\n * The method used to distribute the colors along the line.\r\n * You can use segment distribution when each segment will use on color from the color table.\r\n * Or you can use line distribution when the colors are distributed evenly along the line ignoring the segments.\r\n */\r\n colorsDistributionType: GreasedLineMeshColorDistributionType;\r\n\r\n /**\r\n * Defaults to engine.getRenderWidth() and engine.getRenderHeight()\r\n * Rendering resolution\r\n */\r\n resolution: Vector2;\r\n\r\n /**\r\n * You can provide a colorsTexture to use instead of one generated from the 'colors' option\r\n */\r\n colorsTexture: Nullable<RawTexture>;\r\n\r\n /**\r\n * Allows to change the color without marking the material dirty.\r\n * MATERIAL_TYPE_STANDARD and MATERIAL_TYPE_PBR material's shaders will get recompiled if there was no color set and you set a color or when there was a color set and you set it to null.\r\n * @param value the color\r\n * @param doNotMarkDirty the flag\r\n */\r\n setColor(value: Nullable<Color3>, doNotMarkDirty?: boolean): void;\r\n\r\n /**\r\n * Set the colors\r\n * @param colors colors array\r\n * @param lazy if true the colors texture will not be updated\r\n * @param forceNewTexture forces to create a new colors texture\r\n */\r\n setColors(colors: Nullable<Color3[]>, lazy: boolean, forceNewTexture?: boolean): void;\r\n\r\n /**\r\n * Creates and sets the colors texture from the colors array which was created in lazy mode\r\n */\r\n updateLazy(): void;\r\n}\r\n\r\n/**\r\n * Material types for GreasedLine\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#materialtype}\r\n */\r\nexport const enum GreasedLineMeshMaterialType {\r\n /**\r\n * StandardMaterial\r\n */\r\n MATERIAL_TYPE_STANDARD = 0,\r\n /**\r\n * PBR Material\r\n */\r\n MATERIAL_TYPE_PBR = 1,\r\n /**\r\n * Simple and fast shader material without texture, light, fog, instances, ... support.\r\n * Just raw colored lines.\r\n * Dashing and visibility is supported.\r\n */\r\n MATERIAL_TYPE_SIMPLE = 2,\r\n}\r\n\r\n/**\r\n * Color blending mode of the @see GreasedLineMaterial and the base material\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colormode}\r\n */\r\nexport const enum GreasedLineMeshColorMode {\r\n /**\r\n * Color blending mode SET\r\n */\r\n COLOR_MODE_SET = 0,\r\n /**\r\n * Color blending mode ADD\r\n */\r\n COLOR_MODE_ADD = 1,\r\n /**\r\n * Color blending mode ADD\r\n */\r\n COLOR_MODE_MULTIPLY = 2,\r\n}\r\n\r\n/**\r\n * Color distribution type of the @see colors.\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colordistributiontype}\r\n *\r\n */\r\nexport const enum GreasedLineMeshColorDistributionType {\r\n /**\r\n * Colors distributed between segments of the line\r\n */\r\n COLOR_DISTRIBUTION_TYPE_SEGMENT = 0,\r\n /**\r\n * Colors distributed along the line ingoring the segments\r\n */\r\n COLOR_DISTRIBUTION_TYPE_LINE = 1,\r\n}\r\n\r\n/**\r\n * Options for GreasedLineMaterial\r\n */\r\nexport interface GreasedLineMaterialOptions {\r\n /**\r\n * Line width. If sizeAttenuation os false scene units will be used for width.\r\n * Defaults to 0.1 if @see sizeAttenuation is false, or to 1 if it's true.\r\n */\r\n width?: number;\r\n /**\r\n * If false then width units = scene units. If true then line will width be reduced.\r\n * Defaults to false.\r\n */\r\n sizeAttenuation?: boolean;\r\n /**\r\n * Type of the material to use to render the line.\r\n * Defaults to StandardMaterial.\r\n */\r\n materialType?: GreasedLineMeshMaterialType;\r\n /**\r\n * Color of the line. Applies to all line segments.\r\n * Defaults to White.\r\n */\r\n color?: Color3;\r\n /**\r\n * Color mode of the line. Applies to all line segments.\r\n * The pixel color from the material shader will be modified with the value of @see color using the colorMode.\r\n * Defaults to @see GreasedLineMeshColorMode.SET\r\n */\r\n colorMode?: GreasedLineMeshColorMode;\r\n /**\r\n * Colors of the line segments.\r\n * Defaults to empty.\r\n */\r\n colors?: Color3[];\r\n /**\r\n * If true, @see colors are used, otherwise they're ignored.\r\n * Defaults to false.\r\n */\r\n useColors?: boolean;\r\n /**\r\n * Sampling type of the colors texture\r\n * Defaults to NEAREST_NEAREST.\r\n */\r\n colorsSampling?: number;\r\n /**\r\n * The method used to distribute the colors along the line.\r\n * You can use segment distribution when each segment will use on color from the color table.\r\n * Or you can use line distribution when the colors are distributed evenly along the line ignoring the segments.\r\n */\r\n colorDistributionType?: GreasedLineMeshColorDistributionType;\r\n /**\r\n * If true, dashing is used.\r\n * Defaults to false.\r\n */\r\n useDash?: boolean;\r\n /**\r\n * @see GreasedLinePluginMaterial.setDashCount\r\n * Number of dashes in the line.\r\n * Defaults to 1.\r\n */\r\n dashCount?: number;\r\n /**\r\n * Offset of the dashes along the line. 0 to 1.\r\n * Defaults to 0.\r\n * @see GreasedLinePluginMaterial.setDashOffset\r\n */\r\n dashOffset?: number;\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n * Defaults to 0.5.\r\n * @see GreasedLinePluginMaterial.setDashRatio\r\n */\r\n dashRatio?: number;\r\n /**\r\n * Sets the line length visibility.\r\n * 0 - 0% of the line will be visible.\r\n * 1 - 100% of the line will be visible.\r\n * @see GreasedLinePluginMaterial.setVisibility\r\n */\r\n visibility?: number;\r\n /**\r\n * Defaults to engine.getRenderWidth() and engine.getRenderHeight()\r\n * Rendering resolution\r\n */\r\n resolution?: Vector2;\r\n /**\r\n * Whether to use camera facing for the line.\r\n * Defaults to true.\r\n */\r\n cameraFacing?: boolean;\r\n /**\r\n * You can provide a colorsTexture to use instead of one generated from the 'colors' option\r\n */\r\n colorsTexture?: RawTexture;\r\n}\r\n"]}
|
|
@@ -25,6 +25,7 @@ export declare class ClipPlanesBlock extends NodeMaterialBlock {
|
|
|
25
25
|
* @param state defines the state that will be used for the build
|
|
26
26
|
*/
|
|
27
27
|
initialize(state: NodeMaterialBuildState): void;
|
|
28
|
+
private _initShaderSourceAsync;
|
|
28
29
|
/**
|
|
29
30
|
* Gets the worldPosition input component
|
|
30
31
|
*/
|
|
@@ -39,6 +39,28 @@ export class ClipPlanesBlock extends NodeMaterialBlock {
|
|
|
39
39
|
state._excludeVariableName("fClipDistance5");
|
|
40
40
|
state._excludeVariableName("vClipPlane6");
|
|
41
41
|
state._excludeVariableName("fClipDistance6");
|
|
42
|
+
this._initShaderSourceAsync(state.shaderLanguage);
|
|
43
|
+
}
|
|
44
|
+
async _initShaderSourceAsync(shaderLanguage) {
|
|
45
|
+
this._codeIsReady = false;
|
|
46
|
+
if (shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
47
|
+
await Promise.all([
|
|
48
|
+
import("../../../../ShadersWGSL/ShadersInclude/clipPlaneFragment.js"),
|
|
49
|
+
import("../../../../ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration.js"),
|
|
50
|
+
import("../../../../ShadersWGSL/ShadersInclude/clipPlaneVertex.js"),
|
|
51
|
+
import("../../../../ShadersWGSL/ShadersInclude/clipPlaneVertexDeclaration.js"),
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
await Promise.all([
|
|
56
|
+
import("../../../../Shaders/ShadersInclude/clipPlaneFragment.js"),
|
|
57
|
+
import("../../../../Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js"),
|
|
58
|
+
import("../../../../Shaders/ShadersInclude/clipPlaneVertex.js"),
|
|
59
|
+
import("../../../../Shaders/ShadersInclude/clipPlaneVertexDeclaration.js"),
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
this._codeIsReady = true;
|
|
63
|
+
this.onCodeIsReadyObservable.notifyObservers(this);
|
|
42
64
|
}
|
|
43
65
|
/**
|
|
44
66
|
* Gets the worldPosition input component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipPlanesBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/Dual/clipPlanesBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,aAAa,EA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AAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;YAC3F,KAAK,CAAC,sBAAsB,CAAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;YAC3F,KAAK,CAAC,sBAAsB,CAAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;YAC3F,KAAK,CAAC,sBAAsB,CAAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;YAE3F,OAAO;SACV;QAED,WAAW;QACX,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9C,KAAK,CAAC,wBAAwB,CAAC,8BAA8B,EAAE,QAAQ,CAAC,CAAC;QACzE,KAAK,CAAC,iBAAiB,IAAI,KAAK,CAAC,oBAAoB,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QAErF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import { NodeMaterialBlock } from \"../../nodeMaterialBlock\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../../nodeMaterialBuildState\";\r\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets\";\r\nimport type { NodeMaterialConnectionPoint } from \"../../nodeMaterialBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { Effect } from \"../../../effect\";\r\nimport type { NodeMaterial, NodeMaterialDefines } from \"../../nodeMaterial\";\r\nimport type { Mesh } from \"../../../../Meshes/mesh\";\r\nimport type { AbstractMesh } from \"../../../../Meshes/abstractMesh\";\r\nimport { bindClipPlane } from \"../../../../Materials/clipPlaneMaterialHelper\";\r\n/**\r\n * Block used to implement clip planes\r\n */\r\nexport class ClipPlanesBlock extends NodeMaterialBlock {\r\n /**\r\n * Create a new ClipPlanesBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.VertexAndFragment, true);\r\n\r\n this.registerInput(\"worldPosition\", NodeMaterialBlockConnectionPointTypes.Vector4, false);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ClipPlanesBlock\";\r\n }\r\n\r\n /**\r\n * Initialize the block and prepare the context for build\r\n * @param state defines the state that will be used for the build\r\n */\r\n public override initialize(state: NodeMaterialBuildState) {\r\n state._excludeVariableName(\"vClipPlane\");\r\n state._excludeVariableName(\"fClipDistance\");\r\n state._excludeVariableName(\"vClipPlane2\");\r\n state._excludeVariableName(\"fClipDistance2\");\r\n state._excludeVariableName(\"vClipPlane3\");\r\n state._excludeVariableName(\"fClipDistance3\");\r\n state._excludeVariableName(\"vClipPlane4\");\r\n state._excludeVariableName(\"fClipDistance4\");\r\n state._excludeVariableName(\"vClipPlane5\");\r\n state._excludeVariableName(\"fClipDistance5\");\r\n state._excludeVariableName(\"vClipPlane6\");\r\n state._excludeVariableName(\"fClipDistance6\");\r\n }\r\n\r\n /**\r\n * Gets the worldPosition input component\r\n */\r\n public get worldPosition(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n public override get target() {\r\n return NodeMaterialBlockTargets.VertexAndFragment;\r\n }\r\n\r\n public override set target(value: NodeMaterialBlockTargets) {}\r\n\r\n public override prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines) {\r\n const scene = mesh.getScene();\r\n\r\n const useClipPlane1 = (nodeMaterial.clipPlane ?? scene.clipPlane) ? true : false;\r\n const useClipPlane2 = (nodeMaterial.clipPlane2 ?? scene.clipPlane2) ? true : false;\r\n const useClipPlane3 = (nodeMaterial.clipPlane3 ?? scene.clipPlane3) ? true : false;\r\n const useClipPlane4 = (nodeMaterial.clipPlane4 ?? scene.clipPlane4) ? true : false;\r\n const useClipPlane5 = (nodeMaterial.clipPlane5 ?? scene.clipPlane5) ? true : false;\r\n const useClipPlane6 = (nodeMaterial.clipPlane6 ?? scene.clipPlane6) ? true : false;\r\n\r\n defines.setValue(\"CLIPPLANE\", useClipPlane1, true);\r\n defines.setValue(\"CLIPPLANE2\", useClipPlane2, true);\r\n defines.setValue(\"CLIPPLANE3\", useClipPlane3, true);\r\n defines.setValue(\"CLIPPLANE4\", useClipPlane4, true);\r\n defines.setValue(\"CLIPPLANE5\", useClipPlane5, true);\r\n defines.setValue(\"CLIPPLANE6\", useClipPlane6, true);\r\n }\r\n\r\n public override bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n const scene = mesh.getScene();\r\n\r\n bindClipPlane(effect, nodeMaterial, scene);\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n const comments = `//${this.name}`;\r\n if (state.target !== NodeMaterialBlockTargets.Fragment) {\r\n // Vertex\r\n const worldPos = this.worldPosition;\r\n\r\n state._emitFunctionFromInclude(\"clipPlaneVertexDeclaration\", comments, {\r\n replaceStrings: [{ search: /uniform vec4 vClipPlane\\d*;/g, replace: \"\" }],\r\n });\r\n state.compilationString += state._emitCodeFromInclude(\"clipPlaneVertex\", comments, {\r\n replaceStrings: [{ search: /worldPos/g, replace: worldPos.associatedVariableName }],\r\n });\r\n\r\n state._emitUniformFromString(\"vClipPlane\", NodeMaterialBlockConnectionPointTypes.Vector4);\r\n state._emitUniformFromString(\"vClipPlane2\", NodeMaterialBlockConnectionPointTypes.Vector4);\r\n state._emitUniformFromString(\"vClipPlane3\", NodeMaterialBlockConnectionPointTypes.Vector4);\r\n state._emitUniformFromString(\"vClipPlane4\", NodeMaterialBlockConnectionPointTypes.Vector4);\r\n state._emitUniformFromString(\"vClipPlane5\", NodeMaterialBlockConnectionPointTypes.Vector4);\r\n state._emitUniformFromString(\"vClipPlane6\", NodeMaterialBlockConnectionPointTypes.Vector4);\r\n\r\n return;\r\n }\r\n\r\n // Fragment\r\n state.sharedData.bindableBlocks.push(this);\r\n state.sharedData.blocksWithDefines.push(this);\r\n\r\n state._emitFunctionFromInclude(\"clipPlaneFragmentDeclaration\", comments);\r\n state.compilationString += state._emitCodeFromInclude(\"clipPlaneFragment\", comments);\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ClipPlanesBlock\", ClipPlanesBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"clipPlanesBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/Dual/clipPlanesBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAK3D,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAE9E;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,iBAAiB;IAClD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAE9D,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,qCAAqC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC9F,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,iBAAiB,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACa,UAAU,CAAC,KAA6B;QACpD,KAAK,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;QACzC,KAAK,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAA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AAY,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;YAC1F,KAAK,CAAC,sBAAsB,CAAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;YAC3F,KAAK,CAAC,sBAAsB,CAAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;YAC3F,KAAK,CAAC,sBAAsB,CAAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;YAC3F,KAAK,CAAC,sBAAsB,CAAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;YAC3F,KAAK,CAAC,sBAAsB,CAAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;YAE3F,OAAO;SACV;QAED,WAAW;QACX,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9C,KAAK,CAAC,wBAAwB,CAAC,8BAA8B,EAAE,QAAQ,CAAC,CAAC;QACzE,KAAK,CAAC,iBAAiB,IAAI,KAAK,CAAC,oBAAoB,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QAErF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import { NodeMaterialBlock } from \"../../nodeMaterialBlock\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../../nodeMaterialBuildState\";\r\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets\";\r\nimport type { NodeMaterialConnectionPoint } from \"../../nodeMaterialBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { Effect } from \"../../../effect\";\r\nimport type { NodeMaterial, NodeMaterialDefines } from \"../../nodeMaterial\";\r\nimport type { Mesh } from \"../../../../Meshes/mesh\";\r\nimport type { AbstractMesh } from \"../../../../Meshes/abstractMesh\";\r\nimport { bindClipPlane } from \"../../../../Materials/clipPlaneMaterialHelper\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n/**\r\n * Block used to implement clip planes\r\n */\r\nexport class ClipPlanesBlock extends NodeMaterialBlock {\r\n /**\r\n * Create a new ClipPlanesBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.VertexAndFragment, true);\r\n\r\n this.registerInput(\"worldPosition\", NodeMaterialBlockConnectionPointTypes.Vector4, false);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ClipPlanesBlock\";\r\n }\r\n\r\n /**\r\n * Initialize the block and prepare the context for build\r\n * @param state defines the state that will be used for the build\r\n */\r\n public override initialize(state: NodeMaterialBuildState) {\r\n state._excludeVariableName(\"vClipPlane\");\r\n state._excludeVariableName(\"fClipDistance\");\r\n state._excludeVariableName(\"vClipPlane2\");\r\n state._excludeVariableName(\"fClipDistance2\");\r\n state._excludeVariableName(\"vClipPlane3\");\r\n state._excludeVariableName(\"fClipDistance3\");\r\n state._excludeVariableName(\"vClipPlane4\");\r\n state._excludeVariableName(\"fClipDistance4\");\r\n state._excludeVariableName(\"vClipPlane5\");\r\n state._excludeVariableName(\"fClipDistance5\");\r\n state._excludeVariableName(\"vClipPlane6\");\r\n state._excludeVariableName(\"fClipDistance6\");\r\n\r\n this._initShaderSourceAsync(state.shaderLanguage);\r\n }\r\n\r\n private async _initShaderSourceAsync(shaderLanguage: ShaderLanguage) {\r\n this._codeIsReady = false;\r\n\r\n if (shaderLanguage === ShaderLanguage.WGSL) {\r\n await Promise.all([\r\n import(\"../../../../ShadersWGSL/ShadersInclude/clipPlaneFragment\"),\r\n import(\"../../../../ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\"),\r\n import(\"../../../../ShadersWGSL/ShadersInclude/clipPlaneVertex\"),\r\n import(\"../../../../ShadersWGSL/ShadersInclude/clipPlaneVertexDeclaration\"),\r\n ]);\r\n } else {\r\n await Promise.all([\r\n import(\"../../../../Shaders/ShadersInclude/clipPlaneFragment\"),\r\n import(\"../../../../Shaders/ShadersInclude/clipPlaneFragmentDeclaration\"),\r\n import(\"../../../../Shaders/ShadersInclude/clipPlaneVertex\"),\r\n import(\"../../../../Shaders/ShadersInclude/clipPlaneVertexDeclaration\"),\r\n ]);\r\n }\r\n\r\n this._codeIsReady = true;\r\n this.onCodeIsReadyObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets the worldPosition input component\r\n */\r\n public get worldPosition(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n public override get target() {\r\n return NodeMaterialBlockTargets.VertexAndFragment;\r\n }\r\n\r\n public override set target(value: NodeMaterialBlockTargets) {}\r\n\r\n public override prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines) {\r\n const scene = mesh.getScene();\r\n\r\n const useClipPlane1 = (nodeMaterial.clipPlane ?? scene.clipPlane) ? true : false;\r\n const useClipPlane2 = (nodeMaterial.clipPlane2 ?? scene.clipPlane2) ? true : false;\r\n const useClipPlane3 = (nodeMaterial.clipPlane3 ?? scene.clipPlane3) ? true : false;\r\n const useClipPlane4 = (nodeMaterial.clipPlane4 ?? scene.clipPlane4) ? true : false;\r\n const useClipPlane5 = (nodeMaterial.clipPlane5 ?? scene.clipPlane5) ? true : false;\r\n const useClipPlane6 = (nodeMaterial.clipPlane6 ?? scene.clipPlane6) ? true : false;\r\n\r\n defines.setValue(\"CLIPPLANE\", useClipPlane1, true);\r\n defines.setValue(\"CLIPPLANE2\", useClipPlane2, true);\r\n defines.setValue(\"CLIPPLANE3\", useClipPlane3, true);\r\n defines.setValue(\"CLIPPLANE4\", useClipPlane4, true);\r\n defines.setValue(\"CLIPPLANE5\", useClipPlane5, true);\r\n defines.setValue(\"CLIPPLANE6\", useClipPlane6, true);\r\n }\r\n\r\n public override bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n const scene = mesh.getScene();\r\n\r\n bindClipPlane(effect, nodeMaterial, scene);\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n const comments = `//${this.name}`;\r\n if (state.target !== NodeMaterialBlockTargets.Fragment) {\r\n // Vertex\r\n const worldPos = this.worldPosition;\r\n\r\n state._emitFunctionFromInclude(\"clipPlaneVertexDeclaration\", comments, {\r\n replaceStrings: [{ search: /uniform vec4 vClipPlane\\d*;/g, replace: \"\" }],\r\n });\r\n state.compilationString += state._emitCodeFromInclude(\"clipPlaneVertex\", comments, {\r\n replaceStrings: [{ search: /worldPos/g, replace: worldPos.associatedVariableName }],\r\n });\r\n\r\n state._emitUniformFromString(\"vClipPlane\", NodeMaterialBlockConnectionPointTypes.Vector4);\r\n state._emitUniformFromString(\"vClipPlane2\", NodeMaterialBlockConnectionPointTypes.Vector4);\r\n state._emitUniformFromString(\"vClipPlane3\", NodeMaterialBlockConnectionPointTypes.Vector4);\r\n state._emitUniformFromString(\"vClipPlane4\", NodeMaterialBlockConnectionPointTypes.Vector4);\r\n state._emitUniformFromString(\"vClipPlane5\", NodeMaterialBlockConnectionPointTypes.Vector4);\r\n state._emitUniformFromString(\"vClipPlane6\", NodeMaterialBlockConnectionPointTypes.Vector4);\r\n\r\n return;\r\n }\r\n\r\n // Fragment\r\n state.sharedData.bindableBlocks.push(this);\r\n state.sharedData.blocksWithDefines.push(this);\r\n\r\n state._emitFunctionFromInclude(\"clipPlaneFragmentDeclaration\", comments);\r\n state.compilationString += state._emitCodeFromInclude(\"clipPlaneFragment\", comments);\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ClipPlanesBlock\", ClipPlanesBlock);\r\n"]}
|
|
@@ -5,7 +5,6 @@ import type { Effect } from "../../../effect";
|
|
|
5
5
|
import type { NodeMaterialConnectionPoint } from "../../nodeMaterialBlockConnectionPoint";
|
|
6
6
|
import type { AbstractMesh } from "../../../../Meshes/abstractMesh";
|
|
7
7
|
import type { NodeMaterial, NodeMaterialDefines } from "../../nodeMaterial";
|
|
8
|
-
import "../../../../Shaders/ShadersInclude/fogFragmentDeclaration";
|
|
9
8
|
/**
|
|
10
9
|
* Block used to add support for scene fog
|
|
11
10
|
*/
|
|
@@ -42,6 +41,8 @@ export declare class FogBlock extends NodeMaterialBlock {
|
|
|
42
41
|
* Gets the output component
|
|
43
42
|
*/
|
|
44
43
|
get output(): NodeMaterialConnectionPoint;
|
|
44
|
+
initialize(state: NodeMaterialBuildState): void;
|
|
45
|
+
private _initShaderSourceAsync;
|
|
45
46
|
autoConfigure(material: NodeMaterial, additionalFilteringInfo?: (node: NodeMaterialBlock) => boolean): void;
|
|
46
47
|
prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines): void;
|
|
47
48
|
bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh): void;
|
|
@@ -4,7 +4,6 @@ import { NodeMaterialSystemValues } from "../../Enums/nodeMaterialSystemValues.j
|
|
|
4
4
|
import { NodeMaterialBlockTargets } from "../../Enums/nodeMaterialBlockTargets.js";
|
|
5
5
|
import { InputBlock } from "../Input/inputBlock.js";
|
|
6
6
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
7
|
-
import "../../../../Shaders/ShadersInclude/fogFragmentDeclaration.js";
|
|
8
7
|
import { GetFogState } from "../../../materialHelper.functions.js";
|
|
9
8
|
/**
|
|
10
9
|
* Block used to add support for scene fog
|
|
@@ -63,6 +62,20 @@ export class FogBlock extends NodeMaterialBlock {
|
|
|
63
62
|
get output() {
|
|
64
63
|
return this._outputs[0];
|
|
65
64
|
}
|
|
65
|
+
initialize(state) {
|
|
66
|
+
this._initShaderSourceAsync(state.shaderLanguage);
|
|
67
|
+
}
|
|
68
|
+
async _initShaderSourceAsync(shaderLanguage) {
|
|
69
|
+
this._codeIsReady = false;
|
|
70
|
+
if (shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
71
|
+
await import("../../../../ShadersWGSL/ShadersInclude/fogFragmentDeclaration.js");
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
await import("../../../../Shaders/ShadersInclude/fogFragmentDeclaration.js");
|
|
75
|
+
}
|
|
76
|
+
this._codeIsReady = true;
|
|
77
|
+
this.onCodeIsReadyObservable.notifyObservers(this);
|
|
78
|
+
}
|
|
66
79
|
autoConfigure(material, additionalFilteringInfo = () => true) {
|
|
67
80
|
if (!this.view.isConnected) {
|
|
68
81
|
let viewInput = material.getInputBlockByPredicate((b) => b.systemValue === NodeMaterialSystemValues.View && additionalFilteringInfo(b));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fogBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/Dual/fogBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAMhF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,2DAA2D,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,6CAAgD;AAGtE;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,iBAAiB;IAI3C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;QAE/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,MAAM,CAAC,OAAO,KAAK,CAAC,sBAAsB,SAAS,CAAC;YAC9G,KAAK,CAAC,iBAAiB,IAAI,UAAU,CAAC;SACzC;aAAM;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC;YACpC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;YACvB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;YACnE,KAAK,CAAC,sBAAsB,CAAC,IAAI,CAAC,gBAAgB,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;YACnG,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,gCAAwB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;YACpF,KAAK,CAAC,iBAAiB,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC,gBAAgB,OAAO,IAAI,CAAC,sBAAsB,MAAM,QAAQ,CAAC,sBAAsB,UAAU,CAAC;SACjJ;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import { NodeMaterialBlock } from \"../../nodeMaterialBlock\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../../nodeMaterialBuildState\";\r\nimport { NodeMaterialSystemValues } from \"../../Enums/nodeMaterialSystemValues\";\r\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets\";\r\nimport type { Mesh } from \"../../../../Meshes/mesh\";\r\nimport type { Effect } from \"../../../effect\";\r\nimport type { NodeMaterialConnectionPoint } from \"../../nodeMaterialBlockConnectionPoint\";\r\nimport type { AbstractMesh } from \"../../../../Meshes/abstractMesh\";\r\nimport type { NodeMaterial, NodeMaterialDefines } from \"../../nodeMaterial\";\r\nimport { InputBlock } from \"../Input/inputBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\n\r\nimport \"../../../../Shaders/ShadersInclude/fogFragmentDeclaration\";\r\nimport { GetFogState } from \"core/Materials/materialHelper.functions\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\n/**\r\n * Block used to add support for scene fog\r\n */\r\nexport class FogBlock extends NodeMaterialBlock {\r\n private _fogDistanceName: string;\r\n private _fogParameters: string;\r\n\r\n /**\r\n * Create a new FogBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.VertexAndFragment, false);\r\n\r\n // Vertex\r\n this.registerInput(\"worldPosition\", NodeMaterialBlockConnectionPointTypes.Vector4, false, NodeMaterialBlockTargets.Vertex);\r\n this.registerInput(\"view\", NodeMaterialBlockConnectionPointTypes.Matrix, false, NodeMaterialBlockTargets.Vertex);\r\n\r\n // Fragment\r\n this.registerInput(\"input\", NodeMaterialBlockConnectionPointTypes.AutoDetect, false, NodeMaterialBlockTargets.Fragment);\r\n this.registerInput(\"fogColor\", NodeMaterialBlockConnectionPointTypes.AutoDetect, false, NodeMaterialBlockTargets.Fragment);\r\n\r\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);\r\n\r\n this.input.addExcludedConnectionPointFromAllowedTypes(\r\n NodeMaterialBlockConnectionPointTypes.Color3 | NodeMaterialBlockConnectionPointTypes.Vector3 | NodeMaterialBlockConnectionPointTypes.Color4\r\n );\r\n this.fogColor.addExcludedConnectionPointFromAllowedTypes(\r\n NodeMaterialBlockConnectionPointTypes.Color3 | NodeMaterialBlockConnectionPointTypes.Vector3 | NodeMaterialBlockConnectionPointTypes.Color4\r\n );\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"FogBlock\";\r\n }\r\n\r\n /**\r\n * Gets the world position input component\r\n */\r\n public get worldPosition(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the view input component\r\n */\r\n public get view(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the color input component\r\n */\r\n public get input(): NodeMaterialConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the fog color input component\r\n */\r\n public get fogColor(): NodeMaterialConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure(material: NodeMaterial, additionalFilteringInfo: (node: NodeMaterialBlock) => boolean = () => true) {\r\n if (!this.view.isConnected) {\r\n let viewInput = material.getInputBlockByPredicate((b) => b.systemValue === NodeMaterialSystemValues.View && additionalFilteringInfo(b));\r\n\r\n if (!viewInput) {\r\n viewInput = new InputBlock(\"view\");\r\n viewInput.setAsSystemValue(NodeMaterialSystemValues.View);\r\n }\r\n viewInput.output.connectTo(this.view);\r\n }\r\n if (!this.fogColor.isConnected) {\r\n let fogColorInput = material.getInputBlockByPredicate((b) => b.systemValue === NodeMaterialSystemValues.FogColor && additionalFilteringInfo(b));\r\n\r\n if (!fogColorInput) {\r\n fogColorInput = new InputBlock(\"fogColor\", undefined, NodeMaterialBlockConnectionPointTypes.Color3);\r\n fogColorInput.setAsSystemValue(NodeMaterialSystemValues.FogColor);\r\n }\r\n fogColorInput.output.connectTo(this.fogColor);\r\n }\r\n }\r\n\r\n public override prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines) {\r\n const scene = mesh.getScene();\r\n defines.setValue(\"FOG\", nodeMaterial.fogEnabled && GetFogState(mesh, scene));\r\n }\r\n\r\n public override bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n const scene = mesh.getScene();\r\n effect.setFloat4(this._fogParameters, scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n if (state.target === NodeMaterialBlockTargets.Fragment) {\r\n state.sharedData.blocksWithDefines.push(this);\r\n state.sharedData.bindableBlocks.push(this);\r\n\r\n let replaceStrings = [];\r\n let prefix1 = \"\";\r\n let prefix2 = \"\";\r\n\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n replaceStrings = [\r\n { search: /fn CalcFogFactor\\(\\)/, replace: \"fn CalcFogFactor(vFogDistance: vec3f, vFogInfos: vec4f)\" },\r\n { search: /uniforms.vFogInfos/g, replace: \"vFogInfos\" },\r\n { search: /fragmentInputs.vFogDistance/g, replace: \"vFogDistance\" },\r\n ];\r\n\r\n prefix1 = \"fragmentInputs.\";\r\n prefix2 = \"uniforms.\";\r\n } else {\r\n replaceStrings = [{ search: /float CalcFogFactor\\(\\)/, replace: \"float CalcFogFactor(vec3 vFogDistance, vec4 vFogInfos)\" }];\r\n }\r\n\r\n state._emitFunctionFromInclude(\"fogFragmentDeclaration\", `//${this.name}`, {\r\n removeUniforms: true,\r\n removeVaryings: true,\r\n removeIfDef: false,\r\n replaceStrings: replaceStrings,\r\n });\r\n\r\n const tempFogVariablename = state._getFreeVariableName(\"fog\");\r\n const color = this.input;\r\n const fogColor = this.fogColor;\r\n this._fogParameters = state._getFreeVariableName(\"fogParameters\");\r\n const output = this._outputs[0];\r\n\r\n state._emitUniformFromString(this._fogParameters, NodeMaterialBlockConnectionPointTypes.Vector4);\r\n\r\n state.compilationString += `#ifdef FOG\\n`;\r\n state.compilationString += `${state._declareLocalVar(tempFogVariablename, NodeMaterialBlockConnectionPointTypes.Float)} = CalcFogFactor(${prefix1}${this._fogDistanceName}, ${prefix2}${this._fogParameters});\\n`;\r\n state.compilationString +=\r\n state._declareOutput(output) +\r\n ` = ${tempFogVariablename} * ${color.associatedVariableName}.rgb + (1.0 - ${tempFogVariablename}) * ${fogColor.associatedVariableName}.rgb;\\n`;\r\n state.compilationString += `#else\\n${state._declareOutput(output)} = ${color.associatedVariableName}.rgb;\\n`;\r\n state.compilationString += `#endif\\n`;\r\n } else {\r\n const worldPos = this.worldPosition;\r\n const view = this.view;\r\n this._fogDistanceName = state._getFreeVariableName(\"vFogDistance\");\r\n state._emitVaryingFromString(this._fogDistanceName, NodeMaterialBlockConnectionPointTypes.Vector3);\r\n const prefix = state.shaderLanguage === ShaderLanguage.WGSL ? \"vertexOutputs.\" : \"\";\r\n state.compilationString += `${prefix}${this._fogDistanceName} = (${view.associatedVariableName} * ${worldPos.associatedVariableName}).xyz;\\n`;\r\n }\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.FogBlock\", FogBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"fogBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/Dual/fogBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAMhF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,6CAAgD;AAGtE;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,iBAAiB;IAI3C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;QAE/D,SAAS;QACT,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,qCAAqC,CAAC,OAAO,EAAE,KAAK,EAAE,wBAAwB,CAAC,MAAM,CAA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oBAAoB,OAAO,GAAG,IAAI,CAAC,gBAAgB,KAAK,OAAO,GAAG,IAAI,CAAC,cAAc,MAAM,CAAC;YAClN,KAAK,CAAC,iBAAiB;gBACnB,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC;oBAC5B,MAAM,mBAAmB,MAAM,KAAK,CAAC,sBAAsB,iBAAiB,mBAAmB,OAAO,QAAQ,CAAC,sBAAsB,SAAS,CAAC;YACnJ,KAAK,CAAC,iBAAiB,IAAI,UAAU,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,KAAK,CAAC,sBAAsB,SAAS,CAAC;YAC9G,KAAK,CAAC,iBAAiB,IAAI,UAAU,CAAC;SACzC;aAAM;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC;YACpC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;YACvB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;YACnE,KAAK,CAAC,sBAAsB,CAAC,IAAI,CAAC,gBAAgB,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;YACnG,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,gCAAwB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;YACpF,KAAK,CAAC,iBAAiB,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC,gBAAgB,OAAO,IAAI,CAAC,sBAAsB,MAAM,QAAQ,CAAC,sBAAsB,UAAU,CAAC;SACjJ;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import { NodeMaterialBlock } from \"../../nodeMaterialBlock\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../../nodeMaterialBuildState\";\r\nimport { NodeMaterialSystemValues } from \"../../Enums/nodeMaterialSystemValues\";\r\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets\";\r\nimport type { Mesh } from \"../../../../Meshes/mesh\";\r\nimport type { Effect } from \"../../../effect\";\r\nimport type { NodeMaterialConnectionPoint } from \"../../nodeMaterialBlockConnectionPoint\";\r\nimport type { AbstractMesh } from \"../../../../Meshes/abstractMesh\";\r\nimport type { NodeMaterial, NodeMaterialDefines } from \"../../nodeMaterial\";\r\nimport { InputBlock } from \"../Input/inputBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\n\r\nimport { GetFogState } from \"core/Materials/materialHelper.functions\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\n/**\r\n * Block used to add support for scene fog\r\n */\r\nexport class FogBlock extends NodeMaterialBlock {\r\n private _fogDistanceName: string;\r\n private _fogParameters: string;\r\n\r\n /**\r\n * Create a new FogBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.VertexAndFragment, false);\r\n\r\n // Vertex\r\n this.registerInput(\"worldPosition\", NodeMaterialBlockConnectionPointTypes.Vector4, false, NodeMaterialBlockTargets.Vertex);\r\n this.registerInput(\"view\", NodeMaterialBlockConnectionPointTypes.Matrix, false, NodeMaterialBlockTargets.Vertex);\r\n\r\n // Fragment\r\n this.registerInput(\"input\", NodeMaterialBlockConnectionPointTypes.AutoDetect, false, NodeMaterialBlockTargets.Fragment);\r\n this.registerInput(\"fogColor\", NodeMaterialBlockConnectionPointTypes.AutoDetect, false, NodeMaterialBlockTargets.Fragment);\r\n\r\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);\r\n\r\n this.input.addExcludedConnectionPointFromAllowedTypes(\r\n NodeMaterialBlockConnectionPointTypes.Color3 | NodeMaterialBlockConnectionPointTypes.Vector3 | NodeMaterialBlockConnectionPointTypes.Color4\r\n );\r\n this.fogColor.addExcludedConnectionPointFromAllowedTypes(\r\n NodeMaterialBlockConnectionPointTypes.Color3 | NodeMaterialBlockConnectionPointTypes.Vector3 | NodeMaterialBlockConnectionPointTypes.Color4\r\n );\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"FogBlock\";\r\n }\r\n\r\n /**\r\n * Gets the world position input component\r\n */\r\n public get worldPosition(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the view input component\r\n */\r\n public get view(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the color input component\r\n */\r\n public get input(): NodeMaterialConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the fog color input component\r\n */\r\n public get fogColor(): NodeMaterialConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override initialize(state: NodeMaterialBuildState) {\r\n this._initShaderSourceAsync(state.shaderLanguage);\r\n }\r\n\r\n private async _initShaderSourceAsync(shaderLanguage: ShaderLanguage) {\r\n this._codeIsReady = false;\r\n\r\n if (shaderLanguage === ShaderLanguage.WGSL) {\r\n await import(\"../../../../ShadersWGSL/ShadersInclude/fogFragmentDeclaration\");\r\n } else {\r\n await import(\"../../../../Shaders/ShadersInclude/fogFragmentDeclaration\");\r\n }\r\n\r\n this._codeIsReady = true;\r\n this.onCodeIsReadyObservable.notifyObservers(this);\r\n }\r\n\r\n public override autoConfigure(material: NodeMaterial, additionalFilteringInfo: (node: NodeMaterialBlock) => boolean = () => true) {\r\n if (!this.view.isConnected) {\r\n let viewInput = material.getInputBlockByPredicate((b) => b.systemValue === NodeMaterialSystemValues.View && additionalFilteringInfo(b));\r\n\r\n if (!viewInput) {\r\n viewInput = new InputBlock(\"view\");\r\n viewInput.setAsSystemValue(NodeMaterialSystemValues.View);\r\n }\r\n viewInput.output.connectTo(this.view);\r\n }\r\n if (!this.fogColor.isConnected) {\r\n let fogColorInput = material.getInputBlockByPredicate((b) => b.systemValue === NodeMaterialSystemValues.FogColor && additionalFilteringInfo(b));\r\n\r\n if (!fogColorInput) {\r\n fogColorInput = new InputBlock(\"fogColor\", undefined, NodeMaterialBlockConnectionPointTypes.Color3);\r\n fogColorInput.setAsSystemValue(NodeMaterialSystemValues.FogColor);\r\n }\r\n fogColorInput.output.connectTo(this.fogColor);\r\n }\r\n }\r\n\r\n public override prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines) {\r\n const scene = mesh.getScene();\r\n defines.setValue(\"FOG\", nodeMaterial.fogEnabled && GetFogState(mesh, scene));\r\n }\r\n\r\n public override bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n const scene = mesh.getScene();\r\n effect.setFloat4(this._fogParameters, scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n if (state.target === NodeMaterialBlockTargets.Fragment) {\r\n state.sharedData.blocksWithDefines.push(this);\r\n state.sharedData.bindableBlocks.push(this);\r\n\r\n let replaceStrings = [];\r\n let prefix1 = \"\";\r\n let prefix2 = \"\";\r\n\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n replaceStrings = [\r\n { search: /fn CalcFogFactor\\(\\)/, replace: \"fn CalcFogFactor(vFogDistance: vec3f, vFogInfos: vec4f)\" },\r\n { search: /uniforms.vFogInfos/g, replace: \"vFogInfos\" },\r\n { search: /fragmentInputs.vFogDistance/g, replace: \"vFogDistance\" },\r\n ];\r\n\r\n prefix1 = \"fragmentInputs.\";\r\n prefix2 = \"uniforms.\";\r\n } else {\r\n replaceStrings = [{ search: /float CalcFogFactor\\(\\)/, replace: \"float CalcFogFactor(vec3 vFogDistance, vec4 vFogInfos)\" }];\r\n }\r\n\r\n state._emitFunctionFromInclude(\"fogFragmentDeclaration\", `//${this.name}`, {\r\n removeUniforms: true,\r\n removeVaryings: true,\r\n removeIfDef: false,\r\n replaceStrings: replaceStrings,\r\n });\r\n\r\n const tempFogVariablename = state._getFreeVariableName(\"fog\");\r\n const color = this.input;\r\n const fogColor = this.fogColor;\r\n this._fogParameters = state._getFreeVariableName(\"fogParameters\");\r\n const output = this._outputs[0];\r\n\r\n state._emitUniformFromString(this._fogParameters, NodeMaterialBlockConnectionPointTypes.Vector4);\r\n\r\n state.compilationString += `#ifdef FOG\\n`;\r\n state.compilationString += `${state._declareLocalVar(tempFogVariablename, NodeMaterialBlockConnectionPointTypes.Float)} = CalcFogFactor(${prefix1}${this._fogDistanceName}, ${prefix2}${this._fogParameters});\\n`;\r\n state.compilationString +=\r\n state._declareOutput(output) +\r\n ` = ${tempFogVariablename} * ${color.associatedVariableName}.rgb + (1.0 - ${tempFogVariablename}) * ${fogColor.associatedVariableName}.rgb;\\n`;\r\n state.compilationString += `#else\\n${state._declareOutput(output)} = ${color.associatedVariableName}.rgb;\\n`;\r\n state.compilationString += `#endif\\n`;\r\n } else {\r\n const worldPos = this.worldPosition;\r\n const view = this.view;\r\n this._fogDistanceName = state._getFreeVariableName(\"vFogDistance\");\r\n state._emitVaryingFromString(this._fogDistanceName, NodeMaterialBlockConnectionPointTypes.Vector3);\r\n const prefix = state.shaderLanguage === ShaderLanguage.WGSL ? \"vertexOutputs.\" : \"\";\r\n state.compilationString += `${prefix}${this._fogDistanceName} = (${view.associatedVariableName} * ${worldPos.associatedVariableName}).xyz;\\n`;\r\n }\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.FogBlock\", FogBlock);\r\n"]}
|
|
@@ -7,3 +7,31 @@ export * from "./currentScreenBlock";
|
|
|
7
7
|
export * from "./sceneDepthBlock";
|
|
8
8
|
export * from "./imageSourceBlock";
|
|
9
9
|
export * from "./clipPlanesBlock";
|
|
10
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/clipPlaneFragment";
|
|
11
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration";
|
|
12
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/clipPlaneVertex";
|
|
13
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/clipPlaneVertexDeclaration";
|
|
14
|
+
export * from "../../../../Shaders/ShadersInclude/clipPlaneFragment";
|
|
15
|
+
export * from "../../../../Shaders/ShadersInclude/clipPlaneFragmentDeclaration";
|
|
16
|
+
export * from "../../../../Shaders/ShadersInclude/clipPlaneVertex";
|
|
17
|
+
export * from "../../../../Shaders/ShadersInclude/clipPlaneVertexDeclaration";
|
|
18
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/fogFragmentDeclaration";
|
|
19
|
+
export * from "../../../../Shaders/ShadersInclude/fogFragmentDeclaration";
|
|
20
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/lightFragment";
|
|
21
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/lightUboDeclaration";
|
|
22
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/lightVxUboDeclaration";
|
|
23
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/helperFunctions";
|
|
24
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/lightsFragmentFunctions";
|
|
25
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/shadowsFragmentFunctions";
|
|
26
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/shadowsVertex";
|
|
27
|
+
export * from "../../../../Shaders/ShadersInclude/lightFragmentDeclaration";
|
|
28
|
+
export * from "../../../../Shaders/ShadersInclude/lightFragment";
|
|
29
|
+
export * from "../../../../Shaders/ShadersInclude/lightUboDeclaration";
|
|
30
|
+
export * from "../../../../Shaders/ShadersInclude/lightVxUboDeclaration";
|
|
31
|
+
export * from "../../../../Shaders/ShadersInclude/lightVxFragmentDeclaration";
|
|
32
|
+
export * from "../../../../Shaders/ShadersInclude/helperFunctions";
|
|
33
|
+
export * from "../../../../Shaders/ShadersInclude/lightsFragmentFunctions";
|
|
34
|
+
export * from "../../../../Shaders/ShadersInclude/shadowsFragmentFunctions";
|
|
35
|
+
export * from "../../../../Shaders/ShadersInclude/shadowsVertex";
|
|
36
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/reflectionFunction";
|
|
37
|
+
export * from "../../../../Shaders/ShadersInclude/reflectionFunction";
|
|
@@ -7,4 +7,37 @@ export * from "./currentScreenBlock.js";
|
|
|
7
7
|
export * from "./sceneDepthBlock.js";
|
|
8
8
|
export * from "./imageSourceBlock.js";
|
|
9
9
|
export * from "./clipPlanesBlock.js";
|
|
10
|
+
// async-loaded shaders
|
|
11
|
+
// clipPlaneBlock
|
|
12
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/clipPlaneFragment.js";
|
|
13
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration.js";
|
|
14
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/clipPlaneVertex.js";
|
|
15
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/clipPlaneVertexDeclaration.js";
|
|
16
|
+
export * from "../../../../Shaders/ShadersInclude/clipPlaneFragment.js";
|
|
17
|
+
export * from "../../../../Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js";
|
|
18
|
+
export * from "../../../../Shaders/ShadersInclude/clipPlaneVertex.js";
|
|
19
|
+
export * from "../../../../Shaders/ShadersInclude/clipPlaneVertexDeclaration.js";
|
|
20
|
+
// fogBlock
|
|
21
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/fogFragmentDeclaration.js";
|
|
22
|
+
export * from "../../../../Shaders/ShadersInclude/fogFragmentDeclaration.js";
|
|
23
|
+
// lightBlock
|
|
24
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/lightFragment.js";
|
|
25
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/lightUboDeclaration.js";
|
|
26
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js";
|
|
27
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/helperFunctions.js";
|
|
28
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js";
|
|
29
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js";
|
|
30
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/shadowsVertex.js";
|
|
31
|
+
export * from "../../../../Shaders/ShadersInclude/lightFragmentDeclaration.js";
|
|
32
|
+
export * from "../../../../Shaders/ShadersInclude/lightFragment.js";
|
|
33
|
+
export * from "../../../../Shaders/ShadersInclude/lightUboDeclaration.js";
|
|
34
|
+
export * from "../../../../Shaders/ShadersInclude/lightVxUboDeclaration.js";
|
|
35
|
+
export * from "../../../../Shaders/ShadersInclude/lightVxFragmentDeclaration.js";
|
|
36
|
+
export * from "../../../../Shaders/ShadersInclude/helperFunctions.js";
|
|
37
|
+
export * from "../../../../Shaders/ShadersInclude/lightsFragmentFunctions.js";
|
|
38
|
+
export * from "../../../../Shaders/ShadersInclude/shadowsFragmentFunctions.js";
|
|
39
|
+
export * from "../../../../Shaders/ShadersInclude/shadowsVertex.js";
|
|
40
|
+
// reflectionTextureBlock
|
|
41
|
+
export * from "../../../../ShadersWGSL/ShadersInclude/reflectionFunction.js";
|
|
42
|
+
export * from "../../../../Shaders/ShadersInclude/reflectionFunction.js";
|
|
10
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/Dual/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC","sourcesContent":["export * from \"./fogBlock\";\r\nexport * from \"./lightBlock\";\r\nexport * from \"./textureBlock\";\r\nexport * from \"./reflectionTextureBaseBlock\";\r\nexport * from \"./reflectionTextureBlock\";\r\nexport * from \"./currentScreenBlock\";\r\nexport * from \"./sceneDepthBlock\";\r\nexport * from \"./imageSourceBlock\";\r\nexport * from \"./clipPlanesBlock\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/Dual/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAElC,uBAAuB;AAEvB,iBAAiB;AACjB,cAAc,0DAA0D,CAAC;AACzE,cAAc,qEAAqE,CAAC;AACpF,cAAc,wDAAwD,CAAC;AACvE,cAAc,mEAAmE,CAAC;AAClF,cAAc,sDAAsD,CAAC;AACrE,cAAc,iEAAiE,CAAC;AAChF,cAAc,oDAAoD,CAAC;AACnE,cAAc,+DAA+D,CAAC;AAE9E,WAAW;AACX,cAAc,+DAA+D,CAAC;AAC9E,cAAc,2DAA2D,CAAC;AAE1E,aAAa;AACb,cAAc,sDAAsD,CAAC;AACrE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,8DAA8D,CAAC;AAC7E,cAAc,wDAAwD,CAAC;AACvE,cAAc,gEAAgE,CAAC;AAC/E,cAAc,iEAAiE,CAAC;AAChF,cAAc,sDAAsD,CAAC;AACrE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,kDAAkD,CAAC;AACjE,cAAc,wDAAwD,CAAC;AACvE,cAAc,0DAA0D,CAAC;AACzE,cAAc,+DAA+D,CAAC;AAC9E,cAAc,oDAAoD,CAAC;AACnE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,6DAA6D,CAAC;AAC5E,cAAc,kDAAkD,CAAC;AAEjE,yBAAyB;AACzB,cAAc,2DAA2D,CAAC;AAC1E,cAAc,uDAAuD,CAAC","sourcesContent":["export * from \"./fogBlock\";\r\nexport * from \"./lightBlock\";\r\nexport * from \"./textureBlock\";\r\nexport * from \"./reflectionTextureBaseBlock\";\r\nexport * from \"./reflectionTextureBlock\";\r\nexport * from \"./currentScreenBlock\";\r\nexport * from \"./sceneDepthBlock\";\r\nexport * from \"./imageSourceBlock\";\r\nexport * from \"./clipPlanesBlock\";\r\n\r\n// async-loaded shaders\r\n\r\n// clipPlaneBlock\r\nexport * from \"../../../../ShadersWGSL/ShadersInclude/clipPlaneFragment\";\r\nexport * from \"../../../../ShadersWGSL/ShadersInclude/clipPlaneFragmentDeclaration\";\r\nexport * from \"../../../../ShadersWGSL/ShadersInclude/clipPlaneVertex\";\r\nexport * from \"../../../../ShadersWGSL/ShadersInclude/clipPlaneVertexDeclaration\";\r\nexport * from \"../../../../Shaders/ShadersInclude/clipPlaneFragment\";\r\nexport * from \"../../../../Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\r\nexport * from \"../../../../Shaders/ShadersInclude/clipPlaneVertex\";\r\nexport * from \"../../../../Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\r\n\r\n// fogBlock\r\nexport * from \"../../../../ShadersWGSL/ShadersInclude/fogFragmentDeclaration\";\r\nexport * from \"../../../../Shaders/ShadersInclude/fogFragmentDeclaration\";\r\n\r\n// lightBlock\r\nexport * from \"../../../../ShadersWGSL/ShadersInclude/lightFragment\";\r\nexport * from \"../../../../ShadersWGSL/ShadersInclude/lightUboDeclaration\";\r\nexport * from \"../../../../ShadersWGSL/ShadersInclude/lightVxUboDeclaration\";\r\nexport * from \"../../../../ShadersWGSL/ShadersInclude/helperFunctions\";\r\nexport * from \"../../../../ShadersWGSL/ShadersInclude/lightsFragmentFunctions\";\r\nexport * from \"../../../../ShadersWGSL/ShadersInclude/shadowsFragmentFunctions\";\r\nexport * from \"../../../../ShadersWGSL/ShadersInclude/shadowsVertex\";\r\nexport * from \"../../../../Shaders/ShadersInclude/lightFragmentDeclaration\";\r\nexport * from \"../../../../Shaders/ShadersInclude/lightFragment\";\r\nexport * from \"../../../../Shaders/ShadersInclude/lightUboDeclaration\";\r\nexport * from \"../../../../Shaders/ShadersInclude/lightVxUboDeclaration\";\r\nexport * from \"../../../../Shaders/ShadersInclude/lightVxFragmentDeclaration\";\r\nexport * from \"../../../../Shaders/ShadersInclude/helperFunctions\";\r\nexport * from \"../../../../Shaders/ShadersInclude/lightsFragmentFunctions\";\r\nexport * from \"../../../../Shaders/ShadersInclude/shadowsFragmentFunctions\";\r\nexport * from \"../../../../Shaders/ShadersInclude/shadowsVertex\";\r\n\r\n// reflectionTextureBlock\r\nexport * from \"../../../../ShadersWGSL/ShadersInclude/reflectionFunction\";\r\nexport * from \"../../../../Shaders/ShadersInclude/reflectionFunction\";\r\n"]}
|
|
@@ -8,15 +8,6 @@ import type { Mesh } from "../../../../Meshes/mesh";
|
|
|
8
8
|
import type { Light } from "../../../../Lights/light";
|
|
9
9
|
import type { Nullable } from "../../../../types";
|
|
10
10
|
import type { Scene } from "../../../../scene";
|
|
11
|
-
import "../../../../Shaders/ShadersInclude/lightFragmentDeclaration";
|
|
12
|
-
import "../../../../Shaders/ShadersInclude/lightVxFragmentDeclaration";
|
|
13
|
-
import "../../../../Shaders/ShadersInclude/lightUboDeclaration";
|
|
14
|
-
import "../../../../Shaders/ShadersInclude/lightVxUboDeclaration";
|
|
15
|
-
import "../../../../Shaders/ShadersInclude/lightFragment";
|
|
16
|
-
import "../../../../Shaders/ShadersInclude/helperFunctions";
|
|
17
|
-
import "../../../../Shaders/ShadersInclude/lightsFragmentFunctions";
|
|
18
|
-
import "../../../../Shaders/ShadersInclude/shadowsFragmentFunctions";
|
|
19
|
-
import "../../../../Shaders/ShadersInclude/shadowsVertex";
|
|
20
11
|
/**
|
|
21
12
|
* Block used to add light in the fragment shader
|
|
22
13
|
*/
|
|
@@ -84,6 +75,8 @@ export declare class LightBlock extends NodeMaterialBlock {
|
|
|
84
75
|
* Gets the shadow output component
|
|
85
76
|
*/
|
|
86
77
|
get shadow(): NodeMaterialConnectionPoint;
|
|
78
|
+
initialize(state: NodeMaterialBuildState): void;
|
|
79
|
+
private _initShaderSourceAsync;
|
|
87
80
|
autoConfigure(material: NodeMaterial, additionalFilteringInfo?: (node: NodeMaterialBlock) => boolean): void;
|
|
88
81
|
prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines): void;
|
|
89
82
|
updateUniformsAndSamples(state: NodeMaterialBuildState, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines, uniformBuffers: string[]): void;
|
|
@@ -6,15 +6,6 @@ import { NodeMaterialSystemValues } from "../../Enums/nodeMaterialSystemValues.j
|
|
|
6
6
|
import { InputBlock } from "../Input/inputBlock.js";
|
|
7
7
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
8
8
|
import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
|
|
9
|
-
import "../../../../Shaders/ShadersInclude/lightFragmentDeclaration.js";
|
|
10
|
-
import "../../../../Shaders/ShadersInclude/lightVxFragmentDeclaration.js";
|
|
11
|
-
import "../../../../Shaders/ShadersInclude/lightUboDeclaration.js";
|
|
12
|
-
import "../../../../Shaders/ShadersInclude/lightVxUboDeclaration.js";
|
|
13
|
-
import "../../../../Shaders/ShadersInclude/lightFragment.js";
|
|
14
|
-
import "../../../../Shaders/ShadersInclude/helperFunctions.js";
|
|
15
|
-
import "../../../../Shaders/ShadersInclude/lightsFragmentFunctions.js";
|
|
16
|
-
import "../../../../Shaders/ShadersInclude/shadowsFragmentFunctions.js";
|
|
17
|
-
import "../../../../Shaders/ShadersInclude/shadowsVertex.js";
|
|
18
9
|
import { Logger } from "../../../../Misc/logger.js";
|
|
19
10
|
import { BindLight, BindLights, PrepareDefinesForLight, PrepareDefinesForLights, PrepareUniformsAndSamplersForLight } from "../../../materialHelper.functions.js";
|
|
20
11
|
/**
|
|
@@ -130,6 +121,38 @@ export class LightBlock extends NodeMaterialBlock {
|
|
|
130
121
|
get shadow() {
|
|
131
122
|
return this._outputs[2];
|
|
132
123
|
}
|
|
124
|
+
initialize(state) {
|
|
125
|
+
this._initShaderSourceAsync(state.shaderLanguage);
|
|
126
|
+
}
|
|
127
|
+
async _initShaderSourceAsync(shaderLanguage) {
|
|
128
|
+
this._codeIsReady = false;
|
|
129
|
+
if (shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
130
|
+
await Promise.all([
|
|
131
|
+
import("../../../../ShadersWGSL/ShadersInclude/lightFragment.js"),
|
|
132
|
+
import("../../../../ShadersWGSL/ShadersInclude/lightUboDeclaration.js"),
|
|
133
|
+
import("../../../../ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js"),
|
|
134
|
+
import("../../../../ShadersWGSL/ShadersInclude/helperFunctions.js"),
|
|
135
|
+
import("../../../../ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js"),
|
|
136
|
+
import("../../../../ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js"),
|
|
137
|
+
import("../../../../ShadersWGSL/ShadersInclude/shadowsVertex.js"),
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
await Promise.all([
|
|
142
|
+
import("../../../../Shaders/ShadersInclude/lightFragmentDeclaration.js"),
|
|
143
|
+
import("../../../../Shaders/ShadersInclude/lightFragment.js"),
|
|
144
|
+
import("../../../../Shaders/ShadersInclude/lightUboDeclaration.js"),
|
|
145
|
+
import("../../../../Shaders/ShadersInclude/lightVxUboDeclaration.js"),
|
|
146
|
+
import("../../../../Shaders/ShadersInclude/lightVxFragmentDeclaration.js"),
|
|
147
|
+
import("../../../../Shaders/ShadersInclude/helperFunctions.js"),
|
|
148
|
+
import("../../../../Shaders/ShadersInclude/lightsFragmentFunctions.js"),
|
|
149
|
+
import("../../../../Shaders/ShadersInclude/shadowsFragmentFunctions.js"),
|
|
150
|
+
import("../../../../Shaders/ShadersInclude/shadowsVertex.js"),
|
|
151
|
+
]);
|
|
152
|
+
}
|
|
153
|
+
this._codeIsReady = true;
|
|
154
|
+
this.onCodeIsReadyObservable.notifyObservers(this);
|
|
155
|
+
}
|
|
133
156
|
autoConfigure(material, additionalFilteringInfo = () => true) {
|
|
134
157
|
if (!this.cameraPosition.isConnected) {
|
|
135
158
|
let cameraPositionInput = material.getInputBlockByPredicate((b) => b.systemValue === NodeMaterialSystemValues.CameraPosition && additionalFilteringInfo(b));
|