@babylonjs/core 7.27.0 → 7.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/Animations/animationGroup.d.ts +2 -2
  2. package/Animations/animationGroup.js.map +1 -1
  3. package/Audio/audioSceneComponent.d.ts +5 -9
  4. package/Audio/audioSceneComponent.js.map +1 -1
  5. package/Bones/skeleton.d.ts +2 -2
  6. package/Bones/skeleton.js.map +1 -1
  7. package/Cameras/camera.d.ts +2 -0
  8. package/Cameras/camera.js +2 -0
  9. package/Cameras/camera.js.map +1 -1
  10. package/Engines/WebGPU/webgpuSnapshotRendering.js +3 -0
  11. package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
  12. package/Engines/abstractEngine.js +2 -2
  13. package/Engines/abstractEngine.js.map +1 -1
  14. package/{abstractScene.d.ts → IAssetContainer.d.ts} +33 -6
  15. package/IAssetContainer.js +2 -0
  16. package/IAssetContainer.js.map +1 -0
  17. package/Layers/effectLayerSceneComponent.d.ts +6 -6
  18. package/Layers/effectLayerSceneComponent.js +3 -3
  19. package/Layers/effectLayerSceneComponent.js.map +1 -1
  20. package/Layers/glowLayer.d.ts +3 -3
  21. package/Layers/glowLayer.js +2 -2
  22. package/Layers/glowLayer.js.map +1 -1
  23. package/Layers/highlightLayer.d.ts +3 -3
  24. package/Layers/highlightLayer.js +2 -2
  25. package/Layers/highlightLayer.js.map +1 -1
  26. package/Layers/layerSceneComponent.d.ts +5 -5
  27. package/Layers/layerSceneComponent.js.map +1 -1
  28. package/LensFlares/lensFlareSystemSceneComponent.d.ts +6 -6
  29. package/LensFlares/lensFlareSystemSceneComponent.js +6 -6
  30. package/LensFlares/lensFlareSystemSceneComponent.js.map +1 -1
  31. package/Lights/Shadows/shadowGeneratorSceneComponent.d.ts +3 -3
  32. package/Lights/Shadows/shadowGeneratorSceneComponent.js.map +1 -1
  33. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +1 -1
  34. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  35. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.d.ts +2 -2
  36. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js.map +1 -1
  37. package/Materials/Textures/baseTexture.d.ts +2 -2
  38. package/Materials/Textures/baseTexture.js.map +1 -1
  39. package/Materials/effectRenderer.d.ts +1 -0
  40. package/Materials/effectRenderer.js +2 -0
  41. package/Materials/effectRenderer.js.map +1 -1
  42. package/Materials/material.d.ts +2 -2
  43. package/Materials/material.decalMapConfiguration.d.ts +1 -1
  44. package/Materials/material.decalMapConfiguration.js +1 -1
  45. package/Materials/material.decalMapConfiguration.js.map +1 -1
  46. package/Materials/material.js.map +1 -1
  47. package/Materials/shaderMaterial.d.ts +5 -0
  48. package/Materials/shaderMaterial.js +7 -0
  49. package/Materials/shaderMaterial.js.map +1 -1
  50. package/Maths/math.color.d.ts +20 -0
  51. package/Maths/math.color.js +41 -12
  52. package/Maths/math.color.js.map +1 -1
  53. package/Meshes/Builders/greasedLineBuilder.d.ts +16 -0
  54. package/Meshes/Builders/greasedLineBuilder.js +1 -1
  55. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  56. package/Meshes/Builders/groundBuilder.d.ts +1 -0
  57. package/Meshes/Builders/groundBuilder.js +2 -2
  58. package/Meshes/Builders/groundBuilder.js.map +1 -1
  59. package/Meshes/GreasedLine/greasedLineBaseMesh.js +1 -1
  60. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  61. package/Meshes/GreasedLine/greasedLineMesh.js +1 -1
  62. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  63. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +1 -1
  64. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  65. package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +3 -0
  66. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +86 -1
  67. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  68. package/Meshes/Node/Blocks/Sources/nullBlock.d.ts +4 -0
  69. package/Meshes/Node/Blocks/Sources/nullBlock.js +8 -0
  70. package/Meshes/Node/Blocks/Sources/nullBlock.js.map +1 -1
  71. package/Meshes/Node/Blocks/Sources/planeBlock.d.ts +13 -0
  72. package/Meshes/Node/Blocks/Sources/planeBlock.js +41 -3
  73. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  74. package/Meshes/Node/Blocks/debugBlock.js +1 -1
  75. package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
  76. package/Meshes/Node/Blocks/geometryElbowBlock.js +1 -1
  77. package/Meshes/Node/Blocks/geometryElbowBlock.js.map +1 -1
  78. package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +4 -0
  79. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +47 -1
  80. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  81. package/Meshes/geometry.d.ts +2 -2
  82. package/Meshes/geometry.js.map +1 -1
  83. package/Meshes/mesh.d.ts +7 -0
  84. package/Meshes/mesh.js +15 -0
  85. package/Meshes/mesh.js.map +1 -1
  86. package/Meshes/meshUVSpaceRenderer.d.ts +3 -2
  87. package/Meshes/meshUVSpaceRenderer.js +15 -3
  88. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  89. package/Misc/greasedLineTools.d.ts +3 -1
  90. package/Misc/greasedLineTools.js +17 -2
  91. package/Misc/greasedLineTools.js.map +1 -1
  92. package/Misc/index.d.ts +2 -0
  93. package/Misc/index.js +2 -0
  94. package/Misc/index.js.map +1 -1
  95. package/Misc/screenshotTools.js +3 -2
  96. package/Misc/screenshotTools.js.map +1 -1
  97. package/Misc/textureTools.js +20 -4
  98. package/Misc/textureTools.js.map +1 -1
  99. package/Morph/morphTargetManager.d.ts +2 -2
  100. package/Morph/morphTargetManager.js.map +1 -1
  101. package/PostProcesses/postProcess.d.ts +2 -2
  102. package/PostProcesses/postProcess.js.map +1 -1
  103. package/Probes/reflectionProbe.d.ts +5 -5
  104. package/Probes/reflectionProbe.js +3 -3
  105. package/Probes/reflectionProbe.js.map +1 -1
  106. package/Rendering/fluidRenderer/fluidRenderer.d.ts +2 -2
  107. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  108. package/Rendering/prePassRendererSceneComponent.d.ts +2 -2
  109. package/Rendering/prePassRendererSceneComponent.js.map +1 -1
  110. package/Rendering/subSurfaceSceneComponent.d.ts +2 -2
  111. package/Rendering/subSurfaceSceneComponent.js.map +1 -1
  112. package/Shaders/lod.fragment.js +2 -2
  113. package/Shaders/lod.fragment.js.map +1 -1
  114. package/Shaders/lodCube.fragment.js +2 -2
  115. package/Shaders/lodCube.fragment.js.map +1 -1
  116. package/Shaders/spriteMap.fragment.js +18 -6
  117. package/Shaders/spriteMap.fragment.js.map +1 -1
  118. package/Shaders/spriteMap.vertex.js +1 -1
  119. package/Shaders/spriteMap.vertex.js.map +1 -1
  120. package/ShadersWGSL/lod.fragment.d.ts +5 -0
  121. package/ShadersWGSL/lod.fragment.js +11 -0
  122. package/ShadersWGSL/lod.fragment.js.map +1 -0
  123. package/ShadersWGSL/lodCube.fragment.d.ts +5 -0
  124. package/ShadersWGSL/lodCube.fragment.js +30 -0
  125. package/ShadersWGSL/lodCube.fragment.js.map +1 -0
  126. package/Sprites/spriteMap.d.ts +16 -0
  127. package/Sprites/spriteMap.js +17 -0
  128. package/Sprites/spriteMap.js.map +1 -1
  129. package/assetContainer.d.ts +143 -3
  130. package/assetContainer.js +129 -8
  131. package/assetContainer.js.map +1 -1
  132. package/index.d.ts +0 -1
  133. package/index.js +0 -1
  134. package/index.js.map +1 -1
  135. package/node.d.ts +2 -2
  136. package/node.js.map +1 -1
  137. package/package.json +1 -1
  138. package/scene.d.ts +103 -14
  139. package/scene.js +170 -71
  140. package/scene.js.map +1 -1
  141. package/sceneComponent.d.ts +3 -3
  142. package/sceneComponent.js.map +1 -1
  143. package/abstractScene.js +0 -117
  144. package/abstractScene.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"greasedLineMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,IAAI,CAAC,sBAAsB,GAAG,CAAC,UAAe,EAAE,KAAY,EAAQ,EAAE;IAClE,OAAO,eAAe,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,mBAAmB;IAcpD;;;;;OAKG;IACH,YAC6B,IAAY,EACrC,KAAY,EACZ,QAAgC;QAEhC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAJJ,SAAI,GAAJ,IAAI,CAAQ;QAZzC;;WAEG;QACI,0BAAqB,GAAG,GAAG,CAAC;QAe/B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAE3B,IAAI,QAAQ,CAAC,MAAM,EAAE;YACjB,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;SACnE;IACL,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,iBAAiB,CAAC;IAC7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\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport type { Ray, TrianglePickingPredicate } from \"../../Culling/ray\";\r\nimport { Buffer, VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { PickingInfo } from \"../../Collisions/pickingInfo\";\r\nimport type { Nullable, FloatArray } from \"../../types\";\r\nimport type { Node } from \"../../node\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions } from \"./greasedLineBaseMesh\";\r\nimport { GreasedLineBaseMesh } from \"./greasedLineBaseMesh\";\r\nimport type { VertexData } from \"../mesh.vertexData\";\r\n\r\nMesh._GreasedLineMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GreasedLineMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * GreasedLineMesh\r\n * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.\r\n */\r\nexport class GreasedLineMesh extends GreasedLineBaseMesh {\r\n private _previousAndSide: FloatArray;\r\n private _nextAndCounters: FloatArray;\r\n\r\n private static _V_START = new Vector3();\r\n private static _V_END = new Vector3();\r\n private static _V_OFFSET_START = new Vector3();\r\n private static _V_OFFSET_END = new Vector3();\r\n\r\n /**\r\n * Treshold used to pick the mesh\r\n */\r\n public intersectionThreshold = 0.1;\r\n\r\n /**\r\n * GreasedLineMesh\r\n * @param name name of the mesh\r\n * @param scene the scene\r\n * @param _options mesh options\r\n */\r\n constructor(\r\n public override readonly name: string,\r\n scene: Scene,\r\n _options: GreasedLineMeshOptions\r\n ) {\r\n super(name, scene, _options);\r\n\r\n this._previousAndSide = [];\r\n this._nextAndCounters = [];\r\n\r\n if (_options.points) {\r\n this.addPoints(GreasedLineTools.ConvertPoints(_options.points));\r\n }\r\n }\r\n\r\n /**\r\n * \"GreasedLineMesh\"\r\n * @returns \"GreasedLineMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GreasedLineMesh\";\r\n }\r\n\r\n protected _updateColorPointers() {\r\n if (this._options.colorPointers) {\r\n return;\r\n }\r\n\r\n let colorPointer = 0;\r\n this._colorPointers = [];\r\n this._points.forEach((p) => {\r\n for (let jj = 0; jj < p.length; jj += 3) {\r\n this._colorPointers.push(colorPointer);\r\n this._colorPointers.push(colorPointer++);\r\n }\r\n });\r\n }\r\n\r\n protected _updateWidths(): void {\r\n // intentionally left blank\r\n }\r\n\r\n protected _setPoints(points: number[][]) {\r\n this._points = points;\r\n this._options.points = points;\r\n\r\n this._initGreasedLine();\r\n\r\n let indiceOffset = 0;\r\n let vertexPositionsLen = 0,\r\n indicesLength = 0,\r\n uvLength = 0,\r\n previousAndSideLength = 0;\r\n points.forEach((p) => {\r\n vertexPositionsLen += p.length * 2;\r\n indicesLength += (p.length - 3) * 2;\r\n uvLength += (p.length * 4) / 3;\r\n previousAndSideLength += (p.length * 8) / 3;\r\n });\r\n const vertexPositionsArr = new Float32Array(vertexPositionsLen);\r\n const indicesArr = vertexPositionsLen > 65535 ? new Uint32Array(indicesLength) : new Uint16Array(indicesLength);\r\n const uvArr = new Float32Array(uvLength);\r\n const previousAndSide = new Float32Array(previousAndSideLength);\r\n // it's the same length here\r\n const nextAndCounters = new Float32Array(previousAndSideLength);\r\n let vertexPositionsOffset = 0,\r\n indicesOffset = 0,\r\n uvOffset = 0,\r\n previousAndSideOffset = 0,\r\n nextAndCountersOffset = 0;\r\n\r\n points.forEach((p) => {\r\n const lengthArray = GreasedLineTools.GetLineLengthArray(p);\r\n const totalLength = lengthArray[lengthArray.length - 1];\r\n for (let j = 0, jj = 0; jj < p.length; j++, jj += 3) {\r\n const baseOffset = vertexPositionsOffset + jj * 2;\r\n vertexPositionsArr[baseOffset + 0] = p[jj + 0];\r\n vertexPositionsArr[baseOffset + 1] = p[jj + 1];\r\n vertexPositionsArr[baseOffset + 2] = p[jj + 2];\r\n vertexPositionsArr[baseOffset + 3] = p[jj + 0];\r\n vertexPositionsArr[baseOffset + 4] = p[jj + 1];\r\n vertexPositionsArr[baseOffset + 5] = p[jj + 2];\r\n\r\n if (jj < p.length - 3) {\r\n const n = j * 2 + indiceOffset;\r\n const baseIndicesOffset = indicesOffset + jj * 2;\r\n indicesArr[baseIndicesOffset + 0] = n;\r\n indicesArr[baseIndicesOffset + 1] = n + 1;\r\n indicesArr[baseIndicesOffset + 2] = n + 2;\r\n indicesArr[baseIndicesOffset + 3] = n + 2;\r\n indicesArr[baseIndicesOffset + 4] = n + 1;\r\n indicesArr[baseIndicesOffset + 5] = n + 3;\r\n }\r\n }\r\n\r\n indiceOffset += (p.length / 3) * 2;\r\n const currVertexPositionsOffsetLength = p.length * 2;\r\n const positions = vertexPositionsArr.subarray(vertexPositionsOffset, vertexPositionsOffset + currVertexPositionsOffsetLength);\r\n vertexPositionsOffset += currVertexPositionsOffsetLength;\r\n indicesOffset += (p.length - 3) * 2;\r\n\r\n const previous = new Float32Array(positions.length);\r\n const next = new Float32Array(positions.length);\r\n const l = positions.length / 6;\r\n let v;\r\n if (GreasedLineMesh._CompareV3(0, l - 1, positions)) {\r\n v = positions.subarray((l - 2) * 6, (l - 1) * 6);\r\n } else {\r\n v = positions.subarray(0, 6);\r\n }\r\n previous.set(v);\r\n previous.set(positions.subarray(0, positions.length - 6), 6);\r\n next.set(positions.subarray(6));\r\n if (GreasedLineMesh._CompareV3(l - 1, 0, positions)) {\r\n v = positions.subarray(6, 12);\r\n } else {\r\n v = positions.subarray((l - 1) * 6, l * 6);\r\n }\r\n next.set(v, next.length - 6);\r\n\r\n for (let i = 0, sidesLength = positions.length / 3; i < sidesLength; i++) {\r\n previousAndSide[previousAndSideOffset++] = previous[i * 3];\r\n previousAndSide[previousAndSideOffset++] = previous[i * 3 + 1];\r\n previousAndSide[previousAndSideOffset++] = previous[i * 3 + 2];\r\n // side[i] = i % 2 ? -1 : 1;\r\n // side[i] = 1 - ((i & 1) << 1);\r\n previousAndSide[previousAndSideOffset++] = 1 - ((i & 1) << 1);\r\n nextAndCounters[nextAndCountersOffset++] = next[i * 3];\r\n nextAndCounters[nextAndCountersOffset++] = next[i * 3 + 1];\r\n nextAndCounters[nextAndCountersOffset++] = next[i * 3 + 2];\r\n // counters[i] = lengthArray[i >> 1] / totalLength;\r\n nextAndCounters[nextAndCountersOffset++] = lengthArray[i >> 1] / totalLength;\r\n }\r\n if (this._options.uvs) {\r\n for (let i = 0; i < this._options.uvs.length; i++) {\r\n uvArr[uvOffset++] = this._options.uvs[i];\r\n }\r\n } else {\r\n for (let j = 0; j < l; j++) {\r\n // uvs\r\n const lengthRatio = lengthArray[j] / totalLength;\r\n const uvOffsetBase = uvOffset + j * 4;\r\n uvArr[uvOffsetBase + 0] = lengthRatio;\r\n uvArr[uvOffsetBase + 1] = 0;\r\n uvArr[uvOffsetBase + 2] = lengthRatio;\r\n uvArr[uvOffsetBase + 3] = 1;\r\n }\r\n }\r\n });\r\n this._vertexPositions = vertexPositionsArr;\r\n this._indices = indicesArr;\r\n this._uvs = uvArr;\r\n this._previousAndSide = previousAndSide;\r\n this._nextAndCounters = nextAndCounters;\r\n\r\n if (!this._lazy) {\r\n if (!this._options.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._createVertexBuffers();\r\n this.refreshBoundingInfo();\r\n }\r\n }\r\n\r\n /**\r\n * Clones the GreasedLineMesh.\r\n * @param name new line name\r\n * @param newParent new parent node\r\n * @returns cloned line\r\n */\r\n public override clone(name: string = `${this.name}-cloned`, newParent?: Nullable<Node>) {\r\n const lineOptions = this._createLineOptions();\r\n const deepCopiedLineOptions = {};\r\n DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, [\"instance\"], undefined, true);\r\n\r\n const cloned = new GreasedLineMesh(name, this._scene, <GreasedLineMeshOptions>deepCopiedLineOptions);\r\n if (newParent) {\r\n cloned.parent = newParent;\r\n }\r\n\r\n cloned.material = this.material;\r\n\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n }\r\n\r\n /**\r\n * Parses a serialized GreasedLineMesh\r\n * @param parsedMesh the serialized GreasedLineMesh\r\n * @param scene the scene to create the GreasedLineMesh in\r\n * @returns the created GreasedLineMesh\r\n */\r\n public static override Parse(parsedMesh: any, scene: Scene): Mesh {\r\n const lineOptions = <GreasedLineMeshOptions>parsedMesh.lineOptions;\r\n const name = <string>parsedMesh.name;\r\n const result = new GreasedLineMesh(name, scene, lineOptions);\r\n return result;\r\n }\r\n\r\n protected override _initGreasedLine() {\r\n super._initGreasedLine();\r\n\r\n this._previousAndSide = [];\r\n this._nextAndCounters = [];\r\n }\r\n /**\r\n * Checks whether a ray is intersecting this GreasedLineMesh\r\n * @param ray ray to check the intersection of this mesh with\r\n * @param fastCheck not supported\r\n * @param trianglePredicate not supported\r\n * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)\r\n * @param worldToUse not supported\r\n * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check\r\n * @returns the picking info\r\n */\r\n public override intersects(\r\n ray: Ray,\r\n fastCheck?: boolean,\r\n trianglePredicate?: TrianglePickingPredicate,\r\n onlyBoundingInfo = false,\r\n worldToUse?: Matrix,\r\n skipBoundingInfo = false\r\n ): PickingInfo {\r\n const pickingInfo = new PickingInfo();\r\n const intersections = this.findAllIntersections(ray, fastCheck, trianglePredicate, onlyBoundingInfo, worldToUse, skipBoundingInfo, true);\r\n if (intersections?.length === 1) {\r\n const intersection = intersections[0];\r\n pickingInfo.hit = true;\r\n pickingInfo.distance = intersection.distance;\r\n pickingInfo.ray = ray;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.pickedPoint = intersection.point;\r\n }\r\n return pickingInfo;\r\n }\r\n\r\n /**\r\n * Gets all intersections of a ray and the line\r\n * @param ray Ray to check the intersection of this mesh with\r\n * @param _fastCheck not supported\r\n * @param _trianglePredicate not supported\r\n * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)\r\n * @param _worldToUse not supported\r\n * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check\r\n * @param firstOnly If true, the first and only intersection is immediatelly returned if found\r\n * @returns intersection(s)\r\n */\r\n public findAllIntersections(\r\n ray: Ray,\r\n _fastCheck?: boolean,\r\n _trianglePredicate?: TrianglePickingPredicate,\r\n onlyBoundingInfo = false,\r\n _worldToUse?: Matrix,\r\n skipBoundingInfo = false,\r\n firstOnly = false\r\n ): { distance: number; point: Vector3 }[] | undefined {\r\n if (onlyBoundingInfo && !skipBoundingInfo && ray.intersectsSphere(this._boundingSphere, this.intersectionThreshold) === false) {\r\n return;\r\n }\r\n\r\n const indices = this.getIndices();\r\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n const widths = this._widths;\r\n\r\n const lineWidth = this.greasedLineMaterial?.width ?? 1;\r\n\r\n const intersects = [];\r\n if (indices && positions && widths) {\r\n let i = 0,\r\n l = 0;\r\n for (i = 0, l = indices.length - 1; i < l; i += 3) {\r\n const a = indices[i];\r\n const b = indices[i + 1];\r\n\r\n GreasedLineMesh._V_START.fromArray(positions, a * 3);\r\n GreasedLineMesh._V_END.fromArray(positions, b * 3);\r\n\r\n if (this._offsets) {\r\n GreasedLineMesh._V_OFFSET_START.fromArray(this._offsets, a * 3);\r\n GreasedLineMesh._V_OFFSET_END.fromArray(this._offsets, b * 3);\r\n GreasedLineMesh._V_START.addInPlace(GreasedLineMesh._V_OFFSET_START);\r\n GreasedLineMesh._V_END.addInPlace(GreasedLineMesh._V_OFFSET_END);\r\n }\r\n\r\n const iFloored = Math.floor(i / 3);\r\n const width = widths[iFloored] !== undefined ? widths[iFloored] : 1;\r\n const precision = (this.intersectionThreshold * (lineWidth * width)) / 2;\r\n\r\n const distance = ray.intersectionSegment(GreasedLineMesh._V_START, GreasedLineMesh._V_END, precision);\r\n if (distance !== -1) {\r\n intersects.push({\r\n distance: distance,\r\n point: ray.direction.normalize().multiplyByFloats(distance, distance, distance).add(ray.origin),\r\n });\r\n if (firstOnly) {\r\n return intersects;\r\n }\r\n }\r\n }\r\n i = l;\r\n }\r\n\r\n return intersects;\r\n }\r\n\r\n private get _boundingSphere() {\r\n return this.getBoundingInfo().boundingSphere;\r\n }\r\n\r\n private static _CompareV3(positionIdx1: number, positionIdx2: number, positions: FloatArray) {\r\n const arrayIdx1 = positionIdx1 * 6;\r\n const arrayIdx2 = positionIdx2 * 6;\r\n return positions[arrayIdx1] === positions[arrayIdx2] && positions[arrayIdx1 + 1] === positions[arrayIdx2 + 1] && positions[arrayIdx1 + 2] === positions[arrayIdx2 + 2];\r\n }\r\n\r\n protected override _createVertexBuffers() {\r\n const vertexData: VertexData = super._createVertexBuffers();\r\n\r\n const engine = this._scene.getEngine();\r\n\r\n const previousAndSideBuffer = new Buffer(engine, this._previousAndSide, false, 4);\r\n this.setVerticesBuffer(previousAndSideBuffer.createVertexBuffer(\"grl_previousAndSide\", 0, 4));\r\n\r\n const nextAndCountersBuffer = new Buffer(engine, this._nextAndCounters, false, 4);\r\n this.setVerticesBuffer(nextAndCountersBuffer.createVertexBuffer(\"grl_nextAndCounters\", 0, 4));\r\n\r\n const widthBuffer = new Buffer(engine, this._widths, this._updatable, 1);\r\n this.setVerticesBuffer(widthBuffer.createVertexBuffer(\"grl_widths\", 0, 1));\r\n this._widthsBuffer = widthBuffer;\r\n\r\n const colorPointersBuffer = new Buffer(engine, this._colorPointers, this._updatable, 1);\r\n this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer(\"grl_colorPointers\", 0, 1));\r\n this._colorPointersBuffer = colorPointersBuffer;\r\n\r\n return vertexData;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"greasedLineMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM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qBAAqB,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QAClF,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAE9F,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACzE,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3E,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC;QAEjC,MAAM,mBAAmB,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACxF,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1F,IAAI,CAAC,oBAAoB,GAAG,mBAAmB,CAAC;QAEhD,OAAO,UAAU,CAAC;IACtB,CAAC;;AAzWc,wBAAQ,GAAG,IAAI,OAAO,EAAE,AAAhB,CAAiB;AACzB,sBAAM,GAAG,IAAI,OAAO,EAAE,AAAhB,CAAiB;AACvB,+BAAe,GAAG,IAAI,OAAO,EAAE,AAAhB,CAAiB;AAChC,6BAAa,GAAG,IAAI,OAAO,EAAE,AAAhB,CAAiB","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Matrix } from \"../../Maths/math.vector\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport type { Ray, TrianglePickingPredicate } from \"../../Culling/ray\";\r\nimport { Buffer, VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { PickingInfo } from \"../../Collisions/pickingInfo\";\r\nimport type { Nullable, FloatArray } from \"../../types\";\r\nimport type { Node } from \"../../node\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions } from \"./greasedLineBaseMesh\";\r\nimport { GreasedLineBaseMesh } from \"./greasedLineBaseMesh\";\r\nimport type { VertexData } from \"../mesh.vertexData\";\r\n\r\nMesh._GreasedLineMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GreasedLineMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * GreasedLineMesh\r\n * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.\r\n */\r\nexport class GreasedLineMesh extends GreasedLineBaseMesh {\r\n private _previousAndSide: FloatArray;\r\n private _nextAndCounters: FloatArray;\r\n\r\n private static _V_START = new Vector3();\r\n private static _V_END = new Vector3();\r\n private static _V_OFFSET_START = new Vector3();\r\n private static _V_OFFSET_END = new Vector3();\r\n\r\n /**\r\n * Treshold used to pick the mesh\r\n */\r\n public intersectionThreshold = 0.1;\r\n\r\n /**\r\n * GreasedLineMesh\r\n * @param name name of the mesh\r\n * @param scene the scene\r\n * @param _options mesh options\r\n */\r\n constructor(\r\n public override readonly name: string,\r\n scene: Scene,\r\n _options: GreasedLineMeshOptions\r\n ) {\r\n super(name, scene, _options);\r\n\r\n this._previousAndSide = [];\r\n this._nextAndCounters = [];\r\n\r\n if (_options.points) {\r\n this.addPoints(GreasedLineTools.ConvertPoints(_options.points));\r\n }\r\n }\r\n\r\n /**\r\n * \"GreasedLineMesh\"\r\n * @returns \"GreasedLineMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GreasedLineMesh\";\r\n }\r\n\r\n protected _updateColorPointers() {\r\n if (this._options.colorPointers) {\r\n return;\r\n }\r\n\r\n let colorPointer = 0;\r\n this._colorPointers = [];\r\n this._points.forEach((p) => {\r\n for (let jj = 0; jj < p.length; jj += 3) {\r\n this._colorPointers.push(colorPointer);\r\n this._colorPointers.push(colorPointer++);\r\n }\r\n });\r\n }\r\n\r\n protected _updateWidths(): void {\r\n // intentionally left blank\r\n }\r\n\r\n protected _setPoints(points: number[][]) {\r\n this._points = points;\r\n this._options.points = points;\r\n\r\n this._initGreasedLine();\r\n\r\n let indiceOffset = 0;\r\n let vertexPositionsLen = 0,\r\n indicesLength = 0,\r\n uvLength = 0,\r\n previousAndSideLength = 0;\r\n points.forEach((p) => {\r\n vertexPositionsLen += p.length * 2;\r\n indicesLength += (p.length - 3) * 2;\r\n uvLength += (p.length * 4) / 3;\r\n previousAndSideLength += (p.length * 8) / 3;\r\n });\r\n const vertexPositionsArr = new Float32Array(vertexPositionsLen);\r\n const indicesArr = vertexPositionsLen > 65535 ? new Uint32Array(indicesLength) : new Uint16Array(indicesLength);\r\n const uvArr = new Float32Array(uvLength);\r\n const previousAndSide = new Float32Array(previousAndSideLength);\r\n // it's the same length here\r\n const nextAndCounters = new Float32Array(previousAndSideLength);\r\n let vertexPositionsOffset = 0,\r\n indicesOffset = 0,\r\n uvOffset = 0,\r\n previousAndSideOffset = 0,\r\n nextAndCountersOffset = 0;\r\n\r\n points.forEach((p) => {\r\n const lengthArray = GreasedLineTools.GetLineLengthArray(p);\r\n const totalLength = lengthArray[lengthArray.length - 1];\r\n for (let j = 0, jj = 0; jj < p.length; j++, jj += 3) {\r\n const baseOffset = vertexPositionsOffset + jj * 2;\r\n vertexPositionsArr[baseOffset + 0] = p[jj + 0];\r\n vertexPositionsArr[baseOffset + 1] = p[jj + 1];\r\n vertexPositionsArr[baseOffset + 2] = p[jj + 2];\r\n vertexPositionsArr[baseOffset + 3] = p[jj + 0];\r\n vertexPositionsArr[baseOffset + 4] = p[jj + 1];\r\n vertexPositionsArr[baseOffset + 5] = p[jj + 2];\r\n\r\n if (jj < p.length - 3) {\r\n const n = j * 2 + indiceOffset;\r\n const baseIndicesOffset = indicesOffset + jj * 2;\r\n indicesArr[baseIndicesOffset + 0] = n;\r\n indicesArr[baseIndicesOffset + 1] = n + 1;\r\n indicesArr[baseIndicesOffset + 2] = n + 2;\r\n indicesArr[baseIndicesOffset + 3] = n + 2;\r\n indicesArr[baseIndicesOffset + 4] = n + 1;\r\n indicesArr[baseIndicesOffset + 5] = n + 3;\r\n }\r\n }\r\n\r\n indiceOffset += (p.length / 3) * 2;\r\n const currVertexPositionsOffsetLength = p.length * 2;\r\n const positions = vertexPositionsArr.subarray(vertexPositionsOffset, vertexPositionsOffset + currVertexPositionsOffsetLength);\r\n vertexPositionsOffset += currVertexPositionsOffsetLength;\r\n indicesOffset += (p.length - 3) * 2;\r\n\r\n const previous = new Float32Array(positions.length);\r\n const next = new Float32Array(positions.length);\r\n const l = positions.length / 6;\r\n let v;\r\n if (GreasedLineMesh._CompareV3(0, l - 1, positions)) {\r\n v = positions.subarray((l - 2) * 6, (l - 1) * 6);\r\n } else {\r\n v = positions.subarray(0, 6);\r\n }\r\n previous.set(v);\r\n previous.set(positions.subarray(0, positions.length - 6), 6);\r\n next.set(positions.subarray(6));\r\n if (GreasedLineMesh._CompareV3(l - 1, 0, positions)) {\r\n v = positions.subarray(6, 12);\r\n } else {\r\n v = positions.subarray((l - 1) * 6, l * 6);\r\n }\r\n next.set(v, next.length - 6);\r\n\r\n for (let i = 0, sidesLength = positions.length / 3; i < sidesLength; i++) {\r\n previousAndSide[previousAndSideOffset++] = previous[i * 3];\r\n previousAndSide[previousAndSideOffset++] = previous[i * 3 + 1];\r\n previousAndSide[previousAndSideOffset++] = previous[i * 3 + 2];\r\n // side[i] = i % 2 ? -1 : 1;\r\n // side[i] = 1 - ((i & 1) << 1);\r\n previousAndSide[previousAndSideOffset++] = 1 - ((i & 1) << 1);\r\n nextAndCounters[nextAndCountersOffset++] = next[i * 3];\r\n nextAndCounters[nextAndCountersOffset++] = next[i * 3 + 1];\r\n nextAndCounters[nextAndCountersOffset++] = next[i * 3 + 2];\r\n // counters[i] = lengthArray[i >> 1] / totalLength;\r\n nextAndCounters[nextAndCountersOffset++] = lengthArray[i >> 1] / totalLength;\r\n }\r\n if (this._options.uvs) {\r\n for (let i = 0; i < this._options.uvs.length; i++) {\r\n uvArr[uvOffset++] = this._options.uvs[i];\r\n }\r\n } else {\r\n for (let j = 0; j < l; j++) {\r\n // uvs\r\n const lengthRatio = lengthArray[j] / totalLength;\r\n const uvOffsetBase = uvOffset + j * 4;\r\n uvArr[uvOffsetBase + 0] = lengthRatio;\r\n uvArr[uvOffsetBase + 1] = 0;\r\n uvArr[uvOffsetBase + 2] = lengthRatio;\r\n uvArr[uvOffsetBase + 3] = 1;\r\n }\r\n }\r\n });\r\n this._vertexPositions = vertexPositionsArr;\r\n this._indices = indicesArr;\r\n this._uvs = uvArr;\r\n this._previousAndSide = previousAndSide;\r\n this._nextAndCounters = nextAndCounters;\r\n\r\n if (!this._lazy) {\r\n if (!this._options.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._createVertexBuffers();\r\n !this.doNotSyncBoundingInfo && this.refreshBoundingInfo();\r\n }\r\n }\r\n\r\n /**\r\n * Clones the GreasedLineMesh.\r\n * @param name new line name\r\n * @param newParent new parent node\r\n * @returns cloned line\r\n */\r\n public override clone(name: string = `${this.name}-cloned`, newParent?: Nullable<Node>) {\r\n const lineOptions = this._createLineOptions();\r\n const deepCopiedLineOptions = {};\r\n DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, [\"instance\"], undefined, true);\r\n\r\n const cloned = new GreasedLineMesh(name, this._scene, <GreasedLineMeshOptions>deepCopiedLineOptions);\r\n if (newParent) {\r\n cloned.parent = newParent;\r\n }\r\n\r\n cloned.material = this.material;\r\n\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n }\r\n\r\n /**\r\n * Parses a serialized GreasedLineMesh\r\n * @param parsedMesh the serialized GreasedLineMesh\r\n * @param scene the scene to create the GreasedLineMesh in\r\n * @returns the created GreasedLineMesh\r\n */\r\n public static override Parse(parsedMesh: any, scene: Scene): Mesh {\r\n const lineOptions = <GreasedLineMeshOptions>parsedMesh.lineOptions;\r\n const name = <string>parsedMesh.name;\r\n const result = new GreasedLineMesh(name, scene, lineOptions);\r\n return result;\r\n }\r\n\r\n protected override _initGreasedLine() {\r\n super._initGreasedLine();\r\n\r\n this._previousAndSide = [];\r\n this._nextAndCounters = [];\r\n }\r\n /**\r\n * Checks whether a ray is intersecting this GreasedLineMesh\r\n * @param ray ray to check the intersection of this mesh with\r\n * @param fastCheck not supported\r\n * @param trianglePredicate not supported\r\n * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)\r\n * @param worldToUse not supported\r\n * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check\r\n * @returns the picking info\r\n */\r\n public override intersects(\r\n ray: Ray,\r\n fastCheck?: boolean,\r\n trianglePredicate?: TrianglePickingPredicate,\r\n onlyBoundingInfo = false,\r\n worldToUse?: Matrix,\r\n skipBoundingInfo = false\r\n ): PickingInfo {\r\n const pickingInfo = new PickingInfo();\r\n const intersections = this.findAllIntersections(ray, fastCheck, trianglePredicate, onlyBoundingInfo, worldToUse, skipBoundingInfo, true);\r\n if (intersections?.length === 1) {\r\n const intersection = intersections[0];\r\n pickingInfo.hit = true;\r\n pickingInfo.distance = intersection.distance;\r\n pickingInfo.ray = ray;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.pickedPoint = intersection.point;\r\n }\r\n return pickingInfo;\r\n }\r\n\r\n /**\r\n * Gets all intersections of a ray and the line\r\n * @param ray Ray to check the intersection of this mesh with\r\n * @param _fastCheck not supported\r\n * @param _trianglePredicate not supported\r\n * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)\r\n * @param _worldToUse not supported\r\n * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check\r\n * @param firstOnly If true, the first and only intersection is immediatelly returned if found\r\n * @returns intersection(s)\r\n */\r\n public findAllIntersections(\r\n ray: Ray,\r\n _fastCheck?: boolean,\r\n _trianglePredicate?: TrianglePickingPredicate,\r\n onlyBoundingInfo = false,\r\n _worldToUse?: Matrix,\r\n skipBoundingInfo = false,\r\n firstOnly = false\r\n ): { distance: number; point: Vector3 }[] | undefined {\r\n if (onlyBoundingInfo && !skipBoundingInfo && ray.intersectsSphere(this._boundingSphere, this.intersectionThreshold) === false) {\r\n return;\r\n }\r\n\r\n const indices = this.getIndices();\r\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n const widths = this._widths;\r\n\r\n const lineWidth = this.greasedLineMaterial?.width ?? 1;\r\n\r\n const intersects = [];\r\n if (indices && positions && widths) {\r\n let i = 0,\r\n l = 0;\r\n for (i = 0, l = indices.length - 1; i < l; i += 3) {\r\n const a = indices[i];\r\n const b = indices[i + 1];\r\n\r\n GreasedLineMesh._V_START.fromArray(positions, a * 3);\r\n GreasedLineMesh._V_END.fromArray(positions, b * 3);\r\n\r\n if (this._offsets) {\r\n GreasedLineMesh._V_OFFSET_START.fromArray(this._offsets, a * 3);\r\n GreasedLineMesh._V_OFFSET_END.fromArray(this._offsets, b * 3);\r\n GreasedLineMesh._V_START.addInPlace(GreasedLineMesh._V_OFFSET_START);\r\n GreasedLineMesh._V_END.addInPlace(GreasedLineMesh._V_OFFSET_END);\r\n }\r\n\r\n const iFloored = Math.floor(i / 3);\r\n const width = widths[iFloored] !== undefined ? widths[iFloored] : 1;\r\n const precision = (this.intersectionThreshold * (lineWidth * width)) / 2;\r\n\r\n const distance = ray.intersectionSegment(GreasedLineMesh._V_START, GreasedLineMesh._V_END, precision);\r\n if (distance !== -1) {\r\n intersects.push({\r\n distance: distance,\r\n point: ray.direction.normalize().multiplyByFloats(distance, distance, distance).add(ray.origin),\r\n });\r\n if (firstOnly) {\r\n return intersects;\r\n }\r\n }\r\n }\r\n i = l;\r\n }\r\n\r\n return intersects;\r\n }\r\n\r\n private get _boundingSphere() {\r\n return this.getBoundingInfo().boundingSphere;\r\n }\r\n\r\n private static _CompareV3(positionIdx1: number, positionIdx2: number, positions: FloatArray) {\r\n const arrayIdx1 = positionIdx1 * 6;\r\n const arrayIdx2 = positionIdx2 * 6;\r\n return positions[arrayIdx1] === positions[arrayIdx2] && positions[arrayIdx1 + 1] === positions[arrayIdx2 + 1] && positions[arrayIdx1 + 2] === positions[arrayIdx2 + 2];\r\n }\r\n\r\n protected override _createVertexBuffers() {\r\n const vertexData: VertexData = super._createVertexBuffers();\r\n\r\n const engine = this._scene.getEngine();\r\n\r\n const previousAndSideBuffer = new Buffer(engine, this._previousAndSide, false, 4);\r\n this.setVerticesBuffer(previousAndSideBuffer.createVertexBuffer(\"grl_previousAndSide\", 0, 4));\r\n\r\n const nextAndCountersBuffer = new Buffer(engine, this._nextAndCounters, false, 4);\r\n this.setVerticesBuffer(nextAndCountersBuffer.createVertexBuffer(\"grl_nextAndCounters\", 0, 4));\r\n\r\n const widthBuffer = new Buffer(engine, this._widths, this._updatable, 1);\r\n this.setVerticesBuffer(widthBuffer.createVertexBuffer(\"grl_widths\", 0, 1));\r\n this._widthsBuffer = widthBuffer;\r\n\r\n const colorPointersBuffer = new Buffer(engine, this._colorPointers, this._updatable, 1);\r\n this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer(\"grl_colorPointers\", 0, 1));\r\n this._colorPointersBuffer = colorPointersBuffer;\r\n\r\n return vertexData;\r\n }\r\n}\r\n"]}
