@babylonjs/core 7.0.0 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/Animations/animationGroup.d.ts +1 -1
  2. package/Animations/animationGroup.js +1 -1
  3. package/Animations/animationGroup.js.map +1 -1
  4. package/Animations/runtimeAnimation.js +10 -3
  5. package/Animations/runtimeAnimation.js.map +1 -1
  6. package/Compute/computeEffect.d.ts +3 -4
  7. package/Compute/computeEffect.js +40 -33
  8. package/Compute/computeEffect.js.map +1 -1
  9. package/Compute/computeShader.d.ts +2 -2
  10. package/Compute/computeShader.js.map +1 -1
  11. package/Engines/Extensions/engine.computeShader.d.ts +27 -3
  12. package/Engines/Extensions/engine.computeShader.js +1 -1
  13. package/Engines/Extensions/engine.computeShader.js.map +1 -1
  14. package/Engines/Extensions/engine.multiRender.js +1 -1
  15. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  16. package/Engines/Extensions/engine.renderTarget.js +12 -2
  17. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  18. package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +1 -2
  19. package/Engines/WebGL/webGLRenderTargetWrapper.js +2 -3
  20. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  21. package/Engines/WebGPU/Extensions/engine.computeShader.js +22 -0
  22. package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
  23. package/Engines/WebGPU/Extensions/engine.multiRender.js +1 -1
  24. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  25. package/Engines/WebGPU/Extensions/engine.renderTarget.js +3 -1
  26. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  27. package/Engines/WebGPU/webgpuClearQuad.d.ts +2 -2
  28. package/Engines/WebGPU/webgpuClearQuad.js +8 -3
  29. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  30. package/Engines/WebGPU/webgpuComputePipelineContext.js +4 -2
  31. package/Engines/WebGPU/webgpuComputePipelineContext.js.map +1 -1
  32. package/Engines/WebGPU/webgpuHardwareTexture.js +1 -0
  33. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  34. package/Engines/WebGPU/webgpuShaderProcessor.js +15 -0
  35. package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
  36. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +1 -0
  37. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +10 -2
  38. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  39. package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
  40. package/Engines/WebGPU/webgpuTextureManager.js +7 -7
  41. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  42. package/Engines/nativeEngine.d.ts +1 -0
  43. package/Engines/nativeEngine.js.map +1 -1
  44. package/Engines/nullEngine.d.ts +1 -0
  45. package/Engines/nullEngine.js.map +1 -1
  46. package/Engines/renderTargetWrapper.d.ts +14 -2
  47. package/Engines/renderTargetWrapper.js +23 -3
  48. package/Engines/renderTargetWrapper.js.map +1 -1
  49. package/Engines/thinEngine.d.ts +3 -7
  50. package/Engines/thinEngine.js +23 -9
  51. package/Engines/thinEngine.js.map +1 -1
  52. package/Engines/webgpuEngine.d.ts +2 -2
  53. package/Engines/webgpuEngine.js +19 -9
  54. package/Engines/webgpuEngine.js.map +1 -1
  55. package/Gizmos/axisScaleGizmo.js +6 -1
  56. package/Gizmos/axisScaleGizmo.js.map +1 -1
  57. package/Gizmos/boundingBoxGizmo.d.ts +2 -2
  58. package/Gizmos/boundingBoxGizmo.js +27 -17
  59. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  60. package/Gizmos/scaleGizmo.d.ts +6 -0
  61. package/Gizmos/scaleGizmo.js +10 -2
  62. package/Gizmos/scaleGizmo.js.map +1 -1
  63. package/Lights/Shadows/cascadedShadowGenerator.js +1 -1
  64. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  65. package/Lights/Shadows/shadowGenerator.js +17 -2
  66. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  67. package/Materials/Node/Blocks/Dual/textureBlock.js +5 -0
  68. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  69. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +2 -0
  70. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  71. package/Materials/Node/Blocks/addBlock.d.ts +2 -15
  72. package/Materials/Node/Blocks/addBlock.js +4 -32
  73. package/Materials/Node/Blocks/addBlock.js.map +1 -1
  74. package/Materials/Node/Blocks/baseMathBlock.d.ts +26 -0
  75. package/Materials/Node/Blocks/baseMathBlock.js +84 -0
  76. package/Materials/Node/Blocks/baseMathBlock.js.map +1 -0
  77. package/Materials/Node/Blocks/divideBlock.d.ts +2 -15
  78. package/Materials/Node/Blocks/divideBlock.js +4 -32
  79. package/Materials/Node/Blocks/divideBlock.js.map +1 -1
  80. package/Materials/Node/Blocks/multiplyBlock.d.ts +2 -15
  81. package/Materials/Node/Blocks/multiplyBlock.js +4 -32
  82. package/Materials/Node/Blocks/multiplyBlock.js.map +1 -1
  83. package/Materials/Node/Blocks/subtractBlock.d.ts +2 -15
  84. package/Materials/Node/Blocks/subtractBlock.js +4 -32
  85. package/Materials/Node/Blocks/subtractBlock.js.map +1 -1
  86. package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +4 -0
  87. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +7 -0
  88. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  89. package/Materials/PBR/pbrBaseMaterial.js +1 -5
  90. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  91. package/Materials/PBR/pbrClearCoatConfiguration.d.ts +0 -1
  92. package/Materials/PBR/pbrClearCoatConfiguration.js +3 -12
  93. package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
  94. package/Materials/PBR/pbrIridescenceConfiguration.d.ts +1 -4
  95. package/Materials/PBR/pbrIridescenceConfiguration.js +5 -15
  96. package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
  97. package/Materials/PBR/pbrSheenConfiguration.d.ts +0 -1
  98. package/Materials/PBR/pbrSheenConfiguration.js +3 -12
  99. package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
  100. package/Materials/PBR/pbrSubSurfaceConfiguration.js +5 -17
  101. package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
  102. package/Materials/Textures/baseTexture.d.ts +0 -6
  103. package/Materials/Textures/baseTexture.js +0 -8
  104. package/Materials/Textures/baseTexture.js.map +1 -1
  105. package/Materials/Textures/renderTargetTexture.d.ts +8 -24
  106. package/Materials/Textures/renderTargetTexture.js +13 -8
  107. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  108. package/Materials/Textures/texture.d.ts +5 -8
  109. package/Materials/Textures/texture.js +10 -20
  110. package/Materials/Textures/texture.js.map +1 -1
  111. package/Materials/Textures/textureCreationOptions.d.ts +1 -0
  112. package/Materials/Textures/textureCreationOptions.js.map +1 -1
  113. package/Materials/Textures/thinTexture.js +1 -1
  114. package/Materials/Textures/thinTexture.js.map +1 -1
  115. package/Materials/effect.d.ts +3 -3
  116. package/Materials/effect.js.map +1 -1
  117. package/Materials/shaderMaterial.d.ts +3 -3
  118. package/Materials/shaderMaterial.js.map +1 -1
  119. package/Maths/math.vector.d.ts +12 -0
  120. package/Maths/math.vector.js +17 -2
  121. package/Maths/math.vector.js.map +1 -1
  122. package/Maths/tensor.d.ts +13 -11
  123. package/Maths/tensor.js.map +1 -1
  124. package/Meshes/Builders/greasedLineBuilder.js +14 -0
  125. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  126. package/Meshes/Builders/ribbonBuilder.js +32 -28
  127. package/Meshes/Builders/ribbonBuilder.js.map +1 -1
  128. package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +18 -6
  129. package/Meshes/GreasedLine/greasedLineBaseMesh.js +17 -1
  130. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  131. package/Meshes/GreasedLine/greasedLineMesh.d.ts +0 -2
  132. package/Meshes/GreasedLine/greasedLineMesh.js +84 -77
  133. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  134. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +19 -4
  135. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  136. package/Meshes/Node/Blocks/mathBlock.d.ts +6 -0
  137. package/Meshes/Node/Blocks/mathBlock.js +95 -23
  138. package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
  139. package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +4 -0
  140. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +7 -0
  141. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  142. package/Misc/greasedLineTools.d.ts +6 -0
  143. package/Misc/greasedLineTools.js +21 -0
  144. package/Misc/greasedLineTools.js.map +1 -1
  145. package/Rendering/depthPeelingRenderer.js +1 -1
  146. package/Rendering/depthPeelingRenderer.js.map +1 -1
  147. package/Rendering/fluidRenderer/fluidRenderer.js +1 -1
  148. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  149. package/Rendering/reflectiveShadowMap.js +1 -1
  150. package/Rendering/reflectiveShadowMap.js.map +1 -1
  151. package/Shaders/ShadersInclude/pbrBlockClearcoat.js +0 -4
  152. package/Shaders/ShadersInclude/pbrBlockClearcoat.js.map +1 -1
  153. package/Shaders/ShadersInclude/pbrBlockIridescence.js +0 -3
  154. package/Shaders/ShadersInclude/pbrBlockIridescence.js.map +1 -1
  155. package/Shaders/ShadersInclude/pbrBlockSheen.js +1 -5
  156. package/Shaders/ShadersInclude/pbrBlockSheen.js.map +1 -1
  157. package/Shaders/ShadersInclude/pbrBlockSubSurface.js +1 -1
  158. package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  159. package/Shaders/ShadersInclude/pbrDebug.js +2 -0
  160. package/Shaders/ShadersInclude/pbrDebug.js.map +1 -1
  161. package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +2 -2
  162. package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
  163. package/Shaders/greasedLine.vertex.js +3 -3
  164. package/Shaders/greasedLine.vertex.js.map +1 -1
  165. package/Shaders/pbr.fragment.js +4 -4
  166. package/Shaders/pbr.fragment.js.map +1 -1
  167. package/ShadersWGSL/clearQuad.fragment.js +11 -0
  168. package/ShadersWGSL/clearQuad.fragment.js.map +1 -0
  169. package/ShadersWGSL/clearQuad.vertex.js +22 -0
  170. package/ShadersWGSL/clearQuad.vertex.js.map +1 -0
  171. package/XR/features/WebXRHandTracking.d.ts +5 -0
  172. package/XR/features/WebXRHandTracking.js +6 -0
  173. package/XR/features/WebXRHandTracking.js.map +1 -1
  174. package/node.js +1 -6
  175. package/node.js.map +1 -1
  176. package/package.json +1 -1
  177. package/Shaders/clearQuad.fragment.js +0 -10
  178. package/Shaders/clearQuad.fragment.js.map +0 -1
  179. package/Shaders/clearQuad.vertex.js +0 -19
  180. package/Shaders/clearQuad.vertex.js.map +0 -1
  181. /package/{Shaders → ShadersWGSL}/clearQuad.fragment.d.ts +0 -0
  182. /package/{Shaders → ShadersWGSL}/clearQuad.vertex.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ribbonBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/ribbonBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;;;;;;;;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"../../scene\";\r\nimport type { Vector3, Vector2, Vector4 } from \"../../Maths/math.vector\";\r\nimport { TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { Color4 } from \"../../Maths/math.color\";\r\nimport { Mesh, _CreationDataStorage } from \"../mesh\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a Ribbon\r\n * @param options an object used to set the following optional parameters for the ribbon, required but can be empty\r\n * * pathArray array of paths, each of which an array of successive Vector3\r\n * * closeArray creates a seam between the first and the last paths of the pathArray, optional, default false\r\n * * closePath creates a seam between the first and the last points of each path of the path array, optional, default false\r\n * * offset a positive integer, only used when pathArray contains a single path (offset = 10 means the point 1 is joined to the point 11), default rounded half size of the pathArray length\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * * invertUV swaps in the U and V coordinates when applying a texture, optional, default false\r\n * * uvs a linear array, of length 2 * number of vertices, of custom UV values, optional\r\n * * colors a linear array, of length 4 * number of vertices, of custom color values, optional\r\n * @returns the VertexData of the ribbon\r\n */\r\nexport function CreateRibbonVertexData(options: {\r\n pathArray: Vector3[][];\r\n closeArray?: boolean;\r\n closePath?: boolean;\r\n offset?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n invertUV?: boolean;\r\n uvs?: Vector2[];\r\n colors?: Color4[];\r\n}): VertexData {\r\n let pathArray: Vector3[][] = options.pathArray;\r\n const closeArray: boolean = options.closeArray || false;\r\n const closePath: boolean = options.closePath || false;\r\n const invertUV: boolean = options.invertUV || false;\r\n const defaultOffset: number = Math.floor(pathArray[0].length / 2);\r\n let offset: number = options.offset || defaultOffset;\r\n offset = offset > defaultOffset ? defaultOffset : Math.floor(offset); // offset max allowed : defaultOffset\r\n const sideOrientation: number = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n const customUV = options.uvs;\r\n const customColors = options.colors;\r\n\r\n const positions: number[] = [];\r\n const indices: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: number[] = [];\r\n\r\n const us: number[][] = []; // us[path_id] = [uDist1, uDist2, uDist3 ... ] distances between points on path path_id\r\n const vs: number[][] = []; // vs[i] = [vDist1, vDist2, vDist3, ... ] distances between points i of consecutive paths from pathArray\r\n const uTotalDistance: number[] = []; // uTotalDistance[p] : total distance of path p\r\n const vTotalDistance: number[] = []; // vTotalDistance[i] : total distance between points i of first and last path from pathArray\r\n let minlg: number; // minimal length among all paths from pathArray\r\n const lg: number[] = []; // array of path lengths : nb of vertex per path\r\n const idx: number[] = []; // array of path indexes : index of each path (first vertex) in the total vertex number\r\n let p: number; // path iterator\r\n let i: number; // point iterator\r\n let j: number; // point iterator\r\n\r\n // if single path in pathArray\r\n if (pathArray.length < 2) {\r\n const ar1: Vector3[] = [];\r\n const ar2: Vector3[] = [];\r\n for (i = 0; i < pathArray[0].length - offset; i++) {\r\n ar1.push(pathArray[0][i]);\r\n ar2.push(pathArray[0][i + offset]);\r\n }\r\n pathArray = [ar1, ar2];\r\n }\r\n\r\n // positions and horizontal distances (u)\r\n let idc: number = 0;\r\n const closePathCorr: number = closePath ? 1 : 0; // the final index will be +1 if closePath\r\n let path: Vector3[];\r\n let l: number;\r\n minlg = pathArray[0].length;\r\n let vectlg: number;\r\n let dist: number;\r\n for (p = 0; p < pathArray.length; p++) {\r\n uTotalDistance[p] = 0;\r\n us[p] = [0];\r\n path = pathArray[p];\r\n l = path.length;\r\n minlg = minlg < l ? minlg : l;\r\n\r\n j = 0;\r\n while (j < l) {\r\n positions.push(path[j].x, path[j].y, path[j].z);\r\n if (j > 0) {\r\n vectlg = path[j].subtract(path[j - 1]).length();\r\n dist = vectlg + uTotalDistance[p];\r\n us[p].push(dist);\r\n uTotalDistance[p] = dist;\r\n }\r\n j++;\r\n }\r\n\r\n if (closePath) {\r\n // an extra hidden vertex is added in the \"positions\" array\r\n j--;\r\n positions.push(path[0].x, path[0].y, path[0].z);\r\n vectlg = path[j].subtract(path[0]).length();\r\n dist = vectlg + uTotalDistance[p];\r\n us[p].push(dist);\r\n uTotalDistance[p] = dist;\r\n }\r\n\r\n lg[p] = l + closePathCorr;\r\n idx[p] = idc;\r\n idc += l + closePathCorr;\r\n }\r\n\r\n // vertical distances (v)\r\n let path1: Vector3[];\r\n let path2: Vector3[];\r\n let vertex1: Nullable<Vector3> = null;\r\n let vertex2: Nullable<Vector3> = null;\r\n for (i = 0; i < minlg + closePathCorr; i++) {\r\n vTotalDistance[i] = 0;\r\n vs[i] = [0];\r\n for (p = 0; p < pathArray.length - 1; p++) {\r\n path1 = pathArray[p];\r\n path2 = pathArray[p + 1];\r\n if (i === minlg) {\r\n // closePath\r\n vertex1 = path1[0];\r\n vertex2 = path2[0];\r\n } else {\r\n vertex1 = path1[i];\r\n vertex2 = path2[i];\r\n }\r\n vectlg = vertex2.subtract(vertex1).length();\r\n dist = vectlg + vTotalDistance[i];\r\n vs[i].push(dist);\r\n vTotalDistance[i] = dist;\r\n }\r\n\r\n if (closeArray && vertex2 && vertex1) {\r\n path1 = pathArray[p];\r\n path2 = pathArray[0];\r\n if (i === minlg) {\r\n // closePath\r\n vertex2 = path2[0];\r\n }\r\n vectlg = vertex2.subtract(vertex1).length();\r\n dist = vectlg + vTotalDistance[i];\r\n vTotalDistance[i] = dist;\r\n }\r\n }\r\n\r\n // uvs\r\n let u: number;\r\n let v: number;\r\n if (customUV) {\r\n for (p = 0; p < customUV.length; p++) {\r\n uvs.push(customUV[p].x, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - customUV[p].y : customUV[p].y);\r\n }\r\n } else {\r\n for (p = 0; p < pathArray.length; p++) {\r\n for (i = 0; i < minlg + closePathCorr; i++) {\r\n u = uTotalDistance[p] != 0.0 ? us[p][i] / uTotalDistance[p] : 0.0;\r\n v = vTotalDistance[i] != 0.0 ? vs[i][p] / vTotalDistance[i] : 0.0;\r\n if (invertUV) {\r\n uvs.push(v, u);\r\n } else {\r\n uvs.push(u, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - v : v);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // indices\r\n p = 0; // path index\r\n let pi: number = 0; // positions array index\r\n let l1: number = lg[p] - 1; // path1 length\r\n let l2: number = lg[p + 1] - 1; // path2 length\r\n let min: number = l1 < l2 ? l1 : l2; // current path stop index\r\n let shft: number = idx[1] - idx[0]; // shift\r\n const path1nb: number = closeArray ? lg.length : lg.length - 1; // number of path1 to iterate\ton\r\n\r\n while (pi <= min && p < path1nb) {\r\n // stay under min and don't go over next to last path\r\n // draw two triangles between path1 (p1) and path2 (p2) : (p1.pi, p2.pi, p1.pi+1) and (p2.pi+1, p1.pi+1, p2.pi) clockwise\r\n\r\n indices.push(pi, pi + shft, pi + 1);\r\n indices.push(pi + shft + 1, pi + 1, pi + shft);\r\n pi += 1;\r\n if (pi === min) {\r\n // if end of one of two consecutive paths reached, go to next existing path\r\n p++;\r\n if (p === lg.length - 1) {\r\n // last path of pathArray reached <=> closeArray == true\r\n shft = idx[0] - idx[p];\r\n l1 = lg[p] - 1;\r\n l2 = lg[0] - 1;\r\n } else {\r\n shft = idx[p + 1] - idx[p];\r\n l1 = lg[p] - 1;\r\n l2 = lg[p + 1] - 1;\r\n }\r\n pi = idx[p];\r\n min = l1 < l2 ? l1 + pi : l2 + pi;\r\n }\r\n }\r\n\r\n // normals\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n\r\n if (closePath) {\r\n // update both the first and last vertex normals to their average value\r\n let indexFirst: number = 0;\r\n let indexLast: number = 0;\r\n for (p = 0; p < pathArray.length; p++) {\r\n indexFirst = idx[p] * 3;\r\n if (p + 1 < pathArray.length) {\r\n indexLast = (idx[p + 1] - 1) * 3;\r\n } else {\r\n indexLast = normals.length - 3;\r\n }\r\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\r\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\r\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\r\n normals[indexLast] = normals[indexFirst];\r\n normals[indexLast + 1] = normals[indexFirst + 1];\r\n normals[indexLast + 2] = normals[indexFirst + 2];\r\n }\r\n }\r\n\r\n // sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n\r\n // Colors\r\n let colors: Nullable<Float32Array> = null;\r\n if (customColors) {\r\n colors = new Float32Array(customColors.length * 4);\r\n for (let c = 0; c < customColors.length; c++) {\r\n colors[c * 4] = customColors[c].r;\r\n colors[c * 4 + 1] = customColors[c].g;\r\n colors[c * 4 + 2] = customColors[c].b;\r\n colors[c * 4 + 3] = customColors[c].a;\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n const positions32 = new Float32Array(positions);\r\n const normals32 = new Float32Array(normals);\r\n const uvs32 = new Float32Array(uvs);\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions32;\r\n vertexData.normals = normals32;\r\n vertexData.uvs = uvs32;\r\n if (colors) {\r\n vertexData.set(colors, VertexBuffer.ColorKind);\r\n }\r\n\r\n if (closePath) {\r\n (<any>vertexData)._idx = idx;\r\n }\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a ribbon mesh. The ribbon is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry\r\n * * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array\r\n * * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array\r\n * * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path\r\n * * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11\r\n * * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#ribbon\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The parameter `uvs` is an optional flat array of `Vector2` to update/set each ribbon vertex with its own custom UV values instead of the computed ones\r\n * * The parameters `colors` is an optional flat array of `Color4` to set/update each ribbon vertex with its own custom color values\r\n * * Note that if you use the parameters `uvs` or `colors`, the passed arrays must be populated with the right number of elements, it is to say the number of ribbon vertices. Remember that if you set `closePath` to `true`, there's one extra vertex per path in the geometry\r\n * * Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ribbon mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/ribbon_extra\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n */\r\nexport function CreateRibbon(\r\n name: string,\r\n options: {\r\n pathArray: Vector3[][];\r\n closeArray?: boolean;\r\n closePath?: boolean;\r\n offset?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n uvs?: Vector2[];\r\n colors?: Color4[];\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const pathArray = options.pathArray;\r\n const closeArray = options.closeArray;\r\n const closePath = options.closePath;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n const instance = options.instance;\r\n const updatable = options.updatable;\r\n\r\n if (instance) {\r\n // existing ribbon instance update\r\n // positionFunction : ribbon case\r\n // only pathArray and sideOrientation parameters are taken into account for positions update\r\n const minimum = TmpVectors.Vector3[0].setAll(Number.MAX_VALUE);\r\n const maximum = TmpVectors.Vector3[1].setAll(-Number.MAX_VALUE);\r\n const positionFunction = (positions: FloatArray) => {\r\n let minlg = pathArray[0].length;\r\n const mesh = <Mesh>instance;\r\n let i = 0;\r\n const ns = mesh._originalBuilderSideOrientation === Mesh.DOUBLESIDE ? 2 : 1;\r\n for (let si = 1; si <= ns; ++si) {\r\n for (let p = 0; p < pathArray.length; ++p) {\r\n const path = pathArray[p];\r\n const l = path.length;\r\n minlg = minlg < l ? minlg : l;\r\n for (let j = 0; j < minlg; ++j) {\r\n const pathPoint = path[j];\r\n positions[i] = pathPoint.x;\r\n positions[i + 1] = pathPoint.y;\r\n positions[i + 2] = pathPoint.z;\r\n minimum.minimizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\r\n maximum.maximizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\r\n i += 3;\r\n }\r\n if (mesh._creationDataStorage && mesh._creationDataStorage.closePath) {\r\n const pathPoint = path[0];\r\n positions[i] = pathPoint.x;\r\n positions[i + 1] = pathPoint.y;\r\n positions[i + 2] = pathPoint.z;\r\n i += 3;\r\n }\r\n }\r\n }\r\n };\r\n const positions = <FloatArray>instance.getVerticesData(VertexBuffer.PositionKind);\r\n positionFunction(positions);\r\n if (instance.hasBoundingInfo) {\r\n instance.getBoundingInfo().reConstruct(minimum, maximum, instance._worldMatrix);\r\n } else {\r\n instance.buildBoundingInfo(minimum, maximum, instance._worldMatrix);\r\n }\r\n instance.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\r\n if (options.colors) {\r\n const colors = <FloatArray>instance.getVerticesData(VertexBuffer.ColorKind);\r\n for (let c = 0, colorIndex = 0; c < options.colors.length; c++, colorIndex += 4) {\r\n const color = options.colors[c];\r\n colors[colorIndex] = color.r;\r\n colors[colorIndex + 1] = color.g;\r\n colors[colorIndex + 2] = color.b;\r\n colors[colorIndex + 3] = color.a;\r\n }\r\n instance.updateVerticesData(VertexBuffer.ColorKind, colors, false, false);\r\n }\r\n if (options.uvs) {\r\n const uvs = <FloatArray>instance.getVerticesData(VertexBuffer.UVKind);\r\n for (let i = 0; i < options.uvs.length; i++) {\r\n uvs[i * 2] = options.uvs[i].x;\r\n uvs[i * 2 + 1] = CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - options.uvs[i].y : options.uvs[i].y;\r\n }\r\n instance.updateVerticesData(VertexBuffer.UVKind, uvs, false, false);\r\n }\r\n if (!instance.areNormalsFrozen || instance.isFacetDataEnabled) {\r\n const indices = instance.getIndices();\r\n const normals = <FloatArray>instance.getVerticesData(VertexBuffer.NormalKind);\r\n const params = instance.isFacetDataEnabled ? instance.getFacetDataParameters() : null;\r\n VertexData.ComputeNormals(positions, indices, normals, params);\r\n\r\n if (instance._creationDataStorage && instance._creationDataStorage.closePath) {\r\n let indexFirst: number = 0;\r\n let indexLast: number = 0;\r\n for (let p = 0; p < pathArray.length; p++) {\r\n indexFirst = instance._creationDataStorage!.idx[p] * 3;\r\n if (p + 1 < pathArray.length) {\r\n indexLast = (instance._creationDataStorage!.idx[p + 1] - 1) * 3;\r\n } else {\r\n indexLast = normals.length - 3;\r\n }\r\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\r\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\r\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\r\n normals[indexLast] = normals[indexFirst];\r\n normals[indexLast + 1] = normals[indexFirst + 1];\r\n normals[indexLast + 2] = normals[indexFirst + 2];\r\n }\r\n }\r\n if (!instance.areNormalsFrozen) {\r\n instance.updateVerticesData(VertexBuffer.NormalKind, normals, false, false);\r\n }\r\n }\r\n\r\n return instance;\r\n } else {\r\n // new ribbon creation\r\n\r\n const ribbon = new Mesh(name, scene);\r\n ribbon._originalBuilderSideOrientation = sideOrientation;\r\n ribbon._creationDataStorage = new _CreationDataStorage();\r\n\r\n const vertexData = CreateRibbonVertexData(options);\r\n if (closePath) {\r\n ribbon._creationDataStorage.idx = (<any>vertexData)._idx;\r\n }\r\n ribbon._creationDataStorage.closePath = closePath;\r\n ribbon._creationDataStorage.closeArray = closeArray;\r\n\r\n vertexData.applyToMesh(ribbon, updatable);\r\n\r\n return ribbon;\r\n }\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateRibbon directly\r\n */\r\nexport const RibbonBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateRibbon,\r\n};\r\n\r\nVertexData.CreateRibbon = CreateRibbonVertexData;\r\n\r\nMesh.CreateRibbon = (\r\n name: string,\r\n pathArray: Vector3[][],\r\n closeArray: boolean = false,\r\n closePath: boolean,\r\n offset: number,\r\n scene?: Scene,\r\n updatable: boolean = false,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n) => {\r\n return CreateRibbon(\r\n name,\r\n {\r\n pathArray: pathArray,\r\n closeArray: closeArray,\r\n closePath: closePath,\r\n offset: offset,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n },\r\n scene\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"ribbonBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/ribbonBuilder.ts"],"names":[],"mappings":"AAGA,OAA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,CAAC;AAEjD,IAAI,CAAC,YAAY,GAAG,CAChB,IAAY,EACZ,SAAsB,EACtB,aAAsB,KAAK,EAC3B,SAAkB,EAClB,MAAc,EACd,KAAa,EACb,YAAqB,KAAK,EAC1B,eAAwB,EACxB,QAAe,EACjB,EAAE;IACA,OAAO,YAAY,CACf,IAAI,EACJ;QACI,SAAS,EAAE,SAAS;QACpB,UAAU,EAAE,UAAU;QACtB,SAAS,EAAE,SAAS;QACpB,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,SAAS;QACpB,eAAe,EAAE,eAAe;QAChC,QAAQ,EAAE,QAAQ;KACrB,EACD,KAAK,CACR,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { Nullable, FloatArray } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Vector3, Vector2, Vector4 } from \"../../Maths/math.vector\";\r\nimport { TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { Color4 } from \"../../Maths/math.color\";\r\nimport { Mesh, _CreationDataStorage } from \"../mesh\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a Ribbon\r\n * @param options an object used to set the following optional parameters for the ribbon, required but can be empty\r\n * * pathArray array of paths, each of which an array of successive Vector3\r\n * * closeArray creates a seam between the first and the last paths of the pathArray, optional, default false\r\n * * closePath creates a seam between the first and the last points of each path of the path array, optional, default false\r\n * * offset a positive integer, only used when pathArray contains a single path (offset = 10 means the point 1 is joined to the point 11), default rounded half size of the pathArray length\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * * invertUV swaps in the U and V coordinates when applying a texture, optional, default false\r\n * * uvs a linear array, of length 2 * number of vertices, of custom UV values, optional\r\n * * colors a linear array, of length 4 * number of vertices, of custom color values, optional\r\n * @returns the VertexData of the ribbon\r\n */\r\nexport function CreateRibbonVertexData(options: {\r\n pathArray: Vector3[][];\r\n closeArray?: boolean;\r\n closePath?: boolean;\r\n offset?: number;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n invertUV?: boolean;\r\n uvs?: Vector2[];\r\n colors?: Color4[];\r\n}): VertexData {\r\n let pathArray: Vector3[][] = options.pathArray;\r\n const closeArray: boolean = options.closeArray || false;\r\n const closePath: boolean = options.closePath || false;\r\n const invertUV: boolean = options.invertUV || false;\r\n const defaultOffset: number = Math.floor(pathArray[0].length / 2);\r\n let offset: number = options.offset || defaultOffset;\r\n offset = offset > defaultOffset ? defaultOffset : Math.floor(offset); // offset max allowed : defaultOffset\r\n const sideOrientation: number = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n const customUV = options.uvs;\r\n const customColors = options.colors;\r\n\r\n const positions: number[] = [];\r\n const indices: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: number[] = [];\r\n\r\n const us: number[][] = []; // us[path_id] = [uDist1, uDist2, uDist3 ... ] distances between points on path path_id\r\n const vs: number[][] = []; // vs[i] = [vDist1, vDist2, vDist3, ... ] distances between points i of consecutive paths from pathArray\r\n const uTotalDistance: number[] = []; // uTotalDistance[p] : total distance of path p\r\n const vTotalDistance: number[] = []; // vTotalDistance[i] : total distance between points i of first and last path from pathArray\r\n let minlg: number; // minimal length among all paths from pathArray\r\n const lg: number[] = []; // array of path lengths : nb of vertex per path\r\n const idx: number[] = []; // array of path indexes : index of each path (first vertex) in the total vertex number\r\n let p: number; // path iterator\r\n let i: number; // point iterator\r\n let j: number; // point iterator\r\n\r\n // if single path in pathArray\r\n if (pathArray.length < 2) {\r\n const ar1: Vector3[] = [];\r\n const ar2: Vector3[] = [];\r\n for (i = 0; i < pathArray[0].length - offset; i++) {\r\n ar1.push(pathArray[0][i]);\r\n ar2.push(pathArray[0][i + offset]);\r\n }\r\n pathArray = [ar1, ar2];\r\n }\r\n\r\n // positions and horizontal distances (u)\r\n let idc: number = 0;\r\n const closePathCorr: number = closePath ? 1 : 0; // the final index will be +1 if closePath\r\n const closeArrayCorr: number = closeArray ? 1 : 0;\r\n let path: Vector3[];\r\n let l: number;\r\n minlg = pathArray[0].length;\r\n let vectlg: number;\r\n let dist: number;\r\n for (p = 0; p < pathArray.length + closeArrayCorr; p++) {\r\n uTotalDistance[p] = 0;\r\n us[p] = [0];\r\n path = p === pathArray.length ? pathArray[0] : pathArray[p];\r\n l = path.length;\r\n minlg = minlg < l ? minlg : l;\r\n\r\n j = 0;\r\n while (j < l) {\r\n positions.push(path[j].x, path[j].y, path[j].z);\r\n if (j > 0) {\r\n vectlg = path[j].subtract(path[j - 1]).length();\r\n dist = vectlg + uTotalDistance[p];\r\n us[p].push(dist);\r\n uTotalDistance[p] = dist;\r\n }\r\n j++;\r\n }\r\n\r\n if (closePath) {\r\n // an extra hidden vertex is added in the \"positions\" array\r\n j--;\r\n positions.push(path[0].x, path[0].y, path[0].z);\r\n vectlg = path[j].subtract(path[0]).length();\r\n dist = vectlg + uTotalDistance[p];\r\n us[p].push(dist);\r\n uTotalDistance[p] = dist;\r\n }\r\n\r\n lg[p] = l + closePathCorr;\r\n idx[p] = idc;\r\n idc += l + closePathCorr;\r\n }\r\n\r\n // vertical distances (v)\r\n let path1: Vector3[];\r\n let path2: Vector3[];\r\n let vertex1: Nullable<Vector3> = null;\r\n let vertex2: Nullable<Vector3> = null;\r\n for (i = 0; i < minlg + closePathCorr; i++) {\r\n vTotalDistance[i] = 0;\r\n vs[i] = [0];\r\n for (p = 0; p < pathArray.length - 1 + closeArrayCorr; p++) {\r\n path1 = pathArray[p];\r\n path2 = p === pathArray.length - 1 ? pathArray[0] : pathArray[p + 1];\r\n if (i === minlg) {\r\n // closePath\r\n vertex1 = path1[0];\r\n vertex2 = path2[0];\r\n } else {\r\n vertex1 = path1[i];\r\n vertex2 = path2[i];\r\n }\r\n vectlg = vertex2.subtract(vertex1).length();\r\n dist = vectlg + vTotalDistance[i];\r\n vs[i].push(dist);\r\n vTotalDistance[i] = dist;\r\n }\r\n }\r\n\r\n // uvs\r\n let u: number;\r\n let v: number;\r\n if (customUV) {\r\n for (p = 0; p < customUV.length; p++) {\r\n uvs.push(customUV[p].x, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - customUV[p].y : customUV[p].y);\r\n }\r\n } else {\r\n for (p = 0; p < pathArray.length + closeArrayCorr; p++) {\r\n for (i = 0; i < minlg + closePathCorr; i++) {\r\n u = uTotalDistance[p] != 0.0 ? us[p][i] / uTotalDistance[p] : 0.0;\r\n v = vTotalDistance[i] != 0.0 ? vs[i][p] / vTotalDistance[i] : 0.0;\r\n if (invertUV) {\r\n uvs.push(v, u);\r\n } else {\r\n uvs.push(u, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - v : v);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // indices\r\n p = 0; // path index\r\n let pi: number = 0; // positions array index\r\n let l1: number = lg[p] - 1; // path1 length\r\n let l2: number = lg[p + 1] - 1; // path2 length\r\n let min: number = l1 < l2 ? l1 : l2; // current path stop index\r\n let shft: number = idx[1] - idx[0]; // shift\r\n const path1nb: number = lg.length - 1; // number of path1 to iterate on\r\n\r\n while (pi <= min && p < path1nb) {\r\n // stay under min and don't go over next to last path\r\n // draw two triangles between path1 (p1) and path2 (p2) : (p1.pi, p2.pi, p1.pi+1) and (p2.pi+1, p1.pi+1, p2.pi) clockwise\r\n\r\n indices.push(pi, pi + shft, pi + 1);\r\n indices.push(pi + shft + 1, pi + 1, pi + shft);\r\n pi += 1;\r\n if (pi === min) {\r\n // if end of one of two consecutive paths reached, go to next existing path\r\n p++;\r\n shft = idx[p + 1] - idx[p];\r\n l1 = lg[p] - 1;\r\n l2 = lg[p + 1] - 1;\r\n pi = idx[p];\r\n min = l1 < l2 ? l1 + pi : l2 + pi;\r\n }\r\n }\r\n\r\n // normals\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n\r\n if (closePath) {\r\n // update both the first and last vertex normals to their average value\r\n let indexFirst: number = 0;\r\n let indexLast: number = 0;\r\n for (p = 0; p < pathArray.length; p++) {\r\n indexFirst = idx[p] * 3;\r\n if (p + 1 < pathArray.length) {\r\n indexLast = (idx[p + 1] - 1) * 3;\r\n } else {\r\n indexLast = normals.length - 3;\r\n }\r\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\r\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\r\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\r\n const l = Math.sqrt(normals[indexFirst] * normals[indexFirst] + normals[indexFirst + 1] * normals[indexFirst + 1] + normals[indexFirst + 2] * normals[indexFirst + 2]);\r\n normals[indexFirst] /= l;\r\n normals[indexFirst + 1] /= l;\r\n normals[indexFirst + 2] /= l;\r\n normals[indexLast] = normals[indexFirst];\r\n normals[indexLast + 1] = normals[indexFirst + 1];\r\n normals[indexLast + 2] = normals[indexFirst + 2];\r\n }\r\n }\r\n\r\n if (closeArray) {\r\n let indexFirst = idx[0] * 3;\r\n let indexLast = idx[pathArray.length] * 3;\r\n for (i = 0; i < minlg + closePathCorr; i++) {\r\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\r\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\r\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\r\n const l = Math.sqrt(normals[indexFirst] * normals[indexFirst] + normals[indexFirst + 1] * normals[indexFirst + 1] + normals[indexFirst + 2] * normals[indexFirst + 2]);\r\n normals[indexFirst] /= l;\r\n normals[indexFirst + 1] /= l;\r\n normals[indexFirst + 2] /= l;\r\n normals[indexLast] = normals[indexFirst];\r\n normals[indexLast + 1] = normals[indexFirst + 1];\r\n normals[indexLast + 2] = normals[indexFirst + 2];\r\n indexFirst += 3;\r\n indexLast += 3;\r\n }\r\n }\r\n\r\n // sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n\r\n // Colors\r\n let colors: Nullable<Float32Array> = null;\r\n if (customColors) {\r\n colors = new Float32Array(customColors.length * 4);\r\n for (let c = 0; c < customColors.length; c++) {\r\n colors[c * 4] = customColors[c].r;\r\n colors[c * 4 + 1] = customColors[c].g;\r\n colors[c * 4 + 2] = customColors[c].b;\r\n colors[c * 4 + 3] = customColors[c].a;\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n const positions32 = new Float32Array(positions);\r\n const normals32 = new Float32Array(normals);\r\n const uvs32 = new Float32Array(uvs);\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions32;\r\n vertexData.normals = normals32;\r\n vertexData.uvs = uvs32;\r\n if (colors) {\r\n vertexData.set(colors, VertexBuffer.ColorKind);\r\n }\r\n\r\n if (closePath) {\r\n (<any>vertexData)._idx = idx;\r\n }\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a ribbon mesh. The ribbon is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry\r\n * * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array\r\n * * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array\r\n * * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path\r\n * * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11\r\n * * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#ribbon\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The parameter `uvs` is an optional flat array of `Vector2` to update/set each ribbon vertex with its own custom UV values instead of the computed ones\r\n * * The parameters `colors` is an optional flat array of `Color4` to set/update each ribbon vertex with its own custom color values\r\n * * Note that if you use the parameters `uvs` or `colors`, the passed arrays must be populated with the right number of elements, it is to say the number of ribbon vertices. Remember that if you set `closePath` to `true`, there's one extra vertex per path in the geometry\r\n * * Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the ribbon mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/ribbon_extra\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n */\r\nexport function CreateRibbon(\r\n name: string,\r\n options: {\r\n pathArray: Vector3[][];\r\n closeArray?: boolean;\r\n closePath?: boolean;\r\n offset?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n uvs?: Vector2[];\r\n colors?: Color4[];\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const pathArray = options.pathArray;\r\n const closeArray = options.closeArray;\r\n const closePath = options.closePath;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n const instance = options.instance;\r\n const updatable = options.updatable;\r\n\r\n if (instance) {\r\n // existing ribbon instance update\r\n // positionFunction : ribbon case\r\n // only pathArray and sideOrientation parameters are taken into account for positions update\r\n const minimum = TmpVectors.Vector3[0].setAll(Number.MAX_VALUE);\r\n const maximum = TmpVectors.Vector3[1].setAll(-Number.MAX_VALUE);\r\n const positionFunction = (positions: FloatArray) => {\r\n let minlg = pathArray[0].length;\r\n const mesh = <Mesh>instance;\r\n let i = 0;\r\n const ns = mesh._originalBuilderSideOrientation === Mesh.DOUBLESIDE ? 2 : 1;\r\n for (let si = 1; si <= ns; ++si) {\r\n for (let p = 0; p < pathArray.length; ++p) {\r\n const path = pathArray[p];\r\n const l = path.length;\r\n minlg = minlg < l ? minlg : l;\r\n for (let j = 0; j < minlg; ++j) {\r\n const pathPoint = path[j];\r\n positions[i] = pathPoint.x;\r\n positions[i + 1] = pathPoint.y;\r\n positions[i + 2] = pathPoint.z;\r\n minimum.minimizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\r\n maximum.maximizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\r\n i += 3;\r\n }\r\n if (mesh._creationDataStorage && mesh._creationDataStorage.closePath) {\r\n const pathPoint = path[0];\r\n positions[i] = pathPoint.x;\r\n positions[i + 1] = pathPoint.y;\r\n positions[i + 2] = pathPoint.z;\r\n i += 3;\r\n }\r\n }\r\n }\r\n };\r\n const positions = <FloatArray>instance.getVerticesData(VertexBuffer.PositionKind);\r\n positionFunction(positions);\r\n if (instance.hasBoundingInfo) {\r\n instance.getBoundingInfo().reConstruct(minimum, maximum, instance._worldMatrix);\r\n } else {\r\n instance.buildBoundingInfo(minimum, maximum, instance._worldMatrix);\r\n }\r\n instance.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\r\n if (options.colors) {\r\n const colors = <FloatArray>instance.getVerticesData(VertexBuffer.ColorKind);\r\n for (let c = 0, colorIndex = 0; c < options.colors.length; c++, colorIndex += 4) {\r\n const color = options.colors[c];\r\n colors[colorIndex] = color.r;\r\n colors[colorIndex + 1] = color.g;\r\n colors[colorIndex + 2] = color.b;\r\n colors[colorIndex + 3] = color.a;\r\n }\r\n instance.updateVerticesData(VertexBuffer.ColorKind, colors, false, false);\r\n }\r\n if (options.uvs) {\r\n const uvs = <FloatArray>instance.getVerticesData(VertexBuffer.UVKind);\r\n for (let i = 0; i < options.uvs.length; i++) {\r\n uvs[i * 2] = options.uvs[i].x;\r\n uvs[i * 2 + 1] = CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - options.uvs[i].y : options.uvs[i].y;\r\n }\r\n instance.updateVerticesData(VertexBuffer.UVKind, uvs, false, false);\r\n }\r\n if (!instance.areNormalsFrozen || instance.isFacetDataEnabled) {\r\n const indices = instance.getIndices();\r\n const normals = <FloatArray>instance.getVerticesData(VertexBuffer.NormalKind);\r\n const params = instance.isFacetDataEnabled ? instance.getFacetDataParameters() : null;\r\n VertexData.ComputeNormals(positions, indices, normals, params);\r\n\r\n if (instance._creationDataStorage && instance._creationDataStorage.closePath) {\r\n let indexFirst: number = 0;\r\n let indexLast: number = 0;\r\n for (let p = 0; p < pathArray.length; p++) {\r\n indexFirst = instance._creationDataStorage!.idx[p] * 3;\r\n if (p + 1 < pathArray.length) {\r\n indexLast = (instance._creationDataStorage!.idx[p + 1] - 1) * 3;\r\n } else {\r\n indexLast = normals.length - 3;\r\n }\r\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\r\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\r\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\r\n normals[indexLast] = normals[indexFirst];\r\n normals[indexLast + 1] = normals[indexFirst + 1];\r\n normals[indexLast + 2] = normals[indexFirst + 2];\r\n }\r\n }\r\n if (!instance.areNormalsFrozen) {\r\n instance.updateVerticesData(VertexBuffer.NormalKind, normals, false, false);\r\n }\r\n }\r\n\r\n return instance;\r\n } else {\r\n // new ribbon creation\r\n\r\n const ribbon = new Mesh(name, scene);\r\n ribbon._originalBuilderSideOrientation = sideOrientation;\r\n ribbon._creationDataStorage = new _CreationDataStorage();\r\n\r\n const vertexData = CreateRibbonVertexData(options);\r\n if (closePath) {\r\n ribbon._creationDataStorage.idx = (<any>vertexData)._idx;\r\n }\r\n ribbon._creationDataStorage.closePath = closePath;\r\n ribbon._creationDataStorage.closeArray = closeArray;\r\n\r\n vertexData.applyToMesh(ribbon, updatable);\r\n\r\n return ribbon;\r\n }\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateRibbon directly\r\n */\r\nexport const RibbonBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateRibbon,\r\n};\r\n\r\nVertexData.CreateRibbon = CreateRibbonVertexData;\r\n\r\nMesh.CreateRibbon = (\r\n name: string,\r\n pathArray: Vector3[][],\r\n closeArray: boolean = false,\r\n closePath: boolean,\r\n offset: number,\r\n scene?: Scene,\r\n updatable: boolean = false,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n) => {\r\n return CreateRibbon(\r\n name,\r\n {\r\n pathArray: pathArray,\r\n closeArray: closeArray,\r\n closePath: closePath,\r\n offset: offset,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n },\r\n scene\r\n );\r\n};\r\n"]}
