@babylonjs/core 6.25.0 → 6.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cameras/camera.d.ts +4 -2
- package/Cameras/camera.js.map +1 -1
- package/Debug/debugLayer.js +2 -2
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/WebGPU/webgpuTintWASM.js +4 -10
- package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +5 -12
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.d.ts +2 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.d.ts +2 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.d.ts +2 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +3 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +2 -2
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/shadowDepthWrapper.d.ts +1 -0
- package/Materials/shadowDepthWrapper.js +17 -4
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.d.ts +1 -1
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/Compression/dracoCompression.js +7 -7
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/Compression/meshoptCompression.js +2 -2
- package/Meshes/Compression/meshoptCompression.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.d.ts +2 -1
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.d.ts +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +2 -2
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/instancedMesh.js +9 -9
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.js +3 -1
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/transformNode.js +5 -1
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/basis.js +4 -4
- package/Misc/basis.js.map +1 -1
- package/Misc/fileTools.d.ts +2 -0
- package/Misc/fileTools.js +12 -3
- package/Misc/fileTools.js.map +1 -1
- package/Misc/khronosTextureContainer2.js +21 -24
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/screenshotTools.d.ts +3 -1
- package/Misc/screenshotTools.js +34 -24
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/tools.d.ts +42 -2
- package/Misc/tools.js +102 -2
- package/Misc/tools.js.map +1 -1
- package/Particles/solidParticleSystem.d.ts +1 -1
- package/Particles/solidParticleSystem.js +2 -2
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Shaders/ShadersInclude/bonesDeclaration.js +1 -1
- package/Shaders/ShadersInclude/bonesDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js +1 -2
- package/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js.map +1 -1
- package/Shaders/greasedLine.vertex.d.ts +2 -0
- package/Shaders/greasedLine.vertex.js +15 -3
- package/Shaders/greasedLine.vertex.js.map +1 -1
- package/assetContainer.d.ts +6 -0
- package/assetContainer.js +56 -1
- package/assetContainer.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Vector2 } from "../../../../Maths/math.vector";
|
|
2
2
|
import { FlowGraphBinaryOperationBlock } from "../flowGraphBinaryOperationBlock";
|
|
3
3
|
import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock";
|
|
4
|
-
import {
|
|
4
|
+
import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
|
|
5
|
+
import { FlowGraphBlock } from "../../../flowGraphBlock";
|
|
5
6
|
import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection";
|
|
6
7
|
import type { FlowGraphContext } from "../../../flowGraphContext";
|
|
7
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphVector2MathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,uCAA0C;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAqC,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D,MAAM,OAAO,GAAG,mBAAmB,CAAC;AACpC;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,6BAAwD;IAClG,YAAY,MAAoC;QAC5C,KAAK,CAAC,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAChH,CAAC;CACJ;AACD,aAAa,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC;AAEjD,MAAM,OAAO,GAAG,wBAAwB,CAAC;A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raph/flowGraphRichTypes\";\r\nimport { Vector2 } from \"../../../../Maths/math.vector\";\r\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\r\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\r\nimport { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\r\n\r\nconst ADDNAME = \"FGAddVector2Block\";\r\n/**\r\n * Adds two vectors together.\r\n * @experimental\r\n */\r\nexport class FlowGraphAddVector2Block extends FlowGraphBinaryOperationBlock<Vector2, Vector2, Vector2> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector2, RichTypeVector2, RichTypeVector2, (left, right) => left.add(right), ADDNAME, config);\r\n }\r\n}\r\nRegisterClass(ADDNAME, FlowGraphAddVector2Block);\r\n\r\nconst SUBNAME = \"FGSubtractVector2Block\";\r\n/**\r\n * Subtracts two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphSubtractVector2Block extends FlowGraphBinaryOperationBlock<Vector2, Vector2, Vector2> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector2, RichTypeVector2, RichTypeVector2, (left, right) => left.subtract(right), SUBNAME, config);\r\n }\r\n}\r\nRegisterClass(SUBNAME, FlowGraphSubtractVector2Block);\r\n\r\nconst MULNAME = \"FGMultiplyVector2Block\";\r\n/**\r\n * Multiplies two vectors together.\r\n * @experimental\r\n */\r\nexport class FlowGraphMultiplyVector2Block extends FlowGraphBinaryOperationBlock<Vector2, Vector2, Vector2> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector2, RichTypeVector2, RichTypeVector2, (left, right) => left.multiply(right), MULNAME, config);\r\n }\r\n}\r\nRegisterClass(MULNAME, FlowGraphMultiplyVector2Block);\r\n\r\nconst DIVNAME = \"FGDivideVector2Block\";\r\n/**\r\n * Divides two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphDivideVector2Block extends FlowGraphBinaryOperationBlock<Vector2, Vector2, Vector2> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector2, RichTypeVector2, RichTypeVector2, (left, right) => left.divide(right), DIVNAME, config);\r\n }\r\n}\r\nRegisterClass(DIVNAME, FlowGraphDivideVector2Block);\r\n\r\nconst SCALENAME = \"FGScaleVector2Block\";\r\n/**\r\n * Scales a vector by a given factor.\r\n * @experimental\r\n */\r\nexport class FlowGraphScaleVector2Block extends FlowGraphBinaryOperationBlock<Vector2, number, Vector2> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector2, RichTypeNumber, RichTypeVector2, (left, right) => left.scale(right), SCALENAME, config);\r\n }\r\n}\r\nRegisterClass(SCALENAME, FlowGraphScaleVector2Block);\r\n\r\nconst LENNAME = \"FGLengthVector2Block\";\r\n/**\r\n * Gets the length of a vector.\r\n * @experimental\r\n */\r\nexport class FlowGraphLengthVector2Block extends FlowGraphUnaryOperationBlock<Vector2, number> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector2, RichTypeNumber, (value) => value.length(), LENNAME, config);\r\n }\r\n}\r\nRegisterClass(LENNAME, FlowGraphLengthVector2Block);\r\n\r\nconst NORMALIZENAME = \"FGNormalizeVector2Block\";\r\n/**\r\n * Normalizes a vector.\r\n * @experimental\r\n */\r\nexport class FlowGraphNormalizeVector2Block extends FlowGraphUnaryOperationBlock<Vector2, Vector2> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(\r\n RichTypeVector2,\r\n RichTypeVector2,\r\n (value: Vector2) => {\r\n const copy: Vector2 = value.clone();\r\n copy.normalize();\r\n return copy;\r\n },\r\n NORMALIZENAME,\r\n config\r\n );\r\n }\r\n}\r\nRegisterClass(NORMALIZENAME, FlowGraphNormalizeVector2Block);\r\n\r\nconst CREATENAME = \"FGCreateVector2Block\";\r\n/**\r\n * Creates a vector from two components.\r\n */\r\nexport class FlowGraphCreateVector2Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The x component of the vector.\r\n */\r\n public readonly x: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The y component of the vector.\r\n */\r\n public readonly y: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The created vector.\r\n */\r\n public readonly vector: FlowGraphDataConnection<Vector2>;\r\n\r\n private _cachedVector: Vector2 = Vector2.Zero();\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.x = this._registerDataInput(\"x\", RichTypeNumber);\r\n this.y = this._registerDataInput(\"y\", RichTypeNumber);\r\n this.vector = this._registerDataOutput(\"vector\", RichTypeVector2);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n this._cachedVector.x = this.x.getValue(_context);\r\n this._cachedVector.y = this.y.getValue(_context);\r\n this.vector.setValue(this._cachedVector, _context);\r\n }\r\n}\r\nRegisterClass(CREATENAME, FlowGraphCreateVector2Block);\r\n\r\nconst SPLITNAME = \"FGSplitVector2Block\";\r\n/**\r\n * Split a vector into its components.\r\n */\r\nexport class FlowGraphSplitVector2Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The vector to split.\r\n */\r\n public readonly vector: FlowGraphDataConnection<Vector2>;\r\n /**\r\n * Output connection: The x component of the vector.\r\n */\r\n public readonly x: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The y component of the vector.\r\n */\r\n public readonly y: FlowGraphDataConnection<number>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.vector = this._registerDataInput(\"vector\", RichTypeVector2);\r\n this.x = this._registerDataOutput(\"x\", RichTypeNumber);\r\n this.y = this._registerDataOutput(\"y\", RichTypeNumber);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n const vector = this.vector.getValue(_context);\r\n this.x.setValue(vector.x, _context);\r\n this.y.setValue(vector.y, _context);\r\n }\r\n}\r\nRegisterClass(SPLITNAME, FlowGraphSplitVector2Block);\r\n\r\nconst ROTATENAME = \"FGRotate2dVector2Block\";\r\n/**\r\n * Rotates a vector by a given angle.\r\n */\r\nexport class FlowGraphRotate2dVector2Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The vector to rotate.\r\n */\r\n public readonly input: FlowGraphDataConnection<Vector2>;\r\n /**\r\n * Input connection: The angle to rotate by.\r\n */\r\n public readonly angle: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The rotated vector.\r\n */\r\n public readonly output: FlowGraphDataConnection<Vector2>;\r\n\r\n private _cachedVector: Vector2 = Vector2.Zero();\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.input = this._registerDataInput(\"input\", RichTypeVector2);\r\n this.angle = this._registerDataInput(\"angle\", RichTypeNumber);\r\n this.output = this._registerDataOutput(\"output\", RichTypeVector2);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n const input = this.input.getValue(_context);\r\n const angle = this.angle.getValue(_context);\r\n this._cachedVector.x = input.x * Math.cos(angle) - input.y * Math.sin(angle);\r\n this._cachedVector.y = input.x * Math.sin(angle) + input.y * Math.cos(angle);\r\n this.output.setValue(this._cachedVector, _context);\r\n }\r\n}\r\nRegisterClass(ROTATENAME, FlowGraphRotate2dVector2Block);\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphVector2MathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,uCAA0C;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,4BAA4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C,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC7E,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACvD,CAAC;CACJ;AACD,aAAa,CAAC,UAAU,EAAE,6BAA6B,CAAC,CAAC","sourcesContent":["import { RichTypeNumber, RichTypeVector2 } from \"core/FlowGraph/flowGraphRichTypes\";\r\nimport { Vector2 } from \"../../../../Maths/math.vector\";\r\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\r\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { FlowGraphBlock } from \"../../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\r\n\r\nconst ADDNAME = \"FGAddVector2Block\";\r\n/**\r\n * Adds two vectors together.\r\n * @experimental\r\n */\r\nexport class FlowGraphAddVector2Block extends FlowGraphBinaryOperationBlock<Vector2, Vector2, Vector2> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector2, RichTypeVector2, RichTypeVector2, (left, right) => left.add(right), ADDNAME, config);\r\n }\r\n}\r\nRegisterClass(ADDNAME, FlowGraphAddVector2Block);\r\n\r\nconst SUBNAME = \"FGSubtractVector2Block\";\r\n/**\r\n * Subtracts two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphSubtractVector2Block extends FlowGraphBinaryOperationBlock<Vector2, Vector2, Vector2> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector2, RichTypeVector2, RichTypeVector2, (left, right) => left.subtract(right), SUBNAME, config);\r\n }\r\n}\r\nRegisterClass(SUBNAME, FlowGraphSubtractVector2Block);\r\n\r\nconst MULNAME = \"FGMultiplyVector2Block\";\r\n/**\r\n * Multiplies two vectors together.\r\n * @experimental\r\n */\r\nexport class FlowGraphMultiplyVector2Block extends FlowGraphBinaryOperationBlock<Vector2, Vector2, Vector2> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector2, RichTypeVector2, RichTypeVector2, (left, right) => left.multiply(right), MULNAME, config);\r\n }\r\n}\r\nRegisterClass(MULNAME, FlowGraphMultiplyVector2Block);\r\n\r\nconst DIVNAME = \"FGDivideVector2Block\";\r\n/**\r\n * Divides two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphDivideVector2Block extends FlowGraphBinaryOperationBlock<Vector2, Vector2, Vector2> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector2, RichTypeVector2, RichTypeVector2, (left, right) => left.divide(right), DIVNAME, config);\r\n }\r\n}\r\nRegisterClass(DIVNAME, FlowGraphDivideVector2Block);\r\n\r\nconst SCALENAME = \"FGScaleVector2Block\";\r\n/**\r\n * Scales a vector by a given factor.\r\n * @experimental\r\n */\r\nexport class FlowGraphScaleVector2Block extends FlowGraphBinaryOperationBlock<Vector2, number, Vector2> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector2, RichTypeNumber, RichTypeVector2, (left, right) => left.scale(right), SCALENAME, config);\r\n }\r\n}\r\nRegisterClass(SCALENAME, FlowGraphScaleVector2Block);\r\n\r\nconst LENNAME = \"FGLengthVector2Block\";\r\n/**\r\n * Gets the length of a vector.\r\n * @experimental\r\n */\r\nexport class FlowGraphLengthVector2Block extends FlowGraphUnaryOperationBlock<Vector2, number> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector2, RichTypeNumber, (value) => value.length(), LENNAME, config);\r\n }\r\n}\r\nRegisterClass(LENNAME, FlowGraphLengthVector2Block);\r\n\r\nconst NORMALIZENAME = \"FGNormalizeVector2Block\";\r\n/**\r\n * Normalizes a vector.\r\n * @experimental\r\n */\r\nexport class FlowGraphNormalizeVector2Block extends FlowGraphUnaryOperationBlock<Vector2, Vector2> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(\r\n RichTypeVector2,\r\n RichTypeVector2,\r\n (value: Vector2) => {\r\n const copy: Vector2 = value.clone();\r\n copy.normalize();\r\n return copy;\r\n },\r\n NORMALIZENAME,\r\n config\r\n );\r\n }\r\n}\r\nRegisterClass(NORMALIZENAME, FlowGraphNormalizeVector2Block);\r\n\r\nconst CREATENAME = \"FGCreateVector2Block\";\r\n/**\r\n * Creates a vector from two components.\r\n */\r\nexport class FlowGraphCreateVector2Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The x component of the vector.\r\n */\r\n public readonly x: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The y component of the vector.\r\n */\r\n public readonly y: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The created vector.\r\n */\r\n public readonly vector: FlowGraphDataConnection<Vector2>;\r\n\r\n private _cachedVector: Vector2 = Vector2.Zero();\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.x = this._registerDataInput(\"x\", RichTypeNumber);\r\n this.y = this._registerDataInput(\"y\", RichTypeNumber);\r\n this.vector = this._registerDataOutput(\"vector\", RichTypeVector2);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n this._cachedVector.x = this.x.getValue(_context);\r\n this._cachedVector.y = this.y.getValue(_context);\r\n this.vector.setValue(this._cachedVector, _context);\r\n }\r\n}\r\nRegisterClass(CREATENAME, FlowGraphCreateVector2Block);\r\n\r\nconst SPLITNAME = \"FGSplitVector2Block\";\r\n/**\r\n * Split a vector into its components.\r\n */\r\nexport class FlowGraphSplitVector2Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The vector to split.\r\n */\r\n public readonly vector: FlowGraphDataConnection<Vector2>;\r\n /**\r\n * Output connection: The x component of the vector.\r\n */\r\n public readonly x: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The y component of the vector.\r\n */\r\n public readonly y: FlowGraphDataConnection<number>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.vector = this._registerDataInput(\"vector\", RichTypeVector2);\r\n this.x = this._registerDataOutput(\"x\", RichTypeNumber);\r\n this.y = this._registerDataOutput(\"y\", RichTypeNumber);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n const vector = this.vector.getValue(_context);\r\n this.x.setValue(vector.x, _context);\r\n this.y.setValue(vector.y, _context);\r\n }\r\n}\r\nRegisterClass(SPLITNAME, FlowGraphSplitVector2Block);\r\n\r\nconst ROTATENAME = \"FGRotate2dVector2Block\";\r\n/**\r\n * Rotates a vector by a given angle.\r\n */\r\nexport class FlowGraphRotate2dVector2Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The vector to rotate.\r\n */\r\n public readonly input: FlowGraphDataConnection<Vector2>;\r\n /**\r\n * Input connection: The angle to rotate by.\r\n */\r\n public readonly angle: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The rotated vector.\r\n */\r\n public readonly output: FlowGraphDataConnection<Vector2>;\r\n\r\n private _cachedVector: Vector2 = Vector2.Zero();\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.input = this._registerDataInput(\"input\", RichTypeVector2);\r\n this.angle = this._registerDataInput(\"angle\", RichTypeNumber);\r\n this.output = this._registerDataOutput(\"output\", RichTypeVector2);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n const input = this.input.getValue(_context);\r\n const angle = this.angle.getValue(_context);\r\n this._cachedVector.x = input.x * Math.cos(angle) - input.y * Math.sin(angle);\r\n this._cachedVector.y = input.x * Math.sin(angle) + input.y * Math.cos(angle);\r\n this.output.setValue(this._cachedVector, _context);\r\n }\r\n}\r\nRegisterClass(ROTATENAME, FlowGraphRotate2dVector2Block);\r\n"]}
|
|
@@ -2,7 +2,8 @@ import { FlowGraphBinaryOperationBlock } from "../flowGraphBinaryOperationBlock"
|
|
|
2
2
|
import type { Matrix } from "../../../../Maths/math.vector";
|
|
3
3
|
import { Vector3 } from "../../../../Maths/math.vector";
|
|
4
4
|
import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock";
|
|
5
|
-
import {
|
|
5
|
+
import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
|
|
6
|
+
import { FlowGraphBlock } from "../../../flowGraphBlock";
|
|
6
7
|
import type { FlowGraphContext } from "../../../flowGraphContext";
|
|
7
8
|
import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection";
|
|
8
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphVector3MathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,uCAA0C;AACpG,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAqC,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D,MAAM,OAAO,GAAG,mBAAmB,CAAC;AACpC;;;GAGG;AACH,MAAM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BAA6B,CAAC,CAAC;AAEzD,MAAM,aAAa,GAAG,yBAAyB,CAAC;AAChD;;;GAGG;AACH,MAAM,OAAO,8BAA+B,SAAQ,6BAAuD;IAEvG,YAAY,MAAqC;QAC7C,KAAK,CAAC,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,yBAAyB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;QAFhK,kBAAa,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;IAGhD,CAAC;CACJ;AACD,aAAa,CAAC,aAAa,EAAE,8BAA8B,CAAC,CAAC","sourcesContent":["import { RichTypeMatrix, RichTypeNumber, RichTypeVector3 } from \"core/FlowGraph/flowGraphRichTypes\";\r\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\r\nimport type { Matrix } from \"../../../../Maths/math.vector\";\r\nimport { Quaternion, Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\r\nimport { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\n\r\nconst ADDNAME = \"FGAddVector3Block\";\r\n/**\r\n * Add two vectors together.\r\n * @experimental\r\n */\r\nexport class FlowGraphAddVector3Block extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (left, right) => left.add(right), ADDNAME, config);\r\n }\r\n}\r\nRegisterClass(ADDNAME, FlowGraphAddVector3Block);\r\n\r\nconst SUBNAME = \"FGSubtractVector3Block\";\r\n/**\r\n * Subtract two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphSubtractVector3Block extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (left, right) => left.subtract(right), SUBNAME, config);\r\n }\r\n}\r\nRegisterClass(SUBNAME, FlowGraphSubtractVector3Block);\r\n\r\nconst MULNAME = \"FGMultiplyVector3Block\";\r\n/**\r\n * Multiply two vectors together.\r\n * @experimental\r\n */\r\nexport class FlowGraphMultiplyVector3Block extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (left, right) => left.multiply(right), MULNAME, config);\r\n }\r\n}\r\nRegisterClass(MULNAME, FlowGraphMultiplyVector3Block);\r\n\r\nconst DIVNAME = \"FGDivideVector3Block\";\r\n/**\r\n * Divide two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphDivideVector3Block extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (left, right) => left.divide(right), DIVNAME, config);\r\n }\r\n}\r\nRegisterClass(DIVNAME, FlowGraphDivideVector3Block);\r\n\r\nconst SCALNAME = \"FGScaleVector3Block\";\r\n/**\r\n * Scale a vector by a number.\r\n * @experimental\r\n */\r\nexport class FlowGraphScaleVector3Block extends FlowGraphBinaryOperationBlock<Vector3, number, Vector3> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeNumber, RichTypeVector3, (left, right) => left.scale(right), SCALNAME, config);\r\n }\r\n}\r\nRegisterClass(SCALNAME, FlowGraphScaleVector3Block);\r\n\r\nconst LENNAME = \"FGLengthVector3Block\";\r\n/**\r\n * Get the length of a vector.\r\n * @experimental\r\n */\r\nexport class FlowGraphLengthVector3Block extends FlowGraphUnaryOperationBlock<Vector3, number> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeNumber, (value) => value.length(), LENNAME, config);\r\n }\r\n}\r\nRegisterClass(LENNAME, FlowGraphLengthVector3Block);\r\n\r\nconst NORMNAME = \"FGNormalizeVector3Block\";\r\n/**\r\n * Normalize a vector.\r\n * @experimental\r\n */\r\nexport class FlowGraphNormalizeVector3Block extends FlowGraphUnaryOperationBlock<Vector3, Vector3> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, (value) => value.normalizeToNew(), NORMNAME, config);\r\n }\r\n}\r\nRegisterClass(NORMNAME, FlowGraphNormalizeVector3Block);\r\n\r\nconst DOTNAME = \"FGDotVector3Block\";\r\n/**\r\n * Get the dot product of two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphDotVector3Block extends FlowGraphBinaryOperationBlock<Vector3, Vector3, number> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, RichTypeNumber, (left, right) => Vector3.Dot(left, right), DOTNAME, config);\r\n }\r\n}\r\nRegisterClass(DOTNAME, FlowGraphDotVector3Block);\r\n\r\nconst CROSSNAME = \"FGCrossVector3Block\";\r\n/**\r\n * Get the cross product of two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphCrossVector3Block extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (left, right) => Vector3.Cross(left, right), CROSSNAME, config);\r\n }\r\n}\r\nRegisterClass(CROSSNAME, FlowGraphCrossVector3Block);\r\n\r\nconst CREATENAME = \"FGCreateVector3Block\";\r\n/**\r\n * Create a vector from its components.\r\n * @experimental\r\n */\r\nexport class FlowGraphCreateVector3Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The x component of the vector.\r\n */\r\n public readonly x: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The y component of the vector.\r\n */\r\n public readonly y: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The z component of the vector.\r\n */\r\n public readonly z: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The created vector.\r\n */\r\n public readonly vector: FlowGraphDataConnection<Vector3>;\r\n\r\n private _cachedVector: Vector3 = Vector3.Zero();\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.x = this._registerDataInput(\"x\", RichTypeNumber);\r\n this.y = this._registerDataInput(\"y\", RichTypeNumber);\r\n this.z = this._registerDataInput(\"y\", RichTypeNumber);\r\n this.vector = this._registerDataOutput(\"vector\", RichTypeVector3);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n this._cachedVector.x = this.x.getValue(_context);\r\n this._cachedVector.y = this.y.getValue(_context);\r\n this._cachedVector.z = this.z.getValue(_context);\r\n this.vector.setValue(this._cachedVector, _context);\r\n }\r\n\r\n public getClassName(): string {\r\n return CREATENAME;\r\n }\r\n}\r\nRegisterClass(CREATENAME, FlowGraphCreateVector3Block);\r\n\r\nconst SPLITNAME = \"FGSplitVector3Block\";\r\n/**\r\n * Split a vector into its components.\r\n * @experimental\r\n */\r\nexport class FlowGraphSplitVector3Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The vector to split.\r\n */\r\n public readonly vector: FlowGraphDataConnection<Vector3>;\r\n /**\r\n * Output connection: The x component of the vector.\r\n */\r\n public readonly x: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The y component of the vector.\r\n */\r\n public readonly y: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The z component of the vector.\r\n */\r\n public readonly z: FlowGraphDataConnection<number>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.vector = this._registerDataInput(\"vector\", RichTypeVector3);\r\n this.x = this._registerDataOutput(\"x\", RichTypeNumber);\r\n this.y = this._registerDataOutput(\"y\", RichTypeNumber);\r\n this.z = this._registerDataOutput(\"z\", RichTypeNumber);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n const vector = this.vector.getValue(_context);\r\n this.x.setValue(vector.x, _context);\r\n this.y.setValue(vector.y, _context);\r\n this.z.setValue(vector.z, _context);\r\n }\r\n\r\n public getClassName(): string {\r\n return SPLITNAME;\r\n }\r\n}\r\nRegisterClass(SPLITNAME, FlowGraphSplitVector3Block);\r\n\r\nconst ROTATENAME = \"FGRotateVector3Block\";\r\n/**\r\n * Rotates a vector by a given angle.\r\n */\r\nexport class FlowGraphRotate3dVector3Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The vector to rotate.\r\n */\r\n public readonly input: FlowGraphDataConnection<Vector3>;\r\n /**\r\n * Input connection: The axis to rotate around.\r\n */\r\n public readonly axis: FlowGraphDataConnection<Vector3>;\r\n /**\r\n * Input connection: The angle to rotate by.\r\n */\r\n public readonly angle: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The rotated vector.\r\n */\r\n public readonly output: FlowGraphDataConnection<Vector3>;\r\n\r\n private _cachedQuaternion = new Quaternion();\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.input = this._registerDataInput(\"input\", RichTypeVector3);\r\n this.angle = this._registerDataInput(\"angle\", RichTypeNumber);\r\n this.output = this._registerDataOutput(\"output\", RichTypeVector3);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n const rot = Quaternion.RotationAxisToRef(this.axis.getValue(_context), this.angle.getValue(_context), this._cachedQuaternion);\r\n const input = this.input.getValue(_context);\r\n const output = this.output.getValue(_context);\r\n input.applyRotationQuaternionToRef(rot, output);\r\n }\r\n\r\n public getClassName(): string {\r\n return ROTATENAME;\r\n }\r\n}\r\nRegisterClass(ROTATENAME, FlowGraphRotate3dVector3Block);\r\n\r\nconst TRANSFORMNAME = \"FGTransformVector3Block\";\r\n/**\r\n * Transforms a vector by a given matrix.\r\n * @experimental\r\n */\r\nexport class FlowGraphTransformVector3Block extends FlowGraphBinaryOperationBlock<Matrix, Vector3, Vector3> {\r\n private _cachedResult: Vector3 = Vector3.Zero();\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeMatrix, RichTypeVector3, RichTypeVector3, (left, right) => Vector3.TransformCoordinatesToRef(right, left, this._cachedResult), TRANSFORMNAME, config);\r\n }\r\n}\r\nRegisterClass(TRANSFORMNAME, FlowGraphTransformVector3Block);\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphVector3MathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,uCAA0C;AACpG,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D,MAAM,OAAO,GAAG,mBAAmB,CAAC;AACpC;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,6BAAwD;IAClG,YAAY,MAAqC;QAC7C,KAAK,CAAC,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAChH,CAAC;CACJ;AACD,aAAa,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC;AAEjD,MAAM,OAAO,GAAG,wBAAwB,CAAC;AACzC;;;GA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AAC;QAFhK,kBAAa,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;IAGhD,CAAC;CACJ;AACD,aAAa,CAAC,aAAa,EAAE,8BAA8B,CAAC,CAAC","sourcesContent":["import { RichTypeMatrix, RichTypeNumber, RichTypeVector3 } from \"core/FlowGraph/flowGraphRichTypes\";\r\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\r\nimport type { Matrix } from \"../../../../Maths/math.vector\";\r\nimport { Quaternion, Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { FlowGraphBlock } from \"../../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\n\r\nconst ADDNAME = \"FGAddVector3Block\";\r\n/**\r\n * Add two vectors together.\r\n * @experimental\r\n */\r\nexport class FlowGraphAddVector3Block extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (left, right) => left.add(right), ADDNAME, config);\r\n }\r\n}\r\nRegisterClass(ADDNAME, FlowGraphAddVector3Block);\r\n\r\nconst SUBNAME = \"FGSubtractVector3Block\";\r\n/**\r\n * Subtract two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphSubtractVector3Block extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (left, right) => left.subtract(right), SUBNAME, config);\r\n }\r\n}\r\nRegisterClass(SUBNAME, FlowGraphSubtractVector3Block);\r\n\r\nconst MULNAME = \"FGMultiplyVector3Block\";\r\n/**\r\n * Multiply two vectors together.\r\n * @experimental\r\n */\r\nexport class FlowGraphMultiplyVector3Block extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\r\n constructor(config: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (left, right) => left.multiply(right), MULNAME, config);\r\n }\r\n}\r\nRegisterClass(MULNAME, FlowGraphMultiplyVector3Block);\r\n\r\nconst DIVNAME = \"FGDivideVector3Block\";\r\n/**\r\n * Divide two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphDivideVector3Block extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (left, right) => left.divide(right), DIVNAME, config);\r\n }\r\n}\r\nRegisterClass(DIVNAME, FlowGraphDivideVector3Block);\r\n\r\nconst SCALNAME = \"FGScaleVector3Block\";\r\n/**\r\n * Scale a vector by a number.\r\n * @experimental\r\n */\r\nexport class FlowGraphScaleVector3Block extends FlowGraphBinaryOperationBlock<Vector3, number, Vector3> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeNumber, RichTypeVector3, (left, right) => left.scale(right), SCALNAME, config);\r\n }\r\n}\r\nRegisterClass(SCALNAME, FlowGraphScaleVector3Block);\r\n\r\nconst LENNAME = \"FGLengthVector3Block\";\r\n/**\r\n * Get the length of a vector.\r\n * @experimental\r\n */\r\nexport class FlowGraphLengthVector3Block extends FlowGraphUnaryOperationBlock<Vector3, number> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeNumber, (value) => value.length(), LENNAME, config);\r\n }\r\n}\r\nRegisterClass(LENNAME, FlowGraphLengthVector3Block);\r\n\r\nconst NORMNAME = \"FGNormalizeVector3Block\";\r\n/**\r\n * Normalize a vector.\r\n * @experimental\r\n */\r\nexport class FlowGraphNormalizeVector3Block extends FlowGraphUnaryOperationBlock<Vector3, Vector3> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, (value) => value.normalizeToNew(), NORMNAME, config);\r\n }\r\n}\r\nRegisterClass(NORMNAME, FlowGraphNormalizeVector3Block);\r\n\r\nconst DOTNAME = \"FGDotVector3Block\";\r\n/**\r\n * Get the dot product of two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphDotVector3Block extends FlowGraphBinaryOperationBlock<Vector3, Vector3, number> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, RichTypeNumber, (left, right) => Vector3.Dot(left, right), DOTNAME, config);\r\n }\r\n}\r\nRegisterClass(DOTNAME, FlowGraphDotVector3Block);\r\n\r\nconst CROSSNAME = \"FGCrossVector3Block\";\r\n/**\r\n * Get the cross product of two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphCrossVector3Block extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (left, right) => Vector3.Cross(left, right), CROSSNAME, config);\r\n }\r\n}\r\nRegisterClass(CROSSNAME, FlowGraphCrossVector3Block);\r\n\r\nconst CREATENAME = \"FGCreateVector3Block\";\r\n/**\r\n * Create a vector from its components.\r\n * @experimental\r\n */\r\nexport class FlowGraphCreateVector3Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The x component of the vector.\r\n */\r\n public readonly x: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The y component of the vector.\r\n */\r\n public readonly y: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The z component of the vector.\r\n */\r\n public readonly z: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The created vector.\r\n */\r\n public readonly vector: FlowGraphDataConnection<Vector3>;\r\n\r\n private _cachedVector: Vector3 = Vector3.Zero();\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.x = this._registerDataInput(\"x\", RichTypeNumber);\r\n this.y = this._registerDataInput(\"y\", RichTypeNumber);\r\n this.z = this._registerDataInput(\"y\", RichTypeNumber);\r\n this.vector = this._registerDataOutput(\"vector\", RichTypeVector3);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n this._cachedVector.x = this.x.getValue(_context);\r\n this._cachedVector.y = this.y.getValue(_context);\r\n this._cachedVector.z = this.z.getValue(_context);\r\n this.vector.setValue(this._cachedVector, _context);\r\n }\r\n\r\n public getClassName(): string {\r\n return CREATENAME;\r\n }\r\n}\r\nRegisterClass(CREATENAME, FlowGraphCreateVector3Block);\r\n\r\nconst SPLITNAME = \"FGSplitVector3Block\";\r\n/**\r\n * Split a vector into its components.\r\n * @experimental\r\n */\r\nexport class FlowGraphSplitVector3Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The vector to split.\r\n */\r\n public readonly vector: FlowGraphDataConnection<Vector3>;\r\n /**\r\n * Output connection: The x component of the vector.\r\n */\r\n public readonly x: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The y component of the vector.\r\n */\r\n public readonly y: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The z component of the vector.\r\n */\r\n public readonly z: FlowGraphDataConnection<number>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.vector = this._registerDataInput(\"vector\", RichTypeVector3);\r\n this.x = this._registerDataOutput(\"x\", RichTypeNumber);\r\n this.y = this._registerDataOutput(\"y\", RichTypeNumber);\r\n this.z = this._registerDataOutput(\"z\", RichTypeNumber);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n const vector = this.vector.getValue(_context);\r\n this.x.setValue(vector.x, _context);\r\n this.y.setValue(vector.y, _context);\r\n this.z.setValue(vector.z, _context);\r\n }\r\n\r\n public getClassName(): string {\r\n return SPLITNAME;\r\n }\r\n}\r\nRegisterClass(SPLITNAME, FlowGraphSplitVector3Block);\r\n\r\nconst ROTATENAME = \"FGRotateVector3Block\";\r\n/**\r\n * Rotates a vector by a given angle.\r\n */\r\nexport class FlowGraphRotate3dVector3Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The vector to rotate.\r\n */\r\n public readonly input: FlowGraphDataConnection<Vector3>;\r\n /**\r\n * Input connection: The axis to rotate around.\r\n */\r\n public readonly axis: FlowGraphDataConnection<Vector3>;\r\n /**\r\n * Input connection: The angle to rotate by.\r\n */\r\n public readonly angle: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The rotated vector.\r\n */\r\n public readonly output: FlowGraphDataConnection<Vector3>;\r\n\r\n private _cachedQuaternion = new Quaternion();\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n this.input = this._registerDataInput(\"input\", RichTypeVector3);\r\n this.angle = this._registerDataInput(\"angle\", RichTypeNumber);\r\n this.output = this._registerDataOutput(\"output\", RichTypeVector3);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n const rot = Quaternion.RotationAxisToRef(this.axis.getValue(_context), this.angle.getValue(_context), this._cachedQuaternion);\r\n const input = this.input.getValue(_context);\r\n const output = this.output.getValue(_context);\r\n input.applyRotationQuaternionToRef(rot, output);\r\n }\r\n\r\n public getClassName(): string {\r\n return ROTATENAME;\r\n }\r\n}\r\nRegisterClass(ROTATENAME, FlowGraphRotate3dVector3Block);\r\n\r\nconst TRANSFORMNAME = \"FGTransformVector3Block\";\r\n/**\r\n * Transforms a vector by a given matrix.\r\n * @experimental\r\n */\r\nexport class FlowGraphTransformVector3Block extends FlowGraphBinaryOperationBlock<Matrix, Vector3, Vector3> {\r\n private _cachedResult: Vector3 = Vector3.Zero();\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeMatrix, RichTypeVector3, RichTypeVector3, (left, right) => Vector3.TransformCoordinatesToRef(right, left, this._cachedResult), TRANSFORMNAME, config);\r\n }\r\n}\r\nRegisterClass(TRANSFORMNAME, FlowGraphTransformVector3Block);\r\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { FlowGraphBinaryOperationBlock } from "../flowGraphBinaryOperationBlock";
|
|
2
2
|
import { Vector4 } from "../../../../Maths/math.vector";
|
|
3
3
|
import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock";
|
|
4
|
-
import {
|
|
4
|
+
import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock";
|
|
5
|
+
import { FlowGraphBlock } from "../../../flowGraphBlock";
|
|
5
6
|
import type { FlowGraphContext } from "../../../flowGraphContext";
|
|
6
7
|
import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection";
|
|
7
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphVector4MathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,uCAA0C;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAqC,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D,MAAM,OAAO,GAAG,mBAAmB,CAAC;AACpC;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,6BAAwD;IAClG,YAAY,MAAqC;QAC7C,KAAK,CAAC,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAChH,CAAC;CACJ;AACD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AkB,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QACjE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACvD,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACvD,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACvD,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IAC3D,CAAC;IAEM,cAAc,CAAC,QAA0B;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC;IAEM,YAAY;QACf,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AACD,aAAa,CAAC,SAAS,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import { RichTypeNumber, RichTypeVector4 } from \"core/FlowGraph/flowGraphRichTypes\";\r\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\r\nimport { Vector4 } from \"../../../../Maths/math.vector\";\r\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\r\nimport { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\n\r\nconst ADDNAME = \"FGAddVector4Block\";\r\n/**\r\n * Add two vectors together.\r\n * @experimental\r\n */\r\nexport class FlowGraphAddVector4Block extends FlowGraphBinaryOperationBlock<Vector4, Vector4, Vector4> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector4, RichTypeVector4, RichTypeVector4, (left, right) => left.add(right), ADDNAME, config);\r\n }\r\n}\r\nRegisterClass(ADDNAME, FlowGraphAddVector4Block);\r\n\r\nconst SUBNAME = \"FGSubtractVector4Block\";\r\n/**\r\n * Subtract two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphSubtractVector4Block extends FlowGraphBinaryOperationBlock<Vector4, Vector4, Vector4> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector4, RichTypeVector4, RichTypeVector4, (left, right) => left.subtract(right), SUBNAME, config);\r\n }\r\n}\r\nRegisterClass(SUBNAME, FlowGraphSubtractVector4Block);\r\n\r\nconst MULNAME = \"FGMultiplyVector4Block\";\r\n/**\r\n * Multiply two vectors together.\r\n * @experimental\r\n */\r\nexport class FlowGraphMultiplyVector4Block extends FlowGraphBinaryOperationBlock<Vector4, Vector4, Vector4> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector4, RichTypeVector4, RichTypeVector4, (left, right) => left.multiply(right), MULNAME, config);\r\n }\r\n}\r\nRegisterClass(MULNAME, FlowGraphMultiplyVector4Block);\r\n\r\nconst DIVNAME = \"FGDivideVector4Block\";\r\n/**\r\n * Divide two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphDivideVector4Block extends FlowGraphBinaryOperationBlock<Vector4, Vector4, Vector4> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector4, RichTypeVector4, RichTypeVector4, (left, right) => left.divide(right), DIVNAME, config);\r\n }\r\n}\r\nRegisterClass(DIVNAME, FlowGraphDivideVector4Block);\r\n\r\nconst SCALNAME = \"FGScaleVector4Block\";\r\n/**\r\n * Scale a vector by a number.\r\n * @experimental\r\n */\r\nexport class FlowGraphScaleVector4Block extends FlowGraphBinaryOperationBlock<Vector4, number, Vector4> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector4, RichTypeNumber, RichTypeVector4, (left, right) => left.scale(right), SCALNAME, config);\r\n }\r\n}\r\nRegisterClass(SCALNAME, FlowGraphScaleVector4Block);\r\n\r\nconst LENGTHNAME = \"FGLengthVector4Block\";\r\n/**\r\n * Get the length of a vector.\r\n * @experimental\r\n */\r\nexport class FlowGraphLengthVector4Block extends FlowGraphUnaryOperationBlock<Vector4, number> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector4, RichTypeNumber, (value) => value.length(), LENGTHNAME, config);\r\n }\r\n}\r\nRegisterClass(LENGTHNAME, FlowGraphLengthVector4Block);\r\n\r\nconst NORMALIZENAME = \"FGNormalizeVector4Block\";\r\n/**\r\n * Normalize a vector.\r\n * @experimental\r\n */\r\nexport class FlowGraphNormalizeVector4Block extends FlowGraphUnaryOperationBlock<Vector4, Vector4> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(\r\n RichTypeVector4,\r\n RichTypeVector4,\r\n (value: Vector4) => {\r\n const clone = value.clone();\r\n clone.normalize();\r\n return clone;\r\n },\r\n NORMALIZENAME,\r\n config\r\n );\r\n }\r\n\r\n public getClassName(): string {\r\n return NORMALIZENAME;\r\n }\r\n}\r\nRegisterClass(NORMALIZENAME, FlowGraphNormalizeVector4Block);\r\n\r\nconst CREATENAME = \"FGCreateVector4Block\";\r\n/**\r\n * Create a vector from its components.\r\n * @experimental\r\n */\r\nexport class FlowGraphCreateVector4Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The x component of the vector.\r\n */\r\n public readonly x: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The y component of the vector.\r\n */\r\n public readonly y: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The z component of the vector.\r\n */\r\n public readonly z: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The w component of the vector.\r\n */\r\n public readonly w: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The created vector.\r\n */\r\n public readonly vector: FlowGraphDataConnection<Vector4>;\r\n\r\n private _cachedVector: Vector4 = Vector4.Zero();\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.x = this._registerDataInput(\"x\", RichTypeNumber);\r\n this.y = this._registerDataInput(\"y\", RichTypeNumber);\r\n this.z = this._registerDataInput(\"y\", RichTypeNumber);\r\n this.w = this._registerDataInput(\"w\", RichTypeNumber);\r\n this.vector = this._registerDataOutput(\"vector\", RichTypeVector4);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n this._cachedVector.x = this.x.getValue(_context);\r\n this._cachedVector.y = this.y.getValue(_context);\r\n this._cachedVector.z = this.z.getValue(_context);\r\n this._cachedVector.w = this.w.getValue(_context);\r\n this.vector.setValue(this._cachedVector, _context);\r\n }\r\n\r\n public getClassName(): string {\r\n return CREATENAME;\r\n }\r\n}\r\nRegisterClass(CREATENAME, FlowGraphCreateVector4Block);\r\n\r\nconst SPLITNAME = \"FGSplitVector4Block\";\r\n/**\r\n * Split a vector into its components.\r\n * @experimental\r\n */\r\nexport class FlowGraphSplitVector4Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The vector to split.\r\n */\r\n public readonly vector: FlowGraphDataConnection<Vector4>;\r\n /**\r\n * Output connection: The x component of the vector.\r\n */\r\n public readonly x: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The y component of the vector.\r\n */\r\n public readonly y: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The z component of the vector.\r\n */\r\n public readonly z: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The w component of the vector.\r\n */\r\n public readonly w: FlowGraphDataConnection<number>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.vector = this._registerDataInput(\"vector\", RichTypeVector4);\r\n this.x = this._registerDataOutput(\"x\", RichTypeNumber);\r\n this.y = this._registerDataOutput(\"y\", RichTypeNumber);\r\n this.z = this._registerDataOutput(\"z\", RichTypeNumber);\r\n this.w = this._registerDataOutput(\"w\", RichTypeNumber);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n const vector = this.vector.getValue(_context);\r\n this.x.setValue(vector.x, _context);\r\n this.y.setValue(vector.y, _context);\r\n this.z.setValue(vector.z, _context);\r\n this.w.setValue(vector.w, _context);\r\n }\r\n\r\n public getClassName(): string {\r\n return SPLITNAME;\r\n }\r\n}\r\nRegisterClass(SPLITNAME, FlowGraphSplitVector4Block);\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphVector4MathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,uCAA0C;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D,MAAM,OAAO,GAAG,mBAAmB,CAAC;AACpC;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,6BAAwD;IAClG,YAAY,MAAqC;QAC7C,KAAK,CAAC,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,C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D,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QACjE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACvD,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACvD,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACvD,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IAC3D,CAAC;IAEM,cAAc,CAAC,QAA0B;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC;IAEM,YAAY;QACf,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AACD,aAAa,CAAC,SAAS,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import { RichTypeNumber, RichTypeVector4 } from \"core/FlowGraph/flowGraphRichTypes\";\r\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\r\nimport { Vector4 } from \"../../../../Maths/math.vector\";\r\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\r\nimport type { IFlowGraphBlockConfiguration } from \"../../../flowGraphBlock\";\r\nimport { FlowGraphBlock } from \"../../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\r\n\r\nconst ADDNAME = \"FGAddVector4Block\";\r\n/**\r\n * Add two vectors together.\r\n * @experimental\r\n */\r\nexport class FlowGraphAddVector4Block extends FlowGraphBinaryOperationBlock<Vector4, Vector4, Vector4> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector4, RichTypeVector4, RichTypeVector4, (left, right) => left.add(right), ADDNAME, config);\r\n }\r\n}\r\nRegisterClass(ADDNAME, FlowGraphAddVector4Block);\r\n\r\nconst SUBNAME = \"FGSubtractVector4Block\";\r\n/**\r\n * Subtract two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphSubtractVector4Block extends FlowGraphBinaryOperationBlock<Vector4, Vector4, Vector4> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector4, RichTypeVector4, RichTypeVector4, (left, right) => left.subtract(right), SUBNAME, config);\r\n }\r\n}\r\nRegisterClass(SUBNAME, FlowGraphSubtractVector4Block);\r\n\r\nconst MULNAME = \"FGMultiplyVector4Block\";\r\n/**\r\n * Multiply two vectors together.\r\n * @experimental\r\n */\r\nexport class FlowGraphMultiplyVector4Block extends FlowGraphBinaryOperationBlock<Vector4, Vector4, Vector4> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector4, RichTypeVector4, RichTypeVector4, (left, right) => left.multiply(right), MULNAME, config);\r\n }\r\n}\r\nRegisterClass(MULNAME, FlowGraphMultiplyVector4Block);\r\n\r\nconst DIVNAME = \"FGDivideVector4Block\";\r\n/**\r\n * Divide two vectors.\r\n * @experimental\r\n */\r\nexport class FlowGraphDivideVector4Block extends FlowGraphBinaryOperationBlock<Vector4, Vector4, Vector4> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector4, RichTypeVector4, RichTypeVector4, (left, right) => left.divide(right), DIVNAME, config);\r\n }\r\n}\r\nRegisterClass(DIVNAME, FlowGraphDivideVector4Block);\r\n\r\nconst SCALNAME = \"FGScaleVector4Block\";\r\n/**\r\n * Scale a vector by a number.\r\n * @experimental\r\n */\r\nexport class FlowGraphScaleVector4Block extends FlowGraphBinaryOperationBlock<Vector4, number, Vector4> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector4, RichTypeNumber, RichTypeVector4, (left, right) => left.scale(right), SCALNAME, config);\r\n }\r\n}\r\nRegisterClass(SCALNAME, FlowGraphScaleVector4Block);\r\n\r\nconst LENGTHNAME = \"FGLengthVector4Block\";\r\n/**\r\n * Get the length of a vector.\r\n * @experimental\r\n */\r\nexport class FlowGraphLengthVector4Block extends FlowGraphUnaryOperationBlock<Vector4, number> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(RichTypeVector4, RichTypeNumber, (value) => value.length(), LENGTHNAME, config);\r\n }\r\n}\r\nRegisterClass(LENGTHNAME, FlowGraphLengthVector4Block);\r\n\r\nconst NORMALIZENAME = \"FGNormalizeVector4Block\";\r\n/**\r\n * Normalize a vector.\r\n * @experimental\r\n */\r\nexport class FlowGraphNormalizeVector4Block extends FlowGraphUnaryOperationBlock<Vector4, Vector4> {\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(\r\n RichTypeVector4,\r\n RichTypeVector4,\r\n (value: Vector4) => {\r\n const clone = value.clone();\r\n clone.normalize();\r\n return clone;\r\n },\r\n NORMALIZENAME,\r\n config\r\n );\r\n }\r\n\r\n public getClassName(): string {\r\n return NORMALIZENAME;\r\n }\r\n}\r\nRegisterClass(NORMALIZENAME, FlowGraphNormalizeVector4Block);\r\n\r\nconst CREATENAME = \"FGCreateVector4Block\";\r\n/**\r\n * Create a vector from its components.\r\n * @experimental\r\n */\r\nexport class FlowGraphCreateVector4Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The x component of the vector.\r\n */\r\n public readonly x: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The y component of the vector.\r\n */\r\n public readonly y: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The z component of the vector.\r\n */\r\n public readonly z: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The w component of the vector.\r\n */\r\n public readonly w: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The created vector.\r\n */\r\n public readonly vector: FlowGraphDataConnection<Vector4>;\r\n\r\n private _cachedVector: Vector4 = Vector4.Zero();\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.x = this._registerDataInput(\"x\", RichTypeNumber);\r\n this.y = this._registerDataInput(\"y\", RichTypeNumber);\r\n this.z = this._registerDataInput(\"y\", RichTypeNumber);\r\n this.w = this._registerDataInput(\"w\", RichTypeNumber);\r\n this.vector = this._registerDataOutput(\"vector\", RichTypeVector4);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n this._cachedVector.x = this.x.getValue(_context);\r\n this._cachedVector.y = this.y.getValue(_context);\r\n this._cachedVector.z = this.z.getValue(_context);\r\n this._cachedVector.w = this.w.getValue(_context);\r\n this.vector.setValue(this._cachedVector, _context);\r\n }\r\n\r\n public getClassName(): string {\r\n return CREATENAME;\r\n }\r\n}\r\nRegisterClass(CREATENAME, FlowGraphCreateVector4Block);\r\n\r\nconst SPLITNAME = \"FGSplitVector4Block\";\r\n/**\r\n * Split a vector into its components.\r\n * @experimental\r\n */\r\nexport class FlowGraphSplitVector4Block extends FlowGraphBlock {\r\n /**\r\n * Input connection: The vector to split.\r\n */\r\n public readonly vector: FlowGraphDataConnection<Vector4>;\r\n /**\r\n * Output connection: The x component of the vector.\r\n */\r\n public readonly x: FlowGraphDataConnection<number>;\r\n /**\r\n * Output connection: The y component of the vector.\r\n */\r\n public readonly y: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The z component of the vector.\r\n */\r\n public readonly z: FlowGraphDataConnection<number>;\r\n /**\r\n * Input connection: The w component of the vector.\r\n */\r\n public readonly w: FlowGraphDataConnection<number>;\r\n\r\n constructor(config?: IFlowGraphBlockConfiguration) {\r\n super(config);\r\n\r\n this.vector = this._registerDataInput(\"vector\", RichTypeVector4);\r\n this.x = this._registerDataOutput(\"x\", RichTypeNumber);\r\n this.y = this._registerDataOutput(\"y\", RichTypeNumber);\r\n this.z = this._registerDataOutput(\"z\", RichTypeNumber);\r\n this.w = this._registerDataOutput(\"w\", RichTypeNumber);\r\n }\r\n\r\n public _updateOutputs(_context: FlowGraphContext): void {\r\n const vector = this.vector.getValue(_context);\r\n this.x.setValue(vector.x, _context);\r\n this.y.setValue(vector.y, _context);\r\n this.z.setValue(vector.z, _context);\r\n this.w.setValue(vector.w, _context);\r\n }\r\n\r\n public getClassName(): string {\r\n return SPLITNAME;\r\n }\r\n}\r\nRegisterClass(SPLITNAME, FlowGraphSplitVector4Block);\r\n"]}
|
|
@@ -282,7 +282,7 @@ export class GreasedLinePluginMaterial extends MaterialPluginBase {
|
|
|
282
282
|
grlCounters = grl_nextAndCounters.w;
|
|
283
283
|
|
|
284
284
|
|
|
285
|
-
mat4 grlMatrix = viewProjection *
|
|
285
|
+
mat4 grlMatrix = viewProjection * finalWorld;
|
|
286
286
|
vec4 grlFinalPosition = grlMatrix * vec4( positionUpdated , 1.0 );
|
|
287
287
|
vec4 grlPrevPos = grlMatrix * vec4( grlPrevious + grlPositionOffset, 1.0 );
|
|
288
288
|
vec4 grlNextPos = grlMatrix * vec4( grlNext + grlPositionOffset, 1.0 );
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLinePluginMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLinePluginMaterial.ts"],"names":[],"mappings":"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AC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC;QAC1D,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC5C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAElC,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACjC,CAAC;;AAlqBD;;GAEG;AACoB,oDAA0B,GAAG,2BAA2B,AAA9B,CAA+B;AAkqBpF,aAAa,CAAC,WAAW,yBAAyB,CAAC,0BAA0B,EAAE,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { 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 type { Color3 } from \"../../Maths/math.color\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Material } from \"../material\";\r\nimport { MaterialDefines } from \"../materialDefines\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { BaseTexture } from \"../Textures/baseTexture\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport type { GreasedLineMaterialOptions, IGreasedLineMaterial } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMaterialDefaults } from \"./greasedLineMaterialDefaults\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class MaterialGreasedLineDefines extends MaterialDefines {\r\n /**\r\n * The material has a color option specified\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_HAS_COLOR = false;\r\n /**\r\n * The material's size attenuation optiom\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_SIZE_ATTENUATION = false;\r\n /**\r\n * The type of color distribution is set to line this value equals to true.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = false;\r\n /**\r\n * True if scene is in right handed coordinate system.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = false;\r\n\r\n /**\r\n * True if the line is in camera facing mode\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_CAMERA_FACING = true;\r\n}\r\n\r\n/**\r\n * GreasedLinePluginMaterial for GreasedLineMesh/GreasedLineRibbonMesh.\r\n * Use the GreasedLineBuilder.CreateGreasedLineMaterial function to create and instance of this class.\r\n */\r\nexport class GreasedLinePluginMaterial extends MaterialPluginBase implements IGreasedLineMaterial {\r\n /**\r\n * Plugin name\r\n */\r\n public static readonly GREASED_LINE_MATERIAL_NAME = \"GreasedLinePluginMaterial\";\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n public useColors: boolean;\r\n\r\n /**\r\n * Normalized value of how much of the line will be visible\r\n * 0 - 0% of the line will be visible\r\n * 1 - 100% of the line will be visible\r\n */\r\n public visibility: number;\r\n\r\n /**\r\n * Dash offset\r\n */\r\n public dashOffset: number;\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n public dashRatio: number;\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n public width: number;\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n public colorsSampling: number;\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n public useDash: boolean;\r\n\r\n /**\r\n * The mixing mode of the color paramater. Default value is GreasedLineMeshColorMode.SET\r\n * @see GreasedLineMeshColorMode\r\n */\r\n public colorMode: GreasedLineMeshColorMode;\r\n\r\n /**\r\n * You can provide a colorsTexture to use instead of one generated from the 'colors' option\r\n */\r\n public colorsTexture: Nullable<RawTexture> = null;\r\n\r\n private _scene: Scene;\r\n private _dashCount: number;\r\n private _dashArray: number;\r\n private _color: Nullable<Color3>;\r\n private _colors: Nullable<Color3[]>;\r\n private _colorsDistributionType: GreasedLineMeshColorDistributionType;\r\n private _resolution: Vector2;\r\n private _aspect: number;\r\n private _sizeAttenuation: boolean;\r\n\r\n private _cameraFacing: boolean;\r\n\r\n private _engine: Engine;\r\n\r\n /**\r\n * Creates a new instance of the GreasedLinePluginMaterial\r\n * @param material base material for the plugin\r\n * @param scene the scene\r\n * @param options plugin options\r\n */\r\n constructor(material: Material, scene?: Scene, options?: GreasedLineMaterialOptions) {\r\n options = options || {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n\r\n const defines = new MaterialGreasedLineDefines();\r\n defines.GREASED_LINE_HAS_COLOR = !!options.color && !options.useColors;\r\n defines.GREASED_LINE_SIZE_ATTENUATION = options.sizeAttenuation ?? false;\r\n defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = options.colorDistributionType === GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE;\r\n defines.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = (scene ?? material.getScene()).useRightHandedSystem;\r\n defines.GREASED_LINE_CAMERA_FACING = options.cameraFacing ?? true;\r\n super(material, GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME, 200, defines);\r\n\r\n this._scene = scene ?? material.getScene();\r\n this._engine = this._scene.getEngine();\r\n\r\n this._cameraFacing = options.cameraFacing ?? true;\r\n\r\n this.visibility = options.visibility ?? 1;\r\n this.useDash = options.useDash ?? false;\r\n this.dashRatio = options.dashRatio ?? 0.5;\r\n this.dashOffset = options.dashOffset ?? 0;\r\n this.width = options.width ? options.width : options.sizeAttenuation ? GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED : GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n this._sizeAttenuation = options.sizeAttenuation ?? false;\r\n this.colorMode = options.colorMode ?? GreasedLineMeshColorMode.COLOR_MODE_SET;\r\n this._color = options.color ?? null;\r\n this.useColors = options.useColors ?? false;\r\n this._colorsDistributionType = options.colorDistributionType ?? GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n this.colorsSampling = options.colorsSampling ?? RawTexture.NEAREST_NEAREST;\r\n this._colors = options.colors ?? null;\r\n\r\n this.dashCount = options.dashCount ?? 1; // calculate the _dashArray value, call the setter\r\n this.resolution = options.resolution ?? new Vector2(this._engine.getRenderWidth(), this._engine.getRenderHeight()); // calculate aspect call the setter\r\n\r\n if (options.colorsTexture) {\r\n this.colorsTexture = options.colorsTexture; // colorsTexture from options takes precedence\r\n } else {\r\n if (this._colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${material.name}-colors-texture`, this._colors, this.colorsSampling, this._scene);\r\n } else {\r\n this._color = this._color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR;\r\n GreasedLineTools.PrepareEmptyColorsTexture(this._scene);\r\n }\r\n }\r\n\r\n this._engine.onDisposeObservable.add(() => {\r\n GreasedLineTools.DisposeEmptyColorsTexture();\r\n });\r\n\r\n this._enable(true); // always enabled\r\n }\r\n\r\n /**\r\n * Get the shader attributes\r\n * @param attributes array which will be filled with the attributes\r\n */\r\n getAttributes(attributes: string[]) {\r\n attributes.push(\"grl_offsets\");\r\n attributes.push(\"grl_widths\");\r\n attributes.push(\"grl_colorPointers\");\r\n attributes.push(\"grl_counters\");\r\n if (this._cameraFacing) {\r\n attributes.push(\"grl_previousAndSide\");\r\n attributes.push(\"grl_nextAndCounters\");\r\n } else {\r\n attributes.push(\"grl_slopes\");\r\n }\r\n }\r\n\r\n /**\r\n * Get the shader samplers\r\n * @param samplers\r\n */\r\n 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_singleColor\", size: 3, type: \"vec3\" },\r\n { name: \"grl_dashOptions\", size: 4, type: \"vec4\" },\r\n { name: \"grl_colorMode_visibility_colorsWidth_useColors\", size: 4, type: \"vec4\" },\r\n ];\r\n if (this._cameraFacing) {\r\n ubo.push({ name: \"grl_projection\", size: 16, type: \"mat4\" }, { name: \"grl_aspect_resolution_lineWidth\", size: 4, type: \"vec4\" });\r\n }\r\n\r\n return {\r\n ubo,\r\n vertex: this._cameraFacing\r\n ? `\r\n uniform vec4 grl_aspect_resolution_lineWidth;\r\n uniform mat4 grl_projection;\r\n `\r\n : \"\",\r\n fragment: `\r\n uniform vec4 grl_dashOptions;\r\n uniform 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 if (this._cameraFacing) {\r\n const activeCamera = this._scene.activeCamera;\r\n\r\n if (activeCamera) {\r\n const projection = activeCamera.getProjectionMatrix();\r\n uniformBuffer.updateMatrix(\"grl_projection\", projection);\r\n } else {\r\n throw Error(\"GreasedLinePluginMaterial requires an active camera.\");\r\n }\r\n\r\n const resolutionLineWidth = TmpVectors.Vector4[0];\r\n resolutionLineWidth.x = this._aspect;\r\n resolutionLineWidth.y = this._resolution.x;\r\n resolutionLineWidth.z = this._resolution.y;\r\n resolutionLineWidth.w = this.width;\r\n uniformBuffer.updateVector4(\"grl_aspect_resolution_lineWidth\", resolutionLineWidth);\r\n }\r\n\r\n const dashOptions = TmpVectors.Vector4[0];\r\n dashOptions.x = GreasedLineTools.BooleanToNumber(this.useDash);\r\n dashOptions.y = this._dashArray;\r\n dashOptions.z = this.dashOffset;\r\n dashOptions.w = this.dashRatio;\r\n uniformBuffer.updateVector4(\"grl_dashOptions\", dashOptions);\r\n\r\n const colorModeVisibilityColorsWidthUseColors = TmpVectors.Vector4[1];\r\n colorModeVisibilityColorsWidthUseColors.x = this.colorMode;\r\n colorModeVisibilityColorsWidthUseColors.y = this.visibility;\r\n colorModeVisibilityColorsWidthUseColors.z = this.colorsTexture ? this.colorsTexture.getSize().width : 0;\r\n colorModeVisibilityColorsWidthUseColors.w = GreasedLineTools.BooleanToNumber(this.useColors);\r\n uniformBuffer.updateVector4(\"grl_colorMode_visibility_colorsWidth_useColors\", colorModeVisibilityColorsWidthUseColors);\r\n\r\n if (this._color) {\r\n uniformBuffer.updateColor3(\"grl_singleColor\", this._color);\r\n }\r\n\r\n uniformBuffer.setTexture(\"grl_colors\", this.colorsTexture ?? GreasedLineMaterialDefaults.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 && !this.useColors;\r\n defines.GREASED_LINE_SIZE_ATTENUATION = this._sizeAttenuation;\r\n defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = this._colorsDistributionType === GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE;\r\n defines.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = _scene.useRightHandedSystem;\r\n defines.GREASED_LINE_CAMERA_FACING = this._cameraFacing;\r\n }\r\n\r\n /**\r\n * Get the class name\r\n * @returns class name\r\n */\r\n 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 const obj: any = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_DEFINITIONS: `\r\n attribute float grl_widths;\r\n attribute vec3 grl_offsets;\r\n attribute float grl_colorPointers;\r\n\r\n varying float grlCounters;\r\n varying float grlColorPointer;\r\n\r\n #ifdef GREASED_LINE_CAMERA_FACING\r\n attribute vec4 grl_previousAndSide;\r\n attribute vec4 grl_nextAndCounters;\r\n\r\n vec2 grlFix( vec4 i, float aspect ) {\r\n vec2 res = i.xy / i.w;\r\n res.x *= aspect;\r\n return res;\r\n }\r\n #else\r\n attribute vec3 grl_slopes;\r\n attribute float grl_counters;\r\n #endif\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_UPDATE_POSITION: `\r\n #ifdef GREASED_LINE_CAMERA_FACING\r\n vec3 grlPositionOffset = grl_offsets;\r\n positionUpdated += grlPositionOffset;\r\n #else\r\n positionUpdated = (positionUpdated + grl_offsets) + (grl_slopes * grl_widths);\r\n #endif\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_MAIN_END: `\r\n grlColorPointer = grl_colorPointers;\r\n\r\n #ifdef GREASED_LINE_CAMERA_FACING\r\n\r\n float grlAspect = grl_aspect_resolution_lineWidth.x;\r\n float grlBaseWidth = grl_aspect_resolution_lineWidth.w;\r\n\r\n\r\n vec3 grlPrevious = grl_previousAndSide.xyz;\r\n float grlSide = grl_previousAndSide.w;\r\n\r\n vec3 grlNext = grl_nextAndCounters.xyz;\r\n grlCounters = grl_nextAndCounters.w;\r\n\r\n\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_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\r\n grlNormal.xy *= -.5 * grlWidth;\r\n #else\r\n grlNormal.xy *= .5 * grlWidth;\r\n #endif\r\n\r\n grlNormal *= grl_projection;\r\n\r\n #ifdef GREASED_LINE_SIZE_ATTENUATION\r\n grlNormal.xy *= grlFinalPosition.w;\r\n grlNormal.xy /= ( vec4( grl_aspect_resolution_lineWidth.yz, 0., 1. ) * grl_projection ).xy;\r\n #endif\r\n\r\n grlFinalPosition.xy += grlNormal.xy * grlSide;\r\n gl_Position = grlFinalPosition;\r\n\r\n vPositionW = vec3(grlFinalPosition);\r\n #else\r\n grlCounters = grl_counters;\r\n #endif\r\n `,\r\n };\r\n this._cameraFacing && (obj[\"!gl_Position\\\\=viewProjection\\\\*worldPos;\"] = \"//\"); // not needed for camera facing GRL\r\n return obj;\r\n }\r\n\r\n if (shaderType === \"fragment\") {\r\n return {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_DEFINITIONS: `\r\n varying float grlCounters;\r\n varying float grlColorPointer;\r\n uniform sampler2D grl_colors;\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_MAIN_END: `\r\n float grlColorMode = grl_colorMode_visibility_colorsWidth_useColors.x;\r\n float grlVisibility = grl_colorMode_visibility_colorsWidth_useColors.y;\r\n float grlColorsWidth = grl_colorMode_visibility_colorsWidth_useColors.z;\r\n float grlUseColors = grl_colorMode_visibility_colorsWidth_useColors.w;\r\n\r\n float grlUseDash = grl_dashOptions.x;\r\n float grlDashArray = grl_dashOptions.y;\r\n float grlDashOffset = grl_dashOptions.z;\r\n float grlDashRatio = grl_dashOptions.w;\r\n\r\n gl_FragColor.a *= step(grlCounters, grlVisibility);\r\n if( gl_FragColor.a == 0. ) discard;\r\n\r\n if(grlUseDash == 1.){\r\n gl_FragColor.a *= ceil(mod(grlCounters + grlDashOffset, grlDashArray) - (grlDashArray * grlDashRatio));\r\n if (gl_FragColor.a == 0.) discard;\r\n }\r\n\r\n #ifdef GREASED_LINE_HAS_COLOR\r\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\r\n gl_FragColor.rgb = grl_singleColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\r\n gl_FragColor.rgb += grl_singleColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\r\n gl_FragColor.rgb *= grl_singleColor;\r\n }\r\n #else\r\n if (grlUseColors == 1.) {\r\n #ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\r\n vec4 grlColor = texture2D(grl_colors, vec2(grlCounters, 0.), 0.);\r\n #else\r\n 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\r\n return null;\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 = GreasedLineTools.Color3toRGBAUint8(colors);\r\n this.colorsTexture.update(colorArray);\r\n } else {\r\n this.colorsTexture?.dispose();\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this._material.name}-colors-texture`, colors, this.colorsSampling, this._scene);\r\n }\r\n }\r\n\r\n /**\r\n * Updates the material. Use when material created in lazy mode.\r\n */\r\n public updateLazy() {\r\n if (this._colors) {\r\n this.setColors(this._colors, false, true);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the number of dashes in the line\r\n */\r\n get dashCount() {\r\n return this._dashCount;\r\n }\r\n /**\r\n * Sets the number of dashes in the line\r\n * @param value dash\r\n */\r\n set dashCount(value: number) {\r\n this._dashCount = value;\r\n this._dashArray = 1 / value;\r\n }\r\n\r\n /**\r\n * If set to true the line will be rendered always with the same width regardless how far it is located from the camera.\r\n * Not supported for non camera facing lines.\r\n */\r\n get sizeAttenuation() {\r\n return this._sizeAttenuation;\r\n }\r\n\r\n /**\r\n * Turn on/off size attenuation of the width option and widths array.\r\n * Not supported for non camera facing lines.\r\n * @param value If set to true the line will be rendered always with the same width regardless how far it is located from the camera.\r\n */\r\n set sizeAttenuation(value: boolean) {\r\n this._sizeAttenuation = value;\r\n this.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the color of the line\r\n */\r\n get color() {\r\n return this._color;\r\n }\r\n\r\n /**\r\n * Sets the color of the line\r\n * @param value Color3 or null to clear the color. You need to clear the color if you use colors and useColors = true\r\n */\r\n set color(value: Nullable<Color3>) {\r\n this.setColor(value);\r\n }\r\n\r\n /**\r\n * Sets the color of the line. If set the whole line will be mixed with this color according to the colorMode option.\r\n * @param value color\r\n */\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 greasedLineMaterialOptions.color && this.setColor(greasedLineMaterialOptions.color, true);\r\n greasedLineMaterialOptions.colorDistributionType && (this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType);\r\n greasedLineMaterialOptions.colors && (this.colors = greasedLineMaterialOptions.colors);\r\n greasedLineMaterialOptions.colorsSampling && (this.colorsSampling = greasedLineMaterialOptions.colorsSampling);\r\n greasedLineMaterialOptions.colorMode && (this.colorMode = greasedLineMaterialOptions.colorMode);\r\n greasedLineMaterialOptions.useColors && (this.useColors = greasedLineMaterialOptions.useColors);\r\n greasedLineMaterialOptions.visibility && (this.visibility = greasedLineMaterialOptions.visibility);\r\n greasedLineMaterialOptions.useDash && (this.useDash = greasedLineMaterialOptions.useDash);\r\n greasedLineMaterialOptions.dashCount && (this.dashCount = greasedLineMaterialOptions.dashCount);\r\n greasedLineMaterialOptions.dashRatio && (this.dashRatio = greasedLineMaterialOptions.dashRatio);\r\n greasedLineMaterialOptions.dashOffset && (this.dashOffset = greasedLineMaterialOptions.dashOffset);\r\n greasedLineMaterialOptions.width && (this.width = greasedLineMaterialOptions.width);\r\n greasedLineMaterialOptions.sizeAttenuation && (this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation);\r\n greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);\r\n\r\n if (this.colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this._material.name}-colors-texture`, this.colors, this.colorsSampling, scene);\r\n } else {\r\n GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n this.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param plugin define the config where to copy the info\r\n */\r\n public copyTo(plugin: MaterialPluginBase): void {\r\n const dest = plugin as GreasedLinePluginMaterial;\r\n\r\n dest.colorsTexture?.dispose();\r\n\r\n if (this._colors) {\r\n dest.colorsTexture = GreasedLineTools.CreateColorsTexture(`${dest._material.name}-colors-texture`, this._colors, dest.colorsSampling, this._scene);\r\n }\r\n\r\n dest.setColor(this.color, true);\r\n dest.colorsDistributionType = this.colorsDistributionType;\r\n dest.colorsSampling = this.colorsSampling;\r\n dest.colorMode = this.colorMode;\r\n dest.useColors = this.useColors;\r\n dest.visibility = this.visibility;\r\n dest.useDash = this.useDash;\r\n dest.dashCount = this.dashCount;\r\n dest.dashRatio = this.dashRatio;\r\n dest.dashOffset = this.dashOffset;\r\n dest.width = this.width;\r\n dest.sizeAttenuation = this.sizeAttenuation;\r\n dest.resolution = this.resolution;\r\n\r\n dest.markAllDefinesAsDirty();\r\n }\r\n}\r\n\r\nRegisterClass(`BABYLON.${GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME}`, GreasedLinePluginMaterial);\r\n"]}
|
|
1
|
+
{"version":3,"file":"greasedLinePluginMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLinePluginMaterial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI9D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,oCAAoC,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AACjH,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,eAAe;IAA/D;;QACI;;WAEG;QACH,gEAA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C,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;;AAlqBD;;GAEG;AACoB,oDAA0B,GAAG,2BAA2B,AAA9B,CAA+B;AAkqBpF,aAAa,CAAC,WAAW,yBAAyB,CAAC,0BAA0B,EAAE,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { 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 type { Color3 } from \"../../Maths/math.color\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Material } from \"../material\";\r\nimport { MaterialDefines } from \"../materialDefines\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { BaseTexture } from \"../Textures/baseTexture\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport type { GreasedLineMaterialOptions, IGreasedLineMaterial } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMaterialDefaults } from \"./greasedLineMaterialDefaults\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class MaterialGreasedLineDefines extends MaterialDefines {\r\n /**\r\n * The material has a color option specified\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_HAS_COLOR = false;\r\n /**\r\n * The material's size attenuation optiom\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_SIZE_ATTENUATION = false;\r\n /**\r\n * The type of color distribution is set to line this value equals to true.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = false;\r\n /**\r\n * True if scene is in right handed coordinate system.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = false;\r\n\r\n /**\r\n * True if the line is in camera facing mode\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n GREASED_LINE_CAMERA_FACING = true;\r\n}\r\n\r\n/**\r\n * GreasedLinePluginMaterial for GreasedLineMesh/GreasedLineRibbonMesh.\r\n * Use the GreasedLineBuilder.CreateGreasedLineMaterial function to create and instance of this class.\r\n */\r\nexport class GreasedLinePluginMaterial extends MaterialPluginBase implements IGreasedLineMaterial {\r\n /**\r\n * Plugin name\r\n */\r\n public static readonly GREASED_LINE_MATERIAL_NAME = \"GreasedLinePluginMaterial\";\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n public useColors: boolean;\r\n\r\n /**\r\n * Normalized value of how much of the line will be visible\r\n * 0 - 0% of the line will be visible\r\n * 1 - 100% of the line will be visible\r\n */\r\n public visibility: number;\r\n\r\n /**\r\n * Dash offset\r\n */\r\n public dashOffset: number;\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n public dashRatio: number;\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n public width: number;\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n public colorsSampling: number;\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n public useDash: boolean;\r\n\r\n /**\r\n * The mixing mode of the color paramater. Default value is GreasedLineMeshColorMode.SET\r\n * @see GreasedLineMeshColorMode\r\n */\r\n public colorMode: GreasedLineMeshColorMode;\r\n\r\n /**\r\n * You can provide a colorsTexture to use instead of one generated from the 'colors' option\r\n */\r\n public colorsTexture: Nullable<RawTexture> = null;\r\n\r\n private _scene: Scene;\r\n private _dashCount: number;\r\n private _dashArray: number;\r\n private _color: Nullable<Color3>;\r\n private _colors: Nullable<Color3[]>;\r\n private _colorsDistributionType: GreasedLineMeshColorDistributionType;\r\n private _resolution: Vector2;\r\n private _aspect: number;\r\n private _sizeAttenuation: boolean;\r\n\r\n private _cameraFacing: boolean;\r\n\r\n private _engine: Engine;\r\n\r\n /**\r\n * Creates a new instance of the GreasedLinePluginMaterial\r\n * @param material base material for the plugin\r\n * @param scene the scene\r\n * @param options plugin options\r\n */\r\n constructor(material: Material, scene?: Scene, options?: GreasedLineMaterialOptions) {\r\n options = options || {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n\r\n const defines = new MaterialGreasedLineDefines();\r\n defines.GREASED_LINE_HAS_COLOR = !!options.color && !options.useColors;\r\n defines.GREASED_LINE_SIZE_ATTENUATION = options.sizeAttenuation ?? false;\r\n defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = options.colorDistributionType === GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE;\r\n defines.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = (scene ?? material.getScene()).useRightHandedSystem;\r\n defines.GREASED_LINE_CAMERA_FACING = options.cameraFacing ?? true;\r\n super(material, GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME, 200, defines);\r\n\r\n this._scene = scene ?? material.getScene();\r\n this._engine = this._scene.getEngine();\r\n\r\n this._cameraFacing = options.cameraFacing ?? true;\r\n\r\n this.visibility = options.visibility ?? 1;\r\n this.useDash = options.useDash ?? false;\r\n this.dashRatio = options.dashRatio ?? 0.5;\r\n this.dashOffset = options.dashOffset ?? 0;\r\n this.width = options.width ? options.width : options.sizeAttenuation ? GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED : GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n this._sizeAttenuation = options.sizeAttenuation ?? false;\r\n this.colorMode = options.colorMode ?? GreasedLineMeshColorMode.COLOR_MODE_SET;\r\n this._color = options.color ?? null;\r\n this.useColors = options.useColors ?? false;\r\n this._colorsDistributionType = options.colorDistributionType ?? GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n this.colorsSampling = options.colorsSampling ?? RawTexture.NEAREST_NEAREST;\r\n this._colors = options.colors ?? null;\r\n\r\n this.dashCount = options.dashCount ?? 1; // calculate the _dashArray value, call the setter\r\n this.resolution = options.resolution ?? new Vector2(this._engine.getRenderWidth(), this._engine.getRenderHeight()); // calculate aspect call the setter\r\n\r\n if (options.colorsTexture) {\r\n this.colorsTexture = options.colorsTexture; // colorsTexture from options takes precedence\r\n } else {\r\n if (this._colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${material.name}-colors-texture`, this._colors, this.colorsSampling, this._scene);\r\n } else {\r\n this._color = this._color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR;\r\n GreasedLineTools.PrepareEmptyColorsTexture(this._scene);\r\n }\r\n }\r\n\r\n this._engine.onDisposeObservable.add(() => {\r\n GreasedLineTools.DisposeEmptyColorsTexture();\r\n });\r\n\r\n this._enable(true); // always enabled\r\n }\r\n\r\n /**\r\n * Get the shader attributes\r\n * @param attributes array which will be filled with the attributes\r\n */\r\n getAttributes(attributes: string[]) {\r\n attributes.push(\"grl_offsets\");\r\n attributes.push(\"grl_widths\");\r\n attributes.push(\"grl_colorPointers\");\r\n attributes.push(\"grl_counters\");\r\n if (this._cameraFacing) {\r\n attributes.push(\"grl_previousAndSide\");\r\n attributes.push(\"grl_nextAndCounters\");\r\n } else {\r\n attributes.push(\"grl_slopes\");\r\n }\r\n }\r\n\r\n /**\r\n * Get the shader samplers\r\n * @param samplers\r\n */\r\n 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_singleColor\", size: 3, type: \"vec3\" },\r\n { name: \"grl_dashOptions\", size: 4, type: \"vec4\" },\r\n { name: \"grl_colorMode_visibility_colorsWidth_useColors\", size: 4, type: \"vec4\" },\r\n ];\r\n if (this._cameraFacing) {\r\n ubo.push({ name: \"grl_projection\", size: 16, type: \"mat4\" }, { name: \"grl_aspect_resolution_lineWidth\", size: 4, type: \"vec4\" });\r\n }\r\n\r\n return {\r\n ubo,\r\n vertex: this._cameraFacing\r\n ? `\r\n uniform vec4 grl_aspect_resolution_lineWidth;\r\n uniform mat4 grl_projection;\r\n `\r\n : \"\",\r\n fragment: `\r\n uniform vec4 grl_dashOptions;\r\n uniform 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 if (this._cameraFacing) {\r\n const activeCamera = this._scene.activeCamera;\r\n\r\n if (activeCamera) {\r\n const projection = activeCamera.getProjectionMatrix();\r\n uniformBuffer.updateMatrix(\"grl_projection\", projection);\r\n } else {\r\n throw Error(\"GreasedLinePluginMaterial requires an active camera.\");\r\n }\r\n\r\n const resolutionLineWidth = TmpVectors.Vector4[0];\r\n resolutionLineWidth.x = this._aspect;\r\n resolutionLineWidth.y = this._resolution.x;\r\n resolutionLineWidth.z = this._resolution.y;\r\n resolutionLineWidth.w = this.width;\r\n uniformBuffer.updateVector4(\"grl_aspect_resolution_lineWidth\", resolutionLineWidth);\r\n }\r\n\r\n const dashOptions = TmpVectors.Vector4[0];\r\n dashOptions.x = GreasedLineTools.BooleanToNumber(this.useDash);\r\n dashOptions.y = this._dashArray;\r\n dashOptions.z = this.dashOffset;\r\n dashOptions.w = this.dashRatio;\r\n uniformBuffer.updateVector4(\"grl_dashOptions\", dashOptions);\r\n\r\n const colorModeVisibilityColorsWidthUseColors = TmpVectors.Vector4[1];\r\n colorModeVisibilityColorsWidthUseColors.x = this.colorMode;\r\n colorModeVisibilityColorsWidthUseColors.y = this.visibility;\r\n colorModeVisibilityColorsWidthUseColors.z = this.colorsTexture ? this.colorsTexture.getSize().width : 0;\r\n colorModeVisibilityColorsWidthUseColors.w = GreasedLineTools.BooleanToNumber(this.useColors);\r\n uniformBuffer.updateVector4(\"grl_colorMode_visibility_colorsWidth_useColors\", colorModeVisibilityColorsWidthUseColors);\r\n\r\n if (this._color) {\r\n uniformBuffer.updateColor3(\"grl_singleColor\", this._color);\r\n }\r\n\r\n uniformBuffer.setTexture(\"grl_colors\", this.colorsTexture ?? GreasedLineMaterialDefaults.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 && !this.useColors;\r\n defines.GREASED_LINE_SIZE_ATTENUATION = this._sizeAttenuation;\r\n defines.GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE = this._colorsDistributionType === GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE;\r\n defines.GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM = _scene.useRightHandedSystem;\r\n defines.GREASED_LINE_CAMERA_FACING = this._cameraFacing;\r\n }\r\n\r\n /**\r\n * Get the class name\r\n * @returns class name\r\n */\r\n 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 const obj: any = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_DEFINITIONS: `\r\n attribute float grl_widths;\r\n attribute vec3 grl_offsets;\r\n attribute float grl_colorPointers;\r\n\r\n varying float grlCounters;\r\n varying float grlColorPointer;\r\n\r\n #ifdef GREASED_LINE_CAMERA_FACING\r\n attribute vec4 grl_previousAndSide;\r\n attribute vec4 grl_nextAndCounters;\r\n\r\n vec2 grlFix( vec4 i, float aspect ) {\r\n vec2 res = i.xy / i.w;\r\n res.x *= aspect;\r\n return res;\r\n }\r\n #else\r\n attribute vec3 grl_slopes;\r\n attribute float grl_counters;\r\n #endif\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_UPDATE_POSITION: `\r\n #ifdef GREASED_LINE_CAMERA_FACING\r\n vec3 grlPositionOffset = grl_offsets;\r\n positionUpdated += grlPositionOffset;\r\n #else\r\n positionUpdated = (positionUpdated + grl_offsets) + (grl_slopes * grl_widths);\r\n #endif\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_VERTEX_MAIN_END: `\r\n grlColorPointer = grl_colorPointers;\r\n\r\n #ifdef GREASED_LINE_CAMERA_FACING\r\n\r\n float grlAspect = grl_aspect_resolution_lineWidth.x;\r\n float grlBaseWidth = grl_aspect_resolution_lineWidth.w;\r\n\r\n\r\n vec3 grlPrevious = grl_previousAndSide.xyz;\r\n float grlSide = grl_previousAndSide.w;\r\n\r\n vec3 grlNext = grl_nextAndCounters.xyz;\r\n grlCounters = grl_nextAndCounters.w;\r\n\r\n\r\n mat4 grlMatrix = viewProjection * finalWorld;\r\n vec4 grlFinalPosition = grlMatrix * vec4( positionUpdated , 1.0 );\r\n vec4 grlPrevPos = grlMatrix * vec4( grlPrevious + grlPositionOffset, 1.0 );\r\n vec4 grlNextPos = grlMatrix * vec4( grlNext + grlPositionOffset, 1.0 );\r\n\r\n vec2 grlCurrentP = grlFix( grlFinalPosition, grlAspect );\r\n vec2 grlPrevP = grlFix( grlPrevPos, grlAspect );\r\n vec2 grlNextP = grlFix( grlNextPos, grlAspect );\r\n\r\n float grlWidth = grlBaseWidth * grl_widths;\r\n\r\n vec2 grlDir;\r\n if( grlNextP == grlCurrentP ) grlDir = normalize( grlCurrentP - grlPrevP );\r\n else if( grlPrevP == grlCurrentP ) grlDir = normalize( grlNextP - grlCurrentP );\r\n else {\r\n vec2 grlDir1 = normalize( grlCurrentP - grlPrevP );\r\n vec2 grlDir2 = normalize( grlNextP - grlCurrentP );\r\n grlDir = normalize( grlDir1 + grlDir2 );\r\n }\r\n vec4 grlNormal = vec4( -grlDir.y, grlDir.x, 0., 1. );\r\n #ifdef GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\r\n grlNormal.xy *= -.5 * grlWidth;\r\n #else\r\n grlNormal.xy *= .5 * grlWidth;\r\n #endif\r\n\r\n grlNormal *= grl_projection;\r\n\r\n #ifdef GREASED_LINE_SIZE_ATTENUATION\r\n grlNormal.xy *= grlFinalPosition.w;\r\n grlNormal.xy /= ( vec4( grl_aspect_resolution_lineWidth.yz, 0., 1. ) * grl_projection ).xy;\r\n #endif\r\n\r\n grlFinalPosition.xy += grlNormal.xy * grlSide;\r\n gl_Position = grlFinalPosition;\r\n\r\n vPositionW = vec3(grlFinalPosition);\r\n #else\r\n grlCounters = grl_counters;\r\n #endif\r\n `,\r\n };\r\n this._cameraFacing && (obj[\"!gl_Position\\\\=viewProjection\\\\*worldPos;\"] = \"//\"); // not needed for camera facing GRL\r\n return obj;\r\n }\r\n\r\n if (shaderType === \"fragment\") {\r\n return {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_DEFINITIONS: `\r\n varying float grlCounters;\r\n varying float grlColorPointer;\r\n uniform sampler2D grl_colors;\r\n `,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_MAIN_END: `\r\n float grlColorMode = grl_colorMode_visibility_colorsWidth_useColors.x;\r\n float grlVisibility = grl_colorMode_visibility_colorsWidth_useColors.y;\r\n float grlColorsWidth = grl_colorMode_visibility_colorsWidth_useColors.z;\r\n float grlUseColors = grl_colorMode_visibility_colorsWidth_useColors.w;\r\n\r\n float grlUseDash = grl_dashOptions.x;\r\n float grlDashArray = grl_dashOptions.y;\r\n float grlDashOffset = grl_dashOptions.z;\r\n float grlDashRatio = grl_dashOptions.w;\r\n\r\n gl_FragColor.a *= step(grlCounters, grlVisibility);\r\n if( gl_FragColor.a == 0. ) discard;\r\n\r\n if(grlUseDash == 1.){\r\n gl_FragColor.a *= ceil(mod(grlCounters + grlDashOffset, grlDashArray) - (grlDashArray * grlDashRatio));\r\n if (gl_FragColor.a == 0.) discard;\r\n }\r\n\r\n #ifdef GREASED_LINE_HAS_COLOR\r\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\r\n gl_FragColor.rgb = grl_singleColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\r\n gl_FragColor.rgb += grl_singleColor;\r\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\r\n gl_FragColor.rgb *= grl_singleColor;\r\n }\r\n #else\r\n if (grlUseColors == 1.) {\r\n #ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\r\n vec4 grlColor = texture2D(grl_colors, vec2(grlCounters, 0.), 0.);\r\n #else\r\n 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\r\n return null;\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 = GreasedLineTools.Color3toRGBAUint8(colors);\r\n this.colorsTexture.update(colorArray);\r\n } else {\r\n this.colorsTexture?.dispose();\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this._material.name}-colors-texture`, colors, this.colorsSampling, this._scene);\r\n }\r\n }\r\n\r\n /**\r\n * Updates the material. Use when material created in lazy mode.\r\n */\r\n public updateLazy() {\r\n if (this._colors) {\r\n this.setColors(this._colors, false, true);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the number of dashes in the line\r\n */\r\n get dashCount() {\r\n return this._dashCount;\r\n }\r\n /**\r\n * Sets the number of dashes in the line\r\n * @param value dash\r\n */\r\n set dashCount(value: number) {\r\n this._dashCount = value;\r\n this._dashArray = 1 / value;\r\n }\r\n\r\n /**\r\n * If set to true the line will be rendered always with the same width regardless how far it is located from the camera.\r\n * Not supported for non camera facing lines.\r\n */\r\n get sizeAttenuation() {\r\n return this._sizeAttenuation;\r\n }\r\n\r\n /**\r\n * Turn on/off size attenuation of the width option and widths array.\r\n * Not supported for non camera facing lines.\r\n * @param value If set to true the line will be rendered always with the same width regardless how far it is located from the camera.\r\n */\r\n set sizeAttenuation(value: boolean) {\r\n this._sizeAttenuation = value;\r\n this.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the color of the line\r\n */\r\n get color() {\r\n return this._color;\r\n }\r\n\r\n /**\r\n * Sets the color of the line\r\n * @param value Color3 or null to clear the color. You need to clear the color if you use colors and useColors = true\r\n */\r\n set color(value: Nullable<Color3>) {\r\n this.setColor(value);\r\n }\r\n\r\n /**\r\n * Sets the color of the line. If set the whole line will be mixed with this color according to the colorMode option.\r\n * @param value color\r\n */\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 greasedLineMaterialOptions.color && this.setColor(greasedLineMaterialOptions.color, true);\r\n greasedLineMaterialOptions.colorDistributionType && (this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType);\r\n greasedLineMaterialOptions.colors && (this.colors = greasedLineMaterialOptions.colors);\r\n greasedLineMaterialOptions.colorsSampling && (this.colorsSampling = greasedLineMaterialOptions.colorsSampling);\r\n greasedLineMaterialOptions.colorMode && (this.colorMode = greasedLineMaterialOptions.colorMode);\r\n greasedLineMaterialOptions.useColors && (this.useColors = greasedLineMaterialOptions.useColors);\r\n greasedLineMaterialOptions.visibility && (this.visibility = greasedLineMaterialOptions.visibility);\r\n greasedLineMaterialOptions.useDash && (this.useDash = greasedLineMaterialOptions.useDash);\r\n greasedLineMaterialOptions.dashCount && (this.dashCount = greasedLineMaterialOptions.dashCount);\r\n greasedLineMaterialOptions.dashRatio && (this.dashRatio = greasedLineMaterialOptions.dashRatio);\r\n greasedLineMaterialOptions.dashOffset && (this.dashOffset = greasedLineMaterialOptions.dashOffset);\r\n greasedLineMaterialOptions.width && (this.width = greasedLineMaterialOptions.width);\r\n greasedLineMaterialOptions.sizeAttenuation && (this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation);\r\n greasedLineMaterialOptions.resolution && (this.resolution = greasedLineMaterialOptions.resolution);\r\n\r\n if (this.colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this._material.name}-colors-texture`, this.colors, this.colorsSampling, scene);\r\n } else {\r\n GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n this.markAllDefinesAsDirty();\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param plugin define the config where to copy the info\r\n */\r\n public copyTo(plugin: MaterialPluginBase): void {\r\n const dest = plugin as GreasedLinePluginMaterial;\r\n\r\n dest.colorsTexture?.dispose();\r\n\r\n if (this._colors) {\r\n dest.colorsTexture = GreasedLineTools.CreateColorsTexture(`${dest._material.name}-colors-texture`, this._colors, dest.colorsSampling, this._scene);\r\n }\r\n\r\n dest.setColor(this.color, true);\r\n dest.colorsDistributionType = this.colorsDistributionType;\r\n dest.colorsSampling = this.colorsSampling;\r\n dest.colorMode = this.colorMode;\r\n dest.useColors = this.useColors;\r\n dest.visibility = this.visibility;\r\n dest.useDash = this.useDash;\r\n dest.dashCount = this.dashCount;\r\n dest.dashRatio = this.dashRatio;\r\n dest.dashOffset = this.dashOffset;\r\n dest.width = this.width;\r\n dest.sizeAttenuation = this.sizeAttenuation;\r\n dest.resolution = this.resolution;\r\n\r\n dest.markAllDefinesAsDirty();\r\n }\r\n}\r\n\r\nRegisterClass(`BABYLON.${GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME}`, GreasedLinePluginMaterial);\r\n"]}
|