@@ -141,7 +141,7 @@ export class GreasedLineRibbonMesh extends GreasedLineBaseMesh {
141
141
  }
142
142
  if (!this._lazy) {
143
143
  this._createVertexBuffers();
144
- this.refreshBoundingInfo();
144
+ !this.doNotSyncBoundingInfo && this.refreshBoundingInfo();
145
145
  }
146
146
  }
147
147
  static _GetDirectionPlanesFromDirectionsOption(count, directions) {
@@ -1 +1 @@
1
- {"version":3,"file":"greasedLineRibbonMesh.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C;IACtB,CAAC;;AAziBD;;GAEG;AACW,mCAAa,GAAG,GAAG,CAAC;AAEnB,2DAAqC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,0BAA0B,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACjH,0DAAoC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,yBAAyB,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAC/G,6CAAuB,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAEpG;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC,2DAA2D;AAC3H;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,UAAU,CAAC;AAChD;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,YAAY,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Quaternion, TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Node } from \"../../node\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions, GreasedLineRibbonOptions } from \"./greasedLineBaseMesh\";\r\nimport { GreasedLineBaseMesh, GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from \"./greasedLineBaseMesh\";\r\nimport type { VertexData } from \"../mesh.vertexData\";\r\n\r\nMesh._GreasedLineRibbonMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GreasedLineRibbonMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * GreasedLineRibbonMesh\r\n * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.\r\n */\r\nexport class GreasedLineRibbonMesh extends GreasedLineBaseMesh {\r\n /**\r\n * Default line width\r\n */\r\n public static DEFAULT_WIDTH = 0.1;\r\n\r\n private static _RightHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.RightHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftReadOnly, Math.PI / 2);\r\n\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XY plane\r\n */\r\n public static DIRECTION_XY = Vector3.LeftHandedForwardReadOnly; // doesn't matter in which handed system the scene operates\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XZ plane\r\n */\r\n public static DIRECTION_XZ = Vector3.UpReadOnly;\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the YZ plane\r\n */\r\n public static DIRECTION_YZ = Vector3.LeftReadOnly;\r\n\r\n private _paths: Vector3[][];\r\n private _pathsOptions: { options: GreasedLineMeshOptions; pathCount: number }[];\r\n private _vSegmentLengths: number[][];\r\n private _uSegmentLengths: number[][];\r\n private _vTotalLengths: number[];\r\n private _uTotalLengths: number[];\r\n\r\n private _counters: number[];\r\n private _slopes: number[];\r\n private _ribbonWidths: number[];\r\n\r\n /**\r\n * GreasedLineRibbonMesh\r\n * @param name name of the mesh\r\n * @param scene the scene\r\n * @param _options mesh options\r\n * @param _pathOptions used internaly when parsing a serialized GreasedLineRibbonMesh\r\n */\r\n constructor(\r\n public override readonly name: string,\r\n scene: Scene,\r\n _options: GreasedLineMeshOptions,\r\n _pathOptions?: { options: GreasedLineMeshOptions; pathCount: number }[]\r\n ) {\r\n super(name, scene, _options);\r\n\r\n if (!_options.ribbonOptions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"'GreasedLineMeshOptions.ribbonOptions' is not set.\";\r\n }\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._widths = _options.widths ?? [];\r\n this._ribbonWidths = [];\r\n this._pathsOptions = _pathOptions ?? [];\r\n\r\n if (_options.points) {\r\n this.addPoints(GreasedLineTools.ConvertPoints(_options.points), _options, !!_pathOptions);\r\n }\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n * @param options mesh options\r\n * @param hasPathOptions defaults to false\r\n */\r\n public override addPoints(points: number[][], options: GreasedLineMeshOptions, hasPathOptions = false) {\r\n if (!options.ribbonOptions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"addPoints() on GreasedLineRibbonMesh instance requires 'GreasedLineMeshOptions.ribbonOptions'.\";\r\n }\r\n\r\n if (!hasPathOptions) {\r\n this._pathsOptions.push({ options, pathCount: points.length });\r\n }\r\n\r\n super.addPoints(points, options);\r\n }\r\n\r\n /**\r\n * \"GreasedLineRibbonMesh\"\r\n * @returns \"GreasedLineRibbonMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GreasedLineRibbonMesh\";\r\n }\r\n\r\n /**\r\n * Return true if the line was created from two edge paths or one points path.\r\n * In this case the line is always flat.\r\n */\r\n public get isFlatLine() {\r\n return this._paths.length < 3;\r\n }\r\n\r\n /**\r\n * Returns the slopes of the line at each point relative to the center of the line\r\n */\r\n get slopes() {\r\n return this._slopes;\r\n }\r\n\r\n /**\r\n * Set the slopes of the line at each point relative to the center of the line\r\n */\r\n set slopes(slopes: number[]) {\r\n this._slopes = slopes;\r\n }\r\n\r\n protected _updateColorPointers() {\r\n if (this._options.colorPointers) {\r\n return;\r\n }\r\n\r\n let colorPointer = 0;\r\n this._colorPointers = [];\r\n for (let i = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const points = this._points[i];\r\n\r\n if (pathOptions.ribbonOptions!.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n for (let k = 0; k < pathCount; k++) {\r\n for (let j = 0; j < points.length; j += 3) {\r\n this._colorPointers.push(colorPointer);\r\n this._colorPointers.push(colorPointer++);\r\n }\r\n }\r\n } else {\r\n for (let j = 0; j < points.length; j += 3) {\r\n for (let k = 0; k < pathCount; k++) {\r\n this._colorPointers.push(colorPointer);\r\n }\r\n colorPointer++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _updateWidths(): void {\r\n super._updateWidthsWithValue(1);\r\n }\r\n\r\n protected _setPoints(points: number[][], _options: GreasedLineMeshOptions) {\r\n if (!this._options.ribbonOptions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No 'GreasedLineMeshOptions.ribbonOptions' provided.\";\r\n }\r\n this._points = points;\r\n this._options.points = points;\r\n\r\n this._initGreasedLine();\r\n\r\n let indiceOffset = 0;\r\n let directionPlanes: Vector3[];\r\n for (let i = 0, c = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const subPoints = points.slice(c, c + pathCount);\r\n c += pathCount;\r\n if (pathOptions.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS) {\r\n indiceOffset = this._preprocess(GreasedLineTools.ToVector3Array(subPoints) as Vector3[][], indiceOffset, pathOptions);\r\n } else {\r\n if (pathOptions.ribbonOptions?.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE) {\r\n if (!pathOptions.ribbonOptions!.directions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE 'GreasedLineMeshOptions.ribbonOptions.directions' must be defined.\";\r\n }\r\n directionPlanes = GreasedLineRibbonMesh._GetDirectionPlanesFromDirectionsOption(subPoints.length, pathOptions.ribbonOptions!.directions);\r\n }\r\n subPoints.forEach((p, idx) => {\r\n const pathArray = GreasedLineRibbonMesh._ConvertToRibbonPath(\r\n p,\r\n pathOptions.ribbonOptions!,\r\n this._scene.useRightHandedSystem,\r\n directionPlanes ? directionPlanes[idx] : directionPlanes\r\n );\r\n indiceOffset = this._preprocess(pathArray, indiceOffset, pathOptions);\r\n });\r\n }\r\n }\r\n\r\n if (!this._lazy) {\r\n this._createVertexBuffers();\r\n this.refreshBoundingInfo();\r\n }\r\n }\r\n\r\n private static _GetDirectionPlanesFromDirectionsOption(count: number, directions: Vector3 | Vector3[]) {\r\n if (Array.isArray(directions)) {\r\n return directions;\r\n }\r\n\r\n return new Array(count).fill(directions) as Vector3[];\r\n }\r\n\r\n private static _CreateRibbonVertexData(pathArray: Vector3[][], options: GreasedLineMeshOptions) {\r\n const numOfPaths = pathArray.length;\r\n if (numOfPaths < 2) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Minimum of two paths are required to create a GreasedLineRibbonMesh.\";\r\n }\r\n\r\n const positions = [];\r\n const indices = [];\r\n\r\n const path = pathArray[0];\r\n for (let i = 0; i < path.length; i++) {\r\n for (let pi = 0; pi < pathArray.length; pi++) {\r\n const v = pathArray[pi][i];\r\n positions.push(v.x, v.y, v.z);\r\n }\r\n }\r\n\r\n const v: number[] = [1, 0, numOfPaths];\r\n const doubleSided = options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED ?? false;\r\n\r\n const closePath = options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath;\r\n if (numOfPaths > 2) {\r\n for (let i = 0; i < path.length - 1; i++) {\r\n v[0] = 1 + numOfPaths * i;\r\n v[1] = numOfPaths * i;\r\n v[2] = (i + 1) * numOfPaths;\r\n for (let pi = 0; pi < (numOfPaths - 1) * 2; pi++) {\r\n if (pi % 2 !== 0) {\r\n v[2] += 1;\r\n }\r\n if (pi % 2 === 0 && pi > 0) {\r\n v[0] += 1;\r\n v[1] += 1;\r\n }\r\n indices.push(v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[0], v[2]);\r\n if (doubleSided) {\r\n indices.push(v[0], v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[2]);\r\n }\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < positions.length / 3 - 3; i += 2) {\r\n indices.push(i, i + 1, i + 2);\r\n indices.push(i + 2, i + 1, i + 3);\r\n if (doubleSided) {\r\n indices.push(i + 1, i, i + 2);\r\n indices.push(i + 1, i + 2, i + 3);\r\n }\r\n }\r\n }\r\n if (closePath) {\r\n let lastIndice = numOfPaths * (path.length - 1);\r\n for (let pi = 0; pi < numOfPaths - 1; pi++) {\r\n indices.push(lastIndice, pi + 1, pi);\r\n indices.push(lastIndice + 1, pi + 1, lastIndice);\r\n if (doubleSided) {\r\n indices.push(pi, pi + 1, lastIndice);\r\n indices.push(lastIndice, pi + 1, lastIndice + 1);\r\n }\r\n lastIndice++;\r\n }\r\n }\r\n\r\n return {\r\n positions,\r\n indices,\r\n };\r\n }\r\n\r\n private _preprocess(pathArray: Vector3[][], indiceOffset: number, options: GreasedLineMeshOptions) {\r\n this._paths = pathArray;\r\n\r\n const ribbonVertexData = GreasedLineRibbonMesh._CreateRibbonVertexData(pathArray, options);\r\n\r\n const positions = ribbonVertexData.positions;\r\n\r\n if (!this._options.widths) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No 'GreasedLineMeshOptions.widths' table is specified.\";\r\n }\r\n\r\n const vertexPositions = Array.isArray(this._vertexPositions) ? this._vertexPositions : Array.from(this._vertexPositions);\r\n this._vertexPositions = vertexPositions;\r\n const uvs = Array.isArray(this._uvs) ? this._uvs : Array.from(this._uvs);\r\n this._uvs = uvs;\r\n const indices = Array.isArray(this._indices) ? this._indices : Array.from(this._indices);\r\n this._indices = indices;\r\n\r\n for (const p of positions) {\r\n vertexPositions.push(p);\r\n }\r\n\r\n let pathArrayCopy = pathArray;\r\n if (options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath) {\r\n pathArrayCopy = [];\r\n for (let i = 0; i < pathArray.length; i++) {\r\n const pathCopy = pathArray[i].slice();\r\n pathCopy.push(pathArray[i][0].clone());\r\n pathArrayCopy.push(pathCopy);\r\n }\r\n }\r\n\r\n this._calculateSegmentLengths(pathArrayCopy);\r\n\r\n const pathArrayLength = pathArrayCopy.length;\r\n const previousCounters = new Array(pathArrayLength).fill(0);\r\n for (let i = 0; i < pathArrayCopy[0].length; i++) {\r\n let v = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const counter = previousCounters[pi] + this._vSegmentLengths[pi][i] / this._vTotalLengths[pi];\r\n this._counters.push(counter);\r\n uvs.push(counter, v);\r\n\r\n previousCounters[pi] = counter;\r\n v += this._uSegmentLengths[i][pi] / this._uTotalLengths[i];\r\n }\r\n }\r\n\r\n for (let i = 0, c = 0; i < pathArrayCopy[0].length; i++) {\r\n const widthLower = this._uSegmentLengths[i][0] / 2;\r\n const widthUpper = this._uSegmentLengths[i][pathArrayLength - 1] / 2;\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthLower);\r\n for (let pi = 0; pi < pathArrayLength - 2; pi++) {\r\n this._ribbonWidths.push(0);\r\n }\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthUpper);\r\n }\r\n\r\n const slopes =\r\n options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS\r\n ? new Array(pathArrayCopy[0].length * pathArrayCopy.length * 6).fill(0)\r\n : GreasedLineRibbonMesh._CalculateSlopes(pathArrayCopy);\r\n for (const s of slopes) {\r\n this._slopes.push(s);\r\n }\r\n\r\n if (ribbonVertexData.indices) {\r\n for (let i = 0; i < ribbonVertexData.indices.length; i++) {\r\n indices.push(ribbonVertexData.indices[i] + indiceOffset);\r\n }\r\n }\r\n indiceOffset += positions.length / 3;\r\n\r\n return indiceOffset;\r\n }\r\n\r\n private static _ConvertToRibbonPath(points: number[], ribbonInfo: GreasedLineRibbonOptions, rightHandedSystem: boolean, directionPlane?: Vector3) {\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS && !ribbonInfo.width) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"'GreasedLineMeshOptions.ribbonOptiosn.width' must be specified in GreasedLineRibbonPointsMode.POINTS_MODE_POINTS.\";\r\n }\r\n const path1 = [];\r\n const path2 = [];\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n const width = ribbonInfo.width! / 2;\r\n const pointVectors = GreasedLineTools.ToVector3Array(points) as Vector3[];\r\n let direction: Nullable<Vector3> = null;\r\n let fatDirection: Nullable<Vector3> = null;\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT) {\r\n // set the direction plane from the first line segment for the whole line\r\n directionPlane = GreasedLineRibbonMesh._GetDirectionFromPoints(pointVectors[0], pointVectors[1], null);\r\n }\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO && !(ribbonInfo.directions instanceof Vector3)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO 'GreasedLineMeshOptions.ribbonOptions.directions' must be a Vector3.\";\r\n }\r\n\r\n TmpVectors.Vector3[1] = ribbonInfo.directions instanceof Vector3 ? ribbonInfo.directions : GreasedLineRibbonMesh.DIRECTION_XZ;\r\n for (let i = 0; i < pointVectors.length - (directionPlane ? 0 : 1); i++) {\r\n const p1 = pointVectors[i];\r\n const p2 = pointVectors[i + 1];\r\n\r\n if (directionPlane) {\r\n direction = <Vector3>directionPlane;\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO) {\r\n p2.subtractToRef(p1, TmpVectors.Vector3[0]);\r\n direction = Vector3.CrossToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2]).normalize();\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_ALL_SEGMENTS) {\r\n direction = GreasedLineRibbonMesh._GetDirectionFromPoints(p1, p2, direction);\r\n } else {\r\n // GreasedLineRibbonAutoDirectionMode.DIRECTION_ENHANCED\r\n const directionTemp = p2.subtract(p1);\r\n directionTemp.applyRotationQuaternionInPlace(\r\n directionTemp.x > directionTemp.y && directionTemp.x > directionTemp.z\r\n ? rightHandedSystem\r\n ? GreasedLineRibbonMesh._RightHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftReadOnlyQuaternion\r\n );\r\n direction = directionTemp.normalize();\r\n }\r\n\r\n fatDirection = direction.multiplyByFloats(width, width, width);\r\n path1.push(p1.add(fatDirection));\r\n path2.push(p1.subtract(fatDirection));\r\n }\r\n if (!directionPlane) {\r\n path1.push(pointVectors[pointVectors.length - 1].add(fatDirection!));\r\n path2.push(pointVectors[pointVectors.length - 1].subtract(fatDirection!));\r\n }\r\n }\r\n return [path1, path2];\r\n }\r\n\r\n private static _GetDirectionFromPoints(p1: Vector3, p2: Vector3, previousDirection: Nullable<Vector3>) {\r\n // handle straight lines\r\n if (p1.x === p2.x && (!previousDirection || previousDirection?.x === 1)) {\r\n return GreasedLineRibbonMesh.DIRECTION_YZ;\r\n }\r\n\r\n if (p1.y === p2.y) {\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n if (p1.z === p2.z) {\r\n return GreasedLineRibbonMesh.DIRECTION_XY;\r\n }\r\n\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n /**\r\n * Clones the GreasedLineRibbonMesh.\r\n * @param name new line name\r\n * @param newParent new parent node\r\n * @returns cloned line\r\n */\r\n public override clone(name: string = `${this.name}-cloned`, newParent?: Nullable<Node>) {\r\n const lineOptions = this._createLineOptions();\r\n const deepCopiedLineOptions: any = {};\r\n const pathOptionsCloned: any = [];\r\n DeepCopier.DeepCopy(this._pathsOptions, pathOptionsCloned, undefined, undefined, true);\r\n DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, [\"instance\"], undefined, true);\r\n\r\n const cloned = new GreasedLineRibbonMesh(name, this._scene, <GreasedLineMeshOptions>deepCopiedLineOptions, pathOptionsCloned);\r\n if (newParent) {\r\n cloned.parent = newParent;\r\n }\r\n\r\n cloned.material = this.material;\r\n\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineRibbonMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n serializationObject.pathsOptions = this._pathsOptions;\r\n }\r\n\r\n /**\r\n * Parses a serialized GreasedLineRibbonMesh\r\n * @param parsedMesh the serialized GreasedLineRibbonMesh\r\n * @param scene the scene to create the GreasedLineRibbonMesh in\r\n * @returns the created GreasedLineRibbonMesh\r\n */\r\n public static override Parse(parsedMesh: any, scene: Scene): Mesh {\r\n const lineOptions = <GreasedLineMeshOptions>parsedMesh.lineOptions;\r\n const name = <string>parsedMesh.name;\r\n const pathOptions = parsedMesh.pathOptions;\r\n const result = new GreasedLineRibbonMesh(name, scene, lineOptions, pathOptions);\r\n return result;\r\n }\r\n\r\n protected override _initGreasedLine() {\r\n super._initGreasedLine();\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._ribbonWidths = [];\r\n }\r\n\r\n private _calculateSegmentLengths(pathArray: Vector3[][]) {\r\n const pathArrayLength = pathArray.length;\r\n this._vSegmentLengths = new Array(pathArrayLength);\r\n this._vTotalLengths = new Array(pathArrayLength);\r\n let length = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const points = pathArray[pi];\r\n this._vSegmentLengths[pi] = [0]; // first point has 0 distance\r\n length = 0;\r\n for (let i = 0; i < points.length - 1; i++) {\r\n const l = Math.abs(points[i].subtract(points[i + 1]).lengthSquared()); // it's ok to have lengthSquared() here\r\n length += l;\r\n this._vSegmentLengths[pi].push(l);\r\n }\r\n this._vTotalLengths[pi] = length;\r\n }\r\n\r\n const positionsLength = pathArray[0].length;\r\n this._uSegmentLengths = new Array(positionsLength).fill([]);\r\n this._uTotalLengths = new Array(positionsLength).fill([]);\r\n const uLength = new Vector3();\r\n for (let i = 0; i < positionsLength; i++) {\r\n length = 0;\r\n for (let pi = 1; pi < pathArrayLength; pi++) {\r\n pathArray[pi][i].subtractToRef(pathArray[pi - 1][i], uLength);\r\n const l = uLength.length(); // must be length()\r\n length += l;\r\n this._uSegmentLengths[i].push(l);\r\n }\r\n this._uTotalLengths[i] = length;\r\n }\r\n }\r\n\r\n private static _CalculateSlopes(paths: Vector3[][]) {\r\n const points1 = paths[0];\r\n const points2 = paths.length === 2 ? paths[1] : paths[paths.length - 1];\r\n const slopes: number[] = [];\r\n\r\n const slope = new Vector3();\r\n for (let i = 0; i < points1.length; i++) {\r\n for (let pi = 0; pi < paths.length; pi++) {\r\n if (pi === 0 || pi === paths.length - 1) {\r\n points1[i].subtract(points2[i]).normalizeToRef(slope);\r\n slopes.push(slope.x, slope.y, slope.z);\r\n slopes.push(-slope.x, -slope.y, -slope.z);\r\n } else {\r\n slopes.push(0, 0, 0, 0, 0, 0);\r\n }\r\n }\r\n }\r\n\r\n return slopes;\r\n }\r\n\r\n protected override _createVertexBuffers(): VertexData {\r\n this._uvs = this._options.uvs ?? this._uvs;\r\n const vertexData = super._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n\r\n const countersBuffer = new Buffer(this._engine, this._counters, this._updatable, 1);\r\n this.setVerticesBuffer(countersBuffer.createVertexBuffer(\"grl_counters\", 0, 1));\r\n\r\n const colorPointersBuffer = new Buffer(this._engine, this._colorPointers, this._updatable, 1);\r\n this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer(\"grl_colorPointers\", 0, 1));\r\n\r\n const slopesBuffer = new Buffer(this._engine, this._slopes, this._updatable, 3);\r\n this.setVerticesBuffer(slopesBuffer.createVertexBuffer(\"grl_slopes\", 0, 3));\r\n\r\n const widthsBuffer = new Buffer(this._engine, this._ribbonWidths, this._updatable, 1);\r\n this.setVerticesBuffer(widthsBuffer.createVertexBuffer(\"grl_widths\", 0, 1));\r\n this._widthsBuffer = widthsBuffer;\r\n\r\n return vertexData;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"greasedLineRibbonMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineRibbonMesh.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAA+F,MAAM,uBAAuB,CAAC;AAGzJ,IAAI,CAAC,4BAA4B,GAAG,CAAC,UAAe,EAAE,KAAY,EAAQ,EAAE;IACxE,OAAO,qBAAqB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,mBAAmB;IAkC1D;;;;;;OAMG;IACH,YAC6B,IAAY,EACrC,KAAY,EACZ,QAAgC,EAChC,YAAuE;QAEvE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QALJ,SAAI,GAAJ,IAAI,CAAQ;QAOrC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE;YACzB,4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ChF,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAE5E,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACtF,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5E,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAElC,OAAO,UAAU,CAAC;IACtB,CAAC;;AAziBD;;GAEG;AACW,mCAAa,GAAG,GAAG,CAAC;AAEnB,2DAAqC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,0BAA0B,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACjH,0DAAoC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,yBAAyB,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAC/G,6CAAuB,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAEpG;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC,2DAA2D;AAC3H;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,UAAU,CAAC;AAChD;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,YAAY,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Quaternion, TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Node } from \"../../node\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions, GreasedLineRibbonOptions } from \"./greasedLineBaseMesh\";\r\nimport { GreasedLineBaseMesh, GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from \"./greasedLineBaseMesh\";\r\nimport type { VertexData } from \"../mesh.vertexData\";\r\n\r\nMesh._GreasedLineRibbonMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GreasedLineRibbonMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * GreasedLineRibbonMesh\r\n * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.\r\n */\r\nexport class GreasedLineRibbonMesh extends GreasedLineBaseMesh {\r\n /**\r\n * Default line width\r\n */\r\n public static DEFAULT_WIDTH = 0.1;\r\n\r\n private static _RightHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.RightHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftReadOnly, Math.PI / 2);\r\n\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XY plane\r\n */\r\n public static DIRECTION_XY = Vector3.LeftHandedForwardReadOnly; // doesn't matter in which handed system the scene operates\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XZ plane\r\n */\r\n public static DIRECTION_XZ = Vector3.UpReadOnly;\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the YZ plane\r\n */\r\n public static DIRECTION_YZ = Vector3.LeftReadOnly;\r\n\r\n private _paths: Vector3[][];\r\n private _pathsOptions: { options: GreasedLineMeshOptions; pathCount: number }[];\r\n private _vSegmentLengths: number[][];\r\n private _uSegmentLengths: number[][];\r\n private _vTotalLengths: number[];\r\n private _uTotalLengths: number[];\r\n\r\n private _counters: number[];\r\n private _slopes: number[];\r\n private _ribbonWidths: number[];\r\n\r\n /**\r\n * GreasedLineRibbonMesh\r\n * @param name name of the mesh\r\n * @param scene the scene\r\n * @param _options mesh options\r\n * @param _pathOptions used internaly when parsing a serialized GreasedLineRibbonMesh\r\n */\r\n constructor(\r\n public override readonly name: string,\r\n scene: Scene,\r\n _options: GreasedLineMeshOptions,\r\n _pathOptions?: { options: GreasedLineMeshOptions; pathCount: number }[]\r\n ) {\r\n super(name, scene, _options);\r\n\r\n if (!_options.ribbonOptions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"'GreasedLineMeshOptions.ribbonOptions' is not set.\";\r\n }\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._widths = _options.widths ?? [];\r\n this._ribbonWidths = [];\r\n this._pathsOptions = _pathOptions ?? [];\r\n\r\n if (_options.points) {\r\n this.addPoints(GreasedLineTools.ConvertPoints(_options.points), _options, !!_pathOptions);\r\n }\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n * @param options mesh options\r\n * @param hasPathOptions defaults to false\r\n */\r\n public override addPoints(points: number[][], options: GreasedLineMeshOptions, hasPathOptions = false) {\r\n if (!options.ribbonOptions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"addPoints() on GreasedLineRibbonMesh instance requires 'GreasedLineMeshOptions.ribbonOptions'.\";\r\n }\r\n\r\n if (!hasPathOptions) {\r\n this._pathsOptions.push({ options, pathCount: points.length });\r\n }\r\n\r\n super.addPoints(points, options);\r\n }\r\n\r\n /**\r\n * \"GreasedLineRibbonMesh\"\r\n * @returns \"GreasedLineRibbonMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GreasedLineRibbonMesh\";\r\n }\r\n\r\n /**\r\n * Return true if the line was created from two edge paths or one points path.\r\n * In this case the line is always flat.\r\n */\r\n public get isFlatLine() {\r\n return this._paths.length < 3;\r\n }\r\n\r\n /**\r\n * Returns the slopes of the line at each point relative to the center of the line\r\n */\r\n get slopes() {\r\n return this._slopes;\r\n }\r\n\r\n /**\r\n * Set the slopes of the line at each point relative to the center of the line\r\n */\r\n set slopes(slopes: number[]) {\r\n this._slopes = slopes;\r\n }\r\n\r\n protected _updateColorPointers() {\r\n if (this._options.colorPointers) {\r\n return;\r\n }\r\n\r\n let colorPointer = 0;\r\n this._colorPointers = [];\r\n for (let i = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const points = this._points[i];\r\n\r\n if (pathOptions.ribbonOptions!.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n for (let k = 0; k < pathCount; k++) {\r\n for (let j = 0; j < points.length; j += 3) {\r\n this._colorPointers.push(colorPointer);\r\n this._colorPointers.push(colorPointer++);\r\n }\r\n }\r\n } else {\r\n for (let j = 0; j < points.length; j += 3) {\r\n for (let k = 0; k < pathCount; k++) {\r\n this._colorPointers.push(colorPointer);\r\n }\r\n colorPointer++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _updateWidths(): void {\r\n super._updateWidthsWithValue(1);\r\n }\r\n\r\n protected _setPoints(points: number[][], _options: GreasedLineMeshOptions) {\r\n if (!this._options.ribbonOptions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No 'GreasedLineMeshOptions.ribbonOptions' provided.\";\r\n }\r\n this._points = points;\r\n this._options.points = points;\r\n\r\n this._initGreasedLine();\r\n\r\n let indiceOffset = 0;\r\n let directionPlanes: Vector3[];\r\n for (let i = 0, c = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const subPoints = points.slice(c, c + pathCount);\r\n c += pathCount;\r\n if (pathOptions.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS) {\r\n indiceOffset = this._preprocess(GreasedLineTools.ToVector3Array(subPoints) as Vector3[][], indiceOffset, pathOptions);\r\n } else {\r\n if (pathOptions.ribbonOptions?.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE) {\r\n if (!pathOptions.ribbonOptions!.directions) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE 'GreasedLineMeshOptions.ribbonOptions.directions' must be defined.\";\r\n }\r\n directionPlanes = GreasedLineRibbonMesh._GetDirectionPlanesFromDirectionsOption(subPoints.length, pathOptions.ribbonOptions!.directions);\r\n }\r\n subPoints.forEach((p, idx) => {\r\n const pathArray = GreasedLineRibbonMesh._ConvertToRibbonPath(\r\n p,\r\n pathOptions.ribbonOptions!,\r\n this._scene.useRightHandedSystem,\r\n directionPlanes ? directionPlanes[idx] : directionPlanes\r\n );\r\n indiceOffset = this._preprocess(pathArray, indiceOffset, pathOptions);\r\n });\r\n }\r\n }\r\n\r\n if (!this._lazy) {\r\n this._createVertexBuffers();\r\n !this.doNotSyncBoundingInfo && this.refreshBoundingInfo();\r\n }\r\n }\r\n\r\n private static _GetDirectionPlanesFromDirectionsOption(count: number, directions: Vector3 | Vector3[]) {\r\n if (Array.isArray(directions)) {\r\n return directions;\r\n }\r\n\r\n return new Array(count).fill(directions) as Vector3[];\r\n }\r\n\r\n private static _CreateRibbonVertexData(pathArray: Vector3[][], options: GreasedLineMeshOptions) {\r\n const numOfPaths = pathArray.length;\r\n if (numOfPaths < 2) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Minimum of two paths are required to create a GreasedLineRibbonMesh.\";\r\n }\r\n\r\n const positions = [];\r\n const indices = [];\r\n\r\n const path = pathArray[0];\r\n for (let i = 0; i < path.length; i++) {\r\n for (let pi = 0; pi < pathArray.length; pi++) {\r\n const v = pathArray[pi][i];\r\n positions.push(v.x, v.y, v.z);\r\n }\r\n }\r\n\r\n const v: number[] = [1, 0, numOfPaths];\r\n const doubleSided = options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED ?? false;\r\n\r\n const closePath = options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath;\r\n if (numOfPaths > 2) {\r\n for (let i = 0; i < path.length - 1; i++) {\r\n v[0] = 1 + numOfPaths * i;\r\n v[1] = numOfPaths * i;\r\n v[2] = (i + 1) * numOfPaths;\r\n for (let pi = 0; pi < (numOfPaths - 1) * 2; pi++) {\r\n if (pi % 2 !== 0) {\r\n v[2] += 1;\r\n }\r\n if (pi % 2 === 0 && pi > 0) {\r\n v[0] += 1;\r\n v[1] += 1;\r\n }\r\n indices.push(v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[0], v[2]);\r\n if (doubleSided) {\r\n indices.push(v[0], v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[2]);\r\n }\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < positions.length / 3 - 3; i += 2) {\r\n indices.push(i, i + 1, i + 2);\r\n indices.push(i + 2, i + 1, i + 3);\r\n if (doubleSided) {\r\n indices.push(i + 1, i, i + 2);\r\n indices.push(i + 1, i + 2, i + 3);\r\n }\r\n }\r\n }\r\n if (closePath) {\r\n let lastIndice = numOfPaths * (path.length - 1);\r\n for (let pi = 0; pi < numOfPaths - 1; pi++) {\r\n indices.push(lastIndice, pi + 1, pi);\r\n indices.push(lastIndice + 1, pi + 1, lastIndice);\r\n if (doubleSided) {\r\n indices.push(pi, pi + 1, lastIndice);\r\n indices.push(lastIndice, pi + 1, lastIndice + 1);\r\n }\r\n lastIndice++;\r\n }\r\n }\r\n\r\n return {\r\n positions,\r\n indices,\r\n };\r\n }\r\n\r\n private _preprocess(pathArray: Vector3[][], indiceOffset: number, options: GreasedLineMeshOptions) {\r\n this._paths = pathArray;\r\n\r\n const ribbonVertexData = GreasedLineRibbonMesh._CreateRibbonVertexData(pathArray, options);\r\n\r\n const positions = ribbonVertexData.positions;\r\n\r\n if (!this._options.widths) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"No 'GreasedLineMeshOptions.widths' table is specified.\";\r\n }\r\n\r\n const vertexPositions = Array.isArray(this._vertexPositions) ? this._vertexPositions : Array.from(this._vertexPositions);\r\n this._vertexPositions = vertexPositions;\r\n const uvs = Array.isArray(this._uvs) ? this._uvs : Array.from(this._uvs);\r\n this._uvs = uvs;\r\n const indices = Array.isArray(this._indices) ? this._indices : Array.from(this._indices);\r\n this._indices = indices;\r\n\r\n for (const p of positions) {\r\n vertexPositions.push(p);\r\n }\r\n\r\n let pathArrayCopy = pathArray;\r\n if (options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath) {\r\n pathArrayCopy = [];\r\n for (let i = 0; i < pathArray.length; i++) {\r\n const pathCopy = pathArray[i].slice();\r\n pathCopy.push(pathArray[i][0].clone());\r\n pathArrayCopy.push(pathCopy);\r\n }\r\n }\r\n\r\n this._calculateSegmentLengths(pathArrayCopy);\r\n\r\n const pathArrayLength = pathArrayCopy.length;\r\n const previousCounters = new Array(pathArrayLength).fill(0);\r\n for (let i = 0; i < pathArrayCopy[0].length; i++) {\r\n let v = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const counter = previousCounters[pi] + this._vSegmentLengths[pi][i] / this._vTotalLengths[pi];\r\n this._counters.push(counter);\r\n uvs.push(counter, v);\r\n\r\n previousCounters[pi] = counter;\r\n v += this._uSegmentLengths[i][pi] / this._uTotalLengths[i];\r\n }\r\n }\r\n\r\n for (let i = 0, c = 0; i < pathArrayCopy[0].length; i++) {\r\n const widthLower = this._uSegmentLengths[i][0] / 2;\r\n const widthUpper = this._uSegmentLengths[i][pathArrayLength - 1] / 2;\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthLower);\r\n for (let pi = 0; pi < pathArrayLength - 2; pi++) {\r\n this._ribbonWidths.push(0);\r\n }\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthUpper);\r\n }\r\n\r\n const slopes =\r\n options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS\r\n ? new Array(pathArrayCopy[0].length * pathArrayCopy.length * 6).fill(0)\r\n : GreasedLineRibbonMesh._CalculateSlopes(pathArrayCopy);\r\n for (const s of slopes) {\r\n this._slopes.push(s);\r\n }\r\n\r\n if (ribbonVertexData.indices) {\r\n for (let i = 0; i < ribbonVertexData.indices.length; i++) {\r\n indices.push(ribbonVertexData.indices[i] + indiceOffset);\r\n }\r\n }\r\n indiceOffset += positions.length / 3;\r\n\r\n return indiceOffset;\r\n }\r\n\r\n private static _ConvertToRibbonPath(points: number[], ribbonInfo: GreasedLineRibbonOptions, rightHandedSystem: boolean, directionPlane?: Vector3) {\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS && !ribbonInfo.width) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"'GreasedLineMeshOptions.ribbonOptiosn.width' must be specified in GreasedLineRibbonPointsMode.POINTS_MODE_POINTS.\";\r\n }\r\n const path1 = [];\r\n const path2 = [];\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n const width = ribbonInfo.width! / 2;\r\n const pointVectors = GreasedLineTools.ToVector3Array(points) as Vector3[];\r\n let direction: Nullable<Vector3> = null;\r\n let fatDirection: Nullable<Vector3> = null;\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT) {\r\n // set the direction plane from the first line segment for the whole line\r\n directionPlane = GreasedLineRibbonMesh._GetDirectionFromPoints(pointVectors[0], pointVectors[1], null);\r\n }\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO && !(ribbonInfo.directions instanceof Vector3)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO 'GreasedLineMeshOptions.ribbonOptions.directions' must be a Vector3.\";\r\n }\r\n\r\n TmpVectors.Vector3[1] = ribbonInfo.directions instanceof Vector3 ? ribbonInfo.directions : GreasedLineRibbonMesh.DIRECTION_XZ;\r\n for (let i = 0; i < pointVectors.length - (directionPlane ? 0 : 1); i++) {\r\n const p1 = pointVectors[i];\r\n const p2 = pointVectors[i + 1];\r\n\r\n if (directionPlane) {\r\n direction = <Vector3>directionPlane;\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO) {\r\n p2.subtractToRef(p1, TmpVectors.Vector3[0]);\r\n direction = Vector3.CrossToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2]).normalize();\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_ALL_SEGMENTS) {\r\n direction = GreasedLineRibbonMesh._GetDirectionFromPoints(p1, p2, direction);\r\n } else {\r\n // GreasedLineRibbonAutoDirectionMode.DIRECTION_ENHANCED\r\n const directionTemp = p2.subtract(p1);\r\n directionTemp.applyRotationQuaternionInPlace(\r\n directionTemp.x > directionTemp.y && directionTemp.x > directionTemp.z\r\n ? rightHandedSystem\r\n ? GreasedLineRibbonMesh._RightHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftReadOnlyQuaternion\r\n );\r\n direction = directionTemp.normalize();\r\n }\r\n\r\n fatDirection = direction.multiplyByFloats(width, width, width);\r\n path1.push(p1.add(fatDirection));\r\n path2.push(p1.subtract(fatDirection));\r\n }\r\n if (!directionPlane) {\r\n path1.push(pointVectors[pointVectors.length - 1].add(fatDirection!));\r\n path2.push(pointVectors[pointVectors.length - 1].subtract(fatDirection!));\r\n }\r\n }\r\n return [path1, path2];\r\n }\r\n\r\n private static _GetDirectionFromPoints(p1: Vector3, p2: Vector3, previousDirection: Nullable<Vector3>) {\r\n // handle straight lines\r\n if (p1.x === p2.x && (!previousDirection || previousDirection?.x === 1)) {\r\n return GreasedLineRibbonMesh.DIRECTION_YZ;\r\n }\r\n\r\n if (p1.y === p2.y) {\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n if (p1.z === p2.z) {\r\n return GreasedLineRibbonMesh.DIRECTION_XY;\r\n }\r\n\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n /**\r\n * Clones the GreasedLineRibbonMesh.\r\n * @param name new line name\r\n * @param newParent new parent node\r\n * @returns cloned line\r\n */\r\n public override clone(name: string = `${this.name}-cloned`, newParent?: Nullable<Node>) {\r\n const lineOptions = this._createLineOptions();\r\n const deepCopiedLineOptions: any = {};\r\n const pathOptionsCloned: any = [];\r\n DeepCopier.DeepCopy(this._pathsOptions, pathOptionsCloned, undefined, undefined, true);\r\n DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, [\"instance\"], undefined, true);\r\n\r\n const cloned = new GreasedLineRibbonMesh(name, this._scene, <GreasedLineMeshOptions>deepCopiedLineOptions, pathOptionsCloned);\r\n if (newParent) {\r\n cloned.parent = newParent;\r\n }\r\n\r\n cloned.material = this.material;\r\n\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineRibbonMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n serializationObject.pathsOptions = this._pathsOptions;\r\n }\r\n\r\n /**\r\n * Parses a serialized GreasedLineRibbonMesh\r\n * @param parsedMesh the serialized GreasedLineRibbonMesh\r\n * @param scene the scene to create the GreasedLineRibbonMesh in\r\n * @returns the created GreasedLineRibbonMesh\r\n */\r\n public static override Parse(parsedMesh: any, scene: Scene): Mesh {\r\n const lineOptions = <GreasedLineMeshOptions>parsedMesh.lineOptions;\r\n const name = <string>parsedMesh.name;\r\n const pathOptions = parsedMesh.pathOptions;\r\n const result = new GreasedLineRibbonMesh(name, scene, lineOptions, pathOptions);\r\n return result;\r\n }\r\n\r\n protected override _initGreasedLine() {\r\n super._initGreasedLine();\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._ribbonWidths = [];\r\n }\r\n\r\n private _calculateSegmentLengths(pathArray: Vector3[][]) {\r\n const pathArrayLength = pathArray.length;\r\n this._vSegmentLengths = new Array(pathArrayLength);\r\n this._vTotalLengths = new Array(pathArrayLength);\r\n let length = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const points = pathArray[pi];\r\n this._vSegmentLengths[pi] = [0]; // first point has 0 distance\r\n length = 0;\r\n for (let i = 0; i < points.length - 1; i++) {\r\n const l = Math.abs(points[i].subtract(points[i + 1]).lengthSquared()); // it's ok to have lengthSquared() here\r\n length += l;\r\n this._vSegmentLengths[pi].push(l);\r\n }\r\n this._vTotalLengths[pi] = length;\r\n }\r\n\r\n const positionsLength = pathArray[0].length;\r\n this._uSegmentLengths = new Array(positionsLength).fill([]);\r\n this._uTotalLengths = new Array(positionsLength).fill([]);\r\n const uLength = new Vector3();\r\n for (let i = 0; i < positionsLength; i++) {\r\n length = 0;\r\n for (let pi = 1; pi < pathArrayLength; pi++) {\r\n pathArray[pi][i].subtractToRef(pathArray[pi - 1][i], uLength);\r\n const l = uLength.length(); // must be length()\r\n length += l;\r\n this._uSegmentLengths[i].push(l);\r\n }\r\n this._uTotalLengths[i] = length;\r\n }\r\n }\r\n\r\n private static _CalculateSlopes(paths: Vector3[][]) {\r\n const points1 = paths[0];\r\n const points2 = paths.length === 2 ? paths[1] : paths[paths.length - 1];\r\n const slopes: number[] = [];\r\n\r\n const slope = new Vector3();\r\n for (let i = 0; i < points1.length; i++) {\r\n for (let pi = 0; pi < paths.length; pi++) {\r\n if (pi === 0 || pi === paths.length - 1) {\r\n points1[i].subtract(points2[i]).normalizeToRef(slope);\r\n slopes.push(slope.x, slope.y, slope.z);\r\n slopes.push(-slope.x, -slope.y, -slope.z);\r\n } else {\r\n slopes.push(0, 0, 0, 0, 0, 0);\r\n }\r\n }\r\n }\r\n\r\n return slopes;\r\n }\r\n\r\n protected override _createVertexBuffers(): VertexData {\r\n this._uvs = this._options.uvs ?? this._uvs;\r\n const vertexData = super._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n\r\n const countersBuffer = new Buffer(this._engine, this._counters, this._updatable, 1);\r\n this.setVerticesBuffer(countersBuffer.createVertexBuffer(\"grl_counters\", 0, 1));\r\n\r\n const colorPointersBuffer = new Buffer(this._engine, this._colorPointers, this._updatable, 1);\r\n this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer(\"grl_colorPointers\", 0, 1));\r\n\r\n const slopesBuffer = new Buffer(this._engine, this._slopes, this._updatable, 3);\r\n this.setVerticesBuffer(slopesBuffer.createVertexBuffer(\"grl_slopes\", 0, 3));\r\n\r\n const widthsBuffer = new Buffer(this._engine, this._ribbonWidths, this._updatable, 1);\r\n this.setVerticesBuffer(widthsBuffer.createVertexBuffer(\"grl_widths\", 0, 1));\r\n this._widthsBuffer = widthsBuffer;\r\n\r\n return vertexData;\r\n }\r\n}\r\n"]}
@@ -50,6 +50,9 @@ export declare class SetPositionsBlock extends NodeGeometryBlock implements INod
50
50
  * Gets the geometry output component