@@ -5,6 +5,7 @@ import { Buffer } from "../../Buffers/buffer";
5
5
  import type { Vector3 } from "../../Maths/math.vector";
6
6
  import { VertexData } from "../mesh.vertexData";
7
7
  import type { Engine } from "../../Engines/engine";
8
+ import type { FloatArray, IndicesArray } from "../../types";
8
9
  /**
9
10
  * In POINTS_MODE_POINTS every array of points will become the center (backbone) of the ribbon. The ribbon will be expanded by `width / 2` to `+direction` and `-direction` as well.
10
11
  * In POINTS_MODE_PATHS every array of points specifies an edge. These will be used to build one ribbon.
@@ -28,12 +29,14 @@ export declare enum GreasedLineRibbonFacesMode {
28
29
  * AUTO_DIRECTIONS_FROM_FIRST_SEGMENT sets the direction (slope) of the ribbon from the direction of the first line segment. Recommended.
29
30
  * AUTO_DIRECTIONS_FROM_ALL_SEGMENTS in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments. Slow method.
30
31
  * AUTO_DIRECTIONS_ENHANCED in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments using a more sophisitcaed algorithm. Slowest method.
32
+ * AUTO_DIRECTIONS_FACE_TO in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments and a direction (face-to) vector specified in direction. The resulting line will face to the direction of this face-to vector.
31
33
  * AUTO_DIRECTIONS_NONE you have to set the direction (slope) manually. Recommended.
32
34
  */
