@babylonjs/core 6.16.0 → 6.16.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 (145) hide show
  1. package/Bones/boneIKController.js +1 -0
  2. package/Bones/boneIKController.js.map +1 -1
  3. package/Debug/axesViewer.js +3 -3
  4. package/Debug/axesViewer.js.map +1 -1
  5. package/Decorators/nodeDecorator.d.ts +2 -1
  6. package/Decorators/nodeDecorator.js.map +1 -1
  7. package/Engines/thinEngine.js +2 -2
  8. package/Engines/thinEngine.js.map +1 -1
  9. package/Gizmos/planeDragGizmo.js +13 -5
  10. package/Gizmos/planeDragGizmo.js.map +1 -1
  11. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +7 -3
  12. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  13. package/Materials/Node/nodeMaterial.d.ts +1 -1
  14. package/Materials/Node/nodeMaterial.js +6 -2
  15. package/Materials/Node/nodeMaterial.js.map +1 -1
  16. package/Materials/greasedLinePluginMaterial.d.ts +96 -4
  17. package/Materials/greasedLinePluginMaterial.js +15 -6
  18. package/Materials/greasedLinePluginMaterial.js.map +1 -1
  19. package/Materials/greasedLineSimpleMaterial.d.ts +228 -0
  20. package/Materials/greasedLineSimpleMaterial.js +435 -0
  21. package/Materials/greasedLineSimpleMaterial.js.map +1 -0
  22. package/Materials/material.decalMapConfiguration.js +2 -0
  23. package/Materials/material.decalMapConfiguration.js.map +1 -1
  24. package/Materials/meshDebugPluginMaterial.d.ts +66 -17
  25. package/Materials/meshDebugPluginMaterial.js +65 -75
  26. package/Materials/meshDebugPluginMaterial.js.map +1 -1
  27. package/Maths/math.vector.js.map +1 -1
  28. package/Meshes/Builders/greasedLineBuilder.d.ts +3 -2
  29. package/Meshes/Builders/greasedLineBuilder.js +26 -15
  30. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  31. package/Meshes/Builders/textBuilder.d.ts +6 -0
  32. package/Meshes/Builders/textBuilder.js +5 -0
  33. package/Meshes/Builders/textBuilder.js.map +1 -1
  34. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.d.ts +2 -2
  35. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +9 -3
  36. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
  37. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +1 -1
  38. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
  39. package/Meshes/Node/Blocks/Set/setNormalsBlock.d.ts +1 -1
  40. package/Meshes/Node/Blocks/Set/setNormalsBlock.js +1 -1
  41. package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
  42. package/Meshes/Node/Blocks/Set/setUVsBlock.js +1 -1
  43. package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
  44. package/Meshes/Node/Blocks/Sources/boxBlock.js +1 -1
  45. package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
  46. package/Meshes/Node/Blocks/Sources/capsuleBlock.js +1 -1
  47. package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
  48. package/Meshes/Node/Blocks/Sources/cylinderBlock.js +1 -1
  49. package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
  50. package/Meshes/Node/Blocks/Sources/discBlock.d.ts +1 -1
  51. package/Meshes/Node/Blocks/Sources/discBlock.js +2 -2
  52. package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
  53. package/Meshes/Node/Blocks/Sources/gridBlock.js +1 -1
  54. package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
  55. package/Meshes/Node/Blocks/Sources/icoSphereBlock.d.ts +3 -3
  56. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +4 -4
  57. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
  58. package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +1 -1
  59. package/Meshes/Node/Blocks/Sources/meshBlock.js +1 -1
  60. package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
  61. package/Meshes/Node/Blocks/Sources/nullBlock.d.ts +22 -0
  62. package/Meshes/Node/Blocks/Sources/nullBlock.js +34 -0
  63. package/Meshes/Node/Blocks/Sources/nullBlock.js.map +1 -0
  64. package/Meshes/Node/Blocks/Sources/planeBlock.js +1 -1
  65. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  66. package/Meshes/Node/Blocks/Sources/sphereBlock.js +1 -1
  67. package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
  68. package/Meshes/Node/Blocks/Sources/torusBlock.d.ts +1 -1
  69. package/Meshes/Node/Blocks/Sources/torusBlock.js +2 -2
  70. package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
  71. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js +1 -1
  72. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  73. package/Meshes/Node/Blocks/conditionBlock.d.ts +1 -1
  74. package/Meshes/Node/Blocks/conditionBlock.js +9 -6
  75. package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
  76. package/Meshes/Node/Blocks/debugBlock.js +1 -1
  77. package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
  78. package/Meshes/Node/Blocks/geometryInputBlock.d.ts +1 -0
  79. package/Meshes/Node/Blocks/geometryInputBlock.js +33 -1
  80. package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
  81. package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +43 -0
  82. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +118 -0
  83. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -0
  84. package/Meshes/Node/Blocks/geometryOutputBlock.js +1 -0
  85. package/Meshes/Node/Blocks/geometryOutputBlock.js.map +1 -1
  86. package/Meshes/Node/Blocks/geometryTransformBlock.d.ts +8 -1
  87. package/Meshes/Node/Blocks/geometryTransformBlock.js +20 -1
  88. package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
  89. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +4 -1
  90. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
  91. package/Meshes/Node/Blocks/{IntFloatConverterBlock.js → intFloatConverterBlock.js} +1 -1
  92. package/Meshes/Node/Blocks/{IntFloatConverterBlock.js.map → intFloatConverterBlock.js.map} +1 -1
  93. package/Meshes/Node/Blocks/mathBlock.d.ts +1 -1
  94. package/Meshes/Node/Blocks/mathBlock.js +6 -2
  95. package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
  96. package/Meshes/Node/Blocks/mergeGeometryBlock.js +1 -1
  97. package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
  98. package/Meshes/Node/Blocks/noiseBlock.js +2 -2
  99. package/Meshes/Node/Blocks/noiseBlock.js.map +1 -1
  100. package/Meshes/Node/Blocks/normalizeVectorBlock.d.ts +1 -1
  101. package/Meshes/Node/Blocks/normalizeVectorBlock.js +1 -1
  102. package/Meshes/Node/Blocks/normalizeVectorBlock.js.map +1 -1
  103. package/Meshes/Node/Blocks/randomBlock.d.ts +2 -2
  104. package/Meshes/Node/Blocks/randomBlock.js +7 -2
  105. package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
  106. package/Meshes/Node/Blocks/vectorConverterBlock.d.ts +1 -0
  107. package/Meshes/Node/Blocks/vectorConverterBlock.js +35 -7
  108. package/Meshes/Node/Blocks/vectorConverterBlock.js.map +1 -1
  109. package/Meshes/Node/Enums/nodeGeometryConnectionPointTypes.d.ts +5 -5
  110. package/Meshes/Node/Enums/nodeGeometryConnectionPointTypes.js +5 -5
  111. package/Meshes/Node/Enums/nodeGeometryConnectionPointTypes.js.map +1 -1
  112. package/Meshes/Node/Enums/nodeGeometryContextualSources.d.ts +1 -3
  113. package/Meshes/Node/Enums/nodeGeometryContextualSources.js +0 -2
  114. package/Meshes/Node/Enums/nodeGeometryContextualSources.js.map +1 -1
  115. package/Meshes/Node/Interfaces/nodeGeometryExecutionContext.d.ts +1 -1
  116. package/Meshes/Node/Interfaces/nodeGeometryExecutionContext.js.map +1 -1
  117. package/Meshes/Node/index.d.ts +3 -1
  118. package/Meshes/Node/index.js +3 -1
  119. package/Meshes/Node/index.js.map +1 -1
  120. package/Meshes/Node/nodeGeometry.d.ts +3 -2
  121. package/Meshes/Node/nodeGeometry.js +10 -9
  122. package/Meshes/Node/nodeGeometry.js.map +1 -1
  123. package/Meshes/Node/nodeGeometryBlock.d.ts +7 -1
  124. package/Meshes/Node/nodeGeometryBlock.js +26 -6
  125. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  126. package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +1 -1
  127. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  128. package/Meshes/Node/nodeGeometryBuildState.d.ts +1 -1
  129. package/Meshes/Node/nodeGeometryBuildState.js +3 -3
  130. package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
  131. package/Meshes/greasedLineMesh.d.ts +4 -2
  132. package/Meshes/greasedLineMesh.js +26 -2
  133. package/Meshes/greasedLineMesh.js.map +1 -1
  134. package/Meshes/mesh.vertexData.js.map +1 -1
  135. package/Misc/greasedLineTools.d.ts +1 -1
  136. package/Misc/greasedLineTools.js +1 -1
  137. package/Misc/greasedLineTools.js.map +1 -1
  138. package/Shaders/greasedLine.fragment.d.ts +5 -0
  139. package/Shaders/greasedLine.fragment.js +16 -0
  140. package/Shaders/greasedLine.fragment.js.map +1 -0
  141. package/Shaders/greasedLine.vertex.d.ts +5 -0
  142. package/Shaders/greasedLine.vertex.js +19 -0
  143. package/Shaders/greasedLine.vertex.js.map +1 -0
  144. package/package.json +1 -1
  145. /package/Meshes/Node/Blocks/{IntFloatConverterBlock.d.ts → intFloatConverterBlock.d.ts} +0 -0
