@onerjs/core 8.41.6 → 8.41.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animation.d.ts +6 -2
- package/Animations/animation.js +28 -4
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.d.ts +2 -1
- package/Animations/animationGroup.js +3 -2
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/animatorAvatar.d.ts +161 -0
- package/Animations/animatorAvatar.js +573 -0
- package/Animations/animatorAvatar.js.map +1 -0
- package/Animations/index.d.ts +1 -0
- package/Animations/index.js +1 -0
- package/Animations/index.js.map +1 -1
- package/AudioV2/webAudio/webAudioSoundSource.d.ts +2 -2
- package/AudioV2/webAudio/webAudioSoundSource.js +12 -2
- package/AudioV2/webAudio/webAudioSoundSource.js.map +1 -1
- package/Bones/index.d.ts +1 -0
- package/Bones/index.js +1 -0
- package/Bones/index.js.map +1 -1
- package/Bones/skeleton.d.ts +13 -0
- package/Bones/skeleton.functions.d.ts +26 -0
- package/Bones/skeleton.functions.js +91 -0
- package/Bones/skeleton.functions.js.map +1 -0
- package/Bones/skeleton.js +26 -0
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/geospatialCamera.js +21 -20
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Cameras/geospatialCameraMovement.d.ts +8 -1
- package/Cameras/geospatialCameraMovement.js +29 -8
- package/Cameras/geospatialCameraMovement.js.map +1 -1
- package/Collisions/gpuPicker.d.ts +11 -0
- package/Collisions/gpuPicker.js +148 -19
- package/Collisions/gpuPicker.js.map +1 -1
- package/Debug/skeletonViewer.d.ts +4 -8
- package/Debug/skeletonViewer.js +13 -22
- package/Debug/skeletonViewer.js.map +1 -1
- package/Engines/Extensions/engine.multiview.d.ts +2 -0
- package/Engines/Extensions/engine.multiview.js +7 -3
- package/Engines/Extensions/engine.multiview.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +4 -0
- package/Engines/constants.js +4 -0
- package/Engines/constants.js.map +1 -1
- package/Instrumentation/engineInstrumentation.js +2 -1
- package/Instrumentation/engineInstrumentation.js.map +1 -1
- package/Layers/effectLayer.js +1 -3
- package/Layers/effectLayer.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +2 -3
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +37 -2
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.d.ts +109 -0
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js +210 -0
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +71 -15
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.d.ts +86 -0
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js +161 -0
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js.map +1 -0
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +0 -6
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js +0 -1
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js +0 -1
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js.map +1 -1
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +14 -0
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +14 -0
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +20 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js +20 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/depthSourceBlock.d.ts +13 -0
- package/Materials/Node/Blocks/Dual/depthSourceBlock.js +13 -0
- package/Materials/Node/Blocks/Dual/depthSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.d.ts +21 -0
- package/Materials/Node/Blocks/Dual/fogBlock.js +21 -0
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.d.ts +21 -0
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +21 -0
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.d.ts +38 -0
- package/Materials/Node/Blocks/Dual/lightBlock.js +38 -0
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +29 -0
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +29 -0
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.d.ts +5 -0
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js +5 -0
- package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.d.ts +16 -0
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +16 -0
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.d.ts +16 -0
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js +16 -0
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.d.ts +34 -0
- package/Materials/Node/Blocks/Dual/textureBlock.js +34 -0
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.d.ts +17 -0
- package/Materials/Node/Blocks/Fragment/TBNBlock.js +17 -2
- package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.d.ts +7 -0
- package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.js +7 -0
- package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +21 -0
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +21 -0
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.d.ts +10 -0
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +10 -0
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.d.ts +28 -0
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +28 -0
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +30 -0
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +30 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.d.ts +4 -0
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +4 -0
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.d.ts +5 -0
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js +5 -0
- package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/twirlBlock.d.ts +3 -0
- package/Materials/Node/Blocks/Fragment/twirlBlock.js +3 -0
- package/Materials/Node/Blocks/Fragment/twirlBlock.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.d.ts +6 -0
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +6 -0
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.d.ts +16 -0
- package/Materials/Node/Blocks/Input/inputBlock.js +16 -1
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +5 -0
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js +5 -0
- package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +10 -0
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js +10 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +23 -0
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +23 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/iridescenceBlock.d.ts +17 -0
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js +17 -0
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +41 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +41 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +21 -0
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +21 -0
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +29 -0
- package/Materials/Node/Blocks/PBR/refractionBlock.js +29 -0
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.d.ts +14 -0
- package/Materials/Node/Blocks/PBR/sheenBlock.js +14 -0
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.d.ts +7 -0
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +7 -0
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Particle/particleTextureBlock.d.ts +23 -0
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js +23 -0
- package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportInBlock.d.ts +6 -0
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js +6 -0
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.d.ts +17 -0
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.js +17 -0
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/bonesBlock.d.ts +22 -0
- package/Materials/Node/Blocks/Vertex/bonesBlock.js +22 -0
- package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.d.ts +13 -0
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +13 -0
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +20 -0
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +20 -0
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.d.ts +27 -0
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +27 -0
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/Blocks/clampBlock.d.ts +10 -0
- package/Materials/Node/Blocks/clampBlock.js +10 -0
- package/Materials/Node/Blocks/clampBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.d.ts +10 -0
- package/Materials/Node/Blocks/cloudBlock.js +10 -0
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/colorMergerBlock.d.ts +10 -0
- package/Materials/Node/Blocks/colorMergerBlock.js +10 -0
- package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
- package/Materials/Node/Blocks/conditionalBlock.d.ts +14 -0
- package/Materials/Node/Blocks/conditionalBlock.js +14 -0
- package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
- package/Materials/Node/Blocks/curveBlock.d.ts +10 -0
- package/Materials/Node/Blocks/curveBlock.js +10 -0
- package/Materials/Node/Blocks/curveBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.d.ts +10 -0
- package/Materials/Node/Blocks/customBlock.js +10 -0
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/debugBlock.d.ts +10 -0
- package/Materials/Node/Blocks/debugBlock.js +10 -0
- package/Materials/Node/Blocks/debugBlock.js.map +1 -1
- package/Materials/Node/Blocks/fresnelBlock.d.ts +4 -0
- package/Materials/Node/Blocks/fresnelBlock.js +4 -0
- package/Materials/Node/Blocks/fresnelBlock.js.map +1 -1
- package/Materials/Node/Blocks/gradientBlock.d.ts +10 -0
- package/Materials/Node/Blocks/gradientBlock.js +10 -0
- package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
- package/Materials/Node/Blocks/loopBlock.d.ts +10 -0
- package/Materials/Node/Blocks/loopBlock.js +10 -0
- package/Materials/Node/Blocks/loopBlock.js.map +1 -1
- package/Materials/Node/Blocks/matrixBuilderBlock.d.ts +1 -0
- package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -0
- package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.d.ts +10 -0
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js +10 -0
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
- package/Materials/Node/Blocks/pannerBlock.d.ts +5 -0
- package/Materials/Node/Blocks/pannerBlock.js +5 -0
- package/Materials/Node/Blocks/pannerBlock.js.map +1 -1
- package/Materials/Node/Blocks/remapBlock.d.ts +10 -0
- package/Materials/Node/Blocks/remapBlock.js +10 -0
- package/Materials/Node/Blocks/remapBlock.js.map +1 -1
- package/Materials/Node/Blocks/rotate2dBlock.d.ts +1 -0
- package/Materials/Node/Blocks/rotate2dBlock.js +1 -0
- package/Materials/Node/Blocks/rotate2dBlock.js.map +1 -1
- package/Materials/Node/Blocks/transformBlock.d.ts +10 -0
- package/Materials/Node/Blocks/transformBlock.js +10 -0
- package/Materials/Node/Blocks/transformBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.d.ts +22 -0
- package/Materials/Node/Blocks/triPlanarBlock.js +22 -0
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/trigonometryBlock.d.ts +10 -0
- package/Materials/Node/Blocks/trigonometryBlock.js +10 -0
- package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
- package/Materials/Node/Blocks/vectorMergerBlock.d.ts +10 -0
- package/Materials/Node/Blocks/vectorMergerBlock.js +10 -0
- package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
- package/Materials/Node/Blocks/viewDirectionBlock.d.ts +5 -0
- package/Materials/Node/Blocks/viewDirectionBlock.js +5 -0
- package/Materials/Node/Blocks/viewDirectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/waveBlock.d.ts +10 -0
- package/Materials/Node/Blocks/waveBlock.js +10 -0
- package/Materials/Node/Blocks/waveBlock.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.d.ts +1 -0
- package/Materials/Node/Blocks/worleyNoise3DBlock.js +1 -0
- package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +13 -0
- package/Materials/Node/nodeMaterial.js +14 -2
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.d.ts +0 -3
- package/Materials/Node/nodeMaterialBlock.js +1 -6
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +1 -2
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js +1 -1
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/index.d.ts +2 -0
- package/Materials/index.js +2 -0
- package/Materials/index.js.map +1 -1
- package/Maths/math.constants.d.ts +2 -1
- package/Maths/math.constants.js +3 -2
- package/Maths/math.constants.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +17 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/instancedMesh.js +1 -0
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +5 -0
- package/Meshes/mesh.js +39 -16
- package/Meshes/mesh.js.map +1 -1
- package/Misc/dataStorage.d.ts +13 -0
- package/Misc/dataStorage.js +25 -0
- package/Misc/dataStorage.js.map +1 -1
- package/Morph/morphTarget.d.ts +9 -5
- package/Morph/morphTarget.js +15 -7
- package/Morph/morphTarget.js.map +1 -1
- package/Morph/morphTargetManager.d.ts +3 -1
- package/Morph/morphTargetManager.js +5 -2
- package/Morph/morphTargetManager.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/emitters.functions.js +3 -3
- package/Particles/Node/Blocks/Emitters/emitters.functions.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +1 -1
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +2 -2
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js +7 -7
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -1
- package/Particles/Node/Blocks/particleLocalVariableBlock.js +2 -2
- package/Particles/Node/Blocks/particleLocalVariableBlock.js.map +1 -1
- package/Particles/Node/nodeParticleBuildState.js +7 -7
- package/Particles/Node/nodeParticleBuildState.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +9 -4
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/particle.d.ts +73 -61
- package/Particles/particle.js +106 -91
- package/Particles/particle.js.map +1 -1
- package/Particles/particleSystem.js +5 -5
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.function.js +83 -83
- package/Particles/thinParticleSystem.function.js.map +1 -1
- package/Particles/thinParticleSystem.js +8 -8
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +14 -1
- package/Physics/v2/Plugins/havokPlugin.js +154 -10
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Probes/reflectionProbe.js +9 -6
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +3 -1
- package/Rendering/objectRenderer.js +28 -8
- package/Rendering/objectRenderer.js.map +1 -1
- package/Rendering/reflectiveShadowMap.js +1 -1
- package/Rendering/reflectiveShadowMap.js.map +1 -1
- package/Rendering/thinDepthPeelingRenderer.js +8 -0
- package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
- package/Shaders/gaussianSplatting.fragment.js +8 -2
- package/Shaders/gaussianSplatting.fragment.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +8 -2
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.fragment.js +7 -1
- package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +8 -2
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +22 -1
- package/scene.js +15 -15
- package/scene.js.map +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Nullable } from "../../types.js";
|
|
2
|
+
import type { Scene } from "../../scene.js";
|
|
3
|
+
import type { AbstractEngine } from "../../Engines/abstractEngine.js";
|
|
4
|
+
import type { SubMesh } from "../../Meshes/subMesh.js";
|
|
5
|
+
import type { UniformBuffer } from "../uniformBuffer.js";
|
|
6
|
+
import type { MaterialDefines } from "../materialDefines.js";
|
|
7
|
+
import { Color3 } from "../../Maths/math.color.js";
|
|
8
|
+
import { MaterialPluginBase } from "../materialPluginBase.js";
|
|
9
|
+
import { ShaderLanguage } from "../shaderLanguage.js";
|
|
10
|
+
import type { GaussianSplattingMaterial } from "./gaussianSplattingMaterial.js";
|
|
11
|
+
/**
|
|
12
|
+
* Plugin for GaussianSplattingMaterial that replaces per-splat colors with a
|
|
13
|
+
* solid color per compound-mesh part. Each part index maps to a single Color3
|
|
14
|
+
* value, which is looked up in a uniform array in the fragment shader.
|
|
15
|
+
*/
|
|
16
|
+
export declare class GaussianSplattingSolidColorMaterialPlugin extends MaterialPluginBase {
|
|
17
|
+
private _partColors;
|
|
18
|
+
private _maxPartCount;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new GaussianSplatSolidColorPlugin.
|
|
21
|
+
* @param material The GaussianSplattingMaterial to attach the plugin to.
|
|
22
|
+
* @param partColors A map from part index to the solid Color3 for that part.
|
|
23
|
+
* @param maxPartCount The maximum number of parts supported. This determines the size of the uniform array.
|
|
24
|
+
*/
|
|
25
|
+
constructor(material: GaussianSplattingMaterial, partColors: Color3[], maxPartCount?: number);
|
|
26
|
+
/**
|
|
27
|
+
* Updates the part colors dynamically.
|
|
28
|
+
* @param partColors A map from part index to the solid Color3 for that part.
|
|
29
|
+
*/
|
|
30
|
+
updatePartColors(partColors: Color3[]): void;
|
|
31
|
+
/**
|
|
32
|
+
* @returns the class name
|
|
33
|
+
*/
|
|
34
|
+
getClassName(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Indicates this plugin supports both GLSL and WGSL.
|
|
37
|
+
* @param shaderLanguage the shader language to check
|
|
38
|
+
* @returns true for GLSL and WGSL
|
|
39
|
+
*/
|
|
40
|
+
isCompatible(shaderLanguage: ShaderLanguage): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Always ready — no textures or async resources to wait on.
|
|
43
|
+
* @param _defines the defines
|
|
44
|
+
* @param _scene the scene
|
|
45
|
+
* @param _engine the engine
|
|
46
|
+
* @param _subMesh the submesh
|
|
47
|
+
* @returns true
|
|
48
|
+
*/
|
|
49
|
+
isReadyForSubMesh(_defines: MaterialDefines, _scene: Scene, _engine: AbstractEngine, _subMesh: SubMesh): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Returns custom shader code fragments to inject solid-color rendering.
|
|
52
|
+
*
|
|
53
|
+
* @param shaderType "vertex" or "fragment"
|
|
54
|
+
* @param shaderLanguage the shader language to use (default: GLSL)
|
|
55
|
+
* @returns null or a map of injection point names to code strings
|
|
56
|
+
*/
|
|
57
|
+
getCustomCode(shaderType: string, shaderLanguage?: ShaderLanguage): Nullable<{
|
|
58
|
+
[pointName: string]: string;
|
|
59
|
+
}>;
|
|
60
|
+
private _getCustomCodeGLSL;
|
|
61
|
+
private _getCustomCodeWGSL;
|
|
62
|
+
/**
|
|
63
|
+
* Registers the `partColors` uniform with the engine so that
|
|
64
|
+
* the Effect can resolve its location.
|
|
65
|
+
* @returns uniform descriptions
|
|
66
|
+
*/
|
|
67
|
+
getUniforms(): {
|
|
68
|
+
ubo?: Array<{
|
|
69
|
+
name: string;
|
|
70
|
+
size?: number;
|
|
71
|
+
type?: string;
|
|
72
|
+
arraySize?: number;
|
|
73
|
+
}>;
|
|
74
|
+
vertex?: string;
|
|
75
|
+
fragment?: string;
|
|
76
|
+
externalUniforms?: string[];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Binds the `partColors` uniform array each frame.
|
|
80
|
+
* @param _uniformBuffer the uniform buffer (unused — we bind directly on the effect)
|
|
81
|
+
* @param _scene the current scene
|
|
82
|
+
* @param _engine the current engine
|
|
83
|
+
* @param subMesh the submesh being rendered
|
|
84
|
+
*/
|
|
85
|
+
bindForSubMesh(_uniformBuffer: UniformBuffer, _scene: Scene, _engine: AbstractEngine, subMesh: SubMesh): void;
|
|
86
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { Color3 } from "../../Maths/math.color.js";
|
|
2
|
+
import { MaterialPluginBase } from "../materialPluginBase.js";
|
|
3
|
+
import { RegisterClass } from "../../Misc/typeStore.js";
|
|
4
|
+
import { GaussianSplattingMaxPartCount } from "./gaussianSplattingMaterial.js";
|
|
5
|
+
/**
|
|
6
|
+
* Plugin for GaussianSplattingMaterial that replaces per-splat colors with a
|
|
7
|
+
* solid color per compound-mesh part. Each part index maps to a single Color3
|
|
8
|
+
* value, which is looked up in a uniform array in the fragment shader.
|
|
9
|
+
*/
|
|
10
|
+
export class GaussianSplattingSolidColorMaterialPlugin extends MaterialPluginBase {
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new GaussianSplatSolidColorPlugin.
|
|
13
|
+
* @param material The GaussianSplattingMaterial to attach the plugin to.
|
|
14
|
+
* @param partColors A map from part index to the solid Color3 for that part.
|
|
15
|
+
* @param maxPartCount The maximum number of parts supported. This determines the size of the uniform array.
|
|
16
|
+
*/
|
|
17
|
+
constructor(material, partColors, maxPartCount = GaussianSplattingMaxPartCount) {
|
|
18
|
+
super(material, "GaussianSplatSolidColor", 200);
|
|
19
|
+
this._partColors = partColors;
|
|
20
|
+
this._maxPartCount = maxPartCount;
|
|
21
|
+
this._enable(true);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Updates the part colors dynamically.
|
|
25
|
+
* @param partColors A map from part index to the solid Color3 for that part.
|
|
26
|
+
*/
|
|
27
|
+
updatePartColors(partColors) {
|
|
28
|
+
this._partColors = partColors;
|
|
29
|
+
}
|
|
30
|
+
// --- Plugin overrides ---
|
|
31
|
+
/**
|
|
32
|
+
* @returns the class name
|
|
33
|
+
*/
|
|
34
|
+
getClassName() {
|
|
35
|
+
return "GaussianSplattingSolidColorMaterialPlugin";
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Indicates this plugin supports both GLSL and WGSL.
|
|
39
|
+
* @param shaderLanguage the shader language to check
|
|
40
|
+
* @returns true for GLSL and WGSL
|
|
41
|
+
*/
|
|
42
|
+
isCompatible(shaderLanguage) {
|
|
43
|
+
switch (shaderLanguage) {
|
|
44
|
+
case 0 /* ShaderLanguage.GLSL */:
|
|
45
|
+
case 1 /* ShaderLanguage.WGSL */:
|
|
46
|
+
return true;
|
|
47
|
+
default:
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Always ready — no textures or async resources to wait on.
|
|
53
|
+
* @param _defines the defines
|
|
54
|
+
* @param _scene the scene
|
|
55
|
+
* @param _engine the engine
|
|
56
|
+
* @param _subMesh the submesh
|
|
57
|
+
* @returns true
|
|
58
|
+
*/
|
|
59
|
+
isReadyForSubMesh(_defines, _scene, _engine, _subMesh) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Returns custom shader code fragments to inject solid-color rendering.
|
|
64
|
+
*
|
|
65
|
+
* @param shaderType "vertex" or "fragment"
|
|
66
|
+
* @param shaderLanguage the shader language to use (default: GLSL)
|
|
67
|
+
* @returns null or a map of injection point names to code strings
|
|
68
|
+
*/
|
|
69
|
+
getCustomCode(shaderType, shaderLanguage = 0 /* ShaderLanguage.GLSL */) {
|
|
70
|
+
const maxPartCount = this._maxPartCount ?? GaussianSplattingMaxPartCount;
|
|
71
|
+
if (shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
72
|
+
return this._getCustomCodeWGSL(shaderType, maxPartCount);
|
|
73
|
+
}
|
|
74
|
+
return this._getCustomCodeGLSL(shaderType, maxPartCount);
|
|
75
|
+
}
|
|
76
|
+
_getCustomCodeGLSL(shaderType, maxPartCount) {
|
|
77
|
+
if (shaderType === "vertex") {
|
|
78
|
+
return {
|
|
79
|
+
CUSTOM_VERTEX_DEFINITIONS: `varying float vPartIndex;`,
|
|
80
|
+
CUSTOM_VERTEX_UPDATE: `
|
|
81
|
+
#if IS_COMPOUND
|
|
82
|
+
vPartIndex = float(splat.partIndex);
|
|
83
|
+
#else
|
|
84
|
+
vPartIndex = 0.0;
|
|
85
|
+
#endif
|
|
86
|
+
`,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
else if (shaderType === "fragment") {
|
|
90
|
+
return {
|
|
91
|
+
CUSTOM_FRAGMENT_DEFINITIONS: `
|
|
92
|
+
varying float vPartIndex;
|
|
93
|
+
uniform vec3 partColors[${maxPartCount}];
|
|
94
|
+
`,
|
|
95
|
+
CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR: `
|
|
96
|
+
int partIdx = int(vPartIndex + 0.5);
|
|
97
|
+
finalColor = vec4(partColors[partIdx], finalColor.w);
|
|
98
|
+
`,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
_getCustomCodeWGSL(shaderType, maxPartCount) {
|
|
104
|
+
if (shaderType === "vertex") {
|
|
105
|
+
return {
|
|
106
|
+
CUSTOM_VERTEX_DEFINITIONS: `varying vPartIndex: f32;`,
|
|
107
|
+
CUSTOM_VERTEX_UPDATE: `
|
|
108
|
+
#if IS_COMPOUND
|
|
109
|
+
vertexOutputs.vPartIndex = f32(splat.partIndex);
|
|
110
|
+
#else
|
|
111
|
+
vertexOutputs.vPartIndex = 0.0;
|
|
112
|
+
#endif
|
|
113
|
+
`,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
else if (shaderType === "fragment") {
|
|
117
|
+
return {
|
|
118
|
+
CUSTOM_FRAGMENT_DEFINITIONS: `
|
|
119
|
+
varying vPartIndex: f32;
|
|
120
|
+
uniform partColors: array<vec3f, ${maxPartCount}>;
|
|
121
|
+
`,
|
|
122
|
+
CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR: `
|
|
123
|
+
var partIdx: i32 = i32(fragmentInputs.vPartIndex + 0.5);
|
|
124
|
+
finalColor = vec4f(uniforms.partColors[partIdx], finalColor.w);
|
|
125
|
+
`,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Registers the `partColors` uniform with the engine so that
|
|
132
|
+
* the Effect can resolve its location.
|
|
133
|
+
* @returns uniform descriptions
|
|
134
|
+
*/
|
|
135
|
+
getUniforms() {
|
|
136
|
+
return {
|
|
137
|
+
externalUniforms: ["partColors"],
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Binds the `partColors` uniform array each frame.
|
|
142
|
+
* @param _uniformBuffer the uniform buffer (unused — we bind directly on the effect)
|
|
143
|
+
* @param _scene the current scene
|
|
144
|
+
* @param _engine the current engine
|
|
145
|
+
* @param subMesh the submesh being rendered
|
|
146
|
+
*/
|
|
147
|
+
bindForSubMesh(_uniformBuffer, _scene, _engine, subMesh) {
|
|
148
|
+
const effect = subMesh.effect;
|
|
149
|
+
if (!effect) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const colorArray = [];
|
|
153
|
+
for (let i = 0; i < this._maxPartCount; i++) {
|
|
154
|
+
const color = this._partColors[i] ?? new Color3(0, 0, 0);
|
|
155
|
+
colorArray.push(color.r, color.g, color.b);
|
|
156
|
+
}
|
|
157
|
+
effect.setArray3("partColors", colorArray);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
RegisterClass("BABYLON.GaussianSplattingSolidColorMaterialPlugin", GaussianSplattingSolidColorMaterialPlugin);
|
|
161
|
+
//# sourceMappingURL=gaussianSplattingSolidColorMaterialPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gaussianSplattingSolidColorMaterialPlugin.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAG5E;;;;GAIG;AACH,MAAM,OAAO,yCAA0C,SAAQ,kBAAkB;IAI7E;;;;;OAKG;IACH,YAAY,QAAmC,EAAE,UAAoB,EAAE,YAAY,GAAG,6BAA6B;QAC/G,KAAK,CAAC,QAAQ,EAAE,yBAAyB,EAAE,GAAG,CA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E,yCAAyC,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport type { SubMesh } from \"../../Meshes/subMesh\";\r\nimport type { UniformBuffer } from \"../uniformBuffer\";\r\nimport type { MaterialDefines } from \"../materialDefines\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { MaterialPluginBase } from \"../materialPluginBase\";\r\nimport { ShaderLanguage } from \"../shaderLanguage\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport { GaussianSplattingMaxPartCount } from \"./gaussianSplattingMaterial\";\r\nimport type { GaussianSplattingMaterial } from \"./gaussianSplattingMaterial\";\r\n\r\n/**\r\n * Plugin for GaussianSplattingMaterial that replaces per-splat colors with a\r\n * solid color per compound-mesh part. Each part index maps to a single Color3\r\n * value, which is looked up in a uniform array in the fragment shader.\r\n */\r\nexport class GaussianSplattingSolidColorMaterialPlugin extends MaterialPluginBase {\r\n private _partColors: Color3[];\r\n private _maxPartCount: number;\r\n\r\n /**\r\n * Creates a new GaussianSplatSolidColorPlugin.\r\n * @param material The GaussianSplattingMaterial to attach the plugin to.\r\n * @param partColors A map from part index to the solid Color3 for that part.\r\n * @param maxPartCount The maximum number of parts supported. This determines the size of the uniform array.\r\n */\r\n constructor(material: GaussianSplattingMaterial, partColors: Color3[], maxPartCount = GaussianSplattingMaxPartCount) {\r\n super(material, \"GaussianSplatSolidColor\", 200);\r\n\r\n this._partColors = partColors;\r\n this._maxPartCount = maxPartCount;\r\n this._enable(true);\r\n }\r\n\r\n /**\r\n * Updates the part colors dynamically.\r\n * @param partColors A map from part index to the solid Color3 for that part.\r\n */\r\n public updatePartColors(partColors: Color3[]): void {\r\n this._partColors = partColors;\r\n }\r\n\r\n // --- Plugin overrides ---\r\n\r\n /**\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"GaussianSplattingSolidColorMaterialPlugin\";\r\n }\r\n\r\n /**\r\n * Indicates this plugin supports both GLSL and WGSL.\r\n * @param shaderLanguage the shader language to check\r\n * @returns true for GLSL and WGSL\r\n */\r\n public override isCompatible(shaderLanguage: ShaderLanguage): boolean {\r\n switch (shaderLanguage) {\r\n case ShaderLanguage.GLSL:\r\n case ShaderLanguage.WGSL:\r\n return true;\r\n default:\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Always ready — no textures or async resources to wait on.\r\n * @param _defines the defines\r\n * @param _scene the scene\r\n * @param _engine the engine\r\n * @param _subMesh the submesh\r\n * @returns true\r\n */\r\n public override isReadyForSubMesh(_defines: MaterialDefines, _scene: Scene, _engine: AbstractEngine, _subMesh: SubMesh): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Returns custom shader code fragments to inject solid-color rendering.\r\n *\r\n * @param shaderType \"vertex\" or \"fragment\"\r\n * @param shaderLanguage the shader language to use (default: GLSL)\r\n * @returns null or a map of injection point names to code strings\r\n */\r\n public override getCustomCode(shaderType: string, shaderLanguage = ShaderLanguage.GLSL): Nullable<{ [pointName: string]: string }> {\r\n const maxPartCount = this._maxPartCount ?? GaussianSplattingMaxPartCount;\r\n\r\n if (shaderLanguage === ShaderLanguage.WGSL) {\r\n return this._getCustomCodeWGSL(shaderType, maxPartCount);\r\n }\r\n return this._getCustomCodeGLSL(shaderType, maxPartCount);\r\n }\r\n\r\n private _getCustomCodeGLSL(shaderType: string, maxPartCount: number): Nullable<{ [pointName: string]: string }> {\r\n if (shaderType === \"vertex\") {\r\n return {\r\n CUSTOM_VERTEX_DEFINITIONS: `varying float vPartIndex;`,\r\n CUSTOM_VERTEX_UPDATE: `\r\n#if IS_COMPOUND\r\n vPartIndex = float(splat.partIndex);\r\n#else\r\n vPartIndex = 0.0;\r\n#endif\r\n `,\r\n };\r\n } else if (shaderType === \"fragment\") {\r\n return {\r\n CUSTOM_FRAGMENT_DEFINITIONS: `\r\nvarying float vPartIndex;\r\nuniform vec3 partColors[${maxPartCount}];\r\n `,\r\n CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR: `\r\nint partIdx = int(vPartIndex + 0.5);\r\nfinalColor = vec4(partColors[partIdx], finalColor.w);\r\n `,\r\n };\r\n }\r\n return null;\r\n }\r\n\r\n private _getCustomCodeWGSL(shaderType: string, maxPartCount: number): Nullable<{ [pointName: string]: string }> {\r\n if (shaderType === \"vertex\") {\r\n return {\r\n CUSTOM_VERTEX_DEFINITIONS: `varying vPartIndex: f32;`,\r\n CUSTOM_VERTEX_UPDATE: `\r\n#if IS_COMPOUND\r\n vertexOutputs.vPartIndex = f32(splat.partIndex);\r\n#else\r\n vertexOutputs.vPartIndex = 0.0;\r\n#endif\r\n `,\r\n };\r\n } else if (shaderType === \"fragment\") {\r\n return {\r\n CUSTOM_FRAGMENT_DEFINITIONS: `\r\nvarying vPartIndex: f32;\r\nuniform partColors: array<vec3f, ${maxPartCount}>;\r\n `,\r\n CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR: `\r\nvar partIdx: i32 = i32(fragmentInputs.vPartIndex + 0.5);\r\nfinalColor = vec4f(uniforms.partColors[partIdx], finalColor.w);\r\n `,\r\n };\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Registers the `partColors` uniform with the engine so that\r\n * the Effect can resolve its location.\r\n * @returns uniform descriptions\r\n */\r\n public override getUniforms(): {\r\n ubo?: Array<{ name: string; size?: number; type?: string; arraySize?: number }>;\r\n vertex?: string;\r\n fragment?: string;\r\n externalUniforms?: string[];\r\n } {\r\n return {\r\n externalUniforms: [\"partColors\"],\r\n };\r\n }\r\n\r\n /**\r\n * Binds the `partColors` uniform array each frame.\r\n * @param _uniformBuffer the uniform buffer (unused — we bind directly on the effect)\r\n * @param _scene the current scene\r\n * @param _engine the current engine\r\n * @param subMesh the submesh being rendered\r\n */\r\n public override bindForSubMesh(_uniformBuffer: UniformBuffer, _scene: Scene, _engine: AbstractEngine, subMesh: SubMesh): void {\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n\r\n const colorArray: number[] = [];\r\n for (let i = 0; i < this._maxPartCount; i++) {\r\n const color = this._partColors[i] ?? new Color3(0, 0, 0);\r\n colorArray.push(color.r, color.g, color.b);\r\n }\r\n\r\n effect.setArray3(\"partColors\", colorArray);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GaussianSplattingSolidColorMaterialPlugin\", GaussianSplattingSolidColorMaterialPlugin);\r\n"]}
|
|
@@ -16,32 +16,26 @@ export class MaterialGreasedLineDefines extends MaterialDefines {
|
|
|
16
16
|
/**
|
|
17
17
|
* The material has a color option specified
|
|
18
18
|
*/
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
20
19
|
this.GREASED_LINE_HAS_COLOR = false;
|
|
21
20
|
/**
|
|
22
21
|
* The material's size attenuation optiom
|
|
23
22
|
*/
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
25
23
|
this.GREASED_LINE_SIZE_ATTENUATION = false;
|
|
26
24
|
/**
|
|
27
25
|
* The type of color distribution is set to line this value equals to true.
|
|
28
26
|
*/
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
30
27
|
this.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = false;
|
|
31
28
|
/**
|
|
32
29
|
* True if scene is in right handed coordinate system.
|
|
33
30
|
*/
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
35
31
|
this.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = false;
|
|
36
32
|
/**
|
|
37
33
|
* True if the line is in camera facing mode
|
|
38
34
|
*/
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
40
35
|
this.GREASED_LINE_CAMERA_FACING = true;
|
|
41
36
|
/**
|
|
42
37
|
* True if the line uses offsets
|
|
43
38
|
*/
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
45
39
|
this.GREASED_LINE_USE_OFFSETS = false;
|
|
46
40
|
}
|
|
47
41
|
}
|
|
@@ -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;AAKrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC5F,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAG5F;;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;QAElC;;WAEG;QACH,gEAAgE;QAChE,6BAAwB,GAAG,KAAK,CAAC;IACrC,CAAC;CAAA;AAED;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,kBAAkB;IA4E7D;;;;OAIG;IACa,YAAY,CAAC,eAA+B;QACxD,OAAO,IAAI,CAAC;IACh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S,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;IAEO,OAAO,CAAC,cAA8B;QAC1C,OAAO,cAAc,gCAAwB,IAAI,IAAI,CAAC,UAAU,CAAC;IACrE,CAAC;;AA9kBD;;GAEG;AACoB,oDAA0B,GAAG,2BAA2B,AAA9B,CAA+B;AAEhF;;;GAGG;AACW,mCAAS,GAAG,KAAK,AAAR,CAAS;AAwkBpC,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 { ShaderLanguage } from \"../shaderLanguage\";\r\n\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\nimport { GetCustomCode as getCustomCodeGLSL } from \"./greasedLinePluginMaterialShadersGLSL\";\r\nimport { GetCustomCode as getCustomCodeWGSL } from \"./greasedLinePluginMaterialShadersWGSL\";\r\nimport type { GreasedLineBaseMesh } from \"../../Meshes\";\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 * True if the line uses offsets\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_USE_OFFSETS = false;\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 * Force all the greased lines to compile to glsl even on WebGPU engines.\r\n * False by default. This is mostly meant for backward compatibility.\r\n */\r\n public static ForceGLSL = false;\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 private _forceGLSL = false;\r\n\r\n /**\r\n * Gets a boolean indicating that the plugin is compatible with a given shader language\r\n * @param _shaderLanguage The shader language to use\r\n * @returns true if the plugin is compatible with the shader language. Return always true since both GLSL and WGSL are supported\r\n */\r\n public override isCompatible(_shaderLanguage: ShaderLanguage): boolean {\r\n return true;\r\n }\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, true, true);\r\n\r\n this._forceGLSL = options?.forceGLSL || GreasedLinePluginMaterial.ForceGLSL;\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\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 * @param shaderLanguage The shader language to use\r\n * @returns uniforms\r\n */\r\n override getUniforms(shaderLanguage = ShaderLanguage.GLSL) {\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 if (shaderLanguage === ShaderLanguage.WGSL) {\r\n ubo.push({\r\n name: \"viewProjection\",\r\n size: 16,\r\n type: \"mat4\",\r\n });\r\n }\r\n\r\n return {\r\n ubo,\r\n vertex:\r\n this._cameraFacing && this._isGLSL(shaderLanguage)\r\n ? `\r\n uniform vec4 grl_aspect_resolution_lineWidth;\r\n uniform mat4 grl_projection;\r\n `\r\n : \"\",\r\n fragment: this._isGLSL(shaderLanguage)\r\n ? `\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\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 uniformBuffer.updateMatrix(\"grl_projection\", this._scene.getProjectionMatrix());\r\n if (!this._isGLSL(this._material.shaderLanguage)) {\r\n uniformBuffer.updateMatrix(\"viewProjection\", this._scene.getTransformMatrix());\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 defines.GREASED_LINE_USE_OFFSETS = !!(mesh as GreasedLineBaseMesh).offsets;\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 * @param shaderLanguage GLSL or WGSL\r\n * @returns shader code\r\n */\r\n override getCustomCode(shaderType: string, shaderLanguage = ShaderLanguage.GLSL): Nullable<{ [pointName: string]: string }> {\r\n if (this._isGLSL(shaderLanguage)) {\r\n return getCustomCodeGLSL(shaderType, this._cameraFacing);\r\n }\r\n return getCustomCodeWGSL(shaderType, this._cameraFacing);\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 if (!doNotMarkDirty) {\r\n this.markAllDefinesAsDirty();\r\n }\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 if (this._colors) {\r\n greasedLineMaterialOptions.colors = this._colors;\r\n }\r\n if (this._color) {\r\n greasedLineMaterialOptions.color = this._color;\r\n }\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 if (greasedLineMaterialOptions.color) {\r\n this.setColor(greasedLineMaterialOptions.color, true);\r\n }\r\n if (greasedLineMaterialOptions.colorDistributionType) {\r\n this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType;\r\n }\r\n if (greasedLineMaterialOptions.colors) {\r\n this.colors = greasedLineMaterialOptions.colors;\r\n }\r\n if (greasedLineMaterialOptions.colorsSampling) {\r\n this.colorsSampling = greasedLineMaterialOptions.colorsSampling;\r\n }\r\n if (greasedLineMaterialOptions.colorMode) {\r\n this.colorMode = greasedLineMaterialOptions.colorMode;\r\n }\r\n if (greasedLineMaterialOptions.useColors) {\r\n this.useColors = greasedLineMaterialOptions.useColors;\r\n }\r\n if (greasedLineMaterialOptions.visibility) {\r\n this.visibility = greasedLineMaterialOptions.visibility;\r\n }\r\n if (greasedLineMaterialOptions.useDash) {\r\n this.useDash = greasedLineMaterialOptions.useDash;\r\n }\r\n if (greasedLineMaterialOptions.dashCount) {\r\n this.dashCount = greasedLineMaterialOptions.dashCount;\r\n }\r\n if (greasedLineMaterialOptions.dashRatio) {\r\n this.dashRatio = greasedLineMaterialOptions.dashRatio;\r\n }\r\n if (greasedLineMaterialOptions.dashOffset) {\r\n this.dashOffset = greasedLineMaterialOptions.dashOffset;\r\n }\r\n if (greasedLineMaterialOptions.width) {\r\n this.width = greasedLineMaterialOptions.width;\r\n }\r\n if (greasedLineMaterialOptions.sizeAttenuation) {\r\n this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation;\r\n }\r\n if (greasedLineMaterialOptions.resolution) {\r\n 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 private _isGLSL(shaderLanguage: ShaderLanguage) {\r\n return shaderLanguage === ShaderLanguage.GLSL || this._forceGLSL;\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;AAKrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC5F,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAG5F;;GAEG;AACH,MA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AAI,CAAC,KAAK,EAAE,IAAI,CAAC,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;IAEO,OAAO,CAAC,cAA8B;QAC1C,OAAO,cAAc,gCAAwB,IAAI,IAAI,CAAC,UAAU,CAAC;IACrE,CAAC;;AA9kBD;;GAEG;AACoB,oDAA0B,GAAG,2BAA2B,AAA9B,CAA+B;AAEhF;;;GAGG;AACW,mCAAS,GAAG,KAAK,AAAR,CAAS;AAwkBpC,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 { ShaderLanguage } from \"../shaderLanguage\";\r\n\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\nimport { GetCustomCode as getCustomCodeGLSL } from \"./greasedLinePluginMaterialShadersGLSL\";\r\nimport { GetCustomCode as getCustomCodeWGSL } from \"./greasedLinePluginMaterialShadersWGSL\";\r\nimport type { GreasedLineBaseMesh } from \"../../Meshes\";\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 GREASED_LINE_HAS_COLOR = false;\r\n /**\r\n * The material's size attenuation optiom\r\n */\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 GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = false;\r\n /**\r\n * True if scene is in right handed coordinate system.\r\n */\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 GREASED_LINE_CAMERA_FACING = true;\r\n\r\n /**\r\n * True if the line uses offsets\r\n */\r\n GREASED_LINE_USE_OFFSETS = false;\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 * Force all the greased lines to compile to glsl even on WebGPU engines.\r\n * False by default. This is mostly meant for backward compatibility.\r\n */\r\n public static ForceGLSL = false;\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 private _forceGLSL = false;\r\n\r\n /**\r\n * Gets a boolean indicating that the plugin is compatible with a given shader language\r\n * @param _shaderLanguage The shader language to use\r\n * @returns true if the plugin is compatible with the shader language. Return always true since both GLSL and WGSL are supported\r\n */\r\n public override isCompatible(_shaderLanguage: ShaderLanguage): boolean {\r\n return true;\r\n }\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, true, true);\r\n\r\n this._forceGLSL = options?.forceGLSL || GreasedLinePluginMaterial.ForceGLSL;\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\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 * @param shaderLanguage The shader language to use\r\n * @returns uniforms\r\n */\r\n override getUniforms(shaderLanguage = ShaderLanguage.GLSL) {\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 if (shaderLanguage === ShaderLanguage.WGSL) {\r\n ubo.push({\r\n name: \"viewProjection\",\r\n size: 16,\r\n type: \"mat4\",\r\n });\r\n }\r\n\r\n return {\r\n ubo,\r\n vertex:\r\n this._cameraFacing && this._isGLSL(shaderLanguage)\r\n ? `\r\n uniform vec4 grl_aspect_resolution_lineWidth;\r\n uniform mat4 grl_projection;\r\n `\r\n : \"\",\r\n fragment: this._isGLSL(shaderLanguage)\r\n ? `\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\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 uniformBuffer.updateMatrix(\"grl_projection\", this._scene.getProjectionMatrix());\r\n if (!this._isGLSL(this._material.shaderLanguage)) {\r\n uniformBuffer.updateMatrix(\"viewProjection\", this._scene.getTransformMatrix());\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 defines.GREASED_LINE_USE_OFFSETS = !!(mesh as GreasedLineBaseMesh).offsets;\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 * @param shaderLanguage GLSL or WGSL\r\n * @returns shader code\r\n */\r\n override getCustomCode(shaderType: string, shaderLanguage = ShaderLanguage.GLSL): Nullable<{ [pointName: string]: string }> {\r\n if (this._isGLSL(shaderLanguage)) {\r\n return getCustomCodeGLSL(shaderType, this._cameraFacing);\r\n }\r\n return getCustomCodeWGSL(shaderType, this._cameraFacing);\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 if (!doNotMarkDirty) {\r\n this.markAllDefinesAsDirty();\r\n }\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 if (this._colors) {\r\n greasedLineMaterialOptions.colors = this._colors;\r\n }\r\n if (this._color) {\r\n greasedLineMaterialOptions.color = this._color;\r\n }\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 if (greasedLineMaterialOptions.color) {\r\n this.setColor(greasedLineMaterialOptions.color, true);\r\n }\r\n if (greasedLineMaterialOptions.colorDistributionType) {\r\n this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType;\r\n }\r\n if (greasedLineMaterialOptions.colors) {\r\n this.colors = greasedLineMaterialOptions.colors;\r\n }\r\n if (greasedLineMaterialOptions.colorsSampling) {\r\n this.colorsSampling = greasedLineMaterialOptions.colorsSampling;\r\n }\r\n if (greasedLineMaterialOptions.colorMode) {\r\n this.colorMode = greasedLineMaterialOptions.colorMode;\r\n }\r\n if (greasedLineMaterialOptions.useColors) {\r\n this.useColors = greasedLineMaterialOptions.useColors;\r\n }\r\n if (greasedLineMaterialOptions.visibility) {\r\n this.visibility = greasedLineMaterialOptions.visibility;\r\n }\r\n if (greasedLineMaterialOptions.useDash) {\r\n this.useDash = greasedLineMaterialOptions.useDash;\r\n }\r\n if (greasedLineMaterialOptions.dashCount) {\r\n this.dashCount = greasedLineMaterialOptions.dashCount;\r\n }\r\n if (greasedLineMaterialOptions.dashRatio) {\r\n this.dashRatio = greasedLineMaterialOptions.dashRatio;\r\n }\r\n if (greasedLineMaterialOptions.dashOffset) {\r\n this.dashOffset = greasedLineMaterialOptions.dashOffset;\r\n }\r\n if (greasedLineMaterialOptions.width) {\r\n this.width = greasedLineMaterialOptions.width;\r\n }\r\n if (greasedLineMaterialOptions.sizeAttenuation) {\r\n this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation;\r\n }\r\n if (greasedLineMaterialOptions.resolution) {\r\n 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 private _isGLSL(shaderLanguage: ShaderLanguage) {\r\n return shaderLanguage === ShaderLanguage.GLSL || this._forceGLSL;\r\n }\r\n}\r\n\r\nRegisterClass(`BABYLON.${GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME}`, GreasedLinePluginMaterial);\r\n"]}
|
|
@@ -88,7 +88,6 @@ export function GetCustomCode(shaderType, cameraFacing) {
|
|
|
88
88
|
if (cameraFacing) {
|
|
89
89
|
obj["!gl_Position\\=viewProjection\\*worldPos;"] = "//"; // not needed for camera facing GRL
|
|
90
90
|
}
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
92
91
|
return obj;
|
|
93
92
|
}
|
|
94
93
|
if (shaderType === "fragment") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLinePluginMaterialShadersGLSL.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,UAAkB,EAAE,YAAqB;IACnE,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAQ;YACb,yBAAyB,EAAE;;;;;;;;;;;;;;;;;;;;iBAoBtB;YACL,6BAA6B,EAAE;;;;;;;iBAO1B;YACL,sBAAsB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CnB;SACR,CAAC;QACF,IAAI,YAAY,EAAE,CAAC;YACf,GAAG,CAAC,2CAA2C,CAAC,GAAG,IAAI,CAAC,CAAC,mCAAmC;QAChG,CAAC;QACD
|
|
1
|
+
{"version":3,"file":"greasedLinePluginMaterialShadersGLSL.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,UAAkB,EAAE,YAAqB;IACnE,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAQ;YACb,yBAAyB,EAAE;;;;;;;;;;;;;;;;;;;;iBAoBtB;YACL,6BAA6B,EAAE;;;;;;;iBAO1B;YACL,sBAAsB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CnB;SACR,CAAC;QACF,IAAI,YAAY,EAAE,CAAC;YACf,GAAG,CAAC,2CAA2C,CAAC,GAAG,IAAI,CAAC,CAAC,mCAAmC;QAChG,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAED,IAAI,UAAU,KAAK,UAAU,EAAE,CAAC;QAC5B,OAAO;YACH,2BAA2B,EAAE;;;;;;;;;;iBAUxB;YACL,gCAAgC,EAAE;;;;;;;;;;;;;;;;;;;;8CAoBA,+CAAuC;;qDAEhC,+CAAuC;;qDAEvC,oDAA4C;;;;;;;;;;;kDAW/C,+CAAuC;;yDAEhC,+CAAuC;;yDAEvC,oDAA4C;;;;;iBAKpF;SACR,CAAC;IACN,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\nimport { GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\n\n/**\n * Returns GLSL custom shader code\n * @param shaderType vertex or fragment\n * @param cameraFacing is in camera facing mode?\n * @returns GLSL custom shader code\n */\n/** @internal */\nexport function GetCustomCode(shaderType: string, cameraFacing: boolean): Nullable<{ [pointName: string]: string }> {\n if (shaderType === \"vertex\") {\n const obj: any = {\n CUSTOM_VERTEX_DEFINITIONS: `\n attribute float grl_widths;\n attribute vec3 grl_offsets;\n attribute float grl_colorPointers;\n varying float grlCounters;\n varying float grlColorPointer;\n\n #ifdef GREASED_LINE_CAMERA_FACING\n attribute vec4 grl_previousAndSide;\n attribute vec4 grl_nextAndCounters;\n\n vec2 grlFix( vec4 i, float aspect ) {\n vec2 res = i.xy / i.w;\n res.x *= aspect;\n return res;\n }\n #else\n attribute vec3 grl_slopes;\n attribute float grl_counters;\n #endif\n `,\n CUSTOM_VERTEX_UPDATE_POSITION: `\n #ifdef GREASED_LINE_CAMERA_FACING\n vec3 grlPositionOffset = grl_offsets;\n positionUpdated += grlPositionOffset;\n #else\n positionUpdated = (positionUpdated + grl_offsets) + (grl_slopes * grl_widths);\n #endif\n `,\n CUSTOM_VERTEX_MAIN_END: `\n grlColorPointer = grl_colorPointers;\n\n #ifdef GREASED_LINE_CAMERA_FACING\n\n float grlAspect = grl_aspect_resolution_lineWidth.x;\n float grlBaseWidth = grl_aspect_resolution_lineWidth.w;\n\n vec3 grlPrevious = grl_previousAndSide.xyz;\n float grlSide = grl_previousAndSide.w;\n\n vec3 grlNext = grl_nextAndCounters.xyz;\n grlCounters = grl_nextAndCounters.w;\n float grlWidth = grlBaseWidth * grl_widths;\n \n vec3 worldDir = normalize(grlNext - grlPrevious);\n vec3 nearPosition = positionUpdated + (worldDir * 0.01);\n mat4 grlMatrix = viewProjection * finalWorld;\n vec4 grlFinalPosition = grlMatrix * vec4(positionUpdated , 1.0);\n vec4 screenNearPos = grlMatrix * vec4(nearPosition, 1.0);\n vec2 grlLinePosition = grlFix(grlFinalPosition, grlAspect);\n vec2 grlLineNearPosition = grlFix(screenNearPos, grlAspect);\n vec2 grlDir = normalize(grlLineNearPosition - grlLinePosition);\n\n vec4 grlNormal = vec4(-grlDir.y, grlDir.x, 0., 1.);\n\n #ifdef GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\n grlNormal.xy *= -.5 * grlWidth;\n #else\n grlNormal.xy *= .5 * grlWidth;\n #endif\n\n grlNormal *= grl_projection;\n\n #ifdef GREASED_LINE_SIZE_ATTENUATION\n grlNormal.xy *= grlFinalPosition.w;\n grlNormal.xy /= (vec4(grl_aspect_resolution_lineWidth.yz, 0., 1.) * grl_projection).xy;\n #endif\n\n grlFinalPosition.xy += grlNormal.xy * grlSide;\n gl_Position = grlFinalPosition;\n\n vPositionW = vec3(grlFinalPosition);\n #else\n grlCounters = grl_counters;\n #endif\n `,\n };\n if (cameraFacing) {\n obj[\"!gl_Position\\\\=viewProjection\\\\*worldPos;\"] = \"//\"; // not needed for camera facing GRL\n }\n return obj;\n }\n\n if (shaderType === \"fragment\") {\n return {\n CUSTOM_FRAGMENT_DEFINITIONS: `\n #ifdef PBR\n #define grlFinalColor finalColor\n #else\n #define grlFinalColor color\n #endif\n\n varying float grlCounters;\n varying float grlColorPointer;\n uniform sampler2D grl_colors;\n `,\n CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR: `\n float grlColorMode = grl_colorMode_visibility_colorsWidth_useColors.x;\n float grlVisibility = grl_colorMode_visibility_colorsWidth_useColors.y;\n float grlColorsWidth = grl_colorMode_visibility_colorsWidth_useColors.z;\n float grlUseColors = grl_colorMode_visibility_colorsWidth_useColors.w;\n\n float grlUseDash = grl_dashOptions.x;\n float grlDashArray = grl_dashOptions.y;\n float grlDashOffset = grl_dashOptions.z;\n float grlDashRatio = grl_dashOptions.w;\n\n grlFinalColor.a *= step(grlCounters, grlVisibility);\n if(grlFinalColor.a == 0.) discard;\n\n if(grlUseDash == 1.){\n grlFinalColor.a *= ceil(mod(grlCounters + grlDashOffset, grlDashArray) - (grlDashArray * grlDashRatio));\n if (grlFinalColor.a == 0.) discard;\n }\n\n #ifdef GREASED_LINE_HAS_COLOR\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\n grlFinalColor.rgb = grl_singleColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\n grlFinalColor.rgb += grl_singleColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\n grlFinalColor.rgb *= grl_singleColor;\n }\n #else\n if (grlUseColors == 1.) {\n #ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\n vec4 grlColor = texture2D(grl_colors, vec2(grlCounters, 0.), 0.);\n #else\n vec2 lookup = vec2(fract(grlColorPointer / grl_textureSize.x), 1.0 - floor(grlColorPointer / grl_textureSize.x) / max(grl_textureSize.y - 1.0, 1.0));\n vec4 grlColor = texture2D(grl_colors, lookup, 0.0);\n #endif\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\n grlFinalColor = grlColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\n grlFinalColor += grlColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\n grlFinalColor *= grlColor;\n }\n }\n #endif\n `,\n };\n }\n\n return null;\n}\n"]}
|
|
@@ -105,7 +105,6 @@ export function GetCustomCode(shaderType, cameraFacing) {
|
|
|
105
105
|
if (cameraFacing) {
|
|
106
106
|
obj["!vertexOutputs\\.position\\s=\\sscene\\.viewProjection\\s\\*\\sworldPos;"] = "//"; // not needed for camera facing GRL
|
|
107
107
|
}
|
|
108
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
109
108
|
return obj;
|
|
110
109
|
}
|
|
111
110
|
if (shaderType === "fragment") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLinePluginMaterialShadersWGSL.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,UAAkB,EAAE,YAAqB;IACnE,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAQ;YACb,yBAAyB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;iBAyBtB;YACL,6BAA6B,EAAE;;;;;;;;;;;;iBAY1B;YACL,sBAAsB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqDnB;SACR,CAAC;QAEF,IAAI,YAAY,EAAE,CAAC;YACf,GAAG,CAAC,0EAA0E,CAAC,GAAG,IAAI,CAAC,CAAC,mCAAmC;QAC/H,CAAC;QACD
|
|
1
|
+
{"version":3,"file":"greasedLinePluginMaterialShadersWGSL.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,UAAkB,EAAE,YAAqB;IACnE,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAQ;YACb,yBAAyB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;iBAyBtB;YACL,6BAA6B,EAAE;;;;;;;;;;;;iBAY1B;YACL,sBAAsB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqDnB;SACR,CAAC;QAEF,IAAI,YAAY,EAAE,CAAC;YACf,GAAG,CAAC,0EAA0E,CAAC,GAAG,IAAI,CAAC,CAAC,mCAAmC;QAC/H,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAED,IAAI,UAAU,KAAK,UAAU,EAAE,CAAC;QAC5B,OAAO;YACH,2BAA2B,EAAE;;;;;;;;;;;;iBAYxB;YACL,gCAAgC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;8CA0BA,+CAAuC;;qDAEhC,+CAAuC;;qDAEvC,oDAA4C;;;;;;;;;;;kDAW/C,+CAAuC;;yDAEhC,+CAAuC;;yDAEvC,oDAA4C;;;;;;;iBAOpF;SACR,CAAC;IACN,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\nimport { GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\n\n/**\n * Returns WGSL custom shader code\n * @param shaderType vertex or fragment\n * @param cameraFacing is in camera facing mode?\n * @returns WGSL custom shader code\n */\n/** @internal */\nexport function GetCustomCode(shaderType: string, cameraFacing: boolean): Nullable<{ [pointName: string]: string }> {\n if (shaderType === \"vertex\") {\n const obj: any = {\n CUSTOM_VERTEX_DEFINITIONS: `\n attribute grl_widths: f32;\n attribute grl_colorPointers: f32;\n varying grlCounters: f32;\n varying grlColorPointer: f32;\n\n #ifdef GREASED_LINE_USE_OFFSETS\n attribute grl_offsets: vec3f; \n #endif\n\n #ifdef GREASED_LINE_CAMERA_FACING\n attribute grl_previousAndSide : vec4f;\n attribute grl_nextAndCounters : vec4f;\n\n fn grlFix(i: vec4f, aspect: f32) -> vec2f {\n var res = i.xy / i.w;\n res.x *= aspect;\n return res;\n }\n #else\n attribute grl_slopes: f32;\n attribute grl_counters: f32;\n #endif\n\n\n `,\n CUSTOM_VERTEX_UPDATE_POSITION: `\n #ifdef GREASED_LINE_USE_OFFSETS\n var grlPositionOffset: vec3f = input.grl_offsets;\n #else\n var grlPositionOffset = vec3f(0.);\n #endif\n\n #ifdef GREASED_LINE_CAMERA_FACING\n positionUpdated += grlPositionOffset;\n #else\n positionUpdated = (positionUpdated + grlPositionOffset) + (input.grl_slopes * input.grl_widths);\n #endif\n `,\n CUSTOM_VERTEX_MAIN_END: `\n vertexOutputs.grlColorPointer = input.grl_colorPointers;\n\n #ifdef GREASED_LINE_CAMERA_FACING\n\n let grlAspect: f32 = uniforms.grl_aspect_resolution_lineWidth.x;\n let grlBaseWidth: f32 = uniforms.grl_aspect_resolution_lineWidth.w;\n\n let grlPrevious: vec3f = input.grl_previousAndSide.xyz;\n let grlSide: f32 = input.grl_previousAndSide.w;\n\n let grlNext: vec3f = input.grl_nextAndCounters.xyz;\n vertexOutputs.grlCounters = input.grl_nextAndCounters.w;\n\n let grlWidth: f32 = grlBaseWidth * input.grl_widths;\n\n let worldDir: vec3f = normalize(grlNext - grlPrevious);\n let nearPosition: vec3f = positionUpdated + (worldDir * 0.01);\n let grlMatrix: mat4x4f = uniforms.viewProjection * finalWorld;\n let grlFinalPosition: vec4f = grlMatrix * vec4f(positionUpdated, 1.0); \n let screenNearPos: vec4f = grlMatrix * vec4(nearPosition, 1.0);\n let grlLinePosition: vec2f = grlFix(grlFinalPosition, grlAspect);\n let grlLineNearPosition: vec2f = grlFix(screenNearPos, grlAspect);\n let grlDir: vec2f = normalize(grlLineNearPosition - grlLinePosition);\n\n var grlNormal: vec4f = vec4f(-grlDir.y, grlDir.x, 0.0, 1.0);\n\n let grlHalfWidth: f32 = 0.5 * grlWidth;\n #if defined(GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM)\n grlNormal.x *= -grlHalfWidth;\n grlNormal.y *= -grlHalfWidth;\n #else\n grlNormal.x *= grlHalfWidth;\n grlNormal.y *= grlHalfWidth;\n #endif\n\n grlNormal *= uniforms.grl_projection;\n\n #if defined(GREASED_LINE_SIZE_ATTENUATION)\n grlNormal.x *= grlFinalPosition.w;\n grlNormal.y *= grlFinalPosition.w;\n\n let pr = vec4f(uniforms.grl_aspect_resolution_lineWidth.yz, 0.0, 1.0) * uniforms.grl_projection;\n grlNormal.x /= pr.x;\n grlNormal.y /= pr.y;\n #endif\n\n vertexOutputs.position = vec4f(grlFinalPosition.xy + grlNormal.xy * grlSide, grlFinalPosition.z, grlFinalPosition.w);\n vertexOutputs.vPositionW = vertexOutputs.position.xyz;\n \n #else\n vertexOutputs.grlCounters = input.grl_counters;\n #endif\n `,\n };\n\n if (cameraFacing) {\n obj[\"!vertexOutputs\\\\.position\\\\s=\\\\sscene\\\\.viewProjection\\\\s\\\\*\\\\sworldPos;\"] = \"//\"; // not needed for camera facing GRL\n }\n return obj;\n }\n\n if (shaderType === \"fragment\") {\n return {\n CUSTOM_FRAGMENT_DEFINITIONS: `\n #ifdef PBR\n #define grlFinalColor finalColor\n #else\n #define grlFinalColor color\n #endif\n\n varying grlCounters: f32;\n varying grlColorPointer: 32;\n\n var grl_colors: texture_2d<f32>;\n var grl_colorsSampler: sampler;\n `,\n CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR: `\n let grlColorMode: f32 = uniforms.grl_colorMode_visibility_colorsWidth_useColors.x;\n let grlVisibility: f32 = uniforms.grl_colorMode_visibility_colorsWidth_useColors.y;\n let grlColorsWidth: f32 = uniforms.grl_colorMode_visibility_colorsWidth_useColors.z;\n let grlUseColors: f32 = uniforms.grl_colorMode_visibility_colorsWidth_useColors.w;\n\n let grlUseDash: f32 = uniforms.grl_dashOptions.x;\n let grlDashArray: f32 = uniforms.grl_dashOptions.y;\n let grlDashOffset: f32 = uniforms.grl_dashOptions.z;\n let grlDashRatio: f32 = uniforms.grl_dashOptions.w;\n\n grlFinalColor.a *= step(fragmentInputs.grlCounters, grlVisibility);\n if (grlFinalColor.a == 0.0) {\n discard;\n }\n\n if (grlUseDash == 1.0) {\n let dashPosition = (fragmentInputs.grlCounters + grlDashOffset) % grlDashArray;\n grlFinalColor.a *= ceil(dashPosition - (grlDashArray * grlDashRatio));\n\n if (grlFinalColor.a == 0.0) {\n discard;\n }\n }\n\n #ifdef GREASED_LINE_HAS_COLOR\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\n grlFinalColor = vec4f(uniforms.grl_singleColor, grlFinalColor.a);\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\n grlFinalColor += vec4f(uniforms.grl_singleColor, grlFinalColor.a);\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\n grlFinalColor *= vec4f(uniforms.grl_singleColor, grlFinalColor.a);\n }\n #else\n if (grlUseColors == 1.) {\n #ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\n let grlColor: vec4f = textureSample(grl_colors, grl_colorsSampler, vec2f(fragmentInputs.grlCounters, 0.));\n #else\n let lookup: vec2f = vec2(fract(fragmentInputs.grlColorPointer / uniforms.grl_textureSize.x), 1.0 - floor(fragmentInputs.grlColorPointer / uniforms.grl_textureSize.x) / max(uniforms.grl_textureSize.y - 1.0, 1.0));\n let grlColor: vec4f = textureSample(grl_colors, grl_colorsSampler, lookup);\n #endif\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\n grlFinalColor = grlColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\n grlFinalColor += grlColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\n grlFinalColor *= grlColor;\n }\n }\n #endif\n\n\n `,\n };\n }\n\n return null;\n}\n"]}
|