sphereBuilder.d.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import type { Vector4 } from "../../Maths/math.vector";
  2. import { Mesh } from "../mesh";
  3. import { VertexData } from "../mesh.vertexData";
  4. import type { Scene } from "../../scene";
  5. import type { Nullable } from "../../types";
  6. /**
  7. * Creates the VertexData for an ellipsoid, defaults to a sphere
  8. * @param options an object used to set the following optional parameters for the box, required but can be empty
  9. * * segments sets the number of horizontal strips optional, default 32
  10. * * diameter sets the axes dimensions, diameterX, diameterY and diameterZ to the value of diameter, optional default 1
  11. * * diameterX sets the diameterX (x direction) of the ellipsoid, overwrites the diameterX set by diameter, optional, default diameter
  12. * * diameterY sets the diameterY (y direction) of the ellipsoid, overwrites the diameterY set by diameter, optional, default diameter
  13. * * diameterZ sets the diameterZ (z direction) of the ellipsoid, overwrites the diameterZ set by diameter, optional, default diameter
  14. * * arc a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the circumference (latitude) given by the arc value, optional, default 1
  15. * * slice a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the height (latitude) given by the arc value, optional, default 1
  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 ellipsoid
  20. */
  21. export declare function CreateSphereVertexData(options: {
  22. segments?: number;
  23. diameter?: number;
  24. diameterX?: number;
  25. diameterY?: number;
  26. diameterZ?: number;
  27. arc?: number;
  28. slice?: number;
  29. sideOrientation?: number;
  30. frontUVs?: Vector4;
  31. backUVs?: Vector4;
  32. dedupTopBottomIndices?: boolean;
  33. }): VertexData;
  34. /**
  35. * Creates a sphere mesh
  36. * * The parameter `diameter` sets the diameter size (float) of the sphere (default 1)
  37. * * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value of `diameter`)
  38. * * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32)
  39. * * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio
  40. * * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude)
  41. * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  42. * * 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
  43. * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
  44. * @param name defines the name of the mesh
  45. * @param options defines the options used to create the mesh
  46. * @param scene defines the hosting scene
  47. * @returns the sphere mesh
  48. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#sphere
  49. */
  50. export declare function CreateSphere(name: string, options?: {
  51. segments?: number;
  52. diameter?: number;
  53. diameterX?: number;
  54. diameterY?: number;
  55. diameterZ?: number;
  56. arc?: number;
  57. slice?: number;
  58. sideOrientation?: number;
  59. frontUVs?: Vector4;
  60. backUVs?: Vector4;
  61. updatable?: boolean;
  62. }, scene?: Nullable<Scene>): Mesh;
  63. /**
  64. * Class containing static functions to help procedurally build meshes
  65. * @deprecated use CreateSphere directly
  66. */
  67. export declare const SphereBuilder: {
  68. CreateSphere: typeof CreateSphere;
  69. };