@babylonjs/core 7.27.0 → 7.27.2

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 (144) hide show
  1. package/Animations/animationGroup.d.ts +2 -2
  2. package/Animations/animationGroup.js.map +1 -1
  3. package/Audio/audioSceneComponent.d.ts +5 -9
  4. package/Audio/audioSceneComponent.js.map +1 -1
  5. package/Bones/skeleton.d.ts +2 -2
  6. package/Bones/skeleton.js.map +1 -1
  7. package/Cameras/camera.d.ts +2 -0
  8. package/Cameras/camera.js +2 -0
  9. package/Cameras/camera.js.map +1 -1
  10. package/Engines/WebGPU/webgpuSnapshotRendering.js +3 -0
  11. package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
  12. package/Engines/abstractEngine.js +2 -2
  13. package/Engines/abstractEngine.js.map +1 -1
  14. package/{abstractScene.d.ts → IAssetContainer.d.ts} +33 -6
  15. package/IAssetContainer.js +2 -0
  16. package/IAssetContainer.js.map +1 -0
  17. package/Layers/effectLayerSceneComponent.d.ts +6 -6
  18. package/Layers/effectLayerSceneComponent.js +3 -3
  19. package/Layers/effectLayerSceneComponent.js.map +1 -1
  20. package/Layers/glowLayer.d.ts +3 -3
  21. package/Layers/glowLayer.js +2 -2
  22. package/Layers/glowLayer.js.map +1 -1
  23. package/Layers/highlightLayer.d.ts +3 -3
  24. package/Layers/highlightLayer.js +2 -2
  25. package/Layers/highlightLayer.js.map +1 -1
  26. package/Layers/layerSceneComponent.d.ts +5 -5
  27. package/Layers/layerSceneComponent.js.map +1 -1
  28. package/LensFlares/lensFlareSystemSceneComponent.d.ts +6 -6
  29. package/LensFlares/lensFlareSystemSceneComponent.js +6 -6
  30. package/LensFlares/lensFlareSystemSceneComponent.js.map +1 -1
  31. package/Lights/Shadows/shadowGeneratorSceneComponent.d.ts +3 -3
  32. package/Lights/Shadows/shadowGeneratorSceneComponent.js.map +1 -1
  33. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +1 -1
  34. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  35. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.d.ts +2 -2
  36. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js.map +1 -1
  37. package/Materials/Textures/baseTexture.d.ts +2 -2
  38. package/Materials/Textures/baseTexture.js.map +1 -1
  39. package/Materials/effectRenderer.d.ts +1 -0
  40. package/Materials/effectRenderer.js +2 -0
  41. package/Materials/effectRenderer.js.map +1 -1
  42. package/Materials/material.d.ts +2 -2
  43. package/Materials/material.decalMapConfiguration.d.ts +1 -1
  44. package/Materials/material.decalMapConfiguration.js +1 -1
  45. package/Materials/material.decalMapConfiguration.js.map +1 -1
  46. package/Materials/material.js.map +1 -1
  47. package/Materials/shaderMaterial.d.ts +5 -0
  48. package/Materials/shaderMaterial.js +7 -0
  49. package/Materials/shaderMaterial.js.map +1 -1
  50. package/Maths/math.color.d.ts +20 -0
  51. package/Maths/math.color.js +41 -12
  52. package/Maths/math.color.js.map +1 -1
  53. package/Meshes/Builders/greasedLineBuilder.d.ts +16 -0
  54. package/Meshes/Builders/greasedLineBuilder.js +1 -1
  55. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  56. package/Meshes/Builders/groundBuilder.d.ts +1 -0
  57. package/Meshes/Builders/groundBuilder.js +2 -2
  58. package/Meshes/Builders/groundBuilder.js.map +1 -1
  59. package/Meshes/GreasedLine/greasedLineBaseMesh.js +1 -1
  60. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  61. package/Meshes/GreasedLine/greasedLineMesh.js +1 -1
  62. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  63. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +1 -1
  64. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  65. package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +3 -0
  66. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +86 -1
  67. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  68. package/Meshes/Node/Blocks/Sources/nullBlock.d.ts +4 -0
  69. package/Meshes/Node/Blocks/Sources/nullBlock.js +8 -0
  70. package/Meshes/Node/Blocks/Sources/nullBlock.js.map +1 -1
  71. package/Meshes/Node/Blocks/Sources/planeBlock.d.ts +13 -0
  72. package/Meshes/Node/Blocks/Sources/planeBlock.js +41 -3
  73. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  74. package/Meshes/Node/Blocks/debugBlock.js +1 -1
  75. package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
  76. package/Meshes/Node/Blocks/geometryElbowBlock.js +1 -1
  77. package/Meshes/Node/Blocks/geometryElbowBlock.js.map +1 -1
  78. package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +4 -0
  79. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +47 -1
  80. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  81. package/Meshes/geometry.d.ts +2 -2
  82. package/Meshes/geometry.js.map +1 -1
  83. package/Meshes/mesh.d.ts +7 -0
  84. package/Meshes/mesh.js +15 -0
  85. package/Meshes/mesh.js.map +1 -1
  86. package/Meshes/meshUVSpaceRenderer.d.ts +3 -2
  87. package/Meshes/meshUVSpaceRenderer.js +15 -3
  88. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  89. package/Misc/greasedLineTools.d.ts +3 -1
  90. package/Misc/greasedLineTools.js +17 -2
  91. package/Misc/greasedLineTools.js.map +1 -1
  92. package/Misc/index.d.ts +2 -0
  93. package/Misc/index.js +2 -0
  94. package/Misc/index.js.map +1 -1
  95. package/Misc/screenshotTools.js +3 -2
  96. package/Misc/screenshotTools.js.map +1 -1
  97. package/Misc/textureTools.js +20 -4
  98. package/Misc/textureTools.js.map +1 -1
  99. package/Morph/morphTargetManager.d.ts +2 -2
  100. package/Morph/morphTargetManager.js.map +1 -1
  101. package/PostProcesses/postProcess.d.ts +2 -2
  102. package/PostProcesses/postProcess.js.map +1 -1
  103. package/Probes/reflectionProbe.d.ts +5 -5
  104. package/Probes/reflectionProbe.js +3 -3
  105. package/Probes/reflectionProbe.js.map +1 -1
  106. package/Rendering/fluidRenderer/fluidRenderer.d.ts +2 -2
  107. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  108. package/Rendering/prePassRendererSceneComponent.d.ts +2 -2
  109. package/Rendering/prePassRendererSceneComponent.js.map +1 -1
  110. package/Rendering/subSurfaceSceneComponent.d.ts +2 -2
  111. package/Rendering/subSurfaceSceneComponent.js.map +1 -1
  112. package/Shaders/lod.fragment.js +2 -2
  113. package/Shaders/lod.fragment.js.map +1 -1
  114. package/Shaders/lodCube.fragment.js +2 -2
  115. package/Shaders/lodCube.fragment.js.map +1 -1
  116. package/Shaders/spriteMap.fragment.js +18 -6
  117. package/Shaders/spriteMap.fragment.js.map +1 -1
  118. package/Shaders/spriteMap.vertex.js +1 -1
  119. package/Shaders/spriteMap.vertex.js.map +1 -1
  120. package/ShadersWGSL/lod.fragment.d.ts +5 -0
  121. package/ShadersWGSL/lod.fragment.js +11 -0
  122. package/ShadersWGSL/lod.fragment.js.map +1 -0
  123. package/ShadersWGSL/lodCube.fragment.d.ts +5 -0
  124. package/ShadersWGSL/lodCube.fragment.js +30 -0
  125. package/ShadersWGSL/lodCube.fragment.js.map +1 -0
  126. package/Sprites/spriteMap.d.ts +16 -0
  127. package/Sprites/spriteMap.js +17 -0
  128. package/Sprites/spriteMap.js.map +1 -1
  129. package/assetContainer.d.ts +143 -3
  130. package/assetContainer.js +129 -8
  131. package/assetContainer.js.map +1 -1
  132. package/index.d.ts +0 -1
  133. package/index.js +0 -1
  134. package/index.js.map +1 -1
  135. package/node.d.ts +2 -2
  136. package/node.js.map +1 -1
  137. package/package.json +1 -1
  138. package/scene.d.ts +103 -14
  139. package/scene.js +170 -71
  140. package/scene.js.map +1 -1
  141. package/sceneComponent.d.ts +3 -3
  142. package/sceneComponent.js.map +1 -1
  143. package/abstractScene.js +0 -117
  144. package/abstractScene.js.map +0 -1
