@babylonjs/core 7.27.0 → 7.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/Animations/animationGroup.d.ts +2 -2
  2. package/Animations/animationGroup.js.map +1 -1
  3. package/Audio/audioSceneComponent.d.ts +5 -9
  4. package/Audio/audioSceneComponent.js.map +1 -1
  5. package/Bones/skeleton.d.ts +2 -2
  6. package/Bones/skeleton.js.map +1 -1
  7. package/Cameras/camera.d.ts +2 -0
  8. package/Cameras/camera.js +2 -0
  9. package/Cameras/camera.js.map +1 -1
  10. package/Engines/WebGPU/webgpuSnapshotRendering.js +3 -0
  11. package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
  12. package/Engines/abstractEngine.js +2 -2
  13. package/Engines/abstractEngine.js.map +1 -1
  14. package/{abstractScene.d.ts → IAssetContainer.d.ts} +33 -6
  15. package/IAssetContainer.js +2 -0
  16. package/IAssetContainer.js.map +1 -0
  17. package/Layers/effectLayerSceneComponent.d.ts +6 -6
  18. package/Layers/effectLayerSceneComponent.js +3 -3
  19. package/Layers/effectLayerSceneComponent.js.map +1 -1
  20. package/Layers/glowLayer.d.ts +3 -3
  21. package/Layers/glowLayer.js +2 -2
  22. package/Layers/glowLayer.js.map +1 -1
  23. package/Layers/highlightLayer.d.ts +3 -3
  24. package/Layers/highlightLayer.js +2 -2
  25. package/Layers/highlightLayer.js.map +1 -1
  26. package/Layers/layerSceneComponent.d.ts +5 -5
  27. package/Layers/layerSceneComponent.js.map +1 -1
  28. package/LensFlares/lensFlareSystemSceneComponent.d.ts +6 -6
  29. package/LensFlares/lensFlareSystemSceneComponent.js +6 -6
  30. package/LensFlares/lensFlareSystemSceneComponent.js.map +1 -1
  31. package/Lights/Shadows/shadowGeneratorSceneComponent.d.ts +3 -3
  32. package/Lights/Shadows/shadowGeneratorSceneComponent.js.map +1 -1
  33. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +1 -1
  34. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  35. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.d.ts +2 -2
  36. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js.map +1 -1
  37. package/Materials/Textures/baseTexture.d.ts +2 -2
  38. package/Materials/Textures/baseTexture.js.map +1 -1
  39. package/Materials/effectRenderer.d.ts +1 -0
  40. package/Materials/effectRenderer.js +2 -0
  41. package/Materials/effectRenderer.js.map +1 -1
  42. package/Materials/material.d.ts +2 -2
  43. package/Materials/material.decalMapConfiguration.d.ts +1 -1
  44. package/Materials/material.decalMapConfiguration.js +1 -1
  45. package/Materials/material.decalMapConfiguration.js.map +1 -1
  46. package/Materials/material.js.map +1 -1
  47. package/Materials/shaderMaterial.d.ts +5 -0
  48. package/Materials/shaderMaterial.js +7 -0
  49. package/Materials/shaderMaterial.js.map +1 -1
  50. package/Maths/math.color.d.ts +20 -0
  51. package/Maths/math.color.js +41 -12
  52. package/Maths/math.color.js.map +1 -1
  53. package/Meshes/Builders/greasedLineBuilder.d.ts +16 -0
  54. package/Meshes/Builders/greasedLineBuilder.js +1 -1
  55. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  56. package/Meshes/Builders/groundBuilder.d.ts +1 -0
  57. package/Meshes/Builders/groundBuilder.js +2 -2
  58. package/Meshes/Builders/groundBuilder.js.map +1 -1
  59. package/Meshes/GreasedLine/greasedLineBaseMesh.js +1 -1
  60. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  61. package/Meshes/GreasedLine/greasedLineMesh.js +1 -1
  62. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  63. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +1 -1
  64. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  65. package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +3 -0
  66. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +86 -1
  67. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  68. package/Meshes/Node/Blocks/Sources/nullBlock.d.ts +4 -0
  69. package/Meshes/Node/Blocks/Sources/nullBlock.js +8 -0
  70. package/Meshes/Node/Blocks/Sources/nullBlock.js.map +1 -1
  71. package/Meshes/Node/Blocks/Sources/planeBlock.d.ts +13 -0
  72. package/Meshes/Node/Blocks/Sources/planeBlock.js +41 -3
  73. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  74. package/Meshes/Node/Blocks/debugBlock.js +1 -1
  75. package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
  76. package/Meshes/Node/Blocks/geometryElbowBlock.js +1 -1
  77. package/Meshes/Node/Blocks/geometryElbowBlock.js.map +1 -1
  78. package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +4 -0
  79. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +47 -1
  80. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  81. package/Meshes/geometry.d.ts +2 -2
  82. package/Meshes/geometry.js.map +1 -1
  83. package/Meshes/mesh.d.ts +7 -0
  84. package/Meshes/mesh.js +15 -0
  85. package/Meshes/mesh.js.map +1 -1
  86. package/Meshes/meshUVSpaceRenderer.d.ts +3 -2
  87. package/Meshes/meshUVSpaceRenderer.js +15 -3
  88. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  89. package/Misc/greasedLineTools.d.ts +3 -1
  90. package/Misc/greasedLineTools.js +17 -2
  91. package/Misc/greasedLineTools.js.map +1 -1
  92. package/Misc/index.d.ts +2 -0
  93. package/Misc/index.js +2 -0
  94. package/Misc/index.js.map +1 -1
  95. package/Misc/screenshotTools.js +3 -2
  96. package/Misc/screenshotTools.js.map +1 -1
  97. package/Misc/textureTools.js +20 -4
  98. package/Misc/textureTools.js.map +1 -1
  99. package/Morph/morphTargetManager.d.ts +2 -2
  100. package/Morph/morphTargetManager.js.map +1 -1
  101. package/PostProcesses/postProcess.d.ts +2 -2
  102. package/PostProcesses/postProcess.js.map +1 -1
  103. package/Probes/reflectionProbe.d.ts +5 -5
  104. package/Probes/reflectionProbe.js +3 -3
  105. package/Probes/reflectionProbe.js.map +1 -1
  106. package/Rendering/fluidRenderer/fluidRenderer.d.ts +2 -2
  107. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  108. package/Rendering/prePassRendererSceneComponent.d.ts +2 -2
  109. package/Rendering/prePassRendererSceneComponent.js.map +1 -1
  110. package/Rendering/subSurfaceSceneComponent.d.ts +2 -2
  111. package/Rendering/subSurfaceSceneComponent.js.map +1 -1
  112. package/Shaders/lod.fragment.js +2 -2
  113. package/Shaders/lod.fragment.js.map +1 -1
  114. package/Shaders/lodCube.fragment.js +2 -2
  115. package/Shaders/lodCube.fragment.js.map +1 -1
  116. package/Shaders/spriteMap.fragment.js +18 -6
  117. package/Shaders/spriteMap.fragment.js.map +1 -1
  118. package/Shaders/spriteMap.vertex.js +1 -1
  119. package/Shaders/spriteMap.vertex.js.map +1 -1
  120. package/ShadersWGSL/lod.fragment.d.ts +5 -0
  121. package/ShadersWGSL/lod.fragment.js +11 -0
  122. package/ShadersWGSL/lod.fragment.js.map +1 -0
  123. package/ShadersWGSL/lodCube.fragment.d.ts +5 -0
  124. package/ShadersWGSL/lodCube.fragment.js +30 -0
  125. package/ShadersWGSL/lodCube.fragment.js.map +1 -0
  126. package/Sprites/spriteMap.d.ts +16 -0
  127. package/Sprites/spriteMap.js +17 -0
  128. package/Sprites/spriteMap.js.map +1 -1
  129. package/assetContainer.d.ts +143 -3
  130. package/assetContainer.js +129 -8
  131. package/assetContainer.js.map +1 -1
  132. package/index.d.ts +0 -1
  133. package/index.js +0 -1
  134. package/index.js.map +1 -1
  135. package/node.d.ts +2 -2
  136. package/node.js.map +1 -1
  137. package/package.json +1 -1
  138. package/scene.d.ts +103 -14
  139. package/scene.js +170 -71
  140. package/scene.js.map +1 -1
  141. package/sceneComponent.d.ts +3 -3
  142. package/sceneComponent.js.map +1 -1
  143. package/abstractScene.js +0 -117
  144. package/abstractScene.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"greasedLineBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/greasedLineBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAG7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AAEtG;;;GAGG;AACH,MAAM,CAAN,IAAkB,gCAyBjB;AAzBD,WAAkB,gCAAgC;IAC9C;;OAEG;IACH,6HAA2B,CAAA;IAC3B;;OAEG;IACH,iIAA6B,CAAA;IAC7B;;OAEG;IACH,6HAA2B,CAAA;IAC3B;;OAEG;IACH,+HAA4B,CAAA;IAC5B;;OAEG;IACH,2HAA0B,CAAA;IAC1B;;OAEG;IACH,uIAAgC,CAAA;AACpC,CAAC,EAzBiB,gCAAgC,KAAhC,gCAAgC,QAyBjD;AAED;;;GAGG;AACH,MAAM,CAAN,IAAkB,gCAyBjB;AAzBD,WAAkB,gCAAgC;IAC9C;;OAEG;IACH,6HAA2B,CAAA;IAC3B;;OAEG;IACH,iIAA6B,CAAA;IAC7B;;OAEG;IACH,6HAA2B,CAAA;IAC3B;;OAEG;IACH,+HAA4B,CAAA;IAC5B;;OAEG;IACH,2HAA0B,CAAA;IAC1B;;OAEG;IACH,uIAAgC,CAAA;AACpC,CAA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aAC9B;SACJ;KACJ;SAAM;QACH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE;YACjC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9B;KACJ;IAED,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["import { StandardMaterial } from \"./../../Materials/standardMaterial\";\r\nimport { PBRMaterial } from \"../../Materials/PBR/pbrMaterial\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { GreasedLineMesh } from \"../GreasedLine/greasedLineMesh\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\nimport { GreasedLineSimpleMaterial } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions } from \"../GreasedLine/greasedLineBaseMesh\";\r\nimport { GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from \"../GreasedLine/greasedLineBaseMesh\";\r\nimport { GreasedLineRibbonMesh } from \"../GreasedLine/greasedLineRibbonMesh\";\r\nimport type { GreasedLineMaterialOptions } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshMaterialType } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { GreasedLineMaterialDefaults } from \"../../Materials/GreasedLine/greasedLineMaterialDefaults\";\r\n\r\n/**\r\n * How are the colors distributed along the color table\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colors-and-colordistribution}\r\n */\r\nexport const enum GreasedLineMeshColorDistribution {\r\n /**\r\n * Do no modify the color table\r\n */\r\n COLOR_DISTRIBUTION_NONE = 0,\r\n /**\r\n * Repeat the colors until the color table is full\r\n */\r\n COLOR_DISTRIBUTION_REPEAT = 1,\r\n /**\r\n * Distribute the colors evenly through the color table\r\n */\r\n COLOR_DISTRIBUTION_EVEN = 2,\r\n /**\r\n * Put the colors to start of the color table a fill the rest with the default color\r\n */\r\n COLOR_DISTRIBUTION_START = 3,\r\n /**\r\n * Put the colors to the end of the color table and fill the rest with the default color\r\n */\r\n COLOR_DISTRIBUTION_END = 4,\r\n /**\r\n * Put the colors to start and to the end of the color table and fill the gap between with the default color\r\n */\r\n COLOR_DISTRIBUTION_START_END = 5,\r\n}\r\n\r\n/**\r\n * How are the widths distributed along the width table\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#widths-and-widthdistribution}\r\n */\r\nexport const enum GreasedLineMeshWidthDistribution {\r\n /**\r\n * Do no modify the width table\r\n */\r\n WIDTH_DISTRIBUTION_NONE = 0,\r\n /**\r\n * Repeat the widths until the width table is full\r\n */\r\n WIDTH_DISTRIBUTION_REPEAT = 1,\r\n /**\r\n * Distribute the widths evenly through the width table\r\n */\r\n WIDTH_DISTRIBUTION_EVEN = 2,\r\n /**\r\n * Put the widths to start of the width table a fill the rest with the default width\r\n */\r\n WIDTH_DISTRIBUTION_START = 3,\r\n /**\r\n * Put the widths to the end of the width table and fill the rest with the default width\r\n */\r\n WIDTH_DISTRIBUTION_END = 4,\r\n /**\r\n * Put the widths to start and to the end of the width table and fill the gap between with the default width\r\n */\r\n WIDTH_DISTRIBUTION_START_END = 5,\r\n}\r\n\r\n/**\r\n * Material options for GreasedLineBuilder\r\n */\r\nexport interface GreasedLineMaterialBuilderOptions extends GreasedLineMaterialOptions {\r\n /**\r\n * If set to true a new material will be created and a new material plugin will be attached\r\n * to the material. The material will be set on the mesh. If the instance option is specified in the mesh options,\r\n * no material will be created/assigned. Defaults to true.\r\n */\r\n createAndAssignMaterial?: boolean;\r\n /**\r\n * Distribution of the colors if the color table contains fewer entries than needed. Defaults to GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START\r\n * @see CompleteGreasedLineColorTable\r\n */\r\n colorDistribution?: GreasedLineMeshColorDistribution;\r\n}\r\n\r\n/**\r\n * Line mesh options for GreasedLineBuilder\r\n */\r\nexport interface GreasedLineMeshBuilderOptions extends GreasedLineMeshOptions {\r\n /**\r\n * Distribution of the widths if the width table contains fewer entries than needed. Defaults to GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START\r\n * @see CompleteGreasedLineWidthTable\r\n */\r\n widthDistribution?: GreasedLineMeshWidthDistribution;\r\n}\r\n\r\n/**\r\n * Builder functions for creating GreasedLineMeshes\r\n */\r\n\r\n/**\r\n * Creates a new @see GreasedLinePluginMaterial\r\n * @param name name of the material\r\n * @param options material options @see GreasedLineMaterialOptions\r\n * @param scene scene or null to use the last scene\r\n * @returns StandardMaterial or PBRMaterial with the @see GreasedLinePluginMaterial attached to it\r\n */\r\nexport function CreateGreasedLineMaterial(name: string, options: GreasedLineMaterialOptions, scene: Nullable<Scene>) {\r\n scene = <Scene>(scene ?? EngineStore.LastCreatedScene);\r\n\r\n let material;\r\n switch (options.materialType) {\r\n case GreasedLineMeshMaterialType.MATERIAL_TYPE_PBR:\r\n material = new PBRMaterial(name, scene, true); // Forcing glsl for now\r\n new GreasedLinePluginMaterial(material, scene, options);\r\n break;\r\n case GreasedLineMeshMaterialType.MATERIAL_TYPE_SIMPLE:\r\n material = new GreasedLineSimpleMaterial(name, scene, options);\r\n break;\r\n default:\r\n material = new StandardMaterial(name, scene, true); // Forcing glsl for now\r\n new GreasedLinePluginMaterial(material, scene, options);\r\n break;\r\n }\r\n\r\n return material;\r\n}\r\n\r\n/**\r\n * Creates a GreasedLine mesh\r\n * @param name name of the mesh\r\n * @param options options for the mesh\r\n * @param materialOptions material options for the mesh\r\n * @param scene scene where the mesh will be created\r\n * @returns instance of GreasedLineMesh\r\n */\r\nexport function CreateGreasedLine(name: string, options: GreasedLineMeshBuilderOptions, materialOptions?: Nullable<GreasedLineMaterialBuilderOptions>, scene?: Nullable<Scene>) {\r\n scene = <Scene>(scene ?? EngineStore.LastCreatedScene);\r\n\r\n let instance;\r\n const allPoints = GreasedLineTools.ConvertPoints(options.points);\r\n\r\n options.widthDistribution = options.widthDistribution ?? GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START;\r\n if (options.ribbonOptions) {\r\n options.ribbonOptions.facesMode = options.ribbonOptions.facesMode ?? GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING;\r\n options.ribbonOptions.pointsMode = options.ribbonOptions.pointsMode ?? GreasedLineRibbonPointsMode.POINTS_MODE_POINTS;\r\n options.ribbonOptions.directionsAutoMode =\r\n options.ribbonOptions.directionsAutoMode ??\r\n (options.ribbonOptions.directions ? GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE : GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT);\r\n }\r\n\r\n materialOptions = materialOptions ?? {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n materialOptions.createAndAssignMaterial = materialOptions.createAndAssignMaterial ?? true;\r\n materialOptions.colorDistribution = materialOptions?.colorDistribution ?? GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START;\r\n materialOptions.materialType = materialOptions.materialType ?? GreasedLineMeshMaterialType.MATERIAL_TYPE_STANDARD;\r\n\r\n const pointsCount = GetPointsCount(allPoints);\r\n const widths = CompleteGreasedLineWidthTable(pointsCount, options.widths ?? [], options.widthDistribution);\r\n\r\n const colors = materialOptions?.colors\r\n ? CompleteGreasedLineColorTable(pointsCount, materialOptions.colors, materialOptions.colorDistribution, materialOptions.color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR)\r\n : undefined;\r\n\r\n // create new mesh if instance is not defined\r\n const initialGreasedLineOptions: GreasedLineMeshOptions = {\r\n points: allPoints,\r\n updatable: options.updatable,\r\n widths,\r\n lazy: options.lazy,\r\n ribbonOptions: options.ribbonOptions,\r\n uvs: options.uvs,\r\n colorPointers: options.colorPointers,\r\n };\r\n\r\n if (initialGreasedLineOptions.ribbonOptions) {\r\n if (initialGreasedLineOptions.ribbonOptions.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n initialGreasedLineOptions.ribbonOptions.width = materialOptions.width ?? initialGreasedLineOptions.ribbonOptions.width ?? GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n }\r\n }\r\n\r\n if (!options.instance) {\r\n instance = initialGreasedLineOptions.ribbonOptions\r\n ? new GreasedLineRibbonMesh(name, scene, initialGreasedLineOptions)\r\n : new GreasedLineMesh(name, scene, initialGreasedLineOptions);\r\n\r\n if (materialOptions) {\r\n const initialMaterialOptions: GreasedLineMaterialOptions = {\r\n materialType: materialOptions.materialType,\r\n dashCount: materialOptions.dashCount,\r\n dashOffset: materialOptions.dashOffset,\r\n dashRatio: materialOptions.dashRatio,\r\n resolution: materialOptions.resolution,\r\n sizeAttenuation: materialOptions.sizeAttenuation,\r\n useColors: materialOptions.useColors,\r\n useDash: materialOptions.useDash,\r\n visibility: materialOptions.visibility,\r\n width: materialOptions.width,\r\n color: materialOptions.color,\r\n colorMode: materialOptions.colorMode,\r\n colorsSampling: materialOptions.colorsSampling,\r\n colorDistributionType: materialOptions.colorDistributionType,\r\n colors,\r\n cameraFacing: !options.ribbonOptions,\r\n colorsTexture: materialOptions.colorsTexture,\r\n };\r\n\r\n if (materialOptions.createAndAssignMaterial) {\r\n const material = CreateGreasedLineMaterial(name, initialMaterialOptions, scene);\r\n instance.material = material;\r\n\r\n if (options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING) {\r\n material.backFaceCulling = false;\r\n }\r\n }\r\n }\r\n } else {\r\n // update the data on the mesh instance\r\n instance = options.instance;\r\n if (instance instanceof GreasedLineRibbonMesh) {\r\n instance.addPoints(allPoints, initialGreasedLineOptions);\r\n } else {\r\n // add widths\r\n const currentWidths = instance.widths;\r\n if (currentWidths) {\r\n const newWidths = currentWidths.slice();\r\n for (const w of widths) {\r\n newWidths.push(w);\r\n }\r\n instance.widths = newWidths;\r\n } else {\r\n instance.widths = widths;\r\n }\r\n\r\n instance.addPoints(allPoints);\r\n\r\n // add UVs\r\n if (options.uvs) {\r\n const currentUVs = instance.uvs;\r\n if (currentUVs) {\r\n const newUVs = new Float32Array(currentUVs.length + options.uvs.length);\r\n newUVs.set(currentUVs, 0);\r\n newUVs.set(options.uvs, currentUVs.length);\r\n instance.uvs = newUVs;\r\n } else {\r\n instance.uvs = options.uvs;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // add colors\r\n // it will merge if any colors already on the instance\r\n if (colors && options.instance) {\r\n if (options.instance.greasedLineMaterial) {\r\n const currentColors = options.instance.greasedLineMaterial.colors;\r\n if (currentColors) {\r\n const newColors = currentColors.concat(colors);\r\n options.instance.greasedLineMaterial.setColors(newColors, instance.isLazy());\r\n }\r\n }\r\n }\r\n\r\n return instance;\r\n}\r\n\r\n/**\r\n * Counts the number of points\r\n * @param allPoints Array of points [[x, y, z], [x, y, z], ...] or Array of points [x, y, z, x, y, z, ...]\r\n * @returns total number of points\r\n */\r\nexport function GetPointsCount(allPoints: number[][]) {\r\n let pointCount = 0;\r\n for (const points of allPoints) {\r\n pointCount += (<number[]>points).length / 3;\r\n }\r\n return pointCount;\r\n}\r\n\r\n/**\r\n * Completes the width table/fills the missing entries. It means it creates a width entry for every point of the line mesh.\r\n * You can provide more points the widths when creating the mesh. This function will fill the empty entries.\r\n * The algorithm used to fill the empty entries can be\r\n * GreasedLineMeshWidthDistribution.REPEAT - the width table will be repeatedly copied to the empty values [wL, wU] = [wL, wU, wL, wU, wL, wU, wL, wU, ...]\r\n * GreasedLineMeshWidthDistribution.EVEN - the width table will be evenly copied to the empty values [wL, wU] = [wL, wL, wL, wL, wU, wU, wU, wU]\r\n * GreasedLineMeshWidthDistribution.START - the width table will be copied at the start of the empty values\r\n * and rest will be filled width the default width upper and default width lower values [wU, wL] = [wL, wU, dwL, dwU, dwL, dwU, dwL, dwU]\r\n * GreasedLineMeshWidthDistribution.END - the width table will be copied at the end of the empty values\r\n * and rest will be filled width the default values [wL, wU] = [wL, wU, dwL, dwU, dwL, dwU, wL, wU]\r\n * @param pointCount number of points of the line mesh\r\n * @param widths array of widths [widhtLower, widthUpper, widthLower, widthUpper ...]. Two widths (lower/upper) per point.\r\n * @param widthsDistribution how to distribute widths if the widths array has fewer entries than pointCount\r\n * @param defaultWidthUpper the default value which will be used to fill empty width entries - upper width\r\n * @param defaultWidthLower the default value which will be used to fill empty width entries - lower width\r\n * @returns completed width table.\r\n */\r\nexport function CompleteGreasedLineWidthTable(\r\n pointCount: number,\r\n widths: number[],\r\n widthsDistribution: GreasedLineMeshWidthDistribution,\r\n defaultWidthUpper = 1,\r\n defaultWidthLower = 1\r\n): number[] {\r\n const missingCount = pointCount - widths.length / 2;\r\n\r\n const widthsData: number[] = [];\r\n if (missingCount < 0) {\r\n return widths.slice(0, pointCount * 2);\r\n }\r\n\r\n // is the width table shorter than the point table?\r\n if (missingCount > 0) {\r\n if (widths.length % 2 != 0) {\r\n widths.push(defaultWidthUpper);\r\n }\r\n // it is, fill in the missing elements\r\n if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START_END) {\r\n const halfCount = Math.floor(widths.length / 2);\r\n\r\n // start sector\r\n for (let i = 0, j = 0; i < halfCount - 1; i++) {\r\n widthsData.push(widths[j++]);\r\n widthsData.push(widths[j++]);\r\n }\r\n\r\n // middle sector\r\n const widthL = widths[halfCount / 2];\r\n const widthU = widths[halfCount / 2 + 1];\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(widthU);\r\n widthsData.push(widthL);\r\n }\r\n\r\n // end sector\r\n for (let i = halfCount; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START) {\r\n // start sector\r\n for (let i = 0; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(defaultWidthUpper);\r\n widthsData.push(defaultWidthLower);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_END) {\r\n // start sector\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(defaultWidthUpper);\r\n widthsData.push(defaultWidthLower);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_REPEAT) {\r\n let i = 0;\r\n for (let x = 0; x < pointCount; x++) {\r\n widthsData.push(widths[i++]);\r\n widthsData.push(widths[i++]);\r\n\r\n if (i === widths.length) {\r\n i = 0;\r\n }\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_EVEN) {\r\n let j = 0;\r\n const widthsectorLength = widths.length / ((pointCount - 1) * 2);\r\n for (let x = 0; x < pointCount; x++) {\r\n const i = Math.floor(j);\r\n\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n\r\n j += widthsectorLength;\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < widths.length; i++) {\r\n widthsData.push(widths[i]);\r\n }\r\n }\r\n\r\n return widthsData;\r\n}\r\n\r\n/**\r\n * Completes the color table/fill the missing color entries. It means it creates a color entry for every point of the line mesh.\r\n * You can provide more points the colors when creating the mesh. This function will fill the empty entries.\r\n * The algorithm used to fill the empty entries can be\r\n * GreasedLineMesColorhDistribution.REPEAT - the color table will be repeatedly copied to the empty values [c1, c2] = [c1, c2, c1, c2, c1, c2, c1, c2]\r\n * GreasedLineMesColorhDistribution.EVEN - the color table will be evenly copied to the empty values [c1, c2] = [c1, c1, c1, c1, c2, c2, c2, c2]\r\n * GreasedLineMesColorhDistribution.START - the color table will be copied at the start of the empty values\r\n * and rest will be filled color the default color value [c1, c2] = [c1, c2, dc, dc, dc, dc, dc, dc]\r\n * GreasedLineMesColorhDistribution.START_END - the color table will be copied at the start and the end of the empty values\r\n * and rest will be filled color the default color value [c1, c2] = [c1, c2, dc, dc, dc, dc, c1, c2]\r\n * @param pointCount number of points of the line mesh\r\n * @param colors array of Color3 for the color table\r\n * @param colorDistribution how to distribute colors if the colors array has fewer entries than pointCount\r\n * @param defaultColor default color to be used to fill empty entries in the color table\r\n * @returns completed array of Color3s\r\n */\r\nexport function CompleteGreasedLineColorTable(pointCount: number, colors: Color3[], colorDistribution: GreasedLineMeshColorDistribution, defaultColor: Color3): Color3[] {\r\n pointCount = Math.max(colors.length, pointCount);\r\n const missingCount = pointCount - colors.length;\r\n if (missingCount < 0) {\r\n return colors.slice(0, pointCount);\r\n }\r\n\r\n const colorsData: Color3[] = [];\r\n // is the color table shorter than the point table?\r\n if (missingCount > 0) {\r\n // it is, fill in the missing elements\r\n if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START_END) {\r\n const halfCount = Math.floor(colors.length / 2);\r\n\r\n // start sector\r\n for (let i = 0; i < halfCount; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n\r\n // middle sector\r\n for (let i = 0; i < missingCount - 1; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n\r\n // end sector\r\n for (let i = halfCount; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START) {\r\n // start sector\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < missingCount; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_END) {\r\n // start sector\r\n for (let i = 0; i < missingCount - 1; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_REPEAT) {\r\n let i = 0;\r\n for (let x = 0; x < pointCount; x++) {\r\n colorsData.push(colors[i]);\r\n\r\n i++;\r\n\r\n if (i === colors.length) {\r\n i = 0;\r\n }\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_EVEN) {\r\n let j = 0;\r\n const colorSectorLength = colors.length / (pointCount - 1);\r\n for (let x = 0; x < pointCount - 1; x++) {\r\n const i = Math.floor(j);\r\n\r\n colorsData.push(colors[i]);\r\n\r\n j += colorSectorLength;\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_NONE) {\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < pointCount; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n }\r\n\r\n return colorsData;\r\n}\r\n"]}
