@babylonjs/core 6.16.2 → 6.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animatable.d.ts +4 -0
- package/Animations/animatable.js +7 -1
- package/Animations/animatable.js.map +1 -1
- package/Animations/animationGroup.d.ts +16 -0
- package/Animations/animationGroup.js +50 -0
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/animationGroupMask.d.ts +63 -0
- package/Animations/animationGroupMask.js +83 -0
- package/Animations/animationGroupMask.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/Audio/audioEngine.d.ts +1 -1
- package/Audio/audioEngine.js +24 -13
- package/Audio/audioEngine.js.map +1 -1
- package/Bones/skeleton.d.ts +3 -1
- package/Bones/skeleton.js +11 -2
- package/Bones/skeleton.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.js +26 -1
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js +1 -0
- package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
- package/Materials/greasedLinePluginMaterial.d.ts +7 -2
- package/Materials/greasedLinePluginMaterial.js +46 -21
- package/Materials/greasedLinePluginMaterial.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.d.ts +77 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +198 -0
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -0
- package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +4 -0
- package/Meshes/Node/Blocks/Sources/meshBlock.js +6 -0
- package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Teleport/teleportInBlock.js +1 -0
- package/Meshes/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCollectionBlock.d.ts +76 -0
- package/Meshes/Node/Blocks/geometryCollectionBlock.js +163 -0
- package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryInfoBlock.d.ts +43 -0
- package/Meshes/Node/Blocks/geometryInfoBlock.js +100 -0
- package/Meshes/Node/Blocks/geometryInfoBlock.js.map +1 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js +2 -0
- package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
- package/Meshes/Node/Blocks/noiseBlock.d.ts +10 -2
- package/Meshes/Node/Blocks/noiseBlock.js +22 -4
- package/Meshes/Node/Blocks/noiseBlock.js.map +1 -1
- package/Meshes/Node/Enums/nodeGeometryContextualSources.d.ts +5 -1
- package/Meshes/Node/Enums/nodeGeometryContextualSources.js +4 -0
- package/Meshes/Node/Enums/nodeGeometryContextualSources.js.map +1 -1
- package/Meshes/Node/index.d.ts +3 -0
- package/Meshes/Node/index.js +3 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/Node/nodeGeometry.d.ts +7 -0
- package/Meshes/Node/nodeGeometry.js +17 -0
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.d.ts +8 -3
- package/Meshes/Node/nodeGeometryBlock.js +24 -5
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBuildState.js +8 -0
- package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
- package/Meshes/mesh.vertexData.d.ts +13 -0
- package/Meshes/mesh.vertexData.js +14 -0
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/transformNode.js +7 -3
- package/Meshes/transformNode.js.map +1 -1
- package/Particles/IGPUParticleSystemPlatform.d.ts +2 -2
- package/Particles/IGPUParticleSystemPlatform.js.map +1 -1
- package/Particles/computeShaderParticleSystem.d.ts +2 -2
- package/Particles/computeShaderParticleSystem.js +2 -2
- package/Particles/computeShaderParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +2 -0
- package/Particles/gpuParticleSystem.js +16 -3
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.d.ts +2 -0
- package/Particles/particleSystem.js +40 -7
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/webgl2ParticleSystem.d.ts +4 -2
- package/Particles/webgl2ParticleSystem.js +8 -2
- package/Particles/webgl2ParticleSystem.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +18 -1
- package/Physics/v2/physicsBody.js +26 -1
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Shaders/gpuRenderParticles.vertex.js +5 -5
- package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
- package/Shaders/particles.vertex.js +5 -5
- package/Shaders/particles.vertex.js.map +1 -1
- package/package.json +1 -1
|
@@ -55,6 +55,7 @@ export class NodeMaterialTeleportInBlock extends NodeMaterialBlock {
|
|
|
55
55
|
endpoint._entryPoint = this;
|
|
56
56
|
endpoint._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
57
57
|
endpoint._tempEntryPointUniqueId = null;
|
|
58
|
+
endpoint.name = "> " + this.name;
|
|
58
59
|
}
|
|
59
60
|
/**
|
|
60
61
|
* Remove enpoint from this block
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teleportInBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/Teleport/teleportInBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,iBAAiB;IAG9D,0CAA0C;IAC1C,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AAC;CACJ;AAED,aAAa,CAAC,qCAAqC,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets\";\r\nimport { NodeMaterialBlock } from \"../../nodeMaterialBlock\";\r\nimport type { NodeMaterialConnectionPoint } from \"../../nodeMaterialBlockConnectionPoint\";\r\nimport type { NodeMaterialTeleportOutBlock } from \"./teleportOutBlock\";\r\n\r\n/**\r\n * Defines a block used to teleport a value to an endpoint\r\n */\r\nexport class NodeMaterialTeleportInBlock extends NodeMaterialBlock {\r\n private _endpoints: NodeMaterialTeleportOutBlock[] = [];\r\n\r\n /** Gets the list of attached endpoints */\r\n public get endpoints() {\r\n return this._endpoints;\r\n }\r\n\r\n /**\r\n * Create a new NodeMaterialTeleportInBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Neutral);\r\n\r\n this.registerInput(\"input\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"NodeMaterialTeleportInBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /** Gets a boolean indicating that this connection will be used in the fragment shader */\r\n public isConnectedInFragmentShader() {\r\n return this.endpoints.some((e) => e.output.isConnectedInFragmentShader);\r\n }\r\n\r\n public _dumpCode(uniqueNames: string[], alreadyDumped: NodeMaterialBlock[]) {\r\n let codeString = super._dumpCode(uniqueNames, alreadyDumped);\r\n\r\n for (const endpoint of this.endpoints) {\r\n if (alreadyDumped.indexOf(endpoint) === -1) {\r\n codeString += endpoint._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Add an enpoint to this block\r\n * @param endpoint define the endpoint to attach to\r\n */\r\n public attachToEndpoint(endpoint: NodeMaterialTeleportOutBlock) {\r\n endpoint.detach();\r\n\r\n this._endpoints.push(endpoint);\r\n endpoint._entryPoint = this;\r\n endpoint._outputs[0]._typeConnectionSource = this._inputs[0];\r\n endpoint._tempEntryPointUniqueId = null;\r\n endpoint.name = \"> \" + this.name;\r\n }\r\n\r\n /**\r\n * Remove enpoint from this block\r\n * @param endpoint define the endpoint to remove\r\n */\r\n public detachFromEndpoint(endpoint: NodeMaterialTeleportOutBlock) {\r\n const index = this._endpoints.indexOf(endpoint);\r\n\r\n if (index !== -1) {\r\n this._endpoints.splice(index, 1);\r\n endpoint._outputs[0]._typeConnectionSource = null;\r\n endpoint._entryPoint = null;\r\n }\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public dispose() {\r\n super.dispose();\r\n\r\n for (const endpoint of this._endpoints) {\r\n this.detachFromEndpoint(endpoint);\r\n }\r\n\r\n this._endpoints = [];\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeMaterialTeleportInBlock\", NodeMaterialTeleportInBlock);\r\n"]}
|
|
@@ -259,7 +259,6 @@ export declare class MaterialGreasedLineDefines extends MaterialDefines {
|
|
|
259
259
|
* GreasedLinePluginMaterial for GreasedLineMesh
|
|
260
260
|
*/
|
|
261
261
|
export declare class GreasedLinePluginMaterial extends MaterialPluginBase implements IGreasedLineMaterial {
|
|
262
|
-
private _scene;
|
|
263
262
|
/**
|
|
264
263
|
* Plugin name
|
|
265
264
|
*/
|
|
@@ -312,6 +311,7 @@ export declare class GreasedLinePluginMaterial extends MaterialPluginBase implem
|
|
|
312
311
|
* @see GreasedLineMeshColorMode
|
|
313
312
|
*/
|
|
314
313
|
colorMode: GreasedLineMeshColorMode;
|
|
314
|
+
private _scene;
|
|
315
315
|
private _dashCount;
|
|
316
316
|
private _dashArray;
|
|
317
317
|
private _color;
|
|
@@ -322,7 +322,7 @@ export declare class GreasedLinePluginMaterial extends MaterialPluginBase implem
|
|
|
322
322
|
private _sizeAttenuation;
|
|
323
323
|
private _colorsTexture?;
|
|
324
324
|
private _engine;
|
|
325
|
-
constructor(material: Material,
|
|
325
|
+
constructor(material: Material, scene?: Scene, options?: GreasedLineMaterialOptions);
|
|
326
326
|
/**
|
|
327
327
|
* Get the shader attributes
|
|
328
328
|
* @param attributes array which will be filled with the attributes
|
|
@@ -482,6 +482,11 @@ export declare class GreasedLinePluginMaterial extends MaterialPluginBase implem
|
|
|
482
482
|
* @param rootUrl root url for textures
|
|
483
483
|
*/
|
|
484
484
|
parse(source: any, scene: Scene, rootUrl: string): void;
|
|
485
|
+
/**
|
|
486
|
+
* Makes a duplicate of the current configuration into another one.
|
|
487
|
+
* @param plugin define the config where to copy the info
|
|
488
|
+
*/
|
|
489
|
+
copyTo(plugin: MaterialPluginBase): void;
|
|
485
490
|
/**
|
|
486
491
|
* A minimum size texture for the colors sampler2D when there is no colors texture defined yet.
|
|
487
492
|
* For fast switching using the useColors property without the need to use defines.
|
|
@@ -91,8 +91,8 @@ export class MaterialGreasedLineDefines extends MaterialDefines {
|
|
|
91
91
|
* GreasedLinePluginMaterial for GreasedLineMesh
|
|
92
92
|
*/
|
|
93
93
|
export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
94
|
-
constructor(material,
|
|
95
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q
|
|
94
|
+
constructor(material, scene, options) {
|
|
95
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
96
96
|
options = options || {
|
|
97
97
|
color: GreasedLinePluginMaterial.DEFAULT_COLOR,
|
|
98
98
|
};
|
|
@@ -100,31 +100,30 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
100
100
|
defines.GREASED_LINE_HAS_COLOR = !!options.color;
|
|
101
101
|
defines.GREASED_LINE_SIZE_ATTENUATION = (_a = options.sizeAttenuation) !== null && _a !== void 0 ? _a : false;
|
|
102
102
|
defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = options.colorDistributionType === GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE;
|
|
103
|
-
defines.GREASED_LNE_RIGHT_HANDED_COORDINATE_SYSTEM =
|
|
103
|
+
defines.GREASED_LNE_RIGHT_HANDED_COORDINATE_SYSTEM = (scene !== null && scene !== void 0 ? scene : material.getScene()).useRightHandedSystem;
|
|
104
104
|
super(material, GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME, 200, defines);
|
|
105
|
-
this._scene =
|
|
106
|
-
this._scene = (_b = this._scene) !== null && _b !== void 0 ? _b : material.getScene();
|
|
105
|
+
this._scene = scene !== null && scene !== void 0 ? scene : material.getScene();
|
|
107
106
|
this._engine = this._scene.getEngine();
|
|
108
|
-
this.visibility = (
|
|
109
|
-
this.useDash = (
|
|
110
|
-
this.dashRatio = (
|
|
111
|
-
this.dashOffset = (
|
|
107
|
+
this.visibility = (_b = options.visibility) !== null && _b !== void 0 ? _b : 1;
|
|
108
|
+
this.useDash = (_c = options.useDash) !== null && _c !== void 0 ? _c : false;
|
|
109
|
+
this.dashRatio = (_d = options.dashRatio) !== null && _d !== void 0 ? _d : 0.5;
|
|
110
|
+
this.dashOffset = (_e = options.dashOffset) !== null && _e !== void 0 ? _e : 0;
|
|
112
111
|
this.width = options.width ? options.width : options.sizeAttenuation ? GreasedLinePluginMaterial.DEFAULT_WIDTH_ATTENUATED : GreasedLinePluginMaterial.DEFAULT_WIDTH;
|
|
113
|
-
this._sizeAttenuation = (
|
|
114
|
-
this.colorMode = (
|
|
115
|
-
this._color = (
|
|
116
|
-
this.useColors = (
|
|
117
|
-
this._colorsDistributionType = (
|
|
118
|
-
this.colorsSampling = (
|
|
119
|
-
this._colors = (
|
|
120
|
-
this.dashCount = (
|
|
121
|
-
this.resolution = (
|
|
112
|
+
this._sizeAttenuation = (_f = options.sizeAttenuation) !== null && _f !== void 0 ? _f : false;
|
|
113
|
+
this.colorMode = (_g = options.colorMode) !== null && _g !== void 0 ? _g : GreasedLineMeshColorMode.COLOR_MODE_SET;
|
|
114
|
+
this._color = (_h = options.color) !== null && _h !== void 0 ? _h : null;
|
|
115
|
+
this.useColors = (_j = options.useColors) !== null && _j !== void 0 ? _j : false;
|
|
116
|
+
this._colorsDistributionType = (_k = options.colorDistributionType) !== null && _k !== void 0 ? _k : GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;
|
|
117
|
+
this.colorsSampling = (_l = options.colorsSampling) !== null && _l !== void 0 ? _l : RawTexture.NEAREST_NEAREST;
|
|
118
|
+
this._colors = (_m = options.colors) !== null && _m !== void 0 ? _m : null;
|
|
119
|
+
this.dashCount = (_o = options.dashCount) !== null && _o !== void 0 ? _o : 1; // calculate the _dashArray value, call the setter
|
|
120
|
+
this.resolution = (_p = options.resolution) !== null && _p !== void 0 ? _p : new Vector2(this._engine.getRenderWidth(), this._engine.getRenderHeight()); // calculate aspect call the setter
|
|
122
121
|
if (this._colors) {
|
|
123
122
|
this._createColorsTexture(`${material.name}-colors-texture`, this._colors);
|
|
124
123
|
}
|
|
125
124
|
else {
|
|
126
|
-
this._color = (
|
|
127
|
-
GreasedLinePluginMaterial._PrepareEmptyColorsTexture(_scene);
|
|
125
|
+
this._color = (_q = this._color) !== null && _q !== void 0 ? _q : GreasedLinePluginMaterial.DEFAULT_COLOR;
|
|
126
|
+
GreasedLinePluginMaterial._PrepareEmptyColorsTexture(this._scene);
|
|
128
127
|
}
|
|
129
128
|
this._engine.onDisposeObservable.add(() => {
|
|
130
129
|
var _a;
|
|
@@ -509,7 +508,7 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
509
508
|
* Gets the color of the line
|
|
510
509
|
*/
|
|
511
510
|
get color() {
|
|
512
|
-
return this.
|
|
511
|
+
return this._color;
|
|
513
512
|
}
|
|
514
513
|
/**
|
|
515
514
|
* Sets the color of the line
|
|
@@ -617,6 +616,32 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
617
616
|
greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);
|
|
618
617
|
this.markAllDefinesAsDirty();
|
|
619
618
|
}
|
|
619
|
+
/**
|
|
620
|
+
* Makes a duplicate of the current configuration into another one.
|
|
621
|
+
* @param plugin define the config where to copy the info
|
|
622
|
+
*/
|
|
623
|
+
copyTo(plugin) {
|
|
624
|
+
var _a;
|
|
625
|
+
const dest = plugin;
|
|
626
|
+
(_a = dest._colorsTexture) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
627
|
+
if (this._colors) {
|
|
628
|
+
dest._createColorsTexture(`${dest._material.name}-colors-texture`, this._colors);
|
|
629
|
+
}
|
|
630
|
+
dest.setColor(this.color, true);
|
|
631
|
+
dest.colorsDistributionType = this.colorsDistributionType;
|
|
632
|
+
dest.colorsSampling = this.colorsSampling;
|
|
633
|
+
dest.colorMode = this.colorMode;
|
|
634
|
+
dest.useColors = this.useColors;
|
|
635
|
+
dest.visibility = this.visibility;
|
|
636
|
+
dest.useDash = this.useDash;
|
|
637
|
+
dest.dashCount = this.dashCount;
|
|
638
|
+
dest.dashRatio = this.dashRatio;
|
|
639
|
+
dest.dashOffset = this.dashOffset;
|
|
640
|
+
dest.width = this.width;
|
|
641
|
+
dest.sizeAttenuation = this.sizeAttenuation;
|
|
642
|
+
dest.resolution = this.resolution;
|
|
643
|
+
dest.markAllDefinesAsDirty();
|
|
644
|
+
}
|
|
620
645
|
/**
|
|
621
646
|
* A minimum size texture for the colors sampler2D when there is no colors texture defined yet.
|
|
622
647
|
* For fast switching using the useColors property without the need to use defines.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLinePluginMaterial.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/greasedLinePluginMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,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B,CAAC,UAAU,CAAC,CAAC;QAEnG,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,0BAA0B,CAAC,KAAY;QAClD,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC3B,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;YACtC,yBAAyB,CAAC,mBAAmB,GAAG,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,kBAAkB,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;YAC9J,yBAAyB,CAAC,mBAAmB,CAAC,IAAI,GAAG,uBAAuB,CAAC;SAChF;IACL,CAAC;;AAnpBD;;GAEG;AACoB,oDAA0B,GAAG,2BAA2B,CAAC;AAEhF;;GAEG;AACW,uCAAa,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;AAC7C;;GAEG;AACW,kDAAwB,GAAG,CAAC,CAAC;AAC3C;;GAEG;AACW,uCAAa,GAAG,GAAG,CAAC;AAsoBtC,aAAa,CAAC,WAAW,yBAAyB,CAAC,0BAA0B,EAAE,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { Engine } from \"../Engines/engine\";\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 { 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\n\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 * 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 *\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 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 not supporting lightning nor textures\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 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 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\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_LNE_RIGHT_HANDED_COORDINATE_SYSTEM = false;\r\n}\r\n\r\n/**\r\n * GreasedLinePluginMaterial for GreasedLineMesh\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 * Default line color for newly created lines\r\n */\r\n public static DEFAULT_COLOR = Color3.White();\r\n /**\r\n * Default line width when sizeAttenuation is true\r\n */\r\n public static DEFAULT_WIDTH_ATTENUATED = 1;\r\n /**\r\n * Defaule line width\r\n */\r\n public static DEFAULT_WIDTH = 0.1;\r\n\r\n private static _EmptyColorsTexture: Nullable<BaseTexture>;\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 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 _colorsTexture?: RawTexture;\r\n\r\n private _engine: Engine;\r\n\r\n constructor(material: Material, private _scene: Scene, options?: GreasedLineMaterialOptions) {\r\n options = options || {\r\n color: GreasedLinePluginMaterial.DEFAULT_COLOR,\r\n };\r\n\r\n const defines = new MaterialGreasedLineDefines();\r\n defines.GREASED_LINE_HAS_COLOR = !!options.color;\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_LNE_RIGHT_HANDED_COORDINATE_SYSTEM = _scene.useRightHandedSystem;\r\n super(material, GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME, 200, defines);\r\n\r\n this._scene = this._scene ?? material.getScene();\r\n this._engine = this._scene.getEngine();\r\n\r\n this.visibility = options.visibility ?? 1;\r\n this.useDash = options.useDash ?? false;\r\n this.dashRatio = options.dashRatio ?? 0.5;\r\n this.dashOffset = options.dashOffset ?? 0;\r\n this.width = options.width ? options.width : options.sizeAttenuation ? GreasedLinePluginMaterial.DEFAULT_WIDTH_ATTENUATED : GreasedLinePluginMaterial.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 (this._colors) {\r\n this._createColorsTexture(`${material.name}-colors-texture`, this._colors);\r\n } else {\r\n this._color = this._color ?? GreasedLinePluginMaterial.DEFAULT_COLOR;\r\n GreasedLinePluginMaterial._PrepareEmptyColorsTexture(_scene);\r\n }\r\n\r\n this._engine.onDisposeObservable.add(() => {\r\n GreasedLinePluginMaterial._EmptyColorsTexture?.dispose();\r\n GreasedLinePluginMaterial._EmptyColorsTexture = null;\r\n });\r\n\r\n this._enable(true); // always enabled\r\n }\r\n\r\n /**\r\n * Get the shader attributes\r\n * @param attributes array which will be filled with the attributes\r\n */\r\n getAttributes(attributes: string[]) {\r\n attributes.push(\"grl_offsets\");\r\n attributes.push(\"grl_previousAndSide\");\r\n attributes.push(\"grl_nextAndCounters\");\r\n attributes.push(\"grl_widths\");\r\n attributes.push(\"grl_colorPointers\");\r\n }\r\n\r\n /**\r\n * Get the shader samplers\r\n * @param samplers\r\n */\r\n 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\r\n */\r\n public getActiveTextures(activeTextures: BaseTexture[]): void {\r\n if (this._colorsTexture) {\r\n activeTextures.push(this._colorsTexture);\r\n }\r\n }\r\n\r\n /**\r\n * Get the shader uniforms\r\n * @returns uniforms\r\n */\r\n getUniforms() {\r\n const ubo = [\r\n { name: \"grl_projection\", size: 16, type: \"mat4\" },\r\n { name: \"grl_singleColor\", size: 3, type: \"vec3\" },\r\n { name: \"grl_aspect_resolution_lineWidth\", size: 4, type: \"vec4\" },\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\r\n return {\r\n ubo,\r\n vertex: `\r\n uniform vec4 grl_aspect_resolution_lineWidth;\r\n uniform mat4 grl_projection;\r\n `,\r\n fragment: `\r\n uniform vec4 grl_dashOptions;\r\n uniform vec4 grl_colorMode_visibility_colorsWidth_useColors;\r\n uniform vec3 grl_singleColor;\r\n `,\r\n };\r\n }\r\n\r\n // only getter, it doesn't make sense to use this plugin on a mesh other than GreasedLineMesh\r\n // and it doesn't make sense to disable it on the mesh\r\n get isEnabled() {\r\n return true;\r\n }\r\n\r\n /**\r\n * Bind the uniform buffer\r\n * @param uniformBuffer\r\n */\r\n bindForSubMesh(uniformBuffer: UniformBuffer) {\r\n const activeCamera = this._scene.activeCamera;\r\n\r\n if (activeCamera) {\r\n const projection = activeCamera.getProjectionMatrix();\r\n uniformBuffer.updateMatrix(\"grl_projection\", projection);\r\n } else {\r\n throw Error(\"GreasedLinePluginMaterial requires an active camera.\");\r\n }\r\n\r\n const resolutionLineWidth = TmpVectors.Vector4[0];\r\n resolutionLineWidth.x = this._aspect;\r\n resolutionLineWidth.y = this._resolution.x;\r\n resolutionLineWidth.z = this._resolution.y;\r\n resolutionLineWidth.w = this.width;\r\n uniformBuffer.updateVector4(\"grl_aspect_resolution_lineWidth\", resolutionLineWidth);\r\n\r\n const dashOptions = TmpVectors.Vector4[0];\r\n dashOptions.x = GreasedLinePluginMaterial._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 = GreasedLinePluginMaterial._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\r\n uniformBuffer.setTexture(\"grl_colors\", this._colorsTexture ?? GreasedLinePluginMaterial._EmptyColorsTexture);\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 prepareDefines(defines: MaterialGreasedLineDefines, _scene: Scene, _mesh: AbstractMesh) {\r\n defines.GREASED_LINE_HAS_COLOR = !!this._color;\r\n defines.GREASED_LINE_SIZE_ATTENUATION = this._sizeAttenuation ?? false;\r\n defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = this._colorsDistributionType === GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE;\r\n defines.GREASED_LNE_RIGHT_HANDED_COORDINATE_SYSTEM = _scene.useRightHandedSystem;\r\n }\r\n\r\n /**\r\n * Get the class name\r\n * @returns class name\r\n */\r\n getClassName() {\r\n return GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME;\r\n }\r\n\r\n /**\r\n * Get shader code\r\n * @param shaderType vertex/fragment\r\n * @returns shader code\r\n */\r\n getCustomCode(shaderType: string): Nullable<{ [pointName: string]: string }> {\r\n if (shaderType === \"vertex\") {\r\n return {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_DEFINITIONS: `\r\n attribute vec4 grl_previousAndSide;\r\n attribute vec4 grl_nextAndCounters;\r\n attribute float grl_widths;\r\n attribute vec3 grl_offsets;\r\n attribute float grl_colorPointers;\r\n\r\n varying float grlCounters;\r\n varying float grlColorPointer;\r\n\r\n vec2 grlFix( vec4 i, float aspect ) {\r\n vec2 res = i.xy / i.w;\r\n res.x *= aspect;\r\n return res;\r\n }\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_UPDATE_POSITION: `\r\n vec3 grlPositionOffset = grl_offsets;\r\n positionUpdated += grlPositionOffset;\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_MAIN_END: `\r\n\r\n float grlAspect = grl_aspect_resolution_lineWidth.x;\r\n float grlBaseWidth = grl_aspect_resolution_lineWidth.w;\r\n\r\n grlColorPointer = grl_colorPointers;\r\n\r\n vec3 grlPrevious = grl_previousAndSide.xyz;\r\n float grlSide = grl_previousAndSide.w;\r\n\r\n vec3 grlNext = grl_nextAndCounters.xyz;\r\n grlCounters = grl_nextAndCounters.w;\r\n\r\n\r\n mat4 grlMatrix = viewProjection * world;\r\n vec4 grlFinalPosition = grlMatrix * vec4( positionUpdated , 1.0 );\r\n vec4 grlPrevPos = grlMatrix * vec4( grlPrevious + grlPositionOffset, 1.0 );\r\n vec4 grlNextPos = grlMatrix * vec4( grlNext + grlPositionOffset, 1.0 );\r\n\r\n vec2 grlCurrentP = grlFix( grlFinalPosition, grlAspect );\r\n vec2 grlPrevP = grlFix( grlPrevPos, grlAspect );\r\n vec2 grlNextP = grlFix( grlNextPos, grlAspect );\r\n\r\n float grlWidth = grlBaseWidth * grl_widths;\r\n\r\n vec2 grlDir;\r\n if( grlNextP == grlCurrentP ) grlDir = normalize( grlCurrentP - grlPrevP );\r\n else if( grlPrevP == grlCurrentP ) grlDir = normalize( grlNextP - grlCurrentP );\r\n else {\r\n vec2 grlDir1 = normalize( grlCurrentP - grlPrevP );\r\n vec2 grlDir2 = normalize( grlNextP - grlCurrentP );\r\n grlDir = normalize( grlDir1 + grlDir2 );\r\n }\r\n vec4 grlNormal = vec4( -grlDir.y, grlDir.x, 0., 1. );\r\n #ifdef GREASED_LNE_RIGHT_HANDED_COORDINATE_SYSTEM\r\n grlNormal.xy *= -.5 * grlWidth;\r\n #else\r\n grlNormal.xy *= .5 * grlWidth;\r\n #endif\r\n grlNormal *= grl_projection;\r\n #ifdef GREASED_LINE_SIZE_ATTENUATION\r\n grlNormal.xy *= grlFinalPosition.w;\r\n grlNormal.xy /= ( vec4( grl_aspect_resolution_lineWidth.yz, 0., 1. ) * grl_projection ).xy;\r\n #endif\r\n grlFinalPosition.xy += grlNormal.xy * grlSide;\r\n gl_Position = grlFinalPosition;\r\n\r\n vPositionW = vec3(grlFinalPosition);\r\n\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n \"!gl_Position\\\\=viewProjection\\\\*worldPos;\": \"//\", // remove\r\n };\r\n }\r\n\r\n if (shaderType === \"fragment\") {\r\n return {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_DEFINITIONS: `\r\n varying float grlCounters;\r\n varying float grlColorPointer;\r\n uniform sampler2D grl_colors;\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_MAIN_END: `\r\n float grlColorMode = grl_colorMode_visibility_colorsWidth_useColors.x;\r\n float grlVisibility = grl_colorMode_visibility_colorsWidth_useColors.y;\r\n float grlColorsWidth = grl_colorMode_visibility_colorsWidth_useColors.z;\r\n float grlUseColors = grl_colorMode_visibility_colorsWidth_useColors.w;\r\n\r\n float grlUseDash = grl_dashOptions.x;\r\n float grlDashArray = grl_dashOptions.y;\r\n float grlDashOffset = grl_dashOptions.z;\r\n float grlDashRatio = grl_dashOptions.w;\r\n\r\n gl_FragColor.a *= step(grlCounters, grlVisibility);\r\n if( gl_FragColor.a == 0. ) discard;\r\n\r\n if(grlUseDash == 1.){\r\n gl_FragColor.a *= ceil(mod(grlCounters + grlDashOffset, grlDashArray) - (grlDashArray * grlDashRatio));\r\n if (gl_FragColor.a == 0.) discard;\r\n }\r\n\r\n #ifdef GREASED_LINE_HAS_COLOR\r\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\r\n gl_FragColor.rgb = grl_singleColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\r\n gl_FragColor.rgb += grl_singleColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\r\n gl_FragColor.rgb *= grl_singleColor;\r\n }\r\n #else\r\n if (grlUseColors == 1.) {\r\n #ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\r\n vec4 grlColor = texture2D(grl_colors, vec2(grlCounters, 0.), 0.);\r\n #else\r\n vec4 grlColor = texture2D(grl_colors, vec2(grlColorPointer/grlColorsWidth, 0.), 0.);\r\n #endif\r\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\r\n gl_FragColor = grlColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\r\n gl_FragColor += grlColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\r\n gl_FragColor *= grlColor;\r\n }\r\n }\r\n #endif\r\n `,\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Converts boolean to number.\r\n * @param bool\r\n * @returns 1 if true, 0 if false.\r\n */\r\n private static _BooleanToNumber(bool?: boolean) {\r\n return bool ? 1 : 0;\r\n }\r\n\r\n /**\r\n * Converts an array of Color3 to Uint8Array\r\n * @param colors Arrray of Color3\r\n * @returns Uin8Array of colors [r, g, b, a, r, g, b, a, ...]\r\n */\r\n private static _Color3toRGBAUint8(colors: Color3[]) {\r\n const colorTable: Uint8Array = new Uint8Array(colors.length * 4);\r\n for (let i = 0, j = 0; i < colors.length; i++) {\r\n colorTable[j++] = colors[i].r * 255;\r\n colorTable[j++] = colors[i].g * 255;\r\n colorTable[j++] = colors[i].b * 255;\r\n colorTable[j++] = 255;\r\n }\r\n\r\n return colorTable;\r\n }\r\n\r\n /**\r\n * Creates a RawTexture from an RGBA color array and sets it on the plugin material instance.\r\n * @param name name of the texture\r\n * @param colors Uint8Array of colors\r\n */\r\n private _createColorsTexture(name: string, colors: Color3[]) {\r\n const colorsArray = GreasedLinePluginMaterial._Color3toRGBAUint8(colors);\r\n this._colorsTexture = new RawTexture(colorsArray, colors.length, 1, Engine.TEXTUREFORMAT_RGBA, this._scene, false, true, this.colorsSampling);\r\n this._colorsTexture.name = name;\r\n }\r\n\r\n /**\r\n * Disposes the plugin material.\r\n */\r\n public 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 * @returns\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 = GreasedLinePluginMaterial._Color3toRGBAUint8(colors);\r\n this._colorsTexture.update(colorArray);\r\n } else {\r\n this._colorsTexture?.dispose();\r\n this._createColorsTexture(`${this._material.name}-colors-texture`, colors);\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 * False means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n get sizeAttenuation() {\r\n return this._sizeAttenuation;\r\n }\r\n\r\n /**\r\n * Turn on/off attenuation of the width option and widths array.\r\n * @param value false means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n set sizeAttenuation(value: boolean) {\r\n this._sizeAttenuation = value;\r\n this.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 */\r\n public setColor(value: Nullable<Color3>, doNotMarkDirty = false) {\r\n if ((this._color === null && value !== null) || (this._color !== null && value === null)) {\r\n this._color = value;\r\n !doNotMarkDirty && this.markAllDefinesAsDirty();\r\n } else {\r\n this._color = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the color distributiopn type\r\n */\r\n get colorsDistributionType() {\r\n return this._colorsDistributionType;\r\n }\r\n\r\n /**\r\n * Sets the color distribution type\r\n * @see GreasedLineMeshColorDistributionType\r\n * @param value color distribution type\r\n */\r\n set colorsDistributionType(value: GreasedLineMeshColorDistributionType) {\r\n this._colorsDistributionType = value;\r\n this.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the resolution\r\n */\r\n get resolution() {\r\n return this._resolution;\r\n }\r\n\r\n /**\r\n * Sets the resolution\r\n * @param value resolution of the screen for GreasedLine\r\n */\r\n set resolution(value: Vector2) {\r\n this._aspect = value.x / value.y;\r\n this._resolution = value;\r\n }\r\n\r\n /**\r\n * Serializes this plugin material\r\n * @returns serializationObjec\r\n */\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n const greasedLineMaterialOptions: GreasedLineMaterialOptions = {\r\n colorDistributionType: this._colorsDistributionType,\r\n colorsSampling: this.colorsSampling,\r\n colorMode: this.colorMode,\r\n dashCount: this._dashCount,\r\n dashOffset: this.dashOffset,\r\n dashRatio: this.dashRatio,\r\n resolution: this._resolution,\r\n sizeAttenuation: this._sizeAttenuation,\r\n useColors: this.useColors,\r\n useDash: this.useDash,\r\n visibility: this.visibility,\r\n width: this.width,\r\n };\r\n\r\n this._colors && (greasedLineMaterialOptions.colors = this._colors);\r\n this._color && (greasedLineMaterialOptions.color = this._color);\r\n\r\n serializationObject.greasedLineMaterialOptions = greasedLineMaterialOptions;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized objects\r\n * @param source serialized object\r\n * @param scene scene\r\n * @param rootUrl root url for textures\r\n */\r\n public 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.colors) {\r\n this._createColorsTexture(`${this._material.name}-colors-texture`, greasedLineMaterialOptions.colors);\r\n } else {\r\n GreasedLinePluginMaterial._PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n greasedLineMaterialOptions.color && this.setColor(greasedLineMaterialOptions.color, true);\r\n greasedLineMaterialOptions.colorDistributionType && (this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType);\r\n greasedLineMaterialOptions.colorsSampling && (this.colorsSampling = greasedLineMaterialOptions.colorsSampling);\r\n greasedLineMaterialOptions.colorMode && (this.colorMode = greasedLineMaterialOptions.colorMode);\r\n greasedLineMaterialOptions.useColors && (this.useColors = greasedLineMaterialOptions.useColors);\r\n greasedLineMaterialOptions.visibility && (this.visibility = greasedLineMaterialOptions.visibility);\r\n greasedLineMaterialOptions.useDash && (this.useDash = greasedLineMaterialOptions.useDash);\r\n greasedLineMaterialOptions.dashCount && (this.dashCount = greasedLineMaterialOptions.dashCount);\r\n greasedLineMaterialOptions.dashRatio && (this.dashRatio = greasedLineMaterialOptions.dashRatio);\r\n greasedLineMaterialOptions.dashOffset && (this.dashOffset = greasedLineMaterialOptions.dashOffset);\r\n greasedLineMaterialOptions.width && (this.width = greasedLineMaterialOptions.width);\r\n greasedLineMaterialOptions.sizeAttenuation && (this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation);\r\n greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);\r\n\r\n this.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * A minimum size texture for the colors sampler2D when there is no colors texture defined yet.\r\n * For fast switching using the useColors property without the need to use defines.\r\n * @param scene Scene\r\n */\r\n private static _PrepareEmptyColorsTexture(scene: Scene) {\r\n if (!this._EmptyColorsTexture) {\r\n const colorsArray = new Uint8Array(4);\r\n GreasedLinePluginMaterial._EmptyColorsTexture = new RawTexture(colorsArray, 1, 1, Engine.TEXTUREFORMAT_RGBA, scene, false, false, RawTexture.NEAREST_NEAREST);\r\n GreasedLinePluginMaterial._EmptyColorsTexture.name = \"grlEmptyColorsTexture\";\r\n }\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/greasedLinePluginMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA0GlD;;;GAGG;AACH,MAAM,CAAN,IAAY,2BAaX;AAbD,WAAY,2BAA2B;IACnC;;OAEG;IACH,iHAA0B,CAAA;IAC1B;;OAEG;IACH,uGAAqB,CAAA;IACrB;;OAEG;IACH,6GAAwB,CAAA;AAC5B,CAAC,EAbW,2BAA2B,KAA3B,2BAA2B,QAatC;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,wBAaX;AAbD,WAAY,wBAAwB;IAChC;;OAEG;IACH,2FAAkB,CAAA;IAClB;;OAEG;IACH,2FAAkB,CAAA;IAClB;;OAEG;IACH,qGAAuB,CAAA;AAC3B,CAAC,EAbW,wBAAwB,KAAxB,wBAAwB,QAanC;AAED;;;;GAIG;A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AAI,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;IAED;;;;OAIG;IACK,MAAM,CAAC,0BAA0B,CAAC,KAAY;QAClD,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC3B,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;YACtC,yBAAyB,CAAC,mBAAmB,GAAG,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,kBAAkB,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;YAC9J,yBAAyB,CAAC,mBAAmB,CAAC,IAAI,GAAG,uBAAuB,CAAC;SAChF;IACL,CAAC;;AAlrBD;;GAEG;AACoB,oDAA0B,GAAG,2BAA2B,CAAC;AAEhF;;GAEG;AACW,uCAAa,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;AAC7C;;GAEG;AACW,kDAAwB,GAAG,CAAC,CAAC;AAC3C;;GAEG;AACW,uCAAa,GAAG,GAAG,CAAC;AAqqBtC,aAAa,CAAC,WAAW,yBAAyB,CAAC,0BAA0B,EAAE,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { Engine } from \"../Engines/engine\";\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 { 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\n\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 * 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 *\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 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 not supporting lightning nor textures\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 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 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\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_LNE_RIGHT_HANDED_COORDINATE_SYSTEM = false;\r\n}\r\n\r\n/**\r\n * GreasedLinePluginMaterial for GreasedLineMesh\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 * Default line color for newly created lines\r\n */\r\n public static DEFAULT_COLOR = Color3.White();\r\n /**\r\n * Default line width when sizeAttenuation is true\r\n */\r\n public static DEFAULT_WIDTH_ATTENUATED = 1;\r\n /**\r\n * Defaule line width\r\n */\r\n public static DEFAULT_WIDTH = 0.1;\r\n\r\n private static _EmptyColorsTexture: Nullable<BaseTexture>;\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 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 _colorsTexture?: RawTexture;\r\n\r\n private _engine: Engine;\r\n\r\n constructor(material: Material, scene?: Scene, options?: GreasedLineMaterialOptions) {\r\n options = options || {\r\n color: GreasedLinePluginMaterial.DEFAULT_COLOR,\r\n };\r\n\r\n const defines = new MaterialGreasedLineDefines();\r\n defines.GREASED_LINE_HAS_COLOR = !!options.color;\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_LNE_RIGHT_HANDED_COORDINATE_SYSTEM = (scene ?? material.getScene()).useRightHandedSystem;\r\n super(material, GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME, 200, defines);\r\n\r\n this._scene = scene ?? material.getScene();\r\n this._engine = this._scene.getEngine();\r\n\r\n this.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 ? GreasedLinePluginMaterial.DEFAULT_WIDTH_ATTENUATED : GreasedLinePluginMaterial.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 (this._colors) {\r\n this._createColorsTexture(`${material.name}-colors-texture`, this._colors);\r\n } else {\r\n this._color = this._color ?? GreasedLinePluginMaterial.DEFAULT_COLOR;\r\n GreasedLinePluginMaterial._PrepareEmptyColorsTexture(this._scene);\r\n }\r\n\r\n this._engine.onDisposeObservable.add(() => {\r\n GreasedLinePluginMaterial._EmptyColorsTexture?.dispose();\r\n GreasedLinePluginMaterial._EmptyColorsTexture = null;\r\n });\r\n\r\n this._enable(true); // always enabled\r\n }\r\n\r\n /**\r\n * Get the shader attributes\r\n * @param attributes array which will be filled with the attributes\r\n */\r\n getAttributes(attributes: string[]) {\r\n attributes.push(\"grl_offsets\");\r\n attributes.push(\"grl_previousAndSide\");\r\n attributes.push(\"grl_nextAndCounters\");\r\n attributes.push(\"grl_widths\");\r\n attributes.push(\"grl_colorPointers\");\r\n }\r\n\r\n /**\r\n * Get the shader samplers\r\n * @param samplers\r\n */\r\n 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\r\n */\r\n public getActiveTextures(activeTextures: BaseTexture[]): void {\r\n if (this._colorsTexture) {\r\n activeTextures.push(this._colorsTexture);\r\n }\r\n }\r\n\r\n /**\r\n * Get the shader uniforms\r\n * @returns uniforms\r\n */\r\n getUniforms() {\r\n const ubo = [\r\n { name: \"grl_projection\", size: 16, type: \"mat4\" },\r\n { name: \"grl_singleColor\", size: 3, type: \"vec3\" },\r\n { name: \"grl_aspect_resolution_lineWidth\", size: 4, type: \"vec4\" },\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\r\n return {\r\n ubo,\r\n vertex: `\r\n uniform vec4 grl_aspect_resolution_lineWidth;\r\n uniform mat4 grl_projection;\r\n `,\r\n fragment: `\r\n uniform vec4 grl_dashOptions;\r\n uniform vec4 grl_colorMode_visibility_colorsWidth_useColors;\r\n uniform vec3 grl_singleColor;\r\n `,\r\n };\r\n }\r\n\r\n // only getter, it doesn't make sense to use this plugin on a mesh other than GreasedLineMesh\r\n // and it doesn't make sense to disable it on the mesh\r\n get isEnabled() {\r\n return true;\r\n }\r\n\r\n /**\r\n * Bind the uniform buffer\r\n * @param uniformBuffer\r\n */\r\n bindForSubMesh(uniformBuffer: UniformBuffer) {\r\n const activeCamera = this._scene.activeCamera;\r\n\r\n if (activeCamera) {\r\n const projection = activeCamera.getProjectionMatrix();\r\n uniformBuffer.updateMatrix(\"grl_projection\", projection);\r\n } else {\r\n throw Error(\"GreasedLinePluginMaterial requires an active camera.\");\r\n }\r\n\r\n const resolutionLineWidth = TmpVectors.Vector4[0];\r\n resolutionLineWidth.x = this._aspect;\r\n resolutionLineWidth.y = this._resolution.x;\r\n resolutionLineWidth.z = this._resolution.y;\r\n resolutionLineWidth.w = this.width;\r\n uniformBuffer.updateVector4(\"grl_aspect_resolution_lineWidth\", resolutionLineWidth);\r\n\r\n const dashOptions = TmpVectors.Vector4[0];\r\n dashOptions.x = GreasedLinePluginMaterial._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 = GreasedLinePluginMaterial._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\r\n uniformBuffer.setTexture(\"grl_colors\", this._colorsTexture ?? GreasedLinePluginMaterial._EmptyColorsTexture);\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 prepareDefines(defines: MaterialGreasedLineDefines, _scene: Scene, _mesh: AbstractMesh) {\r\n defines.GREASED_LINE_HAS_COLOR = !!this._color;\r\n defines.GREASED_LINE_SIZE_ATTENUATION = this._sizeAttenuation ?? false;\r\n defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = this._colorsDistributionType === GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE;\r\n defines.GREASED_LNE_RIGHT_HANDED_COORDINATE_SYSTEM = _scene.useRightHandedSystem;\r\n }\r\n\r\n /**\r\n * Get the class name\r\n * @returns class name\r\n */\r\n getClassName() {\r\n return GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME;\r\n }\r\n\r\n /**\r\n * Get shader code\r\n * @param shaderType vertex/fragment\r\n * @returns shader code\r\n */\r\n getCustomCode(shaderType: string): Nullable<{ [pointName: string]: string }> {\r\n if (shaderType === \"vertex\") {\r\n return {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_DEFINITIONS: `\r\n attribute vec4 grl_previousAndSide;\r\n attribute vec4 grl_nextAndCounters;\r\n attribute float grl_widths;\r\n attribute vec3 grl_offsets;\r\n attribute float grl_colorPointers;\r\n\r\n varying float grlCounters;\r\n varying float grlColorPointer;\r\n\r\n vec2 grlFix( vec4 i, float aspect ) {\r\n vec2 res = i.xy / i.w;\r\n res.x *= aspect;\r\n return res;\r\n }\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_UPDATE_POSITION: `\r\n vec3 grlPositionOffset = grl_offsets;\r\n positionUpdated += grlPositionOffset;\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_MAIN_END: `\r\n\r\n float grlAspect = grl_aspect_resolution_lineWidth.x;\r\n float grlBaseWidth = grl_aspect_resolution_lineWidth.w;\r\n\r\n grlColorPointer = grl_colorPointers;\r\n\r\n vec3 grlPrevious = grl_previousAndSide.xyz;\r\n float grlSide = grl_previousAndSide.w;\r\n\r\n vec3 grlNext = grl_nextAndCounters.xyz;\r\n grlCounters = grl_nextAndCounters.w;\r\n\r\n\r\n mat4 grlMatrix = viewProjection * world;\r\n vec4 grlFinalPosition = grlMatrix * vec4( positionUpdated , 1.0 );\r\n vec4 grlPrevPos = grlMatrix * vec4( grlPrevious + grlPositionOffset, 1.0 );\r\n vec4 grlNextPos = grlMatrix * vec4( grlNext + grlPositionOffset, 1.0 );\r\n\r\n vec2 grlCurrentP = grlFix( grlFinalPosition, grlAspect );\r\n vec2 grlPrevP = grlFix( grlPrevPos, grlAspect );\r\n vec2 grlNextP = grlFix( grlNextPos, grlAspect );\r\n\r\n float grlWidth = grlBaseWidth * grl_widths;\r\n\r\n vec2 grlDir;\r\n if( grlNextP == grlCurrentP ) grlDir = normalize( grlCurrentP - grlPrevP );\r\n else if( grlPrevP == grlCurrentP ) grlDir = normalize( grlNextP - grlCurrentP );\r\n else {\r\n vec2 grlDir1 = normalize( grlCurrentP - grlPrevP );\r\n vec2 grlDir2 = normalize( grlNextP - grlCurrentP );\r\n grlDir = normalize( grlDir1 + grlDir2 );\r\n }\r\n vec4 grlNormal = vec4( -grlDir.y, grlDir.x, 0., 1. );\r\n #ifdef GREASED_LNE_RIGHT_HANDED_COORDINATE_SYSTEM\r\n grlNormal.xy *= -.5 * grlWidth;\r\n #else\r\n grlNormal.xy *= .5 * grlWidth;\r\n #endif\r\n grlNormal *= grl_projection;\r\n #ifdef GREASED_LINE_SIZE_ATTENUATION\r\n grlNormal.xy *= grlFinalPosition.w;\r\n grlNormal.xy /= ( vec4( grl_aspect_resolution_lineWidth.yz, 0., 1. ) * grl_projection ).xy;\r\n #endif\r\n grlFinalPosition.xy += grlNormal.xy * grlSide;\r\n gl_Position = grlFinalPosition;\r\n\r\n vPositionW = vec3(grlFinalPosition);\r\n\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n \"!gl_Position\\\\=viewProjection\\\\*worldPos;\": \"//\", // remove\r\n };\r\n }\r\n\r\n if (shaderType === \"fragment\") {\r\n return {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_DEFINITIONS: `\r\n varying float grlCounters;\r\n varying float grlColorPointer;\r\n uniform sampler2D grl_colors;\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_MAIN_END: `\r\n float grlColorMode = grl_colorMode_visibility_colorsWidth_useColors.x;\r\n float grlVisibility = grl_colorMode_visibility_colorsWidth_useColors.y;\r\n float grlColorsWidth = grl_colorMode_visibility_colorsWidth_useColors.z;\r\n float grlUseColors = grl_colorMode_visibility_colorsWidth_useColors.w;\r\n\r\n float grlUseDash = grl_dashOptions.x;\r\n float grlDashArray = grl_dashOptions.y;\r\n float grlDashOffset = grl_dashOptions.z;\r\n float grlDashRatio = grl_dashOptions.w;\r\n\r\n gl_FragColor.a *= step(grlCounters, grlVisibility);\r\n if( gl_FragColor.a == 0. ) discard;\r\n\r\n if(grlUseDash == 1.){\r\n gl_FragColor.a *= ceil(mod(grlCounters + grlDashOffset, grlDashArray) - (grlDashArray * grlDashRatio));\r\n if (gl_FragColor.a == 0.) discard;\r\n }\r\n\r\n #ifdef GREASED_LINE_HAS_COLOR\r\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\r\n gl_FragColor.rgb = grl_singleColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\r\n gl_FragColor.rgb += grl_singleColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\r\n gl_FragColor.rgb *= grl_singleColor;\r\n }\r\n #else\r\n if (grlUseColors == 1.) {\r\n #ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\r\n vec4 grlColor = texture2D(grl_colors, vec2(grlCounters, 0.), 0.);\r\n #else\r\n vec4 grlColor = texture2D(grl_colors, vec2(grlColorPointer/grlColorsWidth, 0.), 0.);\r\n #endif\r\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\r\n gl_FragColor = grlColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\r\n gl_FragColor += grlColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\r\n gl_FragColor *= grlColor;\r\n }\r\n }\r\n #endif\r\n `,\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Converts boolean to number.\r\n * @param bool\r\n * @returns 1 if true, 0 if false.\r\n */\r\n private static _BooleanToNumber(bool?: boolean) {\r\n return bool ? 1 : 0;\r\n }\r\n\r\n /**\r\n * Converts an array of Color3 to Uint8Array\r\n * @param colors Arrray of Color3\r\n * @returns Uin8Array of colors [r, g, b, a, r, g, b, a, ...]\r\n */\r\n private static _Color3toRGBAUint8(colors: Color3[]) {\r\n const colorTable: Uint8Array = new Uint8Array(colors.length * 4);\r\n for (let i = 0, j = 0; i < colors.length; i++) {\r\n colorTable[j++] = colors[i].r * 255;\r\n colorTable[j++] = colors[i].g * 255;\r\n colorTable[j++] = colors[i].b * 255;\r\n colorTable[j++] = 255;\r\n }\r\n\r\n return colorTable;\r\n }\r\n\r\n /**\r\n * Creates a RawTexture from an RGBA color array and sets it on the plugin material instance.\r\n * @param name name of the texture\r\n * @param colors Uint8Array of colors\r\n */\r\n private _createColorsTexture(name: string, colors: Color3[]) {\r\n const colorsArray = GreasedLinePluginMaterial._Color3toRGBAUint8(colors);\r\n this._colorsTexture = new RawTexture(colorsArray, colors.length, 1, Engine.TEXTUREFORMAT_RGBA, this._scene, false, true, this.colorsSampling);\r\n this._colorsTexture.name = name;\r\n }\r\n\r\n /**\r\n * Disposes the plugin material.\r\n */\r\n public 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 * @returns\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 = GreasedLinePluginMaterial._Color3toRGBAUint8(colors);\r\n this._colorsTexture.update(colorArray);\r\n } else {\r\n this._colorsTexture?.dispose();\r\n this._createColorsTexture(`${this._material.name}-colors-texture`, colors);\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 * False means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n get sizeAttenuation() {\r\n return this._sizeAttenuation;\r\n }\r\n\r\n /**\r\n * Turn on/off attenuation of the width option and widths array.\r\n * @param value false means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n set sizeAttenuation(value: boolean) {\r\n this._sizeAttenuation = value;\r\n this.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 */\r\n public setColor(value: Nullable<Color3>, doNotMarkDirty = false) {\r\n if ((this._color === null && value !== null) || (this._color !== null && value === null)) {\r\n this._color = value;\r\n !doNotMarkDirty && this.markAllDefinesAsDirty();\r\n } else {\r\n this._color = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the color distributiopn type\r\n */\r\n get colorsDistributionType() {\r\n return this._colorsDistributionType;\r\n }\r\n\r\n /**\r\n * Sets the color distribution type\r\n * @see GreasedLineMeshColorDistributionType\r\n * @param value color distribution type\r\n */\r\n set colorsDistributionType(value: GreasedLineMeshColorDistributionType) {\r\n this._colorsDistributionType = value;\r\n this.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the resolution\r\n */\r\n get resolution() {\r\n return this._resolution;\r\n }\r\n\r\n /**\r\n * Sets the resolution\r\n * @param value resolution of the screen for GreasedLine\r\n */\r\n set resolution(value: Vector2) {\r\n this._aspect = value.x / value.y;\r\n this._resolution = value;\r\n }\r\n\r\n /**\r\n * Serializes this plugin material\r\n * @returns serializationObjec\r\n */\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n const greasedLineMaterialOptions: GreasedLineMaterialOptions = {\r\n colorDistributionType: this._colorsDistributionType,\r\n colorsSampling: this.colorsSampling,\r\n colorMode: this.colorMode,\r\n dashCount: this._dashCount,\r\n dashOffset: this.dashOffset,\r\n dashRatio: this.dashRatio,\r\n resolution: this._resolution,\r\n sizeAttenuation: this._sizeAttenuation,\r\n useColors: this.useColors,\r\n useDash: this.useDash,\r\n visibility: this.visibility,\r\n width: this.width,\r\n };\r\n\r\n this._colors && (greasedLineMaterialOptions.colors = this._colors);\r\n this._color && (greasedLineMaterialOptions.color = this._color);\r\n\r\n serializationObject.greasedLineMaterialOptions = greasedLineMaterialOptions;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized objects\r\n * @param source serialized object\r\n * @param scene scene\r\n * @param rootUrl root url for textures\r\n */\r\n public 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.colors) {\r\n this._createColorsTexture(`${this._material.name}-colors-texture`, greasedLineMaterialOptions.colors);\r\n } else {\r\n GreasedLinePluginMaterial._PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n greasedLineMaterialOptions.color && this.setColor(greasedLineMaterialOptions.color, true);\r\n greasedLineMaterialOptions.colorDistributionType && (this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType);\r\n greasedLineMaterialOptions.colorsSampling && (this.colorsSampling = greasedLineMaterialOptions.colorsSampling);\r\n greasedLineMaterialOptions.colorMode && (this.colorMode = greasedLineMaterialOptions.colorMode);\r\n greasedLineMaterialOptions.useColors && (this.useColors = greasedLineMaterialOptions.useColors);\r\n greasedLineMaterialOptions.visibility && (this.visibility = greasedLineMaterialOptions.visibility);\r\n greasedLineMaterialOptions.useDash && (this.useDash = greasedLineMaterialOptions.useDash);\r\n greasedLineMaterialOptions.dashCount && (this.dashCount = greasedLineMaterialOptions.dashCount);\r\n greasedLineMaterialOptions.dashRatio && (this.dashRatio = greasedLineMaterialOptions.dashRatio);\r\n greasedLineMaterialOptions.dashOffset && (this.dashOffset = greasedLineMaterialOptions.dashOffset);\r\n greasedLineMaterialOptions.width && (this.width = greasedLineMaterialOptions.width);\r\n greasedLineMaterialOptions.sizeAttenuation && (this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation);\r\n greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);\r\n\r\n 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 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._createColorsTexture(`${dest._material.name}-colors-texture`, this._colors);\r\n }\r\n\r\n dest.setColor(this.color, true);\r\n dest.colorsDistributionType = this.colorsDistributionType;\r\n dest.colorsSampling = this.colorsSampling;\r\n dest.colorMode = this.colorMode;\r\n dest.useColors = this.useColors;\r\n dest.visibility = this.visibility;\r\n dest.useDash = this.useDash;\r\n dest.dashCount = this.dashCount;\r\n dest.dashRatio = this.dashRatio;\r\n dest.dashOffset = this.dashOffset;\r\n dest.width = this.width;\r\n dest.sizeAttenuation = this.sizeAttenuation;\r\n dest.resolution = this.resolution;\r\n\r\n dest.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * A minimum size texture for the colors sampler2D when there is no colors texture defined yet.\r\n * For fast switching using the useColors property without the need to use defines.\r\n * @param scene Scene\r\n */\r\n private static _PrepareEmptyColorsTexture(scene: Scene) {\r\n if (!this._EmptyColorsTexture) {\r\n const colorsArray = new Uint8Array(4);\r\n GreasedLinePluginMaterial._EmptyColorsTexture = new RawTexture(colorsArray, 1, 1, Engine.TEXTUREFORMAT_RGBA, scene, false, false, RawTexture.NEAREST_NEAREST);\r\n GreasedLinePluginMaterial._EmptyColorsTexture.name = \"grlEmptyColorsTexture\";\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(`BABYLON.${GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME}`, GreasedLinePluginMaterial);\r\n"]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
import type { NodeGeometryBuildState } from "../../nodeGeometryBuildState";
|
|
4
|
+
import type { INodeGeometryExecutionContext } from "../../Interfaces/nodeGeometryExecutionContext";
|
|
5
|
+
import { Vector3 } from "../../../../Maths/math.vector";
|
|
6
|
+
/**
|
|
7
|
+
* Block used to instance geometry inside a geometry
|
|
8
|
+
*/
|
|
9
|
+
export declare class InstantiateOnVolumeBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {
|
|
10
|
+
private _vertexData;
|
|
11
|
+
private _currentPosition;
|
|
12
|
+
private _vertex0;
|
|
13
|
+
private _vertex1;
|
|
14
|
+
private _vertex2;
|
|
15
|
+
/**
|
|
16
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
17
|
+
* Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
|
|
18
|
+
*/
|
|
19
|
+
evaluateContext: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Create a new InstantiateOnVolumeBlock
|
|
22
|
+
* @param name defines the block name
|
|
23
|
+
*/
|
|
24
|
+
constructor(name: string);
|
|
25
|
+
/**
|
|
26
|
+
* Gets the current index in the current flow
|
|
27
|
+
* @returns the current index
|
|
28
|
+
*/
|
|
29
|
+
getExecutionIndex(): number;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the current face index in the current flow
|
|
32
|
+
* @returns the current face index
|
|
33
|
+
*/
|
|
34
|
+
getExecutionFaceIndex(): number;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the value associated with a contextual positions
|
|
37
|
+
* @returns the value associated with the source
|
|
38
|
+
*/
|
|
39
|
+
getOverridePositionsContextualValue(): Vector3;
|
|
40
|
+
/**
|
|
41
|
+
* Gets the current class name
|
|
42
|
+
* @returns the class name
|
|
43
|
+
*/
|
|
44
|
+
getClassName(): string;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the geometry input component
|
|
47
|
+
*/
|
|
48
|
+
get geometry(): NodeGeometryConnectionPoint;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the instance input component
|
|
51
|
+
*/
|
|
52
|
+
get instance(): NodeGeometryConnectionPoint;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the rotation input component
|
|
55
|
+
*/
|
|
56
|
+
get rotation(): NodeGeometryConnectionPoint;
|
|
57
|
+
/**
|
|
58
|
+
* Gets the scaling input component
|
|
59
|
+
*/
|
|
60
|
+
get scaling(): NodeGeometryConnectionPoint;
|
|
61
|
+
/**
|
|
62
|
+
* Gets the count input component
|
|
63
|
+
*/
|
|
64
|
+
get count(): NodeGeometryConnectionPoint;
|
|
65
|
+
/**
|
|
66
|
+
* Gets the geometry output component
|
|
67
|
+
*/
|
|
68
|
+
get output(): NodeGeometryConnectionPoint;
|
|
69
|
+
protected _buildBlock(state: NodeGeometryBuildState): void;
|
|
70
|
+
protected _dumpPropertiesCode(): string;
|
|
71
|
+
/**
|
|
72
|
+
* Serializes this block in a JSON representation
|
|
73
|
+
* @returns the serialized block object
|
|
74
|
+
*/
|
|
75
|
+
serialize(): any;
|
|
76
|
+
_deserialize(serializationObject: any): void;
|
|
77
|
+
}
|