@@ -40,7 +40,7 @@ export declare class MathBlock extends NodeGeometryBlock {
40
40
  */
41
41
  get left(): NodeGeometryConnectionPoint;
42
42
  /**
43
- * Gets the positions input component
43
+ * Gets the right input component
44
44
  */
45
45
  get right(): NodeGeometryConnectionPoint;
46
46
  /**
@@ -40,6 +40,10 @@ export class MathBlock extends NodeGeometryBlock {
40
40
  this.registerInput("right", NodeGeometryBlockConnectionPointTypes.AutoDetect);
41
41
  this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
42
42
  this._outputs[0]._typeConnectionSource = this._inputs[0];
43
+ this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
44
+ this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
45
+ this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
46
+ this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
43
47
  this._linkConnectionTypes(0, 1);
44
48
  }
45
49
  /**
@@ -56,7 +60,7 @@ export class MathBlock extends NodeGeometryBlock {
56
60
  return this._inputs[0];
57
61
  }
58
62
  /**
59
- * Gets the positions input component
63
+ * Gets the right input component
60
64
  */
61
65
  get right() {
62
66
  return this._inputs[1];
@@ -199,7 +203,7 @@ export class MathBlock extends NodeGeometryBlock {
199
203
  };
200
204
  }
201
205
  _dumpPropertiesCode() {
202
- const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.operation = BABYLON.MathBlockOperations.${MathBlockOperations[this.operation]};\r\n`;
206
+ const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.operation = BABYLON.MathBlockOperations.${MathBlockOperations[this.operation]};\n`;
203
207
  return codeString;
204
208
  }
205
209
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mathBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/mathBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EA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AAK,EAAE,mBAAmB,CAAC,MAAM,EAAE;YACtD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE;YAChD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE;SACnD;KACJ,CAAC;4CACyC;AAyM/C,aAAa,CAAC,mBAAmB,EAAE,SAAS,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 { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Operations supported by the Math block\r\n */\r\nexport enum MathBlockOperations {\r\n /** Add */\r\n Add,\r\n /** Subtract */\r\n Subtract,\r\n /** Multiply */\r\n Multiply,\r\n /** Divide */\r\n Divide,\r\n /** Max */\r\n Max,\r\n /** Min */\r\n Min,\r\n}\r\n\r\n/**\r\n * Block used to apply math functions\r\n */\r\nexport class MathBlock extends NodeGeometryBlock {\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: \"Add\", value: MathBlockOperations.Add },\r\n { label: \"Subtract\", value: MathBlockOperations.Subtract },\r\n { label: \"Multiply\", value: MathBlockOperations.Multiply },\r\n { label: \"Divide\", value: MathBlockOperations.Divide },\r\n { label: \"Max\", value: MathBlockOperations.Max },\r\n { label: \"Min\", value: MathBlockOperations.Min },\r\n ],\r\n })\r\n public operation = MathBlockOperations.Add;\r\n\r\n /**\r\n * Create a new MathBlock\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(\"left\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 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 getClassName() {\r\n return \"MathBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left input component\r\n */\r\n public get left(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the positions input component\r\n */\r\n public get right(): 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 _buildBlock() {\r\n let func: (state: NodeGeometryBuildState) => any;\r\n const left = this.left;\r\n const right = this.right;\r\n\r\n if (!left.isConnected || !right.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const isFloat = left.type === NodeGeometryBlockConnectionPointTypes.Float || left.type === NodeGeometryBlockConnectionPointTypes.Int;\r\n\r\n switch (this.operation) {\r\n case MathBlockOperations.Add: {\r\n if (isFloat) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) + right.getConnectedValue(state);\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).add(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Subtract: {\r\n if (isFloat) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) - right.getConnectedValue(state);\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).subtract(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Multiply: {\r\n if (isFloat) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) * right.getConnectedValue(state);\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).multiply(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Divide: {\r\n if (isFloat) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) / right.getConnectedValue(state);\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).divide(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Min: {\r\n if (isFloat) {\r\n func = (state) => {\r\n return Math.min(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n } else {\r\n switch (left.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n return Vector2.Minimize(left.getConnectedValue(state), state.adapt(right, left.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n return Vector3.Minimize(left.getConnectedValue(state), state.adapt(right, left.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n return Vector4.Minimize(left.getConnectedValue(state), state.adapt(right, left.type));\r\n };\r\n break;\r\n }\r\n }\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Max: {\r\n if (isFloat) {\r\n func = (state) => {\r\n return Math.max(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n } else {\r\n switch (left.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n return Vector2.Maximize(left.getConnectedValue(state), state.adapt(right, left.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n return Vector3.Maximize(left.getConnectedValue(state), state.adapt(right, left.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n return Vector4.Maximize(left.getConnectedValue(state), state.adapt(right, left.type));\r\n };\r\n break;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n if (left.type === NodeGeometryBlockConnectionPointTypes.Int) {\r\n return func(state) | 0;\r\n }\r\n return func(state);\r\n };\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.operation = BABYLON.MathBlockOperations.${MathBlockOperations[this.operation]};\\r\\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 serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.operation = this.operation;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.operation = serializationObject.operation;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MathBlock\", MathBlock);\r\n"]}
1
+ {"version":3,"file":"mathBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/mathBlock.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;AAElG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACnE,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG;;GAEG;AACH,MAAM,CAAN,IAAY,mBAaX;AAbD,WAAY,mBAAmB;IAC3B,UAAU;IACV,2DAAG,CAAA;IACH,eAAe;IACf,qEAAQ,CAAA;IACR,eAAe;IACf,qEAAQ,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,EAAE,mBAAmB,CAAC,QAAQ,EAAE;YAC1D,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mBAAmB,CAAC,MAAM,EAAE;YACtD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE;YAChD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE;SACnD;KACJ,CAAC;4CACyC;AA6M/C,aAAa,CAAC,mBAAmB,EAAE,SAAS,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 { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Operations supported by the Math block\r\n */\r\nexport enum MathBlockOperations {\r\n /** Add */\r\n Add,\r\n /** Subtract */\r\n Subtract,\r\n /** Multiply */\r\n Multiply,\r\n /** Divide */\r\n Divide,\r\n /** Max */\r\n Max,\r\n /** Min */\r\n Min,\r\n}\r\n\r\n/**\r\n * Block used to apply math functions\r\n */\r\nexport class MathBlock extends NodeGeometryBlock {\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: \"Add\", value: MathBlockOperations.Add },\r\n { label: \"Subtract\", value: MathBlockOperations.Subtract },\r\n { label: \"Multiply\", value: MathBlockOperations.Multiply },\r\n { label: \"Divide\", value: MathBlockOperations.Divide },\r\n { label: \"Max\", value: MathBlockOperations.Max },\r\n { label: \"Min\", value: MathBlockOperations.Min },\r\n ],\r\n })\r\n public operation = MathBlockOperations.Add;\r\n\r\n /**\r\n * Create a new MathBlock\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(\"left\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\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.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._linkConnectionTypes(0, 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 getClassName() {\r\n return \"MathBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left input component\r\n */\r\n public get left(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right input component\r\n */\r\n public get right(): 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 _buildBlock() {\r\n let func: (state: NodeGeometryBuildState) => any;\r\n const left = this.left;\r\n const right = this.right;\r\n\r\n if (!left.isConnected || !right.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const isFloat = left.type === NodeGeometryBlockConnectionPointTypes.Float || left.type === NodeGeometryBlockConnectionPointTypes.Int;\r\n\r\n switch (this.operation) {\r\n case MathBlockOperations.Add: {\r\n if (isFloat) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) + right.getConnectedValue(state);\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).add(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Subtract: {\r\n if (isFloat) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) - right.getConnectedValue(state);\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).subtract(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Multiply: {\r\n if (isFloat) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) * right.getConnectedValue(state);\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).multiply(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Divide: {\r\n if (isFloat) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) / right.getConnectedValue(state);\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).divide(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Min: {\r\n if (isFloat) {\r\n func = (state) => {\r\n return Math.min(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n } else {\r\n switch (left.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n return Vector2.Minimize(left.getConnectedValue(state), state.adapt(right, left.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n return Vector3.Minimize(left.getConnectedValue(state), state.adapt(right, left.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n return Vector4.Minimize(left.getConnectedValue(state), state.adapt(right, left.type));\r\n };\r\n break;\r\n }\r\n }\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Max: {\r\n if (isFloat) {\r\n func = (state) => {\r\n return Math.max(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n } else {\r\n switch (left.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n return Vector2.Maximize(left.getConnectedValue(state), state.adapt(right, left.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n return Vector3.Maximize(left.getConnectedValue(state), state.adapt(right, left.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n return Vector4.Maximize(left.getConnectedValue(state), state.adapt(right, left.type));\r\n };\r\n break;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n if (left.type === NodeGeometryBlockConnectionPointTypes.Int) {\r\n return func(state) | 0;\r\n }\r\n return func(state);\r\n };\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.operation = BABYLON.MathBlockOperations.${MathBlockOperations[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 serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.operation = this.operation;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.operation = serializationObject.operation;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MathBlock\", MathBlock);\r\n"]}
@@ -99,7 +99,7 @@ export class MergeGeometryBlock extends NodeGeometryBlock {
99
99
  }