33
35
  export declare enum GreasedLineRibbonAutoDirectionMode {
34
36
  AUTO_DIRECTIONS_FROM_FIRST_SEGMENT = 0,
35
37
  AUTO_DIRECTIONS_FROM_ALL_SEGMENTS = 1,
36
38
  AUTO_DIRECTIONS_ENHANCED = 2,
39
+ AUTO_DIRECTIONS_FACE_TO = 3,
37
40
  AUTO_DIRECTIONS_NONE = 99
38
41
  }
39
42
  export type GreasedLineRibbonOptions = {
@@ -82,7 +85,7 @@ export interface GreasedLineMeshOptions {
82
85
  */
83
86
  points: GreasedLinePoints;
84
87
  /**
85
- * Each line segmment (from point to point) can have it's width multiplier. Final width = widths[segmentIdx] * width.
88
+ * Each line segment (from point to point) can have it's width multiplier. Final width = widths[segmentIdx] * width.
86
89
  * Defaults to empty array.
87
90
  */
88
91
  widths?: number[];
@@ -99,7 +102,7 @@ export interface GreasedLineMeshOptions {
99
102
  /**
100
103
  * UVs for the mesh
101
104
  */
102
- uvs?: number[];
105
+ uvs?: FloatArray;
103
106
  /**
104
107
  * If true, offsets and widths are updatable.
105
108
  * Defaults to false.
@@ -123,9 +126,9 @@ export interface GreasedLineMeshOptions {
123
126
  export declare abstract class GreasedLineBaseMesh extends Mesh {
124
127
  readonly name: string;
125
128
  protected _options: GreasedLineMeshOptions;
126
- protected _vertexPositions: number[];
127
- protected _indices: number[];
128
- protected _uvs: number[];
129
+ protected _vertexPositions: FloatArray;
130
+ protected _indices: IndicesArray;
131
+ protected _uvs: FloatArray;
129
132
  protected _points: number[][];
130
133
  protected _offsets: number[];
131
134
  protected _colorPointers: number[];
@@ -163,11 +166,20 @@ export declare abstract class GreasedLineBaseMesh extends Mesh {
163
166
  */
164
167
  dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void;
165
168
  /**
166
- *
167
169
  * @returns true if the mesh was created in lazy mode
168
170
  */
169
171
  isLazy(): boolean;
170
172
  /**
173
+ * Returns the UVs
174
+ */
175
+ get uvs(): FloatArray;
176
+ /**
177
+ * Sets the UVs
178
+ * @param uvs the UVs
179
+ */
180
+ set uvs(uvs: FloatArray);
181
+ /**
182
+ * Returns the points offsets
171
183
  * Return the points offsets
172
184
  */
173
185
  get offsets(): number[];
@@ -29,6 +29,7 @@ export var GreasedLineRibbonFacesMode;
29
29
  * AUTO_DIRECTIONS_FROM_FIRST_SEGMENT sets the direction (slope) of the ribbon from the direction of the first line segment. Recommended.
30
30
  * AUTO_DIRECTIONS_FROM_ALL_SEGMENTS in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments. Slow method.
31
31
  * AUTO_DIRECTIONS_ENHANCED in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments using a more sophisitcaed algorithm. Slowest method.
32
+ * AUTO_DIRECTIONS_FACE_TO in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments and a direction (face-to) vector specified in direction. The resulting line will face to the direction of this face-to vector.
32
33
  * AUTO_DIRECTIONS_NONE you have to set the direction (slope) manually. Recommended.
33
34
  */
34
35
  export var GreasedLineRibbonAutoDirectionMode;
@@ -36,6 +37,7 @@ export var GreasedLineRibbonAutoDirectionMode;
36
37
  GreasedLineRibbonAutoDirectionMode[GreasedLineRibbonAutoDirectionMode["AUTO_DIRECTIONS_FROM_FIRST_SEGMENT"] = 0] = "AUTO_DIRECTIONS_FROM_FIRST_SEGMENT";
37
38
  GreasedLineRibbonAutoDirectionMode[GreasedLineRibbonAutoDirectionMode["AUTO_DIRECTIONS_FROM_ALL_SEGMENTS"] = 1] = "AUTO_DIRECTIONS_FROM_ALL_SEGMENTS";
38
39
  GreasedLineRibbonAutoDirectionMode[GreasedLineRibbonAutoDirectionMode["AUTO_DIRECTIONS_ENHANCED"] = 2] = "AUTO_DIRECTIONS_ENHANCED";
40
+ GreasedLineRibbonAutoDirectionMode[GreasedLineRibbonAutoDirectionMode["AUTO_DIRECTIONS_FACE_TO"] = 3] = "AUTO_DIRECTIONS_FACE_TO";
39
41
  GreasedLineRibbonAutoDirectionMode[GreasedLineRibbonAutoDirectionMode["AUTO_DIRECTIONS_NONE"] = 99] = "AUTO_DIRECTIONS_NONE";
40
42
  })(GreasedLineRibbonAutoDirectionMode || (GreasedLineRibbonAutoDirectionMode = {}));
41
43
  /**
@@ -109,13 +111,27 @@ export class GreasedLineBaseMesh extends Mesh {
109
111
  super.dispose(doNotRecurse, disposeMaterialAndTextures);
110
112
  }
111
113
  /**
112
- *
113
114
  * @returns true if the mesh was created in lazy mode
114
115
  */
115
116
  isLazy() {
116
117
  return this._lazy;
117
118
  }
118
119
  /**
120
+ * Returns the UVs
121
+ */
122
+ get uvs() {
123
+ return this._uvs;
124
+ }
125
+ /**
126
+ * Sets the UVs
127
+ * @param uvs the UVs
128
+ */
129
+ set uvs(uvs) {
130
+ this._uvs = uvs instanceof Float32Array ? uvs : new Float32Array(uvs);
131
+ this._createVertexBuffers();
132
+ }
133
+ /**
134
+ * Returns the points offsets
119
135
  * Return the points offsets
120
136
  */
121
137
  get offsets() {
@@ -1 +1 @@
1
- {"version":3,"file":"greasedLineBaseMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineBaseMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,M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;IAES,oBAAoB,CAAC,OAAiB;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QAEvC,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7E,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { IGreasedLineMaterial } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineSimpleMaterial } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport type { Engine } from \"../../Engines/engine\";\r\n\r\n/**\r\n * In POINTS_MODE_POINTS every array of points will become the center (backbone) of the ribbon. The ribbon will be expanded by `width / 2` to `+direction` and `-direction` as well.\r\n * In POINTS_MODE_PATHS every array of points specifies an edge. These will be used to build one ribbon.\r\n */\r\nexport enum GreasedLineRibbonPointsMode {\r\n POINTS_MODE_POINTS = 0,\r\n POINTS_MODE_PATHS = 1,\r\n}\r\n\r\n/**\r\n * FACES_MODE_SINGLE_SIDED single sided with back face culling. Default value.\r\n * FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING single sided without back face culling. Sets backFaceCulling = false on the material so it affects all line ribbons added to the line ribbon instance.\r\n * FACES_MODE_DOUBLE_SIDED extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\nexport enum GreasedLineRibbonFacesMode {\r\n FACES_MODE_SINGLE_SIDED = 0,\r\n FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = 1,\r\n FACES_MODE_DOUBLE_SIDED = 2,\r\n}\r\n\r\n/**\r\n * Only with POINTS_MODE_PATHS.\r\n * AUTO_DIRECTIONS_FROM_FIRST_SEGMENT sets the direction (slope) of the ribbon from the direction of the first line segment. Recommended.\r\n * AUTO_DIRECTIONS_FROM_ALL_SEGMENTS in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments. Slow method.\r\n * AUTO_DIRECTIONS_ENHANCED in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments using a more sophisitcaed algorithm. Slowest method.\r\n * AUTO_DIRECTIONS_NONE you have to set the direction (slope) manually. Recommended.\r\n */\r\nexport enum GreasedLineRibbonAutoDirectionMode {\r\n AUTO_DIRECTIONS_FROM_FIRST_SEGMENT = 0,\r\n AUTO_DIRECTIONS_FROM_ALL_SEGMENTS = 1,\r\n AUTO_DIRECTIONS_ENHANCED = 2,\r\n AUTO_DIRECTIONS_NONE = 99,\r\n}\r\n\r\nexport type GreasedLineRibbonOptions = {\r\n /**\r\n * Defines how the points are processed.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_POINTS every array of points will become the center of the ribbon. The ribbon will be expanded by width/2 to +direction and -direction as well.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_PATHS every array of points is one path. These will be used to buuid one ribbon.\r\n */\r\n pointsMode?: GreasedLineRibbonPointsMode;\r\n /**\r\n * Normalized directions of the slopes of the non camera facing lines.\r\n */\r\n directions?: Vector3[] | Vector3;\r\n /**\r\n * Defines the calculation mode of the directions which the line will be thickened to.\r\n */\r\n directionsAutoMode?: GreasedLineRibbonAutoDirectionMode;\r\n /**\r\n * Width of the ribbon.\r\n */\r\n width?: number;\r\n /**\r\n * Controls how the faces are created.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED = single sided with back face culling. Default value.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = single sided without back face culling\r\n * GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED = extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\n facesMode?: GreasedLineRibbonFacesMode;\r\n /**\r\n * If true, the path will be closed.\r\n */\r\n closePath?: boolean;\r\n /**\r\n * If true, normals will be computed when creating the vertex buffers.\r\n * This results to smooth shading of the mesh.\r\n */\r\n smoothShading?: boolean;\r\n};\r\n\r\nexport type GreasedLinePoints = Vector3[] | Vector3[][] | Float32Array | Float32Array[] | number[][] | number[];\r\n\r\n/**\r\n * Options for creating a GreasedLineMesh\r\n */\r\nexport interface GreasedLineMeshOptions {\r\n /**\r\n * Points of the line.\r\n */\r\n points: GreasedLinePoints;\r\n /**\r\n * Each line segmment (from point to point) can have it's width multiplier. Final width = widths[segmentIdx] * width.\r\n * Defaults to empty array.\r\n */\r\n widths?: number[];\r\n /**\r\n * If instance is specified, lines are added to the specified instance.\r\n * Defaults to undefined.\r\n */\r\n instance?: GreasedLineBaseMesh;\r\n /**\r\n * You can manually set the color pointers so you can control which segment/part\r\n * will use which color from the colors material option\r\n */\r\n colorPointers?: number[];\r\n /**\r\n * UVs for the mesh\r\n */\r\n uvs?: number[];\r\n /**\r\n * If true, offsets and widths are updatable.\r\n * Defaults to false.\r\n */\r\n updatable?: boolean;\r\n /**\r\n * Use when @see instance is specified.\r\n * If true, the line will be rendered only after calling instance.updateLazy(). If false, line will be rerendered after every call to @see CreateGreasedLine\r\n * Defaults to false.\r\n */\r\n lazy?: boolean;\r\n /**\r\n * The options for the ribbon which will be used as a line.\r\n * If this option is set the line switches automatically to a non camera facing mode.\r\n */\r\n ribbonOptions?: GreasedLineRibbonOptions;\r\n}\r\n\r\n/**\r\n * GreasedLineBaseMesh\r\n */\r\nexport abstract class GreasedLineBaseMesh extends Mesh {\r\n protected _vertexPositions: number[];\r\n protected _indices: number[];\r\n protected _uvs: number[];\r\n protected _points: number[][];\r\n protected _offsets: number[];\r\n protected _colorPointers: number[];\r\n protected _widths: number[];\r\n\r\n protected _offsetsBuffer?: Buffer;\r\n protected _widthsBuffer?: Buffer;\r\n protected _colorPointersBuffer?: Buffer;\r\n\r\n protected _lazy = false;\r\n protected _updatable = false;\r\n\r\n protected _engine: Engine;\r\n\r\n constructor(\r\n public readonly name: string,\r\n scene: Scene,\r\n protected _options: GreasedLineMeshOptions\r\n ) {\r\n super(name, scene, null, null, false, false);\r\n\r\n this._engine = scene.getEngine();\r\n\r\n this._lazy = _options.lazy ?? false;\r\n this._updatable = _options.updatable ?? false;\r\n\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n this._points = [];\r\n this._colorPointers = _options.colorPointers ?? [];\r\n this._widths = _options.widths ?? new Array(_options.points.length).fill(1);\r\n }\r\n\r\n /**\r\n * \"GreasedLineMesh\"\r\n * @returns \"GreasedLineMesh\"\r\n */\r\n public getClassName(): string {\r\n return \"GreasedLineMesh\";\r\n }\r\n\r\n protected abstract _setPoints(points: number[][], options?: GreasedLineMeshOptions): void;\r\n protected abstract _updateColorPointers(): void;\r\n protected abstract _updateWidths(): void;\r\n\r\n protected _updateWidthsWithValue(defaulValue: number) {\r\n let pointCount = 0;\r\n for (const points of this._points) {\r\n pointCount += points.length;\r\n }\r\n const countDiff = (pointCount / 3) * 2 - this._widths.length;\r\n for (let i = 0; i < countDiff; i++) {\r\n this._widths.push(defaulValue);\r\n }\r\n }\r\n\r\n /**\r\n * Updated a lazy line. Rerenders the line and updates boundinfo as well.\r\n */\r\n public updateLazy() {\r\n this._setPoints(this._points);\r\n if (!this._options.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n this.refreshBoundingInfo();\r\n\r\n this.greasedLineMaterial?.updateLazy();\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 optional options\r\n */\r\n public addPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n for (const p of points) {\r\n this._points.push(p);\r\n }\r\n\r\n if (!this._lazy) {\r\n this.setPoints(this._points, options);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the line and it's resources\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n public dispose(doNotRecurse?: boolean, disposeMaterialAndTextures = false) {\r\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\r\n }\r\n\r\n /**\r\n *\r\n * @returns true if the mesh was created in lazy mode\r\n */\r\n public isLazy(): boolean {\r\n return this._lazy;\r\n }\r\n\r\n /**\r\n * Return the points offsets\r\n */\r\n get offsets() {\r\n return this._offsets;\r\n }\r\n\r\n /**\r\n * Sets point offests\r\n * @param offsets offset table [x,y,z, x,y,z, ....]\r\n */\r\n set offsets(offsets: number[]) {\r\n this._offsets = offsets;\r\n if (!this._offsetsBuffer) {\r\n this._createOffsetsBuffer(offsets);\r\n } else {\r\n this._offsetsBuffer.update(offsets);\r\n }\r\n }\r\n\r\n /**\r\n * Gets widths at each line point like [widthLower, widthUpper, widthLower, widthUpper, ...]\r\n */\r\n get widths() {\r\n return this._widths;\r\n }\r\n\r\n /**\r\n * Sets widths at each line point\r\n * @param widths width table [widthLower, widthUpper, widthLower, widthUpper ...]\r\n */\r\n set widths(widths: number[]) {\r\n this._widths = widths;\r\n if (!this._lazy) {\r\n this._widthsBuffer && this._widthsBuffer.update(widths);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the color pointer. Each vertex need a color pointer. These color pointers points to the colors in the color table @see colors\r\n */\r\n get colorPointers() {\r\n return this._colorPointers;\r\n }\r\n\r\n /**\r\n * Sets the color pointer\r\n * @param colorPointers array of color pointer in the colors array. One pointer for every vertex is needed.\r\n */\r\n set colorPointers(colorPointers: number[]) {\r\n this._colorPointers = colorPointers;\r\n if (!this._lazy) {\r\n this._colorPointersBuffer && this._colorPointersBuffer.update(colorPointers);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the pluginMaterial associated with line\r\n */\r\n get greasedLineMaterial(): IGreasedLineMaterial | undefined {\r\n if (this.material && this.material instanceof GreasedLineSimpleMaterial) {\r\n return this.material;\r\n }\r\n const materialPlugin = this.material?.pluginManager?.getPlugin(GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME);\r\n if (materialPlugin) {\r\n return <GreasedLinePluginMaterial>materialPlugin;\r\n }\r\n return;\r\n }\r\n\r\n /**\r\n * Return copy the points.\r\n */\r\n get points() {\r\n const pointsCopy: number[][] = [];\r\n DeepCopier.DeepCopy(this._points, pointsCopy);\r\n return pointsCopy;\r\n }\r\n\r\n /**\r\n * Sets line points and rerenders the line.\r\n * @param points points table\r\n * @param options optional options\r\n */\r\n public setPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n this._points = points;\r\n this._updateWidths();\r\n if (!options?.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._setPoints(points, options);\r\n }\r\n\r\n protected _initGreasedLine() {\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n }\r\n\r\n protected _createLineOptions() {\r\n const lineOptions: GreasedLineMeshOptions = {\r\n points: this._points,\r\n colorPointers: this._colorPointers,\r\n lazy: this._lazy,\r\n updatable: this._updatable,\r\n uvs: this._uvs,\r\n widths: this._widths,\r\n ribbonOptions: this._options.ribbonOptions,\r\n };\r\n return lineOptions;\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 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 protected _createVertexBuffers(computeNormals = false) {\r\n const vertexData = new VertexData();\r\n vertexData.positions = this._vertexPositions;\r\n vertexData.indices = this._indices;\r\n vertexData.uvs = this._uvs;\r\n if (computeNormals) {\r\n vertexData.normals = [];\r\n VertexData.ComputeNormals(this._vertexPositions, this._indices, vertexData.normals);\r\n }\r\n vertexData.applyToMesh(this, this._options.updatable);\r\n return vertexData;\r\n }\r\n\r\n protected _createOffsetsBuffer(offsets: number[]) {\r\n const engine = this._scene.getEngine();\r\n\r\n const offsetBuffer = new Buffer(engine, offsets, this._updatable, 3);\r\n this.setVerticesBuffer(offsetBuffer.createVertexBuffer(\"grl_offsets\", 0, 3));\r\n this._offsetsBuffer = offsetBuffer;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"greasedLineBaseMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineBaseMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAIlG;;;GAGG;AACH,MAAM,CAAN,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACnC,yGAAsB,CAAA;IACtB,uGAAqB,CAAA;AACzB,CAAC,EAHW,2BAA2B,KAA3B,2BAA2B,QAGtC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,iHAA2B,CAAA;IAC3B,yJAA+C,CAAA;IAC/C,iHAA2B,CAAA;AAC/B,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAED;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,kCAMX;AAND,WAAY,kCAAkC;IAC1C,uJAAsC,CAAA;IACtC,qJAAqC,CAA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\";\r\nimport type { IGreasedLineMaterial } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineSimpleMaterial } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport type { Engine } from \"../../Engines/engine\";\r\nimport type { FloatArray, IndicesArray } from \"../../types\";\r\n\r\n/**\r\n * In POINTS_MODE_POINTS every array of points will become the center (backbone) of the ribbon. The ribbon will be expanded by `width / 2` to `+direction` and `-direction` as well.\r\n * In POINTS_MODE_PATHS every array of points specifies an edge. These will be used to build one ribbon.\r\n */\r\nexport enum GreasedLineRibbonPointsMode {\r\n POINTS_MODE_POINTS = 0,\r\n POINTS_MODE_PATHS = 1,\r\n}\r\n\r\n/**\r\n * FACES_MODE_SINGLE_SIDED single sided with back face culling. Default value.\r\n * FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING single sided without back face culling. Sets backFaceCulling = false on the material so it affects all line ribbons added to the line ribbon instance.\r\n * FACES_MODE_DOUBLE_SIDED extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\nexport enum GreasedLineRibbonFacesMode {\r\n FACES_MODE_SINGLE_SIDED = 0,\r\n FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = 1,\r\n FACES_MODE_DOUBLE_SIDED = 2,\r\n}\r\n\r\n/**\r\n * Only with POINTS_MODE_PATHS.\r\n * AUTO_DIRECTIONS_FROM_FIRST_SEGMENT sets the direction (slope) of the ribbon from the direction of the first line segment. Recommended.\r\n * AUTO_DIRECTIONS_FROM_ALL_SEGMENTS in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments. Slow method.\r\n * AUTO_DIRECTIONS_ENHANCED in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments using a more sophisitcaed algorithm. Slowest method.\r\n * AUTO_DIRECTIONS_FACE_TO in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments and a direction (face-to) vector specified in direction. The resulting line will face to the direction of this face-to vector.\r\n * AUTO_DIRECTIONS_NONE you have to set the direction (slope) manually. Recommended.\r\n */\r\nexport enum GreasedLineRibbonAutoDirectionMode {\r\n AUTO_DIRECTIONS_FROM_FIRST_SEGMENT = 0,\r\n AUTO_DIRECTIONS_FROM_ALL_SEGMENTS = 1,\r\n AUTO_DIRECTIONS_ENHANCED = 2,\r\n AUTO_DIRECTIONS_FACE_TO = 3,\r\n AUTO_DIRECTIONS_NONE = 99,\r\n}\r\n\r\nexport type GreasedLineRibbonOptions = {\r\n /**\r\n * Defines how the points are processed.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_POINTS every array of points will become the center of the ribbon. The ribbon will be expanded by width/2 to +direction and -direction as well.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_PATHS every array of points is one path. These will be used to buuid one ribbon.\r\n */\r\n pointsMode?: GreasedLineRibbonPointsMode;\r\n /**\r\n * Normalized directions of the slopes of the non camera facing lines.\r\n */\r\n directions?: Vector3[] | Vector3;\r\n /**\r\n * Defines the calculation mode of the directions which the line will be thickened to.\r\n */\r\n directionsAutoMode?: GreasedLineRibbonAutoDirectionMode;\r\n /**\r\n * Width of the ribbon.\r\n */\r\n width?: number;\r\n /**\r\n * Controls how the faces are created.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED = single sided with back face culling. Default value.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = single sided without back face culling\r\n * GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED = extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\n facesMode?: GreasedLineRibbonFacesMode;\r\n /**\r\n * If true, the path will be closed.\r\n */\r\n closePath?: boolean;\r\n /**\r\n * If true, normals will be computed when creating the vertex buffers.\r\n * This results to smooth shading of the mesh.\r\n */\r\n smoothShading?: boolean;\r\n};\r\n\r\nexport type GreasedLinePoints = Vector3[] | Vector3[][] | Float32Array | Float32Array[] | number[][] | number[];\r\n\r\n/**\r\n * Options for creating a GreasedLineMesh\r\n */\r\nexport interface GreasedLineMeshOptions {\r\n /**\r\n * Points of the line.\r\n */\r\n points: GreasedLinePoints;\r\n /**\r\n * Each line segment (from point to point) can have it's width multiplier. Final width = widths[segmentIdx] * width.\r\n * Defaults to empty array.\r\n */\r\n widths?: number[];\r\n /**\r\n * If instance is specified, lines are added to the specified instance.\r\n * Defaults to undefined.\r\n */\r\n instance?: GreasedLineBaseMesh;\r\n /**\r\n * You can manually set the color pointers so you can control which segment/part\r\n * will use which color from the colors material option\r\n */\r\n colorPointers?: number[];\r\n /**\r\n * UVs for the mesh\r\n */\r\n uvs?: FloatArray;\r\n /**\r\n * If true, offsets and widths are updatable.\r\n * Defaults to false.\r\n */\r\n updatable?: boolean;\r\n /**\r\n * Use when @see instance is specified.\r\n * If true, the line will be rendered only after calling instance.updateLazy(). If false, line will be rerendered after every call to @see CreateGreasedLine\r\n * Defaults to false.\r\n */\r\n lazy?: boolean;\r\n /**\r\n * The options for the ribbon which will be used as a line.\r\n * If this option is set the line switches automatically to a non camera facing mode.\r\n */\r\n ribbonOptions?: GreasedLineRibbonOptions;\r\n}\r\n\r\n/**\r\n * GreasedLineBaseMesh\r\n */\r\nexport abstract class GreasedLineBaseMesh extends Mesh {\r\n protected _vertexPositions: FloatArray;\r\n protected _indices: IndicesArray;\r\n protected _uvs: FloatArray;\r\n protected _points: number[][];\r\n protected _offsets: number[];\r\n protected _colorPointers: number[];\r\n protected _widths: number[];\r\n\r\n protected _offsetsBuffer?: Buffer;\r\n protected _widthsBuffer?: Buffer;\r\n protected _colorPointersBuffer?: Buffer;\r\n\r\n protected _lazy = false;\r\n protected _updatable = false;\r\n\r\n protected _engine: Engine;\r\n\r\n constructor(\r\n public readonly name: string,\r\n scene: Scene,\r\n protected _options: GreasedLineMeshOptions\r\n ) {\r\n super(name, scene, null, null, false, false);\r\n\r\n this._engine = scene.getEngine();\r\n\r\n this._lazy = _options.lazy ?? false;\r\n this._updatable = _options.updatable ?? false;\r\n\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n this._points = [];\r\n this._colorPointers = _options.colorPointers ?? [];\r\n this._widths = _options.widths ?? new Array(_options.points.length).fill(1);\r\n }\r\n\r\n /**\r\n * \"GreasedLineMesh\"\r\n * @returns \"GreasedLineMesh\"\r\n */\r\n public getClassName(): string {\r\n return \"GreasedLineMesh\";\r\n }\r\n\r\n protected abstract _setPoints(points: number[][], options?: GreasedLineMeshOptions): void;\r\n protected abstract _updateColorPointers(): void;\r\n protected abstract _updateWidths(): void;\r\n\r\n protected _updateWidthsWithValue(defaulValue: number) {\r\n let pointCount = 0;\r\n for (const points of this._points) {\r\n pointCount += points.length;\r\n }\r\n const countDiff = (pointCount / 3) * 2 - this._widths.length;\r\n for (let i = 0; i < countDiff; i++) {\r\n this._widths.push(defaulValue);\r\n }\r\n }\r\n\r\n /**\r\n * Updated a lazy line. Rerenders the line and updates boundinfo as well.\r\n */\r\n public updateLazy() {\r\n this._setPoints(this._points);\r\n if (!this._options.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n this.refreshBoundingInfo();\r\n\r\n this.greasedLineMaterial?.updateLazy();\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 optional options\r\n */\r\n public addPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n for (const p of points) {\r\n this._points.push(p);\r\n }\r\n\r\n if (!this._lazy) {\r\n this.setPoints(this._points, options);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the line and it's resources\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n public dispose(doNotRecurse?: boolean, disposeMaterialAndTextures = false) {\r\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\r\n }\r\n\r\n /**\r\n * @returns true if the mesh was created in lazy mode\r\n */\r\n public isLazy(): boolean {\r\n return this._lazy;\r\n }\r\n\r\n /**\r\n * Returns the UVs\r\n */\r\n get uvs() {\r\n return this._uvs;\r\n }\r\n\r\n /**\r\n * Sets the UVs\r\n * @param uvs the UVs\r\n */\r\n set uvs(uvs: FloatArray) {\r\n this._uvs = uvs instanceof Float32Array ? uvs : new Float32Array(uvs);\r\n this._createVertexBuffers();\r\n }\r\n\r\n /**\r\n * Returns the points offsets\r\n * Return the points offsets\r\n */\r\n get offsets() {\r\n return this._offsets;\r\n }\r\n\r\n /**\r\n * Sets point offests\r\n * @param offsets offset table [x,y,z, x,y,z, ....]\r\n */\r\n set offsets(offsets: number[]) {\r\n this._offsets = offsets;\r\n if (!this._offsetsBuffer) {\r\n this._createOffsetsBuffer(offsets);\r\n } else {\r\n this._offsetsBuffer.update(offsets);\r\n }\r\n }\r\n\r\n /**\r\n * Gets widths at each line point like [widthLower, widthUpper, widthLower, widthUpper, ...]\r\n */\r\n get widths() {\r\n return this._widths;\r\n }\r\n\r\n /**\r\n * Sets widths at each line point\r\n * @param widths width table [widthLower, widthUpper, widthLower, widthUpper ...]\r\n */\r\n set widths(widths: number[]) {\r\n this._widths = widths;\r\n if (!this._lazy) {\r\n this._widthsBuffer && this._widthsBuffer.update(widths);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the color pointer. Each vertex need a color pointer. These color pointers points to the colors in the color table @see colors\r\n */\r\n get colorPointers() {\r\n return this._colorPointers;\r\n }\r\n\r\n /**\r\n * Sets the color pointer\r\n * @param colorPointers array of color pointer in the colors array. One pointer for every vertex is needed.\r\n */\r\n set colorPointers(colorPointers: number[]) {\r\n this._colorPointers = colorPointers;\r\n if (!this._lazy) {\r\n this._colorPointersBuffer && this._colorPointersBuffer.update(colorPointers);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the pluginMaterial associated with line\r\n */\r\n get greasedLineMaterial(): IGreasedLineMaterial | undefined {\r\n if (this.material && this.material instanceof GreasedLineSimpleMaterial) {\r\n return this.material;\r\n }\r\n const materialPlugin = this.material?.pluginManager?.getPlugin(GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME);\r\n if (materialPlugin) {\r\n return <GreasedLinePluginMaterial>materialPlugin;\r\n }\r\n return;\r\n }\r\n\r\n /**\r\n * Return copy the points.\r\n */\r\n get points() {\r\n const pointsCopy: number[][] = [];\r\n DeepCopier.DeepCopy(this._points, pointsCopy);\r\n return pointsCopy;\r\n }\r\n\r\n /**\r\n * Sets line points and rerenders the line.\r\n * @param points points table\r\n * @param options optional options\r\n */\r\n public setPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n this._points = points;\r\n this._updateWidths();\r\n if (!options?.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._setPoints(points, options);\r\n }\r\n\r\n protected _initGreasedLine() {\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n }\r\n\r\n protected _createLineOptions() {\r\n const lineOptions: GreasedLineMeshOptions = {\r\n points: this._points,\r\n colorPointers: this._colorPointers,\r\n lazy: this._lazy,\r\n updatable: this._updatable,\r\n uvs: this._uvs,\r\n widths: this._widths,\r\n ribbonOptions: this._options.ribbonOptions,\r\n };\r\n return lineOptions;\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 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 protected _createVertexBuffers(computeNormals = false) {\r\n const vertexData = new VertexData();\r\n vertexData.positions = this._vertexPositions;\r\n vertexData.indices = this._indices;\r\n vertexData.uvs = this._uvs;\r\n if (computeNormals) {\r\n vertexData.normals = [];\r\n VertexData.ComputeNormals(this._vertexPositions, this._indices, vertexData.normals);\r\n }\r\n vertexData.applyToMesh(this, this._options.updatable);\r\n return vertexData;\r\n }\r\n\r\n protected _createOffsetsBuffer(offsets: number[]) {\r\n const engine = this._scene.getEngine();\r\n\r\n const offsetBuffer = new Buffer(engine, offsets, this._updatable, 3);\r\n this.setVerticesBuffer(offsetBuffer.createVertexBuffer(\"grl_offsets\", 0, 3));\r\n this._offsetsBuffer = offsetBuffer;\r\n }\r\n}\r\n"]}
@@ -88,7 +88,5 @@ export declare class GreasedLineMesh extends GreasedLineBaseMesh {
88
88
  }[] | undefined;
89
89
  private get _boundingSphere();
90
90
  private static _CompareV3;
91
- private static _CopyV3;
92
- private _preprocess;
93
91
  protected _createVertexBuffers(): VertexData;
94
92
  }
