boxBuilder.d.ts 5.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import type { Nullable } from "../../types";
  2. import type { Scene } from "../../scene";
  3. import { Vector4 } from "../../Maths/math.vector";
  4. import { Color4 } from "../../Maths/math.color";
  5. import { Mesh } from "../mesh";
  6. import { VertexData } from "../mesh.vertexData";
  7. /**
  8. * Creates the VertexData for a box
  9. * @param options an object used to set the following optional parameters for the box, required but can be empty
  10. * * size sets the width, height and depth of the box to the value of size, optional default 1
  11. * * width sets the width (x direction) of the box, overwrites the width set by size, optional, default size
  12. * * height sets the height (y direction) of the box, overwrites the height set by size, optional, default size
  13. * * depth sets the depth (z direction) of the box, overwrites the depth set by size, optional, default size
  14. * * faceUV an array of 6 Vector4 elements used to set different images to each box side
  15. * * faceColors an array of 6 Color3 elements used to set different colors to each box side
  16. * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
  17. * * 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)
  18. * * 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)
  19. * @returns the VertexData of the box
  20. */
  21. export declare function CreateBoxVertexData(options: {
  22. size?: number;
  23. width?: number;
  24. height?: number;
  25. depth?: number;
  26. faceUV?: Vector4[];
  27. faceColors?: Color4[];
  28. sideOrientation?: number;
  29. frontUVs?: Vector4;
  30. backUVs?: Vector4;
  31. wrap?: boolean;
  32. topBaseAt?: number;
  33. bottomBaseAt?: number;
  34. }): VertexData;
  35. /**
  36. * Creates the VertexData for a segmented box
  37. * @param options an object used to set the following optional parameters for the box, required but can be empty
  38. * * size sets the width, height and depth of the box to the value of size, optional default 1
  39. * * width sets the width (x direction) of the box, overwrites the width set by size, optional, default size
  40. * * height sets the height (y direction) of the box, overwrites the height set by size, optional, default size
  41. * * depth sets the depth (z direction) of the box, overwrites the depth set by size, optional, default size
  42. * * segments sets the number of segments on the all axis (1 by default)
  43. * * widthSegments sets the number of segments on the x axis (1 by default)
  44. * * heightSegments sets the number of segments on the y axis (1 by default)
  45. * * depthSegments sets the number of segments on the z axis (1 by default)
  46. * @returns the VertexData of the box
  47. */
  48. export declare function CreateSegmentedBoxVertexData(options: {
  49. size?: number;
  50. width?: number;
  51. height?: number;
  52. depth?: number;
  53. segments?: number;
  54. widthSegments?: number;
  55. heightSegments?: number;
  56. depthSegments?: number;
  57. }): VertexData;
  58. /**
  59. * Creates a box mesh
  60. * * The parameter `size` sets the size (float) of each box side (default 1)
  61. * * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value of `size`)
  62. * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements)
  63. * * Please read this tutorial : https://doc.babylonjs.com/features/featuresDeepDive/materials/using/texturePerBoxFace
  64. * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  65. * * 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
  66. * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
  67. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#box
  68. * @param name defines the name of the mesh
  69. * @param options defines the options used to create the mesh
  70. * @param scene defines the hosting scene
  71. * @returns the box mesh
  72. */
  73. export declare function CreateBox(name: string, options?: {
  74. size?: number;
  75. width?: number;
  76. height?: number;
  77. depth?: number;
  78. faceUV?: Vector4[];
  79. faceColors?: Color4[];
  80. sideOrientation?: number;
  81. frontUVs?: Vector4;
  82. backUVs?: Vector4;
  83. wrap?: boolean;
  84. topBaseAt?: number;
  85. bottomBaseAt?: number;
  86. updatable?: boolean;
  87. }, scene?: Nullable<Scene>): Mesh;
  88. /**
  89. * Class containing static functions to help procedurally build meshes
  90. * @deprecated please use CreateBox directly
  91. */
  92. export declare const BoxBuilder: {
  93. CreateBox: typeof CreateBox;
  94. };