@babylonjs/core 7.48.3 → 7.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/Animations/animatable.core.d.ts +1 -0
  2. package/Animations/animatable.core.js +3 -1
  3. package/Animations/animatable.core.js.map +1 -1
  4. package/Behaviors/Cameras/framingBehavior.js +3 -0
  5. package/Behaviors/Cameras/framingBehavior.js.map +1 -1
  6. package/Behaviors/Meshes/baseSixDofDragBehavior.js +10 -9
  7. package/Behaviors/Meshes/baseSixDofDragBehavior.js.map +1 -1
  8. package/Buffers/bufferUtils.d.ts +9 -10
  9. package/Buffers/bufferUtils.js +16 -0
  10. package/Buffers/bufferUtils.js.map +1 -1
  11. package/Culling/Helper/transformFeedbackBoundingHelper.js +2 -1
  12. package/Culling/Helper/transformFeedbackBoundingHelper.js.map +1 -1
  13. package/Engines/WebGPU/webgpuBufferManager.js +23 -22
  14. package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
  15. package/Engines/WebGPU/webgpuCacheSampler.js +12 -3
  16. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  17. package/Engines/abstractEngine.js +2 -2
  18. package/Engines/abstractEngine.js.map +1 -1
  19. package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.d.ts +43 -0
  20. package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.js +83 -0
  21. package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.js.map +1 -0
  22. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  23. package/FrameGraph/Node/Blocks/index.js +1 -0
  24. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  25. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.d.ts +35 -0
  26. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +40 -0
  27. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -0
  28. package/FrameGraph/frameGraph.d.ts +4 -0
  29. package/FrameGraph/frameGraph.js +6 -0
  30. package/FrameGraph/frameGraph.js.map +1 -1
  31. package/FrameGraph/frameGraphRenderContext.d.ts +2 -2
  32. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  33. package/FrameGraph/index.d.ts +1 -0
  34. package/FrameGraph/index.js +1 -0
  35. package/FrameGraph/index.js.map +1 -1
  36. package/Inputs/scene.inputManager.js +4 -4
  37. package/Inputs/scene.inputManager.js.map +1 -1
  38. package/Layers/thinEffectLayer.js +3 -1
  39. package/Layers/thinEffectLayer.js.map +1 -1
  40. package/Lights/Shadows/shadowGenerator.js +3 -1
  41. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  42. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js +9 -20
  43. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js.map +1 -1
  44. package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js +8 -19
  45. package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js.map +1 -1
  46. package/Materials/Node/Blocks/Fragment/prePassOutputBlock.d.ts +8 -0
  47. package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js +36 -0
  48. package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js.map +1 -1
  49. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +6 -3
  50. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  51. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.d.ts +8 -0
  52. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +48 -0
  53. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  54. package/Materials/Node/nodeMaterial.d.ts +2 -0
  55. package/Materials/Node/nodeMaterial.js +14 -0
  56. package/Materials/Node/nodeMaterial.js.map +1 -1
  57. package/Materials/PBR/pbrBaseMaterial.d.ts +2 -0
  58. package/Materials/PBR/pbrBaseMaterial.js +2 -0
  59. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  60. package/Materials/materialHelper.functions.d.ts +2 -1
  61. package/Materials/materialHelper.functions.js +17 -1
  62. package/Materials/materialHelper.functions.js.map +1 -1
  63. package/Materials/shaderMaterial.js +3 -1
  64. package/Materials/shaderMaterial.js.map +1 -1
  65. package/Materials/standardMaterial.d.ts +2 -0
  66. package/Materials/standardMaterial.js +2 -0
  67. package/Materials/standardMaterial.js.map +1 -1
  68. package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
  69. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.d.ts +4 -0
  70. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +11 -2
  71. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
  72. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.d.ts +4 -0
  73. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +11 -2
  74. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
  75. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.d.ts +4 -0
  76. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +11 -2
  77. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
  78. package/Meshes/Node/Blocks/Sources/pointListBlock.d.ts +35 -0
  79. package/Meshes/Node/Blocks/Sources/pointListBlock.js +76 -0
  80. package/Meshes/Node/Blocks/Sources/pointListBlock.js.map +1 -0
  81. package/Meshes/Node/Blocks/computeNormalsBlock.js +3 -0
  82. package/Meshes/Node/Blocks/computeNormalsBlock.js.map +1 -1
  83. package/Meshes/Node/index.d.ts +1 -0
  84. package/Meshes/Node/index.js +1 -0
  85. package/Meshes/Node/index.js.map +1 -1
  86. package/Meshes/abstractMesh.hotSpot.d.ts +4 -4
  87. package/Meshes/abstractMesh.hotSpot.js +7 -10
  88. package/Meshes/abstractMesh.hotSpot.js.map +1 -1
  89. package/Meshes/abstractMesh.js +6 -0
  90. package/Meshes/abstractMesh.js.map +1 -1
  91. package/Meshes/csg2.js +15 -2
  92. package/Meshes/csg2.js.map +1 -1
  93. package/Meshes/mesh.d.ts +52 -1
  94. package/Meshes/mesh.js +60 -21
  95. package/Meshes/mesh.js.map +1 -1
  96. package/Misc/screenshotTools.js +3 -0
  97. package/Misc/screenshotTools.js.map +1 -1
  98. package/Misc/snapshotRenderingHelper.d.ts +3 -1
  99. package/Misc/snapshotRenderingHelper.js +27 -5
  100. package/Misc/snapshotRenderingHelper.js.map +1 -1
  101. package/Morph/morphTarget.d.ts +12 -0
  102. package/Morph/morphTarget.js +35 -1
  103. package/Morph/morphTarget.js.map +1 -1
  104. package/Morph/morphTargetManager.d.ts +13 -0
  105. package/Morph/morphTargetManager.js +30 -1
  106. package/Morph/morphTargetManager.js.map +1 -1
  107. package/PostProcesses/volumetricLightScatteringPostProcess.js +3 -1
  108. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  109. package/Rendering/GlobalIllumination/giRSMManager.js +2 -2
  110. package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
  111. package/Rendering/depthRenderer.js +3 -1
  112. package/Rendering/depthRenderer.js.map +1 -1
  113. package/Rendering/geometryBufferRenderer.js +3 -1
  114. package/Rendering/geometryBufferRenderer.js.map +1 -1
  115. package/Rendering/outlineRenderer.js +3 -1
  116. package/Rendering/outlineRenderer.js.map +1 -1
  117. package/Rendering/utilityLayerRenderer.d.ts +3 -1
  118. package/Rendering/utilityLayerRenderer.js +16 -7
  119. package/Rendering/utilityLayerRenderer.js.map +1 -1
  120. package/Shaders/ShadersInclude/morphTargetsVertex.js +9 -0
  121. package/Shaders/ShadersInclude/morphTargetsVertex.js.map +1 -1
  122. package/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js +3 -0
  123. package/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js.map +1 -1
  124. package/Shaders/ShadersInclude/vertexColorMixing.js +2 -2
  125. package/Shaders/ShadersInclude/vertexColorMixing.js.map +1 -1
  126. package/Shaders/background.vertex.js +1 -1
  127. package/Shaders/background.vertex.js.map +1 -1
  128. package/Shaders/color.vertex.js +3 -0
  129. package/Shaders/color.vertex.js.map +1 -1
  130. package/Shaders/default.vertex.js +3 -0
  131. package/Shaders/default.vertex.js.map +1 -1
  132. package/Shaders/greasedLine.vertex.js +1 -2
  133. package/Shaders/greasedLine.vertex.js.map +1 -1
  134. package/Shaders/pbr.vertex.js +3 -0
  135. package/Shaders/pbr.vertex.js.map +1 -1
  136. package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js +6 -0
  137. package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js.map +1 -1
  138. package/ShadersWGSL/ShadersInclude/morphTargetsVertexGlobalDeclaration.js +3 -0
  139. package/ShadersWGSL/ShadersInclude/morphTargetsVertexGlobalDeclaration.js.map +1 -1
  140. package/ShadersWGSL/boundingInfo.compute.js +3 -0
  141. package/ShadersWGSL/boundingInfo.compute.js.map +1 -1
  142. package/ShadersWGSL/color.vertex.js +3 -0
  143. package/ShadersWGSL/color.vertex.js.map +1 -1
  144. package/ShadersWGSL/default.vertex.js +3 -0
  145. package/ShadersWGSL/default.vertex.js.map +1 -1
  146. package/ShadersWGSL/greasedLine.vertex.js +2 -3
  147. package/ShadersWGSL/greasedLine.vertex.js.map +1 -1
  148. package/ShadersWGSL/pbr.vertex.js +3 -0
  149. package/ShadersWGSL/pbr.vertex.js.map +1 -1
  150. package/ShadersWGSL/screenSpaceReflection2.fragment.js +1 -0
  151. package/ShadersWGSL/screenSpaceReflection2.fragment.js.map +1 -1
  152. package/XR/features/WebXRControllerPointerSelection.js +1 -0
  153. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  154. package/package.json +1 -1
  155. package/scene.d.ts +2 -0
  156. package/scene.js +13 -9
  157. package/scene.js.map +1 -1
  158. package/types.d.ts +22 -0
  159. package/types.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"instant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,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE7C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,mBAAmB,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YACpD,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC/D,CAAC;QAED,IAAI,mBAAmB,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC7C,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;QACjD,CAAC;IACL,CAAC;CACJ;AA3TU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;iEAC3F;AAMvB;IADN,sBAAsB,CAAC,WAAW,0CAAkC,OAAO,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;0DACvF;AAuT5B,aAAa,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { INodeGeometryExecutionContext } from \"../../Interfaces/nodeGeometryExecutionContext\";\r\nimport type { VertexData } from \"../../../mesh.vertexData\";\r\nimport { Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\nimport type { Nullable } from \"../../../../types\";\r\nimport { Ray } from \"../../../../Culling/ray\";\r\nimport { extractMinAndMax } from \"../../../../Maths/math.functions\";\r\nimport type { INodeGeometryInstancingContext } from \"../../Interfaces/nodeGeometryInstancingContext\";\r\n\r\n/**\r\n * Block used to instance geometry inside a geometry\r\n */\r\nexport class InstantiateOnVolumeBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext, INodeGeometryInstancingContext {\r\n private _vertexData: VertexData;\r\n private _currentLoopIndex: number;\r\n private _currentPosition = new Vector3();\r\n private _vertex0 = new Vector3();\r\n private _vertex1 = new Vector3();\r\n private _vertex2 = new Vector3();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that a grid pattern should be used\r\n */\r\n @editableInPropertyPage(\"Grid mode\", PropertyTypeForEdition.Boolean, \"MODES\", { notifiers: { rebuild: true } })\r\n public gridMode = false;\r\n\r\n /**\r\n * Create a new InstantiateOnVolumeBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"instance\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"count\", NodeGeometryBlockConnectionPointTypes.Int, true, 256);\r\n this.registerInput(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n this.registerInput(\"gridSize\", NodeGeometryBlockConnectionPointTypes.Int, true, 10);\r\n\r\n this.scaling.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current instance index in the current flow\r\n * @returns the current index\r\n */\r\n public getInstanceIndex(): number {\r\n return this._currentLoopIndex;\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentLoopIndex;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual positions\r\n * @returns the value associated with the source\r\n */\r\n public getOverridePositionsContextualValue() {\r\n return this._currentPosition;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"InstantiateOnVolumeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry input component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the instance input component\r\n */\r\n public get instance(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the count input component\r\n */\r\n public get count(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the grid size input component\r\n */\r\n public get gridSize(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\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 _getValueOnGrid(step: number, size: number, min: number, max: number): number {\r\n const cellSize = (max - min) / size;\r\n return min + cellSize / 2 + step * cellSize;\r\n }\r\n\r\n private _getIndexinGrid(x: number, y: number, z: number, size: number) {\r\n return x + y * size + z * size * size;\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n state.pushInstancingContext(this);\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n state.pushGeometryContext(this._vertexData);\r\n\r\n if (!this._vertexData || !this._vertexData.positions || !this._vertexData.indices || !this.instance.isConnected) {\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n state.restoreGeometryContext();\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n // Processing\r\n let instanceGeometry: Nullable<VertexData> = null;\r\n const instanceCount = this.count.getConnectedValue(state);\r\n const additionalVertexData: VertexData[] = [];\r\n const boundingInfo = extractMinAndMax(this._vertexData.positions!, 0, this._vertexData.positions!.length / 3);\r\n const min = boundingInfo.minimum;\r\n const max = boundingInfo.maximum;\r\n const direction = new Vector3(0.5, 0.8, 0.2);\r\n const faceCount = this._vertexData.indices.length / 3;\r\n const gridSize = this.gridSize.getConnectedValue(state);\r\n this._currentLoopIndex = 0;\r\n\r\n let candidatesCells: Array<boolean>;\r\n if (this.gridMode) {\r\n candidatesCells = [];\r\n // Generates the list of candidates cells\r\n for (let index = 0; index < gridSize * gridSize * gridSize; index++) {\r\n candidatesCells[index] = false;\r\n }\r\n }\r\n\r\n for (let index = 0; index < instanceCount; index++) {\r\n if (this.gridMode) {\r\n // Get a random cell\r\n let cellX = Math.floor(Math.random() * gridSize);\r\n let cellY = Math.floor(Math.random() * gridSize);\r\n let cellZ = Math.floor(Math.random() * gridSize);\r\n let cellIndex = this._getIndexinGrid(cellX, cellY, cellZ, gridSize);\r\n\r\n if (candidatesCells![cellIndex]) {\r\n // Find the first one that is free\r\n let found = false;\r\n for (let candidateIndex = 0; candidateIndex < gridSize * gridSize * gridSize; candidateIndex++) {\r\n if (!candidatesCells![candidateIndex]) {\r\n cellZ = Math.floor(candidateIndex / (gridSize * gridSize));\r\n cellY = Math.floor((candidateIndex - cellZ * gridSize * gridSize) / gridSize);\r\n cellX = candidateIndex - cellZ * gridSize * gridSize - cellY * gridSize;\r\n cellIndex = this._getIndexinGrid(cellX, cellY, cellZ, gridSize);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (!found) {\r\n // No more free cells\r\n break;\r\n }\r\n }\r\n\r\n if (!candidatesCells![cellIndex]) {\r\n // Cell is free\r\n const x = this._getValueOnGrid(cellX, gridSize, min.x, max.x);\r\n const y = this._getValueOnGrid(cellY, gridSize, min.y, max.y);\r\n const z = this._getValueOnGrid(cellZ, gridSize, min.z, max.z);\r\n this._currentPosition.set(x, y, z);\r\n candidatesCells![cellIndex] = true;\r\n }\r\n } else {\r\n this._currentPosition.set(Math.random() * (max.x - min.x) + min.x, Math.random() * (max.y - min.y) + min.y, Math.random() * (max.z - min.z) + min.z);\r\n }\r\n\r\n // Cast a ray from the random point in an arbitrary direction\r\n const ray = new Ray(this._currentPosition, direction);\r\n\r\n let intersectionCount = 0;\r\n for (let currentFaceIndex = 0; currentFaceIndex < faceCount; currentFaceIndex++) {\r\n // Extract face vertices\r\n this._vertex0.fromArray(this._vertexData.positions!, this._vertexData.indices![currentFaceIndex * 3] * 3);\r\n this._vertex1.fromArray(this._vertexData.positions!, this._vertexData.indices![currentFaceIndex * 3 + 1] * 3);\r\n this._vertex2.fromArray(this._vertexData.positions!, this._vertexData.indices![currentFaceIndex * 3 + 2] * 3);\r\n\r\n const currentIntersectInfo = ray.intersectsTriangle(this._vertex0, this._vertex1, this._vertex2);\r\n\r\n if (currentIntersectInfo && currentIntersectInfo.distance > 0) {\r\n intersectionCount++;\r\n }\r\n }\r\n\r\n if (intersectionCount % 2 === 0) {\r\n // We are outside, try again\r\n index--;\r\n continue;\r\n }\r\n\r\n // Clone the instance\r\n instanceGeometry = this.instance.getConnectedValue(state) as VertexData;\r\n\r\n if (!instanceGeometry || !instanceGeometry.positions || instanceGeometry.positions.length === 0) {\r\n continue;\r\n }\r\n const clone = instanceGeometry!.clone();\r\n\r\n if (this.matrix.isConnected) {\r\n const transform = this.matrix.getConnectedValue(state);\r\n state._instantiateWithPositionAndMatrix(clone, this._currentPosition, transform, additionalVertexData);\r\n } else {\r\n const scaling = state.adaptInput(this.scaling, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.OneReadOnly);\r\n const rotation = this.rotation.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n state._instantiate(clone, this._currentPosition, rotation, scaling, additionalVertexData);\r\n }\r\n this._currentLoopIndex++;\r\n }\r\n\r\n // Merge\r\n if (additionalVertexData.length) {\r\n if (additionalVertexData.length === 1) {\r\n this._vertexData = additionalVertexData[0];\r\n } else {\r\n // We do not merge the main one as user can use a merge node if wanted\r\n const main = additionalVertexData.splice(0, 1)[0];\r\n this._vertexData = main.merge(additionalVertexData, true, false, true, true);\r\n }\r\n }\r\n\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n return this._vertexData;\r\n };\r\n\r\n // Storage\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n codeString += `${this._codeVariableName}.gridMode = ${this.gridMode ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n serializationObject.gridMode = this.gridMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n\r\n if (serializationObject.gridMode !== undefined) {\r\n this.gridMode = serializationObject.gridMode;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.InstantiateOnVolumeBlock\", InstantiateOnVolumeBlock);\r\n"]}
1
+ {"version":3,"file":"instantiateOnVolumeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAIrG,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAA0B,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAEtG,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,iBAAiB;IAqB3D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAvBR,qBAAgB,GAAG,IAAI,OAAO,EAAE,CAAC;QACjC,aAAQ,GAAG,IAAI,OAAO,EAAE,CAAC;QACzB,aAAQ,GAAG,IAAI,OAAO,EAAE,CAAC;QACzB,aAAQ,GAAG,IAAI,OAAO,EAAE,CAAC;QAEjC;;;WAGG;QAEI,oBAAe,GAAG,IAAI,CAAC;Q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;IACL,CAAC;CACJ;AAvUU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;iEAC3F;AAMvB;IADN,sBAAsB,CAAC,WAAW,0CAAkC,OAAO,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;0DACvF;AAmU5B,aAAa,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { INodeGeometryExecutionContext } from \"../../Interfaces/nodeGeometryExecutionContext\";\r\nimport type { VertexData } from \"../../../mesh.vertexData\";\r\nimport { Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\nimport type { Nullable } from \"../../../../types\";\r\nimport { Ray } from \"../../../../Culling/ray\";\r\nimport { extractMinAndMax } from \"../../../../Maths/math.functions\";\r\nimport type { INodeGeometryInstancingContext } from \"../../Interfaces/nodeGeometryInstancingContext\";\r\n\r\n/**\r\n * Block used to instance geometry inside a geometry\r\n */\r\nexport class InstantiateOnVolumeBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext, INodeGeometryInstancingContext {\r\n private _vertexData: VertexData;\r\n private _currentLoopIndex: number;\r\n private _currentPosition = new Vector3();\r\n private _vertex0 = new Vector3();\r\n private _vertex1 = new Vector3();\r\n private _vertex2 = new Vector3();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that a grid pattern should be used\r\n */\r\n @editableInPropertyPage(\"Grid mode\", PropertyTypeForEdition.Boolean, \"MODES\", { notifiers: { rebuild: true } })\r\n public gridMode = false;\r\n\r\n /**\r\n * Create a new InstantiateOnVolumeBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"instance\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"count\", NodeGeometryBlockConnectionPointTypes.Int, true, 256);\r\n this.registerInput(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"offset\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n this.registerInput(\"gridSize\", NodeGeometryBlockConnectionPointTypes.Int, true, 10);\r\n\r\n this.scaling.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current instance index in the current flow\r\n * @returns the current index\r\n */\r\n public getInstanceIndex(): number {\r\n return this._currentLoopIndex;\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentLoopIndex;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual positions\r\n * @returns the value associated with the source\r\n */\r\n public getOverridePositionsContextualValue() {\r\n return this._currentPosition;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"InstantiateOnVolumeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry input component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the instance input component\r\n */\r\n public get instance(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the count input component\r\n */\r\n public get count(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the offset input component\r\n */\r\n public get offset(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the grid size input component\r\n */\r\n public get gridSize(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\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 _getValueOnGrid(step: number, size: number, min: number, max: number): number {\r\n const cellSize = (max - min) / size;\r\n return min + cellSize / 2 + step * cellSize;\r\n }\r\n\r\n private _getIndexinGrid(x: number, y: number, z: number, size: number) {\r\n return x + y * size + z * size * size;\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n state.pushInstancingContext(this);\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n state.pushGeometryContext(this._vertexData);\r\n\r\n if (!this._vertexData || !this._vertexData.positions || !this._vertexData.indices || !this.instance.isConnected) {\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n state.restoreGeometryContext();\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n // Processing\r\n let instanceGeometry: Nullable<VertexData> = null;\r\n const instanceCount = this.count.getConnectedValue(state);\r\n const additionalVertexData: VertexData[] = [];\r\n const boundingInfo = extractMinAndMax(this._vertexData.positions!, 0, this._vertexData.positions!.length / 3);\r\n const min = boundingInfo.minimum;\r\n const max = boundingInfo.maximum;\r\n const direction = new Vector3(0.5, 0.8, 0.2);\r\n const faceCount = this._vertexData.indices.length / 3;\r\n const gridSize = this.gridSize.getConnectedValue(state);\r\n this._currentLoopIndex = 0;\r\n\r\n let candidatesCells: Array<boolean>;\r\n if (this.gridMode) {\r\n candidatesCells = [];\r\n // Generates the list of candidates cells\r\n for (let index = 0; index < gridSize * gridSize * gridSize; index++) {\r\n candidatesCells[index] = false;\r\n }\r\n }\r\n\r\n for (let index = 0; index < instanceCount; index++) {\r\n if (this.gridMode) {\r\n // Get a random cell\r\n let cellX = Math.floor(Math.random() * gridSize);\r\n let cellY = Math.floor(Math.random() * gridSize);\r\n let cellZ = Math.floor(Math.random() * gridSize);\r\n let cellIndex = this._getIndexinGrid(cellX, cellY, cellZ, gridSize);\r\n\r\n if (candidatesCells![cellIndex]) {\r\n // Find the first one that is free\r\n let found = false;\r\n for (let candidateIndex = 0; candidateIndex < gridSize * gridSize * gridSize; candidateIndex++) {\r\n if (!candidatesCells![candidateIndex]) {\r\n cellZ = Math.floor(candidateIndex / (gridSize * gridSize));\r\n cellY = Math.floor((candidateIndex - cellZ * gridSize * gridSize) / gridSize);\r\n cellX = candidateIndex - cellZ * gridSize * gridSize - cellY * gridSize;\r\n cellIndex = this._getIndexinGrid(cellX, cellY, cellZ, gridSize);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (!found) {\r\n // No more free cells\r\n break;\r\n }\r\n }\r\n\r\n if (!candidatesCells![cellIndex]) {\r\n // Cell is free\r\n const x = this._getValueOnGrid(cellX, gridSize, min.x, max.x);\r\n const y = this._getValueOnGrid(cellY, gridSize, min.y, max.y);\r\n const z = this._getValueOnGrid(cellZ, gridSize, min.z, max.z);\r\n this._currentPosition.set(x, y, z);\r\n candidatesCells![cellIndex] = true;\r\n }\r\n } else {\r\n this._currentPosition.set(Math.random() * (max.x - min.x) + min.x, Math.random() * (max.y - min.y) + min.y, Math.random() * (max.z - min.z) + min.z);\r\n }\r\n\r\n // Cast a ray from the random point in an arbitrary direction\r\n const ray = new Ray(this._currentPosition, direction);\r\n\r\n let intersectionCount = 0;\r\n for (let currentFaceIndex = 0; currentFaceIndex < faceCount; currentFaceIndex++) {\r\n // Extract face vertices\r\n this._vertex0.fromArray(this._vertexData.positions!, this._vertexData.indices![currentFaceIndex * 3] * 3);\r\n this._vertex1.fromArray(this._vertexData.positions!, this._vertexData.indices![currentFaceIndex * 3 + 1] * 3);\r\n this._vertex2.fromArray(this._vertexData.positions!, this._vertexData.indices![currentFaceIndex * 3 + 2] * 3);\r\n\r\n const currentIntersectInfo = ray.intersectsTriangle(this._vertex0, this._vertex1, this._vertex2);\r\n\r\n if (currentIntersectInfo && currentIntersectInfo.distance > 0) {\r\n intersectionCount++;\r\n }\r\n }\r\n\r\n if (intersectionCount % 2 === 0) {\r\n // We are outside, try again\r\n index--;\r\n continue;\r\n }\r\n\r\n // Clone the instance\r\n instanceGeometry = this.instance.getConnectedValue(state) as VertexData;\r\n\r\n if (!instanceGeometry || !instanceGeometry.positions || instanceGeometry.positions.length === 0) {\r\n continue;\r\n }\r\n const clone = instanceGeometry!.clone();\r\n\r\n if (this.matrix.isConnected) {\r\n const transform = this.matrix.getConnectedValue(state);\r\n state._instantiateWithPositionAndMatrix(clone, this._currentPosition, transform, additionalVertexData);\r\n } else {\r\n const offset = state.adaptInput(this.offset, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.ZeroReadOnly);\r\n const scaling = state.adaptInput(this.scaling, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.OneReadOnly);\r\n const rotation = this.rotation.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n\r\n this._currentPosition.addInPlace(offset);\r\n\r\n state._instantiate(clone, this._currentPosition, rotation, scaling, additionalVertexData);\r\n }\r\n this._currentLoopIndex++;\r\n }\r\n\r\n // Merge\r\n if (additionalVertexData.length) {\r\n if (additionalVertexData.length === 1) {\r\n this._vertexData = additionalVertexData[0];\r\n } else {\r\n // We do not merge the main one as user can use a merge node if wanted\r\n const main = additionalVertexData.splice(0, 1)[0];\r\n this._vertexData = main.merge(additionalVertexData, true, false, true, true);\r\n }\r\n }\r\n\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n return this._vertexData;\r\n };\r\n\r\n // Storage\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n codeString += `${this._codeVariableName}.gridMode = ${this.gridMode ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n serializationObject.gridMode = this.gridMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n\r\n if (serializationObject.gridMode !== undefined) {\r\n this.gridMode = serializationObject.gridMode;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.InstantiateOnVolumeBlock\", InstantiateOnVolumeBlock);\r\n"]}
@@ -0,0 +1,35 @@
1
+ import { NodeGeometryBlock } from "../../nodeGeometryBlock";
2
+ import type { NodeGeometryConnectionPoint } from "../../nodeGeometryBlockConnectionPoint";
3
+ import type { NodeGeometryBuildState } from "../../nodeGeometryBuildState";
4
+ import { Vector3 } from "../../../../Maths/math.vector.js";
5
+ /**
6
+ * Defines a block used to generate a geometry data from a list of points
7
+ */
8
+ export declare class PointListBlock extends NodeGeometryBlock {
9
+ /**
10
+ * Gets or sets a list of points used to generate the geometry
11
+ */
12
+ points: Vector3[];
13
+ /**
14
+ * Create a new PointListBlock
15
+ * @param name defines the block name
16
+ */
17
+ constructor(name: string);
18
+ /**
19
+ * Gets the current class name
20
+ * @returns the class name
21
+ */
22
+ getClassName(): string;
23
+ /**
24
+ * Gets the geometry output component
25
+ */
26
+ get geometry(): NodeGeometryConnectionPoint;
27
+ protected _buildBlock(state: NodeGeometryBuildState): void;
28
+ protected _dumpPropertiesCode(): string;
29
+ /**
30
+ * Serializes this block in a JSON representation
31
+ * @returns the serialized block object
32
+ */
33
+ serialize(): any;
34
+ _deserialize(serializationObject: any): void;
35
+ }
@@ -0,0 +1,76 @@
1
+ import { NodeGeometryBlockConnectionPointTypes } from "../../Enums/nodeGeometryConnectionPointTypes.js";
2
+ import { NodeGeometryBlock } from "../../nodeGeometryBlock.js";
3
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
4
+ import { Vector3 } from "../../../../Maths/math.vector.js";
5
+ import { VertexData } from "../../../mesh.vertexData.js";
6
+ /**
7
+ * Defines a block used to generate a geometry data from a list of points
8
+ */
9
+ export class PointListBlock extends NodeGeometryBlock {
10
+ /**
11
+ * Create a new PointListBlock
12
+ * @param name defines the block name
13
+ */
14
+ constructor(name) {
15
+ super(name);
16
+ /**
17
+ * Gets or sets a list of points used to generate the geometry
18
+ */
19
+ this.points = [];
20
+ this.registerOutput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
21
+ }
22
+ /**
23
+ * Gets the current class name
24
+ * @returns the class name
25
+ */
26
+ getClassName() {
27
+ return "PointListBlock";
28
+ }
29
+ /**
30
+ * Gets the geometry output component
31
+ */
32
+ get geometry() {
33
+ return this._outputs[0];
34
+ }
35
+ _buildBlock(state) {
36
+ this.geometry._storedFunction = () => {
37
+ this.geometry._executionCount = 1;
38
+ if (this.points.length === 0) {
39
+ return null;
40
+ }
41
+ const vertexData = new VertexData();
42
+ vertexData.positions = this.points.reduce((acc, point) => {
43
+ acc.push(point.x, point.y, point.z);
44
+ return acc;
45
+ }, []);
46
+ return vertexData;
47
+ };
48
+ }
49
+ _dumpPropertiesCode() {
50
+ let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.points = [];\n`;
51
+ for (let i = 0; i < this.points.length; i++) {
52
+ const point = this.points[i];
53
+ codeString += `${this._codeVariableName}.points.push(new BABYLON.Vector3(${point.x}, ${point.y}, ${point.z}));\n`;
54
+ }
55
+ return codeString;
56
+ }
57
+ /**
58
+ * Serializes this block in a JSON representation
59
+ * @returns the serialized block object
60
+ */
61
+ serialize() {
62
+ const serializationObject = super.serialize();
63
+ serializationObject.points = this.points.map((point) => {
64
+ return point.asArray();
65
+ });
66
+ return serializationObject;
67
+ }
68
+ _deserialize(serializationObject) {
69
+ super._deserialize(serializationObject);
70
+ this.points = serializationObject.points.map((point) => {
71
+ return Vector3.FromArray(point);
72
+ });
73
+ }
74
+ }
75
+ RegisterClass("BABYLON.PointListBlock", PointListBlock);
76
+ //# sourceMappingURL=pointListBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointListBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Bloc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from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\n\r\n/**\r\n * Defines a block used to generate a geometry data from a list of points\r\n */\r\nexport class PointListBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets a list of points used to generate the geometry\r\n */\r\n public points: Vector3[] = [];\r\n\r\n /**\r\n * Create a new PointListBlock\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.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"PointListBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n this.geometry._storedFunction = () => {\r\n this.geometry._executionCount = 1;\r\n\r\n if (this.points.length === 0) {\r\n return null;\r\n }\r\n\r\n const vertexData = new VertexData();\r\n vertexData.positions = this.points.reduce((acc, point) => {\r\n acc.push(point.x, point.y, point.z);\r\n return acc;\r\n }, [] as number[]);\r\n\r\n return vertexData;\r\n };\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.points = [];\\n`;\r\n\r\n for (let i = 0; i < this.points.length; i++) {\r\n const point = this.points[i];\r\n codeString += `${this._codeVariableName}.points.push(new BABYLON.Vector3(${point.x}, ${point.y}, ${point.z}));\\n`;\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 override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.points = this.points.map((point) => {\r\n return point.asArray();\r\n });\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.points = serializationObject.points.map((point: number[]) => {\r\n return Vector3.FromArray(point);\r\n });\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PointListBlock\", PointListBlock);\r\n"]}
@@ -40,6 +40,9 @@ export class ComputeNormalsBlock extends NodeGeometryBlock {
40
40
  return null;
41
41
  }
42
42
  const vertexData = this.geometry.getConnectedValue(state);
43
+ if (!vertexData) {
44
+ return null;
45
+ }
43
46
  if (!vertexData.normals) {
44
47
  vertexData.normals = [];
45
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"computeNormalsBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/computeNormalsBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iCAAoC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IACtD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,qBAAqB,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAEkB,WAAW;QAC1B,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YACpC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;gBAC7B,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAC1D,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;gBACtB,UAAU,CAAC,OAAO,GAAG,EAAE,CAAC;YAC5B,CAAC;YAED,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;YAExF,OAAO,UAAU,CAAC;QACtB,CAAC,CAAC;IACN,CAAC;CACJ;AAED,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n/**\r\n * Block used to recompute normals for a geometry\r\n */\r\nexport class ComputeNormalsBlock 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(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ComputeNormalsBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n this.output._storedFunction = (state) => {\r\n if (!this.geometry.isConnected) {\r\n return null;\r\n }\r\n\r\n const vertexData = this.geometry.getConnectedValue(state);\r\n if (!vertexData.normals) {\r\n vertexData.normals = [];\r\n }\r\n\r\n VertexData.ComputeNormals(vertexData.positions, vertexData.indices, vertexData.normals);\r\n\r\n return vertexData;\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ComputeNormalsBlock\", ComputeNormalsBlock);\r\n"]}
1
+ {"version":3,"file":"computeNormalsBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/computeNormalsBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iCAAoC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IACtD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,qBAAqB,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAEkB,WAAW;QAC1B,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YACpC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;gBAC7B,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAC1D,IAAI,CAAC,UAAU,EAAE,CAAC;gBACd,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;gBACtB,UAAU,CAAC,OAAO,GAAG,EAAE,CAAC;YAC5B,CAAC;YAED,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;YAExF,OAAO,UAAU,CAAC;QACtB,CAAC,CAAC;IACN,CAAC;CACJ;AAED,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\n/**\r\n * Block used to recompute normals for a geometry\r\n */\r\nexport class ComputeNormalsBlock 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(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ComputeNormalsBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n this.output._storedFunction = (state) => {\r\n if (!this.geometry.isConnected) {\r\n return null;\r\n }\r\n\r\n const vertexData = this.geometry.getConnectedValue(state);\r\n if (!vertexData) {\r\n return null;\r\n }\r\n\r\n if (!vertexData.normals) {\r\n vertexData.normals = [];\r\n }\r\n\r\n VertexData.ComputeNormals(vertexData.positions, vertexData.indices, vertexData.normals);\r\n\r\n return vertexData;\r\n };\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ComputeNormalsBlock\", ComputeNormalsBlock);\r\n"]}
@@ -19,6 +19,7 @@ export * from "./Blocks/Sources/cylinderBlock";
19
19
  export * from "./Blocks/Sources/capsuleBlock";
20
20
  export * from "./Blocks/Sources/discBlock";
21
21
  export * from "./Blocks/Sources/nullBlock";
22
+ export * from "./Blocks/Sources/pointListBlock";
22
23
  export * from "./Blocks/Set/setPositionsBlock";
23
24
  export * from "./Blocks/Set/setNormalsBlock";
24
25
  export * from "./Blocks/Set/setUVsBlock";
@@ -19,6 +19,7 @@ export * from "./Blocks/Sources/cylinderBlock.js";
19
19
  export * from "./Blocks/Sources/capsuleBlock.js";
20
20
  export * from "./Blocks/Sources/discBlock.js";
21
21
  export * from "./Blocks/Sources/nullBlock.js";
22
+ export * from "./Blocks/Sources/pointListBlock.js";
22
23
  export * from "./Blocks/Set/setPositionsBlock.js";
23
24
  export * from "./Blocks/Set/setNormalsBlock.js";
24
25
  export * from "./Blocks/Set/setUVsBlock.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oC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\";\r\nexport * from \"./nodeGeometryBlockConnectionPoint\";\r\nexport * from \"./nodeGeometryBuildState\";\r\nexport * from \"./Interfaces/nodeGeometryExecutionContext\";\r\nexport * from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nexport * from \"./Enums/nodeGeometryContextualSources\";\r\nexport * from \"./Blocks/geometryOptimizeBlock\";\r\nexport * from \"./Blocks/geometryOutputBlock\";\r\nexport * from \"./Blocks/geometryInputBlock\";\r\nexport * from \"./Blocks/Sources/planeBlock\";\r\nexport * from \"./Blocks/Sources/boxBlock\";\r\nexport * from \"./Blocks/Sources/meshBlock\";\r\nexport * from \"./Blocks/Sources/icoSphereBlock\";\r\nexport * from \"./Blocks/Sources/sphereBlock\";\r\nexport * from \"./Blocks/Sources/gridBlock\";\r\nexport * from \"./Blocks/Sources/torusBlock\";\r\nexport * from \"./Blocks/Sources/cylinderBlock\";\r\nexport * from \"./Blocks/Sources/capsuleBlock\";\r\nexport * from \"./Blocks/Sources/discBlock\";\r\nexport * from \"./Blocks/Sources/nullBlock\";\r\nexport * from \"./Blocks/Set/setPositionsBlock\";\r\nexport * from \"./Blocks/Set/setNormalsBlock\";\r\nexport * from \"./Blocks/Set/setUVsBlock\";\r\nexport * from \"./Blocks/Set/setColorsBlock\";\r\nexport * from \"./Blocks/Set/setTangentsBlock\";\r\nexport * from \"./Blocks/mathBlock\";\r\nexport * from \"./Blocks/mapRangeBlock\";\r\nexport * from \"./Blocks/conditionBlock\";\r\nexport * from \"./Blocks/randomBlock\";\r\nexport * from \"./Blocks/noiseBlock\";\r\nexport * from \"./Blocks/mergeGeometryBlock\";\r\nexport * from \"./Blocks/geometryCollectionBlock\";\r\nexport * from \"./Blocks/cleanGeometryBlock\";\r\nexport * from \"./Blocks/geometryElbowBlock\";\r\nexport * from \"./Blocks/computeNormalsBlock\";\r\nexport * from \"./Blocks/vectorConverterBlock\";\r\nexport * from \"./Blocks/normalizeVectorBlock\";\r\nexport * from \"./Blocks/Set/setMaterialIDBlock\";\r\nexport * from \"./Blocks/Set/latticeBlock\";\r\nexport * from \"./Blocks/geometryTrigonometryBlock\";\r\nexport * from \"./Blocks/geometryTransformBlock\";\r\nexport * from \"./Blocks/Matrices/rotationXBlock\";\r\nexport * from \"./Blocks/Matrices/rotationYBlock\";\r\nexport * from \"./Blocks/Matrices/rotationZBlock\";\r\nexport * from \"./Blocks/Matrices/scalingBlock\";\r\nexport * from \"./Blocks/Matrices/alignBlock\";\r\nexport * from \"./Blocks/Matrices/translationBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVerticesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnFacesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVolumeBlock\";\r\nexport * from \"./Blocks/Instances/instantiateBlock\";\r\nexport * from \"./Blocks/Instances/instantiateLinearBlock\";\r\nexport * from \"./Blocks/Instances/instantiateRadialBlock\";\r\nexport * from \"./Blocks/intFloatConverterBlock\";\r\nexport * from \"./Blocks/debugBlock\";\r\nexport * from \"./Blocks/geometryInfoBlock\";\r\nexport * from \"./Blocks/mappingBlock\";\r\nexport * from \"./Blocks/matrixComposeBlock\";\r\nexport * from \"./Blocks/Teleport/teleportInBlock\";\r\nexport * from \"./Blocks/Teleport/teleportOutBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureFetchBlock\";\r\nexport * from \"./Blocks/boundingBlock\";\r\nexport * from \"./Blocks/booleanGeometryBlock\";\r\nexport * from \"./Blocks/geometryArcTan2Block\";\r\nexport * from \"./Blocks/geometryLerpBlock\";\r\nexport * from \"./Blocks/geometryNLerpBlock\";\r\nexport * from \"./Blocks/geometryStepBlock\";\r\nexport * from \"./Blocks/geometrySmoothStepBlock\";\r\nexport * from \"./Blocks/geometryModBlock\";\r\nexport * from \"./Blocks/geometryPowBlock\";\r\nexport * from \"./Blocks/geometryClampBlock\";\r\nexport * from \"./Blocks/geometryCrossBlock\";\r\nexport * from \"./Blocks/geometryCurveBlock\";\r\nexport * from \"./Blocks/geometryDesaturateBlock\";\r\nexport * from \"./Blocks/geometryPosterizeBlock\";\r\nexport * from \"./Blocks/geometryReplaceColorBlock\";\r\nexport * from \"./Blocks/geometryDistanceBlock\";\r\nexport * from \"./Blocks/geometryDotBlock\";\r\nexport * from \"./Blocks/geometryLengthBlock\";\r\nexport * from \"./Blocks/geometryRotate2dBlock\";\r\nexport * from \"./Blocks/geometryInterceptorBlock\";\r\nexport * from \"./Blocks/Set/aggregatorBlock\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,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A6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC","sourcesContent":["export * from \"./nodeGeometry\";\r\nexport * from \"./nodeGeometryBlock\";\r\nexport * from \"./nodeGeometryBlockConnectionPoint\";\r\nexport * from \"./nodeGeometryBuildState\";\r\nexport * from \"./Interfaces/nodeGeometryExecutionContext\";\r\nexport * from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nexport * from \"./Enums/nodeGeometryContextualSources\";\r\nexport * from \"./Blocks/geometryOptimizeBlock\";\r\nexport * from \"./Blocks/geometryOutputBlock\";\r\nexport * from \"./Blocks/geometryInputBlock\";\r\nexport * from \"./Blocks/Sources/planeBlock\";\r\nexport * from \"./Blocks/Sources/boxBlock\";\r\nexport * from \"./Blocks/Sources/meshBlock\";\r\nexport * from \"./Blocks/Sources/icoSphereBlock\";\r\nexport * from \"./Blocks/Sources/sphereBlock\";\r\nexport * from \"./Blocks/Sources/gridBlock\";\r\nexport * from \"./Blocks/Sources/torusBlock\";\r\nexport * from \"./Blocks/Sources/cylinderBlock\";\r\nexport * from \"./Blocks/Sources/capsuleBlock\";\r\nexport * from \"./Blocks/Sources/discBlock\";\r\nexport * from \"./Blocks/Sources/nullBlock\";\r\nexport * from \"./Blocks/Sources/pointListBlock\";\r\nexport * from \"./Blocks/Set/setPositionsBlock\";\r\nexport * from \"./Blocks/Set/setNormalsBlock\";\r\nexport * from \"./Blocks/Set/setUVsBlock\";\r\nexport * from \"./Blocks/Set/setColorsBlock\";\r\nexport * from \"./Blocks/Set/setTangentsBlock\";\r\nexport * from \"./Blocks/mathBlock\";\r\nexport * from \"./Blocks/mapRangeBlock\";\r\nexport * from \"./Blocks/conditionBlock\";\r\nexport * from \"./Blocks/randomBlock\";\r\nexport * from \"./Blocks/noiseBlock\";\r\nexport * from \"./Blocks/mergeGeometryBlock\";\r\nexport * from \"./Blocks/geometryCollectionBlock\";\r\nexport * from \"./Blocks/cleanGeometryBlock\";\r\nexport * from \"./Blocks/geometryElbowBlock\";\r\nexport * from \"./Blocks/computeNormalsBlock\";\r\nexport * from \"./Blocks/vectorConverterBlock\";\r\nexport * from \"./Blocks/normalizeVectorBlock\";\r\nexport * from \"./Blocks/Set/setMaterialIDBlock\";\r\nexport * from \"./Blocks/Set/latticeBlock\";\r\nexport * from \"./Blocks/geometryTrigonometryBlock\";\r\nexport * from \"./Blocks/geometryTransformBlock\";\r\nexport * from \"./Blocks/Matrices/rotationXBlock\";\r\nexport * from \"./Blocks/Matrices/rotationYBlock\";\r\nexport * from \"./Blocks/Matrices/rotationZBlock\";\r\nexport * from \"./Blocks/Matrices/scalingBlock\";\r\nexport * from \"./Blocks/Matrices/alignBlock\";\r\nexport * from \"./Blocks/Matrices/translationBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVerticesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnFacesBlock\";\r\nexport * from \"./Blocks/Instances/instantiateOnVolumeBlock\";\r\nexport * from \"./Blocks/Instances/instantiateBlock\";\r\nexport * from \"./Blocks/Instances/instantiateLinearBlock\";\r\nexport * from \"./Blocks/Instances/instantiateRadialBlock\";\r\nexport * from \"./Blocks/intFloatConverterBlock\";\r\nexport * from \"./Blocks/debugBlock\";\r\nexport * from \"./Blocks/geometryInfoBlock\";\r\nexport * from \"./Blocks/mappingBlock\";\r\nexport * from \"./Blocks/matrixComposeBlock\";\r\nexport * from \"./Blocks/Teleport/teleportInBlock\";\r\nexport * from \"./Blocks/Teleport/teleportOutBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureBlock\";\r\nexport * from \"./Blocks/Textures/geometryTextureFetchBlock\";\r\nexport * from \"./Blocks/boundingBlock\";\r\nexport * from \"./Blocks/booleanGeometryBlock\";\r\nexport * from \"./Blocks/geometryArcTan2Block\";\r\nexport * from \"./Blocks/geometryLerpBlock\";\r\nexport * from \"./Blocks/geometryNLerpBlock\";\r\nexport * from \"./Blocks/geometryStepBlock\";\r\nexport * from \"./Blocks/geometrySmoothStepBlock\";\r\nexport * from \"./Blocks/geometryModBlock\";\r\nexport * from \"./Blocks/geometryPowBlock\";\r\nexport * from \"./Blocks/geometryClampBlock\";\r\nexport * from \"./Blocks/geometryCrossBlock\";\r\nexport * from \"./Blocks/geometryCurveBlock\";\r\nexport * from \"./Blocks/geometryDesaturateBlock\";\r\nexport * from \"./Blocks/geometryPosterizeBlock\";\r\nexport * from \"./Blocks/geometryReplaceColorBlock\";\r\nexport * from \"./Blocks/geometryDistanceBlock\";\r\nexport * from \"./Blocks/geometryDotBlock\";\r\nexport * from \"./Blocks/geometryLengthBlock\";\r\nexport * from \"./Blocks/geometryRotate2dBlock\";\r\nexport * from \"./Blocks/geometryInterceptorBlock\";\r\nexport * from \"./Blocks/Set/aggregatorBlock\";\r\n"]}
@@ -1,4 +1,4 @@
1
- import type { AbstractMesh, Nullable, PickingInfo } from "../index.js";
1
+ import type { AbstractMesh, PickingInfo } from "../index.js";
2
2
  import { Vector3 } from "../Maths/math.vector";
3
3
  /**
4
4
  * Data for mesh hotspot computation
@@ -15,11 +15,11 @@ export type HotSpotQuery = {
15
15
  };
16
16
  /**
17
17
  * Create a HotSpotQuery from a picking info
18
- * @remarks If there is no pickedMesh or the pickedMesh has no indices, null will be returned
18
+ * @remarks If there is no pickedMesh or the pickedMesh has no indices, the faceId is used as the base index
19
19
  * @param pickingInfo picking info to use
20
- * @returns HotSpotQuery or null if it was not possible to create one
20
+ * @returns the created HotSpotQuery
21
21
  */
22
- export declare function CreateHotSpotQueryForPickingInfo(pickingInfo: PickingInfo): Nullable<HotSpotQuery>;
22
+ export declare function CreateHotSpotQueryForPickingInfo(pickingInfo: PickingInfo): HotSpotQuery;
23
23
  /**
24
24
  * Return a transformed local position from a mesh and vertex index
25
25
  * @param mesh mesh used to get vertex array from
@@ -3,20 +3,17 @@ import { VertexBuffer } from "../Buffers/buffer.js";
3
3
 
4
4
  /**
5
5
  * Create a HotSpotQuery from a picking info
6
- * @remarks If there is no pickedMesh or the pickedMesh has no indices, null will be returned
6
+ * @remarks If there is no pickedMesh or the pickedMesh has no indices, the faceId is used as the base index
7
7
  * @param pickingInfo picking info to use
8
- * @returns HotSpotQuery or null if it was not possible to create one
8
+ * @returns the created HotSpotQuery
9
9
  */
10
10
  export function CreateHotSpotQueryForPickingInfo(pickingInfo) {
11
11
  const indices = pickingInfo.pickedMesh?.getIndices();
12
- if (indices) {
13
- const base = pickingInfo.faceId * 3;
14
- return {
15
- pointIndex: [indices[base], indices[base + 1], indices[base + 2]],
16
- barycentric: [pickingInfo.bu, pickingInfo.bv, 1 - pickingInfo.bu - pickingInfo.bv],
17
- };
18
- }
19
- return null;
12
+ const base = pickingInfo.faceId * 3;
13
+ return {
14
+ pointIndex: indices ? [indices[base], indices[base + 1], indices[base + 2]] : [base, base + 1, base + 2],
15
+ barycentric: [pickingInfo.bu, pickingInfo.bv, 1 - pickingInfo.bu - pickingInfo.bv],
16
+ };
20
17
  }
21
18
  /**
22
19
  * Return a transformed local position from a mesh and vertex index
@@ -1 +1 @@
1
- {"version":3,"file":"abstractMesh.hotSpot.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/abstractMesh.hotSpot.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,gCAA+B;AAgBnD;;;;;GAKG;AACH,MAAM,UAAU,gCAAgC,CAAC,WAAwB;IACrE,MAAM,OAAO,GAAG,WAAW,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC;IACrD,IAAI,OAAO,EAAE,C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AC,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACvC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC1B,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QACjC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC1B,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QACjC,QAAQ,CAAC,SAAS,EAAE,CAAC;QACrB,QAAQ,CAAC,SAAS,EAAE,CAAC;QACrB,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAElD,2CAA2C;QAC3C,MAAM,UAAU,GACZ,IAAI,CAAC,QAAQ;YACb,IAAI,CAAC,QAAQ,CAAC,eAAe;gBACzB,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAAC,CAAC,SAAS,CAAC,wCAAwC,CAAC,CAAC;QAElJ,IAAI,UAAU,EAAE,CAAC;YACb,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,CAAC;QAED,oCAAoC;QACpC,OAAO,CAAC,oBAAoB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,EAAE,SAAS,CAAC,CAAC;QAC1E,SAAS,CAAC,SAAS,EAAE,CAAC;IAC1B,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { AbstractMesh, Nullable, PickingInfo } from \"core/index\";\r\nimport { Vector3, TmpVectors, Matrix } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\n/**\r\n * Data for mesh hotspot computation\r\n */\r\nexport type HotSpotQuery = {\r\n /**\r\n * 3 point indices\r\n */\r\n pointIndex: [number, number, number];\r\n /**\r\n * 3 barycentric coordinates\r\n */\r\n barycentric: [number, number, number];\r\n};\r\n\r\n/**\r\n * Create a HotSpotQuery from a picking info\r\n * @remarks If there is no pickedMesh or the pickedMesh has no indices, null will be returned\r\n * @param pickingInfo picking info to use\r\n * @returns HotSpotQuery or null if it was not possible to create one\r\n */\r\nexport function CreateHotSpotQueryForPickingInfo(pickingInfo: PickingInfo): Nullable<HotSpotQuery> {\r\n const indices = pickingInfo.pickedMesh?.getIndices();\r\n if (indices) {\r\n const base = pickingInfo.faceId * 3;\r\n return {\r\n pointIndex: [indices[base], indices[base + 1], indices[base + 2]],\r\n barycentric: [pickingInfo.bu, pickingInfo.bv, 1 - pickingInfo.bu - pickingInfo.bv],\r\n };\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Return a transformed local position from a mesh and vertex index\r\n * @param mesh mesh used to get vertex array from\r\n * @param index vertex index\r\n * @param res resulting local position\r\n * @returns false if it was not possible to compute the position for that vertex\r\n */\r\nexport function GetTransformedPosition(mesh: AbstractMesh, index: number, res: Vector3): boolean {\r\n const data = mesh.getVerticesData(VertexBuffer.PositionKind);\r\n if (!data) {\r\n return false;\r\n }\r\n const base = index * 3;\r\n const values = [data[base + 0], data[base + 1], data[base + 2]];\r\n if (values.some((value) => isNaN(value ?? Number.NaN))) {\r\n return false;\r\n }\r\n\r\n if (mesh.morphTargetManager) {\r\n for (let component = 0; component < 3; component++) {\r\n let value = values[component];\r\n for (let targetCount = 0; targetCount < mesh.morphTargetManager.numTargets; targetCount++) {\r\n const target = mesh.morphTargetManager.getTarget(targetCount);\r\n const influence = target.influence;\r\n if (influence !== 0) {\r\n const targetData = target.getPositions();\r\n if (targetData) {\r\n value += (targetData[base + component] - data[base + component]) * influence;\r\n }\r\n }\r\n }\r\n values[component] = value;\r\n }\r\n }\r\n res.fromArray(values);\r\n if (mesh.skeleton) {\r\n const matricesIndicesData = mesh.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n const matricesWeightsData = mesh.getVerticesData(VertexBuffer.MatricesWeightsKind);\r\n if (matricesWeightsData && matricesIndicesData) {\r\n const needExtras = mesh.numBoneInfluencers > 4;\r\n const matricesIndicesExtraData = needExtras ? mesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\r\n const matricesWeightsExtraData = needExtras ? mesh.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\r\n const skeletonMatrices = mesh.skeleton.getTransformMatrices(mesh);\r\n\r\n const finalMatrix = TmpVectors.Matrix[0];\r\n const tempMatrix = TmpVectors.Matrix[1];\r\n\r\n finalMatrix.reset();\r\n const matWeightIdx = index * 4;\r\n\r\n let inf: number;\r\n let weight: number;\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n if (matricesIndicesExtraData && matricesWeightsExtraData) {\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsExtraData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n }\r\n\r\n Vector3.TransformCoordinatesFromFloatsToRef(values[0], values[1], values[2], finalMatrix, res);\r\n }\r\n }\r\n\r\n return true;\r\n}\r\n\r\n/**\r\n * Compute a world space hotspot position\r\n * TmpVectors.Vector3[0..4] are modified by this function. Do not use them as result output.\r\n * @param mesh mesh used to get hotspot from\r\n * @param hotSpotQuery point indices and barycentric\r\n * @param resPosition output world position\r\n * @param resNormal optional output world normal\r\n * @returns false if it was not possible to compute the hotspot position\r\n */\r\nexport function GetHotSpotToRef(mesh: AbstractMesh, hotSpotQuery: HotSpotQuery, resPosition: Vector3, resNormal?: Vector3): boolean {\r\n resPosition.set(0, 0, 0);\r\n for (let i = 0; i < 3; i++) {\r\n const index = hotSpotQuery.pointIndex[i];\r\n if (!GetTransformedPosition(mesh, index, TmpVectors.Vector3[i])) {\r\n return false;\r\n }\r\n TmpVectors.Vector3[i].scaleAndAddToRef(hotSpotQuery.barycentric[i], resPosition);\r\n }\r\n\r\n // Convert the result to world space\r\n Vector3.TransformCoordinatesToRef(resPosition, mesh.getWorldMatrix(), resPosition);\r\n\r\n // compute normal in world space\r\n if (resNormal) {\r\n const pointA = TmpVectors.Vector3[0];\r\n const pointB = TmpVectors.Vector3[1];\r\n const pointC = TmpVectors.Vector3[2];\r\n const segmentA = TmpVectors.Vector3[3];\r\n const segmentB = TmpVectors.Vector3[4];\r\n segmentA.copyFrom(pointB);\r\n segmentA.subtractInPlace(pointA);\r\n segmentB.copyFrom(pointC);\r\n segmentB.subtractInPlace(pointA);\r\n segmentA.normalize();\r\n segmentB.normalize();\r\n Vector3.CrossToRef(segmentA, segmentB, resNormal);\r\n\r\n // flip normal when face culling is changed\r\n const flipNormal =\r\n mesh.material &&\r\n mesh.material.sideOrientation ===\r\n (mesh.getScene().useRightHandedSystem ? Constants.MATERIAL_ClockWiseSideOrientation : Constants.MATERIAL_CounterClockWiseSideOrientation);\r\n\r\n if (flipNormal) {\r\n resNormal.scaleInPlace(-1);\r\n }\r\n\r\n // Convert the result to world space\r\n Vector3.TransformNormalToRef(resNormal, mesh.getWorldMatrix(), resNormal);\r\n resNormal.normalize();\r\n }\r\n\r\n return true;\r\n}\r\n"]}
1
+ {"version":3,"file":"abstractMesh.hotSpot.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/abstractMesh.hotSpot.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAA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al-modules\r\nimport type { AbstractMesh, PickingInfo } from \"core/index\";\r\nimport { Vector3, TmpVectors, Matrix } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\n/**\r\n * Data for mesh hotspot computation\r\n */\r\nexport type HotSpotQuery = {\r\n /**\r\n * 3 point indices\r\n */\r\n pointIndex: [number, number, number];\r\n /**\r\n * 3 barycentric coordinates\r\n */\r\n barycentric: [number, number, number];\r\n};\r\n\r\n/**\r\n * Create a HotSpotQuery from a picking info\r\n * @remarks If there is no pickedMesh or the pickedMesh has no indices, the faceId is used as the base index\r\n * @param pickingInfo picking info to use\r\n * @returns the created HotSpotQuery\r\n */\r\nexport function CreateHotSpotQueryForPickingInfo(pickingInfo: PickingInfo): HotSpotQuery {\r\n const indices = pickingInfo.pickedMesh?.getIndices();\r\n const base = pickingInfo.faceId * 3;\r\n\r\n return {\r\n pointIndex: indices ? [indices[base], indices[base + 1], indices[base + 2]] : [base, base + 1, base + 2],\r\n barycentric: [pickingInfo.bu, pickingInfo.bv, 1 - pickingInfo.bu - pickingInfo.bv],\r\n };\r\n}\r\n\r\n/**\r\n * Return a transformed local position from a mesh and vertex index\r\n * @param mesh mesh used to get vertex array from\r\n * @param index vertex index\r\n * @param res resulting local position\r\n * @returns false if it was not possible to compute the position for that vertex\r\n */\r\nexport function GetTransformedPosition(mesh: AbstractMesh, index: number, res: Vector3): boolean {\r\n const data = mesh.getVerticesData(VertexBuffer.PositionKind);\r\n if (!data) {\r\n return false;\r\n }\r\n const base = index * 3;\r\n const values = [data[base + 0], data[base + 1], data[base + 2]];\r\n if (values.some((value) => isNaN(value ?? Number.NaN))) {\r\n return false;\r\n }\r\n\r\n if (mesh.morphTargetManager) {\r\n for (let component = 0; component < 3; component++) {\r\n let value = values[component];\r\n for (let targetCount = 0; targetCount < mesh.morphTargetManager.numTargets; targetCount++) {\r\n const target = mesh.morphTargetManager.getTarget(targetCount);\r\n const influence = target.influence;\r\n if (influence !== 0) {\r\n const targetData = target.getPositions();\r\n if (targetData) {\r\n value += (targetData[base + component] - data[base + component]) * influence;\r\n }\r\n }\r\n }\r\n values[component] = value;\r\n }\r\n }\r\n res.fromArray(values);\r\n if (mesh.skeleton) {\r\n const matricesIndicesData = mesh.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n const matricesWeightsData = mesh.getVerticesData(VertexBuffer.MatricesWeightsKind);\r\n if (matricesWeightsData && matricesIndicesData) {\r\n const needExtras = mesh.numBoneInfluencers > 4;\r\n const matricesIndicesExtraData = needExtras ? mesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\r\n const matricesWeightsExtraData = needExtras ? mesh.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\r\n const skeletonMatrices = mesh.skeleton.getTransformMatrices(mesh);\r\n\r\n const finalMatrix = TmpVectors.Matrix[0];\r\n const tempMatrix = TmpVectors.Matrix[1];\r\n\r\n finalMatrix.reset();\r\n const matWeightIdx = index * 4;\r\n\r\n let inf: number;\r\n let weight: number;\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n if (matricesIndicesExtraData && matricesWeightsExtraData) {\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsExtraData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n }\r\n\r\n Vector3.TransformCoordinatesFromFloatsToRef(values[0], values[1], values[2], finalMatrix, res);\r\n }\r\n }\r\n\r\n return true;\r\n}\r\n\r\n/**\r\n * Compute a world space hotspot position\r\n * TmpVectors.Vector3[0..4] are modified by this function. Do not use them as result output.\r\n * @param mesh mesh used to get hotspot from\r\n * @param hotSpotQuery point indices and barycentric\r\n * @param resPosition output world position\r\n * @param resNormal optional output world normal\r\n * @returns false if it was not possible to compute the hotspot position\r\n */\r\nexport function GetHotSpotToRef(mesh: AbstractMesh, hotSpotQuery: HotSpotQuery, resPosition: Vector3, resNormal?: Vector3): boolean {\r\n resPosition.set(0, 0, 0);\r\n for (let i = 0; i < 3; i++) {\r\n const index = hotSpotQuery.pointIndex[i];\r\n if (!GetTransformedPosition(mesh, index, TmpVectors.Vector3[i])) {\r\n return false;\r\n }\r\n TmpVectors.Vector3[i].scaleAndAddToRef(hotSpotQuery.barycentric[i], resPosition);\r\n }\r\n\r\n // Convert the result to world space\r\n Vector3.TransformCoordinatesToRef(resPosition, mesh.getWorldMatrix(), resPosition);\r\n\r\n // compute normal in world space\r\n if (resNormal) {\r\n const pointA = TmpVectors.Vector3[0];\r\n const pointB = TmpVectors.Vector3[1];\r\n const pointC = TmpVectors.Vector3[2];\r\n const segmentA = TmpVectors.Vector3[3];\r\n const segmentB = TmpVectors.Vector3[4];\r\n segmentA.copyFrom(pointB);\r\n segmentA.subtractInPlace(pointA);\r\n segmentB.copyFrom(pointC);\r\n segmentB.subtractInPlace(pointA);\r\n segmentA.normalize();\r\n segmentB.normalize();\r\n Vector3.CrossToRef(segmentA, segmentB, resNormal);\r\n\r\n // flip normal when face culling is changed\r\n const flipNormal =\r\n mesh.material &&\r\n mesh.material.sideOrientation ===\r\n (mesh.getScene().useRightHandedSystem ? Constants.MATERIAL_ClockWiseSideOrientation : Constants.MATERIAL_CounterClockWiseSideOrientation);\r\n\r\n if (flipNormal) {\r\n resNormal.scaleInPlace(-1);\r\n }\r\n\r\n // Convert the result to world space\r\n Vector3.TransformNormalToRef(resNormal, mesh.getWorldMatrix(), resNormal);\r\n resNormal.normalize();\r\n }\r\n\r\n return true;\r\n}\r\n"]}
@@ -32,6 +32,12 @@ function applyMorph(data, kind, morphTargetManager) {
32
32
  case VertexBuffer.UVKind:
33
33
  getTargetData = (target) => target.getUVs();
34
34
  break;
35
+ case VertexBuffer.UV2Kind:
36
+ getTargetData = (target) => target.getUV2s();
37
+ break;
38
+ case VertexBuffer.ColorKind:
39
+ getTargetData = (target) => target.getColors();
40
+ break;
35
41
  default:
36
42
  return;
37
43
  }