@babylonjs/core 7.37.0 → 7.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cameras/arcRotateCamera.d.ts +3 -1
- package/Cameras/arcRotateCamera.js +14 -3
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +12 -2
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +5 -0
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +21 -5
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +52 -176
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.d.ts +11 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js +158 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js.map +1 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.d.ts +11 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js +177 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js.map +1 -0
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +6 -0
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/index.d.ts +1 -0
- package/Materials/Node/Blocks/index.js +1 -0
- package/Materials/Node/Blocks/index.js.map +1 -1
- package/Materials/Node/Blocks/matrixSplitterBlock.d.ts +56 -0
- package/Materials/Node/Blocks/matrixSplitterBlock.js +130 -0
- package/Materials/Node/Blocks/matrixSplitterBlock.js.map +1 -0
- package/Materials/PBR/pbrBaseMaterial.d.ts +1 -0
- package/Materials/PBR/pbrBaseMaterial.js +12 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/effectRenderer.js +1 -1
- package/Materials/effectRenderer.js.map +1 -1
- package/Maths/math.scalar.d.ts +0 -1
- package/Maths/math.scalar.js +1 -2
- package/Maths/math.scalar.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.js +2 -2
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +15 -2
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +68 -20
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/abstractMesh.hotSpot.d.ts +8 -1
- package/Meshes/abstractMesh.hotSpot.js +17 -0
- package/Meshes/abstractMesh.hotSpot.js.map +1 -1
- package/Meshes/linesMesh.js +1 -1
- package/Meshes/linesMesh.js.map +1 -1
- package/Misc/virtualJoystick.js +2 -0
- package/Misc/virtualJoystick.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +3 -23
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +30 -67
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.d.ts +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +8 -4
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
- package/Rendering/{IBLShadows/iblShadowsImportanceSamplingRenderer.d.ts → iblCdfGenerator.d.ts} +15 -12
- package/Rendering/{IBLShadows/iblShadowsImportanceSamplingRenderer.js → iblCdfGenerator.js} +37 -27
- package/Rendering/iblCdfGenerator.js.map +1 -0
- package/Rendering/iblCdfGeneratorSceneComponent.d.ts +59 -0
- package/Rendering/iblCdfGeneratorSceneComponent.js +83 -0
- package/Rendering/iblCdfGeneratorSceneComponent.js.map +1 -0
- package/Rendering/index.d.ts +12 -10
- package/Rendering/index.js +12 -10
- package/Rendering/index.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +72 -2
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +29 -4
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockReflection.js +9 -1
- package/Shaders/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js +9 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +3 -0
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +16 -2
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/{iblShadowsCdfy.fragment.d.ts → iblCdfx.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsCdfx.fragment.js → iblCdfx.fragment.js} +3 -3
- package/Shaders/iblCdfx.fragment.js.map +1 -0
- package/Shaders/{iblShadowsCdfx.fragment.d.ts → iblCdfy.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsCdfy.fragment.js → iblCdfy.fragment.js} +3 -3
- package/Shaders/iblCdfy.fragment.js.map +1 -0
- package/Shaders/{iblShadowsIcdfx.fragment.d.ts → iblIcdfx.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsIcdfx.fragment.js → iblIcdfx.fragment.js} +3 -3
- package/Shaders/iblIcdfx.fragment.js.map +1 -0
- package/Shaders/{iblShadowsIcdfy.fragment.d.ts → iblIcdfy.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsIcdfy.fragment.js → iblIcdfy.fragment.js} +3 -3
- package/Shaders/iblIcdfy.fragment.js.map +1 -0
- package/Shaders/importanceSamplingDebug.fragment.d.ts +5 -0
- package/Shaders/{iblShadowsImportanceSamplingDebug.fragment.js → importanceSamplingDebug.fragment.js} +3 -3
- package/Shaders/importanceSamplingDebug.fragment.js.map +1 -0
- package/Shaders/pbr.fragment.js +8 -0
- package/Shaders/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +77 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +28 -4
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/oitFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/oitFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +14 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +14 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +3 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +18 -2
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/iblCdfx.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsCdfx.fragment.js → iblCdfx.fragment.js} +3 -3
- package/ShadersWGSL/iblCdfx.fragment.js.map +1 -0
- package/ShadersWGSL/iblCdfy.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsCdfy.fragment.js → iblCdfy.fragment.js} +3 -3
- package/ShadersWGSL/iblCdfy.fragment.js.map +1 -0
- package/ShadersWGSL/iblIcdfx.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsIcdfx.fragment.js → iblIcdfx.fragment.js} +3 -3
- package/ShadersWGSL/iblIcdfx.fragment.js.map +1 -0
- package/ShadersWGSL/iblIcdfy.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsIcdfy.fragment.js → iblIcdfy.fragment.js} +3 -3
- package/ShadersWGSL/iblIcdfy.fragment.js.map +1 -0
- package/ShadersWGSL/importanceSamplingDebug.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsImportanceSamplingDebug.fragment.js → importanceSamplingDebug.fragment.js} +3 -3
- package/ShadersWGSL/importanceSamplingDebug.fragment.js.map +1 -0
- package/ShadersWGSL/pbr.fragment.js +12 -0
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +4 -0
- package/scene.js +6 -0
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +1 -1
- package/sceneComponent.js +1 -1
- package/sceneComponent.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsImportanceSamplingRenderer.js.map +0 -1
- package/Shaders/iblShadowsCdfx.fragment.js.map +0 -1
- package/Shaders/iblShadowsCdfy.fragment.js.map +0 -1
- package/Shaders/iblShadowsIcdfx.fragment.js.map +0 -1
- package/Shaders/iblShadowsIcdfy.fragment.js.map +0 -1
- package/Shaders/iblShadowsImportanceSamplingDebug.fragment.d.ts +0 -5
- package/Shaders/iblShadowsImportanceSamplingDebug.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsCdfx.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsCdfx.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsCdfy.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsCdfy.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsIcdfx.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsIcdfx.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsIcdfy.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsIcdfy.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsImportanceSamplingDebug.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsImportanceSamplingDebug.fragment.js.map +0 -1
|
@@ -28,6 +28,7 @@ class GaussianSplattingMaterialDefines extends MaterialDefines {
|
|
|
28
28
|
this.CLIPPLANE4 = false;
|
|
29
29
|
this.CLIPPLANE5 = false;
|
|
30
30
|
this.CLIPPLANE6 = false;
|
|
31
|
+
this.SH_DEGREE = 0;
|
|
31
32
|
this.rebuild();
|
|
32
33
|
}
|
|
33
34
|
}
|
|
@@ -94,6 +95,10 @@ export class GaussianSplattingMaterial extends PushMaterial {
|
|
|
94
95
|
PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances, null, true);
|
|
95
96
|
// Attribs
|
|
96
97
|
PrepareDefinesForAttributes(mesh, defines, false, false);
|
|
98
|
+
// SH is disabled for webGL1
|
|
99
|
+
if (engine.version > 1 || engine.isWebGPU) {
|
|
100
|
+
defines["SH_DEGREE"] = mesh.shDegree;
|
|
101
|
+
}
|
|
97
102
|
// Get correct effect
|
|
98
103
|
if (defines.isDirty) {
|
|
99
104
|
defines.markAsProcessed();
|
|
@@ -101,8 +106,8 @@ export class GaussianSplattingMaterial extends PushMaterial {
|
|
|
101
106
|
//Attributes
|
|
102
107
|
const attribs = [VertexBuffer.PositionKind, "splatIndex"];
|
|
103
108
|
PrepareAttributesForInstances(attribs, defines);
|
|
104
|
-
const uniforms = ["world", "view", "projection", "vFogInfos", "vFogColor", "logarithmicDepthConstant", "invViewport", "dataTextureSize", "focal"];
|
|
105
|
-
const samplers = ["covariancesATexture", "covariancesBTexture", "centersTexture", "colorsTexture"];
|
|
109
|
+
const uniforms = ["world", "view", "projection", "vFogInfos", "vFogColor", "logarithmicDepthConstant", "invViewport", "dataTextureSize", "focal", "vEyePosition"];
|
|
110
|
+
const samplers = ["covariancesATexture", "covariancesBTexture", "centersTexture", "colorsTexture", "shTexture0", "shTexture1", "shTexture2"];
|
|
106
111
|
const uniformBuffers = ["Scene", "Mesh"];
|
|
107
112
|
PrepareUniformsAndSamplersList({
|
|
108
113
|
uniformsNames: uniforms,
|
|
@@ -181,6 +186,11 @@ export class GaussianSplattingMaterial extends PushMaterial {
|
|
|
181
186
|
effect.setTexture("covariancesBTexture", gsMesh.covariancesBTexture);
|
|
182
187
|
effect.setTexture("centersTexture", gsMesh.centersTexture);
|
|
183
188
|
effect.setTexture("colorsTexture", gsMesh.colorsTexture);
|
|
189
|
+
if (gsMesh.shTextures) {
|
|
190
|
+
for (let i = 0; i < gsMesh.shTextures?.length; i++) {
|
|
191
|
+
effect.setTexture(`shTexture${i}`, gsMesh.shTextures[i]);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
184
194
|
}
|
|
185
195
|
}
|
|
186
196
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gaussianSplattingMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GaussianSplatting/gaussianSplattingMaterial.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,gCAA4B;AAE7C,OAAO,0CAA0C,CAAC;AAClD,OAAO,wCAAwC,CAAC;AAChD,OAAO,8CAA8C,CAAC;AACtD,OAAO,4CAA4C,CAAC;AAC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,OAAO,2BAA2B,CAAC;IACvC,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAU,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnE,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,yBAAyB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACtH,CAAC;CACJ;AAED,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { SubMesh } from \"../../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Effect, IEffectCreationOptions } from \"../../Materials/effect\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Matrix } from \"../../Maths/math.vector\";\r\nimport type { GaussianSplattingMesh } from \"core/Meshes\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { MaterialDefines } from \"../../Materials/materialDefines\";\r\nimport { PushMaterial } from \"../../Materials/pushMaterial\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport { addClipPlaneUniforms, bindClipPlane } from \"../clipPlaneMaterialHelper\";\r\nimport { Camera } from \"core/Cameras/camera\";\r\n\r\nimport \"../../Shaders/gaussianSplatting.fragment\";\r\nimport \"../../Shaders/gaussianSplatting.vertex\";\r\nimport \"../../ShadersWGSL/gaussianSplatting.fragment\";\r\nimport \"../../ShadersWGSL/gaussianSplatting.vertex\";\r\nimport {\r\n BindFogParameters,\r\n BindLogDepth,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"../materialHelper.functions\";\r\nimport { ShaderLanguage } from \"../shaderLanguage\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass GaussianSplattingMaterialDefines extends MaterialDefines {\r\n public FOG = false;\r\n public THIN_INSTANCES = true;\r\n public LOGARITHMICDEPTH = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n\r\n /**\r\n * Constructor of the defines.\r\n */\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * GaussianSplattingMaterial material used to render Gaussian Splatting\r\n * @experimental\r\n */\r\nexport class GaussianSplattingMaterial extends PushMaterial {\r\n /**\r\n * Instantiates a Gaussian Splatting Material in the given scene\r\n * @param name The friendly name of the material\r\n * @param scene The scene to add the material to\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n\r\n this.backFaceCulling = false;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n public override get hasRenderTargetTextures(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha test mode.\r\n * @returns false\r\n */\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha blend mode.\r\n * @returns true\r\n */\r\n public override needAlphaBlending(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Checks whether the material is ready to be rendered for a given mesh.\r\n * @param mesh The mesh to render\r\n * @param subMesh The submesh to check against\r\n * @returns true if all the dependencies are ready (Textures, Effects...)\r\n */\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const useInstances = true;\r\n\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (drawWrapper.effect && this.isFrozen) {\r\n if (drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new GaussianSplattingMaterialDefines();\r\n }\r\n\r\n const scene = this.getScene();\r\n const defines = <GaussianSplattingMaterialDefines>subMesh.materialDefines;\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Misc.\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, false, defines);\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances, null, true);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind, \"splatIndex\"];\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const uniforms = [\"world\", \"view\", \"projection\", \"vFogInfos\", \"vFogColor\", \"logarithmicDepthConstant\", \"invViewport\", \"dataTextureSize\", \"focal\"];\r\n const samplers = [\"covariancesATexture\", \"covariancesBTexture\", \"centersTexture\", \"colorsTexture\"];\r\n const uniformBuffers = [\"Scene\", \"Mesh\"];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n });\r\n\r\n addClipPlaneUniforms(uniforms);\r\n\r\n const join = defines.toString();\r\n const effect = scene.getEngine().createEffect(\r\n \"gaussianSplatting\",\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: {},\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: async () => {\r\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\r\n await Promise.all([import(\"../../ShadersWGSL/gaussianSplatting.fragment\"), import(\"../../ShadersWGSL/gaussianSplatting.vertex\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/gaussianSplatting.fragment\"), import(\"../../Shaders/gaussianSplatting.vertex\")]);\r\n }\r\n },\r\n },\r\n engine\r\n );\r\n subMesh.setEffect(effect, defines, this._materialContext);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n drawWrapper._wasPreviouslyUsingInstances = useInstances;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Bind material effect for a specific Gaussian Splatting mesh\r\n * @param mesh Gaussian splatting mesh\r\n * @param effect Splatting material or node material\r\n * @param scene scene that contains mesh and camera used for rendering\r\n */\r\n public static BindEffect(mesh: Mesh, effect: Effect, scene: Scene): void {\r\n const engine = scene.getEngine();\r\n const camera = scene.activeCamera;\r\n\r\n const renderWidth = engine.getRenderWidth();\r\n const renderHeight = engine.getRenderHeight();\r\n\r\n // check if rigcamera, get number of rigs\r\n const numberOfRigs = camera?.rigParent?.rigCameras.length || 1;\r\n\r\n effect.setFloat2(\"invViewport\", 1 / (renderWidth / numberOfRigs), 1 / renderHeight);\r\n\r\n let focal = 1000;\r\n\r\n if (camera) {\r\n /*\r\n more explicit version:\r\n const t = camera.getProjectionMatrix().m[5];\r\n const FovY = Math.atan(1.0 / t) * 2.0;\r\n focal = renderHeight / 2.0 / Math.tan(FovY / 2.0);\r\n Using a shorter version here to not have tan(atan) and 2.0 factor\r\n */\r\n const t = camera.getProjectionMatrix().m[5];\r\n if (camera.fovMode == Camera.FOVMODE_VERTICAL_FIXED) {\r\n focal = (renderHeight * t) / 2.0;\r\n } else {\r\n focal = (renderWidth * t) / 2.0;\r\n }\r\n }\r\n\r\n effect.setFloat2(\"focal\", focal, focal);\r\n\r\n const gsMesh = mesh as GaussianSplattingMesh;\r\n\r\n if (gsMesh.covariancesATexture) {\r\n const textureSize = gsMesh.covariancesATexture.getSize();\r\n\r\n effect.setFloat2(\"dataTextureSize\", textureSize.width, textureSize.height);\r\n\r\n effect.setTexture(\"covariancesATexture\", gsMesh.covariancesATexture);\r\n effect.setTexture(\"covariancesBTexture\", gsMesh.covariancesBTexture);\r\n effect.setTexture(\"centersTexture\", gsMesh.centersTexture);\r\n effect.setTexture(\"colorsTexture\", gsMesh.colorsTexture);\r\n }\r\n }\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <GaussianSplattingMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices Mesh.\r\n mesh.getMeshUniformBuffer().bindToEffect(effect, \"Mesh\");\r\n mesh.transferToEffect(world);\r\n\r\n // Bind data\r\n const mustRebind = this._mustRebind(scene, effect, subMesh, mesh.visibility);\r\n\r\n if (mustRebind) {\r\n this.bindView(effect);\r\n this.bindViewProjection(effect);\r\n GaussianSplattingMaterial.BindEffect(mesh, this._activeEffect, scene);\r\n // Clip plane\r\n bindClipPlane(effect, this, scene);\r\n } else if (scene.getEngine()._features.needToAlwaysBindUniformBuffers) {\r\n this._needToBindSceneUbo = true;\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, effect);\r\n\r\n // Log. depth\r\n if (this.useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Clones the material.\r\n * @param name The cloned name.\r\n * @returns The cloned material.\r\n */\r\n public override clone(name: string): GaussianSplattingMaterial {\r\n return SerializationHelper.Clone(() => new GaussianSplattingMaterial(name, this.getScene()), this);\r\n }\r\n\r\n /**\r\n * Serializes the current material to its JSON representation.\r\n * @returns The JSON representation.\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GaussianSplattingMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Gets the class name of the material\r\n * @returns \"GaussianSplattingMaterial\"\r\n */\r\n public override getClassName(): string {\r\n return \"GaussianSplattingMaterial\";\r\n }\r\n\r\n /**\r\n * Parse a JSON input to create back a Gaussian Splatting material.\r\n * @param source The JSON data to parse\r\n * @param scene The scene to create the parsed material in\r\n * @param rootUrl The root url of the assets the material depends upon\r\n * @returns the instantiated GaussianSplattingMaterial.\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): GaussianSplattingMaterial {\r\n return SerializationHelper.Parse(() => new GaussianSplattingMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GaussianSplattingMaterial\", GaussianSplattingMaterial);\r\n"]}
|
|
1
|
+
{"version":3,"file":"gaussianSplattingMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GaussianSplatting/gaussianSplattingMaterial.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,gCAA4B;AAE7C,OAAO,0CAA0C,CAAC;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vC,aAAa;QACb,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC3B,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACzC,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACa,KAAK,CAAC,IAAY;QAC9B,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACvG,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,mCAAmC,CAAC;QACrE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,2BAA2B,CAAC;IACvC,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAU,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnE,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,yBAAyB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACtH,CAAC;CACJ;AAED,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { SubMesh } from \"../../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Effect, IEffectCreationOptions } from \"../../Materials/effect\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Matrix } from \"../../Maths/math.vector\";\r\nimport type { GaussianSplattingMesh } from \"core/Meshes\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { MaterialDefines } from \"../../Materials/materialDefines\";\r\nimport { PushMaterial } from \"../../Materials/pushMaterial\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport { addClipPlaneUniforms, bindClipPlane } from \"../clipPlaneMaterialHelper\";\r\nimport { Camera } from \"core/Cameras/camera\";\r\n\r\nimport \"../../Shaders/gaussianSplatting.fragment\";\r\nimport \"../../Shaders/gaussianSplatting.vertex\";\r\nimport \"../../ShadersWGSL/gaussianSplatting.fragment\";\r\nimport \"../../ShadersWGSL/gaussianSplatting.vertex\";\r\nimport {\r\n BindFogParameters,\r\n BindLogDepth,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"../materialHelper.functions\";\r\nimport { ShaderLanguage } from \"../shaderLanguage\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass GaussianSplattingMaterialDefines extends MaterialDefines {\r\n public FOG = false;\r\n public THIN_INSTANCES = true;\r\n public LOGARITHMICDEPTH = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public SH_DEGREE = 0;\r\n\r\n /**\r\n * Constructor of the defines.\r\n */\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * GaussianSplattingMaterial material used to render Gaussian Splatting\r\n * @experimental\r\n */\r\nexport class GaussianSplattingMaterial extends PushMaterial {\r\n /**\r\n * Instantiates a Gaussian Splatting Material in the given scene\r\n * @param name The friendly name of the material\r\n * @param scene The scene to add the material to\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n\r\n this.backFaceCulling = false;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n public override get hasRenderTargetTextures(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha test mode.\r\n * @returns false\r\n */\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha blend mode.\r\n * @returns true\r\n */\r\n public override needAlphaBlending(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Checks whether the material is ready to be rendered for a given mesh.\r\n * @param mesh The mesh to render\r\n * @param subMesh The submesh to check against\r\n * @returns true if all the dependencies are ready (Textures, Effects...)\r\n */\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const useInstances = true;\r\n\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (drawWrapper.effect && this.isFrozen) {\r\n if (drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new GaussianSplattingMaterialDefines();\r\n }\r\n\r\n const scene = this.getScene();\r\n const defines = <GaussianSplattingMaterialDefines>subMesh.materialDefines;\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Misc.\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, false, defines);\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances, null, true);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n\r\n // SH is disabled for webGL1\r\n if (engine.version > 1 || engine.isWebGPU) {\r\n defines[\"SH_DEGREE\"] = (<GaussianSplattingMesh>mesh).shDegree;\r\n }\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind, \"splatIndex\"];\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const uniforms = [\"world\", \"view\", \"projection\", \"vFogInfos\", \"vFogColor\", \"logarithmicDepthConstant\", \"invViewport\", \"dataTextureSize\", \"focal\", \"vEyePosition\"];\r\n const samplers = [\"covariancesATexture\", \"covariancesBTexture\", \"centersTexture\", \"colorsTexture\", \"shTexture0\", \"shTexture1\", \"shTexture2\"];\r\n const uniformBuffers = [\"Scene\", \"Mesh\"];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n });\r\n\r\n addClipPlaneUniforms(uniforms);\r\n\r\n const join = defines.toString();\r\n const effect = scene.getEngine().createEffect(\r\n \"gaussianSplatting\",\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: {},\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: async () => {\r\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\r\n await Promise.all([import(\"../../ShadersWGSL/gaussianSplatting.fragment\"), import(\"../../ShadersWGSL/gaussianSplatting.vertex\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/gaussianSplatting.fragment\"), import(\"../../Shaders/gaussianSplatting.vertex\")]);\r\n }\r\n },\r\n },\r\n engine\r\n );\r\n subMesh.setEffect(effect, defines, this._materialContext);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n drawWrapper._wasPreviouslyUsingInstances = useInstances;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Bind material effect for a specific Gaussian Splatting mesh\r\n * @param mesh Gaussian splatting mesh\r\n * @param effect Splatting material or node material\r\n * @param scene scene that contains mesh and camera used for rendering\r\n */\r\n public static BindEffect(mesh: Mesh, effect: Effect, scene: Scene): void {\r\n const engine = scene.getEngine();\r\n const camera = scene.activeCamera;\r\n\r\n const renderWidth = engine.getRenderWidth();\r\n const renderHeight = engine.getRenderHeight();\r\n\r\n // check if rigcamera, get number of rigs\r\n const numberOfRigs = camera?.rigParent?.rigCameras.length || 1;\r\n\r\n effect.setFloat2(\"invViewport\", 1 / (renderWidth / numberOfRigs), 1 / renderHeight);\r\n\r\n let focal = 1000;\r\n\r\n if (camera) {\r\n /*\r\n more explicit version:\r\n const t = camera.getProjectionMatrix().m[5];\r\n const FovY = Math.atan(1.0 / t) * 2.0;\r\n focal = renderHeight / 2.0 / Math.tan(FovY / 2.0);\r\n Using a shorter version here to not have tan(atan) and 2.0 factor\r\n */\r\n const t = camera.getProjectionMatrix().m[5];\r\n if (camera.fovMode == Camera.FOVMODE_VERTICAL_FIXED) {\r\n focal = (renderHeight * t) / 2.0;\r\n } else {\r\n focal = (renderWidth * t) / 2.0;\r\n }\r\n }\r\n\r\n effect.setFloat2(\"focal\", focal, focal);\r\n\r\n const gsMesh = mesh as GaussianSplattingMesh;\r\n\r\n if (gsMesh.covariancesATexture) {\r\n const textureSize = gsMesh.covariancesATexture.getSize();\r\n\r\n effect.setFloat2(\"dataTextureSize\", textureSize.width, textureSize.height);\r\n\r\n effect.setTexture(\"covariancesATexture\", gsMesh.covariancesATexture);\r\n effect.setTexture(\"covariancesBTexture\", gsMesh.covariancesBTexture);\r\n effect.setTexture(\"centersTexture\", gsMesh.centersTexture);\r\n effect.setTexture(\"colorsTexture\", gsMesh.colorsTexture);\r\n\r\n if (gsMesh.shTextures) {\r\n for (let i = 0; i < gsMesh.shTextures?.length; i++) {\r\n effect.setTexture(`shTexture${i}`, gsMesh.shTextures[i]);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <GaussianSplattingMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices Mesh.\r\n mesh.getMeshUniformBuffer().bindToEffect(effect, \"Mesh\");\r\n mesh.transferToEffect(world);\r\n\r\n // Bind data\r\n const mustRebind = this._mustRebind(scene, effect, subMesh, mesh.visibility);\r\n\r\n if (mustRebind) {\r\n this.bindView(effect);\r\n this.bindViewProjection(effect);\r\n GaussianSplattingMaterial.BindEffect(mesh, this._activeEffect, scene);\r\n // Clip plane\r\n bindClipPlane(effect, this, scene);\r\n } else if (scene.getEngine()._features.needToAlwaysBindUniformBuffers) {\r\n this._needToBindSceneUbo = true;\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, effect);\r\n\r\n // Log. depth\r\n if (this.useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Clones the material.\r\n * @param name The cloned name.\r\n * @returns The cloned material.\r\n */\r\n public override clone(name: string): GaussianSplattingMaterial {\r\n return SerializationHelper.Clone(() => new GaussianSplattingMaterial(name, this.getScene()), this);\r\n }\r\n\r\n /**\r\n * Serializes the current material to its JSON representation.\r\n * @returns The JSON representation.\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GaussianSplattingMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Gets the class name of the material\r\n * @returns \"GaussianSplattingMaterial\"\r\n */\r\n public override getClassName(): string {\r\n return \"GaussianSplattingMaterial\";\r\n }\r\n\r\n /**\r\n * Parse a JSON input to create back a Gaussian Splatting material.\r\n * @param source The JSON data to parse\r\n * @param scene The scene to create the parsed material in\r\n * @param rootUrl The root url of the assets the material depends upon\r\n * @returns the instantiated GaussianSplattingMaterial.\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): GaussianSplattingMaterial {\r\n return SerializationHelper.Parse(() => new GaussianSplattingMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GaussianSplattingMaterial\", GaussianSplattingMaterial);\r\n"]}
|
|
@@ -151,6 +151,11 @@ export declare enum GreasedLineMeshColorDistributionType {
|
|
|
151
151
|
* Options for GreasedLineMaterial
|
|
152
152
|
*/
|
|
153
153
|
export interface GreasedLineMaterialOptions {
|
|
154
|
+
/**
|
|
155
|
+
* Force the greased lines to compile to glsl even on WebGPU engines.
|
|
156
|
+
* False by default. This is mostly meant for backward compatibility.
|
|
157
|
+
*/
|
|
158
|
+
forceGLSL?: boolean;
|
|
154
159
|
/**
|
|
155
160
|
* Line width. If sizeAttenuation os false scene units will be used for width.
|
|
156
161
|
* Defaults to 0.1 if @see sizeAttenuation is false, or to 1 if it's true.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLineMaterialInterfaces.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLineMaterialInterfaces.ts"],"names":[],"mappings":"AAiHA;;;GAGG;AACH,MAAM,CAAN,IAAkB,2BAejB;AAfD,WAAkB,2BAA2B;IACzC;;OAEG;IACH,iHAA0B,CAAA;IAC1B;;OAEG;IACH,uGAAqB,CAAA;IACrB;;;;OAIG;IACH,6GAAwB,CAAA;AAC5B,CAAC,EAfiB,2BAA2B,KAA3B,2BAA2B,QAe5C;AAED;;;GAGG;AACH,MAAM,CAAN,IAAkB,wBAajB;AAbD,WAAkB,wBAAwB;IACtC;;OAEG;IACH,2FAAkB,CAAA;IAClB;;OAEG;IACH,2FAAkB,CAAA;IAClB;;OAEG;IACH,qGAAuB,CAAA;AAC3B,CAAC,EAbiB,wBAAwB,KAAxB,wBAAwB,QAazC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAkB,oCASjB;AATD,WAAkB,oCAAoC;IAClD;;OAEG;IACH,qJAAmC,CAAA;IACnC;;OAEG;IACH,+IAAgC,CAAA;AACpC,CAAC,EATiB,oCAAoC,KAApC,oCAAoC,QASrD","sourcesContent":["import type { RawTexture } from \"../Textures/rawTexture\";\r\nimport type { Vector2 } from \"../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\n/**\r\n * Interface which defines the available methods for a GreasedLineMaterial\r\n */\r\nexport interface IGreasedLineMaterial {\r\n /**\r\n * Normalized value of how much of the line will be visible\r\n * 0 - 0% of the line will be visible\r\n * 1 - 100% of the line will be visible\r\n */\r\n visibility: number;\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n width: number;\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n useDash: boolean;\r\n\r\n /**\r\n * @see GreasedLinePluginMaterial.setDashCount\r\n * Number of dashes in the line.\r\n * Defaults to 1.\r\n */\r\n dashCount: number;\r\n\r\n /**\r\n * Dash offset\r\n */\r\n dashOffset: number;\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n dashRatio: number;\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n useColors: boolean;\r\n\r\n /**\r\n * The mixing mode of the color paramater. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * MATERIAL_TYPE_STANDARD and MATERIAL_TYPE_PBR mixes the color from the base material with the color and/or colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n colorMode: GreasedLineMeshColorMode;\r\n\r\n /**\r\n * Colors of the line segments.\r\n * Defaults to empty.\r\n */\r\n colors: Nullable<Color3[]>;\r\n\r\n /**\r\n * If false then width units = scene units. If true then line will width be reduced.\r\n * Defaults to false.\r\n */\r\n sizeAttenuation: boolean;\r\n\r\n /**\r\n * Color of the line. Applies to all line segments.\r\n * Defaults to White.\r\n */\r\n color: Nullable<Color3>;\r\n\r\n /**\r\n * The method used to distribute the colors along the line.\r\n * You can use segment distribution when each segment will use on color from the color table.\r\n * Or you can use line distribution when the colors are distributed evenly along the line ignoring the segments.\r\n */\r\n colorsDistributionType: GreasedLineMeshColorDistributionType;\r\n\r\n /**\r\n * Defaults to engine.getRenderWidth() and engine.getRenderHeight()\r\n * Rendering resolution\r\n */\r\n resolution: Vector2;\r\n\r\n /**\r\n * You can provide a colorsTexture to use instead of one generated from the 'colors' option\r\n */\r\n colorsTexture: Nullable<RawTexture>;\r\n\r\n /**\r\n * Allows to change the color without marking the material dirty.\r\n * MATERIAL_TYPE_STANDARD and MATERIAL_TYPE_PBR material's shaders will get recompiled if there was no color set and you set a color or when there was a color set and you set it to null.\r\n * @param value the color\r\n * @param doNotMarkDirty the flag\r\n */\r\n setColor(value: Nullable<Color3>, doNotMarkDirty?: boolean): void;\r\n\r\n /**\r\n * Set the colors\r\n * @param colors colors array\r\n * @param lazy if true the colors texture will not be updated\r\n * @param forceNewTexture forces to create a new colors texture\r\n */\r\n setColors(colors: Nullable<Color3[]>, lazy: boolean, forceNewTexture?: boolean): void;\r\n\r\n /**\r\n * Creates and sets the colors texture from the colors array which was created in lazy mode\r\n */\r\n updateLazy(): void;\r\n}\r\n\r\n/**\r\n * Material types for GreasedLine\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#materialtype}\r\n */\r\nexport const enum GreasedLineMeshMaterialType {\r\n /**\r\n * StandardMaterial\r\n */\r\n MATERIAL_TYPE_STANDARD = 0,\r\n /**\r\n * PBR Material\r\n */\r\n MATERIAL_TYPE_PBR = 1,\r\n /**\r\n * Simple and fast shader material without texture, light, fog, instances, ... support.\r\n * Just raw colored lines.\r\n * Dashing and visibility is supported.\r\n */\r\n MATERIAL_TYPE_SIMPLE = 2,\r\n}\r\n\r\n/**\r\n * Color blending mode of the @see GreasedLineMaterial and the base material\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colormode}\r\n */\r\nexport const enum GreasedLineMeshColorMode {\r\n /**\r\n * Color blending mode SET\r\n */\r\n COLOR_MODE_SET = 0,\r\n /**\r\n * Color blending mode ADD\r\n */\r\n COLOR_MODE_ADD = 1,\r\n /**\r\n * Color blending mode ADD\r\n */\r\n COLOR_MODE_MULTIPLY = 2,\r\n}\r\n\r\n/**\r\n * Color distribution type of the @see colors.\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colordistributiontype}\r\n *\r\n */\r\nexport const enum GreasedLineMeshColorDistributionType {\r\n /**\r\n * Colors distributed between segments of the line\r\n */\r\n COLOR_DISTRIBUTION_TYPE_SEGMENT = 0,\r\n /**\r\n * Colors distributed along the line ingoring the segments\r\n */\r\n COLOR_DISTRIBUTION_TYPE_LINE = 1,\r\n}\r\n\r\n/**\r\n * Options for GreasedLineMaterial\r\n */\r\nexport interface GreasedLineMaterialOptions {\r\n /**\r\n * Line width. If sizeAttenuation os false scene units will be used for width.\r\n * Defaults to 0.1 if @see sizeAttenuation is false, or to 1 if it's true.\r\n */\r\n width?: number;\r\n /**\r\n * If false then width units = scene units. If true then line will width be reduced.\r\n * Defaults to false.\r\n */\r\n sizeAttenuation?: boolean;\r\n /**\r\n * Type of the material to use to render the line.\r\n * Defaults to StandardMaterial.\r\n */\r\n materialType?: GreasedLineMeshMaterialType;\r\n /**\r\n * Color of the line. Applies to all line segments.\r\n * Defaults to White.\r\n */\r\n color?: Color3;\r\n /**\r\n * Color mode of the line. Applies to all line segments.\r\n * The pixel color from the material shader will be modified with the value of @see color using the colorMode.\r\n * Defaults to @see GreasedLineMeshColorMode.SET\r\n */\r\n colorMode?: GreasedLineMeshColorMode;\r\n /**\r\n * Colors of the line segments.\r\n * Defaults to empty.\r\n */\r\n colors?: Color3[];\r\n /**\r\n * If true, @see colors are used, otherwise they're ignored.\r\n * Defaults to false.\r\n */\r\n useColors?: boolean;\r\n /**\r\n * Sampling type of the colors texture\r\n * Defaults to NEAREST_NEAREST.\r\n */\r\n colorsSampling?: number;\r\n /**\r\n * The method used to distribute the colors along the line.\r\n * You can use segment distribution when each segment will use on color from the color table.\r\n * Or you can use line distribution when the colors are distributed evenly along the line ignoring the segments.\r\n */\r\n colorDistributionType?: GreasedLineMeshColorDistributionType;\r\n /**\r\n * If true, dashing is used.\r\n * Defaults to false.\r\n */\r\n useDash?: boolean;\r\n /**\r\n * @see GreasedLinePluginMaterial.setDashCount\r\n * Number of dashes in the line.\r\n * Defaults to 1.\r\n */\r\n dashCount?: number;\r\n /**\r\n * Offset of the dashes along the line. 0 to 1.\r\n * Defaults to 0.\r\n * @see GreasedLinePluginMaterial.setDashOffset\r\n */\r\n dashOffset?: number;\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n * Defaults to 0.5.\r\n * @see GreasedLinePluginMaterial.setDashRatio\r\n */\r\n dashRatio?: number;\r\n /**\r\n * Sets the line length visibility.\r\n * 0 - 0% of the line will be visible.\r\n * 1 - 100% of the line will be visible.\r\n * @see GreasedLinePluginMaterial.setVisibility\r\n */\r\n visibility?: number;\r\n /**\r\n * Defaults to engine.getRenderWidth() and engine.getRenderHeight()\r\n * Rendering resolution\r\n */\r\n resolution?: Vector2;\r\n /**\r\n * Whether to use camera facing for the line.\r\n * Defaults to true.\r\n */\r\n cameraFacing?: boolean;\r\n /**\r\n * You can provide a colorsTexture to use instead of one generated from the 'colors' option\r\n */\r\n colorsTexture?: RawTexture;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"greasedLineMaterialInterfaces.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLineMaterialInterfaces.ts"],"names":[],"mappings":"AAiHA;;;GAGG;AACH,MAAM,CAAN,IAAkB,2BAejB;AAfD,WAAkB,2BAA2B;IACzC;;OAEG;IACH,iHAA0B,CAAA;IAC1B;;OAEG;IACH,uGAAqB,CAAA;IACrB;;;;OAIG;IACH,6GAAwB,CAAA;AAC5B,CAAC,EAfiB,2BAA2B,KAA3B,2BAA2B,QAe5C;AAED;;;GAGG;AACH,MAAM,CAAN,IAAkB,wBAajB;AAbD,WAAkB,wBAAwB;IACtC;;OAEG;IACH,2FAAkB,CAAA;IAClB;;OAEG;IACH,2FAAkB,CAAA;IAClB;;OAEG;IACH,qGAAuB,CAAA;AAC3B,CAAC,EAbiB,wBAAwB,KAAxB,wBAAwB,QAazC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAkB,oCASjB;AATD,WAAkB,oCAAoC;IAClD;;OAEG;IACH,qJAAmC,CAAA;IACnC;;OAEG;IACH,+IAAgC,CAAA;AACpC,CAAC,EATiB,oCAAoC,KAApC,oCAAoC,QASrD","sourcesContent":["import type { RawTexture } from \"../Textures/rawTexture\";\r\nimport type { Vector2 } from \"../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\n/**\r\n * Interface which defines the available methods for a GreasedLineMaterial\r\n */\r\nexport interface IGreasedLineMaterial {\r\n /**\r\n * Normalized value of how much of the line will be visible\r\n * 0 - 0% of the line will be visible\r\n * 1 - 100% of the line will be visible\r\n */\r\n visibility: number;\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n width: number;\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n useDash: boolean;\r\n\r\n /**\r\n * @see GreasedLinePluginMaterial.setDashCount\r\n * Number of dashes in the line.\r\n * Defaults to 1.\r\n */\r\n dashCount: number;\r\n\r\n /**\r\n * Dash offset\r\n */\r\n dashOffset: number;\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n dashRatio: number;\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n useColors: boolean;\r\n\r\n /**\r\n * The mixing mode of the color paramater. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * MATERIAL_TYPE_STANDARD and MATERIAL_TYPE_PBR mixes the color from the base material with the color and/or colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n colorMode: GreasedLineMeshColorMode;\r\n\r\n /**\r\n * Colors of the line segments.\r\n * Defaults to empty.\r\n */\r\n colors: Nullable<Color3[]>;\r\n\r\n /**\r\n * If false then width units = scene units. If true then line will width be reduced.\r\n * Defaults to false.\r\n */\r\n sizeAttenuation: boolean;\r\n\r\n /**\r\n * Color of the line. Applies to all line segments.\r\n * Defaults to White.\r\n */\r\n color: Nullable<Color3>;\r\n\r\n /**\r\n * The method used to distribute the colors along the line.\r\n * You can use segment distribution when each segment will use on color from the color table.\r\n * Or you can use line distribution when the colors are distributed evenly along the line ignoring the segments.\r\n */\r\n colorsDistributionType: GreasedLineMeshColorDistributionType;\r\n\r\n /**\r\n * Defaults to engine.getRenderWidth() and engine.getRenderHeight()\r\n * Rendering resolution\r\n */\r\n resolution: Vector2;\r\n\r\n /**\r\n * You can provide a colorsTexture to use instead of one generated from the 'colors' option\r\n */\r\n colorsTexture: Nullable<RawTexture>;\r\n\r\n /**\r\n * Allows to change the color without marking the material dirty.\r\n * MATERIAL_TYPE_STANDARD and MATERIAL_TYPE_PBR material's shaders will get recompiled if there was no color set and you set a color or when there was a color set and you set it to null.\r\n * @param value the color\r\n * @param doNotMarkDirty the flag\r\n */\r\n setColor(value: Nullable<Color3>, doNotMarkDirty?: boolean): void;\r\n\r\n /**\r\n * Set the colors\r\n * @param colors colors array\r\n * @param lazy if true the colors texture will not be updated\r\n * @param forceNewTexture forces to create a new colors texture\r\n */\r\n setColors(colors: Nullable<Color3[]>, lazy: boolean, forceNewTexture?: boolean): void;\r\n\r\n /**\r\n * Creates and sets the colors texture from the colors array which was created in lazy mode\r\n */\r\n updateLazy(): void;\r\n}\r\n\r\n/**\r\n * Material types for GreasedLine\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#materialtype}\r\n */\r\nexport const enum GreasedLineMeshMaterialType {\r\n /**\r\n * StandardMaterial\r\n */\r\n MATERIAL_TYPE_STANDARD = 0,\r\n /**\r\n * PBR Material\r\n */\r\n MATERIAL_TYPE_PBR = 1,\r\n /**\r\n * Simple and fast shader material without texture, light, fog, instances, ... support.\r\n * Just raw colored lines.\r\n * Dashing and visibility is supported.\r\n */\r\n MATERIAL_TYPE_SIMPLE = 2,\r\n}\r\n\r\n/**\r\n * Color blending mode of the @see GreasedLineMaterial and the base material\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colormode}\r\n */\r\nexport const enum GreasedLineMeshColorMode {\r\n /**\r\n * Color blending mode SET\r\n */\r\n COLOR_MODE_SET = 0,\r\n /**\r\n * Color blending mode ADD\r\n */\r\n COLOR_MODE_ADD = 1,\r\n /**\r\n * Color blending mode ADD\r\n */\r\n COLOR_MODE_MULTIPLY = 2,\r\n}\r\n\r\n/**\r\n * Color distribution type of the @see colors.\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colordistributiontype}\r\n *\r\n */\r\nexport const enum GreasedLineMeshColorDistributionType {\r\n /**\r\n * Colors distributed between segments of the line\r\n */\r\n COLOR_DISTRIBUTION_TYPE_SEGMENT = 0,\r\n /**\r\n * Colors distributed along the line ingoring the segments\r\n */\r\n COLOR_DISTRIBUTION_TYPE_LINE = 1,\r\n}\r\n\r\n/**\r\n * Options for GreasedLineMaterial\r\n */\r\nexport interface GreasedLineMaterialOptions {\r\n /**\r\n * Force 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 forceGLSL?: boolean;\r\n /**\r\n * Line width. If sizeAttenuation os false scene units will be used for width.\r\n * Defaults to 0.1 if @see sizeAttenuation is false, or to 1 if it's true.\r\n */\r\n width?: number;\r\n /**\r\n * If false then width units = scene units. If true then line will width be reduced.\r\n * Defaults to false.\r\n */\r\n sizeAttenuation?: boolean;\r\n /**\r\n * Type of the material to use to render the line.\r\n * Defaults to StandardMaterial.\r\n */\r\n materialType?: GreasedLineMeshMaterialType;\r\n /**\r\n * Color of the line. Applies to all line segments.\r\n * Defaults to White.\r\n */\r\n color?: Color3;\r\n /**\r\n * Color mode of the line. Applies to all line segments.\r\n * The pixel color from the material shader will be modified with the value of @see color using the colorMode.\r\n * Defaults to @see GreasedLineMeshColorMode.SET\r\n */\r\n colorMode?: GreasedLineMeshColorMode;\r\n /**\r\n * Colors of the line segments.\r\n * Defaults to empty.\r\n */\r\n colors?: Color3[];\r\n /**\r\n * If true, @see colors are used, otherwise they're ignored.\r\n * Defaults to false.\r\n */\r\n useColors?: boolean;\r\n /**\r\n * Sampling type of the colors texture\r\n * Defaults to NEAREST_NEAREST.\r\n */\r\n colorsSampling?: number;\r\n /**\r\n * The method used to distribute the colors along the line.\r\n * You can use segment distribution when each segment will use on color from the color table.\r\n * Or you can use line distribution when the colors are distributed evenly along the line ignoring the segments.\r\n */\r\n colorDistributionType?: GreasedLineMeshColorDistributionType;\r\n /**\r\n * If true, dashing is used.\r\n * Defaults to false.\r\n */\r\n useDash?: boolean;\r\n /**\r\n * @see GreasedLinePluginMaterial.setDashCount\r\n * Number of dashes in the line.\r\n * Defaults to 1.\r\n */\r\n dashCount?: number;\r\n /**\r\n * Offset of the dashes along the line. 0 to 1.\r\n * Defaults to 0.\r\n * @see GreasedLinePluginMaterial.setDashOffset\r\n */\r\n dashOffset?: number;\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n * Defaults to 0.5.\r\n * @see GreasedLinePluginMaterial.setDashRatio\r\n */\r\n dashRatio?: number;\r\n /**\r\n * Sets the line length visibility.\r\n * 0 - 0% of the line will be visible.\r\n * 1 - 100% of the line will be visible.\r\n * @see GreasedLinePluginMaterial.setVisibility\r\n */\r\n visibility?: number;\r\n /**\r\n * Defaults to engine.getRenderWidth() and engine.getRenderHeight()\r\n * Rendering resolution\r\n */\r\n resolution?: Vector2;\r\n /**\r\n * Whether to use camera facing for the line.\r\n * Defaults to true.\r\n */\r\n cameraFacing?: boolean;\r\n /**\r\n * You can provide a colorsTexture to use instead of one generated from the 'colors' option\r\n */\r\n colorsTexture?: RawTexture;\r\n}\r\n"]}
|
|
@@ -9,6 +9,7 @@ import type { Material } from "../material";
|
|
|
9
9
|
import { MaterialDefines } from "../materialDefines";
|
|
10
10
|
import type { AbstractMesh } from "../../Meshes/abstractMesh";
|
|
11
11
|
import type { BaseTexture } from "../Textures/baseTexture";
|
|
12
|
+
import { ShaderLanguage } from "../shaderLanguage";
|
|
12
13
|
import type { GreasedLineMaterialOptions, IGreasedLineMaterial } from "./greasedLineMaterialInterfaces";
|
|
13
14
|
import { GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from "./greasedLineMaterialInterfaces";
|
|
14
15
|
/**
|
|
@@ -45,6 +46,11 @@ export declare class GreasedLinePluginMaterial extends MaterialPluginBase implem
|
|
|
45
46
|
* Plugin name
|
|
46
47
|
*/
|
|
47
48
|
static readonly GREASED_LINE_MATERIAL_NAME = "GreasedLinePluginMaterial";
|
|
49
|
+
/**
|
|
50
|
+
* Force all the greased lines to compile to glsl even on WebGPU engines.
|
|
51
|
+
* False by default. This is mostly meant for backward compatibility.
|
|
52
|
+
*/
|
|
53
|
+
static ForceGLSL: boolean;
|
|
48
54
|
/**
|
|
49
55
|
* Whether to use the colors option to colorize the line
|
|
50
56
|
*/
|
|
@@ -95,11 +101,18 @@ export declare class GreasedLinePluginMaterial extends MaterialPluginBase implem
|
|
|
95
101
|
private _sizeAttenuation;
|
|
96
102
|
private _cameraFacing;
|
|
97
103
|
private _engine;
|
|
104
|
+
private _forceGLSL;
|
|
105
|
+
/**
|
|
106
|
+
* Gets a boolean indicating that the plugin is compatible with a given shader language
|
|
107
|
+
* @param _shaderLanguage The shader language to use
|
|
108
|
+
* @returns true if the plugin is compatible with the shader language. Return always true since both GLSL and WGSL are supported
|
|
109
|
+
*/
|
|
110
|
+
isCompatible(_shaderLanguage: ShaderLanguage): boolean;
|
|
98
111
|
/**
|
|
99
112
|
* Creates a new instance of the GreasedLinePluginMaterial
|
|
100
|
-
* @param material
|
|
101
|
-
* @param scene
|
|
102
|
-
* @param options
|
|
113
|
+
* @param material Base material for the plugin
|
|
114
|
+
* @param scene The scene
|
|
115
|
+
* @param options Plugin options
|
|
103
116
|
*/
|
|
104
117
|
constructor(material: Material, scene?: Scene, options?: GreasedLineMaterialOptions);
|
|
105
118
|
/**
|
|
@@ -119,9 +132,10 @@ export declare class GreasedLinePluginMaterial extends MaterialPluginBase implem
|
|
|
119
132
|
getActiveTextures(activeTextures: BaseTexture[]): void;
|
|
120
133
|
/**
|
|
121
134
|
* Get the shader uniforms
|
|
135
|
+
* @param shaderLanguage The shader language to use
|
|
122
136
|
* @returns uniforms
|
|
123
137
|
*/
|
|
124
|
-
getUniforms(): {
|
|
138
|
+
getUniforms(shaderLanguage?: ShaderLanguage): {
|
|
125
139
|
ubo: {
|
|
126
140
|
name: string;
|
|
127
141
|
size: number;
|
|
@@ -151,9 +165,10 @@ export declare class GreasedLinePluginMaterial extends MaterialPluginBase implem
|
|
|
151
165
|
/**
|
|
152
166
|
* Get shader code
|
|
153
167
|
* @param shaderType vertex/fragment
|
|
168
|
+
* @param shaderLanguage GLSL or WGSL
|
|
154
169
|
* @returns shader code
|
|
155
170
|
*/
|
|
156
|
-
getCustomCode(shaderType: string): Nullable<{
|
|
171
|
+
getCustomCode(shaderType: string, shaderLanguage?: ShaderLanguage): Nullable<{
|
|
157
172
|
[pointName: string]: string;
|
|
158
173
|
}>;
|
|
159
174
|
/**
|
|
@@ -250,4 +265,5 @@ export declare class GreasedLinePluginMaterial extends MaterialPluginBase implem
|
|
|
250
265
|
* @param plugin define the config where to copy the info
|
|
251
266
|
*/
|
|
252
267
|
copyTo(plugin: MaterialPluginBase): void;
|
|
268
|
+
private _isGLSL;
|
|
253
269
|
}
|
|
@@ -5,6 +5,8 @@ import { MaterialDefines } from "../materialDefines.js";
|
|
|
5
5
|
import { RegisterClass } from "../../Misc/typeStore.js";
|
|
6
6
|
import { GreasedLineMaterialDefaults } from "./greasedLineMaterialDefaults.js";
|
|
7
7
|
import { GreasedLineTools } from "../../Misc/greasedLineTools.js";
|
|
8
|
+
import { GetCustomCode as getCustomCodeGLSL } from "./greasedLinePluginMaterialShadersGLSL.js";
|
|
9
|
+
import { GetCustomCode as getCustomCodeWGSL } from "./greasedLinePluginMaterialShadersWGSL.js";
|
|
8
10
|
/**
|
|
9
11
|
* @internal
|
|
10
12
|
*/
|
|
@@ -43,11 +45,19 @@ export class MaterialGreasedLineDefines extends MaterialDefines {
|
|
|
43
45
|
* Use the GreasedLineBuilder.CreateGreasedLineMaterial function to create and instance of this class.
|
|
44
46
|
*/
|
|
45
47
|
export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
48
|
+
/**
|
|
49
|
+
* Gets a boolean indicating that the plugin is compatible with a given shader language
|
|
50
|
+
* @param _shaderLanguage The shader language to use
|
|
51
|
+
* @returns true if the plugin is compatible with the shader language. Return always true since both GLSL and WGSL are supported
|
|
52
|
+
*/
|
|
53
|
+
isCompatible(_shaderLanguage) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
46
56
|
/**
|
|
47
57
|
* Creates a new instance of the GreasedLinePluginMaterial
|
|
48
|
-
* @param material
|
|
49
|
-
* @param scene
|
|
50
|
-
* @param options
|
|
58
|
+
* @param material Base material for the plugin
|
|
59
|
+
* @param scene The scene
|
|
60
|
+
* @param options Plugin options
|
|
51
61
|
*/
|
|
52
62
|
constructor(material, scene, options) {
|
|
53
63
|
options = options || {
|
|
@@ -59,11 +69,13 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
59
69
|
defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = options.colorDistributionType === 1 /* GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE */;
|
|
60
70
|
defines.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = (scene ?? material.getScene()).useRightHandedSystem;
|
|
61
71
|
defines.GREASED_LINE_CAMERA_FACING = options.cameraFacing ?? true;
|
|
62
|
-
super(material, GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME, 200, defines);
|
|
72
|
+
super(material, GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME, 200, defines, true, true);
|
|
63
73
|
/**
|
|
64
74
|
* You can provide a colorsTexture to use instead of one generated from the 'colors' option
|
|
65
75
|
*/
|
|
66
76
|
this.colorsTexture = null;
|
|
77
|
+
this._forceGLSL = false;
|
|
78
|
+
this._forceGLSL = options?.forceGLSL || GreasedLinePluginMaterial.ForceGLSL;
|
|
67
79
|
this._scene = scene ?? material.getScene();
|
|
68
80
|
this._engine = this._scene.getEngine();
|
|
69
81
|
this._cameraFacing = options.cameraFacing ?? true;
|
|
@@ -96,7 +108,6 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
96
108
|
this._engine.onDisposeObservable.add(() => {
|
|
97
109
|
GreasedLineTools.DisposeEmptyColorsTexture();
|
|
98
110
|
});
|
|
99
|
-
this._enable(true); // always enabled
|
|
100
111
|
}
|
|
101
112
|
/**
|
|
102
113
|
* Get the shader attributes
|
|
@@ -133,9 +144,10 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
133
144
|
}
|
|
134
145
|
/**
|
|
135
146
|
* Get the shader uniforms
|
|
147
|
+
* @param shaderLanguage The shader language to use
|
|
136
148
|
* @returns uniforms
|
|
137
149
|
*/
|
|
138
|
-
getUniforms() {
|
|
150
|
+
getUniforms(shaderLanguage = 0 /* ShaderLanguage.GLSL */) {
|
|
139
151
|
const ubo = [
|
|
140
152
|
{ name: "grl_singleColor", size: 3, type: "vec3" },
|
|
141
153
|
{ name: "grl_textureSize", size: 2, type: "vec2" },
|
|
@@ -145,20 +157,29 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
145
157
|
if (this._cameraFacing) {
|
|
146
158
|
ubo.push({ name: "grl_projection", size: 16, type: "mat4" }, { name: "grl_aspect_resolution_lineWidth", size: 4, type: "vec4" });
|
|
147
159
|
}
|
|
160
|
+
if (shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
161
|
+
ubo.push({
|
|
162
|
+
name: "viewProjection",
|
|
163
|
+
size: 16,
|
|
164
|
+
type: "mat4",
|
|
165
|
+
});
|
|
166
|
+
}
|
|
148
167
|
return {
|
|
149
168
|
ubo,
|
|
150
|
-
vertex: this._cameraFacing
|
|
169
|
+
vertex: this._cameraFacing && this._isGLSL(shaderLanguage)
|
|
170
|
+
? `
|
|
171
|
+
uniform vec4 grl_aspect_resolution_lineWidth;
|
|
172
|
+
uniform mat4 grl_projection;
|
|
173
|
+
`
|
|
174
|
+
: "",
|
|
175
|
+
fragment: this._isGLSL(shaderLanguage)
|
|
151
176
|
? `
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
177
|
+
uniform vec4 grl_dashOptions;
|
|
178
|
+
uniform vec2 grl_textureSize;
|
|
179
|
+
uniform vec4 grl_colorMode_visibility_colorsWidth_useColors;
|
|
180
|
+
uniform vec3 grl_singleColor;
|
|
181
|
+
`
|
|
155
182
|
: "",
|
|
156
|
-
fragment: `
|
|
157
|
-
uniform vec4 grl_dashOptions;
|
|
158
|
-
uniform vec2 grl_textureSize;
|
|
159
|
-
uniform vec4 grl_colorMode_visibility_colorsWidth_useColors;
|
|
160
|
-
uniform vec3 grl_singleColor;
|
|
161
|
-
`,
|
|
162
183
|
};
|
|
163
184
|
}
|
|
164
185
|
// only getter, it doesn't make sense to use this plugin on a mesh other than GreasedLineMesh
|
|
@@ -172,14 +193,8 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
172
193
|
*/
|
|
173
194
|
bindForSubMesh(uniformBuffer) {
|
|
174
195
|
if (this._cameraFacing) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const projection = activeCamera.getProjectionMatrix();
|
|
178
|
-
uniformBuffer.updateMatrix("grl_projection", projection);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
throw Error("GreasedLinePluginMaterial requires an active camera.");
|
|
182
|
-
}
|
|
196
|
+
uniformBuffer.updateMatrix("grl_projection", this._scene.getProjectionMatrix());
|
|
197
|
+
uniformBuffer.updateMatrix("viewProjection", this._scene.getTransformMatrix());
|
|
183
198
|
const resolutionLineWidth = TmpVectors.Vector4[0];
|
|
184
199
|
resolutionLineWidth.x = this._aspect;
|
|
185
200
|
resolutionLineWidth.y = this._resolution.x;
|
|
@@ -229,161 +244,14 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
229
244
|
/**
|
|
230
245
|
* Get shader code
|
|
231
246
|
* @param shaderType vertex/fragment
|
|
247
|
+
* @param shaderLanguage GLSL or WGSL
|
|
232
248
|
* @returns shader code
|
|
233
249
|
*/
|
|
234
|
-
getCustomCode(shaderType) {
|
|
235
|
-
if (
|
|
236
|
-
|
|
237
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
238
|
-
CUSTOM_VERTEX_DEFINITIONS: `
|
|
239
|
-
attribute float grl_widths;
|
|
240
|
-
attribute vec3 grl_offsets;
|
|
241
|
-
attribute float grl_colorPointers;
|
|
242
|
-
varying float grlCounters;
|
|
243
|
-
varying float grlColorPointer;
|
|
244
|
-
|
|
245
|
-
#ifdef GREASED_LINE_CAMERA_FACING
|
|
246
|
-
attribute vec4 grl_previousAndSide;
|
|
247
|
-
attribute vec4 grl_nextAndCounters;
|
|
248
|
-
|
|
249
|
-
vec2 grlFix( vec4 i, float aspect ) {
|
|
250
|
-
vec2 res = i.xy / i.w;
|
|
251
|
-
res.x *= aspect;
|
|
252
|
-
return res;
|
|
253
|
-
}
|
|
254
|
-
#else
|
|
255
|
-
attribute vec3 grl_slopes;
|
|
256
|
-
attribute float grl_counters;
|
|
257
|
-
#endif
|
|
258
|
-
`,
|
|
259
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
260
|
-
CUSTOM_VERTEX_UPDATE_POSITION: `
|
|
261
|
-
#ifdef GREASED_LINE_CAMERA_FACING
|
|
262
|
-
vec3 grlPositionOffset = grl_offsets;
|
|
263
|
-
positionUpdated += grlPositionOffset;
|
|
264
|
-
#else
|
|
265
|
-
positionUpdated = (positionUpdated + grl_offsets) + (grl_slopes * grl_widths);
|
|
266
|
-
#endif
|
|
267
|
-
`,
|
|
268
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
269
|
-
CUSTOM_VERTEX_MAIN_END: `
|
|
270
|
-
grlColorPointer = grl_colorPointers;
|
|
271
|
-
|
|
272
|
-
#ifdef GREASED_LINE_CAMERA_FACING
|
|
273
|
-
|
|
274
|
-
float grlAspect = grl_aspect_resolution_lineWidth.x;
|
|
275
|
-
float grlBaseWidth = grl_aspect_resolution_lineWidth.w;
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
vec3 grlPrevious = grl_previousAndSide.xyz;
|
|
279
|
-
float grlSide = grl_previousAndSide.w;
|
|
280
|
-
|
|
281
|
-
vec3 grlNext = grl_nextAndCounters.xyz;
|
|
282
|
-
grlCounters = grl_nextAndCounters.w;
|
|
283
|
-
|
|
284
|
-
mat4 grlMatrix = viewProjection * finalWorld;
|
|
285
|
-
vec4 grlFinalPosition = grlMatrix * vec4( positionUpdated , 1.0 );
|
|
286
|
-
vec4 grlPrevPos = grlMatrix * vec4( grlPrevious + grlPositionOffset, 1.0 );
|
|
287
|
-
vec4 grlNextPos = grlMatrix * vec4( grlNext + grlPositionOffset, 1.0 );
|
|
288
|
-
|
|
289
|
-
vec2 grlCurrentP = grlFix( grlFinalPosition, grlAspect );
|
|
290
|
-
vec2 grlPrevP = grlFix( grlPrevPos, grlAspect );
|
|
291
|
-
vec2 grlNextP = grlFix( grlNextPos, grlAspect );
|
|
292
|
-
|
|
293
|
-
float grlWidth = grlBaseWidth * grl_widths;
|
|
294
|
-
|
|
295
|
-
vec2 grlDir;
|
|
296
|
-
if( grlNextP == grlCurrentP ) grlDir = normalize( grlCurrentP - grlPrevP );
|
|
297
|
-
else if( grlPrevP == grlCurrentP ) grlDir = normalize( grlNextP - grlCurrentP );
|
|
298
|
-
else {
|
|
299
|
-
vec2 grlDir1 = normalize( grlCurrentP - grlPrevP );
|
|
300
|
-
vec2 grlDir2 = normalize( grlNextP - grlCurrentP );
|
|
301
|
-
grlDir = normalize( grlDir1 + grlDir2 );
|
|
302
|
-
}
|
|
303
|
-
vec4 grlNormal = vec4( -grlDir.y, grlDir.x, 0., 1. );
|
|
304
|
-
#ifdef GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM
|
|
305
|
-
grlNormal.xy *= -.5 * grlWidth;
|
|
306
|
-
#else
|
|
307
|
-
grlNormal.xy *= .5 * grlWidth;
|
|
308
|
-
#endif
|
|
309
|
-
|
|
310
|
-
grlNormal *= grl_projection;
|
|
311
|
-
|
|
312
|
-
#ifdef GREASED_LINE_SIZE_ATTENUATION
|
|
313
|
-
grlNormal.xy *= grlFinalPosition.w;
|
|
314
|
-
grlNormal.xy /= ( vec4( grl_aspect_resolution_lineWidth.yz, 0., 1. ) * grl_projection ).xy;
|
|
315
|
-
#endif
|
|
316
|
-
|
|
317
|
-
grlFinalPosition.xy += grlNormal.xy * grlSide;
|
|
318
|
-
gl_Position = grlFinalPosition;
|
|
319
|
-
|
|
320
|
-
vPositionW = vec3(grlFinalPosition);
|
|
321
|
-
#else
|
|
322
|
-
grlCounters = grl_counters;
|
|
323
|
-
#endif
|
|
324
|
-
`,
|
|
325
|
-
};
|
|
326
|
-
this._cameraFacing && (obj["!gl_Position\\=viewProjection\\*worldPos;"] = "//"); // not needed for camera facing GRL
|
|
327
|
-
return obj;
|
|
328
|
-
}
|
|
329
|
-
if (shaderType === "fragment") {
|
|
330
|
-
return {
|
|
331
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
332
|
-
CUSTOM_FRAGMENT_DEFINITIONS: `
|
|
333
|
-
varying float grlCounters;
|
|
334
|
-
varying float grlColorPointer;
|
|
335
|
-
uniform sampler2D grl_colors;
|
|
336
|
-
`,
|
|
337
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
338
|
-
CUSTOM_FRAGMENT_MAIN_END: `
|
|
339
|
-
float grlColorMode = grl_colorMode_visibility_colorsWidth_useColors.x;
|
|
340
|
-
float grlVisibility = grl_colorMode_visibility_colorsWidth_useColors.y;
|
|
341
|
-
float grlColorsWidth = grl_colorMode_visibility_colorsWidth_useColors.z;
|
|
342
|
-
float grlUseColors = grl_colorMode_visibility_colorsWidth_useColors.w;
|
|
343
|
-
|
|
344
|
-
float grlUseDash = grl_dashOptions.x;
|
|
345
|
-
float grlDashArray = grl_dashOptions.y;
|
|
346
|
-
float grlDashOffset = grl_dashOptions.z;
|
|
347
|
-
float grlDashRatio = grl_dashOptions.w;
|
|
348
|
-
|
|
349
|
-
gl_FragColor.a *= step(grlCounters, grlVisibility);
|
|
350
|
-
if( gl_FragColor.a == 0. ) discard;
|
|
351
|
-
|
|
352
|
-
if(grlUseDash == 1.){
|
|
353
|
-
gl_FragColor.a *= ceil(mod(grlCounters + grlDashOffset, grlDashArray) - (grlDashArray * grlDashRatio));
|
|
354
|
-
if (gl_FragColor.a == 0.) discard;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
#ifdef GREASED_LINE_HAS_COLOR
|
|
358
|
-
if (grlColorMode == ${0 /* GreasedLineMeshColorMode.COLOR_MODE_SET */}.) {
|
|
359
|
-
gl_FragColor.rgb = grl_singleColor;
|
|
360
|
-
} else if (grlColorMode == ${1 /* GreasedLineMeshColorMode.COLOR_MODE_ADD */}.) {
|
|
361
|
-
gl_FragColor.rgb += grl_singleColor;
|
|
362
|
-
} else if (grlColorMode == ${2 /* GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY */}.) {
|
|
363
|
-
gl_FragColor.rgb *= grl_singleColor;
|
|
364
|
-
}
|
|
365
|
-
#else
|
|
366
|
-
if (grlUseColors == 1.) {
|
|
367
|
-
#ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE
|
|
368
|
-
vec4 grlColor = texture2D(grl_colors, vec2(grlCounters, 0.), 0.);
|
|
369
|
-
#else
|
|
370
|
-
vec2 lookup = vec2(fract(grlColorPointer / grl_textureSize.x), 1.0 - floor(grlColorPointer / grl_textureSize.x) / max(grl_textureSize.y - 1.0, 1.0));
|
|
371
|
-
vec4 grlColor = texture2D(grl_colors, lookup, 0.0);
|
|
372
|
-
#endif
|
|
373
|
-
if (grlColorMode == ${0 /* GreasedLineMeshColorMode.COLOR_MODE_SET */}.) {
|
|
374
|
-
gl_FragColor = grlColor;
|
|
375
|
-
} else if (grlColorMode == ${1 /* GreasedLineMeshColorMode.COLOR_MODE_ADD */}.) {
|
|
376
|
-
gl_FragColor += grlColor;
|
|
377
|
-
} else if (grlColorMode == ${2 /* GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY */}.) {
|
|
378
|
-
gl_FragColor *= grlColor;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
#endif
|
|
382
|
-
|
|
383
|
-
`,
|
|
384
|
-
};
|
|
250
|
+
getCustomCode(shaderType, shaderLanguage = 0 /* ShaderLanguage.GLSL */) {
|
|
251
|
+
if (this._isGLSL(shaderLanguage)) {
|
|
252
|
+
return getCustomCodeGLSL(shaderType, this._cameraFacing);
|
|
385
253
|
}
|
|
386
|
-
return
|
|
254
|
+
return getCustomCodeWGSL(shaderType, this._cameraFacing);
|
|
387
255
|
}
|
|
388
256
|
/**
|
|
389
257
|
* Disposes the plugin material.
|
|
@@ -605,10 +473,18 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
605
473
|
dest.resolution = this.resolution;
|
|
606
474
|
dest.markAllDefinesAsDirty();
|
|
607
475
|
}
|
|
476
|
+
_isGLSL(shaderLanguage) {
|
|
477
|
+
return shaderLanguage === 0 /* ShaderLanguage.GLSL */ || this._forceGLSL;
|
|
478
|
+
}
|
|
608
479
|
}
|
|
609
480
|
/**
|
|
610
481
|
* Plugin name
|
|
611
482
|
*/
|
|
612
483
|
GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME = "GreasedLinePluginMaterial";
|
|
484
|
+
/**
|
|
485
|
+
* Force all the greased lines to compile to glsl even on WebGPU engines.
|
|
486
|
+
* False by default. This is mostly meant for backward compatibility.
|
|
487
|
+
*/
|
|
488
|
+
GreasedLinePluginMaterial.ForceGLSL = false;
|
|
613
489
|
RegisterClass(`BABYLON.${GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME}`, GreasedLinePluginMaterial);
|
|
614
490
|
//# sourceMappingURL=greasedLinePluginMaterial.js.map
|