51
51
  */
52
52
  get output(): NodeGeometryConnectionPoint;
53
+ private _remapVector3Data;
54
+ private _remapVector4Data;
55
+ private _remapVector2Data;
53
56
  protected _buildBlock(state: NodeGeometryBuildState): void;
54
57
  protected _dumpPropertiesCode(): string;
55
58
  /**
@@ -68,6 +68,36 @@ export class SetPositionsBlock extends NodeGeometryBlock {
68
68
  get output() {
69
69
  return this._outputs[0];
70
70
  }
71
+ _remapVector3Data(source, remap) {
72
+ const newData = [];
73
+ for (let index = 0; index < source.length; index += 3) {
74
+ const remappedIndex = remap[index / 3];
75
+ if (remappedIndex !== undefined) {
76
+ newData.push(source[index], source[index + 1], source[index + 2]);
77
+ }
78
+ }
79
+ return newData;
80
+ }
81
+ _remapVector4Data(source, remap) {
82
+ const newData = [];
83
+ for (let index = 0; index < source.length; index += 4) {
84
+ const remappedIndex = remap[index / 4];
85
+ if (remappedIndex !== undefined) {
86
+ newData.push(source[index], source[index + 1], source[index + 2], source[index + 3]);
87
+ }
88
+ }
89
+ return newData;
90
+ }
91
+ _remapVector2Data(source, remap) {
92
+ const newData = [];
93
+ for (let index = 0; index < source.length; index += 2) {
94
+ const remappedIndex = remap[index / 2];
95
+ if (remappedIndex !== undefined) {
96
+ newData.push(source[index], source[index + 1]);
97
+ }
98
+ }
99
+ return newData;
100
+ }
71
101
  _buildBlock(state) {
72
102
  const func = (state) => {
73
103
  state.pushExecutionContext(this);
@@ -83,13 +113,68 @@ export class SetPositionsBlock extends NodeGeometryBlock {
83
113
  return;
84
114
  }
85
115
  // Processing
116
+ const remap = {};
86
117
  const vertexCount = this._vertexData.positions.length / 3;
118
+ const newPositions = [];
119
+ let activeIndex = 0;
120
+ let resize = false;
87
121
  for (this._currentIndex = 0; this._currentIndex < vertexCount; this._currentIndex++) {
88
122
  const tempVector3 = this.positions.getConnectedValue(state);
89
123
  if (tempVector3) {
90
- tempVector3.toArray(this._vertexData.positions, this._currentIndex * 3);
124
+ tempVector3.toArray(newPositions, activeIndex * 3);
125
+ remap[this._currentIndex] = activeIndex;
126
+ activeIndex++;
127
+ }
128
+ else {
129
+ resize = true;
130
+ }
131
+ }
132
+ if (resize) {
133
+ // Indices remap
134
+ if (this._vertexData.indices) {
135
+ const newIndices = [];
136
+ for (let index = 0; index < this._vertexData.indices.length; index++) {
137
+ const remappedIndex = remap[this._vertexData.indices[index]];
138
+ if (remappedIndex !== undefined) {
139
+ newIndices.push(remappedIndex);
140
+ }
141
+ }
142
+ this._vertexData.indices = newIndices;
143
+ }
144
+ // Normals remap
145
+ if (this._vertexData.normals) {
146
+ this._vertexData.normals = this._remapVector3Data(this._vertexData.normals, remap);
147
+ }
148
+ // Tangents remap
149
+ if (this._vertexData.tangents) {
150
+ this._vertexData.tangents = this._remapVector4Data(this._vertexData.tangents, remap);
151
+ }
152
+ // Colors remap
153
+ if (this._vertexData.colors) {
154
+ this._vertexData.colors = this._remapVector4Data(this._vertexData.colors, remap);
155
+ }
156
+ // UVs remap
157
+ if (this._vertexData.uvs) {
158
+ this._vertexData.uvs = this._remapVector2Data(this._vertexData.uvs, remap);
159
+ }
160
+ if (this._vertexData.uvs2) {
161
+ this._vertexData.uvs2 = this._remapVector2Data(this._vertexData.uvs2, remap);
162
+ }
163
+ if (this._vertexData.uvs3) {
164
+ this._vertexData.uvs3 = this._remapVector2Data(this._vertexData.uvs3, remap);
165
+ }
166
+ if (this._vertexData.uvs4) {
167
+ this._vertexData.uvs4 = this._remapVector2Data(this._vertexData.uvs4, remap);
168
+ }
169
+ if (this._vertexData.uvs5) {
170
+ this._vertexData.uvs5 = this._remapVector2Data(this._vertexData.uvs5, remap);
171
+ }
172
+ if (this._vertexData.uvs6) {
173
+ this._vertexData.uvs6 = this._remapVector2Data(this._vertexData.uvs6, remap);
91
174
  }
92
175
  }
176
+ // Update positions
177
+ this._vertexData.positions = newPositions;
93
178
  // Storage
94
179
  state.restoreGeometryContext();
95
180
  state.restoreExecutionContext();
@@ -1 +1 @@
1
- {"version":3,"file":"setPositionsBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Set/setPositionsBlock.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;AAKrG,OAAO,EAA0B,sBAAsB,EAAE,gDAAsC;AAE/F;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,iBAAiB;IAWpD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,I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AAG,IAAI,CAAC,iBAAiB,sBAAsB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QAC7I,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,mBAAmB,CAAC,eAAe,KAAK,SAAS,EAAE;YACnD,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;SAC9D;IACL,CAAC;CACJ;AAtIU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;0DAC3F;AAwIlC,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { INodeGeometryExecutionContext } from \"../../Interfaces/nodeGeometryExecutionContext\";\r\nimport type { VertexData } from \"../../../../Meshes/mesh.vertexData\";\r\nimport type { Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to set positions for a geometry\r\n */\r\nexport class SetPositionsBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {\r\n private _vertexData: VertexData;\r\n private _currentIndex: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Create a new SetPositionsBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"positions\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"SetPositionsBlock\";\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 positions input component\r\n */\r\n public get positions(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n\r\n if (this._vertexData) {\r\n this._vertexData = this._vertexData.clone(); // Preserve source data\r\n }\r\n\r\n state.pushGeometryContext(this._vertexData);\r\n\r\n if (!this._vertexData || !this._vertexData.positions || !this.positions.isConnected) {\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n // Processing\r\n const vertexCount = this._vertexData.positions.length / 3;\r\n for (this._currentIndex = 0; this._currentIndex < vertexCount; this._currentIndex++) {\r\n const tempVector3 = this.positions.getConnectedValue(state) as Vector3;\r\n if (tempVector3) {\r\n tempVector3.toArray(this._vertexData.positions, this._currentIndex * 3);\r\n }\r\n }\r\n\r\n // Storage\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n return this._vertexData;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SetPositionsBlock\", SetPositionsBlock);\r\n"]}
1
+ {"version":3,"file":"setPositionsBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Set/setPositionsBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE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AAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { INodeGeometryExecutionContext } from \"../../Interfaces/nodeGeometryExecutionContext\";\r\nimport type { VertexData } from \"../../../../Meshes/mesh.vertexData\";\r\nimport type { Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport type { FloatArray } from \"core/types\";\r\n\r\n/**\r\n * Block used to set positions for a geometry\r\n */\r\nexport class SetPositionsBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {\r\n private _vertexData: VertexData;\r\n private _currentIndex: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Create a new SetPositionsBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"positions\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"SetPositionsBlock\";\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 positions input component\r\n */\r\n public get positions(): 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 _remapVector3Data(source: FloatArray, remap: { [key: number]: number }): FloatArray {\r\n const newData: FloatArray = [];\r\n for (let index = 0; index < source.length; index += 3) {\r\n const remappedIndex = remap[index / 3];\r\n\r\n if (remappedIndex !== undefined) {\r\n newData.push(source[index], source[index + 1], source[index + 2]);\r\n }\r\n }\r\n return newData;\r\n }\r\n\r\n private _remapVector4Data(source: FloatArray, remap: { [key: number]: number }): FloatArray {\r\n const newData: FloatArray = [];\r\n for (let index = 0; index < source.length; index += 4) {\r\n const remappedIndex = remap[index / 4];\r\n\r\n if (remappedIndex !== undefined) {\r\n newData.push(source[index], source[index + 1], source[index + 2], source[index + 3]);\r\n }\r\n }\r\n return newData;\r\n }\r\n\r\n private _remapVector2Data(source: FloatArray, remap: { [key: number]: number }): FloatArray {\r\n const newData: FloatArray = [];\r\n for (let index = 0; index < source.length; index += 2) {\r\n const remappedIndex = remap[index / 2];\r\n\r\n if (remappedIndex !== undefined) {\r\n newData.push(source[index], source[index + 1]);\r\n }\r\n }\r\n return newData;\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n\r\n if (this._vertexData) {\r\n this._vertexData = this._vertexData.clone(); // Preserve source data\r\n }\r\n\r\n state.pushGeometryContext(this._vertexData);\r\n\r\n if (!this._vertexData || !this._vertexData.positions || !this.positions.isConnected) {\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n // Processing\r\n const remap: { [key: number]: number } = {};\r\n const vertexCount = this._vertexData.positions.length / 3;\r\n const newPositions: FloatArray = [];\r\n let activeIndex = 0;\r\n let resize = false;\r\n for (this._currentIndex = 0; this._currentIndex < vertexCount; this._currentIndex++) {\r\n const tempVector3 = this.positions.getConnectedValue(state) as Vector3;\r\n if (tempVector3) {\r\n tempVector3.toArray(newPositions, activeIndex * 3);\r\n remap[this._currentIndex] = activeIndex;\r\n activeIndex++;\r\n } else {\r\n resize = true;\r\n }\r\n }\r\n\r\n if (resize) {\r\n // Indices remap\r\n if (this._vertexData.indices) {\r\n const newIndices: number[] = [];\r\n for (let index = 0; index < this._vertexData.indices.length; index++) {\r\n const remappedIndex = remap[this._vertexData.indices[index]];\r\n\r\n if (remappedIndex !== undefined) {\r\n newIndices.push(remappedIndex);\r\n }\r\n }\r\n\r\n this._vertexData.indices = newIndices;\r\n }\r\n\r\n // Normals remap\r\n if (this._vertexData.normals) {\r\n this._vertexData.normals = this._remapVector3Data(this._vertexData.normals, remap);\r\n }\r\n\r\n // Tangents remap\r\n if (this._vertexData.tangents) {\r\n this._vertexData.tangents = this._remapVector4Data(this._vertexData.tangents, remap);\r\n }\r\n\r\n // Colors remap\r\n if (this._vertexData.colors) {\r\n this._vertexData.colors = this._remapVector4Data(this._vertexData.colors, remap);\r\n }\r\n\r\n // UVs remap\r\n if (this._vertexData.uvs) {\r\n this._vertexData.uvs = this._remapVector2Data(this._vertexData.uvs, remap);\r\n }\r\n if (this._vertexData.uvs2) {\r\n this._vertexData.uvs2 = this._remapVector2Data(this._vertexData.uvs2, remap);\r\n }\r\n if (this._vertexData.uvs3) {\r\n this._vertexData.uvs3 = this._remapVector2Data(this._vertexData.uvs3, remap);\r\n }\r\n if (this._vertexData.uvs4) {\r\n this._vertexData.uvs4 = this._remapVector2Data(this._vertexData.uvs4, remap);\r\n }\r\n if (this._vertexData.uvs5) {\r\n this._vertexData.uvs5 = this._remapVector2Data(this._vertexData.uvs5, remap);\r\n }\r\n if (this._vertexData.uvs6) {\r\n this._vertexData.uvs6 = this._remapVector2Data(this._vertexData.uvs6, remap);\r\n }\r\n }\r\n\r\n // Update positions\r\n this._vertexData.positions = newPositions;\r\n\r\n // Storage\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n return this._vertexData;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SetPositionsBlock\", SetPositionsBlock);\r\n"]}
@@ -18,5 +18,9 @@ export declare class NullBlock extends NodeGeometryBlock {
18
18
  * Gets the geometry output component
19
19
  */
20
20
  get geometry(): NodeGeometryConnectionPoint;
21
+ /**
22
+ * Gets the vector output component
23
+ */
24
+ get vector(): NodeGeometryConnectionPoint;
21
25
  protected _buildBlock(): void;
22
26
  }