1
+ {"version":3,"file":"greasedLineBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/greasedLineBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,OAAO,E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AAC,CAAC,CAAC;gBAE3B,CAAC,EAAE,CAAC;gBAEJ,IAAI,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE;oBACrB,CAAC,GAAG,CAAC,CAAC;iBACT;aACJ;SACJ;aAAM,IAAI,iBAAiB,qEAA6D,EAAE;YACvF,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;YAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;gBACrC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAExB,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBAE3B,CAAC,IAAI,iBAAiB,CAAC;aAC1B;SACJ;aAAM,IAAI,iBAAiB,qEAA6D,EAAE;YACvF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;aAC9B;SACJ;KACJ;SAAM;QACH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE;YACjC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9B;KACJ;IAED,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["import { StandardMaterial } from \"./../../Materials/standardMaterial\";\r\nimport { PBRMaterial } from \"../../Materials/PBR/pbrMaterial\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { GreasedLineMesh } from \"../GreasedLine/greasedLineMesh\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\nimport { GreasedLineSimpleMaterial } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions } from \"../GreasedLine/greasedLineBaseMesh\";\r\nimport { GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from \"../GreasedLine/greasedLineBaseMesh\";\r\nimport { GreasedLineRibbonMesh } from \"../GreasedLine/greasedLineRibbonMesh\";\r\nimport type { GreasedLineMaterialOptions } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshMaterialType } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { GreasedLineMaterialDefaults } from \"../../Materials/GreasedLine/greasedLineMaterialDefaults\";\r\n\r\n/**\r\n * How are the colors distributed along the color table\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colors-and-colordistribution}\r\n */\r\nexport const enum GreasedLineMeshColorDistribution {\r\n /**\r\n * Do no modify the color table\r\n */\r\n COLOR_DISTRIBUTION_NONE = 0,\r\n /**\r\n * Repeat the colors until the color table is full\r\n */\r\n COLOR_DISTRIBUTION_REPEAT = 1,\r\n /**\r\n * Distribute the colors evenly through the color table\r\n */\r\n COLOR_DISTRIBUTION_EVEN = 2,\r\n /**\r\n * Put the colors to start of the color table a fill the rest with the default color\r\n */\r\n COLOR_DISTRIBUTION_START = 3,\r\n /**\r\n * Put the colors to the end of the color table and fill the rest with the default color\r\n */\r\n COLOR_DISTRIBUTION_END = 4,\r\n /**\r\n * Put the colors to start and to the end of the color table and fill the gap between with the default color\r\n */\r\n COLOR_DISTRIBUTION_START_END = 5,\r\n}\r\n\r\n/**\r\n * How are the widths distributed along the width table\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#widths-and-widthdistribution}\r\n */\r\nexport const enum GreasedLineMeshWidthDistribution {\r\n /**\r\n * Do no modify the width table\r\n */\r\n WIDTH_DISTRIBUTION_NONE = 0,\r\n /**\r\n * Repeat the widths until the width table is full\r\n */\r\n WIDTH_DISTRIBUTION_REPEAT = 1,\r\n /**\r\n * Distribute the widths evenly through the width table\r\n */\r\n WIDTH_DISTRIBUTION_EVEN = 2,\r\n /**\r\n * Put the widths to start of the width table a fill the rest with the default width\r\n */\r\n WIDTH_DISTRIBUTION_START = 3,\r\n /**\r\n * Put the widths to the end of the width table and fill the rest with the default width\r\n */\r\n WIDTH_DISTRIBUTION_END = 4,\r\n /**\r\n * Put the widths to start and to the end of the width table and fill the gap between with the default width\r\n */\r\n WIDTH_DISTRIBUTION_START_END = 5,\r\n}\r\n\r\n/**\r\n * Options for converting the points to the internal number[][] format used by GreasedLine\r\n */\r\nexport interface GreasedLinePointsOptions {\r\n /**\r\n * If defined and a Float32Array is used for the points parameter,\r\n * it will create multiple disconnected lines.\r\n * This parameter defines how many entries from the array to use for one line.\r\n * One entry = 3 float values.\r\n */\r\n floatArrayStride?: number;\r\n}\r\n\r\n/**\r\n * Material options for GreasedLineBuilder\r\n */\r\nexport interface GreasedLineMaterialBuilderOptions extends GreasedLineMaterialOptions {\r\n /**\r\n * If set to true a new material will be created and a new material plugin will be attached\r\n * to the material. The material will be set on the mesh. If the instance option is specified in the mesh options,\r\n * no material will be created/assigned. Defaults to true.\r\n */\r\n createAndAssignMaterial?: boolean;\r\n /**\r\n * Distribution of the colors if the color table contains fewer entries than needed. Defaults to GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START\r\n * @see CompleteGreasedLineColorTable\r\n */\r\n colorDistribution?: GreasedLineMeshColorDistribution;\r\n}\r\n\r\n/**\r\n * Line mesh options for GreasedLineBuilder\r\n */\r\nexport interface GreasedLineMeshBuilderOptions extends GreasedLineMeshOptions {\r\n /**\r\n * Options for converting the points.\r\n */\r\n pointsOptions?: GreasedLinePointsOptions;\r\n /**\r\n * Distribution of the widths if the width table contains fewer entries than needed. Defaults to GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START\r\n * @see CompleteGreasedLineWidthTable\r\n */\r\n widthDistribution?: GreasedLineMeshWidthDistribution;\r\n}\r\n\r\n/**\r\n * Builder functions for creating GreasedLineMeshes\r\n */\r\n\r\n/**\r\n * Creates a new @see GreasedLinePluginMaterial\r\n * @param name name of the material\r\n * @param options material options @see GreasedLineMaterialOptions\r\n * @param scene scene or null to use the last scene\r\n * @returns StandardMaterial or PBRMaterial with the @see GreasedLinePluginMaterial attached to it\r\n */\r\nexport function CreateGreasedLineMaterial(name: string, options: GreasedLineMaterialOptions, scene: Nullable<Scene>) {\r\n scene = <Scene>(scene ?? EngineStore.LastCreatedScene);\r\n\r\n let material;\r\n switch (options.materialType) {\r\n case GreasedLineMeshMaterialType.MATERIAL_TYPE_PBR:\r\n material = new PBRMaterial(name, scene, true); // Forcing glsl for now\r\n new GreasedLinePluginMaterial(material, scene, options);\r\n break;\r\n case GreasedLineMeshMaterialType.MATERIAL_TYPE_SIMPLE:\r\n material = new GreasedLineSimpleMaterial(name, scene, options);\r\n break;\r\n default:\r\n material = new StandardMaterial(name, scene, true); // Forcing glsl for now\r\n new GreasedLinePluginMaterial(material, scene, options);\r\n break;\r\n }\r\n\r\n return material;\r\n}\r\n\r\n/**\r\n * Creates a GreasedLine mesh\r\n * @param name name of the mesh\r\n * @param options options for the mesh\r\n * @param materialOptions material options for the mesh\r\n * @param scene scene where the mesh will be created\r\n * @returns instance of GreasedLineMesh\r\n */\r\nexport function CreateGreasedLine(name: string, options: GreasedLineMeshBuilderOptions, materialOptions?: Nullable<GreasedLineMaterialBuilderOptions>, scene?: Nullable<Scene>) {\r\n scene = <Scene>(scene ?? EngineStore.LastCreatedScene);\r\n\r\n let instance;\r\n const allPoints = GreasedLineTools.ConvertPoints(options.points, options.pointsOptions);\r\n\r\n options.widthDistribution = options.widthDistribution ?? GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START;\r\n if (options.ribbonOptions) {\r\n options.ribbonOptions.facesMode = options.ribbonOptions.facesMode ?? GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING;\r\n options.ribbonOptions.pointsMode = options.ribbonOptions.pointsMode ?? GreasedLineRibbonPointsMode.POINTS_MODE_POINTS;\r\n options.ribbonOptions.directionsAutoMode =\r\n options.ribbonOptions.directionsAutoMode ??\r\n (options.ribbonOptions.directions ? GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE : GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT);\r\n }\r\n\r\n materialOptions = materialOptions ?? {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n materialOptions.createAndAssignMaterial = materialOptions.createAndAssignMaterial ?? true;\r\n materialOptions.colorDistribution = materialOptions?.colorDistribution ?? GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START;\r\n materialOptions.materialType = materialOptions.materialType ?? GreasedLineMeshMaterialType.MATERIAL_TYPE_STANDARD;\r\n\r\n const pointsCount = GetPointsCount(allPoints);\r\n const widths = CompleteGreasedLineWidthTable(pointsCount, options.widths ?? [], options.widthDistribution);\r\n\r\n const colors = materialOptions?.colors\r\n ? CompleteGreasedLineColorTable(pointsCount, materialOptions.colors, materialOptions.colorDistribution, materialOptions.color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR)\r\n : undefined;\r\n\r\n // create new mesh if instance is not defined\r\n const initialGreasedLineOptions: GreasedLineMeshOptions = {\r\n points: allPoints,\r\n updatable: options.updatable,\r\n widths,\r\n lazy: options.lazy,\r\n ribbonOptions: options.ribbonOptions,\r\n uvs: options.uvs,\r\n colorPointers: options.colorPointers,\r\n };\r\n\r\n if (initialGreasedLineOptions.ribbonOptions) {\r\n if (initialGreasedLineOptions.ribbonOptions.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n initialGreasedLineOptions.ribbonOptions.width = materialOptions.width ?? initialGreasedLineOptions.ribbonOptions.width ?? GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n }\r\n }\r\n\r\n if (!options.instance) {\r\n instance = initialGreasedLineOptions.ribbonOptions\r\n ? new GreasedLineRibbonMesh(name, scene, initialGreasedLineOptions)\r\n : new GreasedLineMesh(name, scene, initialGreasedLineOptions);\r\n\r\n if (materialOptions) {\r\n const initialMaterialOptions: GreasedLineMaterialOptions = {\r\n materialType: materialOptions.materialType,\r\n dashCount: materialOptions.dashCount,\r\n dashOffset: materialOptions.dashOffset,\r\n dashRatio: materialOptions.dashRatio,\r\n resolution: materialOptions.resolution,\r\n sizeAttenuation: materialOptions.sizeAttenuation,\r\n useColors: materialOptions.useColors,\r\n useDash: materialOptions.useDash,\r\n visibility: materialOptions.visibility,\r\n width: materialOptions.width,\r\n color: materialOptions.color,\r\n colorMode: materialOptions.colorMode,\r\n colorsSampling: materialOptions.colorsSampling,\r\n colorDistributionType: materialOptions.colorDistributionType,\r\n colors,\r\n cameraFacing: !options.ribbonOptions,\r\n colorsTexture: materialOptions.colorsTexture,\r\n };\r\n\r\n if (materialOptions.createAndAssignMaterial) {\r\n const material = CreateGreasedLineMaterial(name, initialMaterialOptions, scene);\r\n instance.material = material;\r\n\r\n if (options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING) {\r\n material.backFaceCulling = false;\r\n }\r\n }\r\n }\r\n } else {\r\n // update the data on the mesh instance\r\n instance = options.instance;\r\n if (instance instanceof GreasedLineRibbonMesh) {\r\n instance.addPoints(allPoints, initialGreasedLineOptions);\r\n } else {\r\n // add widths\r\n const currentWidths = instance.widths;\r\n if (currentWidths) {\r\n const newWidths = currentWidths.slice();\r\n for (const w of widths) {\r\n newWidths.push(w);\r\n }\r\n instance.widths = newWidths;\r\n } else {\r\n instance.widths = widths;\r\n }\r\n\r\n instance.addPoints(allPoints);\r\n\r\n // add UVs\r\n if (options.uvs) {\r\n const currentUVs = instance.uvs;\r\n if (currentUVs) {\r\n const newUVs = new Float32Array(currentUVs.length + options.uvs.length);\r\n newUVs.set(currentUVs, 0);\r\n newUVs.set(options.uvs, currentUVs.length);\r\n instance.uvs = newUVs;\r\n } else {\r\n instance.uvs = options.uvs;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // add colors\r\n // it will merge if any colors already on the instance\r\n if (colors && options.instance) {\r\n if (options.instance.greasedLineMaterial) {\r\n const currentColors = options.instance.greasedLineMaterial.colors;\r\n if (currentColors) {\r\n const newColors = currentColors.concat(colors);\r\n options.instance.greasedLineMaterial.setColors(newColors, instance.isLazy());\r\n }\r\n }\r\n }\r\n\r\n return instance;\r\n}\r\n\r\n/**\r\n * Counts the number of points\r\n * @param allPoints Array of points [[x, y, z], [x, y, z], ...] or Array of points [x, y, z, x, y, z, ...]\r\n * @returns total number of points\r\n */\r\nexport function GetPointsCount(allPoints: number[][]) {\r\n let pointCount = 0;\r\n for (const points of allPoints) {\r\n pointCount += (<number[]>points).length / 3;\r\n }\r\n return pointCount;\r\n}\r\n\r\n/**\r\n * Completes the width table/fills the missing entries. It means it creates a width entry for every point of the line mesh.\r\n * You can provide more points the widths when creating the mesh. This function will fill the empty entries.\r\n * The algorithm used to fill the empty entries can be\r\n * GreasedLineMeshWidthDistribution.REPEAT - the width table will be repeatedly copied to the empty values [wL, wU] = [wL, wU, wL, wU, wL, wU, wL, wU, ...]\r\n * GreasedLineMeshWidthDistribution.EVEN - the width table will be evenly copied to the empty values [wL, wU] = [wL, wL, wL, wL, wU, wU, wU, wU]\r\n * GreasedLineMeshWidthDistribution.START - the width table will be copied at the start of the empty values\r\n * and rest will be filled width the default width upper and default width lower values [wU, wL] = [wL, wU, dwL, dwU, dwL, dwU, dwL, dwU]\r\n * GreasedLineMeshWidthDistribution.END - the width table will be copied at the end of the empty values\r\n * and rest will be filled width the default values [wL, wU] = [wL, wU, dwL, dwU, dwL, dwU, wL, wU]\r\n * @param pointCount number of points of the line mesh\r\n * @param widths array of widths [widhtLower, widthUpper, widthLower, widthUpper ...]. Two widths (lower/upper) per point.\r\n * @param widthsDistribution how to distribute widths if the widths array has fewer entries than pointCount\r\n * @param defaultWidthUpper the default value which will be used to fill empty width entries - upper width\r\n * @param defaultWidthLower the default value which will be used to fill empty width entries - lower width\r\n * @returns completed width table.\r\n */\r\nexport function CompleteGreasedLineWidthTable(\r\n pointCount: number,\r\n widths: number[],\r\n widthsDistribution: GreasedLineMeshWidthDistribution,\r\n defaultWidthUpper = 1,\r\n defaultWidthLower = 1\r\n): number[] {\r\n const missingCount = pointCount - widths.length / 2;\r\n\r\n const widthsData: number[] = [];\r\n if (missingCount < 0) {\r\n return widths.slice(0, pointCount * 2);\r\n }\r\n\r\n // is the width table shorter than the point table?\r\n if (missingCount > 0) {\r\n if (widths.length % 2 != 0) {\r\n widths.push(defaultWidthUpper);\r\n }\r\n // it is, fill in the missing elements\r\n if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START_END) {\r\n const halfCount = Math.floor(widths.length / 2);\r\n\r\n // start sector\r\n for (let i = 0, j = 0; i < halfCount - 1; i++) {\r\n widthsData.push(widths[j++]);\r\n widthsData.push(widths[j++]);\r\n }\r\n\r\n // middle sector\r\n const widthL = widths[halfCount / 2];\r\n const widthU = widths[halfCount / 2 + 1];\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(widthU);\r\n widthsData.push(widthL);\r\n }\r\n\r\n // end sector\r\n for (let i = halfCount; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START) {\r\n // start sector\r\n for (let i = 0; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(defaultWidthUpper);\r\n widthsData.push(defaultWidthLower);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_END) {\r\n // start sector\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(defaultWidthUpper);\r\n widthsData.push(defaultWidthLower);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_REPEAT) {\r\n let i = 0;\r\n for (let x = 0; x < pointCount; x++) {\r\n widthsData.push(widths[i++]);\r\n widthsData.push(widths[i++]);\r\n\r\n if (i === widths.length) {\r\n i = 0;\r\n }\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_EVEN) {\r\n let j = 0;\r\n const widthsectorLength = widths.length / ((pointCount - 1) * 2);\r\n for (let x = 0; x < pointCount; x++) {\r\n const i = Math.floor(j);\r\n\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n\r\n j += widthsectorLength;\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < widths.length; i++) {\r\n widthsData.push(widths[i]);\r\n }\r\n }\r\n\r\n return widthsData;\r\n}\r\n\r\n/**\r\n * Completes the color table/fill the missing color entries. It means it creates a color entry for every point of the line mesh.\r\n * You can provide more points the colors when creating the mesh. This function will fill the empty entries.\r\n * The algorithm used to fill the empty entries can be\r\n * GreasedLineMesColorhDistribution.REPEAT - the color table will be repeatedly copied to the empty values [c1, c2] = [c1, c2, c1, c2, c1, c2, c1, c2]\r\n * GreasedLineMesColorhDistribution.EVEN - the color table will be evenly copied to the empty values [c1, c2] = [c1, c1, c1, c1, c2, c2, c2, c2]\r\n * GreasedLineMesColorhDistribution.START - the color table will be copied at the start of the empty values\r\n * and rest will be filled color the default color value [c1, c2] = [c1, c2, dc, dc, dc, dc, dc, dc]\r\n * GreasedLineMesColorhDistribution.START_END - the color table will be copied at the start and the end of the empty values\r\n * and rest will be filled color the default color value [c1, c2] = [c1, c2, dc, dc, dc, dc, c1, c2]\r\n * @param pointCount number of points of the line mesh\r\n * @param colors array of Color3 for the color table\r\n * @param colorDistribution how to distribute colors if the colors array has fewer entries than pointCount\r\n * @param defaultColor default color to be used to fill empty entries in the color table\r\n * @returns completed array of Color3s\r\n */\r\nexport function CompleteGreasedLineColorTable(pointCount: number, colors: Color3[], colorDistribution: GreasedLineMeshColorDistribution, defaultColor: Color3): Color3[] {\r\n pointCount = Math.max(colors.length, pointCount);\r\n const missingCount = pointCount - colors.length;\r\n if (missingCount < 0) {\r\n return colors.slice(0, pointCount);\r\n }\r\n\r\n const colorsData: Color3[] = [];\r\n // is the color table shorter than the point table?\r\n if (missingCount > 0) {\r\n // it is, fill in the missing elements\r\n if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START_END) {\r\n const halfCount = Math.floor(colors.length / 2);\r\n\r\n // start sector\r\n for (let i = 0; i < halfCount; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n\r\n // middle sector\r\n for (let i = 0; i < missingCount - 1; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n\r\n // end sector\r\n for (let i = halfCount; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START) {\r\n // start sector\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < missingCount; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_END) {\r\n // start sector\r\n for (let i = 0; i < missingCount - 1; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_REPEAT) {\r\n let i = 0;\r\n for (let x = 0; x < pointCount; x++) {\r\n colorsData.push(colors[i]);\r\n\r\n i++;\r\n\r\n if (i === colors.length) {\r\n i = 0;\r\n }\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_EVEN) {\r\n let j = 0;\r\n const colorSectorLength = colors.length / (pointCount - 1);\r\n for (let x = 0; x < pointCount - 1; x++) {\r\n const i = Math.floor(j);\r\n\r\n colorsData.push(colors[i]);\r\n\r\n j += colorSectorLength;\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_NONE) {\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < pointCount; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n }\r\n\r\n return colorsData;\r\n}\r\n"]}
@@ -15,6 +15,7 @@ import type { Nullable } from "../../types";
15
15
  * @returns the VertexData of the Ground
