@babylonjs/core 7.30.0 → 7.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/Engines/WebGPU/webgpuCacheBindGroups.js +13 -2
  2. package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
  3. package/Engines/WebGPU/webgpuCacheSampler.js +2 -3
  4. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  5. package/Engines/abstractEngine.js +2 -2
  6. package/Engines/abstractEngine.js.map +1 -1
  7. package/Materials/Background/backgroundMaterial.js +1 -11
  8. package/Materials/Background/backgroundMaterial.js.map +1 -1
  9. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +8 -0
  10. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +43 -34
  11. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  12. package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.d.ts +32 -0
  13. package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js +64 -0
  14. package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js.map +1 -0
  15. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.d.ts +48 -0
  16. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +102 -0
  17. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -0
  18. package/Materials/Node/Blocks/GaussianSplatting/index.d.ts +3 -0
  19. package/Materials/Node/Blocks/GaussianSplatting/index.js +4 -0
  20. package/Materials/Node/Blocks/GaussianSplatting/index.js.map +1 -0
  21. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.d.ts +40 -0
  22. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +96 -0
  23. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -0
  24. package/Materials/Node/Blocks/Input/inputBlock.js +6 -0
  25. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  26. package/Materials/Node/Blocks/index.d.ts +1 -0
  27. package/Materials/Node/Blocks/index.js +1 -0
  28. package/Materials/Node/Blocks/index.js.map +1 -1
  29. package/Materials/Node/Enums/nodeMaterialModes.d.ts +3 -1
  30. package/Materials/Node/Enums/nodeMaterialModes.js +2 -0
  31. package/Materials/Node/Enums/nodeMaterialModes.js.map +1 -1
  32. package/Materials/Node/index.d.ts +1 -0
  33. package/Materials/Node/index.js +1 -0
  34. package/Materials/Node/index.js.map +1 -1
  35. package/Materials/Node/nodeMaterialDefault.d.ts +6 -0
  36. package/Materials/Node/nodeMaterialDefault.js +53 -0
  37. package/Materials/Node/nodeMaterialDefault.js.map +1 -0
  38. package/Materials/PBR/pbrBaseMaterial.js +1 -11
  39. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  40. package/Materials/Textures/texture.js +7 -3
  41. package/Materials/Textures/texture.js.map +1 -1
  42. package/Materials/Textures/textureSampler.d.ts +1 -1
  43. package/Materials/Textures/textureSampler.js.map +1 -1
  44. package/Materials/material.d.ts +5 -1
  45. package/Materials/material.js +19 -1
  46. package/Materials/material.js.map +1 -1
  47. package/Materials/materialPluginManager.js +2 -2
  48. package/Materials/materialPluginManager.js.map +1 -1
  49. package/Materials/pushMaterial.d.ts +1 -1
  50. package/Materials/pushMaterial.js +2 -2
  51. package/Materials/pushMaterial.js.map +1 -1
  52. package/Materials/standardMaterial.js +1 -11
  53. package/Materials/standardMaterial.js.map +1 -1
  54. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +11 -0
  55. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +72 -37
  56. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  57. package/Meshes/Node/Blocks/Set/aggregatorBlock.d.ts +76 -0
  58. package/Meshes/Node/Blocks/Set/aggregatorBlock.js +210 -0
  59. package/Meshes/Node/Blocks/Set/aggregatorBlock.js.map +1 -0
  60. package/Meshes/Node/Blocks/booleanGeometryBlock.d.ts +6 -0
  61. package/Meshes/Node/Blocks/booleanGeometryBlock.js +16 -4
  62. package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
  63. package/Meshes/Node/Blocks/geometryTransformBlock.d.ts +6 -0
  64. package/Meshes/Node/Blocks/geometryTransformBlock.js +14 -2
  65. package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
  66. package/Meshes/Node/index.d.ts +1 -0
  67. package/Meshes/Node/index.js +1 -0
  68. package/Meshes/Node/index.js.map +1 -1
  69. package/Meshes/Node/nodeGeometry.d.ts +1 -1
  70. package/Meshes/Node/nodeGeometry.js +14 -1
  71. package/Meshes/Node/nodeGeometry.js.map +1 -1
  72. package/Meshes/Node/nodeGeometryBlock.d.ts +4 -0
  73. package/Meshes/Node/nodeGeometryBlock.js +6 -0
  74. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  75. package/Meshes/csg.d.ts +1 -0
  76. package/Meshes/csg.js +1 -0
  77. package/Meshes/csg.js.map +1 -1
  78. package/Meshes/csg2.d.ts +126 -0
  79. package/Meshes/csg2.js +350 -0
  80. package/Meshes/csg2.js.map +1 -0
  81. package/Meshes/index.d.ts +1 -0
  82. package/Meshes/index.js +1 -0
  83. package/Meshes/index.js.map +1 -1
  84. package/Meshes/mesh.js +3 -1
  85. package/Meshes/mesh.js.map +1 -1
  86. package/Meshes/mesh.vertexData.d.ts +66 -1
  87. package/Meshes/mesh.vertexData.js.map +1 -1
  88. package/Misc/dumpTools.js +1 -0
  89. package/Misc/dumpTools.js.map +1 -1
  90. package/Misc/tools.d.ts +2 -1
  91. package/Misc/tools.internals.d.ts +13 -0
  92. package/Misc/tools.internals.js +48 -0
  93. package/Misc/tools.internals.js.map +1 -0
  94. package/Misc/tools.js +13 -4
  95. package/Misc/tools.js.map +1 -1
  96. package/Morph/morphTarget.js +1 -0
  97. package/Morph/morphTarget.js.map +1 -1
  98. package/Shaders/ShadersInclude/gaussianSplatting.d.ts +5 -0
  99. package/Shaders/ShadersInclude/gaussianSplatting.js +33 -0
  100. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -0
  101. package/Shaders/ShadersInclude/gaussianSplattingFragmentDeclaration.d.ts +7 -0
  102. package/Shaders/ShadersInclude/gaussianSplattingFragmentDeclaration.js +19 -0
  103. package/Shaders/ShadersInclude/gaussianSplattingFragmentDeclaration.js.map +1 -0
  104. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js +1 -1
  105. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
  106. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -2
  107. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
  108. package/Shaders/gaussianSplatting.fragment.d.ts +1 -2
  109. package/Shaders/gaussianSplatting.fragment.js +5 -10
  110. package/Shaders/gaussianSplatting.fragment.js.map +1 -1
  111. package/Shaders/gaussianSplatting.vertex.d.ts +1 -0
  112. package/Shaders/gaussianSplatting.vertex.js +4 -21
  113. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  114. package/package.json +1 -1
