ribbonBuilder.d.ts 5.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import type { Nullable } from "../../types";
  2. import type { Scene } from "../../scene";
  3. import type { Vector3, Vector2, Vector4 } from "../../Maths/math.vector";
  4. import type { Color4 } from "../../Maths/math.color";
  5. import { Mesh } from "../mesh";
  6. import { VertexData } from "../mesh.vertexData";
  7. /**
  8. * Creates the VertexData for a Ribbon
  9. * @param options an object used to set the following optional parameters for the ribbon, required but can be empty
  10. * * pathArray array of paths, each of which an array of successive Vector3
  11. * * closeArray creates a seam between the first and the last paths of the pathArray, optional, default false
  12. * * closePath creates a seam between the first and the last points of each path of the path array, optional, default false
  13. * * offset a positive integer, only used when pathArray contains a single path (offset = 10 means the point 1 is joined to the point 11), default rounded half size of the pathArray length
  14. * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
  15. * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
  16. * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
  17. * * invertUV swaps in the U and V coordinates when applying a texture, optional, default false
  18. * * uvs a linear array, of length 2 * number of vertices, of custom UV values, optional
  19. * * colors a linear array, of length 4 * number of vertices, of custom color values, optional
  20. * @returns the VertexData of the ribbon
  21. */
  22. export declare function CreateRibbonVertexData(options: {
  23. pathArray: Vector3[][];
  24. closeArray?: boolean;
  25. closePath?: boolean;
  26. offset?: number;
  27. sideOrientation?: number;
  28. frontUVs?: Vector4;
  29. backUVs?: Vector4;
  30. invertUV?: boolean;
  31. uvs?: Vector2[];
  32. colors?: Color4[];
  33. }): VertexData;
  34. /**
  35. * Creates a ribbon mesh. The ribbon is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters
  36. * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry
  37. * * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array
  38. * * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array
  39. * * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path
  40. * * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11
  41. * * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#ribbon
  42. * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  43. * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation
  44. * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture
  45. * * The parameter `uvs` is an optional flat array of `Vector2` to update/set each ribbon vertex with its own custom UV values instead of the computed ones
  46. * * The parameters `colors` is an optional flat array of `Color4` to set/update each ribbon vertex with its own custom color values
  47. * * Note that if you use the parameters `uvs` or `colors`, the passed arrays must be populated with the right number of elements, it is to say the number of ribbon vertices. Remember that if you set `closePath` to `true`, there's one extra vertex per path in the geometry
  48. * * Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time
  49. * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
  50. * @param name defines the name of the mesh
  51. * @param options defines the options used to create the mesh
  52. * @param scene defines the hosting scene
  53. * @returns the ribbon mesh
  54. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/ribbon_extra
  55. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param
  56. */
  57. export declare function CreateRibbon(name: string, options: {
  58. pathArray: Vector3[][];
  59. closeArray?: boolean;
  60. closePath?: boolean;
  61. offset?: number;
  62. updatable?: boolean;
  63. sideOrientation?: number;
  64. frontUVs?: Vector4;
  65. backUVs?: Vector4;
  66. instance?: Mesh;
  67. invertUV?: boolean;
  68. uvs?: Vector2[];
  69. colors?: Color4[];
  70. }, scene?: Nullable<Scene>): Mesh;
  71. /**
  72. * Class containing static functions to help procedurally build meshes
  73. * @deprecated use CreateRibbon directly
  74. */
  75. export declare const RibbonBuilder: {
  76. CreateRibbon: typeof CreateRibbon;
  77. };