tubeBuilder.d.ts 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import type { Nullable } from "../../types";
  2. import type { Scene } from "../../scene";
  3. import type { Vector4 } from "../../Maths/math.vector";
  4. import { Vector3 } from "../../Maths/math.vector";
  5. import { Mesh } from "../mesh";
  6. /**
  7. * Creates a tube mesh.
  8. * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters
  9. * * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube
  10. * * The parameter `radius` (positive float, default 1) sets the tube radius size
  11. * * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface
  12. * * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overrides the parameter `radius`
  13. * * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path. It must return a radius value (positive float)
  14. * * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc
  15. * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
  16. * * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter. The `path`Array HAS to have the SAME number of points as the previous one: https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#tube
  17. * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  18. * * 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
  19. * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture
  20. * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created. The NUMBER of points CAN'T CHANGE, only their positions.
  21. * @param name defines the name of the mesh
  22. * @param options defines the options used to create the mesh
  23. * @param options.path
  24. * @param options.radius
  25. * @param options.tessellation
  26. * @param options.radiusFunction
  27. * @param options.cap
  28. * @param options.arc
  29. * @param options.updatable
  30. * @param options.sideOrientation
  31. * @param options.frontUVs
  32. * @param options.backUVs
  33. * @param options.instance
  34. * @param options.invertUV
  35. * @param scene defines the hosting scene
  36. * @returns the tube mesh
  37. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param
  38. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tube
  39. */
  40. export declare function CreateTube(name: string, options: {
  41. path: Vector3[];
  42. radius?: number;
  43. tessellation?: number;
  44. radiusFunction?: {
  45. (i: number, distance: number): number;
  46. };
  47. cap?: number;
  48. arc?: number;
  49. updatable?: boolean;
  50. sideOrientation?: number;
  51. frontUVs?: Vector4;
  52. backUVs?: Vector4;
  53. instance?: Mesh;
  54. invertUV?: boolean;
  55. }, scene?: Nullable<Scene>): Mesh;
  56. /**
  57. * Class containing static functions to help procedurally build meshes
  58. * @deprecated use CreateTube directly
  59. */
  60. export declare const TubeBuilder: {
  61. CreateTube: typeof CreateTube;
  62. };