@@ -0,0 +1,210 @@
1
+ import { __decorate } from "../../../../tslib.es6.js";
2
+ import { NodeGeometryBlock } from "../../nodeGeometryBlock.js";
3
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
4
+ import { NodeGeometryBlockConnectionPointTypes } from "../../Enums/nodeGeometryConnectionPointTypes.js";
5
+ import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
6
+ import { Vector2, Vector3, Vector4 } from "../../../../Maths/math.vector.js";
7
+ /**
8
+ * Conditions supported by the condition block
9
+ */
10
+ export var Aggregations;
11
+ (function (Aggregations) {
12
+ /** Max */
13
+ Aggregations[Aggregations["Max"] = 0] = "Max";
14
+ /** Min */
15
+ Aggregations[Aggregations["Min"] = 1] = "Min";
16
+ /** Sum */
17
+ Aggregations[Aggregations["Sum"] = 2] = "Sum";
18
+ })(Aggregations || (Aggregations = {}));
19
+ /**
20
+ * Block used to extract a valuefrom a geometry
21
+ */
22
+ export class AggregatorBlock extends NodeGeometryBlock {
23
+ /**
24
+ * Create a new SetPositionsBlock
25
+ * @param name defines the block name
26
+ */
27
+ constructor(name) {
28
+ super(name);
29
+ /**
30
+ * Gets or sets the test used by the block
31
+ */
32
+ this.aggregation = Aggregations.Sum;
33
+ /**
34
+ * Gets or sets a boolean indicating that this block can evaluate context
35
+ * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
36
+ */
37
+ this.evaluateContext = true;
38
+ this.registerInput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
39
+ this.registerInput("source", NodeGeometryBlockConnectionPointTypes.AutoDetect);
40
+ this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
41
+ this._outputs[0]._typeConnectionSource = this._inputs[1];
42
+ }
43
+ /**
44
+ * Gets the current index in the current flow
45
+ * @returns the current index
46
+ */
47
+ getExecutionIndex() {
48
+ return this._currentIndex;
49
+ }
50
+ /**
51
+ * Gets the current loop index in the current flow
52
+ * @returns the current loop index
53
+ */
54
+ getExecutionLoopIndex() {
55
+ return this._currentIndex;
56
+ }
57
+ /**
58
+ * Gets the current face index in the current flow
59
+ * @returns the current face index
60
+ */
61
+ getExecutionFaceIndex() {
62
+ return 0;
63
+ }
64
+ /**
65
+ * Gets the current class name
66
+ * @returns the class name
67
+ */
68
+ getClassName() {
69
+ return "AggregatorBlock";
70
+ }
71
+ /**
72
+ * Gets the geometry input component
73
+ */
74
+ get geometry() {
75
+ return this._inputs[0];
76
+ }
77
+ /**
78
+ * Gets the source input component
79
+ */
80
+ get source() {
81
+ return this._inputs[1];
82
+ }
83
+ /**
84
+ * Gets the geometry output component
85
+ */
86
+ get output() {
87
+ return this._outputs[0];
88
+ }
89
+ _buildBlock(state) {
90
+ const func = (state) => {
91
+ state.pushExecutionContext(this);
92
+ this._vertexData = this.geometry.getConnectedValue(state);
93
+ state.pushGeometryContext(this._vertexData);
94
+ if (!this._vertexData || !this._vertexData.positions || !this.source.isConnected) {
95
+ state.restoreGeometryContext();
96
+ state.restoreExecutionContext();
97
+ this.output._storedValue = null;
98
+ return;
99
+ }
100
+ // Processing
101
+ const vertexCount = this._vertexData.positions.length / 3;
102
+ const context = [];
103
+ for (this._currentIndex = 0; this._currentIndex < vertexCount; this._currentIndex++) {
104
+ context.push(this.source.getConnectedValue(state));
105
+ }
106
+ // Aggregation
107
+ let func = null;
108
+ switch (this.aggregation) {
109
+ case Aggregations.Max: {
110
+ func = (a, b) => Math.max(a, b);
111
+ break;
112
+ }
113
+ case Aggregations.Min: {
114
+ func = (a, b) => Math.min(a, b);
115
+ break;
116
+ }
117
+ case Aggregations.Sum: {
118
+ func = (a, b) => a + b;
119
+ break;
120
+ }
121
+ }
122
+ if (!func) {
123
+ state.restoreGeometryContext();
124
+ state.restoreExecutionContext();
125
+ this.output._storedFunction = null;
126
+ this.output._storedValue = null;
127
+ return;
128
+ }
129
+ let returnValue;
130
+ switch (this.source.type) {
131
+ case NodeGeometryBlockConnectionPointTypes.Int:
132
+ case NodeGeometryBlockConnectionPointTypes.Float: {
133
+ returnValue = context.reduce(func);
134
+ break;
135
+ }
136
+ case NodeGeometryBlockConnectionPointTypes.Vector2: {
137
+ const x = context.map((v) => v.x).reduce(func);
138
+ const y = context.map((v) => v.y).reduce(func);
139
+ returnValue = new Vector2(x, y);
140
+ break;
141
+ }
142
+ case NodeGeometryBlockConnectionPointTypes.Vector3: {
143
+ const x = context.map((v) => v.x).reduce(func);
144
+ const y = context.map((v) => v.y).reduce(func);
145
+ const z = context.map((v) => v.z).reduce(func);
146
+ returnValue = new Vector3(x, y, z);
147
+ break;
148
+ }
149
+ case NodeGeometryBlockConnectionPointTypes.Vector4: {
150
+ const x = context.map((v) => v.x).reduce(func);
151
+ const y = context.map((v) => v.y).reduce(func);
152
+ const z = context.map((v) => v.z).reduce(func);
153
+ const w = context.map((v) => v.w).reduce(func);
154
+ returnValue = new Vector4(x, y, z, w);
155
+ break;
156
+ }
157
+ }
158
+ // Storage
159
+ state.restoreGeometryContext();
160
+ state.restoreExecutionContext();
161
+ return returnValue;
162
+ };
163
+ if (this.evaluateContext) {
164
+ this.output._storedFunction = func;
165
+ }
166
+ else {
167
+ this.output._storedFunction = null;
168
+ this.output._storedValue = func(state);
169
+ }
170
+ }
171
+ _dumpPropertiesCode() {
172
+ let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? "true" : "false"};\n`;
173
+ codeString += `${this._codeVariableName}.aggregation = BABYLON.Aggregations.${Aggregations[this.aggregation]};\n`;
174
+ return codeString;
175
+ }
176
+ /**
177
+ * Serializes this block in a JSON representation
178
+ * @returns the serialized block object
179
+ */
180
+ serialize() {
181
+ const serializationObject = super.serialize();
182
+ serializationObject.evaluateContext = this.evaluateContext;
183
+ serializationObject.aggregation = this.aggregation;
184
+ return serializationObject;
185
+ }
186
+ _deserialize(serializationObject) {
187
+ super._deserialize(serializationObject);
188
+ if (serializationObject.evaluateContext !== undefined) {
189
+ this.evaluateContext = serializationObject.evaluateContext;
190
+ }
191
+ if (serializationObject.aggregation !== undefined) {
192
+ this.aggregation = serializationObject.aggregation;
193
+ }
194
+ }
195
+ }
196
+ __decorate([
197
+ editableInPropertyPage("Aggregation", 4 /* PropertyTypeForEdition.List */, "ADVANCED", {
198
+ notifiers: { rebuild: true },
199
+ options: [
200
+ { label: "Max", value: Aggregations.Max },
201
+ { label: "Min", value: Aggregations.Min },
202
+ { label: "Sum", value: Aggregations.Sum },
203
+ ],
204
+ })
205
+ ], AggregatorBlock.prototype, "aggregation", void 0);
206
+ __decorate([
207
+ editableInPropertyPage("Evaluate context", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { notifiers: { rebuild: true } })
208
+ ], AggregatorBlock.prototype, "evaluateContext", void 0);
209
+ RegisterClass("BABYLON.AggregatorBlock", AggregatorBlock);
210
+ //# sourceMappingURL=aggregatorBlock.js.map
@@ -0,0 +1 @@
1
+ {"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C,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC3D,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAEnD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;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;QACD,IAAI,mBAAmB,CAAC,WAAW,KAAK,SAAS,EAAE;YAC/C,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAC,WAAW,CAAC;SACtD;IACL,CAAC;CACJ;AAtMU;IARN,sBAAsB,CAAC,aAAa,uCAA+B,UAAU,EAAE;QAC5E,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,GAAG,EAAE;YACzC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,GAAG,EAAE;YACzC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,GAAG,EAAE;SAC5C;KACJ,CAAC;oDACoC;AAO/B;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;wDAC3F;AAiMlC,aAAa,CAAC,yBAAyB,EAAE,eAAe,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 { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { INodeGeometryExecutionContext } from \"../../Interfaces/nodeGeometryExecutionContext\";\r\nimport type { VertexData } from \"../../../../Meshes/mesh.vertexData\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\n/**\r\n * Conditions supported by the condition block\r\n */\r\nexport enum Aggregations {\r\n /** Max */\r\n Max,\r\n /** Min */\r\n Min,\r\n /** Sum */\r\n Sum,\r\n}\r\n\r\n/**\r\n * Block used to extract a valuefrom a geometry\r\n */\r\nexport class AggregatorBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {\r\n private _vertexData: VertexData;\r\n private _currentIndex: number;\r\n\r\n /**\r\n * Gets or sets the test used by the block\r\n */\r\n @editableInPropertyPage(\"Aggregation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"Max\", value: Aggregations.Max },\r\n { label: \"Min\", value: Aggregations.Min },\r\n { label: \"Sum\", value: Aggregations.Sum },\r\n ],\r\n })\r\n public aggregation = Aggregations.Sum;\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 SetPositionsBlock\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(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"source\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n this._outputs[0]._typeConnectionSource = this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\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 \"AggregatorBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry input component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the source input component\r\n */\r\n public get source(): 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 state.pushExecutionContext(this);\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n\r\n state.pushGeometryContext(this._vertexData);\r\n\r\n if (!this._vertexData || !this._vertexData.positions || !this.source.isConnected) {\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n // Processing\r\n const vertexCount = this._vertexData.positions.length / 3;\r\n const context: any[] = [];\r\n for (this._currentIndex = 0; this._currentIndex < vertexCount; this._currentIndex++) {\r\n context.push(this.source.getConnectedValue(state));\r\n }\r\n\r\n // Aggregation\r\n let func: Nullable<(a: number, b: number) => number> = null;\r\n\r\n switch (this.aggregation) {\r\n case Aggregations.Max: {\r\n func = (a: number, b: number) => Math.max(a, b);\r\n break;\r\n }\r\n case Aggregations.Min: {\r\n func = (a: number, b: number) => Math.min(a, b);\r\n break;\r\n }\r\n case Aggregations.Sum: {\r\n func = (a: number, b: number) => a + b;\r\n break;\r\n }\r\n }\r\n\r\n if (!func) {\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n let returnValue: any;\r\n\r\n switch (this.source.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n returnValue = (context as number[]).reduce(func!);\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n const x = (context as Vector2[]).map((v) => v.x).reduce(func!);\r\n const y = (context as Vector2[]).map((v) => v.y).reduce(func!);\r\n returnValue = new Vector2(x, y);\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n const x = (context as Vector3[]).map((v) => v.x).reduce(func!);\r\n const y = (context as Vector3[]).map((v) => v.y).reduce(func!);\r\n const z = (context as Vector3[]).map((v) => v.z).reduce(func!);\r\n returnValue = new Vector3(x, y, z);\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n const x = (context as Vector4[]).map((v) => v.x).reduce(func!);\r\n const y = (context as Vector4[]).map((v) => v.y).reduce(func!);\r\n const z = (context as Vector4[]).map((v) => v.z).reduce(func!);\r\n const w = (context as Vector4[]).map((v) => v.w).reduce(func!);\r\n returnValue = new Vector4(x, y, z, w);\r\n break;\r\n }\r\n }\r\n\r\n // Storage\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n return returnValue;\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}.aggregation = BABYLON.Aggregations.${Aggregations[this.aggregation]};\\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.aggregation = this.aggregation;\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 if (serializationObject.aggregation !== undefined) {\r\n this.aggregation = serializationObject.aggregation;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.AggregatorBlock\", AggregatorBlock);\r\n"]}
@@ -1,6 +1,7 @@
1
1
  import { NodeGeometryBlock } from "../nodeGeometryBlock";
2
2
  import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
3
3
  import type { NodeGeometryBuildState } from "../nodeGeometryBuildState";
4
+ import type { Nullable } from "../../../types.js";
4
5
  /**
5
6
  * Operations supported by the boolean block
6
7
  */
@@ -25,6 +26,11 @@ export declare class BooleanGeometryBlock extends NodeGeometryBlock {
25
26
  * Gets or sets the operation applied by the block
26
27
  */
27
28
  operation: BooleanGeometryOperations;
29
+ private _csg2LoadingPromise;
30
+ /**
31
+ * @internal
32
+ */
33
+ get _isReadyState(): Nullable<Promise<void>>;
28
34
  /**
29
35
  * Create a new BooleanGeometryBlock
30
36
  * @param name defines the block name
@@ -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 { CSG } from "../../csg.js";
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 = CSG.FromVertexData(vertexData0);
95
- const CSG1 = CSG.FromVertexData(vertexData1);
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.union(CSG1);
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,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B,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC3D,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAE/C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,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;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,C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a,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC3D,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAE/C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,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._scalingMatrix.multiplyToRef(this._rotationMatrix, this._scalingRotationMatrix);
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;AACH,MAAM,OAAO,sBAAuB,SAAQ,iBAAiB;IAczD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAlBR,oBAAe,GAAG,IAAI,MAAM,E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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,aAAa,CAAC,QAAQ,EAAE,qCAAqC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACjF,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO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Ae,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"]}
@@ -80,3 +80,4 @@ export * from "./Blocks/geometryDotBlock";
80
80
  export * from "./Blocks/geometryLengthBlock";
81
81
  export * from "./Blocks/geometryRotate2dBlock";
82
82
  export * from "./Blocks/geometryInterceptorBlock";
83
+ export * from "./Blocks/Set/aggregatorBlock";
@@ -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
@@ -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,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,C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pD,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 \"./Blocks/geometryInterceptorBlock\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/index.ts"],"names":[],"mappings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AAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,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;AAClD,cAAc,8BAA8B,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 \"./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;