@babylonjs/core 7.30.0 → 7.31.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/Engines/WebGPU/webgpuCacheBindGroups.js +13 -2
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +2 -3
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +1 -11
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +8 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +43 -34
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.d.ts +32 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js +64 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js.map +1 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.d.ts +48 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +102 -0
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -0
- package/Materials/Node/Blocks/GaussianSplatting/index.d.ts +3 -0
- package/Materials/Node/Blocks/GaussianSplatting/index.js +4 -0
- package/Materials/Node/Blocks/GaussianSplatting/index.js.map +1 -0
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.d.ts +40 -0
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +96 -0
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -0
- package/Materials/Node/Blocks/Input/inputBlock.js +6 -0
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/index.d.ts +1 -0
- package/Materials/Node/Blocks/index.js +1 -0
- package/Materials/Node/Blocks/index.js.map +1 -1
- package/Materials/Node/Enums/nodeMaterialModes.d.ts +3 -1
- package/Materials/Node/Enums/nodeMaterialModes.js +2 -0
- package/Materials/Node/Enums/nodeMaterialModes.js.map +1 -1
- package/Materials/Node/index.d.ts +1 -0
- package/Materials/Node/index.js +1 -0
- package/Materials/Node/index.js.map +1 -1
- package/Materials/Node/nodeMaterialDefault.d.ts +6 -0
- package/Materials/Node/nodeMaterialDefault.js +53 -0
- package/Materials/Node/nodeMaterialDefault.js.map +1 -0
- package/Materials/PBR/pbrBaseMaterial.js +1 -11
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/texture.js +7 -3
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/textureSampler.d.ts +1 -1
- package/Materials/Textures/textureSampler.js.map +1 -1
- package/Materials/material.d.ts +5 -1
- package/Materials/material.js +19 -1
- package/Materials/material.js.map +1 -1
- package/Materials/materialPluginManager.js +2 -2
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/pushMaterial.d.ts +1 -1
- package/Materials/pushMaterial.js +2 -2
- package/Materials/pushMaterial.js.map +1 -1
- package/Materials/standardMaterial.js +1 -11
- package/Materials/standardMaterial.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +11 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +264 -61
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Set/aggregatorBlock.d.ts +76 -0
- package/Meshes/Node/Blocks/Set/aggregatorBlock.js +210 -0
- package/Meshes/Node/Blocks/Set/aggregatorBlock.js.map +1 -0
- package/Meshes/Node/Blocks/booleanGeometryBlock.d.ts +6 -0
- package/Meshes/Node/Blocks/booleanGeometryBlock.js +16 -4
- package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.d.ts +6 -0
- package/Meshes/Node/Blocks/geometryTransformBlock.js +14 -2
- package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
- package/Meshes/Node/index.d.ts +1 -0
- package/Meshes/Node/index.js +1 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/Node/nodeGeometry.d.ts +1 -1
- package/Meshes/Node/nodeGeometry.js +14 -1
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.d.ts +4 -0
- package/Meshes/Node/nodeGeometryBlock.js +6 -0
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/csg.d.ts +1 -0
- package/Meshes/csg.js +1 -0
- package/Meshes/csg.js.map +1 -1
- package/Meshes/csg2.d.ts +131 -0
- package/Meshes/csg2.js +355 -0
- package/Meshes/csg2.js.map +1 -0
- package/Meshes/index.d.ts +1 -0
- package/Meshes/index.js +1 -0
- package/Meshes/index.js.map +1 -1
- package/Meshes/mesh.js +3 -1
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.d.ts +66 -1
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Misc/dumpTools.js +1 -0
- package/Misc/dumpTools.js.map +1 -1
- package/Misc/tools.d.ts +2 -1
- package/Misc/tools.internals.d.ts +13 -0
- package/Misc/tools.internals.js +48 -0
- package/Misc/tools.internals.js.map +1 -0
- package/Misc/tools.js +13 -4
- package/Misc/tools.js.map +1 -1
- package/Morph/morphTarget.js +1 -0
- package/Morph/morphTarget.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.d.ts +5 -0
- package/Shaders/ShadersInclude/gaussianSplatting.js +33 -0
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -0
- package/Shaders/ShadersInclude/gaussianSplattingFragmentDeclaration.d.ts +7 -0
- package/Shaders/ShadersInclude/gaussianSplattingFragmentDeclaration.js +19 -0
- package/Shaders/ShadersInclude/gaussianSplattingFragmentDeclaration.js.map +1 -0
- package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -2
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
- package/Shaders/gaussianSplatting.fragment.d.ts +1 -2
- package/Shaders/gaussianSplatting.fragment.js +5 -10
- package/Shaders/gaussianSplatting.fragment.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.d.ts +1 -0
- package/Shaders/gaussianSplatting.vertex.js +4 -21
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/lod.fragment.js +1 -1
- package/Shaders/lod.fragment.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
|
|
|
3
3
|
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
4
4
|
import { NodeGeometryBlockConnectionPointTypes } from "../Enums/nodeGeometryConnectionPointTypes.js";
|
|
5
5
|
import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
|
|
6
|
-
import {
|
|
6
|
+
import { CSG2, InitializeCSG2Async, IsCSG2Ready } from "../../csg2.js";
|
|
7
7
|
/**
|
|
8
8
|
* Operations supported by the boolean block
|
|
9
9
|
*/
|
|
@@ -20,6 +20,18 @@ export var BooleanGeometryOperations;
|
|
|
20
20
|
* Block used to apply a boolean operation between 2 geometries
|
|
21
21
|
*/
|
|
22
22
|
export class BooleanGeometryBlock extends NodeGeometryBlock {
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
get _isReadyState() {
|
|
27
|
+
if (IsCSG2Ready()) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
if (!this._csg2LoadingPromise) {
|
|
31
|
+
this._csg2LoadingPromise = InitializeCSG2Async();
|
|
32
|
+
}
|
|
33
|
+
return this._csg2LoadingPromise;
|
|
34
|
+
}
|
|
23
35
|
/**
|
|
24
36
|
* Create a new BooleanGeometryBlock
|
|
25
37
|
* @param name defines the block name
|
|
@@ -91,8 +103,8 @@ export class BooleanGeometryBlock extends NodeGeometryBlock {
|
|
|
91
103
|
if (!vertexData1.colors && vertexData0.colors) {
|
|
92
104
|
vertexData1.colors = new Array(vertexCount * 4);
|
|
93
105
|
}
|
|
94
|
-
const CSG0 =
|
|
95
|
-
const CSG1 =
|
|
106
|
+
const CSG0 = CSG2.FromVertexData(vertexData0);
|
|
107
|
+
const CSG1 = CSG2.FromVertexData(vertexData1);
|
|
96
108
|
let boolCSG;
|
|
97
109
|
switch (this.operation) {
|
|
98
110
|
case BooleanGeometryOperations.Intersect:
|
|
@@ -102,7 +114,7 @@ export class BooleanGeometryBlock extends NodeGeometryBlock {
|
|
|
102
114
|
boolCSG = CSG0.subtract(CSG1);
|
|
103
115
|
break;
|
|
104
116
|
case BooleanGeometryOperations.Union:
|
|
105
|
-
boolCSG = CSG0.
|
|
117
|
+
boolCSG = CSG0.add(CSG1);
|
|
106
118
|
break;
|
|
107
119
|
}
|
|
108
120
|
return boolCSG.toVertexData();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booleanGeometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/booleanGeometryBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAGlG,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,GAAG,EAAE,qBAAwB;AAEtC;;GAEG;AACH,MAAM,CAAN,IAAY,yBAOX;AAPD,WAAY,yBAAyB;IACjC,gBAAgB;IAChB,mFAAS,CAAA;IACT,eAAe;IACf,iFAAQ,CAAA;IACR,YAAY;IAC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AC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC3D,IAAI,mBAAmB,CAAC,SAAS,EAAE;YAC/B,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;SAClD;IACL,CAAC;CACJ;AA9IU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;6DAC1F;AAaxB;IARN,sBAAsB,CAAC,WAAW,uCAA+B,UAAU,EAAE;QAC1E,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,yBAAyB,CAAC,SAAS,EAAE;YAClE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,yBAAyB,CAAC,QAAQ,EAAE;YAChE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,yBAAyB,CAAC,KAAK,EAAE;SAC7D;KACJ,CAAC;uDACqD;AAmI3D,aAAa,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { VertexData } from \"../../mesh.vertexData\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { CSG } from \"core/Meshes/csg\";\r\n\r\n/**\r\n * Operations supported by the boolean block\r\n */\r\nexport enum BooleanGeometryOperations {\r\n /** Intersect */\r\n Intersect,\r\n /** Subtract */\r\n Subtract,\r\n /** Union */\r\n Union,\r\n}\r\n\r\n/**\r\n * Block used to apply a boolean operation between 2 geometries\r\n */\r\nexport class BooleanGeometryBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = false;\r\n\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"Intersect\", value: BooleanGeometryOperations.Intersect },\r\n { label: \"Subtract\", value: BooleanGeometryOperations.Subtract },\r\n { label: \"Union\", value: BooleanGeometryOperations.Union },\r\n ],\r\n })\r\n public operation = BooleanGeometryOperations.Intersect;\r\n\r\n /**\r\n * Create a new BooleanGeometryBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"geometry0\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"geometry1\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"BooleanGeometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry0 input component\r\n */\r\n public get geometry0(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the geometry1 input component\r\n */\r\n public get geometry1(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n const vertexData0 = this.geometry0.getConnectedValue(state) as VertexData;\r\n const vertexData1 = this.geometry1.getConnectedValue(state) as VertexData;\r\n\r\n if (!vertexData0 || !vertexData1) {\r\n return null;\r\n }\r\n\r\n const vertexCount = vertexData0.positions!.length / 3;\r\n // Ensure that all the fields are filled to avoid problems later on in the graph\r\n if (!vertexData0.normals && vertexData1.normals) {\r\n vertexData0.normals = new Array<number>(vertexData0.positions!.length);\r\n }\r\n if (!vertexData1.normals && vertexData0.normals) {\r\n vertexData1.normals = new Array<number>(vertexData1.positions!.length);\r\n }\r\n if (!vertexData0.uvs && vertexData1.uvs) {\r\n vertexData0.uvs = new Array<number>(vertexCount * 2);\r\n }\r\n if (!vertexData1.uvs && vertexData0.uvs) {\r\n vertexData1.uvs = new Array<number>(vertexCount * 2);\r\n }\r\n if (!vertexData0.colors && vertexData1.colors) {\r\n vertexData0.colors = new Array<number>(vertexCount * 4);\r\n }\r\n if (!vertexData1.colors && vertexData0.colors) {\r\n vertexData1.colors = new Array<number>(vertexCount * 4);\r\n }\r\n\r\n const CSG0 = CSG.FromVertexData(vertexData0);\r\n const CSG1 = CSG.FromVertexData(vertexData1);\r\n\r\n let boolCSG: CSG;\r\n\r\n switch (this.operation) {\r\n case BooleanGeometryOperations.Intersect:\r\n boolCSG = CSG0.intersect(CSG1);\r\n break;\r\n case BooleanGeometryOperations.Subtract:\r\n boolCSG = CSG0.subtract(CSG1);\r\n break;\r\n case BooleanGeometryOperations.Union:\r\n boolCSG = CSG0.union(CSG1);\r\n break;\r\n }\r\n\r\n return boolCSG.toVertexData();\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n codeString += `${this._codeVariableName}.operation = BABYLON.BooleanGeometryOperations.${BooleanGeometryOperations[this.operation]};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n serializationObject.operation = this.operation;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n if (serializationObject.operation) {\r\n this.operation = serializationObject.operation;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BooleanGeometryBlock\", BooleanGeometryBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"booleanGeometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/booleanGeometryBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAGlG,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,WAAW,EAAE,sBAAyB;AAG1E;;GAEG;AACH,MAAM,CAAN,IAAY,yBAOX;AAPD,WAAY,yBAAyB;IACjC,gBAAgB;IAChB,mFAAS,CAAA;IACT,eAAe;IACf,iFAAQ,CAAA;IACR,YAAY;IACZ,2EAAK,CAAA;AACT,CAAC,EAPW,yBAAyB,KAAzB,yBAAyB,QAOpC;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,iBAAiB;IAsBvD;;OAEG;IACH,IAAoB,aAAa;QAC7B,IAAI,WAAW,EAAE,EAAE;YACf,OAAO,IAAI,CAAC;SACf;QAED,IAAI,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Y,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC3D,IAAI,mBAAmB,CAAC,SAAS,EAAE;YAC/B,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;SAClD;IACL,CAAC;CACJ;AA9JU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;6DAC1F;AAaxB;IARN,sBAAsB,CAAC,WAAW,uCAA+B,UAAU,EAAE;QAC1E,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,yBAAyB,CAAC,SAAS,EAAE;YAClE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,yBAAyB,CAAC,QAAQ,EAAE;YAChE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,yBAAyB,CAAC,KAAK,EAAE;SAC7D;KACJ,CAAC;uDACqD;AAmJ3D,aAAa,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { VertexData } from \"../../mesh.vertexData\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { CSG2, InitializeCSG2Async, IsCSG2Ready } from \"core/Meshes/csg2\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\n/**\r\n * Operations supported by the boolean block\r\n */\r\nexport enum BooleanGeometryOperations {\r\n /** Intersect */\r\n Intersect,\r\n /** Subtract */\r\n Subtract,\r\n /** Union */\r\n Union,\r\n}\r\n\r\n/**\r\n * Block used to apply a boolean operation between 2 geometries\r\n */\r\nexport class BooleanGeometryBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = false;\r\n\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"Intersect\", value: BooleanGeometryOperations.Intersect },\r\n { label: \"Subtract\", value: BooleanGeometryOperations.Subtract },\r\n { label: \"Union\", value: BooleanGeometryOperations.Union },\r\n ],\r\n })\r\n public operation = BooleanGeometryOperations.Intersect;\r\n\r\n private _csg2LoadingPromise: Promise<void>;\r\n /**\r\n * @internal\r\n */\r\n public override get _isReadyState(): Nullable<Promise<void>> {\r\n if (IsCSG2Ready()) {\r\n return null;\r\n }\r\n\r\n if (!this._csg2LoadingPromise) {\r\n this._csg2LoadingPromise = InitializeCSG2Async();\r\n }\r\n\r\n return this._csg2LoadingPromise;\r\n }\r\n\r\n /**\r\n * Create a new BooleanGeometryBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"geometry0\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"geometry1\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"BooleanGeometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry0 input component\r\n */\r\n public get geometry0(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the geometry1 input component\r\n */\r\n public get geometry1(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n const vertexData0 = this.geometry0.getConnectedValue(state) as VertexData;\r\n const vertexData1 = this.geometry1.getConnectedValue(state) as VertexData;\r\n\r\n if (!vertexData0 || !vertexData1) {\r\n return null;\r\n }\r\n\r\n const vertexCount = vertexData0.positions!.length / 3;\r\n // Ensure that all the fields are filled to avoid problems later on in the graph\r\n if (!vertexData0.normals && vertexData1.normals) {\r\n vertexData0.normals = new Array<number>(vertexData0.positions!.length);\r\n }\r\n if (!vertexData1.normals && vertexData0.normals) {\r\n vertexData1.normals = new Array<number>(vertexData1.positions!.length);\r\n }\r\n if (!vertexData0.uvs && vertexData1.uvs) {\r\n vertexData0.uvs = new Array<number>(vertexCount * 2);\r\n }\r\n if (!vertexData1.uvs && vertexData0.uvs) {\r\n vertexData1.uvs = new Array<number>(vertexCount * 2);\r\n }\r\n if (!vertexData0.colors && vertexData1.colors) {\r\n vertexData0.colors = new Array<number>(vertexCount * 4);\r\n }\r\n if (!vertexData1.colors && vertexData0.colors) {\r\n vertexData1.colors = new Array<number>(vertexCount * 4);\r\n }\r\n\r\n const CSG0 = CSG2.FromVertexData(vertexData0);\r\n const CSG1 = CSG2.FromVertexData(vertexData1);\r\n\r\n let boolCSG: CSG2;\r\n\r\n switch (this.operation) {\r\n case BooleanGeometryOperations.Intersect:\r\n boolCSG = CSG0.intersect(CSG1);\r\n break;\r\n case BooleanGeometryOperations.Subtract:\r\n boolCSG = CSG0.subtract(CSG1);\r\n break;\r\n case BooleanGeometryOperations.Union:\r\n boolCSG = CSG0.add(CSG1);\r\n break;\r\n }\r\n\r\n return boolCSG.toVertexData();\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n codeString += `${this._codeVariableName}.operation = BABYLON.BooleanGeometryOperations.${BooleanGeometryOperations[this.operation]};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n serializationObject.operation = this.operation;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n if (serializationObject.operation) {\r\n this.operation = serializationObject.operation;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BooleanGeometryBlock\", BooleanGeometryBlock);\r\n"]}
|
|
@@ -9,6 +9,8 @@ export declare class GeometryTransformBlock extends NodeGeometryBlock {
|
|
|
9
9
|
private _scalingMatrix;
|
|
10
10
|
private _translationMatrix;
|
|
11
11
|
private _scalingRotationMatrix;
|
|
12
|
+
private _pivotMatrix;
|
|
13
|
+
private _backPivotMatrix;
|
|
12
14
|
private _transformMatrix;
|
|
13
15
|
/**
|
|
14
16
|
* Gets or sets a boolean indicating that this block can evaluate context
|
|
@@ -45,6 +47,10 @@ export declare class GeometryTransformBlock extends NodeGeometryBlock {
|
|
|
45
47
|
* Gets the scaling input component
|
|
46
48
|
*/
|
|
47
49
|
get scaling(): NodeGeometryConnectionPoint;
|
|
50
|
+
/**
|
|
51
|
+
* Gets the pivot input component
|
|
52
|
+
*/
|
|
53
|
+
get pivot(): NodeGeometryConnectionPoint;
|
|
48
54
|
/**
|
|
49
55
|
* Gets the output component
|
|
50
56
|
*/
|
|
@@ -18,6 +18,8 @@ export class GeometryTransformBlock extends NodeGeometryBlock {
|
|
|
18
18
|
this._scalingMatrix = new Matrix();
|
|
19
19
|
this._translationMatrix = new Matrix();
|
|
20
20
|
this._scalingRotationMatrix = new Matrix();
|
|
21
|
+
this._pivotMatrix = new Matrix();
|
|
22
|
+
this._backPivotMatrix = new Matrix();
|
|
21
23
|
this._transformMatrix = new Matrix();
|
|
22
24
|
/**
|
|
23
25
|
* Gets or sets a boolean indicating that this block can evaluate context
|
|
@@ -29,6 +31,7 @@ export class GeometryTransformBlock extends NodeGeometryBlock {
|
|
|
29
31
|
this.registerInput("translation", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());
|
|
30
32
|
this.registerInput("rotation", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());
|
|
31
33
|
this.registerInput("scaling", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());
|
|
34
|
+
this.registerInput("pivot", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());
|
|
32
35
|
this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
|
|
33
36
|
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
34
37
|
this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);
|
|
@@ -72,6 +75,12 @@ export class GeometryTransformBlock extends NodeGeometryBlock {
|
|
|
72
75
|
get scaling() {
|
|
73
76
|
return this._inputs[4];
|
|
74
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Gets the pivot input component
|
|
80
|
+
*/
|
|
81
|
+
get pivot() {
|
|
82
|
+
return this._inputs[5];
|
|
83
|
+
}
|
|
75
84
|
/**
|
|
76
85
|
* Gets the output component
|
|
77
86
|
*/
|
|
@@ -97,11 +106,14 @@ export class GeometryTransformBlock extends NodeGeometryBlock {
|
|
|
97
106
|
const scaling = this.scaling.getConnectedValue(state);
|
|
98
107
|
const rotation = this.rotation.getConnectedValue(state);
|
|
99
108
|
const translation = this.translation.getConnectedValue(state);
|
|
109
|
+
const pivot = this.pivot.getConnectedValue(state);
|
|
100
110
|
// Transform
|
|
111
|
+
Matrix.TranslationToRef(-pivot.x, -pivot.y, -pivot.z, this._pivotMatrix);
|
|
101
112
|
Matrix.ScalingToRef(scaling.x, scaling.y, scaling.z, this._scalingMatrix);
|
|
102
113
|
Matrix.RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, this._rotationMatrix);
|
|
103
|
-
Matrix.TranslationToRef(translation.x, translation.y, translation.z, this._translationMatrix);
|
|
104
|
-
this.
|
|
114
|
+
Matrix.TranslationToRef(translation.x + pivot.x, translation.y + pivot.y, translation.z + pivot.z, this._translationMatrix);
|
|
115
|
+
this._pivotMatrix.multiplyToRef(this._scalingMatrix, this._backPivotMatrix);
|
|
116
|
+
this._backPivotMatrix.multiplyToRef(this._rotationMatrix, this._scalingRotationMatrix);
|
|
105
117
|
this._scalingRotationMatrix.multiplyToRef(this._translationMatrix, this._transformMatrix);
|
|
106
118
|
matrix = this._transformMatrix;
|
|
107
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryTransformBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryTransformBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAGnG;;GAEG;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C,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;SAC9D;IACL,CAAC;CACJ;AA3JU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;+DAC3F;AA6JlC,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { Matrix, Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { VertexData } from \"../../../Meshes/mesh.vertexData\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\n\r\n/**\r\n * Block used to apply a transform to a vector / geometry\r\n */\r\nexport class GeometryTransformBlock extends NodeGeometryBlock {\r\n private _rotationMatrix = new Matrix();\r\n private _scalingMatrix = new Matrix();\r\n private _translationMatrix = new Matrix();\r\n private _scalingRotationMatrix = new Matrix();\r\n private _transformMatrix = new Matrix();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Create a new GeometryTransformBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"translation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"GeometryTransformBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the translation input component\r\n */\r\n public get translation(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n if (!this.value.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (state: NodeGeometryBuildState) => {\r\n const value = this.value.getConnectedValue(state);\r\n\r\n if (!value) {\r\n return null;\r\n }\r\n\r\n let matrix: Matrix;\r\n\r\n if (this.matrix.isConnected) {\r\n matrix = this.matrix.getConnectedValue(state);\r\n } else {\r\n const scaling = this.scaling.getConnectedValue(state);\r\n const rotation = this.rotation.getConnectedValue(state);\r\n const translation = this.translation.getConnectedValue(state);\r\n\r\n // Transform\r\n Matrix.ScalingToRef(scaling.x, scaling.y, scaling.z, this._scalingMatrix);\r\n Matrix.RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, this._rotationMatrix);\r\n Matrix.TranslationToRef(translation.x, translation.y, translation.z, this._translationMatrix);\r\n\r\n this._scalingMatrix.multiplyToRef(this._rotationMatrix, this._scalingRotationMatrix);\r\n this._scalingRotationMatrix.multiplyToRef(this._translationMatrix, this._transformMatrix);\r\n matrix = this._transformMatrix;\r\n }\r\n\r\n switch (this.value.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Geometry: {\r\n const geometry = (value as VertexData).clone();\r\n geometry.transform(matrix);\r\n return geometry;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2:\r\n return Vector2.Transform(value, matrix);\r\n case NodeGeometryBlockConnectionPointTypes.Vector3:\r\n return Vector3.TransformCoordinates(value, matrix);\r\n case NodeGeometryBlockConnectionPointTypes.Vector4:\r\n return Vector4.TransformCoordinates(value, matrix);\r\n }\r\n\r\n return null;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTransformBlock\", GeometryTransformBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"geometryTransformBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryTransformBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAGnG;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,iBAAiB;IAgBzD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QApBR,oBAAe,GAAG,IAAI,MAAM,EAAE,CAAC;QAC/B,mBAAc,GAAG,IAAI,MAAM,EAAE,CAAC;QAC9B,uBAAkB,GAAG,IAAI,MAAM,EAAE,CAAC;QAClC,2BAAsB,GAAG,IAAI,MAAM,EAAE,CAAC;QACtC,iBAAY,GAAG,IAAI,MAAM,EAAE,CAAC;QAC5B,qBAAgB,GAAG,IAAI,MAAM,EAAE,CAAC;QAChC,qBAAgB,GAAG,IAAI,MAAM,EAAE,CAAC;QAExC;;;WAGG;QAEI,oBAAe,GAAG,IAAI,CAAC;QAS1B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,aAA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AC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,mBAAmB,CAAC,eAAe,KAAK,SAAS,EAAE;YACnD,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;SAC9D;IACL,CAAC;CACJ;AAtKU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;+DAC3F;AAwKlC,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { Matrix, Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { VertexData } from \"../../../Meshes/mesh.vertexData\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\n\r\n/**\r\n * Block used to apply a transform to a vector / geometry\r\n */\r\nexport class GeometryTransformBlock extends NodeGeometryBlock {\r\n private _rotationMatrix = new Matrix();\r\n private _scalingMatrix = new Matrix();\r\n private _translationMatrix = new Matrix();\r\n private _scalingRotationMatrix = new Matrix();\r\n private _pivotMatrix = new Matrix();\r\n private _backPivotMatrix = new Matrix();\r\n private _transformMatrix = new Matrix();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Create a new GeometryTransformBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"translation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n this.registerInput(\"pivot\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"GeometryTransformBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the translation input component\r\n */\r\n public get translation(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the pivot input component\r\n */\r\n public get pivot(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n if (!this.value.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (state: NodeGeometryBuildState) => {\r\n const value = this.value.getConnectedValue(state);\r\n\r\n if (!value) {\r\n return null;\r\n }\r\n\r\n let matrix: Matrix;\r\n\r\n if (this.matrix.isConnected) {\r\n matrix = this.matrix.getConnectedValue(state);\r\n } else {\r\n const scaling = this.scaling.getConnectedValue(state);\r\n const rotation = this.rotation.getConnectedValue(state);\r\n const translation = this.translation.getConnectedValue(state);\r\n const pivot = this.pivot.getConnectedValue(state);\r\n\r\n // Transform\r\n Matrix.TranslationToRef(-pivot.x, -pivot.y, -pivot.z, this._pivotMatrix);\r\n Matrix.ScalingToRef(scaling.x, scaling.y, scaling.z, this._scalingMatrix);\r\n Matrix.RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, this._rotationMatrix);\r\n Matrix.TranslationToRef(translation.x + pivot.x, translation.y + pivot.y, translation.z + pivot.z, this._translationMatrix);\r\n\r\n this._pivotMatrix.multiplyToRef(this._scalingMatrix, this._backPivotMatrix);\r\n this._backPivotMatrix.multiplyToRef(this._rotationMatrix, this._scalingRotationMatrix);\r\n this._scalingRotationMatrix.multiplyToRef(this._translationMatrix, this._transformMatrix);\r\n matrix = this._transformMatrix;\r\n }\r\n\r\n switch (this.value.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Geometry: {\r\n const geometry = (value as VertexData).clone();\r\n geometry.transform(matrix);\r\n return geometry;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2:\r\n return Vector2.Transform(value, matrix);\r\n case NodeGeometryBlockConnectionPointTypes.Vector3:\r\n return Vector3.TransformCoordinates(value, matrix);\r\n case NodeGeometryBlockConnectionPointTypes.Vector4:\r\n return Vector4.TransformCoordinates(value, matrix);\r\n }\r\n\r\n return null;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTransformBlock\", GeometryTransformBlock);\r\n"]}
|
package/Meshes/Node/index.d.ts
CHANGED
package/Meshes/Node/index.js
CHANGED
|
@@ -80,4 +80,5 @@ export * from "./Blocks/geometryDotBlock.js";
|
|
|
80
80
|
export * from "./Blocks/geometryLengthBlock.js";
|
|
81
81
|
export * from "./Blocks/geometryRotate2dBlock.js";
|
|
82
82
|
export * from "./Blocks/geometryInterceptorBlock.js";
|
|
83
|
+
export * from "./Blocks/Set/aggregatorBlock.js";
|
|
83
84
|
//# sourceMappingURL=index.js.map
|
package/Meshes/Node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB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nD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC","sourcesContent":["export * from \"./nodeGeometry\";\r\nexport * from \"./nodeGeometryBlock\";\r\nexport * from \"./nodeGeometryBlockConnectionPoint\";\r\nexport * from \"./nodeGeometryBuildState\";\r\nexport * from \"./Interfaces/nodeGeometryExecutionContext\";\r\nexport * from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nexport * from \"./Enums/nodeGeometryContextualSources\";\r\nexport * from \"./Blocks/geometryOptimizeBlock\";\r\nexport * from \"./Blocks/geometryOutputBlock\";\r\nexport * from \"./Blocks/geometryInputBlock\";\r\nexport * from \"./Blocks/Sources/planeBlock\";\r\nexport * from \"./Blocks/Sources/boxBlock\";\r\nexport * from \"./Blocks/Sources/meshBlock\";\r\nexport * from \"./Blocks/Sources/icoSphereBlock\";\r\nexport * from \"./Blocks/Sources/sphereBlock\";\r\nexport * from \"./Blocks/Sources/gridBlock\";\r\nexport * from \"./Blocks/Sources/torusBlock\";\r\nexport * from \"./Blocks/Sources/cylinderBlock\";\r\nexport * from \"./Blocks/Sources/capsuleBlock\";\r\nexport * from \"./Blocks/Sources/discBlock\";\r\nexport * from \"./Blocks/Sources/nullBlock\";\r\nexport * from \"./Blocks/Set/setPositionsBlock\";\r\nexport * from \"./Blocks/Set/setNormalsBlock\";\r\nexport * from \"./Blocks/Set/setUVsBlock\";\r\nexport * from \"./Blocks/Set/setColorsBlock\";\r\nexport * from \"./Blocks/Set/setTangentsBlock\";\r\nexport * from \"./Blocks/mathBlock\";\r\nexport * from \"./Blocks/mapRangeBlock\";\r\nexport * from \"./Blocks/conditionBlock\";\r\nexport * from \"./Blocks/randomBlock\";\r\nexport * from \"./Blocks/noiseBlock\";\r\nexport * from \"./Blocks/mergeGeometryBlock\";\r\nexport * from \"./Blocks/geometryCollectionBlock\";\r\nexport * from \"./Blocks/geometryElbowBlock\";\r\nexport * from \"./Blocks/computeNormalsBlock\";\r\nexport * from \"./Blocks/vectorConverterBlock\";\r\nexport * from \"./Blocks/normalizeVectorBlock\";\r\nexport * from \"./Blocks/Set/setMaterialIDBlock\";\r\nexport * from \"./Blocks/Set/latticeBlock\";\r\nexport * from \"./Blocks/geometryTrigonometryBlock\";\r\nexport * from \"./Blocks/geometryTransformBlock\";\r\nexport * from \"./Blocks/Matrices/rotationXBlock\";\r\nexport * from \"./Blocks/Matrices/rotationYBlock\";\r\nexport * from \"./Blocks/Matrices/rotationZBlock\";\r\nexport * from \"./Blocks/Matrices/scalingBlock\";\r\nexport * from \"./Blocks/Matrices/alignBlock\";\r\nexport * from \"./Blocks/Matrices/translationBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVerticesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnFacesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVolumeBlock\";\r\nexport * from \"./Blocks/Instances/instantiateBlock\";\r\nexport * from \"./Blocks/Instances/instantiateLinearBlock\";\r\nexport * from \"./Blocks/Instances/instantiateRadialBlock\";\r\nexport * from \"./Blocks/intFloatConverterBlock\";\r\nexport * from \"./Blocks/debugBlock\";\r\nexport * from \"./Blocks/geometryInfoBlock\";\r\nexport * from \"./Blocks/mappingBlock\";\r\nexport * from \"./Blocks/matrixComposeBlock\";\r\nexport * from \"./Blocks/Teleport/teleportInBlock\";\r\nexport * from \"./Blocks/Teleport/teleportOutBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureFetchBlock\";\r\nexport * from \"./Blocks/boundingBlock\";\r\nexport * from \"./Blocks/booleanGeometryBlock\";\r\nexport * from \"./Blocks/geometryArcTan2Block\";\r\nexport * from \"./Blocks/geometryLerpBlock\";\r\nexport * from \"./Blocks/geometryNLerpBlock\";\r\nexport * from \"./Blocks/geometryStepBlock\";\r\nexport * from \"./Blocks/geometrySmoothStepBlock\";\r\nexport * from \"./Blocks/geometryModBlock\";\r\nexport * from \"./Blocks/geometryPowBlock\";\r\nexport * from \"./Blocks/geometryClampBlock\";\r\nexport * from \"./Blocks/geometryCrossBlock\";\r\nexport * from \"./Blocks/geometryCurveBlock\";\r\nexport * from \"./Blocks/geometryDesaturateBlock\";\r\nexport * from \"./Blocks/geometryPosterizeBlock\";\r\nexport * from \"./Blocks/geometryReplaceColorBlock\";\r\nexport * from \"./Blocks/geometryDistanceBlock\";\r\nexport * from \"./Blocks/geometryDotBlock\";\r\nexport * from \"./Blocks/geometryLengthBlock\";\r\nexport * from \"./Blocks/geometryRotate2dBlock\";\r\nexport * from \"./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\";\r\nexport * from \"./nodeGeometryBuildState\";\r\nexport * from \"./Interfaces/nodeGeometryExecutionContext\";\r\nexport * from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nexport * from \"./Enums/nodeGeometryContextualSources\";\r\nexport * from \"./Blocks/geometryOptimizeBlock\";\r\nexport * from \"./Blocks/geometryOutputBlock\";\r\nexport * from \"./Blocks/geometryInputBlock\";\r\nexport * from \"./Blocks/Sources/planeBlock\";\r\nexport * from \"./Blocks/Sources/boxBlock\";\r\nexport * from \"./Blocks/Sources/meshBlock\";\r\nexport * from \"./Blocks/Sources/icoSphereBlock\";\r\nexport * from \"./Blocks/Sources/sphereBlock\";\r\nexport * from \"./Blocks/Sources/gridBlock\";\r\nexport * from \"./Blocks/Sources/torusBlock\";\r\nexport * from \"./Blocks/Sources/cylinderBlock\";\r\nexport * from \"./Blocks/Sources/capsuleBlock\";\r\nexport * from \"./Blocks/Sources/discBlock\";\r\nexport * from \"./Blocks/Sources/nullBlock\";\r\nexport * from \"./Blocks/Set/setPositionsBlock\";\r\nexport * from \"./Blocks/Set/setNormalsBlock\";\r\nexport * from \"./Blocks/Set/setUVsBlock\";\r\nexport * from \"./Blocks/Set/setColorsBlock\";\r\nexport * from \"./Blocks/Set/setTangentsBlock\";\r\nexport * from \"./Blocks/mathBlock\";\r\nexport * from \"./Blocks/mapRangeBlock\";\r\nexport * from \"./Blocks/conditionBlock\";\r\nexport * from \"./Blocks/randomBlock\";\r\nexport * from \"./Blocks/noiseBlock\";\r\nexport * from \"./Blocks/mergeGeometryBlock\";\r\nexport * from \"./Blocks/geometryCollectionBlock\";\r\nexport * from \"./Blocks/geometryElbowBlock\";\r\nexport * from \"./Blocks/computeNormalsBlock\";\r\nexport * from \"./Blocks/vectorConverterBlock\";\r\nexport * from \"./Blocks/normalizeVectorBlock\";\r\nexport * from \"./Blocks/Set/setMaterialIDBlock\";\r\nexport * from \"./Blocks/Set/latticeBlock\";\r\nexport * from \"./Blocks/geometryTrigonometryBlock\";\r\nexport * from \"./Blocks/geometryTransformBlock\";\r\nexport * from \"./Blocks/Matrices/rotationXBlock\";\r\nexport * from \"./Blocks/Matrices/rotationYBlock\";\r\nexport * from \"./Blocks/Matrices/rotationZBlock\";\r\nexport * from \"./Blocks/Matrices/scalingBlock\";\r\nexport * from \"./Blocks/Matrices/alignBlock\";\r\nexport * from \"./Blocks/Matrices/translationBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVerticesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnFacesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVolumeBlock\";\r\nexport * from \"./Blocks/Instances/instantiateBlock\";\r\nexport * from \"./Blocks/Instances/instantiateLinearBlock\";\r\nexport * from \"./Blocks/Instances/instantiateRadialBlock\";\r\nexport * from \"./Blocks/intFloatConverterBlock\";\r\nexport * from \"./Blocks/debugBlock\";\r\nexport * from \"./Blocks/geometryInfoBlock\";\r\nexport * from \"./Blocks/mappingBlock\";\r\nexport * from \"./Blocks/matrixComposeBlock\";\r\nexport * from \"./Blocks/Teleport/teleportInBlock\";\r\nexport * from \"./Blocks/Teleport/teleportOutBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureFetchBlock\";\r\nexport * from \"./Blocks/boundingBlock\";\r\nexport * from \"./Blocks/booleanGeometryBlock\";\r\nexport * from \"./Blocks/geometryArcTan2Block\";\r\nexport * from \"./Blocks/geometryLerpBlock\";\r\nexport * from \"./Blocks/geometryNLerpBlock\";\r\nexport * from \"./Blocks/geometryStepBlock\";\r\nexport * from \"./Blocks/geometrySmoothStepBlock\";\r\nexport * from \"./Blocks/geometryModBlock\";\r\nexport * from \"./Blocks/geometryPowBlock\";\r\nexport * from \"./Blocks/geometryClampBlock\";\r\nexport * from \"./Blocks/geometryCrossBlock\";\r\nexport * from \"./Blocks/geometryCurveBlock\";\r\nexport * from \"./Blocks/geometryDesaturateBlock\";\r\nexport * from \"./Blocks/geometryPosterizeBlock\";\r\nexport * from \"./Blocks/geometryReplaceColorBlock\";\r\nexport * from \"./Blocks/geometryDistanceBlock\";\r\nexport * from \"./Blocks/geometryDotBlock\";\r\nexport * from \"./Blocks/geometryLengthBlock\";\r\nexport * from \"./Blocks/geometryRotate2dBlock\";\r\nexport * from \"./Blocks/geometryInterceptorBlock\";\r\nexport * from \"./Blocks/Set/aggregatorBlock\";\r\n"]}
|
|
@@ -112,7 +112,7 @@ export declare class NodeGeometry {
|
|
|
112
112
|
*/
|
|
113
113
|
private _createNodeEditor;
|
|
114
114
|
/**
|
|
115
|
-
* Build the final geometry
|
|
115
|
+
* Build the final geometry. Please note that the geometry MAY not be ready until the onBuildObservable is raised.
|
|
116
116
|
* @param verbose defines if the build should log activity
|
|
117
117
|
* @param updateBuildId defines if the internal build Id should be updated (default is true)
|
|
118
118
|
* @param autoConfigure defines if the autoConfigure method should be called when initializing blocks (default is false)
|
|
@@ -159,7 +159,7 @@ export class NodeGeometry {
|
|
|
159
159
|
this.BJSNODEGEOMETRYEDITOR.NodeGeometryEditor.Show(nodeEditorConfig);
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
|
-
* Build the final geometry
|
|
162
|
+
* Build the final geometry. Please note that the geometry MAY not be ready until the onBuildObservable is raised.
|
|
163
163
|
* @param verbose defines if the build should log activity
|
|
164
164
|
* @param updateBuildId defines if the internal build Id should be updated (default is true)
|
|
165
165
|
* @param autoConfigure defines if the autoConfigure method should be called when initializing blocks (default is false)
|
|
@@ -173,6 +173,19 @@ export class NodeGeometry {
|
|
|
173
173
|
const now = PrecisionDate.Now;
|
|
174
174
|
// Initialize blocks
|
|
175
175
|
this._initializeBlock(this.outputBlock, autoConfigure);
|
|
176
|
+
// Check async states
|
|
177
|
+
const promises = [];
|
|
178
|
+
for (const block of this.attachedBlocks) {
|
|
179
|
+
if (block._isReadyState) {
|
|
180
|
+
promises.push(block._isReadyState);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (promises.length) {
|
|
184
|
+
Promise.all(promises).then(() => {
|
|
185
|
+
this.build(verbose, updateBuildId, autoConfigure);
|
|
186
|
+
});
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
176
189
|
// Build
|
|
177
190
|
const state = new NodeGeometryBuildState();
|
|
178
191
|
state.buildId = this._buildId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeGeometry.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/nodeGeometry.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAoB7D;;;GAGG;AACH,MAAM,OAAO,YAAY;IAgBrB,mDAAmD;IAC3C,4BAA4B;QAChC,0DAA0D;QAC1D,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE;YAC3C,OAAO,kBAAkB,CAAC;SAC7B;QAED,gFAAgF;QAChF,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,OAAO,CAAC,kBAAkB,KAAK,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BAAC,OAAO,GAAG,EAAE;4BACV,MAAM,CAAC,GAAG,CAAC,CAAC;yBACf;qBACJ;yBAAM;wBACH,MAAM,CAAC,6BAA6B,GAAG,SAAS,CAAC,CAAC;qBACrD;iBACJ;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;;AAlpBc,8BAAiB,GAAW,CAAC,AAAZ,CAAa;AAM7C,gDAAgD;AAClC,sBAAS,GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,cAAc,CAAC,OAAO,mDAAmD,AAAxG,CAAyG;AAEhI,sCAAsC;AACxB,uBAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AAuDzC;IADN,SAAS,EAAE;0CACQ;AAMb;IADN,SAAS,CAAC,SAAS,CAAC;6CACE","sourcesContent":["import { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Mesh } from \"../mesh\";\r\nimport type { VertexData } from \"../mesh.vertexData\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { GeometryOutputBlock } from \"./Blocks/geometryOutputBlock\";\r\nimport type { NodeGeometryBlock } from \"./nodeGeometryBlock\";\r\nimport { NodeGeometryBuildState } from \"./nodeGeometryBuildState\";\r\nimport { GetClass } from \"../../Misc/typeStore\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { WebRequest } from \"../../Misc/webRequest\";\r\nimport { BoxBlock } from \"./Blocks/Sources/boxBlock\";\r\nimport type { GeometryInputBlock } from \"./Blocks/geometryInputBlock\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\nimport type { TeleportOutBlock } from \"./Blocks/Teleport/teleportOutBlock\";\r\nimport type { TeleportInBlock } from \"./Blocks/Teleport/teleportInBlock\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Color4 } from \"../../Maths/math.color\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\n\r\n// declare NODEGEOMETRYEDITOR namespace for compilation issue\r\ndeclare let NODEGEOMETRYEDITOR: any;\r\ndeclare let BABYLON: any;\r\n\r\n/**\r\n * Interface used to configure the node geometry editor\r\n */\r\nexport interface INodeGeometryEditorOptions {\r\n /** Define the URL to load node editor script from */\r\n editorURL?: string;\r\n /** Additional configuration for the NGE */\r\n nodeGeometryEditorConfig?: {\r\n backgroundColor?: Color4;\r\n hostScene?: Scene;\r\n hostMesh?: Mesh;\r\n };\r\n}\r\n\r\n/**\r\n * Defines a node based geometry\r\n * @see demo at https://playground.babylonjs.com#PYY6XE#69\r\n */\r\nexport class NodeGeometry {\r\n private static _BuildIdGenerator: number = 0;\r\n private _buildId: number = NodeGeometry._BuildIdGenerator++;\r\n private _buildWasSuccessful = false;\r\n private _vertexData: Nullable<VertexData> = null;\r\n private _buildExecutionTime: number = 0;\r\n\r\n /** Define the Url to load node editor script */\r\n public static EditorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/nodeGeometryEditor/babylon.nodeGeometryEditor.js`;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private BJSNODEGEOMETRYEDITOR = this._getGlobalNodeGeometryEditor();\r\n\r\n /** @returns the inspector from bundle or global */\r\n private _getGlobalNodeGeometryEditor(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof NODEGEOMETRYEDITOR !== \"undefined\") {\r\n return NODEGEOMETRYEDITOR;\r\n }\r\n\r\n // In case of module let's check the global emitted from the editor entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.NodeGeometryEditor !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the time spent to build this block (in ms)\r\n */\r\n public get buildExecutionTime() {\r\n return this._buildExecutionTime;\r\n }\r\n\r\n /**\r\n * Gets or sets data used by visual editor\r\n * @see https://nge.babylonjs.com\r\n */\r\n public editorData: any = null;\r\n\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n public attachedBlocks: NodeGeometryBlock[] = [];\r\n\r\n /**\r\n * Observable raised when the geometry is built\r\n */\r\n public onBuildObservable = new Observable<NodeGeometry>();\r\n\r\n /** Gets or sets the GeometryOutputBlock used to gather the final geometry data */\r\n public outputBlock: Nullable<GeometryOutputBlock> = null;\r\n\r\n /**\r\n * Snippet ID if the material was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * The name of the geometry\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * A free comment about the geometry\r\n */\r\n @serialize(\"comment\")\r\n public comment: string;\r\n\r\n /**\r\n * Creates a new geometry\r\n * @param name defines the name of the geometry\r\n */\r\n public constructor(name: string) {\r\n this.name = name;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the geometry e.g. \"NodeGeometry\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeGeometry\";\r\n }\r\n\r\n /**\r\n * Gets the vertex data. This needs to be done after build() was called.\r\n * This is used to access vertexData when creating a mesh is not required.\r\n */\r\n public get vertexData() {\r\n return this._vertexData;\r\n }\r\n\r\n /**\r\n * Get a block by its name\r\n * @param name defines the name of the block to retrieve\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByName(name: string) {\r\n let result = null;\r\n for (const block of this.attachedBlocks) {\r\n if (block.name === name) {\r\n if (!result) {\r\n result = block;\r\n } else {\r\n Tools.Warn(\"More than one block was found with the name `\" + name + \"`\");\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get a block using a predicate\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByPredicate(predicate: (block: NodeGeometryBlock) => boolean) {\r\n for (const block of this.attachedBlocks) {\r\n if (predicate(block)) {\r\n return block;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n public getInputBlocks() {\r\n const blocks: GeometryInputBlock[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput) {\r\n blocks.push(block as GeometryInputBlock);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Launch the node geometry editor\r\n * @param config Define the configuration of the editor\r\n * @returns a promise fulfilled when the node editor is visible\r\n */\r\n public edit(config?: INodeGeometryEditorOptions): Promise<void> {\r\n return new Promise((resolve) => {\r\n this.BJSNODEGEOMETRYEDITOR = this.BJSNODEGEOMETRYEDITOR || this._getGlobalNodeGeometryEditor();\r\n if (typeof this.BJSNODEGEOMETRYEDITOR == \"undefined\") {\r\n const editorUrl = config && config.editorURL ? config.editorURL : NodeGeometry.EditorURL;\r\n\r\n // Load editor and add it to the DOM\r\n Tools.LoadBabylonScript(editorUrl, () => {\r\n this.BJSNODEGEOMETRYEDITOR = this.BJSNODEGEOMETRYEDITOR || this._getGlobalNodeGeometryEditor();\r\n this._createNodeEditor(config?.nodeGeometryEditorConfig);\r\n resolve();\r\n });\r\n } else {\r\n // Otherwise creates the editor\r\n this._createNodeEditor(config?.nodeGeometryEditorConfig);\r\n resolve();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the node editor window.\r\n * @param additionalConfig Additional configuration for the NGE\r\n */\r\n private _createNodeEditor(additionalConfig?: any) {\r\n const nodeEditorConfig: any = {\r\n nodeGeometry: this,\r\n ...additionalConfig,\r\n };\r\n this.BJSNODEGEOMETRYEDITOR.NodeGeometryEditor.Show(nodeEditorConfig);\r\n }\r\n\r\n /**\r\n * Build the final geometry\r\n * @param verbose defines if the build should log activity\r\n * @param updateBuildId defines if the internal build Id should be updated (default is true)\r\n * @param autoConfigure defines if the autoConfigure method should be called when initializing blocks (default is false)\r\n */\r\n public build(verbose: boolean = false, updateBuildId = true, autoConfigure = false) {\r\n this._buildWasSuccessful = false;\r\n\r\n if (!this.outputBlock) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"You must define the outputBlock property before building the geometry\";\r\n }\r\n const now = PrecisionDate.Now;\r\n // Initialize blocks\r\n this._initializeBlock(this.outputBlock, autoConfigure);\r\n\r\n // Build\r\n const state = new NodeGeometryBuildState();\r\n\r\n state.buildId = this._buildId;\r\n state.verbose = verbose;\r\n\r\n this.outputBlock.build(state);\r\n\r\n if (updateBuildId) {\r\n this._buildId = NodeGeometry._BuildIdGenerator++;\r\n }\r\n\r\n this._buildExecutionTime = PrecisionDate.Now - now;\r\n\r\n // Errors\r\n state.emitErrors();\r\n\r\n this._buildWasSuccessful = true;\r\n this._vertexData = state.vertexData;\r\n this.onBuildObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Creates a mesh from the geometry blocks\r\n * @param name defines the name of the mesh\r\n * @param scene The scene the mesh is scoped to\r\n * @returns The new mesh\r\n */\r\n public createMesh(name: string, scene: Nullable<Scene> = null): Nullable<Mesh> {\r\n if (!this._buildWasSuccessful) {\r\n this.build();\r\n }\r\n\r\n if (!this._vertexData) {\r\n return null;\r\n }\r\n\r\n const mesh = new Mesh(name, scene);\r\n this._vertexData.applyToMesh(mesh);\r\n\r\n mesh._internalMetadata = mesh._internalMetadata || {};\r\n mesh._internalMetadata.nodeGeometry = this;\r\n\r\n return mesh;\r\n }\r\n\r\n /**\r\n * Creates a mesh from the geometry blocks\r\n * @param mesh the mesh to update\r\n * @returns True if successfully updated\r\n */\r\n public updateMesh(mesh: Mesh) {\r\n if (!this._buildWasSuccessful) {\r\n this.build();\r\n }\r\n\r\n if (!this._vertexData) {\r\n return false;\r\n }\r\n\r\n this._vertexData.applyToMesh(mesh);\r\n\r\n mesh._internalMetadata = mesh._internalMetadata || {};\r\n mesh._internalMetadata.nodeGeometry = this;\r\n\r\n return mesh;\r\n }\r\n\r\n private _initializeBlock(node: NodeGeometryBlock, autoConfigure = true) {\r\n node.initialize();\r\n if (autoConfigure) {\r\n node.autoConfigure();\r\n }\r\n node._preparationId = this._buildId;\r\n\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n\r\n for (const input of node.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._initializeBlock(block, autoConfigure);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current geometry\r\n */\r\n public clear() {\r\n this.outputBlock = null;\r\n this.attachedBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * Remove a block from the current geometry\r\n * @param block defines the block to remove\r\n */\r\n public removeBlock(block: NodeGeometryBlock) {\r\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\r\n if (attachedBlockIndex > -1) {\r\n this.attachedBlocks.splice(attachedBlockIndex, 1);\r\n }\r\n\r\n if (block === this.outputBlock) {\r\n this.outputBlock = null;\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the geometry\r\n * @param merge defines whether or not the source must be merged or replace the current content\r\n */\r\n public parseSerializedObject(source: any, merge = false) {\r\n if (!merge) {\r\n this.clear();\r\n }\r\n\r\n const map: { [key: number]: NodeGeometryBlock } = {};\r\n\r\n // Create blocks\r\n for (const parsedBlock of source.blocks) {\r\n const blockType = GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n const block: NodeGeometryBlock = new blockType();\r\n block._deserialize(parsedBlock);\r\n map[parsedBlock.id] = block;\r\n\r\n this.attachedBlocks.push(block);\r\n }\r\n }\r\n\r\n // Reconnect teleportation\r\n for (const block of this.attachedBlocks) {\r\n if (block.isTeleportOut) {\r\n const teleportOut = block as TeleportOutBlock;\r\n const id = teleportOut._tempEntryPointUniqueId;\r\n if (id) {\r\n const source = map[id] as TeleportInBlock;\r\n if (source) {\r\n source.attachToEndpoint(teleportOut);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\r\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n const parsedBlock = source.blocks[blockIndex];\r\n const block = map[parsedBlock.id];\r\n\r\n if (!block) {\r\n continue;\r\n }\r\n\r\n if (block.inputs.length && parsedBlock.inputs.some((i: any) => i.targetConnectionName) && !merge) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n\r\n // Outputs\r\n if (source.outputNodeId) {\r\n this.outputBlock = map[source.outputNodeId] as GeometryOutputBlock;\r\n }\r\n\r\n // UI related info\r\n if (source.locations || (source.editorData && source.editorData.locations)) {\r\n const locations: {\r\n blockId: number;\r\n x: number;\r\n y: number;\r\n }[] = source.locations || source.editorData.locations;\r\n\r\n for (const location of locations) {\r\n if (map[location.blockId]) {\r\n location.blockId = map[location.blockId].uniqueId;\r\n }\r\n }\r\n\r\n if (merge && this.editorData && this.editorData.locations) {\r\n locations.concat(this.editorData.locations);\r\n }\r\n\r\n if (source.locations) {\r\n this.editorData = {\r\n locations: locations,\r\n };\r\n } else {\r\n this.editorData = source.editorData;\r\n this.editorData.locations = locations;\r\n }\r\n\r\n const blockMap: number[] = [];\r\n\r\n for (const key in map) {\r\n blockMap[key] = map[key].uniqueId;\r\n }\r\n\r\n this.editorData.map = blockMap;\r\n }\r\n\r\n this.comment = source.comment;\r\n }\r\n\r\n private _restoreConnections(block: NodeGeometryBlock, source: any, map: { [key: number]: NodeGeometryBlock }) {\r\n for (const outputPoint of block.outputs) {\r\n for (const candidate of source.blocks) {\r\n const target = map[candidate.id];\r\n\r\n if (!target) {\r\n continue;\r\n }\r\n\r\n for (const input of candidate.inputs) {\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n const inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Generate a string containing the code declaration required to create an equivalent of this geometry\r\n * @returns a string\r\n */\r\n public generateCode() {\r\n let alreadyDumped: NodeGeometryBlock[] = [];\r\n const blocks: NodeGeometryBlock[] = [];\r\n const uniqueNames: string[] = [\"const\", \"var\", \"let\"];\r\n // Gets active blocks\r\n if (this.outputBlock) {\r\n this._gatherBlocks(this.outputBlock, blocks);\r\n }\r\n\r\n // Generate\r\n let codeString = `let nodeGeometry = new BABYLON.NodeGeometry(\"${this.name || \"node geometry\"}\");\\n`;\r\n for (const node of blocks) {\r\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\r\n codeString += node._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n\r\n if (this.outputBlock) {\r\n // Connections\r\n alreadyDumped = [];\r\n codeString += \"// Connections\\n\";\r\n codeString += this.outputBlock._dumpCodeForOutputConnections(alreadyDumped);\r\n\r\n // Output nodes\r\n codeString += \"// Output nodes\\n\";\r\n codeString += `nodeGeometry.outputBlock = ${this.outputBlock._codeVariableName};\\n`;\r\n codeString += `nodeGeometry.build();\\n`;\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n private _gatherBlocks(rootNode: NodeGeometryBlock, list: NodeGeometryBlock[]) {\r\n if (list.indexOf(rootNode) !== -1) {\r\n return;\r\n }\r\n list.push(rootNode);\r\n\r\n for (const input of rootNode.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== rootNode) {\r\n this._gatherBlocks(block, list);\r\n }\r\n }\r\n }\r\n\r\n // Teleportation\r\n if (rootNode.isTeleportOut) {\r\n const block = rootNode as TeleportOutBlock;\r\n if (block.entryPoint) {\r\n this._gatherBlocks(block.entryPoint, list);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current geometry and set it to a default state\r\n */\r\n public setToDefault() {\r\n this.clear();\r\n\r\n this.editorData = null;\r\n\r\n // Source\r\n const dataBlock = new BoxBlock(\"Box\");\r\n dataBlock.autoConfigure();\r\n\r\n // Final output\r\n const output = new GeometryOutputBlock(\"Geometry Output\");\r\n dataBlock.geometry.connectTo(output.geometry);\r\n\r\n this.outputBlock = output;\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current geometry.\r\n * @param name defines the name to use for the new geometry\r\n * @returns the new geometry\r\n */\r\n public clone(name: string): NodeGeometry {\r\n const serializationObject = this.serialize();\r\n\r\n const clone = SerializationHelper.Clone(() => new NodeGeometry(name), this);\r\n clone.name = name;\r\n\r\n clone.parseSerializedObject(serializationObject);\r\n clone._buildId = this._buildId;\r\n clone.build(false);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serializes this geometry in a JSON representation\r\n * @param selectedBlocks defines the list of blocks to save (if null the whole geometry will be saved)\r\n * @returns the serialized geometry object\r\n */\r\n public serialize(selectedBlocks?: NodeGeometryBlock[]): any {\r\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\r\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\r\n\r\n let blocks: NodeGeometryBlock[] = [];\r\n\r\n if (selectedBlocks) {\r\n blocks = selectedBlocks;\r\n } else {\r\n serializationObject.customType = \"BABYLON.NodeGeometry\";\r\n if (this.outputBlock) {\r\n serializationObject.outputNodeId = this.outputBlock.uniqueId;\r\n }\r\n }\r\n\r\n // Blocks\r\n serializationObject.blocks = [];\r\n\r\n for (const block of blocks) {\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n\r\n if (!selectedBlocks) {\r\n for (const block of this.attachedBlocks) {\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Disposes the ressources\r\n */\r\n public dispose(): void {\r\n for (const block of this.attachedBlocks) {\r\n block.dispose();\r\n }\r\n\r\n this.attachedBlocks.length = 0;\r\n this.onBuildObservable.clear();\r\n }\r\n\r\n /**\r\n * Creates a new node geometry set to default basic configuration\r\n * @param name defines the name of the geometry\r\n * @returns a new NodeGeometry\r\n */\r\n public static CreateDefault(name: string) {\r\n const nodeGeometry = new NodeGeometry(name);\r\n\r\n nodeGeometry.setToDefault();\r\n nodeGeometry.build();\r\n\r\n return nodeGeometry;\r\n }\r\n\r\n /**\r\n * Creates a node geometry from parsed geometry data\r\n * @param source defines the JSON representation of the geometry\r\n * @returns a new node geometry\r\n */\r\n public static Parse(source: any): NodeGeometry {\r\n const nodeGeometry = SerializationHelper.Parse(() => new NodeGeometry(source.name), source, null);\r\n\r\n nodeGeometry.parseSerializedObject(source);\r\n nodeGeometry.build();\r\n\r\n return nodeGeometry;\r\n }\r\n\r\n /**\r\n * Creates a node geometry from a snippet saved by the node geometry editor\r\n * @param snippetId defines the snippet to load\r\n * @param nodeGeometry defines a node geometry to update (instead of creating a new one)\r\n * @param skipBuild defines whether to build the node geometry\r\n * @returns a promise that will resolve to the new node geometry\r\n */\r\n public static ParseFromSnippetAsync(snippetId: string, nodeGeometry?: NodeGeometry, skipBuild: boolean = false): Promise<NodeGeometry> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(NodeGeometry.CreateDefault(\"blank\"));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.nodeGeometry);\r\n\r\n if (!nodeGeometry) {\r\n nodeGeometry = SerializationHelper.Parse(() => new NodeGeometry(snippetId), serializationObject, null);\r\n }\r\n\r\n nodeGeometry.parseSerializedObject(serializationObject);\r\n nodeGeometry.snippetId = snippetId;\r\n\r\n try {\r\n if (!skipBuild) {\r\n nodeGeometry.build();\r\n }\r\n resolve(nodeGeometry);\r\n } catch (err) {\r\n reject(err);\r\n }\r\n } else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nodeGeometry.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/nodeGeometry.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAoB7D;;;GAGG;AACH,MAAM,OAAO,YAAY;IAgBrB,mDAAmD;IAC3C,4BAA4B;QAChC,0DAA0D;QAC1D,IAAI,OAAO,kBAA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AC,SAAS,CAAC;6CACE","sourcesContent":["import { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Mesh } from \"../mesh\";\r\nimport type { VertexData } from \"../mesh.vertexData\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { GeometryOutputBlock } from \"./Blocks/geometryOutputBlock\";\r\nimport type { NodeGeometryBlock } from \"./nodeGeometryBlock\";\r\nimport { NodeGeometryBuildState } from \"./nodeGeometryBuildState\";\r\nimport { GetClass } from \"../../Misc/typeStore\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { WebRequest } from \"../../Misc/webRequest\";\r\nimport { BoxBlock } from \"./Blocks/Sources/boxBlock\";\r\nimport type { GeometryInputBlock } from \"./Blocks/geometryInputBlock\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\nimport type { TeleportOutBlock } from \"./Blocks/Teleport/teleportOutBlock\";\r\nimport type { TeleportInBlock } from \"./Blocks/Teleport/teleportInBlock\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Color4 } from \"../../Maths/math.color\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\n\r\n// declare NODEGEOMETRYEDITOR namespace for compilation issue\r\ndeclare let NODEGEOMETRYEDITOR: any;\r\ndeclare let BABYLON: any;\r\n\r\n/**\r\n * Interface used to configure the node geometry editor\r\n */\r\nexport interface INodeGeometryEditorOptions {\r\n /** Define the URL to load node editor script from */\r\n editorURL?: string;\r\n /** Additional configuration for the NGE */\r\n nodeGeometryEditorConfig?: {\r\n backgroundColor?: Color4;\r\n hostScene?: Scene;\r\n hostMesh?: Mesh;\r\n };\r\n}\r\n\r\n/**\r\n * Defines a node based geometry\r\n * @see demo at https://playground.babylonjs.com#PYY6XE#69\r\n */\r\nexport class NodeGeometry {\r\n private static _BuildIdGenerator: number = 0;\r\n private _buildId: number = NodeGeometry._BuildIdGenerator++;\r\n private _buildWasSuccessful = false;\r\n private _vertexData: Nullable<VertexData> = null;\r\n private _buildExecutionTime: number = 0;\r\n\r\n /** Define the Url to load node editor script */\r\n public static EditorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/nodeGeometryEditor/babylon.nodeGeometryEditor.js`;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private BJSNODEGEOMETRYEDITOR = this._getGlobalNodeGeometryEditor();\r\n\r\n /** @returns the inspector from bundle or global */\r\n private _getGlobalNodeGeometryEditor(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof NODEGEOMETRYEDITOR !== \"undefined\") {\r\n return NODEGEOMETRYEDITOR;\r\n }\r\n\r\n // In case of module let's check the global emitted from the editor entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.NodeGeometryEditor !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the time spent to build this block (in ms)\r\n */\r\n public get buildExecutionTime() {\r\n return this._buildExecutionTime;\r\n }\r\n\r\n /**\r\n * Gets or sets data used by visual editor\r\n * @see https://nge.babylonjs.com\r\n */\r\n public editorData: any = null;\r\n\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n public attachedBlocks: NodeGeometryBlock[] = [];\r\n\r\n /**\r\n * Observable raised when the geometry is built\r\n */\r\n public onBuildObservable = new Observable<NodeGeometry>();\r\n\r\n /** Gets or sets the GeometryOutputBlock used to gather the final geometry data */\r\n public outputBlock: Nullable<GeometryOutputBlock> = null;\r\n\r\n /**\r\n * Snippet ID if the material was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * The name of the geometry\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * A free comment about the geometry\r\n */\r\n @serialize(\"comment\")\r\n public comment: string;\r\n\r\n /**\r\n * Creates a new geometry\r\n * @param name defines the name of the geometry\r\n */\r\n public constructor(name: string) {\r\n this.name = name;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the geometry e.g. \"NodeGeometry\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeGeometry\";\r\n }\r\n\r\n /**\r\n * Gets the vertex data. This needs to be done after build() was called.\r\n * This is used to access vertexData when creating a mesh is not required.\r\n */\r\n public get vertexData() {\r\n return this._vertexData;\r\n }\r\n\r\n /**\r\n * Get a block by its name\r\n * @param name defines the name of the block to retrieve\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByName(name: string) {\r\n let result = null;\r\n for (const block of this.attachedBlocks) {\r\n if (block.name === name) {\r\n if (!result) {\r\n result = block;\r\n } else {\r\n Tools.Warn(\"More than one block was found with the name `\" + name + \"`\");\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get a block using a predicate\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByPredicate(predicate: (block: NodeGeometryBlock) => boolean) {\r\n for (const block of this.attachedBlocks) {\r\n if (predicate(block)) {\r\n return block;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n public getInputBlocks() {\r\n const blocks: GeometryInputBlock[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput) {\r\n blocks.push(block as GeometryInputBlock);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Launch the node geometry editor\r\n * @param config Define the configuration of the editor\r\n * @returns a promise fulfilled when the node editor is visible\r\n */\r\n public edit(config?: INodeGeometryEditorOptions): Promise<void> {\r\n return new Promise((resolve) => {\r\n this.BJSNODEGEOMETRYEDITOR = this.BJSNODEGEOMETRYEDITOR || this._getGlobalNodeGeometryEditor();\r\n if (typeof this.BJSNODEGEOMETRYEDITOR == \"undefined\") {\r\n const editorUrl = config && config.editorURL ? config.editorURL : NodeGeometry.EditorURL;\r\n\r\n // Load editor and add it to the DOM\r\n Tools.LoadBabylonScript(editorUrl, () => {\r\n this.BJSNODEGEOMETRYEDITOR = this.BJSNODEGEOMETRYEDITOR || this._getGlobalNodeGeometryEditor();\r\n this._createNodeEditor(config?.nodeGeometryEditorConfig);\r\n resolve();\r\n });\r\n } else {\r\n // Otherwise creates the editor\r\n this._createNodeEditor(config?.nodeGeometryEditorConfig);\r\n resolve();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the node editor window.\r\n * @param additionalConfig Additional configuration for the NGE\r\n */\r\n private _createNodeEditor(additionalConfig?: any) {\r\n const nodeEditorConfig: any = {\r\n nodeGeometry: this,\r\n ...additionalConfig,\r\n };\r\n this.BJSNODEGEOMETRYEDITOR.NodeGeometryEditor.Show(nodeEditorConfig);\r\n }\r\n\r\n /**\r\n * Build the final geometry. Please note that the geometry MAY not be ready until the onBuildObservable is raised.\r\n * @param verbose defines if the build should log activity\r\n * @param updateBuildId defines if the internal build Id should be updated (default is true)\r\n * @param autoConfigure defines if the autoConfigure method should be called when initializing blocks (default is false)\r\n */\r\n public build(verbose: boolean = false, updateBuildId = true, autoConfigure = false) {\r\n this._buildWasSuccessful = false;\r\n\r\n if (!this.outputBlock) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"You must define the outputBlock property before building the geometry\";\r\n }\r\n const now = PrecisionDate.Now;\r\n // Initialize blocks\r\n this._initializeBlock(this.outputBlock, autoConfigure);\r\n\r\n // Check async states\r\n const promises: Promise<void>[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block._isReadyState) {\r\n promises.push(block._isReadyState);\r\n }\r\n }\r\n\r\n if (promises.length) {\r\n Promise.all(promises).then(() => {\r\n this.build(verbose, updateBuildId, autoConfigure);\r\n });\r\n return;\r\n }\r\n\r\n // Build\r\n const state = new NodeGeometryBuildState();\r\n\r\n state.buildId = this._buildId;\r\n state.verbose = verbose;\r\n\r\n this.outputBlock.build(state);\r\n\r\n if (updateBuildId) {\r\n this._buildId = NodeGeometry._BuildIdGenerator++;\r\n }\r\n\r\n this._buildExecutionTime = PrecisionDate.Now - now;\r\n\r\n // Errors\r\n state.emitErrors();\r\n\r\n this._buildWasSuccessful = true;\r\n this._vertexData = state.vertexData;\r\n this.onBuildObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Creates a mesh from the geometry blocks\r\n * @param name defines the name of the mesh\r\n * @param scene The scene the mesh is scoped to\r\n * @returns The new mesh\r\n */\r\n public createMesh(name: string, scene: Nullable<Scene> = null): Nullable<Mesh> {\r\n if (!this._buildWasSuccessful) {\r\n this.build();\r\n }\r\n\r\n if (!this._vertexData) {\r\n return null;\r\n }\r\n\r\n const mesh = new Mesh(name, scene);\r\n this._vertexData.applyToMesh(mesh);\r\n\r\n mesh._internalMetadata = mesh._internalMetadata || {};\r\n mesh._internalMetadata.nodeGeometry = this;\r\n\r\n return mesh;\r\n }\r\n\r\n /**\r\n * Creates a mesh from the geometry blocks\r\n * @param mesh the mesh to update\r\n * @returns True if successfully updated\r\n */\r\n public updateMesh(mesh: Mesh) {\r\n if (!this._buildWasSuccessful) {\r\n this.build();\r\n }\r\n\r\n if (!this._vertexData) {\r\n return false;\r\n }\r\n\r\n this._vertexData.applyToMesh(mesh);\r\n\r\n mesh._internalMetadata = mesh._internalMetadata || {};\r\n mesh._internalMetadata.nodeGeometry = this;\r\n\r\n return mesh;\r\n }\r\n\r\n private _initializeBlock(node: NodeGeometryBlock, autoConfigure = true) {\r\n node.initialize();\r\n if (autoConfigure) {\r\n node.autoConfigure();\r\n }\r\n node._preparationId = this._buildId;\r\n\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n\r\n for (const input of node.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._initializeBlock(block, autoConfigure);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current geometry\r\n */\r\n public clear() {\r\n this.outputBlock = null;\r\n this.attachedBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * Remove a block from the current geometry\r\n * @param block defines the block to remove\r\n */\r\n public removeBlock(block: NodeGeometryBlock) {\r\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\r\n if (attachedBlockIndex > -1) {\r\n this.attachedBlocks.splice(attachedBlockIndex, 1);\r\n }\r\n\r\n if (block === this.outputBlock) {\r\n this.outputBlock = null;\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the geometry\r\n * @param merge defines whether or not the source must be merged or replace the current content\r\n */\r\n public parseSerializedObject(source: any, merge = false) {\r\n if (!merge) {\r\n this.clear();\r\n }\r\n\r\n const map: { [key: number]: NodeGeometryBlock } = {};\r\n\r\n // Create blocks\r\n for (const parsedBlock of source.blocks) {\r\n const blockType = GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n const block: NodeGeometryBlock = new blockType();\r\n block._deserialize(parsedBlock);\r\n map[parsedBlock.id] = block;\r\n\r\n this.attachedBlocks.push(block);\r\n }\r\n }\r\n\r\n // Reconnect teleportation\r\n for (const block of this.attachedBlocks) {\r\n if (block.isTeleportOut) {\r\n const teleportOut = block as TeleportOutBlock;\r\n const id = teleportOut._tempEntryPointUniqueId;\r\n if (id) {\r\n const source = map[id] as TeleportInBlock;\r\n if (source) {\r\n source.attachToEndpoint(teleportOut);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\r\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n const parsedBlock = source.blocks[blockIndex];\r\n const block = map[parsedBlock.id];\r\n\r\n if (!block) {\r\n continue;\r\n }\r\n\r\n if (block.inputs.length && parsedBlock.inputs.some((i: any) => i.targetConnectionName) && !merge) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n\r\n // Outputs\r\n if (source.outputNodeId) {\r\n this.outputBlock = map[source.outputNodeId] as GeometryOutputBlock;\r\n }\r\n\r\n // UI related info\r\n if (source.locations || (source.editorData && source.editorData.locations)) {\r\n const locations: {\r\n blockId: number;\r\n x: number;\r\n y: number;\r\n }[] = source.locations || source.editorData.locations;\r\n\r\n for (const location of locations) {\r\n if (map[location.blockId]) {\r\n location.blockId = map[location.blockId].uniqueId;\r\n }\r\n }\r\n\r\n if (merge && this.editorData && this.editorData.locations) {\r\n locations.concat(this.editorData.locations);\r\n }\r\n\r\n if (source.locations) {\r\n this.editorData = {\r\n locations: locations,\r\n };\r\n } else {\r\n this.editorData = source.editorData;\r\n this.editorData.locations = locations;\r\n }\r\n\r\n const blockMap: number[] = [];\r\n\r\n for (const key in map) {\r\n blockMap[key] = map[key].uniqueId;\r\n }\r\n\r\n this.editorData.map = blockMap;\r\n }\r\n\r\n this.comment = source.comment;\r\n }\r\n\r\n private _restoreConnections(block: NodeGeometryBlock, source: any, map: { [key: number]: NodeGeometryBlock }) {\r\n for (const outputPoint of block.outputs) {\r\n for (const candidate of source.blocks) {\r\n const target = map[candidate.id];\r\n\r\n if (!target) {\r\n continue;\r\n }\r\n\r\n for (const input of candidate.inputs) {\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n const inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Generate a string containing the code declaration required to create an equivalent of this geometry\r\n * @returns a string\r\n */\r\n public generateCode() {\r\n let alreadyDumped: NodeGeometryBlock[] = [];\r\n const blocks: NodeGeometryBlock[] = [];\r\n const uniqueNames: string[] = [\"const\", \"var\", \"let\"];\r\n // Gets active blocks\r\n if (this.outputBlock) {\r\n this._gatherBlocks(this.outputBlock, blocks);\r\n }\r\n\r\n // Generate\r\n let codeString = `let nodeGeometry = new BABYLON.NodeGeometry(\"${this.name || \"node geometry\"}\");\\n`;\r\n for (const node of blocks) {\r\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\r\n codeString += node._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n\r\n if (this.outputBlock) {\r\n // Connections\r\n alreadyDumped = [];\r\n codeString += \"// Connections\\n\";\r\n codeString += this.outputBlock._dumpCodeForOutputConnections(alreadyDumped);\r\n\r\n // Output nodes\r\n codeString += \"// Output nodes\\n\";\r\n codeString += `nodeGeometry.outputBlock = ${this.outputBlock._codeVariableName};\\n`;\r\n codeString += `nodeGeometry.build();\\n`;\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n private _gatherBlocks(rootNode: NodeGeometryBlock, list: NodeGeometryBlock[]) {\r\n if (list.indexOf(rootNode) !== -1) {\r\n return;\r\n }\r\n list.push(rootNode);\r\n\r\n for (const input of rootNode.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== rootNode) {\r\n this._gatherBlocks(block, list);\r\n }\r\n }\r\n }\r\n\r\n // Teleportation\r\n if (rootNode.isTeleportOut) {\r\n const block = rootNode as TeleportOutBlock;\r\n if (block.entryPoint) {\r\n this._gatherBlocks(block.entryPoint, list);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current geometry and set it to a default state\r\n */\r\n public setToDefault() {\r\n this.clear();\r\n\r\n this.editorData = null;\r\n\r\n // Source\r\n const dataBlock = new BoxBlock(\"Box\");\r\n dataBlock.autoConfigure();\r\n\r\n // Final output\r\n const output = new GeometryOutputBlock(\"Geometry Output\");\r\n dataBlock.geometry.connectTo(output.geometry);\r\n\r\n this.outputBlock = output;\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current geometry.\r\n * @param name defines the name to use for the new geometry\r\n * @returns the new geometry\r\n */\r\n public clone(name: string): NodeGeometry {\r\n const serializationObject = this.serialize();\r\n\r\n const clone = SerializationHelper.Clone(() => new NodeGeometry(name), this);\r\n clone.name = name;\r\n\r\n clone.parseSerializedObject(serializationObject);\r\n clone._buildId = this._buildId;\r\n clone.build(false);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serializes this geometry in a JSON representation\r\n * @param selectedBlocks defines the list of blocks to save (if null the whole geometry will be saved)\r\n * @returns the serialized geometry object\r\n */\r\n public serialize(selectedBlocks?: NodeGeometryBlock[]): any {\r\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\r\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\r\n\r\n let blocks: NodeGeometryBlock[] = [];\r\n\r\n if (selectedBlocks) {\r\n blocks = selectedBlocks;\r\n } else {\r\n serializationObject.customType = \"BABYLON.NodeGeometry\";\r\n if (this.outputBlock) {\r\n serializationObject.outputNodeId = this.outputBlock.uniqueId;\r\n }\r\n }\r\n\r\n // Blocks\r\n serializationObject.blocks = [];\r\n\r\n for (const block of blocks) {\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n\r\n if (!selectedBlocks) {\r\n for (const block of this.attachedBlocks) {\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Disposes the ressources\r\n */\r\n public dispose(): void {\r\n for (const block of this.attachedBlocks) {\r\n block.dispose();\r\n }\r\n\r\n this.attachedBlocks.length = 0;\r\n this.onBuildObservable.clear();\r\n }\r\n\r\n /**\r\n * Creates a new node geometry set to default basic configuration\r\n * @param name defines the name of the geometry\r\n * @returns a new NodeGeometry\r\n */\r\n public static CreateDefault(name: string) {\r\n const nodeGeometry = new NodeGeometry(name);\r\n\r\n nodeGeometry.setToDefault();\r\n nodeGeometry.build();\r\n\r\n return nodeGeometry;\r\n }\r\n\r\n /**\r\n * Creates a node geometry from parsed geometry data\r\n * @param source defines the JSON representation of the geometry\r\n * @returns a new node geometry\r\n */\r\n public static Parse(source: any): NodeGeometry {\r\n const nodeGeometry = SerializationHelper.Parse(() => new NodeGeometry(source.name), source, null);\r\n\r\n nodeGeometry.parseSerializedObject(source);\r\n nodeGeometry.build();\r\n\r\n return nodeGeometry;\r\n }\r\n\r\n /**\r\n * Creates a node geometry from a snippet saved by the node geometry editor\r\n * @param snippetId defines the snippet to load\r\n * @param nodeGeometry defines a node geometry to update (instead of creating a new one)\r\n * @param skipBuild defines whether to build the node geometry\r\n * @returns a promise that will resolve to the new node geometry\r\n */\r\n public static ParseFromSnippetAsync(snippetId: string, nodeGeometry?: NodeGeometry, skipBuild: boolean = false): Promise<NodeGeometry> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(NodeGeometry.CreateDefault(\"blank\"));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.nodeGeometry);\r\n\r\n if (!nodeGeometry) {\r\n nodeGeometry = SerializationHelper.Parse(() => new NodeGeometry(snippetId), serializationObject, null);\r\n }\r\n\r\n nodeGeometry.parseSerializedObject(serializationObject);\r\n nodeGeometry.snippetId = snippetId;\r\n\r\n try {\r\n if (!skipBuild) {\r\n nodeGeometry.build();\r\n }\r\n resolve(nodeGeometry);\r\n } catch (err) {\r\n reject(err);\r\n }\r\n } else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -97,6 +97,10 @@ export declare class NodeGeometryBlock {
|
|
|
97
97
|
* @returns descendant or null if none found
|
|
98
98
|
*/
|
|
99
99
|
getDescendantOfPredicate(predicate: (block: NodeGeometryBlock) => boolean): Nullable<NodeGeometryBlock>;
|
|
100
|
+
/**
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
get _isReadyState(): Nullable<Promise<void>>;
|
|
100
104
|
/**
|
|
101
105
|
* Creates a new NodeGeometryBlock
|
|
102
106
|
* @param name defines the block name
|