@@ -60,46 +60,102 @@ export class GreasedLineMesh extends GreasedLineBaseMesh {
60
60
  this._options.points = points;
61
61
  this._initGreasedLine();
62
62
  let indiceOffset = 0;
63
+ let vertexPositionsLen = 0, indicesLength = 0, uvLength = 0, previousAndSideLength = 0;
63
64
  points.forEach((p) => {
64
- const counters = [];
65
- const positions = [];
66
- const indices = [];
67
- const totalLength = GreasedLineTools.GetLineLength(p);
65
+ vertexPositionsLen += p.length * 2;
66
+ indicesLength += (p.length - 3) * 2;
67
+ uvLength += (p.length * 4) / 3;
68
+ previousAndSideLength += (p.length * 8) / 3;
69
+ });
70
+ const vertexPositionsArr = new Float32Array(vertexPositionsLen);
71
+ const indicesArr = vertexPositionsLen > 65535 ? new Uint32Array(indicesLength) : new Uint16Array(indicesLength);
72
+ const uvArr = new Float32Array(uvLength);
73
+ const previousAndSide = new Float32Array(previousAndSideLength);
74
+ // it's the same length here
75
+ const nextAndCounters = new Float32Array(previousAndSideLength);
76
+ let vertexPositionsOffset = 0, indicesOffset = 0, uvOffset = 0, previousAndSideOffset = 0, nextAndCountersOffset = 0;
77
+ points.forEach((p) => {
78
+ const lengthArray = GreasedLineTools.GetLineLengthArray(p);
79
+ const totalLength = lengthArray[lengthArray.length - 1];
68
80
  for (let j = 0, jj = 0; jj < p.length; j++, jj += 3) {
69
- const partialLine = p.slice(0, jj + 3);
70
- const partialLineLength = GreasedLineTools.GetLineLength(partialLine);
71
- const c = partialLineLength / totalLength;
72
- positions.push(p[jj], p[jj + 1], p[jj + 2]);
73
- positions.push(p[jj], p[jj + 1], p[jj + 2]);
74
- counters.push(c);
75
- counters.push(c);
81
+ const baseOffset = vertexPositionsOffset + jj * 2;
82
+ vertexPositionsArr[baseOffset + 0] = p[jj + 0];
83
+ vertexPositionsArr[baseOffset + 1] = p[jj + 1];
84
+ vertexPositionsArr[baseOffset + 2] = p[jj + 2];
85
+ vertexPositionsArr[baseOffset + 3] = p[jj + 0];
86
+ vertexPositionsArr[baseOffset + 4] = p[jj + 1];
87
+ vertexPositionsArr[baseOffset + 5] = p[jj + 2];
76
88
  if (jj < p.length - 3) {
77
89
  const n = j * 2 + indiceOffset;
78
- indices.push(n, n + 1, n + 2);
79
- indices.push(n + 2, n + 1, n + 3);
90
+ const baseIndicesOffset = indicesOffset + jj * 2;
91
+ indicesArr[baseIndicesOffset + 0] = n;
92
+ indicesArr[baseIndicesOffset + 1] = n + 1;
93
+ indicesArr[baseIndicesOffset + 2] = n + 2;
94
+ indicesArr[baseIndicesOffset + 3] = n + 2;
95
+ indicesArr[baseIndicesOffset + 4] = n + 1;
96
+ indicesArr[baseIndicesOffset + 5] = n + 3;
80
97
  }
81
98
  }
82
99
  indiceOffset += (p.length / 3) * 2;
83
- const previous = [];
84
- const next = [];
85
- const side = [];
86
- let uvs = [];
87
- this._preprocess(positions, previous, next, side, uvs);
88
- for (const vp of positions) {
89
- this._vertexPositions.push(vp);
100
+ const currVertexPositionsOffsetLength = p.length * 2;
101
+ const positions = vertexPositionsArr.subarray(vertexPositionsOffset, vertexPositionsOffset + currVertexPositionsOffsetLength);
102
+ vertexPositionsOffset += currVertexPositionsOffsetLength;
103
+ indicesOffset += (p.length - 3) * 2;
104
+ const previous = new Float32Array(positions.length);
105
+ const next = new Float32Array(positions.length);
106
+ const l = positions.length / 6;
107
+ let v;
108
+ if (GreasedLineMesh._CompareV3(0, l - 1, positions)) {
109
+ v = positions.subarray((l - 2) * 6, (l - 1) * 6);
110
+ }
111
+ else {
112
+ v = positions.subarray(0, 6);
90
113
  }
91
- for (const i of indices) {
92
- this._indices.push(i);
114
+ previous.set(v);
115
+ previous.set(positions.subarray(0, positions.length - 6), 6);
116
+ next.set(positions.subarray(6));
117
+ if (GreasedLineMesh._CompareV3(l - 1, 0, positions)) {
118
+ v = positions.subarray(6, 12);
93
119
  }
94
- for (let i = 0; i < side.length; i++) {
95
- this._previousAndSide.push(previous[i * 3], previous[i * 3 + 1], previous[i * 3 + 2], side[i]);
96
- this._nextAndCounters.push(next[i * 3], next[i * 3 + 1], next[i * 3 + 2], counters[i]);
120
+ else {
121
+ v = positions.subarray((l - 1) * 6, l * 6);
97
122
  }
98
- uvs = this._options.uvs ?? uvs;
99
- for (const uv of uvs) {
100
- this._uvs.push(uv);
123
+ next.set(v, next.length - 6);
124
+ for (let i = 0, sidesLength = positions.length / 3; i < sidesLength; i++) {
125
+ previousAndSide[previousAndSideOffset++] = previous[i * 3];
126
+ previousAndSide[previousAndSideOffset++] = previous[i * 3 + 1];
127
+ previousAndSide[previousAndSideOffset++] = previous[i * 3 + 2];
128
+ // side[i] = i % 2 ? -1 : 1;
129
+ // side[i] = 1 - ((i & 1) << 1);
130
+ previousAndSide[previousAndSideOffset++] = 1 - ((i & 1) << 1);
131
+ nextAndCounters[nextAndCountersOffset++] = next[i * 3];
132
+ nextAndCounters[nextAndCountersOffset++] = next[i * 3 + 1];
133
+ nextAndCounters[nextAndCountersOffset++] = next[i * 3 + 2];
134
+ // counters[i] = lengthArray[i >> 1] / totalLength;
135
+ nextAndCounters[nextAndCountersOffset++] = lengthArray[i >> 1] / totalLength;
136
+ }
137
+ if (this._options.uvs) {
138
+ for (let i = 0; i < this._options.uvs.length; i++) {
139
+ uvArr[uvOffset++] = this._options.uvs[i];
140
+ }
141
+ }
142
+ else {
143
+ for (let j = 0; j < l; j++) {
144
+ // uvs
145
+ const uvOffsetBase = uvOffset + j * 4;
146
+ uvArr[uvOffsetBase + 0] = j / (l - 1);
147
+ uvArr[uvOffsetBase + 1] = 0;
148
+ uvArr[uvOffsetBase + 2] = j / (l - 1);
149
+ uvArr[uvOffsetBase + 3] = 1;
150
+ }
151
+ uvOffset += l * 4;
101
152
  }
102
153
  });
154
+ this._vertexPositions = vertexPositionsArr;
155
+ this._indices = indicesArr;
156
+ this._uvs = uvArr;
157
+ this._previousAndSide = previousAndSide;
158
+ this._nextAndCounters = nextAndCounters;
103
159
  if (!this._lazy) {
104
160
  if (!this._options.colorPointers) {
105
161
  this._updateColorPointers();
@@ -233,55 +289,6 @@ export class GreasedLineMesh extends GreasedLineBaseMesh {
233
289
  const arrayIdx2 = positionIdx2 * 6;
234
290
  return positions[arrayIdx1] === positions[arrayIdx2] && positions[arrayIdx1 + 1] === positions[arrayIdx2 + 1] && positions[arrayIdx1 + 2] === positions[arrayIdx2 + 2];
235
291
  }
236
- static _CopyV3(positionIdx, positions) {
237
- const arrayIdx = positionIdx * 6;
238
- return [positions[arrayIdx], positions[arrayIdx + 1], positions[arrayIdx + 2]];
239
- }
240
- _preprocess(positions, previous, next, side, uvs) {
241
- const l = positions.length / 6;
242
- let v = [];
243
- if (GreasedLineMesh._CompareV3(0, l - 1, positions)) {
244
- v = GreasedLineMesh._CopyV3(l - 2, positions);
245
- }
246
- else {
247
- v = GreasedLineMesh._CopyV3(0, positions);
248
- }
249
- previous.push(v[0], v[1], v[2]);
250
- previous.push(v[0], v[1], v[2]);
251
- for (let j = 0; j < l; j++) {
252
- side.push(1);
253
- side.push(-1);
254
- // uvs
255
- if (!this._options.uvs) {
256
- uvs.push(j / (l - 1), 0);
257
- uvs.push(j / (l - 1), 1);
258
- }
259
- if (j < l - 1) {
260
- v = GreasedLineMesh._CopyV3(j, positions);
261
- previous.push(v[0], v[1], v[2]);
262
- previous.push(v[0], v[1], v[2]);
263
- }
264
- if (j > 0) {
265
- v = GreasedLineMesh._CopyV3(j, positions);
266
- next.push(v[0], v[1], v[2]);
267
- next.push(v[0], v[1], v[2]);
268
- }
269
- }
270
- if (GreasedLineMesh._CompareV3(l - 1, 0, positions)) {
271
- v = GreasedLineMesh._CopyV3(1, positions);
272
- }
273
- else {
274
- v = GreasedLineMesh._CopyV3(l - 1, positions);
275
- }
276
- next.push(v[0], v[1], v[2]);
277
- next.push(v[0], v[1], v[2]);
278
- return {
279
- previous,
280
- next,
281
- uvs,
282
- side,
283
- };
284
- }
285
292
  _createVertexBuffers() {
286
293
  const vertexData = super._createVertexBuffers();
287
294
  const engine = this._scene.getEngine();