@@ -5,6 +5,7 @@ import type { NodeGeometryBuildState } from "../../nodeGeometryBuildState";
5
5
  * Defines a block used to generate plane geometry data
6
6
  */
7
7
  export declare class PlaneBlock extends NodeGeometryBlock {
8
+ private _rotationMatrix;
8
9
  /**
9
10
  * Gets or sets a boolean indicating that this block can evaluate context
10
11
  * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
@@ -32,6 +33,18 @@ export declare class PlaneBlock extends NodeGeometryBlock {
32
33
  * Gets the height input component
33
34
  */
34
35
  get height(): NodeGeometryConnectionPoint;
36
+ /**
37
+ * Gets the subdivisions input component
38
+ */
39
+ get subdivisions(): NodeGeometryConnectionPoint;
40
+ /**
41
+ * Gets the subdivisionsX input component
42
+ */
43
+ get subdivisionsX(): NodeGeometryConnectionPoint;
44
+ /**
45
+ * Gets the subdivisionsY input component
46
+ */
47
+ get subdivisionsY(): NodeGeometryConnectionPoint;
35
48
  /**
36
49
  * Gets the geometry output component
37
50
  */
@@ -1,10 +1,11 @@
1
1
  import { __decorate } from "../../../../tslib.es6.js";
2
- import { CreatePlaneVertexData } from "../../../../Meshes/Builders/planeBuilder.js";
3
2
  import { NodeGeometryBlockConnectionPointTypes } from "../../Enums/nodeGeometryConnectionPointTypes.js";
4
3
  import { NodeGeometryBlock } from "../../nodeGeometryBlock.js";
5
4
  import { GeometryInputBlock } from "../geometryInputBlock.js";
6
5
  import { RegisterClass } from "../../../../Misc/typeStore.js";
6
+ import { Matrix } from "../../../../Maths/math.vector.js";
7
7
  import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
8
+ import { CreateGroundVertexData } from "../../../Builders/groundBuilder.js";
8
9
  /**
9
10
  * Defines a block used to generate plane geometry data
10
11
  */
@@ -15,6 +16,7 @@ export class PlaneBlock extends NodeGeometryBlock {
15
16
  */
16
17
  constructor(name) {
17
18
  super(name);
19
+ this._rotationMatrix = new Matrix();
18
20
  /**
19
21
  * Gets or sets a boolean indicating that this block can evaluate context
20
22
  * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change
@@ -23,6 +25,9 @@ export class PlaneBlock extends NodeGeometryBlock {
23
25
  this.registerInput("size", NodeGeometryBlockConnectionPointTypes.Float, true, 1);
24
26
  this.registerInput("width", NodeGeometryBlockConnectionPointTypes.Float, true, 0);
25
27
  this.registerInput("height", NodeGeometryBlockConnectionPointTypes.Float, true, 0);
28
+ this.registerInput("subdivisions", NodeGeometryBlockConnectionPointTypes.Int, true, 1);
29
+ this.registerInput("subdivisionsX", NodeGeometryBlockConnectionPointTypes.Int, true, 0);
30
+ this.registerInput("subdivisionsY", NodeGeometryBlockConnectionPointTypes.Int, true, 0);
26
31
  this.registerOutput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
27
32
  }
28
33
  /**
@@ -50,6 +55,24 @@ export class PlaneBlock extends NodeGeometryBlock {
50
55
  get height() {
51
56
  return this._inputs[2];
52
57
  }
58
+ /**
59
+ * Gets the subdivisions input component
60
+ */
61
+ get subdivisions() {
62
+ return this._inputs[3];
63
+ }
64
+ /**
65
+ * Gets the subdivisionsX input component
66
+ */
67
+ get subdivisionsX() {
68
+ return this._inputs[4];
69
+ }
70
+ /**
71
+ * Gets the subdivisionsY input component
72
+ */
73
+ get subdivisionsY() {
74
+ return this._inputs[5];
75
+ }
53
76
  /**
54
77
  * Gets the geometry output component
55
78
  */
@@ -83,8 +106,23 @@ export class PlaneBlock extends NodeGeometryBlock {
83
106
  options.size = this.size.getConnectedValue(state);
84
107
  options.width = this.width.getConnectedValue(state);
85
108
  options.height = this.height.getConnectedValue(state);
86
- // Append vertex data from the plane builder
87
- return CreatePlaneVertexData(options);
109
+ const subdivisions = this.subdivisions.getConnectedValue(state);
110
+ const subdivisionsX = this.subdivisionsX.getConnectedValue(state);
111
+ const subdivisionsY = this.subdivisionsY.getConnectedValue(state);
112
+ if (subdivisions) {
113
+ options.subdivisions = subdivisions;
114
+ }
115
+ if (subdivisionsX) {
116
+ options.subdivisionsX = subdivisionsX;
117
+ }
118
+ if (subdivisionsY) {
119
+ options.subdivisionsY = subdivisionsY;
120
+ }
121
+ // Append vertex data from the ground builder (to get access to subdivisions)
122
+ const vertexData = CreateGroundVertexData(options);
123
+ Matrix.RotationYawPitchRollToRef(-Math.PI / 2, 0, Math.PI / 2, this._rotationMatrix);
124
+ vertexData.transform(this._rotationMatrix);
125
+ return vertexData;
88
126
  };
89
127
  if (this.evaluateContext) {
90
128
  this.geometry._storedFunction = func;
@@ -1 +1 @@
1
- {"version":3,"file":"planeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Sources/planeBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAA0B,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAEtG;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAQ7C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAZhB;;;WAGG;QAEI,oBAAe,GAAG,KAAK,CAAC;QAS3B,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACjF,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAClF,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAEnF,IAAI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S,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,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;IAC/D,CAAC;CACJ;AAzHU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;mDAC1F;AA2HnC,aAAa,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { CreatePlaneVertexData } from \"../../../../Meshes/Builders/planeBuilder\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport { GeometryInputBlock } from \"../geometryInputBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { Vector4 } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Defines a block used to generate plane geometry data\r\n */\r\nexport class PlaneBlock 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 * Create a new PlaneBlock\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(\"size\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"width\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"height\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n\r\n this.registerOutput(\"geometry\", 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 \"PlaneBlock\";\r\n }\r\n\r\n /**\r\n * Gets the size input component\r\n */\r\n public get size(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the width input component\r\n */\r\n public get width(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the height input component\r\n */\r\n public get height(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (this.size.isConnected) {\r\n return;\r\n }\r\n\r\n if (!this.width.isConnected && !this.height.isConnected) {\r\n const sizeInput = new GeometryInputBlock(\"Size\");\r\n sizeInput.value = 1;\r\n sizeInput.output.connectTo(this.size);\r\n return;\r\n }\r\n\r\n if (!this.width.isConnected) {\r\n const widthInput = new GeometryInputBlock(\"Width\");\r\n widthInput.value = 1;\r\n widthInput.output.connectTo(this.width);\r\n }\r\n\r\n if (!this.height.isConnected) {\r\n const heightInput = new GeometryInputBlock(\"Height\");\r\n heightInput.value = 1;\r\n heightInput.output.connectTo(this.height);\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const options: { size?: number; width?: number; height?: number; sideOrientation?: number; frontUVs?: Vector4; backUVs?: Vector4 } = {};\r\n const func = (state: NodeGeometryBuildState) => {\r\n options.size = this.size.getConnectedValue(state);\r\n options.width = this.width.getConnectedValue(state);\r\n options.height = this.height.getConnectedValue(state);\r\n\r\n // Append vertex data from the plane builder\r\n return CreatePlaneVertexData(options);\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.geometry._storedFunction = func;\r\n } else {\r\n const value = func(state);\r\n this.geometry._storedFunction = () => {\r\n this.geometry._executionCount = 1;\r\n return value.clone();\r\n };\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 this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PlaneBlock\", PlaneBlock);\r\n"]}
1
+ {"version":3,"file":"planeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Sources/planeBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAA0B,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,sBAAsB,EAAE,2CAA2C;AAE5E;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAS7C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,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1B,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,GAAG,EAAE;gBACjC,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,CAAC;gBAClC,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;YACzB,CAAC,CAAC;SACL;IACL,CAAC;IAEkB,mBAAmB;QAClC,MAAM,UAAU,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,sBAAsB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QAC7I,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,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;IAC/D,CAAC;CACJ;AAvKU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;mDAC1F;AAyKnC,aAAa,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport { GeometryInputBlock } from \"../geometryInputBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { Matrix } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\nimport { CreateGroundVertexData } from \"core/Meshes/Builders/groundBuilder\";\r\n\r\n/**\r\n * Defines a block used to generate plane geometry data\r\n */\r\nexport class PlaneBlock extends NodeGeometryBlock {\r\n private _rotationMatrix = new Matrix();\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 * Create a new PlaneBlock\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(\"size\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"width\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"height\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"subdivisions\", NodeGeometryBlockConnectionPointTypes.Int, true, 1);\r\n this.registerInput(\"subdivisionsX\", NodeGeometryBlockConnectionPointTypes.Int, true, 0);\r\n this.registerInput(\"subdivisionsY\", NodeGeometryBlockConnectionPointTypes.Int, true, 0);\r\n\r\n this.registerOutput(\"geometry\", 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 \"PlaneBlock\";\r\n }\r\n\r\n /**\r\n * Gets the size input component\r\n */\r\n public get size(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the width input component\r\n */\r\n public get width(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the height input component\r\n */\r\n public get height(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the subdivisions input component\r\n */\r\n public get subdivisions(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsX input component\r\n */\r\n public get subdivisionsX(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsY input component\r\n */\r\n public get subdivisionsY(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (this.size.isConnected) {\r\n return;\r\n }\r\n\r\n if (!this.width.isConnected && !this.height.isConnected) {\r\n const sizeInput = new GeometryInputBlock(\"Size\");\r\n sizeInput.value = 1;\r\n sizeInput.output.connectTo(this.size);\r\n return;\r\n }\r\n\r\n if (!this.width.isConnected) {\r\n const widthInput = new GeometryInputBlock(\"Width\");\r\n widthInput.value = 1;\r\n widthInput.output.connectTo(this.width);\r\n }\r\n\r\n if (!this.height.isConnected) {\r\n const heightInput = new GeometryInputBlock(\"Height\");\r\n heightInput.value = 1;\r\n heightInput.output.connectTo(this.height);\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const options: { size?: number; width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number } = {};\r\n const func = (state: NodeGeometryBuildState) => {\r\n options.size = this.size.getConnectedValue(state);\r\n options.width = this.width.getConnectedValue(state);\r\n options.height = this.height.getConnectedValue(state);\r\n\r\n const subdivisions = this.subdivisions.getConnectedValue(state);\r\n const subdivisionsX = this.subdivisionsX.getConnectedValue(state);\r\n const subdivisionsY = this.subdivisionsY.getConnectedValue(state);\r\n\r\n if (subdivisions) {\r\n options.subdivisions = subdivisions;\r\n }\r\n\r\n if (subdivisionsX) {\r\n options.subdivisionsX = subdivisionsX;\r\n }\r\n\r\n if (subdivisionsY) {\r\n options.subdivisionsY = subdivisionsY;\r\n }\r\n\r\n // Append vertex data from the ground builder (to get access to subdivisions)\r\n const vertexData = CreateGroundVertexData(options);\r\n\r\n Matrix.RotationYawPitchRollToRef(-Math.PI / 2, 0, Math.PI / 2, this._rotationMatrix);\r\n\r\n vertexData.transform(this._rotationMatrix);\r\n\r\n return vertexData;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.geometry._storedFunction = func;\r\n } else {\r\n const value = func(state);\r\n this.geometry._storedFunction = () => {\r\n this.geometry._executionCount = 1;\r\n return value.clone();\r\n };\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 this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PlaneBlock\", PlaneBlock);\r\n"]}
@@ -27,7 +27,7 @@ export class DebugBlock extends NodeGeometryBlock {
27
27
  * Gets the time spent to build this block (in ms)
28
28
  */
29
29
  get buildExecutionTime() {
30
- return 0;
30
+ return -1;
31
31
  }
32
32
  /**
33
33
  * Gets the current class name
@@ -1 +1 @@
1
- {"version":3,"file":"debugBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/debugBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAA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AW,EAAE;YACzB,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;SACtC;aAAM;YACH,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1C;IACL,CAAC;CACJ;AAED,aAAa,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { Vector2ToFixed, Vector3ToFixed, Vector4ToFixed } from \"../../../Maths/math.vector.functions\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\n\r\n/**\r\n * Defines a block used to debug values going through it\r\n */\r\nexport class DebugBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets the log entries\r\n */\r\n public log: string[][] = [];\r\n\r\n /**\r\n * Create a new DebugBlock\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._isDebug = true;\r\n\r\n this.registerInput(\"input\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\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.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the time spent to build this block (in ms)\r\n */\r\n public override get buildExecutionTime() {\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 \"DebugBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\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.input.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.log = [];\r\n const func = (state: NodeGeometryBuildState) => {\r\n const input = this.input.getConnectedValue(state);\r\n\r\n if (input === null || input === undefined) {\r\n this.log.push([\"null\", \"\"]);\r\n return input;\r\n }\r\n\r\n switch (this.input.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Vector2:\r\n this.log.push([Vector2ToFixed(input, 4), input.toString()]);\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector3:\r\n this.log.push([Vector3ToFixed(input, 4), input.toString()]);\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector4:\r\n this.log.push([Vector4ToFixed(input, 4), input.toString()]);\r\n break;\r\n default:\r\n this.log.push([input.toString(), input.toString()]);\r\n break;\r\n }\r\n\r\n return input;\r\n };\r\n\r\n if (this.output.isConnected) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.DebugBlock\", DebugBlock);\r\n"]}
1
+ {"version":3,"file":"debugBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/debugBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;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IAAI,CAAC,KAAK,CAAC,CAAC;SAC1C;IACL,CAAC;CACJ;AAED,aAAa,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { Vector2ToFixed, Vector3ToFixed, Vector4ToFixed } from \"../../../Maths/math.vector.functions\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\n\r\n/**\r\n * Defines a block used to debug values going through it\r\n */\r\nexport class DebugBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets the log entries\r\n */\r\n public log: string[][] = [];\r\n\r\n /**\r\n * Create a new DebugBlock\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._isDebug = true;\r\n\r\n this.registerInput(\"input\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\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.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the time spent to build this block (in ms)\r\n */\r\n public override get buildExecutionTime() {\r\n return -1;\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 \"DebugBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\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.input.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.log = [];\r\n const func = (state: NodeGeometryBuildState) => {\r\n const input = this.input.getConnectedValue(state);\r\n\r\n if (input === null || input === undefined) {\r\n this.log.push([\"null\", \"\"]);\r\n return input;\r\n }\r\n\r\n switch (this.input.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Vector2:\r\n this.log.push([Vector2ToFixed(input, 4), input.toString()]);\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector3:\r\n this.log.push([Vector3ToFixed(input, 4), input.toString()]);\r\n break;\r\n case NodeGeometryBlockConnectionPointTypes.Vector4:\r\n this.log.push([Vector4ToFixed(input, 4), input.toString()]);\r\n break;\r\n default:\r\n this.log.push([input.toString(), input.toString()]);\r\n break;\r\n }\r\n\r\n return input;\r\n };\r\n\r\n if (this.output.isConnected) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.DebugBlock\", DebugBlock);\r\n"]}
@@ -19,7 +19,7 @@ export class GeometryElbowBlock extends NodeGeometryBlock {
19
19
  * Gets the time spent to build this block (in ms)
20
20
  */
21
21
  get buildExecutionTime() {
22
- return 0;
22
+ return -1;
23
23
  }
24
24
  /**
25
25
  * Gets the current class name
@@ -1 +1 @@
1
- {"version":3,"file":"geometryElbowBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryElbowBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IACrD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAElF,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,IAAoB,kBAAkB;QAClC,OAAO,CAAC,CAAC;IACb,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,oBAAoB,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAEkB,WAAW,CAAC,KAA6B;QACxD,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAEzB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAE9B,MAAM,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YAC/B,OAAO,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC,CAAC;IACN,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\n/**\r\n * Block used as a pass through\r\n */\r\nexport class GeometryElbowBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryElbowBlock\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(\"input\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the time spent to build this block (in ms)\r\n */\r\n public override get buildExecutionTime() {\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 \"GeometryElbowBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\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 super._buildBlock(state);\r\n\r\n const output = this._outputs[0];\r\n const input = this._inputs[0];\r\n\r\n output._storedFunction = (state) => {\r\n return input.getConnectedValue(state);\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryElbowBlock\", GeometryElbowBlock);\r\n"]}
1
+ {"version":3,"file":"geometryElbowBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryElbowBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IACrD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAElF,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,IAAoB,kBAAkB;QAClC,OAAO,CAAC,CAAC,CAAC;IACd,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,oBAAoB,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAEkB,WAAW,CAAC,KAA6B;QACxD,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAEzB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAE9B,MAAM,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YAC/B,OAAO,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC,CAAC;IACN,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\n/**\r\n * Block used as a pass through\r\n */\r\nexport class GeometryElbowBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new GeometryElbowBlock\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(\"input\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the time spent to build this block (in ms)\r\n */\r\n public override get buildExecutionTime() {\r\n return -1;\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 \"GeometryElbowBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\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 super._buildBlock(state);\r\n\r\n const output = this._outputs[0];\r\n const input = this._inputs[0];\r\n\r\n output._storedFunction = (state) => {\r\n return input.getConnectedValue(state);\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryElbowBlock\", GeometryElbowBlock);\r\n"]}
@@ -14,6 +14,10 @@ export declare class GeometryOptimizeBlock extends NodeGeometryBlock {
14
14
  * Define the epsilon used to compare similar positions
15
15
  */
16
16
  epsilon: number;
17
+ /**
18
+ * Optimize faces (by removing duplicates)
19
+ */
20
+ optimizeFaces: boolean;
17
21
  /**
18
22
  * Creates a new GeometryOptimizeBlock
19
23
  * @param name defines the block name
@@ -25,6 +25,10 @@ export class GeometryOptimizeBlock extends NodeGeometryBlock {
25
25
  * Define the epsilon used to compare similar positions
26
26
  */
27
27
  this.epsilon = Epsilon;
28
+ /**
29
+ * Optimize faces (by removing duplicates)
30
+ */
31
+ this.optimizeFaces = false;
28
32
  this.registerInput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
29
33
  this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.Geometry);