@@ -12,6 +12,7 @@ export class NullBlock extends NodeGeometryBlock {
12
12
  constructor(name) {
13
13
  super(name);
14
14
  this.registerOutput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
15
+ this.registerOutput("vector", NodeGeometryBlockConnectionPointTypes.Vector3);
15
16
  }
16
17
  /**
17
18
  * Gets the current class name
@@ -26,8 +27,15 @@ export class NullBlock extends NodeGeometryBlock {
26
27
  get geometry() {
27
28
  return this._outputs[0];
28
29
  }
30
+ /**
31
+ * Gets the vector output component
32
+ */
33
+ get vector() {
34
+ return this._outputs[1];
35
+ }
29
36
  _buildBlock() {
30
37
  this.geometry._storedValue = null;
38
+ this.vector._storedValue = null;
31
39
  }
32
40
  }
33
41
  RegisterClass("BABYLON.NullBlock", NullBlock);
@@ -1 +1 @@
1
- {"version":3,"file":"nullBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Sources/nullBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,iBAAiB;IAC5C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;IACpF,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,WAAW,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAEkB,WAAW;QAC1B,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\n\r\n/**\r\n * Defines a block used to generate a null geometry data\r\n */\r\nexport class NullBlock extends NodeGeometryBlock {\r\n /**\r\n * Create a new NullBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\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 \"NullBlock\";\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() {\r\n this.geometry._storedValue = null;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NullBlock\", NullBlock);\r\n"]}
1
+ {"version":3,"file":"nullBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Sources/nullBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,iBAAiB;IAC5C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAChF,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;IACjF,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,WAAW,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAEkB,WAAW;QAC1B,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC;IACpC,CAAC;CACJ;AAED,aAAa,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\n\r\n/**\r\n * Defines a block used to generate a null geometry data\r\n */\r\nexport class NullBlock extends NodeGeometryBlock {\r\n /**\r\n * Create a new NullBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerOutput(\"vector\", NodeGeometryBlockConnectionPointTypes.Vector3);\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 \"NullBlock\";\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 /**\r\n * Gets the vector output component\r\n */\r\n public get vector(): NodeGeometryConnectionPoint {\r\n return this._outputs[1];\r\n }\r\n\r\n protected override _buildBlock() {\r\n this.geometry._storedValue = null;\r\n this.vector._storedValue = null;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NullBlock\", NullBlock);\r\n"]}