@babylonjs/core 7.11.4 → 7.13.0
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/Actions/abstractActionManager.d.ts +1 -1
- package/Actions/abstractActionManager.js +1 -1
- package/Actions/abstractActionManager.js.map +1 -1
- package/Animations/animation.js +1 -2
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroupMask.d.ts +1 -1
- package/Animations/animationGroupMask.js +2 -2
- package/Animations/animationGroupMask.js.map +1 -1
- package/Animations/animationKey.d.ts +1 -1
- package/Animations/animationKey.js.map +1 -1
- package/Behaviors/Meshes/handConstraintBehavior.d.ts +3 -3
- package/Behaviors/Meshes/handConstraintBehavior.js +16 -17
- package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
- package/Behaviors/Meshes/sixDofDragBehavior.js +2 -3
- package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
- package/Bones/bone.js +31 -32
- package/Bones/bone.js.map +1 -1
- package/Bones/boneIKController.js +5 -6
- package/Bones/boneIKController.js.map +1 -1
- package/Bones/boneLookController.js +13 -13
- package/Bones/boneLookController.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseWheelInput.js +5 -6
- package/Cameras/Inputs/freeCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraVirtualJoystickInput.js +5 -5
- package/Cameras/Inputs/freeCameraVirtualJoystickInput.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.js +8 -10
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Compute/computeEffect.js +2 -3
- package/Compute/computeEffect.js.map +1 -1
- package/Compute/computeShader.js +19 -20
- package/Compute/computeShader.js.map +1 -1
- package/Culling/Helper/IBoundingInfoHelperPlatform.d.ts +4 -0
- package/Culling/Helper/IBoundingInfoHelperPlatform.js.map +1 -1
- package/Culling/Helper/boundingInfoHelper.d.ts +26 -4
- package/Culling/Helper/boundingInfoHelper.js +41 -10
- package/Culling/Helper/boundingInfoHelper.js.map +1 -1
- package/Culling/Helper/computeShaderBoundingHelper.d.ts +12 -3
- package/Culling/Helper/computeShaderBoundingHelper.js +164 -76
- package/Culling/Helper/computeShaderBoundingHelper.js.map +1 -1
- package/Culling/Helper/transformFeedbackBoundingHelper.d.ts +11 -0
- package/Culling/Helper/transformFeedbackBoundingHelper.js +46 -14
- package/Culling/Helper/transformFeedbackBoundingHelper.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Decorators/nodeDecorator.d.ts +1 -1
- package/Decorators/nodeDecorator.js +1 -1
- package/Decorators/nodeDecorator.js.map +1 -1
- package/DeviceInput/InputDevices/deviceEnums.d.ts +5 -5
- package/DeviceInput/InputDevices/deviceEnums.js.map +1 -1
- package/DeviceInput/eventFactory.js +3 -3
- package/DeviceInput/eventFactory.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +2 -2
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.computeShader.d.ts +1 -1
- package/Engines/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/Extensions/engine.cubeTexture.js +2 -2
- package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.dynamicTexture.js +2 -2
- package/Engines/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js +3 -3
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.multiview.js +2 -2
- package/Engines/Extensions/engine.multiview.js.map +1 -1
- package/Engines/Extensions/engine.prefilteredCubeTexture.js +3 -3
- package/Engines/Extensions/engine.prefilteredCubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.js +4 -4
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +3 -3
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Extensions/engine.renderTargetCube.js +2 -2
- package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/Native/nativeShaderProcessors.js +1 -2
- package/Engines/Native/nativeShaderProcessors.js.map +1 -1
- package/Engines/Processors/shaderProcessor.js +2 -3
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGL/webGL2ShaderProcessors.js +1 -2
- package/Engines/WebGL/webGL2ShaderProcessors.js.map +1 -1
- package/Engines/WebGL/webGLShaderProcessors.js +1 -2
- package/Engines/WebGL/webGLShaderProcessors.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.computeShader.js +1 -2
- package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js +2 -2
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +2 -2
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js +2 -2
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.js +5 -5
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +3 -3
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js +2 -2
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +81 -82
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +60 -64
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.js +1 -2
- package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
- package/Engines/WebGPU/webgpuComputeContext.js +13 -15
- package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
- package/Engines/WebGPU/webgpuConstants.d.ts +39 -39
- package/Engines/WebGPU/webgpuConstants.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +6 -8
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -2
- package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
- package/Engines/WebGPU/webgpuQuerySet.js +3 -3
- package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessor.js +15 -19
- package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +8 -10
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +26 -28
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +413 -416
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +50 -51
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/WebGPU/webgpuTimestampQuery.js +1 -2
- package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
- package/Engines/abstractEngine.js +4 -4
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.js +2 -2
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.js +9 -9
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +5 -5
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.js +1 -2
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/shaderStore.js +6 -7
- package/Engines/shaderStore.js.map +1 -1
- package/Engines/thinEngine.js +4 -5
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +11 -0
- package/Engines/webgpuEngine.js +91 -72
- package/Engines/webgpuEngine.js.map +1 -1
- package/Events/deviceInputEvents.d.ts +1 -1
- package/Events/deviceInputEvents.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +1 -1
- package/FlowGraph/flowGraph.js +5 -5
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphBlock.js +2 -3
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +1 -1
- package/FlowGraph/flowGraphConnection.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.js +3 -3
- package/FlowGraph/flowGraphDataConnection.js.map +1 -1
- package/FlowGraph/flowGraphExecutionBlock.js +2 -3
- package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphSignalConnection.js +3 -3
- package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
- package/Gamepads/dualShockGamepad.d.ts +2 -2
- package/Gamepads/dualShockGamepad.js +14 -14
- package/Gamepads/dualShockGamepad.js.map +1 -1
- package/Gamepads/xboxGamepad.d.ts +2 -2
- package/Gamepads/xboxGamepad.js +14 -14
- package/Gamepads/xboxGamepad.js.map +1 -1
- package/Gizmos/gizmo.d.ts +2 -2
- package/Gizmos/gizmo.js +4 -4
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/gizmoManager.js +2 -2
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/scaleGizmo.js +3 -3
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Loading/sceneLoader.d.ts +1 -1
- package/Loading/sceneLoader.js +6 -6
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +3 -3
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +10 -11
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +8 -9
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js +3 -4
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js +2 -3
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +1 -2
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +5 -6
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +4 -5
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +7 -8
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.js +4 -6
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.js +2 -4
- package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/derivativeBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/derivativeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragDepthBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/fragDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +5 -6
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/frontFacingBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +5 -6
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +3 -4
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +7 -9
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +19 -21
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js +3 -4
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js +2 -3
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +4 -5
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js +1 -2
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +28 -29
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +4 -5
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js +5 -6
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.js +4 -5
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +2 -3
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +1 -2
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +1 -2
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +1 -2
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js +1 -2
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/arcTan2Block.js +1 -2
- package/Materials/Node/Blocks/arcTan2Block.js.map +1 -1
- package/Materials/Node/Blocks/biPlanarBlock.js +3 -4
- package/Materials/Node/Blocks/biPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/clampBlock.js +4 -5
- package/Materials/Node/Blocks/clampBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js +3 -4
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/curveBlock.js +1 -2
- package/Materials/Node/Blocks/curveBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.js +1 -2
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -2
- package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.d.ts +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js +35 -35
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
- package/Materials/Node/Blocks/modBlock.js +1 -2
- package/Materials/Node/Blocks/modBlock.js.map +1 -1
- package/Materials/Node/Blocks/remapBlock.js +3 -3
- package/Materials/Node/Blocks/remapBlock.js.map +1 -1
- package/Materials/Node/Blocks/simplexPerlin3DBlock.js +1 -2
- package/Materials/Node/Blocks/simplexPerlin3DBlock.js.map +1 -1
- package/Materials/Node/Blocks/transformBlock.js +1 -2
- package/Materials/Node/Blocks/transformBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js +10 -12
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/voronoiNoiseBlock.js +3 -4
- package/Materials/Node/Blocks/voronoiNoiseBlock.js.map +1 -1
- package/Materials/Node/Blocks/waveBlock.d.ts +1 -1
- package/Materials/Node/Blocks/waveBlock.js +4 -4
- package/Materials/Node/Blocks/waveBlock.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.js +3 -4
- package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
- package/Materials/Node/Enums/nodeMaterialBlockConnectionPointMode.d.ts +1 -1
- package/Materials/Node/Enums/nodeMaterialBlockConnectionPointMode.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +3 -4
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.js +5 -6
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +2 -2
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +10 -10
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +18 -19
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Node/nodeMaterialConnectionPointCustomObject.js +3 -3
- package/Materials/Node/nodeMaterialConnectionPointCustomObject.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +3 -4
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +1 -1
- package/Materials/Textures/internalTexture.js +13 -13
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/ktx2decoderTypes.d.ts +1 -1
- package/Materials/Textures/ktx2decoderTypes.js.map +1 -1
- package/Materials/Textures/rawCubeTexture.js +1 -2
- package/Materials/Textures/rawCubeTexture.js.map +1 -1
- package/Materials/effect.functions.js +2 -3
- package/Materials/effect.functions.js.map +1 -1
- package/Materials/effect.js +3 -4
- package/Materials/effect.js.map +1 -1
- package/Materials/effect.webgl.functions.js +1 -2
- package/Materials/effect.webgl.functions.js.map +1 -1
- package/Materials/material.js +7 -9
- package/Materials/material.js.map +1 -1
- package/Materials/materialPluginEvent.d.ts +1 -1
- package/Materials/materialPluginEvent.js.map +1 -1
- package/Materials/materialPluginManager.js +9 -11
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/meshDebugPluginMaterial.d.ts +1 -1
- package/Materials/meshDebugPluginMaterial.js +2 -2
- package/Materials/meshDebugPluginMaterial.js.map +1 -1
- package/Materials/shaderLanguage.d.ts +1 -1
- package/Materials/shaderLanguage.js.map +1 -1
- package/Materials/shadowDepthWrapper.js +1 -2
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Materials/standardMaterial.js +2 -3
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/math.axis.d.ts +2 -2
- package/Maths/math.axis.js.map +1 -1
- package/Maths/math.path.d.ts +1 -1
- package/Maths/math.path.js +3 -3
- package/Maths/math.path.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.d.ts +2 -2
- package/Meshes/Builders/greasedLineBuilder.js +21 -23
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +3 -3
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +14 -14
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +2 -2
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +2 -2
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +3 -3
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +3 -3
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setColorsBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js +2 -2
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.js +3 -3
- package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.js +2 -2
- package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +2 -2
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +2 -2
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
- package/Meshes/Node/Blocks/booleanGeometryBlock.js +3 -3
- package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/conditionBlock.js +2 -2
- package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryClampBlock.js +3 -3
- package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCollectionBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCurveBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js +3 -3
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mappingBlock.js +2 -2
- package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mathBlock.js +2 -2
- package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.js +2 -2
- package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.js +2 -2
- package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.js +3 -3
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +2 -2
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +7 -7
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/abstractMesh.js +4 -5
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/mesh.js +1 -2
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/meshSimplification.d.ts +1 -1
- package/Meshes/meshSimplification.js +1 -1
- package/Meshes/meshSimplification.js.map +1 -1
- package/Meshes/meshSimplificationSceneComponent.js +2 -2
- package/Meshes/meshSimplificationSceneComponent.js.map +1 -1
- package/Meshes/transformNode.js +7 -8
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/assetsManager.d.ts +1 -1
- package/Misc/assetsManager.js +9 -9
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/basis.js +2 -2
- package/Misc/basis.js.map +1 -1
- package/Misc/copyTextureToTexture.d.ts +1 -1
- package/Misc/copyTextureToTexture.js +1 -1
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Misc/environmentTextureTools.js +3 -3
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/iInspectable.d.ts +1 -1
- package/Misc/iInspectable.js.map +1 -1
- package/Misc/khronosTextureContainer2.js +2 -2
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/timer.d.ts +1 -1
- package/Misc/timer.js +5 -5
- package/Misc/timer.js.map +1 -1
- package/Misc/virtualJoystick.d.ts +1 -1
- package/Misc/virtualJoystick.js +16 -16
- package/Misc/virtualJoystick.js.map +1 -1
- package/Particles/particleSystem.js +3 -3
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/particleSystemComponent.js +1 -2
- package/Particles/particleSystemComponent.js.map +1 -1
- package/Particles/pointsCloudSystem.d.ts +1 -1
- package/Particles/pointsCloudSystem.js +14 -14
- package/Particles/pointsCloudSystem.js.map +1 -1
- package/Particles/subEmitter.d.ts +1 -1
- package/Particles/subEmitter.js +1 -1
- package/Particles/subEmitter.js.map +1 -1
- package/Physics/physicsHelper.d.ts +2 -2
- package/Physics/physicsHelper.js +6 -7
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/v1/physicsImpostor.js +4 -5
- package/Physics/v1/physicsImpostor.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +16 -8
- package/Physics/v2/IPhysicsEnginePlugin.js +9 -0
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +96 -79
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsAggregate.js +8 -9
- package/Physics/v2/physicsAggregate.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +14 -2
- package/Physics/v2/physicsBody.js +30 -11
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Physics/v2/physicsConstraint.js +8 -9
- package/Physics/v2/physicsConstraint.js.map +1 -1
- package/Physics/v2/physicsMaterial.d.ts +1 -1
- package/Physics/v2/physicsMaterial.js.map +1 -1
- package/Physics/v2/physicsShape.js +9 -10
- package/Physics/v2/physicsShape.js.map +1 -1
- package/Physics/v2/ragdoll.js +11 -12
- package/Physics/v2/ragdoll.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +2 -2
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/depthOfFieldEffect.d.ts +1 -1
- package/PostProcesses/depthOfFieldEffect.js +3 -3
- package/PostProcesses/depthOfFieldEffect.js.map +1 -1
- package/PostProcesses/postProcess.js +2 -3
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/tonemapPostProcess.d.ts +1 -1
- package/PostProcesses/tonemapPostProcess.js +4 -4
- package/PostProcesses/tonemapPostProcess.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +10 -10
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
- package/Shaders/spriteMap.fragment.js +3 -2
- package/Shaders/spriteMap.fragment.js.map +1 -1
- package/ShadersWGSL/boundingInfo.compute.js +8 -8
- package/ShadersWGSL/boundingInfo.compute.js.map +1 -1
- package/XR/features/WebXRDepthSensing.js +2 -2
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +2 -2
- package/XR/features/WebXRHandTracking.js +76 -76
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRLightEstimation.js +2 -2
- package/XR/features/WebXRLightEstimation.js.map +1 -1
- package/XR/features/WebXRNearInteraction.d.ts +1 -1
- package/XR/features/WebXRNearInteraction.js +5 -5
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/features/WebXRRawCameraAccess.js +2 -2
- package/XR/features/WebXRRawCameraAccess.js.map +1 -1
- package/XR/motionController/webXRProfiledMotionController.js +2 -2
- package/XR/motionController/webXRProfiledMotionController.js.map +1 -1
- package/XR/webXRCamera.js +3 -4
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXREnterExitUI.js +3 -4
- package/XR/webXREnterExitUI.js.map +1 -1
- package/XR/webXRExperienceHelper.js +12 -13
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRManagedOutputCanvas.d.ts +1 -1
- package/XR/webXRManagedOutputCanvas.js +15 -6
- package/XR/webXRManagedOutputCanvas.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.js +2 -2
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/XR/webXRTypes.d.ts +2 -2
- package/XR/webXRTypes.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +1 -1
- package/scene.js +4 -4
- package/scene.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLinePluginMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLinePluginMaterial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI9D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,oCAAoC,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AACjH,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,eAAe;IAA/D;;QACI;;WAEG;QACH,gEAAgE;QAChE,2BAAsB,GAAG,KAAK,CAAC;QAC/B;;WAEG;QACH,gEAAgE;QAChE,kCAA6B,GAAG,KAAK,CAAC;QACtC;;WAEG;QACH,gEAAgE;QAChE,8CAAyC,GAAG,KAAK,CAAC;QAClD;;WAEG;QACH,gEAAgE;QAChE,gDAA2C,GAAG,KAAK,CAAC;QAEpD;;WAEG;QACH,gEAAgE;QAChE,+BAA0B,GAAG,IAAI,CAAC;IACtC,CAAC;CAAA;AAED;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,kBAAkB;IAoE7D;;;;;OAKG;IACH,YAAY,QAAk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BAA0B,EAAE,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport { RawTexture } from \"../Textures/rawTexture\";\r\nimport { MaterialPluginBase } from \"../materialPluginBase\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { UniformBuffer } from \"../uniformBuffer\";\r\nimport { Vector2, TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Material } from \"../material\";\r\nimport { MaterialDefines } from \"../materialDefines\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { BaseTexture } from \"../Textures/baseTexture\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport type { GreasedLineMaterialOptions, IGreasedLineMaterial } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMaterialDefaults } from \"./greasedLineMaterialDefaults\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class MaterialGreasedLineDefines extends MaterialDefines {\r\n /**\r\n * The material has a color option specified\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_HAS_COLOR = false;\r\n /**\r\n * The material's size attenuation optiom\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_SIZE_ATTENUATION = false;\r\n /**\r\n * The type of color distribution is set to line this value equals to true.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = false;\r\n /**\r\n * True if scene is in right handed coordinate system.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = false;\r\n\r\n /**\r\n * True if the line is in camera facing mode\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_CAMERA_FACING = true;\r\n}\r\n\r\n/**\r\n * GreasedLinePluginMaterial for GreasedLineMesh/GreasedLineRibbonMesh.\r\n * Use the GreasedLineBuilder.CreateGreasedLineMaterial function to create and instance of this class.\r\n */\r\nexport class GreasedLinePluginMaterial extends MaterialPluginBase implements IGreasedLineMaterial {\r\n /**\r\n * Plugin name\r\n */\r\n public static readonly GREASED_LINE_MATERIAL_NAME = \"GreasedLinePluginMaterial\";\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n public useColors: boolean;\r\n\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 public visibility: number;\r\n\r\n /**\r\n * Dash offset\r\n */\r\n public 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 public dashRatio: 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 public width: number;\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n public colorsSampling: number;\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n public useDash: boolean;\r\n\r\n /**\r\n * The mixing mode of the color paramater. Default value is GreasedLineMeshColorMode.SET\r\n * @see GreasedLineMeshColorMode\r\n */\r\n public colorMode: GreasedLineMeshColorMode;\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 public colorsTexture: Nullable<RawTexture> = null;\r\n\r\n private _scene: Scene;\r\n private _dashCount: number;\r\n private _dashArray: number;\r\n private _color: Nullable<Color3>;\r\n private _colors: Nullable<Color3[]>;\r\n private _colorsDistributionType: GreasedLineMeshColorDistributionType;\r\n private _resolution: Vector2;\r\n private _aspect: number;\r\n private _sizeAttenuation: boolean;\r\n\r\n private _cameraFacing: boolean;\r\n\r\n private _engine: AbstractEngine;\r\n\r\n /**\r\n * Creates a new instance of the GreasedLinePluginMaterial\r\n * @param material base material for the plugin\r\n * @param scene the scene\r\n * @param options plugin options\r\n */\r\n constructor(material: Material, scene?: Scene, options?: GreasedLineMaterialOptions) {\r\n options = options || {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n\r\n const defines = new MaterialGreasedLineDefines();\r\n defines.GREASED_LINE_HAS_COLOR = !!options.color && !options.useColors;\r\n defines.GREASED_LINE_SIZE_ATTENUATION = options.sizeAttenuation ?? false;\r\n defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = options.colorDistributionType === GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE;\r\n defines.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = (scene ?? material.getScene()).useRightHandedSystem;\r\n defines.GREASED_LINE_CAMERA_FACING = options.cameraFacing ?? true;\r\n super(material, GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME, 200, defines);\r\n\r\n this._scene = scene ?? material.getScene();\r\n this._engine = this._scene.getEngine();\r\n\r\n this._cameraFacing = options.cameraFacing ?? true;\r\n\r\n this.visibility = options.visibility ?? 1;\r\n this.useDash = options.useDash ?? false;\r\n this.dashRatio = options.dashRatio ?? 0.5;\r\n this.dashOffset = options.dashOffset ?? 0;\r\n this.width = options.width ? options.width : options.sizeAttenuation ? GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED : GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n this._sizeAttenuation = options.sizeAttenuation ?? false;\r\n this.colorMode = options.colorMode ?? GreasedLineMeshColorMode.COLOR_MODE_SET;\r\n this._color = options.color ?? null;\r\n this.useColors = options.useColors ?? false;\r\n this._colorsDistributionType = options.colorDistributionType ?? GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n this.colorsSampling = options.colorsSampling ?? RawTexture.NEAREST_NEAREST;\r\n this._colors = options.colors ?? null;\r\n\r\n this.dashCount = options.dashCount ?? 1; // calculate the _dashArray value, call the setter\r\n this.resolution = options.resolution ?? new Vector2(this._engine.getRenderWidth(), this._engine.getRenderHeight()); // calculate aspect call the setter\r\n\r\n if (options.colorsTexture) {\r\n this.colorsTexture = options.colorsTexture; // colorsTexture from options takes precedence\r\n } else {\r\n if (this._colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${material.name}-colors-texture`, this._colors, this.colorsSampling, this._scene);\r\n } else {\r\n this._color = this._color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR;\r\n GreasedLineTools.PrepareEmptyColorsTexture(this._scene);\r\n }\r\n }\r\n\r\n this._engine.onDisposeObservable.add(() => {\r\n GreasedLineTools.DisposeEmptyColorsTexture();\r\n });\r\n\r\n this._enable(true); // always enabled\r\n }\r\n\r\n /**\r\n * Get the shader attributes\r\n * @param attributes array which will be filled with the attributes\r\n */\r\n override getAttributes(attributes: string[]) {\r\n attributes.push(\"grl_offsets\");\r\n attributes.push(\"grl_widths\");\r\n attributes.push(\"grl_colorPointers\");\r\n attributes.push(\"grl_counters\");\r\n if (this._cameraFacing) {\r\n attributes.push(\"grl_previousAndSide\");\r\n attributes.push(\"grl_nextAndCounters\");\r\n } else {\r\n attributes.push(\"grl_slopes\");\r\n }\r\n }\r\n\r\n /**\r\n * Get the shader samplers\r\n * @param samplers\r\n */\r\n override getSamplers(samplers: string[]) {\r\n samplers.push(\"grl_colors\");\r\n }\r\n\r\n /**\r\n * Get the shader textures\r\n * @param activeTextures array which will be filled with the textures\r\n */\r\n public override getActiveTextures(activeTextures: BaseTexture[]): void {\r\n if (this.colorsTexture) {\r\n activeTextures.push(this.colorsTexture);\r\n }\r\n }\r\n\r\n /**\r\n * Get the shader uniforms\r\n * @returns uniforms\r\n */\r\n override getUniforms() {\r\n const ubo = [\r\n { name: \"grl_singleColor\", size: 3, type: \"vec3\" },\r\n { name: \"grl_textureSize\", size: 2, type: \"vec2\" },\r\n { name: \"grl_dashOptions\", size: 4, type: \"vec4\" },\r\n { name: \"grl_colorMode_visibility_colorsWidth_useColors\", size: 4, type: \"vec4\" },\r\n ];\r\n if (this._cameraFacing) {\r\n ubo.push({ name: \"grl_projection\", size: 16, type: \"mat4\" }, { name: \"grl_aspect_resolution_lineWidth\", size: 4, type: \"vec4\" });\r\n }\r\n\r\n return {\r\n ubo,\r\n vertex: this._cameraFacing\r\n ? `\r\n uniform vec4 grl_aspect_resolution_lineWidth;\r\n uniform mat4 grl_projection;\r\n `\r\n : \"\",\r\n fragment: `\r\n uniform vec4 grl_dashOptions;\r\n uniform vec2 grl_textureSize;\r\n uniform vec4 grl_colorMode_visibility_colorsWidth_useColors;\r\n uniform vec3 grl_singleColor;\r\n `,\r\n };\r\n }\r\n\r\n // only getter, it doesn't make sense to use this plugin on a mesh other than GreasedLineMesh\r\n // and it doesn't make sense to disable it on the mesh\r\n get isEnabled() {\r\n return true;\r\n }\r\n\r\n /**\r\n * Bind the uniform buffer\r\n * @param uniformBuffer\r\n */\r\n override bindForSubMesh(uniformBuffer: UniformBuffer) {\r\n if (this._cameraFacing) {\r\n const activeCamera = this._scene.activeCamera;\r\n\r\n if (activeCamera) {\r\n const projection = activeCamera.getProjectionMatrix();\r\n uniformBuffer.updateMatrix(\"grl_projection\", projection);\r\n } else {\r\n throw Error(\"GreasedLinePluginMaterial requires an active camera.\");\r\n }\r\n\r\n const resolutionLineWidth = TmpVectors.Vector4[0];\r\n resolutionLineWidth.x = this._aspect;\r\n resolutionLineWidth.y = this._resolution.x;\r\n resolutionLineWidth.z = this._resolution.y;\r\n resolutionLineWidth.w = this.width;\r\n uniformBuffer.updateVector4(\"grl_aspect_resolution_lineWidth\", resolutionLineWidth);\r\n }\r\n\r\n const dashOptions = TmpVectors.Vector4[0];\r\n dashOptions.x = GreasedLineTools.BooleanToNumber(this.useDash);\r\n dashOptions.y = this._dashArray;\r\n dashOptions.z = this.dashOffset;\r\n dashOptions.w = this.dashRatio;\r\n uniformBuffer.updateVector4(\"grl_dashOptions\", dashOptions);\r\n\r\n const colorModeVisibilityColorsWidthUseColors = TmpVectors.Vector4[1];\r\n colorModeVisibilityColorsWidthUseColors.x = this.colorMode;\r\n colorModeVisibilityColorsWidthUseColors.y = this.visibility;\r\n colorModeVisibilityColorsWidthUseColors.z = this.colorsTexture ? this.colorsTexture.getSize().width : 0;\r\n colorModeVisibilityColorsWidthUseColors.w = GreasedLineTools.BooleanToNumber(this.useColors);\r\n uniformBuffer.updateVector4(\"grl_colorMode_visibility_colorsWidth_useColors\", colorModeVisibilityColorsWidthUseColors);\r\n\r\n if (this._color) {\r\n uniformBuffer.updateColor3(\"grl_singleColor\", this._color);\r\n }\r\n const texture = this.colorsTexture ?? GreasedLineMaterialDefaults.EmptyColorsTexture;\r\n uniformBuffer.setTexture(\"grl_colors\", texture);\r\n uniformBuffer.updateFloat2(\"grl_textureSize\", texture?.getSize().width ?? 1, texture?.getSize().height ?? 1);\r\n }\r\n\r\n /**\r\n * Prepare the defines\r\n * @param defines\r\n * @param _scene\r\n * @param _mesh\r\n */\r\n override prepareDefines(defines: MaterialGreasedLineDefines, _scene: Scene, _mesh: AbstractMesh) {\r\n defines.GREASED_LINE_HAS_COLOR = !!this.color && !this.useColors;\r\n defines.GREASED_LINE_SIZE_ATTENUATION = this._sizeAttenuation;\r\n defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = this._colorsDistributionType === GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE;\r\n defines.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = _scene.useRightHandedSystem;\r\n defines.GREASED_LINE_CAMERA_FACING = this._cameraFacing;\r\n }\r\n\r\n /**\r\n * Get the class name\r\n * @returns class name\r\n */\r\n override getClassName() {\r\n return GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME;\r\n }\r\n\r\n /**\r\n * Get shader code\r\n * @param shaderType vertex/fragment\r\n * @returns shader code\r\n */\r\n override getCustomCode(shaderType: string): Nullable<{ [pointName: string]: string }> {\r\n if (shaderType === \"vertex\") {\r\n const obj: any = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_DEFINITIONS: `\r\n attribute float grl_widths;\r\n attribute vec3 grl_offsets;\r\n attribute float grl_colorPointers;\r\n varying float grlCounters;\r\n varying float grlColorPointer;\r\n\r\n #ifdef GREASED_LINE_CAMERA_FACING\r\n attribute vec4 grl_previousAndSide;\r\n attribute vec4 grl_nextAndCounters;\r\n\r\n vec2 grlFix( vec4 i, float aspect ) {\r\n vec2 res = i.xy / i.w;\r\n res.x *= aspect;\r\n return res;\r\n }\r\n #else\r\n attribute vec3 grl_slopes;\r\n attribute float grl_counters;\r\n #endif\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_UPDATE_POSITION: `\r\n #ifdef GREASED_LINE_CAMERA_FACING\r\n vec3 grlPositionOffset = grl_offsets;\r\n positionUpdated += grlPositionOffset;\r\n #else\r\n positionUpdated = (positionUpdated + grl_offsets) + (grl_slopes * grl_widths);\r\n #endif\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_MAIN_END: `\r\n grlColorPointer = grl_colorPointers;\r\n\r\n #ifdef GREASED_LINE_CAMERA_FACING\r\n\r\n float grlAspect = grl_aspect_resolution_lineWidth.x;\r\n float grlBaseWidth = grl_aspect_resolution_lineWidth.w;\r\n\r\n\r\n vec3 grlPrevious = grl_previousAndSide.xyz;\r\n float grlSide = grl_previousAndSide.w;\r\n\r\n vec3 grlNext = grl_nextAndCounters.xyz;\r\n grlCounters = grl_nextAndCounters.w;\r\n\r\n mat4 grlMatrix = viewProjection * finalWorld;\r\n vec4 grlFinalPosition = grlMatrix * vec4( positionUpdated , 1.0 );\r\n vec4 grlPrevPos = grlMatrix * vec4( grlPrevious + grlPositionOffset, 1.0 );\r\n vec4 grlNextPos = grlMatrix * vec4( grlNext + grlPositionOffset, 1.0 );\r\n\r\n vec2 grlCurrentP = grlFix( grlFinalPosition, grlAspect );\r\n vec2 grlPrevP = grlFix( grlPrevPos, grlAspect );\r\n vec2 grlNextP = grlFix( grlNextPos, grlAspect );\r\n\r\n float grlWidth = grlBaseWidth * grl_widths;\r\n\r\n vec2 grlDir;\r\n if( grlNextP == grlCurrentP ) grlDir = normalize( grlCurrentP - grlPrevP );\r\n else if( grlPrevP == grlCurrentP ) grlDir = normalize( grlNextP - grlCurrentP );\r\n else {\r\n vec2 grlDir1 = normalize( grlCurrentP - grlPrevP );\r\n vec2 grlDir2 = normalize( grlNextP - grlCurrentP );\r\n grlDir = normalize( grlDir1 + grlDir2 );\r\n }\r\n vec4 grlNormal = vec4( -grlDir.y, grlDir.x, 0., 1. );\r\n #ifdef GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\r\n grlNormal.xy *= -.5 * grlWidth;\r\n #else\r\n grlNormal.xy *= .5 * grlWidth;\r\n #endif\r\n\r\n grlNormal *= grl_projection;\r\n\r\n #ifdef GREASED_LINE_SIZE_ATTENUATION\r\n grlNormal.xy *= grlFinalPosition.w;\r\n grlNormal.xy /= ( vec4( grl_aspect_resolution_lineWidth.yz, 0., 1. ) * grl_projection ).xy;\r\n #endif\r\n\r\n grlFinalPosition.xy += grlNormal.xy * grlSide;\r\n gl_Position = grlFinalPosition;\r\n\r\n vPositionW = vec3(grlFinalPosition);\r\n #else\r\n grlCounters = grl_counters;\r\n #endif\r\n `,\r\n };\r\n this._cameraFacing && (obj[\"!gl_Position\\\\=viewProjection\\\\*worldPos;\"] = \"//\"); // not needed for camera facing GRL\r\n return obj;\r\n }\r\n\r\n if (shaderType === \"fragment\") {\r\n return {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_DEFINITIONS: `\r\n varying float grlCounters;\r\n varying float grlColorPointer;\r\n uniform sampler2D grl_colors;\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_MAIN_END: `\r\n float grlColorMode = grl_colorMode_visibility_colorsWidth_useColors.x;\r\n float grlVisibility = grl_colorMode_visibility_colorsWidth_useColors.y;\r\n float grlColorsWidth = grl_colorMode_visibility_colorsWidth_useColors.z;\r\n float grlUseColors = grl_colorMode_visibility_colorsWidth_useColors.w;\r\n\r\n float grlUseDash = grl_dashOptions.x;\r\n float grlDashArray = grl_dashOptions.y;\r\n float grlDashOffset = grl_dashOptions.z;\r\n float grlDashRatio = grl_dashOptions.w;\r\n\r\n gl_FragColor.a *= step(grlCounters, grlVisibility);\r\n if( gl_FragColor.a == 0. ) discard;\r\n\r\n if(grlUseDash == 1.){\r\n gl_FragColor.a *= ceil(mod(grlCounters + grlDashOffset, grlDashArray) - (grlDashArray * grlDashRatio));\r\n if (gl_FragColor.a == 0.) discard;\r\n }\r\n\r\n #ifdef GREASED_LINE_HAS_COLOR\r\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\r\n gl_FragColor.rgb = grl_singleColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\r\n gl_FragColor.rgb += grl_singleColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\r\n gl_FragColor.rgb *= grl_singleColor;\r\n }\r\n #else\r\n if (grlUseColors == 1.) {\r\n #ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\r\n vec4 grlColor = texture2D(grl_colors, vec2(grlCounters, 0.), 0.);\r\n #else\r\n vec2 lookup = vec2(fract(grlColorPointer / grl_textureSize.x), 1.0 - floor(grlColorPointer / grl_textureSize.x) / max(grl_textureSize.y - 1.0, 1.0));\r\n vec4 grlColor = texture2D(grl_colors, lookup, 0.0);\r\n #endif\r\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\r\n gl_FragColor = grlColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\r\n gl_FragColor += grlColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\r\n gl_FragColor *= grlColor;\r\n }\r\n }\r\n #endif\r\n\r\n `,\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Disposes the plugin material.\r\n */\r\n public override dispose(): void {\r\n this.colorsTexture?.dispose();\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Returns the colors used to colorize the line\r\n */\r\n get colors() {\r\n return this._colors;\r\n }\r\n\r\n /**\r\n * Sets the colors used to colorize the line\r\n */\r\n set colors(value: Nullable<Color3[]>) {\r\n this.setColors(value);\r\n }\r\n\r\n /**\r\n * Creates or updates the colors texture\r\n * @param colors color table RGBA\r\n * @param lazy if lazy, the colors are not updated\r\n * @param forceNewTexture force creation of a new texture\r\n */\r\n public setColors(colors: Nullable<Color3[]>, lazy = false, forceNewTexture = false): void {\r\n const origColorsCount = this._colors?.length ?? 0;\r\n\r\n this._colors = colors;\r\n\r\n if (colors === null || colors.length === 0) {\r\n this.colorsTexture?.dispose();\r\n return;\r\n }\r\n\r\n if (lazy && !forceNewTexture) {\r\n return;\r\n }\r\n\r\n if (this.colorsTexture && origColorsCount === colors.length && !forceNewTexture) {\r\n const colorArray = GreasedLineTools.Color3toRGBAUint8(colors);\r\n this.colorsTexture.update(colorArray);\r\n } else {\r\n this.colorsTexture?.dispose();\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this._material.name}-colors-texture`, colors, this.colorsSampling, this._scene);\r\n }\r\n }\r\n\r\n /**\r\n * Updates the material. Use when material created in lazy mode.\r\n */\r\n public updateLazy() {\r\n if (this._colors) {\r\n this.setColors(this._colors, false, true);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the number of dashes in the line\r\n */\r\n get dashCount() {\r\n return this._dashCount;\r\n }\r\n /**\r\n * Sets the number of dashes in the line\r\n * @param value dash\r\n */\r\n set dashCount(value: number) {\r\n this._dashCount = value;\r\n this._dashArray = 1 / value;\r\n }\r\n\r\n /**\r\n * If set to true the line will be rendered always with the same width regardless how far it is located from the camera.\r\n * Not supported for non camera facing lines.\r\n */\r\n get sizeAttenuation() {\r\n return this._sizeAttenuation;\r\n }\r\n\r\n /**\r\n * Turn on/off size attenuation of the width option and widths array.\r\n * Not supported for non camera facing lines.\r\n * @param value If set to true the line will be rendered always with the same width regardless how far it is located from the camera.\r\n */\r\n set sizeAttenuation(value: boolean) {\r\n this._sizeAttenuation = value;\r\n this.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the color of the line\r\n */\r\n get color() {\r\n return this._color;\r\n }\r\n\r\n /**\r\n * Sets the color of the line\r\n * @param value Color3 or null to clear the color. You need to clear the color if you use colors and useColors = true\r\n */\r\n set color(value: Nullable<Color3>) {\r\n this.setColor(value);\r\n }\r\n\r\n /**\r\n * Sets the color of the line. If set the whole line will be mixed with this color according to the colorMode option.\r\n * @param value color\r\n * @param doNotMarkDirty if true, the material will not be marked as dirty\r\n */\r\n public setColor(value: Nullable<Color3>, doNotMarkDirty = false) {\r\n if ((this._color === null && value !== null) || (this._color !== null && value === null)) {\r\n this._color = value;\r\n !doNotMarkDirty && this.markAllDefinesAsDirty();\r\n } else {\r\n this._color = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the color distributiopn type\r\n */\r\n get colorsDistributionType() {\r\n return this._colorsDistributionType;\r\n }\r\n\r\n /**\r\n * Sets the color distribution type\r\n * @see GreasedLineMeshColorDistributionType\r\n * @param value color distribution type\r\n */\r\n set colorsDistributionType(value: GreasedLineMeshColorDistributionType) {\r\n this._colorsDistributionType = value;\r\n this.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the resolution\r\n */\r\n get resolution() {\r\n return this._resolution;\r\n }\r\n\r\n /**\r\n * Sets the resolution\r\n * @param value resolution of the screen for GreasedLine\r\n */\r\n set resolution(value: Vector2) {\r\n this._aspect = value.x / value.y;\r\n this._resolution = value;\r\n }\r\n\r\n /**\r\n * Serializes this plugin material\r\n * @returns serializationObjec\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n const greasedLineMaterialOptions: GreasedLineMaterialOptions = {\r\n colorDistributionType: this._colorsDistributionType,\r\n colorsSampling: this.colorsSampling,\r\n colorMode: this.colorMode,\r\n dashCount: this._dashCount,\r\n dashOffset: this.dashOffset,\r\n dashRatio: this.dashRatio,\r\n resolution: this._resolution,\r\n sizeAttenuation: this._sizeAttenuation,\r\n useColors: this.useColors,\r\n useDash: this.useDash,\r\n visibility: this.visibility,\r\n width: this.width,\r\n };\r\n\r\n this._colors && (greasedLineMaterialOptions.colors = this._colors);\r\n this._color && (greasedLineMaterialOptions.color = this._color);\r\n\r\n serializationObject.greasedLineMaterialOptions = greasedLineMaterialOptions;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized objects\r\n * @param source serialized object\r\n * @param scene scene\r\n * @param rootUrl root url for textures\r\n */\r\n public override parse(source: any, scene: Scene, rootUrl: string): void {\r\n super.parse(source, scene, rootUrl);\r\n const greasedLineMaterialOptions = <GreasedLineMaterialOptions>source.greasedLineMaterialOptions;\r\n\r\n this.colorsTexture?.dispose();\r\n\r\n greasedLineMaterialOptions.color && this.setColor(greasedLineMaterialOptions.color, true);\r\n greasedLineMaterialOptions.colorDistributionType && (this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType);\r\n greasedLineMaterialOptions.colors && (this.colors = greasedLineMaterialOptions.colors);\r\n greasedLineMaterialOptions.colorsSampling && (this.colorsSampling = greasedLineMaterialOptions.colorsSampling);\r\n greasedLineMaterialOptions.colorMode && (this.colorMode = greasedLineMaterialOptions.colorMode);\r\n greasedLineMaterialOptions.useColors && (this.useColors = greasedLineMaterialOptions.useColors);\r\n greasedLineMaterialOptions.visibility && (this.visibility = greasedLineMaterialOptions.visibility);\r\n greasedLineMaterialOptions.useDash && (this.useDash = greasedLineMaterialOptions.useDash);\r\n greasedLineMaterialOptions.dashCount && (this.dashCount = greasedLineMaterialOptions.dashCount);\r\n greasedLineMaterialOptions.dashRatio && (this.dashRatio = greasedLineMaterialOptions.dashRatio);\r\n greasedLineMaterialOptions.dashOffset && (this.dashOffset = greasedLineMaterialOptions.dashOffset);\r\n greasedLineMaterialOptions.width && (this.width = greasedLineMaterialOptions.width);\r\n greasedLineMaterialOptions.sizeAttenuation && (this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation);\r\n greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);\r\n\r\n if (this.colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this._material.name}-colors-texture`, this.colors, this.colorsSampling, scene);\r\n } else {\r\n GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n this.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param plugin define the config where to copy the info\r\n */\r\n public override copyTo(plugin: MaterialPluginBase): void {\r\n const dest = plugin as GreasedLinePluginMaterial;\r\n\r\n dest.colorsTexture?.dispose();\r\n\r\n if (this._colors) {\r\n dest.colorsTexture = GreasedLineTools.CreateColorsTexture(`${dest._material.name}-colors-texture`, this._colors, dest.colorsSampling, this._scene);\r\n }\r\n\r\n dest.setColor(this.color, true);\r\n dest.colorsDistributionType = this.colorsDistributionType;\r\n dest.colorsSampling = this.colorsSampling;\r\n dest.colorMode = this.colorMode;\r\n dest.useColors = this.useColors;\r\n dest.visibility = this.visibility;\r\n dest.useDash = this.useDash;\r\n dest.dashCount = this.dashCount;\r\n dest.dashRatio = this.dashRatio;\r\n dest.dashOffset = this.dashOffset;\r\n dest.width = this.width;\r\n dest.sizeAttenuation = this.sizeAttenuation;\r\n dest.resolution = this.resolution;\r\n\r\n dest.markAllDefinesAsDirty();\r\n }\r\n}\r\n\r\nRegisterClass(`BABYLON.${GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME}`, GreasedLinePluginMaterial);\r\n"]}
|
|
1
|
+
{"version":3,"file":"greasedLinePluginMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLinePluginMaterial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI9D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,eAAe;IAA/D;;QACI;;WAEG;QACH,gEAAgE;QAChE,2BAAsB,GAAG,KAAK,CAAC;QAC/B;;WAEG;QACH,gEAAgE;QAChE,kCAA6B,GAAG,KAAK,CAAC;QACtC;;WAEG;QACH,gEAAgE;QAChE,8CAAyC,GAAG,KAAK,CAAC;QAClD;;WAEG;QACH,gEAAgE;QAChE,gDAA2C,GAAG,KAAK,CAAC;QAEpD;;WAEG;QACH,gEAAgE;QAChE,+BAA0B,GAAG,IAAI,CAAC;IACtC,CAAC;CAAA;AAED;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,kBAAkB;IAoE7D;;;;;OAKG;IACH,YAAY,QAAkB,EAAE,KAAa,EAAE,OAAoC;QAC/E,OAAO,GAAG,OAAO,IAAI;YACjB,KAAK,EAAE,2BAA2B,CAAC,aAAa;SACnD,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,0BAA0B,EAAE,CAAC;QACjD,OAAO,CAAC,sBAAsB,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC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CAAC;QAChC,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC;QAC1D,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC5C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAElC,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACjC,CAAC;;AApqBD;;GAEG;AACoB,oDAA0B,GAAG,2BAA2B,AAA9B,CAA+B;AAoqBpF,aAAa,CAAC,WAAW,yBAAyB,CAAC,0BAA0B,EAAE,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport { RawTexture } from \"../Textures/rawTexture\";\r\nimport { MaterialPluginBase } from \"../materialPluginBase\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { UniformBuffer } from \"../uniformBuffer\";\r\nimport { Vector2, TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Material } from \"../material\";\r\nimport { MaterialDefines } from \"../materialDefines\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { BaseTexture } from \"../Textures/baseTexture\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport type { GreasedLineMaterialOptions, IGreasedLineMaterial } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMaterialDefaults } from \"./greasedLineMaterialDefaults\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class MaterialGreasedLineDefines extends MaterialDefines {\r\n /**\r\n * The material has a color option specified\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_HAS_COLOR = false;\r\n /**\r\n * The material's size attenuation optiom\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_SIZE_ATTENUATION = false;\r\n /**\r\n * The type of color distribution is set to line this value equals to true.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = false;\r\n /**\r\n * True if scene is in right handed coordinate system.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = false;\r\n\r\n /**\r\n * True if the line is in camera facing mode\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_CAMERA_FACING = true;\r\n}\r\n\r\n/**\r\n * GreasedLinePluginMaterial for GreasedLineMesh/GreasedLineRibbonMesh.\r\n * Use the GreasedLineBuilder.CreateGreasedLineMaterial function to create and instance of this class.\r\n */\r\nexport class GreasedLinePluginMaterial extends MaterialPluginBase implements IGreasedLineMaterial {\r\n /**\r\n * Plugin name\r\n */\r\n public static readonly GREASED_LINE_MATERIAL_NAME = \"GreasedLinePluginMaterial\";\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n public useColors: boolean;\r\n\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 public visibility: number;\r\n\r\n /**\r\n * Dash offset\r\n */\r\n public 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 public dashRatio: 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 public width: number;\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n public colorsSampling: number;\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n public useDash: boolean;\r\n\r\n /**\r\n * The mixing mode of the color paramater. Default value is GreasedLineMeshColorMode.SET\r\n * @see GreasedLineMeshColorMode\r\n */\r\n public colorMode: GreasedLineMeshColorMode;\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 public colorsTexture: Nullable<RawTexture> = null;\r\n\r\n private _scene: Scene;\r\n private _dashCount: number;\r\n private _dashArray: number;\r\n private _color: Nullable<Color3>;\r\n private _colors: Nullable<Color3[]>;\r\n private _colorsDistributionType: GreasedLineMeshColorDistributionType;\r\n private _resolution: Vector2;\r\n private _aspect: number;\r\n private _sizeAttenuation: boolean;\r\n\r\n private _cameraFacing: boolean;\r\n\r\n private _engine: AbstractEngine;\r\n\r\n /**\r\n * Creates a new instance of the GreasedLinePluginMaterial\r\n * @param material base material for the plugin\r\n * @param scene the scene\r\n * @param options plugin options\r\n */\r\n constructor(material: Material, scene?: Scene, options?: GreasedLineMaterialOptions) {\r\n options = options || {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n\r\n const defines = new MaterialGreasedLineDefines();\r\n defines.GREASED_LINE_HAS_COLOR = !!options.color && !options.useColors;\r\n defines.GREASED_LINE_SIZE_ATTENUATION = options.sizeAttenuation ?? false;\r\n defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = options.colorDistributionType === GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE;\r\n defines.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = (scene ?? material.getScene()).useRightHandedSystem;\r\n defines.GREASED_LINE_CAMERA_FACING = options.cameraFacing ?? true;\r\n super(material, GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME, 200, defines);\r\n\r\n this._scene = scene ?? material.getScene();\r\n this._engine = this._scene.getEngine();\r\n\r\n this._cameraFacing = options.cameraFacing ?? true;\r\n\r\n this.visibility = options.visibility ?? 1;\r\n this.useDash = options.useDash ?? false;\r\n this.dashRatio = options.dashRatio ?? 0.5;\r\n this.dashOffset = options.dashOffset ?? 0;\r\n this.width = options.width ? options.width : options.sizeAttenuation ? GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED : GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n this._sizeAttenuation = options.sizeAttenuation ?? false;\r\n this.colorMode = options.colorMode ?? GreasedLineMeshColorMode.COLOR_MODE_SET;\r\n this._color = options.color ?? null;\r\n this.useColors = options.useColors ?? false;\r\n this._colorsDistributionType = options.colorDistributionType ?? GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n this.colorsSampling = options.colorsSampling ?? RawTexture.NEAREST_NEAREST;\r\n this._colors = options.colors ?? null;\r\n\r\n this.dashCount = options.dashCount ?? 1; // calculate the _dashArray value, call the setter\r\n this.resolution = options.resolution ?? new Vector2(this._engine.getRenderWidth(), this._engine.getRenderHeight()); // calculate aspect call the setter\r\n\r\n if (options.colorsTexture) {\r\n this.colorsTexture = options.colorsTexture; // colorsTexture from options takes precedence\r\n } else {\r\n if (this._colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${material.name}-colors-texture`, this._colors, this.colorsSampling, this._scene);\r\n } else {\r\n this._color = this._color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR;\r\n GreasedLineTools.PrepareEmptyColorsTexture(this._scene);\r\n }\r\n }\r\n\r\n this._engine.onDisposeObservable.add(() => {\r\n GreasedLineTools.DisposeEmptyColorsTexture();\r\n });\r\n\r\n this._enable(true); // always enabled\r\n }\r\n\r\n /**\r\n * Get the shader attributes\r\n * @param attributes array which will be filled with the attributes\r\n */\r\n override getAttributes(attributes: string[]) {\r\n attributes.push(\"grl_offsets\");\r\n attributes.push(\"grl_widths\");\r\n attributes.push(\"grl_colorPointers\");\r\n attributes.push(\"grl_counters\");\r\n if (this._cameraFacing) {\r\n attributes.push(\"grl_previousAndSide\");\r\n attributes.push(\"grl_nextAndCounters\");\r\n } else {\r\n attributes.push(\"grl_slopes\");\r\n }\r\n }\r\n\r\n /**\r\n * Get the shader samplers\r\n * @param samplers\r\n */\r\n override getSamplers(samplers: string[]) {\r\n samplers.push(\"grl_colors\");\r\n }\r\n\r\n /**\r\n * Get the shader textures\r\n * @param activeTextures array which will be filled with the textures\r\n */\r\n public override getActiveTextures(activeTextures: BaseTexture[]): void {\r\n if (this.colorsTexture) {\r\n activeTextures.push(this.colorsTexture);\r\n }\r\n }\r\n\r\n /**\r\n * Get the shader uniforms\r\n * @returns uniforms\r\n */\r\n override getUniforms() {\r\n const ubo = [\r\n { name: \"grl_singleColor\", size: 3, type: \"vec3\" },\r\n { name: \"grl_textureSize\", size: 2, type: \"vec2\" },\r\n { name: \"grl_dashOptions\", size: 4, type: \"vec4\" },\r\n { name: \"grl_colorMode_visibility_colorsWidth_useColors\", size: 4, type: \"vec4\" },\r\n ];\r\n if (this._cameraFacing) {\r\n ubo.push({ name: \"grl_projection\", size: 16, type: \"mat4\" }, { name: \"grl_aspect_resolution_lineWidth\", size: 4, type: \"vec4\" });\r\n }\r\n\r\n return {\r\n ubo,\r\n vertex: this._cameraFacing\r\n ? `\r\n uniform vec4 grl_aspect_resolution_lineWidth;\r\n uniform mat4 grl_projection;\r\n `\r\n : \"\",\r\n fragment: `\r\n uniform vec4 grl_dashOptions;\r\n uniform vec2 grl_textureSize;\r\n uniform vec4 grl_colorMode_visibility_colorsWidth_useColors;\r\n uniform vec3 grl_singleColor;\r\n `,\r\n };\r\n }\r\n\r\n // only getter, it doesn't make sense to use this plugin on a mesh other than GreasedLineMesh\r\n // and it doesn't make sense to disable it on the mesh\r\n get isEnabled() {\r\n return true;\r\n }\r\n\r\n /**\r\n * Bind the uniform buffer\r\n * @param uniformBuffer\r\n */\r\n override bindForSubMesh(uniformBuffer: UniformBuffer) {\r\n if (this._cameraFacing) {\r\n const activeCamera = this._scene.activeCamera;\r\n\r\n if (activeCamera) {\r\n const projection = activeCamera.getProjectionMatrix();\r\n uniformBuffer.updateMatrix(\"grl_projection\", projection);\r\n } else {\r\n throw Error(\"GreasedLinePluginMaterial requires an active camera.\");\r\n }\r\n\r\n const resolutionLineWidth = TmpVectors.Vector4[0];\r\n resolutionLineWidth.x = this._aspect;\r\n resolutionLineWidth.y = this._resolution.x;\r\n resolutionLineWidth.z = this._resolution.y;\r\n resolutionLineWidth.w = this.width;\r\n uniformBuffer.updateVector4(\"grl_aspect_resolution_lineWidth\", resolutionLineWidth);\r\n }\r\n\r\n const dashOptions = TmpVectors.Vector4[0];\r\n dashOptions.x = GreasedLineTools.BooleanToNumber(this.useDash);\r\n dashOptions.y = this._dashArray;\r\n dashOptions.z = this.dashOffset;\r\n dashOptions.w = this.dashRatio;\r\n uniformBuffer.updateVector4(\"grl_dashOptions\", dashOptions);\r\n\r\n const colorModeVisibilityColorsWidthUseColors = TmpVectors.Vector4[1];\r\n colorModeVisibilityColorsWidthUseColors.x = this.colorMode;\r\n colorModeVisibilityColorsWidthUseColors.y = this.visibility;\r\n colorModeVisibilityColorsWidthUseColors.z = this.colorsTexture ? this.colorsTexture.getSize().width : 0;\r\n colorModeVisibilityColorsWidthUseColors.w = GreasedLineTools.BooleanToNumber(this.useColors);\r\n uniformBuffer.updateVector4(\"grl_colorMode_visibility_colorsWidth_useColors\", colorModeVisibilityColorsWidthUseColors);\r\n\r\n if (this._color) {\r\n uniformBuffer.updateColor3(\"grl_singleColor\", this._color);\r\n }\r\n const texture = this.colorsTexture ?? GreasedLineMaterialDefaults.EmptyColorsTexture;\r\n uniformBuffer.setTexture(\"grl_colors\", texture);\r\n uniformBuffer.updateFloat2(\"grl_textureSize\", texture?.getSize().width ?? 1, texture?.getSize().height ?? 1);\r\n }\r\n\r\n /**\r\n * Prepare the defines\r\n * @param defines\r\n * @param _scene\r\n * @param _mesh\r\n */\r\n override prepareDefines(defines: MaterialGreasedLineDefines, _scene: Scene, _mesh: AbstractMesh) {\r\n defines.GREASED_LINE_HAS_COLOR = !!this.color && !this.useColors;\r\n defines.GREASED_LINE_SIZE_ATTENUATION = this._sizeAttenuation;\r\n defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = this._colorsDistributionType === GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE;\r\n defines.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = _scene.useRightHandedSystem;\r\n defines.GREASED_LINE_CAMERA_FACING = this._cameraFacing;\r\n }\r\n\r\n /**\r\n * Get the class name\r\n * @returns class name\r\n */\r\n override getClassName() {\r\n return GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME;\r\n }\r\n\r\n /**\r\n * Get shader code\r\n * @param shaderType vertex/fragment\r\n * @returns shader code\r\n */\r\n override getCustomCode(shaderType: string): Nullable<{ [pointName: string]: string }> {\r\n if (shaderType === \"vertex\") {\r\n const obj: any = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_DEFINITIONS: `\r\n attribute float grl_widths;\r\n attribute vec3 grl_offsets;\r\n attribute float grl_colorPointers;\r\n varying float grlCounters;\r\n varying float grlColorPointer;\r\n\r\n #ifdef GREASED_LINE_CAMERA_FACING\r\n attribute vec4 grl_previousAndSide;\r\n attribute vec4 grl_nextAndCounters;\r\n\r\n vec2 grlFix( vec4 i, float aspect ) {\r\n vec2 res = i.xy / i.w;\r\n res.x *= aspect;\r\n return res;\r\n }\r\n #else\r\n attribute vec3 grl_slopes;\r\n attribute float grl_counters;\r\n #endif\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_UPDATE_POSITION: `\r\n #ifdef GREASED_LINE_CAMERA_FACING\r\n vec3 grlPositionOffset = grl_offsets;\r\n positionUpdated += grlPositionOffset;\r\n #else\r\n positionUpdated = (positionUpdated + grl_offsets) + (grl_slopes * grl_widths);\r\n #endif\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_MAIN_END: `\r\n grlColorPointer = grl_colorPointers;\r\n\r\n #ifdef GREASED_LINE_CAMERA_FACING\r\n\r\n float grlAspect = grl_aspect_resolution_lineWidth.x;\r\n float grlBaseWidth = grl_aspect_resolution_lineWidth.w;\r\n\r\n\r\n vec3 grlPrevious = grl_previousAndSide.xyz;\r\n float grlSide = grl_previousAndSide.w;\r\n\r\n vec3 grlNext = grl_nextAndCounters.xyz;\r\n grlCounters = grl_nextAndCounters.w;\r\n\r\n mat4 grlMatrix = viewProjection * finalWorld;\r\n vec4 grlFinalPosition = grlMatrix * vec4( positionUpdated , 1.0 );\r\n vec4 grlPrevPos = grlMatrix * vec4( grlPrevious + grlPositionOffset, 1.0 );\r\n vec4 grlNextPos = grlMatrix * vec4( grlNext + grlPositionOffset, 1.0 );\r\n\r\n vec2 grlCurrentP = grlFix( grlFinalPosition, grlAspect );\r\n vec2 grlPrevP = grlFix( grlPrevPos, grlAspect );\r\n vec2 grlNextP = grlFix( grlNextPos, grlAspect );\r\n\r\n float grlWidth = grlBaseWidth * grl_widths;\r\n\r\n vec2 grlDir;\r\n if( grlNextP == grlCurrentP ) grlDir = normalize( grlCurrentP - grlPrevP );\r\n else if( grlPrevP == grlCurrentP ) grlDir = normalize( grlNextP - grlCurrentP );\r\n else {\r\n vec2 grlDir1 = normalize( grlCurrentP - grlPrevP );\r\n vec2 grlDir2 = normalize( grlNextP - grlCurrentP );\r\n grlDir = normalize( grlDir1 + grlDir2 );\r\n }\r\n vec4 grlNormal = vec4( -grlDir.y, grlDir.x, 0., 1. );\r\n #ifdef GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\r\n grlNormal.xy *= -.5 * grlWidth;\r\n #else\r\n grlNormal.xy *= .5 * grlWidth;\r\n #endif\r\n\r\n grlNormal *= grl_projection;\r\n\r\n #ifdef GREASED_LINE_SIZE_ATTENUATION\r\n grlNormal.xy *= grlFinalPosition.w;\r\n grlNormal.xy /= ( vec4( grl_aspect_resolution_lineWidth.yz, 0., 1. ) * grl_projection ).xy;\r\n #endif\r\n\r\n grlFinalPosition.xy += grlNormal.xy * grlSide;\r\n gl_Position = grlFinalPosition;\r\n\r\n vPositionW = vec3(grlFinalPosition);\r\n #else\r\n grlCounters = grl_counters;\r\n #endif\r\n `,\r\n };\r\n this._cameraFacing && (obj[\"!gl_Position\\\\=viewProjection\\\\*worldPos;\"] = \"//\"); // not needed for camera facing GRL\r\n return obj;\r\n }\r\n\r\n if (shaderType === \"fragment\") {\r\n return {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_DEFINITIONS: `\r\n varying float grlCounters;\r\n varying float grlColorPointer;\r\n uniform sampler2D grl_colors;\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_MAIN_END: `\r\n float grlColorMode = grl_colorMode_visibility_colorsWidth_useColors.x;\r\n float grlVisibility = grl_colorMode_visibility_colorsWidth_useColors.y;\r\n float grlColorsWidth = grl_colorMode_visibility_colorsWidth_useColors.z;\r\n float grlUseColors = grl_colorMode_visibility_colorsWidth_useColors.w;\r\n\r\n float grlUseDash = grl_dashOptions.x;\r\n float grlDashArray = grl_dashOptions.y;\r\n float grlDashOffset = grl_dashOptions.z;\r\n float grlDashRatio = grl_dashOptions.w;\r\n\r\n gl_FragColor.a *= step(grlCounters, grlVisibility);\r\n if( gl_FragColor.a == 0. ) discard;\r\n\r\n if(grlUseDash == 1.){\r\n gl_FragColor.a *= ceil(mod(grlCounters + grlDashOffset, grlDashArray) - (grlDashArray * grlDashRatio));\r\n if (gl_FragColor.a == 0.) discard;\r\n }\r\n\r\n #ifdef GREASED_LINE_HAS_COLOR\r\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\r\n gl_FragColor.rgb = grl_singleColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\r\n gl_FragColor.rgb += grl_singleColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\r\n gl_FragColor.rgb *= grl_singleColor;\r\n }\r\n #else\r\n if (grlUseColors == 1.) {\r\n #ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\r\n vec4 grlColor = texture2D(grl_colors, vec2(grlCounters, 0.), 0.);\r\n #else\r\n vec2 lookup = vec2(fract(grlColorPointer / grl_textureSize.x), 1.0 - floor(grlColorPointer / grl_textureSize.x) / max(grl_textureSize.y - 1.0, 1.0));\r\n vec4 grlColor = texture2D(grl_colors, lookup, 0.0);\r\n #endif\r\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\r\n gl_FragColor = grlColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\r\n gl_FragColor += grlColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\r\n gl_FragColor *= grlColor;\r\n }\r\n }\r\n #endif\r\n\r\n `,\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Disposes the plugin material.\r\n */\r\n public override dispose(): void {\r\n this.colorsTexture?.dispose();\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Returns the colors used to colorize the line\r\n */\r\n get colors() {\r\n return this._colors;\r\n }\r\n\r\n /**\r\n * Sets the colors used to colorize the line\r\n */\r\n set colors(value: Nullable<Color3[]>) {\r\n this.setColors(value);\r\n }\r\n\r\n /**\r\n * Creates or updates the colors texture\r\n * @param colors color table RGBA\r\n * @param lazy if lazy, the colors are not updated\r\n * @param forceNewTexture force creation of a new texture\r\n */\r\n public setColors(colors: Nullable<Color3[]>, lazy = false, forceNewTexture = false): void {\r\n const origColorsCount = this._colors?.length ?? 0;\r\n\r\n this._colors = colors;\r\n\r\n if (colors === null || colors.length === 0) {\r\n this.colorsTexture?.dispose();\r\n return;\r\n }\r\n\r\n if (lazy && !forceNewTexture) {\r\n return;\r\n }\r\n\r\n if (this.colorsTexture && origColorsCount === colors.length && !forceNewTexture) {\r\n const colorArray = GreasedLineTools.Color3toRGBAUint8(colors);\r\n this.colorsTexture.update(colorArray);\r\n } else {\r\n this.colorsTexture?.dispose();\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this._material.name}-colors-texture`, colors, this.colorsSampling, this._scene);\r\n }\r\n }\r\n\r\n /**\r\n * Updates the material. Use when material created in lazy mode.\r\n */\r\n public updateLazy() {\r\n if (this._colors) {\r\n this.setColors(this._colors, false, true);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the number of dashes in the line\r\n */\r\n get dashCount() {\r\n return this._dashCount;\r\n }\r\n /**\r\n * Sets the number of dashes in the line\r\n * @param value dash\r\n */\r\n set dashCount(value: number) {\r\n this._dashCount = value;\r\n this._dashArray = 1 / value;\r\n }\r\n\r\n /**\r\n * If set to true the line will be rendered always with the same width regardless how far it is located from the camera.\r\n * Not supported for non camera facing lines.\r\n */\r\n get sizeAttenuation() {\r\n return this._sizeAttenuation;\r\n }\r\n\r\n /**\r\n * Turn on/off size attenuation of the width option and widths array.\r\n * Not supported for non camera facing lines.\r\n * @param value If set to true the line will be rendered always with the same width regardless how far it is located from the camera.\r\n */\r\n set sizeAttenuation(value: boolean) {\r\n this._sizeAttenuation = value;\r\n this.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the color of the line\r\n */\r\n get color() {\r\n return this._color;\r\n }\r\n\r\n /**\r\n * Sets the color of the line\r\n * @param value Color3 or null to clear the color. You need to clear the color if you use colors and useColors = true\r\n */\r\n set color(value: Nullable<Color3>) {\r\n this.setColor(value);\r\n }\r\n\r\n /**\r\n * Sets the color of the line. If set the whole line will be mixed with this color according to the colorMode option.\r\n * @param value color\r\n * @param doNotMarkDirty if true, the material will not be marked as dirty\r\n */\r\n public setColor(value: Nullable<Color3>, doNotMarkDirty = false) {\r\n if ((this._color === null && value !== null) || (this._color !== null && value === null)) {\r\n this._color = value;\r\n !doNotMarkDirty && this.markAllDefinesAsDirty();\r\n } else {\r\n this._color = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the color distributiopn type\r\n */\r\n get colorsDistributionType() {\r\n return this._colorsDistributionType;\r\n }\r\n\r\n /**\r\n * Sets the color distribution type\r\n * @see GreasedLineMeshColorDistributionType\r\n * @param value color distribution type\r\n */\r\n set colorsDistributionType(value: GreasedLineMeshColorDistributionType) {\r\n this._colorsDistributionType = value;\r\n this.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the resolution\r\n */\r\n get resolution() {\r\n return this._resolution;\r\n }\r\n\r\n /**\r\n * Sets the resolution\r\n * @param value resolution of the screen for GreasedLine\r\n */\r\n set resolution(value: Vector2) {\r\n this._aspect = value.x / value.y;\r\n this._resolution = value;\r\n }\r\n\r\n /**\r\n * Serializes this plugin material\r\n * @returns serializationObjec\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n const greasedLineMaterialOptions: GreasedLineMaterialOptions = {\r\n colorDistributionType: this._colorsDistributionType,\r\n colorsSampling: this.colorsSampling,\r\n colorMode: this.colorMode,\r\n dashCount: this._dashCount,\r\n dashOffset: this.dashOffset,\r\n dashRatio: this.dashRatio,\r\n resolution: this._resolution,\r\n sizeAttenuation: this._sizeAttenuation,\r\n useColors: this.useColors,\r\n useDash: this.useDash,\r\n visibility: this.visibility,\r\n width: this.width,\r\n };\r\n\r\n this._colors && (greasedLineMaterialOptions.colors = this._colors);\r\n this._color && (greasedLineMaterialOptions.color = this._color);\r\n\r\n serializationObject.greasedLineMaterialOptions = greasedLineMaterialOptions;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized objects\r\n * @param source serialized object\r\n * @param scene scene\r\n * @param rootUrl root url for textures\r\n */\r\n public override parse(source: any, scene: Scene, rootUrl: string): void {\r\n super.parse(source, scene, rootUrl);\r\n const greasedLineMaterialOptions = <GreasedLineMaterialOptions>source.greasedLineMaterialOptions;\r\n\r\n this.colorsTexture?.dispose();\r\n\r\n greasedLineMaterialOptions.color && this.setColor(greasedLineMaterialOptions.color, true);\r\n greasedLineMaterialOptions.colorDistributionType && (this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType);\r\n greasedLineMaterialOptions.colors && (this.colors = greasedLineMaterialOptions.colors);\r\n greasedLineMaterialOptions.colorsSampling && (this.colorsSampling = greasedLineMaterialOptions.colorsSampling);\r\n greasedLineMaterialOptions.colorMode && (this.colorMode = greasedLineMaterialOptions.colorMode);\r\n greasedLineMaterialOptions.useColors && (this.useColors = greasedLineMaterialOptions.useColors);\r\n greasedLineMaterialOptions.visibility && (this.visibility = greasedLineMaterialOptions.visibility);\r\n greasedLineMaterialOptions.useDash && (this.useDash = greasedLineMaterialOptions.useDash);\r\n greasedLineMaterialOptions.dashCount && (this.dashCount = greasedLineMaterialOptions.dashCount);\r\n greasedLineMaterialOptions.dashRatio && (this.dashRatio = greasedLineMaterialOptions.dashRatio);\r\n greasedLineMaterialOptions.dashOffset && (this.dashOffset = greasedLineMaterialOptions.dashOffset);\r\n greasedLineMaterialOptions.width && (this.width = greasedLineMaterialOptions.width);\r\n greasedLineMaterialOptions.sizeAttenuation && (this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation);\r\n greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);\r\n\r\n if (this.colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this._material.name}-colors-texture`, this.colors, this.colorsSampling, scene);\r\n } else {\r\n GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n this.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param plugin define the config where to copy the info\r\n */\r\n public override copyTo(plugin: MaterialPluginBase): void {\r\n const dest = plugin as GreasedLinePluginMaterial;\r\n\r\n dest.colorsTexture?.dispose();\r\n\r\n if (this._colors) {\r\n dest.colorsTexture = GreasedLineTools.CreateColorsTexture(`${dest._material.name}-colors-texture`, this._colors, dest.colorsSampling, this._scene);\r\n }\r\n\r\n dest.setColor(this.color, true);\r\n dest.colorsDistributionType = this.colorsDistributionType;\r\n dest.colorsSampling = this.colorsSampling;\r\n dest.colorMode = this.colorMode;\r\n dest.useColors = this.useColors;\r\n dest.visibility = this.visibility;\r\n dest.useDash = this.useDash;\r\n dest.dashCount = this.dashCount;\r\n dest.dashRatio = this.dashRatio;\r\n dest.dashOffset = this.dashOffset;\r\n dest.width = this.width;\r\n dest.sizeAttenuation = this.sizeAttenuation;\r\n dest.resolution = this.resolution;\r\n\r\n dest.markAllDefinesAsDirty();\r\n }\r\n}\r\n\r\nRegisterClass(`BABYLON.${GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME}`, GreasedLinePluginMaterial);\r\n"]}
|
|
@@ -4,7 +4,6 @@ import { Color3 } from "../../Maths/math.color.js";
|
|
|
4
4
|
import { Vector2 } from "../../Maths/math.vector.js";
|
|
5
5
|
import "../../Shaders/greasedLine.fragment.js";
|
|
6
6
|
import "../../Shaders/greasedLine.vertex.js";
|
|
7
|
-
import { GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from "./greasedLineMaterialInterfaces.js";
|
|
8
7
|
import { GreasedLineTools } from "../../Misc/greasedLineTools.js";
|
|
9
8
|
import { GreasedLineMaterialDefaults } from "./greasedLineMaterialDefaults.js";
|
|
10
9
|
/**
|
|
@@ -19,11 +18,11 @@ export class GreasedLineSimpleMaterial extends ShaderMaterial {
|
|
|
19
18
|
*/
|
|
20
19
|
constructor(name, scene, options) {
|
|
21
20
|
const defines = [
|
|
22
|
-
`COLOR_DISTRIBUTION_TYPE_LINE ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE}.`,
|
|
23
|
-
`COLOR_DISTRIBUTION_TYPE_SEGMENT ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT}.`,
|
|
24
|
-
`COLOR_MODE_SET ${GreasedLineMeshColorMode.COLOR_MODE_SET}.`,
|
|
25
|
-
`COLOR_MODE_ADD ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.`,
|
|
26
|
-
`COLOR_MODE_MULTIPLY ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.`,
|
|
21
|
+
`COLOR_DISTRIBUTION_TYPE_LINE ${1 /* GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE */}.`,
|
|
22
|
+
`COLOR_DISTRIBUTION_TYPE_SEGMENT ${0 /* GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT */}.`,
|
|
23
|
+
`COLOR_MODE_SET ${0 /* GreasedLineMeshColorMode.COLOR_MODE_SET */}.`,
|
|
24
|
+
`COLOR_MODE_ADD ${1 /* GreasedLineMeshColorMode.COLOR_MODE_ADD */}.`,
|
|
25
|
+
`COLOR_MODE_MULTIPLY ${2 /* GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY */}.`,
|
|
27
26
|
];
|
|
28
27
|
const attributes = ["position", "grl_widths", "grl_offsets", "grl_colorPointers"];
|
|
29
28
|
scene.useRightHandedSystem && defines.push("GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM");
|
|
@@ -63,7 +62,7 @@ export class GreasedLineSimpleMaterial extends ShaderMaterial {
|
|
|
63
62
|
defines,
|
|
64
63
|
});
|
|
65
64
|
this._color = Color3.White();
|
|
66
|
-
this._colorsDistributionType = GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT
|
|
65
|
+
this._colorsDistributionType = 0 /* GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT */;
|
|
67
66
|
this._colorsTexture = null;
|
|
68
67
|
options = options || {
|
|
69
68
|
color: GreasedLineMaterialDefaults.DEFAULT_COLOR,
|
|
@@ -82,9 +81,9 @@ export class GreasedLineSimpleMaterial extends ShaderMaterial {
|
|
|
82
81
|
this.sizeAttenuation = options.sizeAttenuation ?? false;
|
|
83
82
|
this.color = options.color ?? Color3.White();
|
|
84
83
|
this.useColors = options.useColors ?? false;
|
|
85
|
-
this.colorsDistributionType = options.colorDistributionType ?? GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT
|
|
84
|
+
this.colorsDistributionType = options.colorDistributionType ?? 0 /* GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT */;
|
|
86
85
|
this.colorsSampling = options.colorsSampling ?? RawTexture.NEAREST_NEAREST;
|
|
87
|
-
this.colorMode = options.colorMode ?? GreasedLineMeshColorMode.COLOR_MODE_SET
|
|
86
|
+
this.colorMode = options.colorMode ?? 0 /* GreasedLineMeshColorMode.COLOR_MODE_SET */;
|
|
88
87
|
this._colors = options.colors ?? null;
|
|
89
88
|
this._cameraFacing = options.cameraFacing ?? true;
|
|
90
89
|
this.resolution = options.resolution ?? new Vector2(engine.getRenderWidth(), engine.getRenderHeight()); // calculate aspect call the setter
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLineSimpleMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLineSimpleMaterial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC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AC,GAAG,IAAI,CAAC,IAAI,iBAAiB,EAAE,0BAA0B,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;SACrK;aAAM;YACH,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;SAC1E;QAED,IAAI,CAAC,aAAa,GAAG,0BAA0B,CAAC,YAAY,IAAI,IAAI,CAAC;QACrE,IAAI,CAAC,SAAS,CAAC,4BAA4B,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACrE,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { RawTexture } from \"../Textures/rawTexture\";\r\n\r\nimport { ShaderMaterial } from \"../shaderMaterial\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Vector2 } from \"../../Maths/math.vector\";\r\n\r\nimport \"../../Shaders/greasedLine.fragment\";\r\nimport \"../../Shaders/greasedLine.vertex\";\r\nimport type { GreasedLineMaterialOptions, IGreasedLineMaterial } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport { GreasedLineMaterialDefaults } from \"./greasedLineMaterialDefaults\";\r\n\r\n/**\r\n * GreasedLineSimpleMaterial\r\n */\r\nexport class GreasedLineSimpleMaterial extends ShaderMaterial implements IGreasedLineMaterial {\r\n private _visibility: number;\r\n private _width: number;\r\n private _useDash: boolean;\r\n private _dashCount: number;\r\n private _dashArray: number;\r\n private _dashRatio: number;\r\n private _dashOffset: number;\r\n private _useColors: boolean;\r\n private _color: Color3 = Color3.White();\r\n private _colors: Nullable<Color3[]>;\r\n private _colorsDistributionType: GreasedLineMeshColorDistributionType = GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n private _colorMode: GreasedLineMeshColorMode;\r\n private _colorsSampling: number;\r\n private _resolution: Vector2;\r\n private _sizeAttenuation: boolean;\r\n private _colorsTexture: Nullable<RawTexture> = null;\r\n private _cameraFacing: boolean;\r\n\r\n /**\r\n * GreasedLineSimple material constructor\r\n * @param name material name\r\n * @param scene the scene\r\n * @param options material options\r\n */\r\n constructor(name: string, scene: Scene, options: GreasedLineMaterialOptions) {\r\n const defines = [\r\n `COLOR_DISTRIBUTION_TYPE_LINE ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE}.`,\r\n `COLOR_DISTRIBUTION_TYPE_SEGMENT ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT}.`,\r\n `COLOR_MODE_SET ${GreasedLineMeshColorMode.COLOR_MODE_SET}.`,\r\n `COLOR_MODE_ADD ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.`,\r\n `COLOR_MODE_MULTIPLY ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.`,\r\n ];\r\n const attributes = [\"position\", \"grl_widths\", \"grl_offsets\", \"grl_colorPointers\"];\r\n\r\n scene.useRightHandedSystem && defines.push(\"GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\");\r\n\r\n if (options.cameraFacing) {\r\n defines.push(\"GREASED_LINE_CAMERA_FACING\");\r\n attributes.push(\"grl_previousAndSide\", \"grl_nextAndCounters\");\r\n } else {\r\n attributes.push(\"grl_slopes\");\r\n attributes.push(\"grl_counters\");\r\n }\r\n\r\n super(\r\n name,\r\n scene,\r\n {\r\n vertex: \"greasedLine\",\r\n fragment: \"greasedLine\",\r\n },\r\n {\r\n attributes,\r\n uniforms: [\r\n \"world\",\r\n \"viewProjection\",\r\n \"view\",\r\n \"projection\",\r\n \"grlColorsWidth\",\r\n \"grlUseColors\",\r\n \"grlWidth\",\r\n \"grlColor\",\r\n \"grl_colorModeAndColorDistributionType\",\r\n \"grlResolution\",\r\n \"grlAspect\",\r\n \"grlAizeAttenuation\",\r\n \"grlDashArray\",\r\n \"grlDashOffset\",\r\n \"grlDashRatio\",\r\n \"grlUseDash\",\r\n \"grlVisibility\",\r\n ],\r\n samplers: [\"grlColors\"],\r\n defines,\r\n }\r\n );\r\n options = options || {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n\r\n const engine = scene.getEngine();\r\n\r\n this.visibility = options.visibility ?? 1;\r\n this.useDash = options.useDash ?? false;\r\n this.dashRatio = options.dashRatio ?? 0.5;\r\n this.dashOffset = options.dashOffset ?? 0;\r\n this.dashCount = options.dashCount ?? 1; // calculate the _dashArray value, call the setter\r\n this.width = options.width\r\n ? options.width\r\n : options.sizeAttenuation && options.cameraFacing\r\n ? GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED\r\n : GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n this.sizeAttenuation = options.sizeAttenuation ?? false;\r\n this.color = options.color ?? Color3.White();\r\n this.useColors = options.useColors ?? false;\r\n this.colorsDistributionType = options.colorDistributionType ?? GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n this.colorsSampling = options.colorsSampling ?? RawTexture.NEAREST_NEAREST;\r\n this.colorMode = options.colorMode ?? GreasedLineMeshColorMode.COLOR_MODE_SET;\r\n this._colors = options.colors ?? null;\r\n this._cameraFacing = options.cameraFacing ?? true;\r\n this.resolution = options.resolution ?? new Vector2(engine.getRenderWidth(), engine.getRenderHeight()); // calculate aspect call the setter\r\n\r\n if (options.colorsTexture) {\r\n this.colorsTexture = options.colorsTexture;\r\n } else {\r\n this.colorsTexture = GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n if (this._colors) {\r\n this.setColors(this._colors);\r\n }\r\n\r\n engine.onDisposeObservable.add(() => {\r\n GreasedLineTools.DisposeEmptyColorsTexture();\r\n });\r\n }\r\n\r\n /**\r\n * Disposes the plugin material.\r\n */\r\n public override dispose(): void {\r\n this._colorsTexture?.dispose();\r\n super.dispose();\r\n }\r\n\r\n private _setColorModeAndColorDistributionType() {\r\n this.setVector2(\"grl_colorModeAndColorDistributionType\", new Vector2(this._colorMode, this._colorsDistributionType));\r\n }\r\n\r\n /**\r\n * Updates the material. Use when material created in lazy mode.\r\n */\r\n public updateLazy() {\r\n if (this._colors) {\r\n this.setColors(this._colors, false, true);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the colors used to colorize the line\r\n */\r\n get colors() {\r\n return this._colors;\r\n }\r\n\r\n /**\r\n * Sets the colors used to colorize the line\r\n */\r\n set colors(value: Nullable<Color3[]>) {\r\n this.setColors(value);\r\n }\r\n\r\n /**\r\n * Creates or updates the colors texture\r\n * @param colors color table RGBA\r\n * @param lazy if lazy, the colors are not updated\r\n * @param forceNewTexture force creation of a new texture\r\n */\r\n public setColors(colors: Nullable<Color3[]>, lazy = false, forceNewTexture = false): void {\r\n const origColorsCount = this._colors?.length ?? 0;\r\n\r\n this._colors = colors;\r\n\r\n if (colors === null || colors.length === 0) {\r\n this._colorsTexture?.dispose();\r\n return;\r\n }\r\n\r\n if (lazy && !forceNewTexture) {\r\n return;\r\n }\r\n\r\n if (this._colorsTexture && origColorsCount === colors.length && !forceNewTexture) {\r\n const colorArray = GreasedLineTools.Color3toRGBAUint8(colors);\r\n this._colorsTexture.update(colorArray);\r\n } else {\r\n this._colorsTexture?.dispose();\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, colors, this.colorsSampling, this.getScene());\r\n }\r\n }\r\n\r\n /**\r\n * Gets the colors texture\r\n */\r\n get colorsTexture() {\r\n return (this._colorsTexture as RawTexture) ?? null;\r\n }\r\n\r\n /**\r\n * Sets the colorsTexture\r\n */\r\n set colorsTexture(value: RawTexture) {\r\n this._colorsTexture = value;\r\n this.setFloat(\"grlColorsWidth\", this._colorsTexture.getSize().width);\r\n this.setTexture(\"grlColors\", this._colorsTexture);\r\n }\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 get width() {\r\n return this._width;\r\n }\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 set width(value: number) {\r\n this._width = value;\r\n this.setFloat(\"grlWidth\", value);\r\n }\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n get useColors() {\r\n return this._useColors;\r\n }\r\n\r\n set useColors(value: boolean) {\r\n this._useColors = value;\r\n this.setFloat(\"grlUseColors\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n get colorsSampling() {\r\n return this._colorsSampling;\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n set colorsSampling(value: number) {\r\n this._colorsSampling = value;\r\n }\r\n\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 get visibility() {\r\n return this._visibility;\r\n }\r\n\r\n set visibility(value: number) {\r\n this._visibility = value;\r\n this.setFloat(\"grlVisibility\", value);\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n get useDash() {\r\n return this._useDash;\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n set useDash(value: boolean) {\r\n this._useDash = value;\r\n this.setFloat(\"grlUseDash\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the dash offset\r\n */\r\n get dashOffset() {\r\n return this._dashOffset;\r\n }\r\n\r\n /**\r\n * Sets the dash offset\r\n */\r\n set dashOffset(value: number) {\r\n this._dashOffset = value;\r\n this.setFloat(\"grlDashOffset\", value);\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n get dashRatio() {\r\n return this._dashRatio;\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n set dashRatio(value: number) {\r\n this._dashRatio = value;\r\n this.setFloat(\"grlDashRatio\", value);\r\n }\r\n\r\n /**\r\n * Gets the number of dashes in the line\r\n */\r\n get dashCount() {\r\n return this._dashCount;\r\n }\r\n /**\r\n * Sets the number of dashes in the line\r\n * @param value dash\r\n */\r\n set dashCount(value: number) {\r\n this._dashCount = value;\r\n this._dashArray = 1 / value;\r\n this.setFloat(\"grlDashArray\", this._dashArray);\r\n }\r\n\r\n /**\r\n * False means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n get sizeAttenuation() {\r\n return this._sizeAttenuation;\r\n }\r\n\r\n /**\r\n * Turn on/off attenuation of the width option and widths array.\r\n * @param value false means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n set sizeAttenuation(value: boolean) {\r\n this._sizeAttenuation = value;\r\n this.setFloat(\"grlSizeAttenuation\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the color of the line\r\n */\r\n get color() {\r\n return this.color;\r\n }\r\n\r\n /**\r\n * Sets the color of the line\r\n * @param value Color3\r\n */\r\n set color(value: Color3) {\r\n this.setColor(value);\r\n }\r\n\r\n /**\r\n * Sets the color of the line. If set the whole line will be mixed with this color according to the colorMode option.\r\n * The simple material always needs a color to be set. If you set it to null it will set the color to the default color (GreasedLineSimpleMaterial.DEFAULT_COLOR).\r\n * @param value color\r\n */\r\n public setColor(value: Nullable<Color3>) {\r\n value = value ?? GreasedLineMaterialDefaults.DEFAULT_COLOR;\r\n this._color = value;\r\n this.setColor3(\"grlColor\", value);\r\n }\r\n\r\n /**\r\n * Gets the color distributiopn type\r\n */\r\n get colorsDistributionType() {\r\n return this._colorsDistributionType;\r\n }\r\n\r\n /**\r\n * Sets the color distribution type\r\n * @see GreasedLineMeshColorDistributionType\r\n * @param value color distribution type\r\n */\r\n set colorsDistributionType(value: GreasedLineMeshColorDistributionType) {\r\n this._colorsDistributionType = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n get colorMode() {\r\n return this._colorMode;\r\n }\r\n\r\n /**\r\n * Sets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n set colorMode(value: GreasedLineMeshColorMode) {\r\n this._colorMode = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the resolution\r\n */\r\n get resolution() {\r\n return this._resolution;\r\n }\r\n\r\n /**\r\n * Sets the resolution\r\n * @param value resolution of the screen for GreasedLine\r\n */\r\n set resolution(value: Vector2) {\r\n this._resolution = value;\r\n this.setVector2(\"grlResolution\", value);\r\n this.setFloat(\"grlAspect\", value.x / value.y);\r\n }\r\n\r\n /**\r\n * Serializes this plugin material\r\n * @returns serializationObjec\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n const greasedLineMaterialOptions: GreasedLineMaterialOptions = {\r\n colorDistributionType: this._colorsDistributionType,\r\n colorsSampling: this._colorsSampling,\r\n colorMode: this._colorMode,\r\n color: this._color,\r\n dashCount: this._dashCount,\r\n dashOffset: this._dashOffset,\r\n dashRatio: this._dashRatio,\r\n resolution: this._resolution,\r\n sizeAttenuation: this._sizeAttenuation,\r\n useColors: this._useColors,\r\n useDash: this._useDash,\r\n visibility: this._visibility,\r\n width: this._width,\r\n cameraFacing: this._cameraFacing,\r\n };\r\n\r\n this._colors && (greasedLineMaterialOptions.colors = this._colors);\r\n\r\n serializationObject.greasedLineMaterialOptions = greasedLineMaterialOptions;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized objects\r\n * @param source serialized object\r\n * @param scene scene\r\n * @param _rootUrl root url for textures\r\n */\r\n public parse(source: any, scene: Scene, _rootUrl: string): void {\r\n // TODO: super.parse?\r\n const greasedLineMaterialOptions = <GreasedLineMaterialOptions>source.greasedLineMaterialOptions;\r\n\r\n this._colorsTexture?.dispose();\r\n\r\n greasedLineMaterialOptions.color && (this.color = greasedLineMaterialOptions.color);\r\n greasedLineMaterialOptions.colorDistributionType && (this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType);\r\n greasedLineMaterialOptions.colorsSampling && (this.colorsSampling = greasedLineMaterialOptions.colorsSampling);\r\n greasedLineMaterialOptions.colorMode && (this.colorMode = greasedLineMaterialOptions.colorMode);\r\n greasedLineMaterialOptions.useColors && (this.useColors = greasedLineMaterialOptions.useColors);\r\n greasedLineMaterialOptions.visibility && (this.visibility = greasedLineMaterialOptions.visibility);\r\n greasedLineMaterialOptions.useDash && (this.useDash = greasedLineMaterialOptions.useDash);\r\n greasedLineMaterialOptions.dashCount && (this.dashCount = greasedLineMaterialOptions.dashCount);\r\n greasedLineMaterialOptions.dashRatio && (this.dashRatio = greasedLineMaterialOptions.dashRatio);\r\n greasedLineMaterialOptions.dashOffset && (this.dashOffset = greasedLineMaterialOptions.dashOffset);\r\n greasedLineMaterialOptions.width && (this.width = greasedLineMaterialOptions.width);\r\n greasedLineMaterialOptions.sizeAttenuation && (this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation);\r\n greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);\r\n\r\n if (greasedLineMaterialOptions.colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, greasedLineMaterialOptions.colors, this.colorsSampling, this.getScene());\r\n } else {\r\n this.colorsTexture = GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n this._cameraFacing = greasedLineMaterialOptions.cameraFacing ?? true;\r\n this.setDefine(\"GREASED_LINE_CAMERA_FACING\", this._cameraFacing);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"greasedLineSimpleMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLineSimpleMaterial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IAmBzD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,KAAY,EAAE,OAAmC;QACvE,MAAM,OAAO,GAAG;YACZ,gCAAgC,yEAAiE,GAAG;YACpG,mCAAmC,4EAAoE,GAAG;YAC1G,kBAAkB,+CAAuC,GAAG;YAC5D,kBAAkB,+CAAuC,GAAG;YAC5D,uBAAuB,oDAA4C,GAAG;SACzE,CAAC;QACF,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC;QAElF,KAAK,CAAC,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;QAE1F,IAAI,OAAO,CAAC,YAAY,EAAE;YACtB,OAAO,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;YAC3C,UAAU,CAAC,IAAI,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,CAAC;SACjE;aAAM;YACH,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC9B,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CA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C;QAEnG,IAAI,0BAA0B,CAAC,MAAM,EAAE;YACnC,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,IAAI,iBAAiB,EAAE,0BAA0B,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;SACrK;aAAM;YACH,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;SAC1E;QAED,IAAI,CAAC,aAAa,GAAG,0BAA0B,CAAC,YAAY,IAAI,IAAI,CAAC;QACrE,IAAI,CAAC,SAAS,CAAC,4BAA4B,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACrE,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { RawTexture } from \"../Textures/rawTexture\";\r\n\r\nimport { ShaderMaterial } from \"../shaderMaterial\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Vector2 } from \"../../Maths/math.vector\";\r\n\r\nimport \"../../Shaders/greasedLine.fragment\";\r\nimport \"../../Shaders/greasedLine.vertex\";\r\nimport type { GreasedLineMaterialOptions, IGreasedLineMaterial } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport { GreasedLineMaterialDefaults } from \"./greasedLineMaterialDefaults\";\r\n\r\n/**\r\n * GreasedLineSimpleMaterial\r\n */\r\nexport class GreasedLineSimpleMaterial extends ShaderMaterial implements IGreasedLineMaterial {\r\n private _visibility: number;\r\n private _width: number;\r\n private _useDash: boolean;\r\n private _dashCount: number;\r\n private _dashArray: number;\r\n private _dashRatio: number;\r\n private _dashOffset: number;\r\n private _useColors: boolean;\r\n private _color: Color3 = Color3.White();\r\n private _colors: Nullable<Color3[]>;\r\n private _colorsDistributionType: GreasedLineMeshColorDistributionType = GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n private _colorMode: GreasedLineMeshColorMode;\r\n private _colorsSampling: number;\r\n private _resolution: Vector2;\r\n private _sizeAttenuation: boolean;\r\n private _colorsTexture: Nullable<RawTexture> = null;\r\n private _cameraFacing: boolean;\r\n\r\n /**\r\n * GreasedLineSimple material constructor\r\n * @param name material name\r\n * @param scene the scene\r\n * @param options material options\r\n */\r\n constructor(name: string, scene: Scene, options: GreasedLineMaterialOptions) {\r\n const defines = [\r\n `COLOR_DISTRIBUTION_TYPE_LINE ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE}.`,\r\n `COLOR_DISTRIBUTION_TYPE_SEGMENT ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT}.`,\r\n `COLOR_MODE_SET ${GreasedLineMeshColorMode.COLOR_MODE_SET}.`,\r\n `COLOR_MODE_ADD ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.`,\r\n `COLOR_MODE_MULTIPLY ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.`,\r\n ];\r\n const attributes = [\"position\", \"grl_widths\", \"grl_offsets\", \"grl_colorPointers\"];\r\n\r\n scene.useRightHandedSystem && defines.push(\"GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\");\r\n\r\n if (options.cameraFacing) {\r\n defines.push(\"GREASED_LINE_CAMERA_FACING\");\r\n attributes.push(\"grl_previousAndSide\", \"grl_nextAndCounters\");\r\n } else {\r\n attributes.push(\"grl_slopes\");\r\n attributes.push(\"grl_counters\");\r\n }\r\n\r\n super(\r\n name,\r\n scene,\r\n {\r\n vertex: \"greasedLine\",\r\n fragment: \"greasedLine\",\r\n },\r\n {\r\n attributes,\r\n uniforms: [\r\n \"world\",\r\n \"viewProjection\",\r\n \"view\",\r\n \"projection\",\r\n \"grlColorsWidth\",\r\n \"grlUseColors\",\r\n \"grlWidth\",\r\n \"grlColor\",\r\n \"grl_colorModeAndColorDistributionType\",\r\n \"grlResolution\",\r\n \"grlAspect\",\r\n \"grlAizeAttenuation\",\r\n \"grlDashArray\",\r\n \"grlDashOffset\",\r\n \"grlDashRatio\",\r\n \"grlUseDash\",\r\n \"grlVisibility\",\r\n ],\r\n samplers: [\"grlColors\"],\r\n defines,\r\n }\r\n );\r\n options = options || {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n\r\n const engine = scene.getEngine();\r\n\r\n this.visibility = options.visibility ?? 1;\r\n this.useDash = options.useDash ?? false;\r\n this.dashRatio = options.dashRatio ?? 0.5;\r\n this.dashOffset = options.dashOffset ?? 0;\r\n this.dashCount = options.dashCount ?? 1; // calculate the _dashArray value, call the setter\r\n this.width = options.width\r\n ? options.width\r\n : options.sizeAttenuation && options.cameraFacing\r\n ? GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED\r\n : GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n this.sizeAttenuation = options.sizeAttenuation ?? false;\r\n this.color = options.color ?? Color3.White();\r\n this.useColors = options.useColors ?? false;\r\n this.colorsDistributionType = options.colorDistributionType ?? GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n this.colorsSampling = options.colorsSampling ?? RawTexture.NEAREST_NEAREST;\r\n this.colorMode = options.colorMode ?? GreasedLineMeshColorMode.COLOR_MODE_SET;\r\n this._colors = options.colors ?? null;\r\n this._cameraFacing = options.cameraFacing ?? true;\r\n this.resolution = options.resolution ?? new Vector2(engine.getRenderWidth(), engine.getRenderHeight()); // calculate aspect call the setter\r\n\r\n if (options.colorsTexture) {\r\n this.colorsTexture = options.colorsTexture;\r\n } else {\r\n this.colorsTexture = GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n if (this._colors) {\r\n this.setColors(this._colors);\r\n }\r\n\r\n engine.onDisposeObservable.add(() => {\r\n GreasedLineTools.DisposeEmptyColorsTexture();\r\n });\r\n }\r\n\r\n /**\r\n * Disposes the plugin material.\r\n */\r\n public override dispose(): void {\r\n this._colorsTexture?.dispose();\r\n super.dispose();\r\n }\r\n\r\n private _setColorModeAndColorDistributionType() {\r\n this.setVector2(\"grl_colorModeAndColorDistributionType\", new Vector2(this._colorMode, this._colorsDistributionType));\r\n }\r\n\r\n /**\r\n * Updates the material. Use when material created in lazy mode.\r\n */\r\n public updateLazy() {\r\n if (this._colors) {\r\n this.setColors(this._colors, false, true);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the colors used to colorize the line\r\n */\r\n get colors() {\r\n return this._colors;\r\n }\r\n\r\n /**\r\n * Sets the colors used to colorize the line\r\n */\r\n set colors(value: Nullable<Color3[]>) {\r\n this.setColors(value);\r\n }\r\n\r\n /**\r\n * Creates or updates the colors texture\r\n * @param colors color table RGBA\r\n * @param lazy if lazy, the colors are not updated\r\n * @param forceNewTexture force creation of a new texture\r\n */\r\n public setColors(colors: Nullable<Color3[]>, lazy = false, forceNewTexture = false): void {\r\n const origColorsCount = this._colors?.length ?? 0;\r\n\r\n this._colors = colors;\r\n\r\n if (colors === null || colors.length === 0) {\r\n this._colorsTexture?.dispose();\r\n return;\r\n }\r\n\r\n if (lazy && !forceNewTexture) {\r\n return;\r\n }\r\n\r\n if (this._colorsTexture && origColorsCount === colors.length && !forceNewTexture) {\r\n const colorArray = GreasedLineTools.Color3toRGBAUint8(colors);\r\n this._colorsTexture.update(colorArray);\r\n } else {\r\n this._colorsTexture?.dispose();\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, colors, this.colorsSampling, this.getScene());\r\n }\r\n }\r\n\r\n /**\r\n * Gets the colors texture\r\n */\r\n get colorsTexture() {\r\n return (this._colorsTexture as RawTexture) ?? null;\r\n }\r\n\r\n /**\r\n * Sets the colorsTexture\r\n */\r\n set colorsTexture(value: RawTexture) {\r\n this._colorsTexture = value;\r\n this.setFloat(\"grlColorsWidth\", this._colorsTexture.getSize().width);\r\n this.setTexture(\"grlColors\", this._colorsTexture);\r\n }\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 get width() {\r\n return this._width;\r\n }\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 set width(value: number) {\r\n this._width = value;\r\n this.setFloat(\"grlWidth\", value);\r\n }\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n get useColors() {\r\n return this._useColors;\r\n }\r\n\r\n set useColors(value: boolean) {\r\n this._useColors = value;\r\n this.setFloat(\"grlUseColors\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n get colorsSampling() {\r\n return this._colorsSampling;\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n set colorsSampling(value: number) {\r\n this._colorsSampling = value;\r\n }\r\n\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 get visibility() {\r\n return this._visibility;\r\n }\r\n\r\n set visibility(value: number) {\r\n this._visibility = value;\r\n this.setFloat(\"grlVisibility\", value);\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n get useDash() {\r\n return this._useDash;\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n set useDash(value: boolean) {\r\n this._useDash = value;\r\n this.setFloat(\"grlUseDash\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the dash offset\r\n */\r\n get dashOffset() {\r\n return this._dashOffset;\r\n }\r\n\r\n /**\r\n * Sets the dash offset\r\n */\r\n set dashOffset(value: number) {\r\n this._dashOffset = value;\r\n this.setFloat(\"grlDashOffset\", value);\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n get dashRatio() {\r\n return this._dashRatio;\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n set dashRatio(value: number) {\r\n this._dashRatio = value;\r\n this.setFloat(\"grlDashRatio\", value);\r\n }\r\n\r\n /**\r\n * Gets the number of dashes in the line\r\n */\r\n get dashCount() {\r\n return this._dashCount;\r\n }\r\n /**\r\n * Sets the number of dashes in the line\r\n * @param value dash\r\n */\r\n set dashCount(value: number) {\r\n this._dashCount = value;\r\n this._dashArray = 1 / value;\r\n this.setFloat(\"grlDashArray\", this._dashArray);\r\n }\r\n\r\n /**\r\n * False means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n get sizeAttenuation() {\r\n return this._sizeAttenuation;\r\n }\r\n\r\n /**\r\n * Turn on/off attenuation of the width option and widths array.\r\n * @param value false means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n set sizeAttenuation(value: boolean) {\r\n this._sizeAttenuation = value;\r\n this.setFloat(\"grlSizeAttenuation\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the color of the line\r\n */\r\n get color() {\r\n return this.color;\r\n }\r\n\r\n /**\r\n * Sets the color of the line\r\n * @param value Color3\r\n */\r\n set color(value: Color3) {\r\n this.setColor(value);\r\n }\r\n\r\n /**\r\n * Sets the color of the line. If set the whole line will be mixed with this color according to the colorMode option.\r\n * The simple material always needs a color to be set. If you set it to null it will set the color to the default color (GreasedLineSimpleMaterial.DEFAULT_COLOR).\r\n * @param value color\r\n */\r\n public setColor(value: Nullable<Color3>) {\r\n value = value ?? GreasedLineMaterialDefaults.DEFAULT_COLOR;\r\n this._color = value;\r\n this.setColor3(\"grlColor\", value);\r\n }\r\n\r\n /**\r\n * Gets the color distributiopn type\r\n */\r\n get colorsDistributionType() {\r\n return this._colorsDistributionType;\r\n }\r\n\r\n /**\r\n * Sets the color distribution type\r\n * @see GreasedLineMeshColorDistributionType\r\n * @param value color distribution type\r\n */\r\n set colorsDistributionType(value: GreasedLineMeshColorDistributionType) {\r\n this._colorsDistributionType = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n get colorMode() {\r\n return this._colorMode;\r\n }\r\n\r\n /**\r\n * Sets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n set colorMode(value: GreasedLineMeshColorMode) {\r\n this._colorMode = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the resolution\r\n */\r\n get resolution() {\r\n return this._resolution;\r\n }\r\n\r\n /**\r\n * Sets the resolution\r\n * @param value resolution of the screen for GreasedLine\r\n */\r\n set resolution(value: Vector2) {\r\n this._resolution = value;\r\n this.setVector2(\"grlResolution\", value);\r\n this.setFloat(\"grlAspect\", value.x / value.y);\r\n }\r\n\r\n /**\r\n * Serializes this plugin material\r\n * @returns serializationObjec\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n const greasedLineMaterialOptions: GreasedLineMaterialOptions = {\r\n colorDistributionType: this._colorsDistributionType,\r\n colorsSampling: this._colorsSampling,\r\n colorMode: this._colorMode,\r\n color: this._color,\r\n dashCount: this._dashCount,\r\n dashOffset: this._dashOffset,\r\n dashRatio: this._dashRatio,\r\n resolution: this._resolution,\r\n sizeAttenuation: this._sizeAttenuation,\r\n useColors: this._useColors,\r\n useDash: this._useDash,\r\n visibility: this._visibility,\r\n width: this._width,\r\n cameraFacing: this._cameraFacing,\r\n };\r\n\r\n this._colors && (greasedLineMaterialOptions.colors = this._colors);\r\n\r\n serializationObject.greasedLineMaterialOptions = greasedLineMaterialOptions;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized objects\r\n * @param source serialized object\r\n * @param scene scene\r\n * @param _rootUrl root url for textures\r\n */\r\n public parse(source: any, scene: Scene, _rootUrl: string): void {\r\n // TODO: super.parse?\r\n const greasedLineMaterialOptions = <GreasedLineMaterialOptions>source.greasedLineMaterialOptions;\r\n\r\n this._colorsTexture?.dispose();\r\n\r\n greasedLineMaterialOptions.color && (this.color = greasedLineMaterialOptions.color);\r\n greasedLineMaterialOptions.colorDistributionType && (this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType);\r\n greasedLineMaterialOptions.colorsSampling && (this.colorsSampling = greasedLineMaterialOptions.colorsSampling);\r\n greasedLineMaterialOptions.colorMode && (this.colorMode = greasedLineMaterialOptions.colorMode);\r\n greasedLineMaterialOptions.useColors && (this.useColors = greasedLineMaterialOptions.useColors);\r\n greasedLineMaterialOptions.visibility && (this.visibility = greasedLineMaterialOptions.visibility);\r\n greasedLineMaterialOptions.useDash && (this.useDash = greasedLineMaterialOptions.useDash);\r\n greasedLineMaterialOptions.dashCount && (this.dashCount = greasedLineMaterialOptions.dashCount);\r\n greasedLineMaterialOptions.dashRatio && (this.dashRatio = greasedLineMaterialOptions.dashRatio);\r\n greasedLineMaterialOptions.dashOffset && (this.dashOffset = greasedLineMaterialOptions.dashOffset);\r\n greasedLineMaterialOptions.width && (this.width = greasedLineMaterialOptions.width);\r\n greasedLineMaterialOptions.sizeAttenuation && (this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation);\r\n greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);\r\n\r\n if (greasedLineMaterialOptions.colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, greasedLineMaterialOptions.colors, this.colorsSampling, this.getScene());\r\n } else {\r\n this.colorsTexture = GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n this._cameraFacing = greasedLineMaterialOptions.cameraFacing ?? true;\r\n this.setDefine(\"GREASED_LINE_CAMERA_FACING\", this._cameraFacing);\r\n }\r\n}\r\n"]}
|
|
@@ -3,7 +3,6 @@ import { NodeMaterialBlockConnectionPointTypes } from "../../Enums/nodeMaterialB
|
|
|
3
3
|
import { NodeMaterialBlockTargets } from "../../Enums/nodeMaterialBlockTargets.js";
|
|
4
4
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
5
5
|
import { Texture } from "../../../Textures/texture.js";
|
|
6
|
-
import { ShaderLanguage } from "../../../shaderLanguage.js";
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Base block used as input for post process
|
|
@@ -137,14 +136,14 @@ export class CurrentScreenBlock extends NodeMaterialBlock {
|
|
|
137
136
|
if (state.target === NodeMaterialBlockTargets.Fragment) {
|
|
138
137
|
return;
|
|
139
138
|
}
|
|
140
|
-
const textureReadFunc = state.shaderLanguage === ShaderLanguage.GLSL
|
|
139
|
+
const textureReadFunc = state.shaderLanguage === 0 /* ShaderLanguage.GLSL */
|
|
141
140
|
? `texture2D(${this._samplerName},`
|
|
142
141
|
: `textureSampleLevel(${this._samplerName}, ${this._samplerName + `Sampler`},`;
|
|
143
|
-
const complement = state.shaderLanguage === ShaderLanguage.GLSL ? "" : ", 0";
|
|
142
|
+
const complement = state.shaderLanguage === 0 /* ShaderLanguage.GLSL */ ? "" : ", 0";
|
|
144
143
|
state.compilationString += `${state._declareLocalVar(this._tempTextureRead, NodeMaterialBlockConnectionPointTypes.Vector4)} = ${textureReadFunc} ${uvInput.associatedVariableName}${complement});\n`;
|
|
145
144
|
return;
|
|
146
145
|
}
|
|
147
|
-
const textureReadFunc = state.shaderLanguage === ShaderLanguage.GLSL
|
|
146
|
+
const textureReadFunc = state.shaderLanguage === 0 /* ShaderLanguage.GLSL */
|
|
148
147
|
? `texture2D(${this._samplerName},`
|
|
149
148
|
: `textureSample(${this._samplerName}, ${this._samplerName + `Sampler`},`;
|
|
150
149
|
if (this.uv.ownerBlock.target === NodeMaterialBlockTargets.Fragment) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currentScreenBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/Dual/currentScreenBlock.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;AAMhF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGpD,OAAO,EAAE,cAAc,EAAE,mCAAsC;AAC/D,OAAO,EAAE,SAAS,EAAE,yCAA+B;AAEnD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAsBrD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;QA1BpD,iBAAY,GAAG,gBAAgB,CAAC;QAWxC;;WAEG;QACI,wBAAmB,GAAG,KAAK,CAAC;QAEnC;;WAEG;QACI,yBAAoB,GAAG,KAAK,CAAC;QAShC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QAEvB,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,qCAAqC,CAAC,UAAU,EAAE,KAAK,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;QAE9H,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,qCAAqC,CAAC,MAAM,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAC5G,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,qCAAqC,CAAC,MAAM,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAC3G,IAAI,CAAC,cAAc,CAAC,GA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B,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACnE,mBAAmB,CAAC,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,CAAC;QACrE,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;YAC9C,mBAAmB,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;SAC1D;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB,EAAE,KAAY,EAAE,OAAe;QAChF,KAAK,CAAC,YAAY,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAExD,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC,mBAAmB,CAAC;QACnE,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,mBAAmB,CAAC,oBAAoB,CAAC;QAEvE,IAAI,mBAAmB,CAAC,OAAO,EAAE;YAC7B,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YAChF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAY,CAAC;SACxF;IACL,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,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 type { AbstractMesh } from \"../../../../Meshes/abstractMesh\";\r\nimport type { NodeMaterialDefines, NodeMaterial } from \"../../nodeMaterial\";\r\nimport type { BaseTexture } from \"../../../Textures/baseTexture\";\r\nimport type { Nullable } from \"../../../../types\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { Texture } from \"../../../Textures/texture\";\r\nimport type { Scene } from \"../../../../scene\";\r\nimport type { InputBlock } from \"../Input/inputBlock\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\n/**\r\n * Base block used as input for post process\r\n */\r\nexport class CurrentScreenBlock extends NodeMaterialBlock {\r\n private _samplerName = \"textureSampler\";\r\n private _linearDefineName: string;\r\n private _gammaDefineName: string;\r\n private _mainUVName: string;\r\n private _tempTextureRead: string;\r\n\r\n /**\r\n * Gets or sets the texture associated with the node\r\n */\r\n public texture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if content needs to be converted to gamma space\r\n */\r\n public convertToGammaSpace = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if content needs to be converted to linear space\r\n */\r\n public convertToLinearSpace = false;\r\n\r\n /**\r\n * Create a new CurrentScreenBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.VertexAndFragment);\r\n\r\n this._isUnique = false;\r\n\r\n this.registerInput(\"uv\", NodeMaterialBlockConnectionPointTypes.AutoDetect, false, NodeMaterialBlockTargets.VertexAndFragment);\r\n\r\n this.registerOutput(\"rgba\", NodeMaterialBlockConnectionPointTypes.Color4, NodeMaterialBlockTargets.Neutral);\r\n this.registerOutput(\"rgb\", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Neutral);\r\n this.registerOutput(\"r\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Neutral);\r\n this.registerOutput(\"g\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Neutral);\r\n this.registerOutput(\"b\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Neutral);\r\n this.registerOutput(\"a\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Neutral);\r\n\r\n this._inputs[0].addExcludedConnectionPointFromAllowedTypes(\r\n NodeMaterialBlockConnectionPointTypes.Vector2 | NodeMaterialBlockConnectionPointTypes.Vector3 | NodeMaterialBlockConnectionPointTypes.Vector4\r\n );\r\n\r\n this._inputs[0]._prioritizeVertex = 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 \"CurrentScreenBlock\";\r\n }\r\n\r\n /**\r\n * Gets the uv input component\r\n */\r\n public get uv(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the rgba output component\r\n */\r\n public get rgba(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the rgb output component\r\n */\r\n public get rgb(): NodeMaterialConnectionPoint {\r\n return this._outputs[1];\r\n }\r\n\r\n /**\r\n * Gets the r output component\r\n */\r\n public get r(): NodeMaterialConnectionPoint {\r\n return this._outputs[2];\r\n }\r\n\r\n /**\r\n * Gets the g output component\r\n */\r\n public get g(): NodeMaterialConnectionPoint {\r\n return this._outputs[3];\r\n }\r\n\r\n /**\r\n * Gets the b output component\r\n */\r\n public get b(): NodeMaterialConnectionPoint {\r\n return this._outputs[4];\r\n }\r\n\r\n /**\r\n * Gets the a output component\r\n */\r\n public get a(): NodeMaterialConnectionPoint {\r\n return this._outputs[5];\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(this._samplerName);\r\n }\r\n\r\n public override get target() {\r\n if (!this.uv.isConnected) {\r\n return NodeMaterialBlockTargets.VertexAndFragment;\r\n }\r\n\r\n if (this.uv.sourceBlock!.isInput) {\r\n return NodeMaterialBlockTargets.VertexAndFragment;\r\n }\r\n\r\n return NodeMaterialBlockTargets.Fragment;\r\n }\r\n\r\n public override prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines) {\r\n defines.setValue(this._linearDefineName, this.convertToGammaSpace, true);\r\n defines.setValue(this._gammaDefineName, this.convertToLinearSpace, true);\r\n }\r\n\r\n public override isReady() {\r\n if (this.texture && !this.texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _injectVertexCode(state: NodeMaterialBuildState) {\r\n const uvInput = this.uv;\r\n\r\n if (uvInput.connectedPoint!.ownerBlock.isInput) {\r\n const uvInputOwnerBlock = uvInput.connectedPoint!.ownerBlock as InputBlock;\r\n\r\n if (!uvInputOwnerBlock.isAttribute) {\r\n state._emitUniformFromString(uvInput.associatedVariableName, NodeMaterialBlockConnectionPointTypes.Vector2);\r\n }\r\n }\r\n\r\n this._mainUVName = \"vMain\" + uvInput.associatedVariableName;\r\n\r\n state._emitVaryingFromString(this._mainUVName, NodeMaterialBlockConnectionPointTypes.Vector2);\r\n\r\n state.compilationString += `${this._mainUVName} = ${uvInput.associatedVariableName}.xy;\\n`;\r\n\r\n if (!this._outputs.some((o) => o.isConnectedInVertexShader)) {\r\n return;\r\n }\r\n\r\n this._writeTextureRead(state, true);\r\n\r\n for (const output of this._outputs) {\r\n if (output.hasEndpoints) {\r\n this._writeOutput(state, output, output.name, true);\r\n }\r\n }\r\n }\r\n\r\n private _writeTextureRead(state: NodeMaterialBuildState, vertexMode = false) {\r\n const uvInput = this.uv;\r\n\r\n if (vertexMode) {\r\n if (state.target === NodeMaterialBlockTargets.Fragment) {\r\n return;\r\n }\r\n const textureReadFunc =\r\n state.shaderLanguage === ShaderLanguage.GLSL\r\n ? `texture2D(${this._samplerName},`\r\n : `textureSampleLevel(${this._samplerName}, ${this._samplerName + Constants.AUTOSAMPLERSUFFIX},`;\r\n\r\n const complement = state.shaderLanguage === ShaderLanguage.GLSL ? \"\" : \", 0\";\r\n\r\n state.compilationString += `${state._declareLocalVar(this._tempTextureRead, NodeMaterialBlockConnectionPointTypes.Vector4)} = ${textureReadFunc} ${uvInput.associatedVariableName}${complement});\\n`;\r\n return;\r\n }\r\n\r\n const textureReadFunc =\r\n state.shaderLanguage === ShaderLanguage.GLSL\r\n ? `texture2D(${this._samplerName},`\r\n : `textureSample(${this._samplerName}, ${this._samplerName + Constants.AUTOSAMPLERSUFFIX},`;\r\n\r\n if (this.uv.ownerBlock.target === NodeMaterialBlockTargets.Fragment) {\r\n state.compilationString += `${state._declareLocalVar(this._tempTextureRead, NodeMaterialBlockConnectionPointTypes.Vector4)} = ${textureReadFunc} ${uvInput.associatedVariableName});\\n`;\r\n return;\r\n }\r\n\r\n state.compilationString += `${state._declareLocalVar(this._tempTextureRead, NodeMaterialBlockConnectionPointTypes.Vector4)} = ${textureReadFunc} ${this._mainUVName});\\n`;\r\n }\r\n\r\n private _writeOutput(state: NodeMaterialBuildState, output: NodeMaterialConnectionPoint, swizzle: string, vertexMode = false) {\r\n if (vertexMode) {\r\n if (state.target === NodeMaterialBlockTargets.Fragment) {\r\n return;\r\n }\r\n\r\n state.compilationString += `${state._declareOutput(output)} = ${this._tempTextureRead}.${swizzle};\\n`;\r\n\r\n return;\r\n }\r\n\r\n if (this.uv.ownerBlock.target === NodeMaterialBlockTargets.Fragment) {\r\n state.compilationString += `${state._declareOutput(output)} = ${this._tempTextureRead}.${swizzle};\\n`;\r\n return;\r\n }\r\n\r\n state.compilationString += `${state._declareOutput(output)} = ${this._tempTextureRead}.${swizzle};\\n`;\r\n\r\n state.compilationString += `#ifdef ${this._linearDefineName}\\n`;\r\n state.compilationString += `${output.associatedVariableName} = toGammaSpace(${output.associatedVariableName});\\n`;\r\n state.compilationString += `#endif\\n`;\r\n\r\n state.compilationString += `#ifdef ${this._gammaDefineName}\\n`;\r\n state.compilationString += `${output.associatedVariableName} = toLinearSpace(${output.associatedVariableName});\\n`;\r\n state.compilationString += `#endif\\n`;\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n this._tempTextureRead = state._getFreeVariableName(\"tempTextureRead\");\r\n\r\n if (state.sharedData.blockingBlocks.indexOf(this) < 0) {\r\n state.sharedData.blockingBlocks.push(this);\r\n }\r\n if (state.sharedData.textureBlocks.indexOf(this) < 0) {\r\n state.sharedData.textureBlocks.push(this);\r\n }\r\n if (state.sharedData.blocksWithDefines.indexOf(this) < 0) {\r\n state.sharedData.blocksWithDefines.push(this);\r\n }\r\n\r\n if (state.target !== NodeMaterialBlockTargets.Fragment) {\r\n // Vertex\r\n state._emit2DSampler(this._samplerName);\r\n this._injectVertexCode(state);\r\n return;\r\n }\r\n\r\n // Fragment\r\n if (!this._outputs.some((o) => o.isConnectedInFragmentShader)) {\r\n return;\r\n }\r\n\r\n state._emit2DSampler(this._samplerName);\r\n\r\n this._linearDefineName = state._getFreeDefineName(\"ISLINEAR\");\r\n this._gammaDefineName = state._getFreeDefineName(\"ISGAMMA\");\r\n\r\n const comments = `//${this.name}`;\r\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\r\n\r\n this._writeTextureRead(state);\r\n\r\n for (const output of this._outputs) {\r\n if (output.hasEndpoints) {\r\n this._writeOutput(state, output, output.name);\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.convertToGammaSpace = this.convertToGammaSpace;\r\n serializationObject.convertToLinearSpace = this.convertToLinearSpace;\r\n if (this.texture && !this.texture.isRenderTarget) {\r\n serializationObject.texture = this.texture.serialize();\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any, scene: Scene, rootUrl: string) {\r\n super._deserialize(serializationObject, scene, rootUrl);\r\n\r\n this.convertToGammaSpace = serializationObject.convertToGammaSpace;\r\n this.convertToLinearSpace = !!serializationObject.convertToLinearSpace;\r\n\r\n if (serializationObject.texture) {\r\n rootUrl = serializationObject.texture.url.indexOf(\"data:\") === 0 ? \"\" : rootUrl;\r\n this.texture = Texture.Parse(serializationObject.texture, scene, rootUrl) as Texture;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CurrentScreenBlock\", CurrentScreenBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"currentScreenBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/Dual/currentScreenBlock.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;AAMhF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAIpD,OAAO,EAAE,SAAS,EAAE,yCAA+B;AAEnD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAsBrD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;QA1BpD,iBAAY,GAAG,gBAAgB,CAAC;QAWxC;;WAEG;QACI,wBAAmB,GAAG,KAAK,CAAC;QAEnC;;WAEG;QACI,yBAAoB,GAAG,KAAK,CAAC;QAShC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QAEvB,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,qCAAqC,CAAC,UAAU,EAAE,KAAK,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;QAE9H,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,qCAAqC,CAAC,MAAM,EAAE,wBAAwB,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EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;aACjD;SACJ;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAEe,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACnE,mBAAmB,CAAC,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,CAAC;QACrE,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;YAC9C,mBAAmB,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;SAC1D;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB,EAAE,KAAY,EAAE,OAAe;QAChF,KAAK,CAAC,YAAY,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAExD,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC,mBAAmB,CAAC;QACnE,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,mBAAmB,CAAC,oBAAoB,CAAC;QAEvE,IAAI,mBAAmB,CAAC,OAAO,EAAE;YAC7B,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YAChF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAY,CAAC;SACxF;IACL,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,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 type { AbstractMesh } from \"../../../../Meshes/abstractMesh\";\r\nimport type { NodeMaterialDefines, NodeMaterial } from \"../../nodeMaterial\";\r\nimport type { BaseTexture } from \"../../../Textures/baseTexture\";\r\nimport type { Nullable } from \"../../../../types\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { Texture } from \"../../../Textures/texture\";\r\nimport type { Scene } from \"../../../../scene\";\r\nimport type { InputBlock } from \"../Input/inputBlock\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\n/**\r\n * Base block used as input for post process\r\n */\r\nexport class CurrentScreenBlock extends NodeMaterialBlock {\r\n private _samplerName = \"textureSampler\";\r\n private _linearDefineName: string;\r\n private _gammaDefineName: string;\r\n private _mainUVName: string;\r\n private _tempTextureRead: string;\r\n\r\n /**\r\n * Gets or sets the texture associated with the node\r\n */\r\n public texture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if content needs to be converted to gamma space\r\n */\r\n public convertToGammaSpace = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if content needs to be converted to linear space\r\n */\r\n public convertToLinearSpace = false;\r\n\r\n /**\r\n * Create a new CurrentScreenBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.VertexAndFragment);\r\n\r\n this._isUnique = false;\r\n\r\n this.registerInput(\"uv\", NodeMaterialBlockConnectionPointTypes.AutoDetect, false, NodeMaterialBlockTargets.VertexAndFragment);\r\n\r\n this.registerOutput(\"rgba\", NodeMaterialBlockConnectionPointTypes.Color4, NodeMaterialBlockTargets.Neutral);\r\n this.registerOutput(\"rgb\", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Neutral);\r\n this.registerOutput(\"r\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Neutral);\r\n this.registerOutput(\"g\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Neutral);\r\n this.registerOutput(\"b\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Neutral);\r\n this.registerOutput(\"a\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Neutral);\r\n\r\n this._inputs[0].addExcludedConnectionPointFromAllowedTypes(\r\n NodeMaterialBlockConnectionPointTypes.Vector2 | NodeMaterialBlockConnectionPointTypes.Vector3 | NodeMaterialBlockConnectionPointTypes.Vector4\r\n );\r\n\r\n this._inputs[0]._prioritizeVertex = 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 \"CurrentScreenBlock\";\r\n }\r\n\r\n /**\r\n * Gets the uv input component\r\n */\r\n public get uv(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the rgba output component\r\n */\r\n public get rgba(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the rgb output component\r\n */\r\n public get rgb(): NodeMaterialConnectionPoint {\r\n return this._outputs[1];\r\n }\r\n\r\n /**\r\n * Gets the r output component\r\n */\r\n public get r(): NodeMaterialConnectionPoint {\r\n return this._outputs[2];\r\n }\r\n\r\n /**\r\n * Gets the g output component\r\n */\r\n public get g(): NodeMaterialConnectionPoint {\r\n return this._outputs[3];\r\n }\r\n\r\n /**\r\n * Gets the b output component\r\n */\r\n public get b(): NodeMaterialConnectionPoint {\r\n return this._outputs[4];\r\n }\r\n\r\n /**\r\n * Gets the a output component\r\n */\r\n public get a(): NodeMaterialConnectionPoint {\r\n return this._outputs[5];\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(this._samplerName);\r\n }\r\n\r\n public override get target() {\r\n if (!this.uv.isConnected) {\r\n return NodeMaterialBlockTargets.VertexAndFragment;\r\n }\r\n\r\n if (this.uv.sourceBlock!.isInput) {\r\n return NodeMaterialBlockTargets.VertexAndFragment;\r\n }\r\n\r\n return NodeMaterialBlockTargets.Fragment;\r\n }\r\n\r\n public override prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines) {\r\n defines.setValue(this._linearDefineName, this.convertToGammaSpace, true);\r\n defines.setValue(this._gammaDefineName, this.convertToLinearSpace, true);\r\n }\r\n\r\n public override isReady() {\r\n if (this.texture && !this.texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _injectVertexCode(state: NodeMaterialBuildState) {\r\n const uvInput = this.uv;\r\n\r\n if (uvInput.connectedPoint!.ownerBlock.isInput) {\r\n const uvInputOwnerBlock = uvInput.connectedPoint!.ownerBlock as InputBlock;\r\n\r\n if (!uvInputOwnerBlock.isAttribute) {\r\n state._emitUniformFromString(uvInput.associatedVariableName, NodeMaterialBlockConnectionPointTypes.Vector2);\r\n }\r\n }\r\n\r\n this._mainUVName = \"vMain\" + uvInput.associatedVariableName;\r\n\r\n state._emitVaryingFromString(this._mainUVName, NodeMaterialBlockConnectionPointTypes.Vector2);\r\n\r\n state.compilationString += `${this._mainUVName} = ${uvInput.associatedVariableName}.xy;\\n`;\r\n\r\n if (!this._outputs.some((o) => o.isConnectedInVertexShader)) {\r\n return;\r\n }\r\n\r\n this._writeTextureRead(state, true);\r\n\r\n for (const output of this._outputs) {\r\n if (output.hasEndpoints) {\r\n this._writeOutput(state, output, output.name, true);\r\n }\r\n }\r\n }\r\n\r\n private _writeTextureRead(state: NodeMaterialBuildState, vertexMode = false) {\r\n const uvInput = this.uv;\r\n\r\n if (vertexMode) {\r\n if (state.target === NodeMaterialBlockTargets.Fragment) {\r\n return;\r\n }\r\n const textureReadFunc =\r\n state.shaderLanguage === ShaderLanguage.GLSL\r\n ? `texture2D(${this._samplerName},`\r\n : `textureSampleLevel(${this._samplerName}, ${this._samplerName + Constants.AUTOSAMPLERSUFFIX},`;\r\n\r\n const complement = state.shaderLanguage === ShaderLanguage.GLSL ? \"\" : \", 0\";\r\n\r\n state.compilationString += `${state._declareLocalVar(this._tempTextureRead, NodeMaterialBlockConnectionPointTypes.Vector4)} = ${textureReadFunc} ${uvInput.associatedVariableName}${complement});\\n`;\r\n return;\r\n }\r\n\r\n const textureReadFunc =\r\n state.shaderLanguage === ShaderLanguage.GLSL\r\n ? `texture2D(${this._samplerName},`\r\n : `textureSample(${this._samplerName}, ${this._samplerName + Constants.AUTOSAMPLERSUFFIX},`;\r\n\r\n if (this.uv.ownerBlock.target === NodeMaterialBlockTargets.Fragment) {\r\n state.compilationString += `${state._declareLocalVar(this._tempTextureRead, NodeMaterialBlockConnectionPointTypes.Vector4)} = ${textureReadFunc} ${uvInput.associatedVariableName});\\n`;\r\n return;\r\n }\r\n\r\n state.compilationString += `${state._declareLocalVar(this._tempTextureRead, NodeMaterialBlockConnectionPointTypes.Vector4)} = ${textureReadFunc} ${this._mainUVName});\\n`;\r\n }\r\n\r\n private _writeOutput(state: NodeMaterialBuildState, output: NodeMaterialConnectionPoint, swizzle: string, vertexMode = false) {\r\n if (vertexMode) {\r\n if (state.target === NodeMaterialBlockTargets.Fragment) {\r\n return;\r\n }\r\n\r\n state.compilationString += `${state._declareOutput(output)} = ${this._tempTextureRead}.${swizzle};\\n`;\r\n\r\n return;\r\n }\r\n\r\n if (this.uv.ownerBlock.target === NodeMaterialBlockTargets.Fragment) {\r\n state.compilationString += `${state._declareOutput(output)} = ${this._tempTextureRead}.${swizzle};\\n`;\r\n return;\r\n }\r\n\r\n state.compilationString += `${state._declareOutput(output)} = ${this._tempTextureRead}.${swizzle};\\n`;\r\n\r\n state.compilationString += `#ifdef ${this._linearDefineName}\\n`;\r\n state.compilationString += `${output.associatedVariableName} = toGammaSpace(${output.associatedVariableName});\\n`;\r\n state.compilationString += `#endif\\n`;\r\n\r\n state.compilationString += `#ifdef ${this._gammaDefineName}\\n`;\r\n state.compilationString += `${output.associatedVariableName} = toLinearSpace(${output.associatedVariableName});\\n`;\r\n state.compilationString += `#endif\\n`;\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n this._tempTextureRead = state._getFreeVariableName(\"tempTextureRead\");\r\n\r\n if (state.sharedData.blockingBlocks.indexOf(this) < 0) {\r\n state.sharedData.blockingBlocks.push(this);\r\n }\r\n if (state.sharedData.textureBlocks.indexOf(this) < 0) {\r\n state.sharedData.textureBlocks.push(this);\r\n }\r\n if (state.sharedData.blocksWithDefines.indexOf(this) < 0) {\r\n state.sharedData.blocksWithDefines.push(this);\r\n }\r\n\r\n if (state.target !== NodeMaterialBlockTargets.Fragment) {\r\n // Vertex\r\n state._emit2DSampler(this._samplerName);\r\n this._injectVertexCode(state);\r\n return;\r\n }\r\n\r\n // Fragment\r\n if (!this._outputs.some((o) => o.isConnectedInFragmentShader)) {\r\n return;\r\n }\r\n\r\n state._emit2DSampler(this._samplerName);\r\n\r\n this._linearDefineName = state._getFreeDefineName(\"ISLINEAR\");\r\n this._gammaDefineName = state._getFreeDefineName(\"ISGAMMA\");\r\n\r\n const comments = `//${this.name}`;\r\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\r\n\r\n this._writeTextureRead(state);\r\n\r\n for (const output of this._outputs) {\r\n if (output.hasEndpoints) {\r\n this._writeOutput(state, output, output.name);\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.convertToGammaSpace = this.convertToGammaSpace;\r\n serializationObject.convertToLinearSpace = this.convertToLinearSpace;\r\n if (this.texture && !this.texture.isRenderTarget) {\r\n serializationObject.texture = this.texture.serialize();\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any, scene: Scene, rootUrl: string) {\r\n super._deserialize(serializationObject, scene, rootUrl);\r\n\r\n this.convertToGammaSpace = serializationObject.convertToGammaSpace;\r\n this.convertToLinearSpace = !!serializationObject.convertToLinearSpace;\r\n\r\n if (serializationObject.texture) {\r\n rootUrl = serializationObject.texture.url.indexOf(\"data:\") === 0 ? \"\" : rootUrl;\r\n this.texture = Texture.Parse(serializationObject.texture, scene, rootUrl) as Texture;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CurrentScreenBlock\", CurrentScreenBlock);\r\n"]}
|
|
@@ -6,7 +6,6 @@ import { InputBlock } from "../Input/inputBlock.js";
|
|
|
6
6
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
7
7
|
import "../../../../Shaders/ShadersInclude/fogFragmentDeclaration.js";
|
|
8
8
|
import { GetFogState } from "../../../materialHelper.functions.js";
|
|
9
|
-
import { ShaderLanguage } from "../../../shaderLanguage.js";
|
|
10
9
|
/**
|
|
11
10
|
* Block used to add support for scene fog
|
|
12
11
|
*/
|
|
@@ -101,7 +100,7 @@ export class FogBlock extends NodeMaterialBlock {
|
|
|
101
100
|
let replaceStrings = [];
|
|
102
101
|
let prefix1 = "";
|
|
103
102
|
let prefix2 = "";
|
|
104
|
-
if (state.shaderLanguage === ShaderLanguage.WGSL) {
|
|
103
|
+
if (state.shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
105
104
|
replaceStrings = [
|
|
106
105
|
{ search: /fn CalcFogFactor\(\)/, replace: "fn CalcFogFactor(vFogDistance: vec3f, vFogInfos: vec4f)" },
|
|
107
106
|
{ search: /uniforms.vFogInfos/g, replace: "vFogInfos" },
|
|
@@ -138,7 +137,7 @@ export class FogBlock extends NodeMaterialBlock {
|
|
|
138
137
|
const view = this.view;
|
|
139
138
|
this._fogDistanceName = state._getFreeVariableName("vFogDistance");
|
|
140
139
|
state._emitVaryingFromString(this._fogDistanceName, NodeMaterialBlockConnectionPointTypes.Vector3);
|
|
141
|
-
const prefix = state.shaderLanguage === ShaderLanguage.WGSL ? "vertexOutputs." : "";
|
|
140
|
+
const prefix = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? "vertexOutputs." : "";
|
|
142
141
|
state.compilationString += `${prefix}${this._fogDistanceName} = (${view.associatedVariableName} * ${worldPos.associatedVariableName}).xyz;\n`;
|
|
143
142
|
}
|
|
144
143
|
return this;
|