16
16
  */
17
17
  export declare function CreateGroundVertexData(options: {
18
+ size?: number;
18
19
  width?: number;
19
20
  height?: number;
20
21
  subdivisions?: number;
@@ -23,8 +23,8 @@ export function CreateGroundVertexData(options) {
23
23
  const normals = [];
24
24
  const uvs = [];
25
25
  let row, col;
26
- const width = options.width || 1;
27
- const height = options.height || 1;
26
+ const width = options.width || options.size || 1;
27
+ const height = options.height || options.size || 1;
28
28
  const subdivisionsX = (options.subdivisionsX || options.subdivisions || 1) | 0;
29
29
  const subdivisionsY = (options.subdivisionsY || options.subdivisions || 1) | 0;
30
30
  for (row = 0; row <= subdivisionsY; row++) {
@@ -1 +1 @@
1
- {"version":3,"file":"groundBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/groundBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB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AG,CAAC,IAAY,EAAE,KAAa,EAAE,MAAc,EAAE,YAAoB,EAAE,KAAa,EAAE,SAAmB,EAAQ,EAAE;IAChI,MAAM,OAAO,GAAG;QACZ,KAAK;QACL,MAAM;QACN,YAAY;QACZ,SAAS;KACZ,CAAC;IAEF,OAAO,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,IAAI,CAAC,iBAAiB,GAAG,CACrB,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,YAAsC,EACtC,SAAmC,EACnC,KAAY,EACZ,SAAmB,EACf,EAAE;IACN,MAAM,OAAO,GAAG;QACZ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,YAAY;QACZ,SAAS;QACT,SAAS;KACZ,CAAC;IAEF,OAAO,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,IAAI,CAAC,yBAAyB,GAAG,CAC7B,IAAY,EACZ,GAAW,EACX,KAAa,EACb,MAAc,EACd,YAAoB,EACpB,SAAiB,EACjB,SAAiB,EACjB,KAAY,EACZ,SAAmB,EACnB,OAAoC,EACpC,WAAoB,EACV,EAAE;IACZ,MAAM,OAAO,GAAG;QACZ,KAAK;QACL,MAAM;QACN,YAAY;QACZ,SAAS;QACT,SAAS;QACT,SAAS;QACT,OAAO;QACP,WAAW;KACd,CAAC;IAEF,OAAO,yBAAyB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAChE,CAAC,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { GroundMesh } from \"../groundMesh\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport { Epsilon } from \"../../Maths/math.constants\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a Ground\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * @param options.width the width (x direction) of the ground, optional, default 1\r\n * @param options.height the height (z direction) of the ground, optional, default 1\r\n * @param options.subdivisions the number of subdivisions per side, optional, default 1\r\n * @param options.subdivisionsX the number of subdivisions in the x direction, overrides options.subdivisions, optional, default undefined\r\n * @param options.subdivisionsY the number of subdivisions in the y direction, overrides options.subdivisions, optional, default undefined\r\n * @returns the VertexData of the Ground\r\n */\r\nexport function CreateGroundVertexData(options: { width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number }): VertexData {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n let row: number, col: number;\r\n\r\n const width: number = options.width || 1;\r\n const height: number = options.height || 1;\r\n const subdivisionsX: number = (options.subdivisionsX || options.subdivisions || 1) | 0;\r\n const subdivisionsY: number = (options.subdivisionsY || options.subdivisions || 1) | 0;\r\n\r\n for (row = 0; row <= subdivisionsY; row++) {\r\n for (col = 0; col <= subdivisionsX; col++) {\r\n const position = new Vector3((col * width) / subdivisionsX - width / 2.0, 0, ((subdivisionsY - row) * height) / subdivisionsY - height / 2.0);\r\n const normal = new Vector3(0, 1.0, 0);\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / subdivisionsX, useOpenGLOrientationForUV ? row / subdivisionsY : 1.0 - row / subdivisionsY);\r\n }\r\n }\r\n\r\n for (row = 0; row < subdivisionsY; row++) {\r\n for (col = 0; col < subdivisionsX; col++) {\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + row * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n\r\n indices.push(col + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the VertexData for a TiledGround by subdividing the ground into tiles\r\n * @param options an object used to set the following optional parameters for the Ground\r\n * @param options.xmin ground minimum X coordinate, default -1\r\n * @param options.zmin ground minimum Z coordinate, default -1\r\n * @param options.xmax ground maximum X coordinate, default 1\r\n * @param options.zmax ground maximum Z coordinate, default 1\r\n * @param options.subdivisions a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default {w: 6, h: 6}\r\n * @param options.subdivisions.w positive integer, default 6\r\n * @param options.subdivisions.h positive integer, default 6\r\n * @param options.precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}\r\n * @param options.precision.w positive integer, default 2\r\n * @param options.precision.h positive integer, default 2\r\n * @returns the VertexData of the TiledGround\r\n */\r\nexport function CreateTiledGroundVertexData(options: {\r\n xmin: number;\r\n zmin: number;\r\n xmax: number;\r\n zmax: number;\r\n subdivisions?: { w: number; h: number };\r\n precision?: { w: number; h: number };\r\n}): VertexData {\r\n const xmin = options.xmin !== undefined && options.xmin !== null ? options.xmin : -1.0;\r\n const zmin = options.zmin !== undefined && options.zmin !== null ? options.zmin : -1.0;\r\n const xmax = options.xmax !== undefined && options.xmax !== null ? options.xmax : 1.0;\r\n const zmax = options.zmax !== undefined && options.zmax !== null ? options.zmax : 1.0;\r\n const subdivisions = options.subdivisions || { w: 1, h: 1 };\r\n const precision = options.precision || { w: 1, h: 1 };\r\n\r\n const indices: number[] = [];\r\n const positions: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: number[] = [];\r\n let row: number, col: number, tileRow: number, tileCol: number;\r\n\r\n subdivisions.h = subdivisions.h < 1 ? 1 : subdivisions.h;\r\n subdivisions.w = subdivisions.w < 1 ? 1 : subdivisions.w;\r\n precision.w = precision.w < 1 ? 1 : precision.w;\r\n precision.h = precision.h < 1 ? 1 : precision.h;\r\n\r\n const tileSize = {\r\n w: (xmax - xmin) / subdivisions.w,\r\n h: (zmax - zmin) / subdivisions.h,\r\n };\r\n\r\n function applyTile(xTileMin: number, zTileMin: number, xTileMax: number, zTileMax: number) {\r\n // Indices\r\n const base = positions.length / 3;\r\n const rowLength = precision.w + 1;\r\n for (row = 0; row < precision.h; row++) {\r\n for (col = 0; col < precision.w; col++) {\r\n const square = [base + col + row * rowLength, base + (col + 1) + row * rowLength, base + (col + 1) + (row + 1) * rowLength, base + col + (row + 1) * rowLength];\r\n\r\n indices.push(square[1]);\r\n indices.push(square[2]);\r\n indices.push(square[3]);\r\n indices.push(square[0]);\r\n indices.push(square[1]);\r\n indices.push(square[3]);\r\n }\r\n }\r\n\r\n // Position, normals and uvs\r\n const position = Vector3.Zero();\r\n const normal = new Vector3(0, 1.0, 0);\r\n for (row = 0; row <= precision.h; row++) {\r\n position.z = (row * (zTileMax - zTileMin)) / precision.h + zTileMin;\r\n for (col = 0; col <= precision.w; col++) {\r\n position.x = (col * (xTileMax - xTileMin)) / precision.w + xTileMin;\r\n position.y = 0;\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / precision.w, row / precision.h);\r\n }\r\n }\r\n }\r\n\r\n for (tileRow = 0; tileRow < subdivisions.h; tileRow++) {\r\n for (tileCol = 0; tileCol < subdivisions.w; tileCol++) {\r\n applyTile(xmin + tileCol * tileSize.w, zmin + tileRow * tileSize.h, xmin + (tileCol + 1) * tileSize.w, zmin + (tileRow + 1) * tileSize.h);\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the VertexData of the Ground designed from a heightmap\r\n * @param options an object used to set the following parameters for the Ground, required and provided by CreateGroundFromHeightMap\r\n * @param options.width the width (x direction) of the ground\r\n * @param options.height the height (z direction) of the ground\r\n * @param options.subdivisions the number of subdivisions per side\r\n * @param options.minHeight the minimum altitude on the ground, optional, default 0\r\n * @param options.maxHeight the maximum altitude on the ground, optional default 1\r\n * @param options.colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)\r\n * @param options.buffer the array holding the image color data\r\n * @param options.bufferWidth the width of image\r\n * @param options.bufferHeight the height of image\r\n * @param options.alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @param options.heightBuffer a array of floats where the height data can be saved, if its length is greater than zero.\r\n * @returns the VertexData of the Ground designed from a heightmap\r\n */\r\nexport function CreateGroundFromHeightMapVertexData(options: {\r\n width: number;\r\n height: number;\r\n subdivisions: number;\r\n minHeight: number;\r\n maxHeight: number;\r\n colorFilter: Color3;\r\n buffer: Uint8Array;\r\n bufferWidth: number;\r\n bufferHeight: number;\r\n alphaFilter: number;\r\n heightBuffer?: Float32Array;\r\n}): VertexData {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n let row, col;\r\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\r\n const alphaFilter = options.alphaFilter || 0.0;\r\n let invert = false;\r\n\r\n if (options.minHeight > options.maxHeight) {\r\n invert = true;\r\n const temp = options.maxHeight;\r\n options.maxHeight = options.minHeight;\r\n options.minHeight = temp;\r\n }\r\n\r\n // Vertices\r\n for (row = 0; row <= options.subdivisions; row++) {\r\n for (col = 0; col <= options.subdivisions; col++) {\r\n const position = new Vector3(\r\n (col * options.width) / options.subdivisions - options.width / 2.0,\r\n 0,\r\n ((options.subdivisions - row) * options.height) / options.subdivisions - options.height / 2.0\r\n );\r\n\r\n // Compute height\r\n const heightMapX = (((position.x + options.width / 2) / options.width) * (options.bufferWidth - 1)) | 0;\r\n const heightMapY = ((1.0 - (position.z + options.height / 2) / options.height) * (options.bufferHeight - 1)) | 0;\r\n const pos = (heightMapX + heightMapY * options.bufferWidth) * 4;\r\n let r = options.buffer[pos] / 255.0;\r\n let g = options.buffer[pos + 1] / 255.0;\r\n let b = options.buffer[pos + 2] / 255.0;\r\n const a = options.buffer[pos + 3] / 255.0;\r\n\r\n if (invert) {\r\n r = 1.0 - r;\r\n g = 1.0 - g;\r\n b = 1.0 - b;\r\n }\r\n\r\n const gradient = r * filter.r + g * filter.g + b * filter.b;\r\n\r\n // If our alpha channel is not within our filter then we will assign a 'special' height\r\n // Then when building the indices, we will ignore any vertex that is using the special height\r\n if (a >= alphaFilter) {\r\n position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;\r\n } else {\r\n position.y = options.minHeight - Epsilon; // We can't have a height below minHeight, normally.\r\n }\r\n if (options.heightBuffer) {\r\n // set the height buffer information in row major order.\r\n options.heightBuffer[row * (options.subdivisions + 1) + col] = position.y;\r\n }\r\n\r\n // Add vertex\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(0, 0, 0);\r\n uvs.push(col / options.subdivisions, 1.0 - row / options.subdivisions);\r\n }\r\n }\r\n\r\n // Indices\r\n for (row = 0; row < options.subdivisions; row++) {\r\n for (col = 0; col < options.subdivisions; col++) {\r\n // Calculate Indices\r\n const idx1 = col + 1 + (row + 1) * (options.subdivisions + 1);\r\n const idx2 = col + 1 + row * (options.subdivisions + 1);\r\n const idx3 = col + row * (options.subdivisions + 1);\r\n const idx4 = col + (row + 1) * (options.subdivisions + 1);\r\n\r\n // Check that all indices are visible (based on our special height)\r\n // Only display the vertex if all Indices are visible\r\n // Positions are stored x,y,z for each vertex, hence the * 3 and + 1 for height\r\n const isVisibleIdx1 = positions[idx1 * 3 + 1] >= options.minHeight;\r\n const isVisibleIdx2 = positions[idx2 * 3 + 1] >= options.minHeight;\r\n const isVisibleIdx3 = positions[idx3 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx1 && isVisibleIdx2 && isVisibleIdx3) {\r\n indices.push(idx1);\r\n indices.push(idx2);\r\n indices.push(idx3);\r\n }\r\n\r\n const isVisibleIdx4 = positions[idx4 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx4 && isVisibleIdx1 && isVisibleIdx3) {\r\n indices.push(idx4);\r\n indices.push(idx1);\r\n indices.push(idx3);\r\n }\r\n }\r\n }\r\n\r\n // Normals\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a ground mesh\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 options.width set the width size (float, default 1)\r\n * @param options.height set the height size (float, default 1)\r\n * @param options.subdivisions sets the number of subdivision per side (default 1)\r\n * @param options.subdivisionsX sets the number of subdivision on the X axis (overrides subdivisions)\r\n * @param options.subdivisionsY sets the number of subdivision on the Y axis (overrides subdivisions)\r\n * @param options.updatable defines if the mesh must be flagged as updatable (default false)\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground\r\n */\r\nexport function CreateGround(\r\n name: string,\r\n options: { width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number; updatable?: boolean } = {},\r\n scene?: Scene\r\n): GroundMesh {\r\n const ground = new GroundMesh(name, scene);\r\n ground._setReady(false);\r\n ground._subdivisionsX = options.subdivisionsX || options.subdivisions || 1;\r\n ground._subdivisionsY = options.subdivisionsY || options.subdivisions || 1;\r\n ground._width = options.width || 1;\r\n ground._height = options.height || 1;\r\n ground._maxX = ground._width / 2;\r\n ground._maxZ = ground._height / 2;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n\r\n const vertexData = CreateGroundVertexData(options);\r\n\r\n vertexData.applyToMesh(ground, options.updatable);\r\n\r\n ground._setReady(true);\r\n\r\n return ground;\r\n}\r\n\r\n/**\r\n * Creates a tiled ground mesh\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 options.xmin ground minimum X coordinate (float, default -1)\r\n * @param options.zmin ground minimum Z coordinate (float, default -1)\r\n * @param options.xmax ground maximum X coordinate (float, default 1)\r\n * @param options.zmax ground maximum Z coordinate (float, default 1)\r\n * @param options.subdivisions a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * @param options.subdivisions.w positive integer, default 6\r\n * @param options.subdivisions.h positive integer, default 6\r\n * @param options.precision a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * @param options.precision.w positive integer, default 2\r\n * @param options.precision.h positive integer, default 2\r\n * @param options.updatable boolean, default false, true if the mesh must be flagged as updatable\r\n * @param scene defines the hosting scene\r\n * @returns the tiled ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tiled-ground\r\n */\r\nexport function CreateTiledGround(\r\n name: string,\r\n options: { xmin: number; zmin: number; xmax: number; zmax: number; subdivisions?: { w: number; h: number }; precision?: { w: number; h: number }; updatable?: boolean },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const tiledGround = new Mesh(name, scene);\r\n\r\n const vertexData = CreateTiledGroundVertexData(options);\r\n\r\n vertexData.applyToMesh(tiledGround, options.updatable);\r\n\r\n return tiledGround;\r\n}\r\n\r\n/**\r\n * Creates a ground mesh from a height map. The height map download can take some frames,\r\n * so the mesh is not immediately ready. To wait for the mesh to be completely built,\r\n * you should use the `onReady` callback option.\r\n * @param name defines the name of the mesh\r\n * @param url sets the URL of the height map image resource.\r\n * @param options defines the options used to create the mesh\r\n * @param options.width sets the ground width size (positive float, default 10)\r\n * @param options.height sets the ground height size (positive float, default 10)\r\n * @param options.subdivisions sets the number of subdivision per side (positive integer, default 1)\r\n * @param options.minHeight is the minimum altitude on the ground (float, default 0)\r\n * @param options.maxHeight is the maximum altitude on the ground (float, default 1)\r\n * @param options.colorFilter is the filter to apply to the image pixel colors to compute the height (optional Color3, default (0.3, 0.59, 0.11) )\r\n * @param options.alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @param options.updatable defines if the mesh must be flagged as updatable\r\n * @param options.onReady is a javascript callback function that will be called once the mesh is just built (the height map download can last some time)\r\n * @param options.onError is a javascript callback function that will be called if there is an error\r\n * @param options.passHeightBufferInCallback a boolean that indicates if the calculated height data will be passed in the onReady callback. Useful if you need the height data for physics, for example.\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground-from-a-height-map\r\n */\r\nexport function CreateGroundFromHeightMap(\r\n name: string,\r\n url: string | { data: Uint8Array; width: number; height: number },\r\n options: {\r\n width?: number;\r\n height?: number;\r\n subdivisions?: number;\r\n minHeight?: number;\r\n maxHeight?: number;\r\n colorFilter?: Color3;\r\n alphaFilter?: number;\r\n updatable?: boolean;\r\n onReady?: (mesh: GroundMesh, heightBuffer?: Float32Array) => void;\r\n onError?: (message?: string, exception?: any) => void;\r\n passHeightBufferInCallback?: boolean;\r\n } = {},\r\n scene: Nullable<Scene> = null\r\n): GroundMesh {\r\n const width = options.width || 10.0;\r\n const height = options.height || 10.0;\r\n const subdivisions = options.subdivisions || 1 | 0;\r\n const minHeight = options.minHeight || 0.0;\r\n const maxHeight = options.maxHeight || 1.0;\r\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\r\n const alphaFilter = options.alphaFilter || 0.0;\r\n const updatable = options.updatable;\r\n const onReady = options.onReady;\r\n\r\n scene = scene || EngineStore.LastCreatedScene!;\r\n\r\n const ground = new GroundMesh(name, scene);\r\n ground._subdivisionsX = subdivisions;\r\n ground._subdivisionsY = subdivisions;\r\n ground._width = width;\r\n ground._height = height;\r\n ground._maxX = ground._width / 2.0;\r\n ground._maxZ = ground._height / 2.0;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n\r\n ground._setReady(false);\r\n\r\n let heightBuffer: Float32Array;\r\n if (options.passHeightBufferInCallback) {\r\n heightBuffer = new Float32Array((subdivisions + 1) * (subdivisions + 1));\r\n }\r\n\r\n const onBufferLoaded = (buffer: Uint8Array, bufferWidth: number, bufferHeight: number) => {\r\n const vertexData = CreateGroundFromHeightMapVertexData({\r\n width: width,\r\n height: height,\r\n subdivisions: subdivisions,\r\n minHeight: minHeight,\r\n maxHeight: maxHeight,\r\n colorFilter: filter,\r\n buffer: buffer,\r\n bufferWidth: bufferWidth,\r\n bufferHeight: bufferHeight,\r\n alphaFilter: alphaFilter,\r\n heightBuffer,\r\n });\r\n\r\n vertexData.applyToMesh(ground, updatable);\r\n\r\n //execute ready callback, if set\r\n if (onReady) {\r\n onReady(ground, heightBuffer);\r\n }\r\n\r\n ground._setReady(true);\r\n };\r\n\r\n if (typeof url === \"string\") {\r\n const onload = (img: HTMLImageElement | ImageBitmap) => {\r\n const bufferWidth = img.width;\r\n const bufferHeight = img.height;\r\n\r\n if (scene!.isDisposed) {\r\n return;\r\n }\r\n\r\n const buffer = <Uint8Array>scene?.getEngine().resizeImageBitmap(img, bufferWidth, bufferHeight);\r\n\r\n onBufferLoaded(buffer, bufferWidth, bufferHeight);\r\n };\r\n\r\n Tools.LoadImage(url, onload, options.onError ? options.onError : () => {}, scene.offlineProvider);\r\n } else {\r\n onBufferLoaded(url.data, url.width, url.height);\r\n }\r\n\r\n return ground;\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the functions directly from the module\r\n */\r\nexport const GroundBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateGround,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateGroundFromHeightMap,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTiledGround,\r\n};\r\n\r\nVertexData.CreateGround = CreateGroundVertexData;\r\nVertexData.CreateTiledGround = CreateTiledGroundVertexData;\r\nVertexData.CreateGroundFromHeightMap = CreateGroundFromHeightMapVertexData;\r\n\r\nMesh.CreateGround = (name: string, width: number, height: number, subdivisions: number, scene?: Scene, updatable?: boolean): Mesh => {\r\n const options = {\r\n width,\r\n height,\r\n subdivisions,\r\n updatable,\r\n };\r\n\r\n return CreateGround(name, options, scene);\r\n};\r\n\r\nMesh.CreateTiledGround = (\r\n name: string,\r\n xmin: number,\r\n zmin: number,\r\n xmax: number,\r\n zmax: number,\r\n subdivisions: { w: number; h: number },\r\n precision: { w: number; h: number },\r\n scene: Scene,\r\n updatable?: boolean\r\n): Mesh => {\r\n const options = {\r\n xmin,\r\n zmin,\r\n xmax,\r\n zmax,\r\n subdivisions,\r\n precision,\r\n updatable,\r\n };\r\n\r\n return CreateTiledGround(name, options, scene);\r\n};\r\n\r\nMesh.CreateGroundFromHeightMap = (\r\n name: string,\r\n url: string,\r\n width: number,\r\n height: number,\r\n subdivisions: number,\r\n minHeight: number,\r\n maxHeight: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n onReady?: (mesh: GroundMesh) => void,\r\n alphaFilter?: number\r\n): GroundMesh => {\r\n const options = {\r\n width,\r\n height,\r\n subdivisions,\r\n minHeight,\r\n maxHeight,\r\n updatable,\r\n onReady,\r\n alphaFilter,\r\n };\r\n\r\n return CreateGroundFromHeightMap(name, url, options, scene);\r\n};\r\n"]}
1
+ {"version":3,"file":"groundBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders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AAU,CAAC,iBAAiB,GAAG,2BAA2B,CAAC;AAC3D,UAAU,CAAC,yBAAyB,GAAG,mCAAmC,CAAC;AAE3E,IAAI,CAAC,YAAY,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,MAAc,EAAE,YAAoB,EAAE,KAAa,EAAE,SAAmB,EAAQ,EAAE;IAChI,MAAM,OAAO,GAAG;QACZ,KAAK;QACL,MAAM;QACN,YAAY;QACZ,SAAS;KACZ,CAAC;IAEF,OAAO,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,IAAI,CAAC,iBAAiB,GAAG,CACrB,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,YAAsC,EACtC,SAAmC,EACnC,KAAY,EACZ,SAAmB,EACf,EAAE;IACN,MAAM,OAAO,GAAG;QACZ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,YAAY;QACZ,SAAS;QACT,SAAS;KACZ,CAAC;IAEF,OAAO,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,IAAI,CAAC,yBAAyB,GAAG,CAC7B,IAAY,EACZ,GAAW,EACX,KAAa,EACb,MAAc,EACd,YAAoB,EACpB,SAAiB,EACjB,SAAiB,EACjB,KAAY,EACZ,SAAmB,EACnB,OAAoC,EACpC,WAAoB,EACV,EAAE;IACZ,MAAM,OAAO,GAAG;QACZ,KAAK;QACL,MAAM;QACN,YAAY;QACZ,SAAS;QACT,SAAS;QACT,SAAS;QACT,OAAO;QACP,WAAW;KACd,CAAC;IAEF,OAAO,yBAAyB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAChE,CAAC,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { GroundMesh } from \"../groundMesh\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport { Epsilon } from \"../../Maths/math.constants\";\r\nimport { useOpenGLOrientationForUV } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a Ground\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * @param options.width the width (x direction) of the ground, optional, default 1\r\n * @param options.height the height (z direction) of the ground, optional, default 1\r\n * @param options.subdivisions the number of subdivisions per side, optional, default 1\r\n * @param options.subdivisionsX the number of subdivisions in the x direction, overrides options.subdivisions, optional, default undefined\r\n * @param options.subdivisionsY the number of subdivisions in the y direction, overrides options.subdivisions, optional, default undefined\r\n * @returns the VertexData of the Ground\r\n */\r\nexport function CreateGroundVertexData(options: {\r\n size?: number;\r\n width?: number;\r\n height?: number;\r\n subdivisions?: number;\r\n subdivisionsX?: number;\r\n subdivisionsY?: number;\r\n}): VertexData {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n let row: number, col: number;\r\n\r\n const width: number = options.width || options.size || 1;\r\n const height: number = options.height || options.size || 1;\r\n const subdivisionsX: number = (options.subdivisionsX || options.subdivisions || 1) | 0;\r\n const subdivisionsY: number = (options.subdivisionsY || options.subdivisions || 1) | 0;\r\n\r\n for (row = 0; row <= subdivisionsY; row++) {\r\n for (col = 0; col <= subdivisionsX; col++) {\r\n const position = new Vector3((col * width) / subdivisionsX - width / 2.0, 0, ((subdivisionsY - row) * height) / subdivisionsY - height / 2.0);\r\n const normal = new Vector3(0, 1.0, 0);\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / subdivisionsX, useOpenGLOrientationForUV ? row / subdivisionsY : 1.0 - row / subdivisionsY);\r\n }\r\n }\r\n\r\n for (row = 0; row < subdivisionsY; row++) {\r\n for (col = 0; col < subdivisionsX; col++) {\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + row * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n\r\n indices.push(col + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the VertexData for a TiledGround by subdividing the ground into tiles\r\n * @param options an object used to set the following optional parameters for the Ground\r\n * @param options.xmin ground minimum X coordinate, default -1\r\n * @param options.zmin ground minimum Z coordinate, default -1\r\n * @param options.xmax ground maximum X coordinate, default 1\r\n * @param options.zmax ground maximum Z coordinate, default 1\r\n * @param options.subdivisions a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default {w: 6, h: 6}\r\n * @param options.subdivisions.w positive integer, default 6\r\n * @param options.subdivisions.h positive integer, default 6\r\n * @param options.precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}\r\n * @param options.precision.w positive integer, default 2\r\n * @param options.precision.h positive integer, default 2\r\n * @returns the VertexData of the TiledGround\r\n */\r\nexport function CreateTiledGroundVertexData(options: {\r\n xmin: number;\r\n zmin: number;\r\n xmax: number;\r\n zmax: number;\r\n subdivisions?: { w: number; h: number };\r\n precision?: { w: number; h: number };\r\n}): VertexData {\r\n const xmin = options.xmin !== undefined && options.xmin !== null ? options.xmin : -1.0;\r\n const zmin = options.zmin !== undefined && options.zmin !== null ? options.zmin : -1.0;\r\n const xmax = options.xmax !== undefined && options.xmax !== null ? options.xmax : 1.0;\r\n const zmax = options.zmax !== undefined && options.zmax !== null ? options.zmax : 1.0;\r\n const subdivisions = options.subdivisions || { w: 1, h: 1 };\r\n const precision = options.precision || { w: 1, h: 1 };\r\n\r\n const indices: number[] = [];\r\n const positions: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: number[] = [];\r\n let row: number, col: number, tileRow: number, tileCol: number;\r\n\r\n subdivisions.h = subdivisions.h < 1 ? 1 : subdivisions.h;\r\n subdivisions.w = subdivisions.w < 1 ? 1 : subdivisions.w;\r\n precision.w = precision.w < 1 ? 1 : precision.w;\r\n precision.h = precision.h < 1 ? 1 : precision.h;\r\n\r\n const tileSize = {\r\n w: (xmax - xmin) / subdivisions.w,\r\n h: (zmax - zmin) / subdivisions.h,\r\n };\r\n\r\n function applyTile(xTileMin: number, zTileMin: number, xTileMax: number, zTileMax: number) {\r\n // Indices\r\n const base = positions.length / 3;\r\n const rowLength = precision.w + 1;\r\n for (row = 0; row < precision.h; row++) {\r\n for (col = 0; col < precision.w; col++) {\r\n const square = [base + col + row * rowLength, base + (col + 1) + row * rowLength, base + (col + 1) + (row + 1) * rowLength, base + col + (row + 1) * rowLength];\r\n\r\n indices.push(square[1]);\r\n indices.push(square[2]);\r\n indices.push(square[3]);\r\n indices.push(square[0]);\r\n indices.push(square[1]);\r\n indices.push(square[3]);\r\n }\r\n }\r\n\r\n // Position, normals and uvs\r\n const position = Vector3.Zero();\r\n const normal = new Vector3(0, 1.0, 0);\r\n for (row = 0; row <= precision.h; row++) {\r\n position.z = (row * (zTileMax - zTileMin)) / precision.h + zTileMin;\r\n for (col = 0; col <= precision.w; col++) {\r\n position.x = (col * (xTileMax - xTileMin)) / precision.w + xTileMin;\r\n position.y = 0;\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / precision.w, row / precision.h);\r\n }\r\n }\r\n }\r\n\r\n for (tileRow = 0; tileRow < subdivisions.h; tileRow++) {\r\n for (tileCol = 0; tileCol < subdivisions.w; tileCol++) {\r\n applyTile(xmin + tileCol * tileSize.w, zmin + tileRow * tileSize.h, xmin + (tileCol + 1) * tileSize.w, zmin + (tileRow + 1) * tileSize.h);\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the VertexData of the Ground designed from a heightmap\r\n * @param options an object used to set the following parameters for the Ground, required and provided by CreateGroundFromHeightMap\r\n * @param options.width the width (x direction) of the ground\r\n * @param options.height the height (z direction) of the ground\r\n * @param options.subdivisions the number of subdivisions per side\r\n * @param options.minHeight the minimum altitude on the ground, optional, default 0\r\n * @param options.maxHeight the maximum altitude on the ground, optional default 1\r\n * @param options.colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)\r\n * @param options.buffer the array holding the image color data\r\n * @param options.bufferWidth the width of image\r\n * @param options.bufferHeight the height of image\r\n * @param options.alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @param options.heightBuffer a array of floats where the height data can be saved, if its length is greater than zero.\r\n * @returns the VertexData of the Ground designed from a heightmap\r\n */\r\nexport function CreateGroundFromHeightMapVertexData(options: {\r\n width: number;\r\n height: number;\r\n subdivisions: number;\r\n minHeight: number;\r\n maxHeight: number;\r\n colorFilter: Color3;\r\n buffer: Uint8Array;\r\n bufferWidth: number;\r\n bufferHeight: number;\r\n alphaFilter: number;\r\n heightBuffer?: Float32Array;\r\n}): VertexData {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n let row, col;\r\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\r\n const alphaFilter = options.alphaFilter || 0.0;\r\n let invert = false;\r\n\r\n if (options.minHeight > options.maxHeight) {\r\n invert = true;\r\n const temp = options.maxHeight;\r\n options.maxHeight = options.minHeight;\r\n options.minHeight = temp;\r\n }\r\n\r\n // Vertices\r\n for (row = 0; row <= options.subdivisions; row++) {\r\n for (col = 0; col <= options.subdivisions; col++) {\r\n const position = new Vector3(\r\n (col * options.width) / options.subdivisions - options.width / 2.0,\r\n 0,\r\n ((options.subdivisions - row) * options.height) / options.subdivisions - options.height / 2.0\r\n );\r\n\r\n // Compute height\r\n const heightMapX = (((position.x + options.width / 2) / options.width) * (options.bufferWidth - 1)) | 0;\r\n const heightMapY = ((1.0 - (position.z + options.height / 2) / options.height) * (options.bufferHeight - 1)) | 0;\r\n const pos = (heightMapX + heightMapY * options.bufferWidth) * 4;\r\n let r = options.buffer[pos] / 255.0;\r\n let g = options.buffer[pos + 1] / 255.0;\r\n let b = options.buffer[pos + 2] / 255.0;\r\n const a = options.buffer[pos + 3] / 255.0;\r\n\r\n if (invert) {\r\n r = 1.0 - r;\r\n g = 1.0 - g;\r\n b = 1.0 - b;\r\n }\r\n\r\n const gradient = r * filter.r + g * filter.g + b * filter.b;\r\n\r\n // If our alpha channel is not within our filter then we will assign a 'special' height\r\n // Then when building the indices, we will ignore any vertex that is using the special height\r\n if (a >= alphaFilter) {\r\n position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;\r\n } else {\r\n position.y = options.minHeight - Epsilon; // We can't have a height below minHeight, normally.\r\n }\r\n if (options.heightBuffer) {\r\n // set the height buffer information in row major order.\r\n options.heightBuffer[row * (options.subdivisions + 1) + col] = position.y;\r\n }\r\n\r\n // Add vertex\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(0, 0, 0);\r\n uvs.push(col / options.subdivisions, 1.0 - row / options.subdivisions);\r\n }\r\n }\r\n\r\n // Indices\r\n for (row = 0; row < options.subdivisions; row++) {\r\n for (col = 0; col < options.subdivisions; col++) {\r\n // Calculate Indices\r\n const idx1 = col + 1 + (row + 1) * (options.subdivisions + 1);\r\n const idx2 = col + 1 + row * (options.subdivisions + 1);\r\n const idx3 = col + row * (options.subdivisions + 1);\r\n const idx4 = col + (row + 1) * (options.subdivisions + 1);\r\n\r\n // Check that all indices are visible (based on our special height)\r\n // Only display the vertex if all Indices are visible\r\n // Positions are stored x,y,z for each vertex, hence the * 3 and + 1 for height\r\n const isVisibleIdx1 = positions[idx1 * 3 + 1] >= options.minHeight;\r\n const isVisibleIdx2 = positions[idx2 * 3 + 1] >= options.minHeight;\r\n const isVisibleIdx3 = positions[idx3 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx1 && isVisibleIdx2 && isVisibleIdx3) {\r\n indices.push(idx1);\r\n indices.push(idx2);\r\n indices.push(idx3);\r\n }\r\n\r\n const isVisibleIdx4 = positions[idx4 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx4 && isVisibleIdx1 && isVisibleIdx3) {\r\n indices.push(idx4);\r\n indices.push(idx1);\r\n indices.push(idx3);\r\n }\r\n }\r\n }\r\n\r\n // Normals\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a ground mesh\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 options.width set the width size (float, default 1)\r\n * @param options.height set the height size (float, default 1)\r\n * @param options.subdivisions sets the number of subdivision per side (default 1)\r\n * @param options.subdivisionsX sets the number of subdivision on the X axis (overrides subdivisions)\r\n * @param options.subdivisionsY sets the number of subdivision on the Y axis (overrides subdivisions)\r\n * @param options.updatable defines if the mesh must be flagged as updatable (default false)\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground\r\n */\r\nexport function CreateGround(\r\n name: string,\r\n options: { width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number; updatable?: boolean } = {},\r\n scene?: Scene\r\n): GroundMesh {\r\n const ground = new GroundMesh(name, scene);\r\n ground._setReady(false);\r\n ground._subdivisionsX = options.subdivisionsX || options.subdivisions || 1;\r\n ground._subdivisionsY = options.subdivisionsY || options.subdivisions || 1;\r\n ground._width = options.width || 1;\r\n ground._height = options.height || 1;\r\n ground._maxX = ground._width / 2;\r\n ground._maxZ = ground._height / 2;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n\r\n const vertexData = CreateGroundVertexData(options);\r\n\r\n vertexData.applyToMesh(ground, options.updatable);\r\n\r\n ground._setReady(true);\r\n\r\n return ground;\r\n}\r\n\r\n/**\r\n * Creates a tiled ground mesh\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 options.xmin ground minimum X coordinate (float, default -1)\r\n * @param options.zmin ground minimum Z coordinate (float, default -1)\r\n * @param options.xmax ground maximum X coordinate (float, default 1)\r\n * @param options.zmax ground maximum Z coordinate (float, default 1)\r\n * @param options.subdivisions a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * @param options.subdivisions.w positive integer, default 6\r\n * @param options.subdivisions.h positive integer, default 6\r\n * @param options.precision a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * @param options.precision.w positive integer, default 2\r\n * @param options.precision.h positive integer, default 2\r\n * @param options.updatable boolean, default false, true if the mesh must be flagged as updatable\r\n * @param scene defines the hosting scene\r\n * @returns the tiled ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tiled-ground\r\n */\r\nexport function CreateTiledGround(\r\n name: string,\r\n options: { xmin: number; zmin: number; xmax: number; zmax: number; subdivisions?: { w: number; h: number }; precision?: { w: number; h: number }; updatable?: boolean },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const tiledGround = new Mesh(name, scene);\r\n\r\n const vertexData = CreateTiledGroundVertexData(options);\r\n\r\n vertexData.applyToMesh(tiledGround, options.updatable);\r\n\r\n return tiledGround;\r\n}\r\n\r\n/**\r\n * Creates a ground mesh from a height map. The height map download can take some frames,\r\n * so the mesh is not immediately ready. To wait for the mesh to be completely built,\r\n * you should use the `onReady` callback option.\r\n * @param name defines the name of the mesh\r\n * @param url sets the URL of the height map image resource.\r\n * @param options defines the options used to create the mesh\r\n * @param options.width sets the ground width size (positive float, default 10)\r\n * @param options.height sets the ground height size (positive float, default 10)\r\n * @param options.subdivisions sets the number of subdivision per side (positive integer, default 1)\r\n * @param options.minHeight is the minimum altitude on the ground (float, default 0)\r\n * @param options.maxHeight is the maximum altitude on the ground (float, default 1)\r\n * @param options.colorFilter is the filter to apply to the image pixel colors to compute the height (optional Color3, default (0.3, 0.59, 0.11) )\r\n * @param options.alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @param options.updatable defines if the mesh must be flagged as updatable\r\n * @param options.onReady is a javascript callback function that will be called once the mesh is just built (the height map download can last some time)\r\n * @param options.onError is a javascript callback function that will be called if there is an error\r\n * @param options.passHeightBufferInCallback a boolean that indicates if the calculated height data will be passed in the onReady callback. Useful if you need the height data for physics, for example.\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground-from-a-height-map\r\n */\r\nexport function CreateGroundFromHeightMap(\r\n name: string,\r\n url: string | { data: Uint8Array; width: number; height: number },\r\n options: {\r\n width?: number;\r\n height?: number;\r\n subdivisions?: number;\r\n minHeight?: number;\r\n maxHeight?: number;\r\n colorFilter?: Color3;\r\n alphaFilter?: number;\r\n updatable?: boolean;\r\n onReady?: (mesh: GroundMesh, heightBuffer?: Float32Array) => void;\r\n onError?: (message?: string, exception?: any) => void;\r\n passHeightBufferInCallback?: boolean;\r\n } = {},\r\n scene: Nullable<Scene> = null\r\n): GroundMesh {\r\n const width = options.width || 10.0;\r\n const height = options.height || 10.0;\r\n const subdivisions = options.subdivisions || 1 | 0;\r\n const minHeight = options.minHeight || 0.0;\r\n const maxHeight = options.maxHeight || 1.0;\r\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\r\n const alphaFilter = options.alphaFilter || 0.0;\r\n const updatable = options.updatable;\r\n const onReady = options.onReady;\r\n\r\n scene = scene || EngineStore.LastCreatedScene!;\r\n\r\n const ground = new GroundMesh(name, scene);\r\n ground._subdivisionsX = subdivisions;\r\n ground._subdivisionsY = subdivisions;\r\n ground._width = width;\r\n ground._height = height;\r\n ground._maxX = ground._width / 2.0;\r\n ground._maxZ = ground._height / 2.0;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n\r\n ground._setReady(false);\r\n\r\n let heightBuffer: Float32Array;\r\n if (options.passHeightBufferInCallback) {\r\n heightBuffer = new Float32Array((subdivisions + 1) * (subdivisions + 1));\r\n }\r\n\r\n const onBufferLoaded = (buffer: Uint8Array, bufferWidth: number, bufferHeight: number) => {\r\n const vertexData = CreateGroundFromHeightMapVertexData({\r\n width: width,\r\n height: height,\r\n subdivisions: subdivisions,\r\n minHeight: minHeight,\r\n maxHeight: maxHeight,\r\n colorFilter: filter,\r\n buffer: buffer,\r\n bufferWidth: bufferWidth,\r\n bufferHeight: bufferHeight,\r\n alphaFilter: alphaFilter,\r\n heightBuffer,\r\n });\r\n\r\n vertexData.applyToMesh(ground, updatable);\r\n\r\n //execute ready callback, if set\r\n if (onReady) {\r\n onReady(ground, heightBuffer);\r\n }\r\n\r\n ground._setReady(true);\r\n };\r\n\r\n if (typeof url === \"string\") {\r\n const onload = (img: HTMLImageElement | ImageBitmap) => {\r\n const bufferWidth = img.width;\r\n const bufferHeight = img.height;\r\n\r\n if (scene!.isDisposed) {\r\n return;\r\n }\r\n\r\n const buffer = <Uint8Array>scene?.getEngine().resizeImageBitmap(img, bufferWidth, bufferHeight);\r\n\r\n onBufferLoaded(buffer, bufferWidth, bufferHeight);\r\n };\r\n\r\n Tools.LoadImage(url, onload, options.onError ? options.onError : () => {}, scene.offlineProvider);\r\n } else {\r\n onBufferLoaded(url.data, url.width, url.height);\r\n }\r\n\r\n return ground;\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the functions directly from the module\r\n */\r\nexport const GroundBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateGround,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateGroundFromHeightMap,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTiledGround,\r\n};\r\n\r\nVertexData.CreateGround = CreateGroundVertexData;\r\nVertexData.CreateTiledGround = CreateTiledGroundVertexData;\r\nVertexData.CreateGroundFromHeightMap = CreateGroundFromHeightMapVertexData;\r\n\r\nMesh.CreateGround = (name: string, width: number, height: number, subdivisions: number, scene?: Scene, updatable?: boolean): Mesh => {\r\n const options = {\r\n width,\r\n height,\r\n subdivisions,\r\n updatable,\r\n };\r\n\r\n return CreateGround(name, options, scene);\r\n};\r\n\r\nMesh.CreateTiledGround = (\r\n name: string,\r\n xmin: number,\r\n zmin: number,\r\n xmax: number,\r\n zmax: number,\r\n subdivisions: { w: number; h: number },\r\n precision: { w: number; h: number },\r\n scene: Scene,\r\n updatable?: boolean\r\n): Mesh => {\r\n const options = {\r\n xmin,\r\n zmin,\r\n xmax,\r\n zmax,\r\n subdivisions,\r\n precision,\r\n updatable,\r\n };\r\n\r\n return CreateTiledGround(name, options, scene);\r\n};\r\n\r\nMesh.CreateGroundFromHeightMap = (\r\n name: string,\r\n url: string,\r\n width: number,\r\n height: number,\r\n subdivisions: number,\r\n minHeight: number,\r\n maxHeight: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n onReady?: (mesh: GroundMesh) => void,\r\n alphaFilter?: number\r\n): GroundMesh => {\r\n const options = {\r\n width,\r\n height,\r\n subdivisions,\r\n minHeight,\r\n maxHeight,\r\n updatable,\r\n onReady,\r\n alphaFilter,\r\n };\r\n\r\n return CreateGroundFromHeightMap(name, url, options, scene);\r\n};\r\n"]}
@@ -86,7 +86,7 @@ export class GreasedLineBaseMesh extends Mesh {
86
86
  this._updateColorPointers();
87
87
  }
88
88
  this._createVertexBuffers(this._options.ribbonOptions?.smoothShading);
89
- this.refreshBoundingInfo();
89
+ !this.doNotSyncBoundingInfo && this.refreshBoundingInfo();
90
90
  this.greasedLineMaterial?.updateLazy();
91
91
  }
92
92
  /**
@@ -1 +1 @@
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,IAAkB,2BAGjB;AAHD,WAAkB,2BAA2B;IACzC,yGAAsB,CAAA;IACtB,uGAAqB,CAAA;AACzB,CAAC,EAHiB,2BAA2B,KAA3B,2BAA2B,QAG5C;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAkB,0BAIjB;AAJD,WAAkB,0BAA0B;IACxC,iHAA2B,CAAA;IAC3B,yJAA+C,CAAA;IAC/C,iHAA2B,CAAA;AAC/B,CAAC,EAJiB,0BAA0B,KAA1B,0BAA0B,QAI3C;AAED;;;;;;;GAOG;AACH,MAAM,CAAN,IAAkB,kCAMjB;AAND,WAAkB,kCAAkC;IAChD,uJAAsC,CAAA;IACtC,qJAAqC,CAAA;IACrC,mIAA4B,CA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reasedLineMaterial } 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 { AbstractEngine } from \"../../Engines/abstractEngine\";\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 const 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 const 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 const 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: AbstractEngine;\r\n\r\n constructor(\r\n public override 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 override 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 override 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 override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n }\r\n\r\n 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,IAAkB,2BAGjB;AAHD,WAAkB,2BAA2B;IACzC,yGAAsB,CAAA;IACtB,uGAAqB,CAAA;AACzB,CAAC,EAHiB,2BAA2B,KAA3B,2BAA2B,QAG5C;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAkB,0BAIjB;AAJD,WAAkB,0BAA0B;IACxC,iHAA2B,CAAA;IAC3B,yJAA+C,CAAA;IAC/C,iHAA2B,CAAA;AAC/B,CAAC,EAJiB,0BAA0B,KAA1B,0BAA0B,QAI3C;AAED;;;;;;;GAOG;AACH,MAAM,CAAN,IAAkB,kCAMjB;AAND,WAAkB,kCAAkC;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,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 { AbstractEngine } from \"../../Engines/abstractEngine\";\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 const 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 const 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 const 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: AbstractEngine;\r\n\r\n constructor(\r\n public override 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 override 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.doNotSyncBoundingInfo && 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 override 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 override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n }\r\n\r\n 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"]}
@@ -161,7 +161,7 @@ export class GreasedLineMesh extends GreasedLineBaseMesh {
161
161
  this._updateColorPointers();
162
162
  }
163
163
  this._createVertexBuffers();
164
- this.refreshBoundingInfo();
164
+ !this.doNotSyncBoundingInfo && this.refreshBoundingInfo();
165
165
  }
166
166
  }
167
167
  /**