linesBuilder.d.ts 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import { Vector3 } from "../../Maths/math.vector";
  2. import type { Color4 } from "../../Maths/math.color";
  3. import { VertexData } from "../mesh.vertexData";
  4. import type { Nullable } from "../../types";
  5. import { LinesMesh } from "../../Meshes/linesMesh";
  6. import type { Scene } from "../../scene";
  7. import type { Material } from "../../Materials/material";
  8. /**
  9. * Creates the VertexData of the LineSystem
  10. * @param options an object used to set the following optional parameters for the LineSystem, required but can be empty
  11. * - lines an array of lines, each line being an array of successive Vector3
  12. * - colors an array of line colors, each of the line colors being an array of successive Color4, one per line point
  13. * @returns the VertexData of the LineSystem
  14. */
  15. export declare function CreateLineSystemVertexData(options: {
  16. lines: Vector3[][];
  17. colors?: Nullable<Color4[][]>;
  18. }): VertexData;
  19. /**
  20. * Create the VertexData for a DashedLines
  21. * @param options an object used to set the following optional parameters for the DashedLines, required but can be empty
  22. * - points an array successive Vector3
  23. * - dashSize the size of the dashes relative to the dash number, optional, default 3
  24. * - gapSize the size of the gap between two successive dashes relative to the dash number, optional, default 1
  25. * - dashNb the intended total number of dashes, optional, default 200
  26. * @returns the VertexData for the DashedLines
  27. */
  28. export declare function CreateDashedLinesVertexData(options: {
  29. points: Vector3[];
  30. dashSize?: number;
  31. gapSize?: number;
  32. dashNb?: number;
  33. }): VertexData;
  34. /**
  35. * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh
  36. * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter
  37. * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function
  38. * * The parameter `lines` is an array of lines, each line being an array of successive Vector3
  39. * * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter
  40. * * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point
  41. * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)
  42. * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created
  43. * * Updating a simple Line mesh, you just need to update every line in the `lines` array : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#lines-and-dashedlines
  44. * * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines
  45. * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
  46. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#line-system
  47. * @param name defines the name of the new line system
  48. * @param options defines the options used to create the line system
  49. * @param scene defines the hosting scene
  50. * @returns a new line system mesh
  51. */
  52. export declare function CreateLineSystem(name: string, options: {
  53. lines: Vector3[][];
  54. updatable?: boolean;
  55. instance?: Nullable<LinesMesh>;
  56. colors?: Nullable<Color4[][]>;
  57. useVertexAlpha?: boolean;
  58. material?: Material;
  59. }, scene?: Nullable<Scene>): LinesMesh;
  60. /**
  61. * Creates a line mesh
  62. * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter
  63. * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function
  64. * * The parameter `points` is an array successive Vector3
  65. * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#lines-and-dashedlines
  66. * * The optional parameter `colors` is an array of successive Color4, one per line point
  67. * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need alpha blending (faster)
  68. * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created
  69. * * When updating an instance, remember that only point positions can change, not the number of points
  70. * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
  71. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#lines
  72. * @param name defines the name of the new line system
  73. * @param options defines the options used to create the line system
  74. * @param scene defines the hosting scene
  75. * @returns a new line mesh
  76. */
  77. export declare function CreateLines(name: string, options: {
  78. points: Vector3[];
  79. updatable?: boolean;
  80. instance?: Nullable<LinesMesh>;
  81. colors?: Color4[];
  82. useVertexAlpha?: boolean;
  83. material?: Material;
  84. }, scene?: Nullable<Scene>): LinesMesh;
  85. /**
  86. * Creates a dashed line mesh
  87. * * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter
  88. * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function
  89. * * The parameter `points` is an array successive Vector3
  90. * * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200)
  91. * * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3)
  92. * * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)
  93. * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#lines-and-dashedlines
  94. * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)
  95. * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created
  96. * * When updating an instance, remember that only point positions can change, not the number of points
  97. * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
  98. * @param name defines the name of the mesh
  99. * @param options defines the options used to create the mesh
  100. * @param scene defines the hosting scene
  101. * @returns the dashed line mesh
  102. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#dashed-lines
  103. */
  104. export declare function CreateDashedLines(name: string, options: {
  105. points: Vector3[];
  106. dashSize?: number;
  107. gapSize?: number;
  108. dashNb?: number;
  109. updatable?: boolean;
  110. instance?: LinesMesh;
  111. useVertexAlpha?: boolean;
  112. material?: Material;
  113. }, scene?: Nullable<Scene>): LinesMesh;
  114. /**
  115. * Class containing static functions to help procedurally build meshes
  116. * @deprecated use the functions directly from the module
  117. */
  118. export declare const LinesBuilder: {
  119. CreateDashedLines: typeof CreateDashedLines;
  120. CreateLineSystem: typeof CreateLineSystem;
  121. CreateLines: typeof CreateLines;
  122. };