100
100
  }
101
101
  _dumpPropertiesCode() {
102
- const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? "true" : "false"};\r\n`;
102
+ const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? "true" : "false"};\n`;
103
103
  return codeString;
104
104
  }
105
105
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mergeGeometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/mergeGeometryBlock.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,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAQrD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAZhB;;;WAGG;QAEI,oBAAe,GAAG,KAAK,CAAC;QAS3B,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAChF,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACtF,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACtF,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACtF,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAEtF,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAE9E,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,oBAAoB,C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,kBAAkB,EAAE,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;2DAC1F;AA8HnC,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,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 \"../../../Meshes/mesh.vertexData\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to merge several geometries\r\n */\r\nexport class MergeGeometryBlock 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 MergeGeometryBlock\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, true);\r\n this.registerInput(\"geometry2\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"geometry3\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"geometry4\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 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 getClassName() {\r\n return \"MergeGeometryBlock\";\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 geometry2 input component\r\n */\r\n public get geometry2(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the geometry3 input component\r\n */\r\n public get geometry3(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the geometry4 input component\r\n */\r\n public get geometry4(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\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 _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n let vertexData = this.geometry0.getConnectedValue(state) as VertexData;\r\n const additionalVertexData: VertexData[] = [];\r\n\r\n if (this.geometry1.isConnected) {\r\n additionalVertexData.push(this.geometry1.getConnectedValue(state));\r\n }\r\n if (this.geometry2.isConnected) {\r\n additionalVertexData.push(this.geometry2.getConnectedValue(state));\r\n }\r\n if (this.geometry3.isConnected) {\r\n additionalVertexData.push(this.geometry3.getConnectedValue(state));\r\n }\r\n if (this.geometry4.isConnected) {\r\n additionalVertexData.push(this.geometry4.getConnectedValue(state));\r\n }\r\n\r\n if (additionalVertexData.length && vertexData) {\r\n vertexData = vertexData.merge(additionalVertexData, true, false, true, true);\r\n }\r\n return vertexData;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\r\\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 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 _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.MergeGeometryBlock\", MergeGeometryBlock);\r\n"]}
1
+ {"version":3,"file":"mergeGeometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/mergeGeometryBlock.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,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAQrD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAZhB;;;WAGG;QAEI,oBAAe,GAAG,KAAK,CAAC;QAS3B,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAChF,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACtF,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC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I,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,YAAY,CAAC,mBAAwB;QACxC,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;IAC/D,CAAC;CACJ;AA5HU;IADN,sBAAsB,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;2DAC1F;AA8HnC,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,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 \"../../../Meshes/mesh.vertexData\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to merge several geometries\r\n */\r\nexport class MergeGeometryBlock 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 MergeGeometryBlock\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, true);\r\n this.registerInput(\"geometry2\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"geometry3\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"geometry4\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 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 getClassName() {\r\n return \"MergeGeometryBlock\";\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 geometry2 input component\r\n */\r\n public get geometry2(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the geometry3 input component\r\n */\r\n public get geometry3(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the geometry4 input component\r\n */\r\n public get geometry4(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\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 _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n let vertexData = this.geometry0.getConnectedValue(state) as VertexData;\r\n const additionalVertexData: VertexData[] = [];\r\n\r\n if (this.geometry1.isConnected) {\r\n additionalVertexData.push(this.geometry1.getConnectedValue(state));\r\n }\r\n if (this.geometry2.isConnected) {\r\n additionalVertexData.push(this.geometry2.getConnectedValue(state));\r\n }\r\n if (this.geometry3.isConnected) {\r\n additionalVertexData.push(this.geometry3.getConnectedValue(state));\r\n }\r\n if (this.geometry4.isConnected) {\r\n additionalVertexData.push(this.geometry4.getConnectedValue(state));\r\n }\r\n\r\n if (additionalVertexData.length && vertexData) {\r\n vertexData = vertexData.merge(additionalVertexData, true, false, true, true);\r\n }\r\n return vertexData;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected _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 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 _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.MergeGeometryBlock\", MergeGeometryBlock);\r\n"]}
@@ -139,8 +139,8 @@ export class NoiseBlock extends NodeGeometryBlock {
139
139
  _buildBlock() {
140
140
  this.output._storedFunction = (state) => {
141
141
  const position = state.getContextualValue(NodeGeometryContextualSources.Positions);
142
- const octaves = this.octaves.getConnectedValue(state) || 2;
143
- const roughness = this.roughness.getConnectedValue(state) || 0.5;
142
+ const octaves = this.octaves.getConnectedValue(state);
143
+ const roughness = this.roughness.getConnectedValue(state);
144
144
  return this.noise(octaves, roughness, position);
145
145
  };
146
146
  }
@@ -1 +1 @@
1
- {"version":3,"file":"noiseBlock.js","sourceRoot":"","sources":["../../../../../../dev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AC,CAAC;QAC/C,IAAI,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;QACzB,GAAG,IAAI,MAAM,CAAC;QACd,IAAI,IAAI,MAAM,GAAG,GAAG,CAAC;QACrB,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;IAC1C,CAAC;IAES,WAAW;QACjB,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,SAAS,CAAY,CAAC;YAC9F,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC;YAEjE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACpD,CAAC,CAAC;IACN,CAAC;CACJ;AAED,aAAa,CAAC,oBAAoB,EAAE,UAAU,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 { Vector3 } from \"../../../Maths/math.vector\";\r\nimport { Scalar } from \"../../../Maths/math.scalar\";\r\nimport { NodeGeometryContextualSources } from \"../Enums/nodeGeometryContextualSources\";\r\n\r\n/**\r\n * Block used to get a noise value\r\n */\r\nexport class NoiseBlock extends NodeGeometryBlock {\r\n /**\r\n * Create a new NoiseBlock\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(\"octaves\", NodeGeometryBlockConnectionPointTypes.Float, true, 2, 0, 16);\r\n this.registerInput(\"roughness\", NodeGeometryBlockConnectionPointTypes.Float, true, 0.5, 0, 1);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Float);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"NoiseBlock\";\r\n }\r\n\r\n /**\r\n * Gets the octaves input component\r\n */\r\n public get octaves(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the roughtness input component\r\n */\r\n public get roughness(): 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 private _negateIf(value: number, condition: number) {\r\n return condition !== 0 ? -value : value;\r\n }\r\n\r\n private _noiseGrad(hash: number, x: number, y: number, z: number) {\r\n const h = hash & 15;\r\n const u = h < 8 ? x : y;\r\n const vt = h === 12 || h == 14 ? x : z;\r\n const v = h < 4 ? y : vt;\r\n return this._negateIf(u, h & u) + this._negateIf(v, h & 2);\r\n }\r\n\r\n private _fade(t: number) {\r\n return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\r\n }\r\n\r\n private _hashBitRotate(x: number, k: number) {\r\n return (x << k) | (x >> (32 - k));\r\n }\r\n\r\n private _hash(kx: number, ky: number, kz: number) {\r\n let a: number, b: number, c: number;\r\n a = b = c = 0xdeadbeef + (3 << 2) + 13;\r\n\r\n c += kz;\r\n b += ky;\r\n a += kx;\r\n\r\n c ^= b;\r\n c -= this._hashBitRotate(b, 14);\r\n a ^= c;\r\n a -= this._hashBitRotate(c, 11);\r\n b ^= a;\r\n b -= this._hashBitRotate(a, 25);\r\n c ^= b;\r\n c -= this._hashBitRotate(b, 16);\r\n a ^= c;\r\n a -= this._hashBitRotate(c, 4);\r\n b ^= a;\r\n b -= this._hashBitRotate(a, 14);\r\n c ^= b;\r\n c -= this._hashBitRotate(b, 24);\r\n\r\n return c;\r\n }\r\n\r\n private _mix(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, x: number, y: number, z: number) {\r\n const x1 = 1.0 - x;\r\n const y1 = 1.0 - y;\r\n const z1 = 1.0 - z;\r\n return z1 * (y1 * (v0 * x1 + v1 * x) + y * (v2 * x1 + v3 * x)) + z * (y1 * (v4 * x1 + v5 * x) + y * (v6 * x1 + v7 * x));\r\n }\r\n\r\n private _perlinNoise(position: Vector3) {\r\n const X = (position.x | 0) - (position.x < 0 ? 1 : 0);\r\n const Y = (position.y | 0) - (position.y < 0 ? 1 : 0);\r\n const Z = (position.z | 0) - (position.z < 0 ? 1 : 0);\r\n\r\n const fx = position.x - X;\r\n const fy = position.y - Y;\r\n const fz = position.z - Z;\r\n\r\n const u = this._fade(fx);\r\n const v = this._fade(fy);\r\n const w = this._fade(fz);\r\n\r\n return this._mix(\r\n this._noiseGrad(this._hash(X, Y, Z), fx, fy, fz),\r\n this._noiseGrad(this._hash(X + 1, Y, Z), fx - 1, fy, fz),\r\n this._noiseGrad(this._hash(X, Y + 1, Z), fx, fy - 1, fz),\r\n this._noiseGrad(this._hash(X + 1, Y + 1, Z), fx - 1, fy - 1, fz),\r\n this._noiseGrad(this._hash(X, Y, Z + 1), fx, fy, fz - 1),\r\n this._noiseGrad(this._hash(X + 1, Y, Z + 1), fx - 1, fy, fz - 1),\r\n this._noiseGrad(this._hash(X, Y + 1, Z + 1), fx, fy - 1, fz - 1),\r\n this._noiseGrad(this._hash(X + 1, Y + 1, Z + 1), fx - 1, fy - 1, fz - 1),\r\n u,\r\n v,\r\n w\r\n );\r\n }\r\n\r\n private _perlinSigned(position: Vector3) {\r\n return this._perlinNoise(position) * 0.982;\r\n }\r\n\r\n private _perlin(position: Vector3) {\r\n return this._perlinSigned(position) / 2.0 + 0.5;\r\n }\r\n\r\n /**\r\n * Gets a perlin noise value\r\n * @param octaves\r\n * @param roughness\r\n * @param position\r\n * @returns a value between 0 and 1\r\n * @see Based on https://github.com/blender/blender/blob/main/source/blender/blenlib/intern/noise.cc#L533\r\n */\r\n noise(octaves: number, roughness: number, position: Vector3) {\r\n let fscale = 1.0;\r\n let amp = 1.0;\r\n let maxamp = 0.0;\r\n let sum = 0.0;\r\n octaves = Scalar.Clamp(octaves, 0, 15.0);\r\n const step = octaves | 0;\r\n\r\n for (let i = 0; i <= step; i++) {\r\n const t = this._perlin(position.scale(fscale));\r\n sum += t * amp;\r\n maxamp += amp;\r\n amp *= Scalar.Clamp(roughness, 0.0, 1.0);\r\n fscale *= 2.0;\r\n }\r\n\r\n const rmd = octaves - Math.floor(octaves);\r\n if (rmd == 0.0) {\r\n return sum / maxamp;\r\n }\r\n\r\n const t = this._perlin(position.scale(fscale));\r\n let sum2 = sum + t * amp;\r\n sum /= maxamp;\r\n sum2 /= maxamp + amp;\r\n return (1.0 - rmd) * sum + rmd * sum2;\r\n }\r\n\r\n protected _buildBlock() {\r\n this.output._storedFunction = (state) => {\r\n const position = state.getContextualValue(NodeGeometryContextualSources.Positions) as Vector3;\r\n const octaves = this.octaves.getConnectedValue(state) || 2;\r\n const roughness = this.roughness.getConnectedValue(state) || 0.5;\r\n\r\n return this.noise(octaves, roughness, position);\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NoiseBlock\", NoiseBlock);\r\n"]}
1
+ {"version":3,"file":"noiseBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/noiseBlock.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;AAElG,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,6BAA6B,EAAE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AAG,CAAC,KAAK,EAAE,EAAE;YACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,SAAS,CAAY,CAAC;YAC9F,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACtD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAE1D,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACpD,CAAC,CAAC;IACN,CAAC;CACJ;AAED,aAAa,CAAC,oBAAoB,EAAE,UAAU,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 { Vector3 } from \"../../../Maths/math.vector\";\r\nimport { Scalar } from \"../../../Maths/math.scalar\";\r\nimport { NodeGeometryContextualSources } from \"../Enums/nodeGeometryContextualSources\";\r\n\r\n/**\r\n * Block used to get a noise value\r\n */\r\nexport class NoiseBlock extends NodeGeometryBlock {\r\n /**\r\n * Create a new NoiseBlock\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(\"octaves\", NodeGeometryBlockConnectionPointTypes.Float, true, 2, 0, 16);\r\n this.registerInput(\"roughness\", NodeGeometryBlockConnectionPointTypes.Float, true, 0.5, 0, 1);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Float);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"NoiseBlock\";\r\n }\r\n\r\n /**\r\n * Gets the octaves input component\r\n */\r\n public get octaves(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the roughtness input component\r\n */\r\n public get roughness(): 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 private _negateIf(value: number, condition: number) {\r\n return condition !== 0 ? -value : value;\r\n }\r\n\r\n private _noiseGrad(hash: number, x: number, y: number, z: number) {\r\n const h = hash & 15;\r\n const u = h < 8 ? x : y;\r\n const vt = h === 12 || h == 14 ? x : z;\r\n const v = h < 4 ? y : vt;\r\n return this._negateIf(u, h & u) + this._negateIf(v, h & 2);\r\n }\r\n\r\n private _fade(t: number) {\r\n return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\r\n }\r\n\r\n private _hashBitRotate(x: number, k: number) {\r\n return (x << k) | (x >> (32 - k));\r\n }\r\n\r\n private _hash(kx: number, ky: number, kz: number) {\r\n let a: number, b: number, c: number;\r\n a = b = c = 0xdeadbeef + (3 << 2) + 13;\r\n\r\n c += kz;\r\n b += ky;\r\n a += kx;\r\n\r\n c ^= b;\r\n c -= this._hashBitRotate(b, 14);\r\n a ^= c;\r\n a -= this._hashBitRotate(c, 11);\r\n b ^= a;\r\n b -= this._hashBitRotate(a, 25);\r\n c ^= b;\r\n c -= this._hashBitRotate(b, 16);\r\n a ^= c;\r\n a -= this._hashBitRotate(c, 4);\r\n b ^= a;\r\n b -= this._hashBitRotate(a, 14);\r\n c ^= b;\r\n c -= this._hashBitRotate(b, 24);\r\n\r\n return c;\r\n }\r\n\r\n private _mix(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, x: number, y: number, z: number) {\r\n const x1 = 1.0 - x;\r\n const y1 = 1.0 - y;\r\n const z1 = 1.0 - z;\r\n return z1 * (y1 * (v0 * x1 + v1 * x) + y * (v2 * x1 + v3 * x)) + z * (y1 * (v4 * x1 + v5 * x) + y * (v6 * x1 + v7 * x));\r\n }\r\n\r\n private _perlinNoise(position: Vector3) {\r\n const X = (position.x | 0) - (position.x < 0 ? 1 : 0);\r\n const Y = (position.y | 0) - (position.y < 0 ? 1 : 0);\r\n const Z = (position.z | 0) - (position.z < 0 ? 1 : 0);\r\n\r\n const fx = position.x - X;\r\n const fy = position.y - Y;\r\n const fz = position.z - Z;\r\n\r\n const u = this._fade(fx);\r\n const v = this._fade(fy);\r\n const w = this._fade(fz);\r\n\r\n return this._mix(\r\n this._noiseGrad(this._hash(X, Y, Z), fx, fy, fz),\r\n this._noiseGrad(this._hash(X + 1, Y, Z), fx - 1, fy, fz),\r\n this._noiseGrad(this._hash(X, Y + 1, Z), fx, fy - 1, fz),\r\n this._noiseGrad(this._hash(X + 1, Y + 1, Z), fx - 1, fy - 1, fz),\r\n this._noiseGrad(this._hash(X, Y, Z + 1), fx, fy, fz - 1),\r\n this._noiseGrad(this._hash(X + 1, Y, Z + 1), fx - 1, fy, fz - 1),\r\n this._noiseGrad(this._hash(X, Y + 1, Z + 1), fx, fy - 1, fz - 1),\r\n this._noiseGrad(this._hash(X + 1, Y + 1, Z + 1), fx - 1, fy - 1, fz - 1),\r\n u,\r\n v,\r\n w\r\n );\r\n }\r\n\r\n private _perlinSigned(position: Vector3) {\r\n return this._perlinNoise(position) * 0.982;\r\n }\r\n\r\n private _perlin(position: Vector3) {\r\n return this._perlinSigned(position) / 2.0 + 0.5;\r\n }\r\n\r\n /**\r\n * Gets a perlin noise value\r\n * @param octaves\r\n * @param roughness\r\n * @param position\r\n * @returns a value between 0 and 1\r\n * @see Based on https://github.com/blender/blender/blob/main/source/blender/blenlib/intern/noise.cc#L533\r\n */\r\n noise(octaves: number, roughness: number, position: Vector3) {\r\n let fscale = 1.0;\r\n let amp = 1.0;\r\n let maxamp = 0.0;\r\n let sum = 0.0;\r\n octaves = Scalar.Clamp(octaves, 0, 15.0);\r\n const step = octaves | 0;\r\n\r\n for (let i = 0; i <= step; i++) {\r\n const t = this._perlin(position.scale(fscale));\r\n sum += t * amp;\r\n maxamp += amp;\r\n amp *= Scalar.Clamp(roughness, 0.0, 1.0);\r\n fscale *= 2.0;\r\n }\r\n\r\n const rmd = octaves - Math.floor(octaves);\r\n if (rmd == 0.0) {\r\n return sum / maxamp;\r\n }\r\n\r\n const t = this._perlin(position.scale(fscale));\r\n let sum2 = sum + t * amp;\r\n sum /= maxamp;\r\n sum2 /= maxamp + amp;\r\n return (1.0 - rmd) * sum + rmd * sum2;\r\n }\r\n\r\n protected _buildBlock() {\r\n this.output._storedFunction = (state) => {\r\n const position = state.getContextualValue(NodeGeometryContextualSources.Positions) as Vector3;\r\n const octaves = this.octaves.getConnectedValue(state);\r\n const roughness = this.roughness.getConnectedValue(state);\r\n\r\n return this.noise(octaves, roughness, position);\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NoiseBlock\", NoiseBlock);\r\n"]}
@@ -6,7 +6,7 @@ import type { NodeGeometryBuildState } from "../nodeGeometryBuildState";
6
6
  */