30
34
  }
@@ -55,6 +59,7 @@ export class GeometryOptimizeBlock extends NodeGeometryBlock {
55
59
  const vertexData = this.geometry.getConnectedValue(state);
56
60
  const newPositions = [];
57
61
  const newIndicesMap = {};
62
+ // Optimize positions
58
63
  for (let index = 0; index < vertexData.positions.length; index += 3) {
59
64
  const x = vertexData.positions[index];
60
65
  const y = vertexData.positions[index + 1];
@@ -77,7 +82,42 @@ export class GeometryOptimizeBlock extends NodeGeometryBlock {
77
82
  }
78
83
  const newVertexData = new VertexData();
79
84
  newVertexData.positions = newPositions;
80
- newVertexData.indices = vertexData.indices.map((index) => newIndicesMap[index]);
85
+ const indices = vertexData.indices.map((index) => newIndicesMap[index]);
86
+ const newIndices = [];
87
+ if (this.optimizeFaces) {
88
+ // Optimize indices
89
+ for (let index = 0; index < indices.length; index += 3) {
90
+ const a = indices[index];
91
+ const b = indices[index + 1];
92
+ const c = indices[index + 2];
93
+ if (a === b || b == c || c === a) {
94
+ continue;
95
+ }
96
+ // check if we already have it
97
+ let found = false;
98
+ for (let checkIndex = 0; checkIndex < newIndices.length; checkIndex += 3) {
99
+ if (a === newIndices[checkIndex] && b === newIndices[checkIndex + 1] && c === newIndices[checkIndex + 2]) {
100
+ found = true;
101
+ continue;
102
+ }
103
+ if (a === newIndices[checkIndex + 1] && b === newIndices[checkIndex + 2] && c === newIndices[checkIndex]) {
104
+ found = true;
105
+ continue;
106
+ }
107
+ if (a === newIndices[checkIndex + 2] && b === newIndices[checkIndex] && c === newIndices[checkIndex + 1]) {
108
+ found = true;
109
+ continue;
110
+ }
111
+ }
112
+ if (!found) {
113
+ newIndices.push(a, b, c);
114
+ }
115
+ }
116
+ newVertexData.indices = newIndices;
117
+ }
118
+ else {
119
+ newVertexData.indices = indices;
120
+ }
81
121
  return newVertexData;
82
122
  };
83
123
  if (this.evaluateContext) {
@@ -91,6 +131,7 @@ export class GeometryOptimizeBlock extends NodeGeometryBlock {
91
131
  _dumpPropertiesCode() {
92
132
  let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? "true" : "false"};\n`;
93
133
  codeString += `${this._codeVariableName}.epsilon = ${this.epsilon};\n`;
134
+ codeString += `${this._codeVariableName}.optimizeFaces = ${this.optimizeFaces ? "true" : "false"};\n`;
94
135
  return codeString;
95
136
  }
96
137
  /**
@@ -101,12 +142,14 @@ export class GeometryOptimizeBlock extends NodeGeometryBlock {
101
142
  const serializationObject = super.serialize();
102
143
  serializationObject.evaluateContext = this.evaluateContext;
103
144
  serializationObject.epsilon = this.epsilon;
145
+ serializationObject.optimizeFaces = this.optimizeFaces;
104
146
  return serializationObject;
105
147
  }
106
148
  _deserialize(serializationObject) {
107
149
  super._deserialize(serializationObject);
108
150
  this.evaluateContext = serializationObject.evaluateContext;
109
151
  this.epsilon = serializationObject.epsilon;
152
+ this.optimizeFaces = serializationObject.optimizeFaces;
110
153
  }
111
154
  }
112
155
  __decorate([
@@ -115,5 +158,8 @@ __decorate([
115
158
  __decorate([
116
159
  editableInPropertyPage("Epsilon", 1 /* PropertyTypeForEdition.Float */, "ADVANCED", { notifiers: { rebuild: true } })
117
160
  ], GeometryOptimizeBlock.prototype, "epsilon", void 0);
161
+ __decorate([
162
+ editableInPropertyPage("Optimize faces", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { notifiers: { rebuild: true } })
163
+ ], GeometryOptimizeBlock.prototype, "optimizeFaces", void 0);
118
164
  RegisterClass("BABYLON.GeometryOptimizeBlock", GeometryOptimizeBlock);
119
165
  //# sourceMappingURL=geometryOptimizeBlock.js.map
@@ -1 +1 @@
1
-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I,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC3D,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;IAC/C,CAAC;CACJ;AAlHU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8DAC3F;AAMvB;IADN,sBAAsB,CAAC,SAAS,wCAAgC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;sDACrF;AA8G7B,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport type { FloatArray } from \"../../../types\";\r\nimport { VertexData } from \"../../../Meshes/mesh.vertexData\";\r\nimport { WithinEpsilon } from \"../../../Maths/math.scalar.functions\";\r\nimport { Epsilon } from \"../../../Maths/math.constants\";\r\n/**\r\n * Block used to extract unique positions from a geometry\r\n */\r\nexport class GeometryOptimizeBlock 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 = true;\r\n\r\n /**\r\n * Define the epsilon used to compare similar positions\r\n */\r\n @editableInPropertyPage(\"Epsilon\", PropertyTypeForEdition.Float, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public epsilon = Epsilon;\r\n\r\n /**\r\n * Creates a new GeometryOptimizeBlock\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.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 \"GeometryOptimizeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry 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 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 if (!this.geometry.isConnected) {\r\n return null;\r\n }\r\n const vertexData = this.geometry.getConnectedValue(state);\r\n const newPositions: FloatArray = [];\r\n const newIndicesMap: { [key: number]: number } = {};\r\n\r\n for (let index = 0; index < vertexData.positions.length; index += 3) {\r\n const x = vertexData.positions[index];\r\n const y = vertexData.positions[index + 1];\r\n const z = vertexData.positions[index + 2];\r\n\r\n // check if we already have it\r\n let found = false;\r\n for (let checkIndex = 0; checkIndex < newPositions.length; checkIndex += 3) {\r\n if (\r\n WithinEpsilon(x, newPositions[checkIndex], this.epsilon) &&\r\n WithinEpsilon(y, newPositions[checkIndex + 1], this.epsilon) &&\r\n WithinEpsilon(z, newPositions[checkIndex + 2], this.epsilon)\r\n ) {\r\n newIndicesMap[index / 3] = checkIndex / 3;\r\n found = true;\r\n continue;\r\n }\r\n }\r\n\r\n if (!found) {\r\n newIndicesMap[index / 3] = newPositions.length / 3;\r\n newPositions.push(x, y, z);\r\n }\r\n }\r\n const newVertexData = new VertexData();\r\n newVertexData.positions = newPositions;\r\n newVertexData.indices = vertexData.indices.map((index: number) => newIndicesMap[index]);\r\n\r\n return newVertexData;\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}.epsilon = ${this.epsilon};\\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.epsilon = this.epsilon;\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 this.epsilon = serializationObject.epsilon;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryOptimizeBlock\", GeometryOptimizeBlock);\r\n"]}
1
+ {"version":3,"file":"geometryOptimizeBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryOptimizeBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAGnG,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,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QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC3D,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;QAC3C,IAAI,CAAC,aAAa,GAAG,mBAAmB,CAAC,aAAa,CAAC;IAC3D,CAAC;CACJ;AArKU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8DAC3F;AAMvB;IADN,sBAAsB,CAAC,SAAS,wCAAgC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;sDACrF;AAMlB;IADN,sBAAsB,CAAC,gBAAgB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;4DAC1F;AA2JjC,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport type { FloatArray } from \"../../../types\";\r\nimport { VertexData } from \"../../../Meshes/mesh.vertexData\";\r\nimport { WithinEpsilon } from \"../../../Maths/math.scalar.functions\";\r\nimport { Epsilon } from \"../../../Maths/math.constants\";\r\n/**\r\n * Block used to extract unique positions from a geometry\r\n */\r\nexport class GeometryOptimizeBlock 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 = true;\r\n\r\n /**\r\n * Define the epsilon used to compare similar positions\r\n */\r\n @editableInPropertyPage(\"Epsilon\", PropertyTypeForEdition.Float, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public epsilon = Epsilon;\r\n\r\n /**\r\n * Optimize faces (by removing duplicates)\r\n */\r\n @editableInPropertyPage(\"Optimize faces\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public optimizeFaces = false;\r\n\r\n /**\r\n * Creates a new GeometryOptimizeBlock\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.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 \"GeometryOptimizeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry 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 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 if (!this.geometry.isConnected) {\r\n return null;\r\n }\r\n const vertexData = this.geometry.getConnectedValue(state);\r\n const newPositions: FloatArray = [];\r\n const newIndicesMap: { [key: number]: number } = {};\r\n\r\n // Optimize positions\r\n for (let index = 0; index < vertexData.positions.length; index += 3) {\r\n const x = vertexData.positions[index];\r\n const y = vertexData.positions[index + 1];\r\n const z = vertexData.positions[index + 2];\r\n\r\n // check if we already have it\r\n let found = false;\r\n for (let checkIndex = 0; checkIndex < newPositions.length; checkIndex += 3) {\r\n if (\r\n WithinEpsilon(x, newPositions[checkIndex], this.epsilon) &&\r\n WithinEpsilon(y, newPositions[checkIndex + 1], this.epsilon) &&\r\n WithinEpsilon(z, newPositions[checkIndex + 2], this.epsilon)\r\n ) {\r\n newIndicesMap[index / 3] = checkIndex / 3;\r\n found = true;\r\n continue;\r\n }\r\n }\r\n\r\n if (!found) {\r\n newIndicesMap[index / 3] = newPositions.length / 3;\r\n newPositions.push(x, y, z);\r\n }\r\n }\r\n const newVertexData = new VertexData();\r\n newVertexData.positions = newPositions;\r\n const indices: number[] = vertexData.indices.map((index: number) => newIndicesMap[index]);\r\n const newIndices: number[] = [];\r\n\r\n if (this.optimizeFaces) {\r\n // Optimize indices\r\n for (let index = 0; index < indices.length; index += 3) {\r\n const a = indices[index];\r\n const b = indices[index + 1];\r\n const c = indices[index + 2];\r\n\r\n if (a === b || b == c || c === a) {\r\n continue;\r\n }\r\n\r\n // check if we already have it\r\n let found = false;\r\n for (let checkIndex = 0; checkIndex < newIndices.length; checkIndex += 3) {\r\n if (a === newIndices[checkIndex] && b === newIndices[checkIndex + 1] && c === newIndices[checkIndex + 2]) {\r\n found = true;\r\n continue;\r\n }\r\n\r\n if (a === newIndices[checkIndex + 1] && b === newIndices[checkIndex + 2] && c === newIndices[checkIndex]) {\r\n found = true;\r\n continue;\r\n }\r\n\r\n if (a === newIndices[checkIndex + 2] && b === newIndices[checkIndex] && c === newIndices[checkIndex + 1]) {\r\n found = true;\r\n continue;\r\n }\r\n }\r\n\r\n if (!found) {\r\n newIndices.push(a, b, c);\r\n }\r\n }\r\n\r\n newVertexData.indices = newIndices;\r\n } else {\r\n newVertexData.indices = indices;\r\n }\r\n\r\n return newVertexData;\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}.epsilon = ${this.epsilon};\\n`;\r\n codeString += `${this._codeVariableName}.optimizeFaces = ${this.optimizeFaces ? \"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 serializationObject.epsilon = this.epsilon;\r\n serializationObject.optimizeFaces = this.optimizeFaces;\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 this.epsilon = serializationObject.epsilon;\r\n this.optimizeFaces = serializationObject.optimizeFaces;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryOptimizeBlock\", GeometryOptimizeBlock);\r\n"]}
@@ -8,9 +8,9 @@ import { VertexBuffer } from "../Buffers/buffer";
8
8
  import type { Effect } from "../Materials/effect";
9
9
  import { BoundingInfo } from "../Culling/boundingInfo";
10
10
  import type { DataBuffer } from "../Buffers/dataBuffer";
11
- import type { AbstractScene } from "../abstractScene";
12
11
  import type { Mesh } from "../Meshes/mesh";
13
12
  import type { AbstractEngine } from "../Engines/abstractEngine";
13
+ import type { IAssetContainer } from "../IAssetContainer.js";
14
14
  /**
15
15
  * Class used to store geometry data (vertex buffers + index buffer)
16
16
  */
@@ -67,7 +67,7 @@ export declare class Geometry implements IGetSetVerticesData {
67
67
  _positions: Nullable<Vector3[]>;
68
68
  private _positionsCache;
69
69
  /** @internal */
70
- _parentContainer: Nullable<AbstractScene>;
70
+ _parentContainer: Nullable<IAssetContainer>;
71
71
  /**
72
72
  * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y
73
73
  */