7
7
  export declare class NormalizeVectorBlock extends NodeGeometryBlock {
8
8
  /**
9
- * Creates a new ComputeNormalsBlock
9
+ * Creates a new NormalizeVectorBlock
10
10
  * @param name defines the block name
11
11
  */
12
12
  constructor(name: string);
@@ -6,7 +6,7 @@ import { NodeGeometryBlock } from "../nodeGeometryBlock.js";
6
6
  */
7
7
  export class NormalizeVectorBlock extends NodeGeometryBlock {
8
8
  /**
9
- * Creates a new ComputeNormalsBlock
9
+ * Creates a new NormalizeVectorBlock
10
10
  * @param name defines the block name
11
11
  */
12
12
  constructor(name) {
@@ -1 +1 @@
1
- {"version":3,"file":"normalizeVectorBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/normalizeVectorBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBA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AAI,CAAC;YAChC,OAAO;SACV;QAED,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,CAAC;IAC7F,CAAC;CACJ;AAED,aAAa,CAAC,8BAA8B,EAAE,oBAAoB,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 to normalize vectors\r\n */\r\nexport class NormalizeVectorBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new ComputeNormalsBlock\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._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._outputs[0]._typeConnectionSource = this._inputs[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 getClassName() {\r\n return \"NormalizeVectorBlock\";\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 _buildBlock(state: NodeGeometryBuildState) {\r\n super._buildBlock(state);\r\n this.output._storedFunction = null;\r\n\r\n if (!this.input.isConnected) {\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.output._storedFunction = (state) => this.input.getConnectedValue(state).normalize();\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NormalizeVectorBlock\", NormalizeVectorBlock);\r\n"]}
1
+ {"version":3,"file":"normalizeVectorBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/normalizeVectorBlock.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,oBAAqB,SAAQ,iBAAiB;IACvD;;;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,OAAO,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,qCAAqC,CAAC,KAAK,CAAC,CAAC;QAC/F,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,qCAAqC,CAAC,MAAM,CAAC,CAAC;QAChG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAClG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,sBAAsB,CAAC;IAClC,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;IAES,WAAW,CAAC,KAA6B;QAC/C,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;QAEnC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YACzB,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC;YAChC,OAAO;SACV;QAED,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,CAAC;IAC7F,CAAC;CACJ;AAED,aAAa,CAAC,8BAA8B,EAAE,oBAAoB,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 to normalize vectors\r\n */\r\nexport class NormalizeVectorBlock extends NodeGeometryBlock {\r\n /**\r\n * Creates a new NormalizeVectorBlock\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._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._outputs[0]._typeConnectionSource = this._inputs[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 getClassName() {\r\n return \"NormalizeVectorBlock\";\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 _buildBlock(state: NodeGeometryBuildState) {\r\n super._buildBlock(state);\r\n this.output._storedFunction = null;\r\n\r\n if (!this.input.isConnected) {\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.output._storedFunction = (state) => this.input.getConnectedValue(state).normalize();\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NormalizeVectorBlock\", NormalizeVectorBlock);\r\n"]}
@@ -15,11 +15,11 @@ export declare class RandomBlock extends NodeGeometryBlock {
15
15
  */
16
16
  getClassName(): string;
17
17
  /**
18
- * Gets the left input component
18
+ * Gets the min input component
19
19
  */
20
20
  get min(): NodeGeometryConnectionPoint;
21
21
  /**
22
- * Gets the positions input component
22
+ * Gets the max input component
23
23
  */
24
24
  get max(): NodeGeometryConnectionPoint;
25
25
  /**
@@ -16,6 +16,10 @@ export class RandomBlock extends NodeGeometryBlock {
16
16
  this.registerInput("min", NodeGeometryBlockConnectionPointTypes.AutoDetect);
17
17
  this.registerInput("max", NodeGeometryBlockConnectionPointTypes.AutoDetect);
18
18
  this.registerOutput("output", NodeGeometryBlockConnectionPointTypes.BasedOnInput);
19
+ this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
20
+ this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
21
+ this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);
22
+ this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);
19
23
  this._outputs[0]._typeConnectionSource = this._inputs[0];
20
24
  this._linkConnectionTypes(0, 1);
21
25
  }
@@ -27,13 +31,13 @@ export class RandomBlock extends NodeGeometryBlock {
27
31
  return "RandomBlock";
28
32
  }
29
33
  /**
30
- * Gets the left input component
34
+ * Gets the min input component
31
35
  */
32
36
  get min() {
33
37
  return this._inputs[0];
34
38
  }
35
39
  /**
36
- * Gets the positions input component
40
+ * Gets the max input component
37
41
  */
38
42
  get max() {
39
43
  return this._inputs[1];
@@ -59,6 +63,7 @@ export class RandomBlock extends NodeGeometryBlock {
59
63
  _buildBlock() {
60
64
  let func = null;
61
65
  switch (this.min.type) {
66
+ case NodeGeometryBlockConnectionPointTypes.Int:
62
67
  case NodeGeometryBlockConnectionPointTypes.Float: {
63
68
  func = (state) => {
64
69
  const min = this.min.getConnectedValue(state) || 0;
@@ -1 +1 @@
1
- {"version":3,"file":"randomBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/randomBlock.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;AAElG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGvE;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAC9C;;;OAGG;IACH,YAAmB,IAAY;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C,EACvC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EACvC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAC1C,CAAC;gBACN,CAAC,CAAC;gBACF,MAAM;aACT;SACJ;QAED,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;IACvC,CAAC;CACJ;AAED,aAAa,CAAC,qBAAqB,EAAE,WAAW,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 { GeometryInputBlock } from \"./geometryInputBlock\";\r\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../../types\";\r\n\r\n/**\r\n * Block used to get a random number\r\n */\r\nexport class RandomBlock extends NodeGeometryBlock {\r\n /**\r\n * Create a new RandomBlock\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(\"min\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"max\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 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 getClassName() {\r\n return \"RandomBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left input component\r\n */\r\n public get min(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the positions input component\r\n */\r\n public get max(): 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 public autoConfigure() {\r\n if (!this.min.isConnected) {\r\n const minInput = new GeometryInputBlock(\"Min\");\r\n minInput.value = 0;\r\n minInput.output.connectTo(this.min);\r\n }\r\n\r\n if (!this.max.isConnected) {\r\n const maxInput = new GeometryInputBlock(\"Max\");\r\n maxInput.value = 1;\r\n maxInput.output.connectTo(this.max);\r\n }\r\n }\r\n\r\n protected _buildBlock() {\r\n let func: Nullable<(state: NodeGeometryBuildState) => any> = null;\r\n\r\n switch (this.min.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || 0;\r\n const max = this.max.getConnectedValue(state) || 0;\r\n return min + Math.random() * (max - min);\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector2.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector2.Zero();\r\n return new Vector2(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector3.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector3.Zero();\r\n return new Vector3(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector4.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector4.Zero();\r\n return new Vector4(\r\n min.x + Math.random() * (max.x - min.x),\r\n min.y + Math.random() * (max.y - min.y),\r\n min.z + Math.random() * (max.z - min.z),\r\n min.w + Math.random() * (max.w - min.w)\r\n );\r\n };\r\n break;\r\n }\r\n }\r\n\r\n this.output._storedFunction = func;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.RandomBlock\", RandomBlock);\r\n"]}
1
+ {"version":3,"file":"randomBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/randomBlock.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;AAElG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGvE;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAC9C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC5E,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAE5E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAElF,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,qCAAqC,CAAC,MAAM,CAAC,CAAC;QAChG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAClG,IA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,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EACvC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAC1C,CAAC;gBACN,CAAC,CAAC;gBACF,MAAM;aACT;SACJ;QAED,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;IACvC,CAAC;CACJ;AAED,aAAa,CAAC,qBAAqB,EAAE,WAAW,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 { GeometryInputBlock } from \"./geometryInputBlock\";\r\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../../types\";\r\n\r\n/**\r\n * Block used to get a random number\r\n */\r\nexport class RandomBlock extends NodeGeometryBlock {\r\n /**\r\n * Create a new RandomBlock\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(\"min\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"max\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[1].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 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 getClassName() {\r\n return \"RandomBlock\";\r\n }\r\n\r\n /**\r\n * Gets the min input component\r\n */\r\n public get min(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the max input component\r\n */\r\n public get max(): 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 public autoConfigure() {\r\n if (!this.min.isConnected) {\r\n const minInput = new GeometryInputBlock(\"Min\");\r\n minInput.value = 0;\r\n minInput.output.connectTo(this.min);\r\n }\r\n\r\n if (!this.max.isConnected) {\r\n const maxInput = new GeometryInputBlock(\"Max\");\r\n maxInput.value = 1;\r\n maxInput.output.connectTo(this.max);\r\n }\r\n }\r\n\r\n protected _buildBlock() {\r\n let func: Nullable<(state: NodeGeometryBuildState) => any> = null;\r\n\r\n switch (this.min.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || 0;\r\n const max = this.max.getConnectedValue(state) || 0;\r\n return min + Math.random() * (max - min);\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector2.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector2.Zero();\r\n return new Vector2(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector3.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector3.Zero();\r\n return new Vector3(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector4.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector4.Zero();\r\n return new Vector4(\r\n min.x + Math.random() * (max.x - min.x),\r\n min.y + Math.random() * (max.y - min.y),\r\n min.z + Math.random() * (max.z - min.z),\r\n min.w + Math.random() * (max.w - min.w)\r\n );\r\n };\r\n break;\r\n }\r\n }\r\n\r\n this.output._storedFunction = func;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.RandomBlock\", RandomBlock);\r\n"]}
@@ -80,5 +80,6 @@ export declare class VectorConverterBlock extends NodeGeometryBlock {
80
80
  */
81
81
  get wOut(): NodeGeometryConnectionPoint;
82
82
  protected _inputRename(name: string): string;
83
+ protected _outputRename(name: string): string;
83
84
  protected _buildBlock(state: NodeGeometryBuildState): void;
84
85
  }
@@ -159,6 +159,28 @@ export class VectorConverterBlock extends NodeGeometryBlock {
159
159
  }
160
160
  return name;
161
161
  }
162
+ _outputRename(name) {
163
+ switch (name) {
164
+ case "x":
165
+ return "xOut";
166
+ case "y":
167
+ return "yOut";
168
+ case "z":
169
+ return "zOut";
170
+ case "w":
171
+ return "wOut";
172
+ case "xy":
173
+ return "xyOut";
174
+ case "zw":
175
+ return "zwOut";
176
+ case "xyz":
177
+ return "xyzOut";
178
+ case "xyzw":
179
+ return "xyzwOut";
180
+ default:
181
+ return name;
182
+ }
183
+ }
162
184
  _buildBlock(state) {
163
185
  super._buildBlock(state);
164
186
  const xInput = this.xIn;
@@ -199,19 +221,25 @@ export class VectorConverterBlock extends NodeGeometryBlock {
199
221
  }
200
222
  if (xyInput.isConnected) {
201
223
  const temp = xyInput.getConnectedValue(state);
202
- x = temp.x;
203
- y = temp.y;
224
+ if (temp) {
225
+ x = temp.x;
226
+ y = temp.y;
227
+ }
204
228
  }
205
229
  if (zwInput.isConnected) {
206
230
  const temp = zwInput.getConnectedValue(state);
207
- z = temp.x;
208
- w = temp.y;
231
+ if (temp) {
232
+ z = temp.x;
233
+ w = temp.y;
234
+ }
209
235
  }
210
236
  if (xyzInput.isConnected) {
211
237
  const temp = xyzInput.getConnectedValue(state);
212
- x = temp.x;
213
- y = temp.y;
214
- z = temp.z;
238
+ if (temp) {
239
+ x = temp.x;
240
+ y = temp.y;
241
+ z = temp.z;
242
+ }
215
243
  }
216
244
  return new Vector4(x, y, z, w);
217
245
  };
@@ -1 +1 @@
1
- {"version":3,"file":"vectorConverterBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/vectorConverterBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACvE,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,oBAAqB,SAAQ,iBAAiB;IACvD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACjF,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAChF,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,qCAAqC,CAAC,OA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AC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC;QACF,OAAO,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtD,OAAO,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtD,OAAO,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtD,OAAO,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;CACJ;AAED,aAAa,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\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 * Block used to create a Vector2/3/4 out of individual or partial inputs\r\n */\r\nexport class VectorConverterBlock extends NodeGeometryBlock {\r\n /**\r\n * Create a new VectorConverterBlock\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(\"xyzw \", NodeGeometryBlockConnectionPointTypes.Vector4, true);\r\n this.registerInput(\"xyz \", NodeGeometryBlockConnectionPointTypes.Vector3, true);\r\n this.registerInput(\"xy \", NodeGeometryBlockConnectionPointTypes.Vector2, true);\r\n this.registerInput(\"zw \", NodeGeometryBlockConnectionPointTypes.Vector2, true);\r\n this.registerInput(\"x \", NodeGeometryBlockConnectionPointTypes.Float, true);\r\n this.registerInput(\"y \", NodeGeometryBlockConnectionPointTypes.Float, true);\r\n this.registerInput(\"z \", NodeGeometryBlockConnectionPointTypes.Float, true);\r\n this.registerInput(\"w \", NodeGeometryBlockConnectionPointTypes.Float, true);\r\n\r\n this.registerOutput(\"xyzw\", NodeGeometryBlockConnectionPointTypes.Vector4);\r\n this.registerOutput(\"xyz\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this.registerOutput(\"xy\", NodeGeometryBlockConnectionPointTypes.Vector2);\r\n this.registerOutput(\"zw\", NodeGeometryBlockConnectionPointTypes.Vector2);\r\n this.registerOutput(\"x\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"y\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"z\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"w\", NodeGeometryBlockConnectionPointTypes.Float);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"VectorConverterBlock\";\r\n }\r\n\r\n /**\r\n * Gets the xyzw component (input)\r\n */\r\n public get xyzwIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the xyz component (input)\r\n */\r\n public get xyzIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the xy component (input)\r\n */\r\n public get xyIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the zw component (input)\r\n */\r\n public get zwIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the x component (input)\r\n */\r\n public get xIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the y component (input)\r\n */\r\n public get yIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the z component (input)\r\n */\r\n public get zIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the w component (input)\r\n */\r\n public get wIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[7];\r\n }\r\n\r\n /**\r\n * Gets the xyzw component (output)\r\n */\r\n public get xyzwOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the xyz component (output)\r\n */\r\n public get xyzOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[1];\r\n }\r\n\r\n /**\r\n * Gets the xy component (output)\r\n */\r\n public get xyOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[2];\r\n }\r\n\r\n /**\r\n * Gets the zw component (output)\r\n */\r\n public get zwOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[3];\r\n }\r\n\r\n /**\r\n * Gets the x component (output)\r\n */\r\n public get xOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[4];\r\n }\r\n\r\n /**\r\n * Gets the y component (output)\r\n */\r\n public get yOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[5];\r\n }\r\n\r\n /**\r\n * Gets the z component (output)\r\n */\r\n public get zOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[6];\r\n }\r\n\r\n /**\r\n * Gets the w component (output)\r\n */\r\n public get wOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[7];\r\n }\r\n\r\n protected _inputRename(name: string) {\r\n if (name === \"xyzw \") {\r\n return \"xyzwIn\";\r\n }\r\n if (name === \"xyz \") {\r\n return \"xyzIn\";\r\n }\r\n if (name === \"xy \") {\r\n return \"xyIn\";\r\n }\r\n if (name === \"zw \") {\r\n return \"zwIn\";\r\n }\r\n if (name === \"x \") {\r\n return \"xIn\";\r\n }\r\n if (name === \"y \") {\r\n return \"yIn\";\r\n }\r\n if (name === \"z \") {\r\n return \"zIn\";\r\n }\r\n if (name === \"w \") {\r\n return \"wIn\";\r\n }\r\n return name;\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n super._buildBlock(state);\r\n\r\n const xInput = this.xIn;\r\n const yInput = this.yIn;\r\n const zInput = this.zIn;\r\n const wInput = this.wIn;\r\n const xyInput = this.xyIn;\r\n const zwInput = this.zwIn;\r\n const xyzInput = this.xyzIn;\r\n const xyzwInput = this.xyzwIn;\r\n\r\n const xyzwOutput = this.xyzwOut;\r\n const xyzOutput = this.xyzOut;\r\n const xyOutput = this.xyOut;\r\n const zwOutput = this.zwOut;\r\n const xOutput = this.xOut;\r\n const yOutput = this.yOut;\r\n const zOutput = this.zOut;\r\n const wOutput = this.wOut;\r\n\r\n const getData = (state: NodeGeometryBuildState): Vector4 => {\r\n if (xyzwInput.isConnected) {\r\n return xyzwInput.getConnectedValue(state);\r\n }\r\n\r\n let x: number = 0;\r\n let y: number = 0;\r\n let z: number = 0;\r\n let w: number = 0;\r\n\r\n if (xInput.isConnected) {\r\n x = xInput.getConnectedValue(state);\r\n }\r\n if (yInput.isConnected) {\r\n y = yInput.getConnectedValue(state);\r\n }\r\n if (zInput.isConnected) {\r\n z = zInput.getConnectedValue(state);\r\n }\r\n if (wInput.isConnected) {\r\n w = wInput.getConnectedValue(state);\r\n }\r\n\r\n if (xyInput.isConnected) {\r\n const temp = xyInput.getConnectedValue(state);\r\n x = temp.x;\r\n y = temp.y;\r\n }\r\n if (zwInput.isConnected) {\r\n const temp = zwInput.getConnectedValue(state);\r\n z = temp.x;\r\n w = temp.y;\r\n }\r\n if (xyzInput.isConnected) {\r\n const temp = xyzInput.getConnectedValue(state);\r\n x = temp.x;\r\n y = temp.y;\r\n z = temp.z;\r\n }\r\n\r\n return new Vector4(x, y, z, w);\r\n };\r\n\r\n xyzwOutput._storedFunction = (state) => getData(state);\r\n xyzOutput._storedFunction = (state) => {\r\n const data = getData(state);\r\n return new Vector3(data.x, data.y, data.z);\r\n };\r\n xyOutput._storedFunction = (state) => {\r\n const data = getData(state);\r\n return new Vector2(data.x, data.y);\r\n };\r\n zwOutput._storedFunction = (state) => {\r\n const data = getData(state);\r\n return new Vector2(data.z, data.w);\r\n };\r\n xOutput._storedFunction = (state) => getData(state).x;\r\n yOutput._storedFunction = (state) => getData(state).y;\r\n zOutput._storedFunction = (state) => getData(state).z;\r\n wOutput._storedFunction = (state) => getData(state).w;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.VectorConverterBlock\", VectorConverterBlock);\r\n"]}
1
+ {"version":3,"file":"vectorConverterBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/vectorConverterBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACvE,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,oBAAqB,SAAQ,iBAAiB;IACvD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACjF,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAChF,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC5E,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,q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AAC,CAAC;QACF,QAAQ,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YACjC,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC;QACF,QAAQ,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YACjC,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC;QACF,OAAO,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtD,OAAO,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtD,OAAO,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtD,OAAO,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;CACJ;AAED,aAAa,CAAC,8BAA8B,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\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 * Block used to create a Vector2/3/4 out of individual or partial inputs\r\n */\r\nexport class VectorConverterBlock extends NodeGeometryBlock {\r\n /**\r\n * Create a new VectorConverterBlock\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(\"xyzw \", NodeGeometryBlockConnectionPointTypes.Vector4, true);\r\n this.registerInput(\"xyz \", NodeGeometryBlockConnectionPointTypes.Vector3, true);\r\n this.registerInput(\"xy \", NodeGeometryBlockConnectionPointTypes.Vector2, true);\r\n this.registerInput(\"zw \", NodeGeometryBlockConnectionPointTypes.Vector2, true);\r\n this.registerInput(\"x \", NodeGeometryBlockConnectionPointTypes.Float, true);\r\n this.registerInput(\"y \", NodeGeometryBlockConnectionPointTypes.Float, true);\r\n this.registerInput(\"z \", NodeGeometryBlockConnectionPointTypes.Float, true);\r\n this.registerInput(\"w \", NodeGeometryBlockConnectionPointTypes.Float, true);\r\n\r\n this.registerOutput(\"xyzw\", NodeGeometryBlockConnectionPointTypes.Vector4);\r\n this.registerOutput(\"xyz\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this.registerOutput(\"xy\", NodeGeometryBlockConnectionPointTypes.Vector2);\r\n this.registerOutput(\"zw\", NodeGeometryBlockConnectionPointTypes.Vector2);\r\n this.registerOutput(\"x\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"y\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"z\", NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"w\", NodeGeometryBlockConnectionPointTypes.Float);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"VectorConverterBlock\";\r\n }\r\n\r\n /**\r\n * Gets the xyzw component (input)\r\n */\r\n public get xyzwIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the xyz component (input)\r\n */\r\n public get xyzIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the xy component (input)\r\n */\r\n public get xyIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the zw component (input)\r\n */\r\n public get zwIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the x component (input)\r\n */\r\n public get xIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the y component (input)\r\n */\r\n public get yIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the z component (input)\r\n */\r\n public get zIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the w component (input)\r\n */\r\n public get wIn(): NodeGeometryConnectionPoint {\r\n return this._inputs[7];\r\n }\r\n\r\n /**\r\n * Gets the xyzw component (output)\r\n */\r\n public get xyzwOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the xyz component (output)\r\n */\r\n public get xyzOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[1];\r\n }\r\n\r\n /**\r\n * Gets the xy component (output)\r\n */\r\n public get xyOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[2];\r\n }\r\n\r\n /**\r\n * Gets the zw component (output)\r\n */\r\n public get zwOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[3];\r\n }\r\n\r\n /**\r\n * Gets the x component (output)\r\n */\r\n public get xOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[4];\r\n }\r\n\r\n /**\r\n * Gets the y component (output)\r\n */\r\n public get yOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[5];\r\n }\r\n\r\n /**\r\n * Gets the z component (output)\r\n */\r\n public get zOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[6];\r\n }\r\n\r\n /**\r\n * Gets the w component (output)\r\n */\r\n public get wOut(): NodeGeometryConnectionPoint {\r\n return this._outputs[7];\r\n }\r\n\r\n protected _inputRename(name: string) {\r\n if (name === \"xyzw \") {\r\n return \"xyzwIn\";\r\n }\r\n if (name === \"xyz \") {\r\n return \"xyzIn\";\r\n }\r\n if (name === \"xy \") {\r\n return \"xyIn\";\r\n }\r\n if (name === \"zw \") {\r\n return \"zwIn\";\r\n }\r\n if (name === \"x \") {\r\n return \"xIn\";\r\n }\r\n if (name === \"y \") {\r\n return \"yIn\";\r\n }\r\n if (name === \"z \") {\r\n return \"zIn\";\r\n }\r\n if (name === \"w \") {\r\n return \"wIn\";\r\n }\r\n return name;\r\n }\r\n\r\n protected _outputRename(name: string) {\r\n switch (name) {\r\n case \"x\":\r\n return \"xOut\";\r\n case \"y\":\r\n return \"yOut\";\r\n case \"z\":\r\n return \"zOut\";\r\n case \"w\":\r\n return \"wOut\";\r\n case \"xy\":\r\n return \"xyOut\";\r\n case \"zw\":\r\n return \"zwOut\";\r\n case \"xyz\":\r\n return \"xyzOut\";\r\n case \"xyzw\":\r\n return \"xyzwOut\";\r\n default:\r\n return name;\r\n }\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n super._buildBlock(state);\r\n\r\n const xInput = this.xIn;\r\n const yInput = this.yIn;\r\n const zInput = this.zIn;\r\n const wInput = this.wIn;\r\n const xyInput = this.xyIn;\r\n const zwInput = this.zwIn;\r\n const xyzInput = this.xyzIn;\r\n const xyzwInput = this.xyzwIn;\r\n\r\n const xyzwOutput = this.xyzwOut;\r\n const xyzOutput = this.xyzOut;\r\n const xyOutput = this.xyOut;\r\n const zwOutput = this.zwOut;\r\n const xOutput = this.xOut;\r\n const yOutput = this.yOut;\r\n const zOutput = this.zOut;\r\n const wOutput = this.wOut;\r\n\r\n const getData = (state: NodeGeometryBuildState): Vector4 => {\r\n if (xyzwInput.isConnected) {\r\n return xyzwInput.getConnectedValue(state);\r\n }\r\n\r\n let x: number = 0;\r\n let y: number = 0;\r\n let z: number = 0;\r\n let w: number = 0;\r\n\r\n if (xInput.isConnected) {\r\n x = xInput.getConnectedValue(state);\r\n }\r\n if (yInput.isConnected) {\r\n y = yInput.getConnectedValue(state);\r\n }\r\n if (zInput.isConnected) {\r\n z = zInput.getConnectedValue(state);\r\n }\r\n if (wInput.isConnected) {\r\n w = wInput.getConnectedValue(state);\r\n }\r\n\r\n if (xyInput.isConnected) {\r\n const temp = xyInput.getConnectedValue(state);\r\n if (temp) {\r\n x = temp.x;\r\n y = temp.y;\r\n }\r\n }\r\n if (zwInput.isConnected) {\r\n const temp = zwInput.getConnectedValue(state);\r\n if (temp) {\r\n z = temp.x;\r\n w = temp.y;\r\n }\r\n }\r\n if (xyzInput.isConnected) {\r\n const temp = xyzInput.getConnectedValue(state);\r\n if (temp) {\r\n x = temp.x;\r\n y = temp.y;\r\n z = temp.z;\r\n }\r\n }\r\n\r\n return new Vector4(x, y, z, w);\r\n };\r\n\r\n xyzwOutput._storedFunction = (state) => getData(state);\r\n xyzOutput._storedFunction = (state) => {\r\n const data = getData(state);\r\n return new Vector3(data.x, data.y, data.z);\r\n };\r\n xyOutput._storedFunction = (state) => {\r\n const data = getData(state);\r\n return new Vector2(data.x, data.y);\r\n };\r\n zwOutput._storedFunction = (state) => {\r\n const data = getData(state);\r\n return new Vector2(data.z, data.w);\r\n };\r\n xOutput._storedFunction = (state) => getData(state).x;\r\n yOutput._storedFunction = (state) => getData(state).y;\r\n zOutput._storedFunction = (state) => getData(state).z;\r\n wOutput._storedFunction = (state) => getData(state).w;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.VectorConverterBlock\", VectorConverterBlock);\r\n"]}
@@ -7,15 +7,15 @@ export declare enum NodeGeometryBlockConnectionPointTypes {
7
7
  /** Float */
8
8
  Float = 2,
9
9
  /** Vector2 */
10
- Vector2 = 3,
10
+ Vector2 = 4,
11
11
  /** Vector3 */
12
- Vector3 = 4,
12
+ Vector3 = 8,
13
13
  /** Vector4 */
14
- Vector4 = 5,
14
+ Vector4 = 16,
15
15
  /** Matrix */
16
- Matrix = 6,
16
+ Matrix = 32,
17
17
  /** Geometry */
18
- Geometry = 7,
18
+ Geometry = 64,
19
19
  /** Detect type based on connection */
20
20
  AutoDetect = 1024,
21
21
  /** Output type that will be defined by input type */
@@ -8,15 +8,15 @@ export var NodeGeometryBlockConnectionPointTypes;
8
8
  /** Float */
9
9
  NodeGeometryBlockConnectionPointTypes[NodeGeometryBlockConnectionPointTypes["Float"] = 2] = "Float";
10
10
  /** Vector2 */
11
- NodeGeometryBlockConnectionPointTypes[NodeGeometryBlockConnectionPointTypes["Vector2"] = 3] = "Vector2";
11
+ NodeGeometryBlockConnectionPointTypes[NodeGeometryBlockConnectionPointTypes["Vector2"] = 4] = "Vector2";
12
12
  /** Vector3 */
13
- NodeGeometryBlockConnectionPointTypes[NodeGeometryBlockConnectionPointTypes["Vector3"] = 4] = "Vector3";
13
+ NodeGeometryBlockConnectionPointTypes[NodeGeometryBlockConnectionPointTypes["Vector3"] = 8] = "Vector3";
14
14
  /** Vector4 */
15
- NodeGeometryBlockConnectionPointTypes[NodeGeometryBlockConnectionPointTypes["Vector4"] = 5] = "Vector4";
15
+ NodeGeometryBlockConnectionPointTypes[NodeGeometryBlockConnectionPointTypes["Vector4"] = 16] = "Vector4";
16
16
  /** Matrix */
17
- NodeGeometryBlockConnectionPointTypes[NodeGeometryBlockConnectionPointTypes["Matrix"] = 6] = "Matrix";
17
+ NodeGeometryBlockConnectionPointTypes[NodeGeometryBlockConnectionPointTypes["Matrix"] = 32] = "Matrix";
18
18
  /** Geometry */
19
- NodeGeometryBlockConnectionPointTypes[NodeGeometryBlockConnectionPointTypes["Geometry"] = 7] = "Geometry";
19
+ NodeGeometryBlockConnectionPointTypes[NodeGeometryBlockConnectionPointTypes["Geometry"] = 64] = "Geometry";
20
20
  /** Detect type based on connection */
21
21
  NodeGeometryBlockConnectionPointTypes[NodeGeometryBlockConnectionPointTypes["AutoDetect"] = 1024] = "AutoDetect";
22
22
  /** Output type that will be defined by input type */
@@ -1 +1 @@
1
- {"version":3,"file":"nodeGeometryConnectionPointTypes.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Enums/nodeGeometryConnectionPointTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,qCAuBX;AAvBD,WAAY,qCAAqC;IAC7C,UAAU;IACV,+FAAY,CAAA;IACZ,YAAY;IACZ,mGAAc,CAAA;IACd,cAAc;IACd,uGAAgB,CAAA;IAChB,cAAc;IACd,uGAAgB,CAAA;IAChB,cAAc;IACd,uGAAgB,CAAA;IAChB,aAAa;IACb,qGAAe,CAAA;IACf,eAAe;IACf,yGAAiB,CAAA;IACjB,sCAAsC;IACtC,gHAAmB,CAAA;IACnB,qDAAqD;IACrD,oHAAqB,CAAA;IACrB,gBAAgB;IAChB,8GAAkB,CAAA;IAClB,2BAA2B;IAC3B,kGAAY,CAAA;AAChB,CAAC,EAvBW,qCAAqC,KAArC,qCAAqC,QAuBhD","sourcesContent":["/**\r\n * Defines the kind of connection point for node geometry\r\n */\r\nexport enum NodeGeometryBlockConnectionPointTypes {\r\n /** Int */\r\n Int = 0x0001,\r\n /** Float */\r\n Float = 0x0002,\r\n /** Vector2 */\r\n Vector2 = 0x0003,\r\n /** Vector3 */\r\n Vector3 = 0x0004,\r\n /** Vector4 */\r\n Vector4 = 0x0005,\r\n /** Matrix */\r\n Matrix = 0x0006,\r\n /** Geometry */\r\n Geometry = 0x0007,\r\n /** Detect type based on connection */\r\n AutoDetect = 0x0400,\r\n /** Output type that will be defined by input type */\r\n BasedOnInput = 0x0800,\r\n /** Undefined */\r\n Undefined = 0x1000,\r\n /** Bitmask of all types */\r\n All = 0x0fff,\r\n}\r\n"]}
1
+ {"version":3,"file":"nodeGeometryConnectionPointTypes.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Enums/nodeGeometryConnectionPointTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,qCAuBX;AAvBD,WAAY,qCAAqC;IAC7C,UAAU;IACV,+FAAY,CAAA;IACZ,YAAY;IACZ,mGAAc,CAAA;IACd,cAAc;IACd,uGAAgB,CAAA;IAChB,cAAc;IACd,uGAAgB,CAAA;IAChB,cAAc;IACd,wGAAgB,CAAA;IAChB,aAAa;IACb,sGAAe,CAAA;IACf,eAAe;IACf,0GAAiB,CAAA;IACjB,sCAAsC;IACtC,gHAAmB,CAAA;IACnB,qDAAqD;IACrD,oHAAqB,CAAA;IACrB,gBAAgB;IAChB,8GAAkB,CAAA;IAClB,2BAA2B;IAC3B,kGAAY,CAAA;AAChB,CAAC,EAvBW,qCAAqC,KAArC,qCAAqC,QAuBhD","sourcesContent":["/**\r\n * Defines the kind of connection point for node geometry\r\n */\r\nexport enum NodeGeometryBlockConnectionPointTypes {\r\n /** Int */\r\n Int = 0x0001,\r\n /** Float */\r\n Float = 0x0002,\r\n /** Vector2 */\r\n Vector2 = 0x0004,\r\n /** Vector3 */\r\n Vector3 = 0x0008,\r\n /** Vector4 */\r\n Vector4 = 0x0010,\r\n /** Matrix */\r\n Matrix = 0x0020,\r\n /** Geometry */\r\n Geometry = 0x0040,\r\n /** Detect type based on connection */\r\n AutoDetect = 0x0400,\r\n /** Output type that will be defined by input type */\r\n BasedOnInput = 0x0800,\r\n /** Undefined */\r\n Undefined = 0x1000,\r\n /** Bitmask of all types */\r\n All = 0x0fff,\r\n}\r\n"]}