icoSphereBuilder.d.ts 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import type { Scene } from "../../scene";
  2. import type { Vector4 } from "../../Maths/math.vector";
  3. import { Mesh } from "../mesh";
  4. import { VertexData } from "../mesh.vertexData";
  5. import type { Nullable } from "../../types";
  6. /**
  7. * Creates the VertexData of the IcoSphere
  8. * @param options an object used to set the following optional parameters for the IcoSphere, required but can be empty
  9. * * radius the radius of the IcoSphere, optional default 1
  10. * * radiusX allows stretching in the x direction, optional, default radius
  11. * * radiusY allows stretching in the y direction, optional, default radius
  12. * * radiusZ allows stretching in the z direction, optional, default radius
  13. * * flat when true creates a flat shaded mesh, optional, default true
  14. * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4
  15. * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
  16. * * 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)
  17. * * 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)
  18. * @returns the VertexData of the IcoSphere
  19. */
  20. export declare function CreateIcoSphereVertexData(options: {
  21. radius?: number;
  22. radiusX?: number;
  23. radiusY?: number;
  24. radiusZ?: number;
  25. flat?: boolean;
  26. subdivisions?: number;
  27. sideOrientation?: number;
  28. frontUVs?: Vector4;
  29. backUVs?: Vector4;
  30. }): VertexData;
  31. /**
  32. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided
  33. * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)
  34. * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value of `radius`)
  35. * * The parameter `subdivisions` sets the number of subdivisions (positive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size
  36. * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface
  37. * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
  38. * * 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
  39. * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
  40. * @param name defines the name of the mesh
  41. * @param options defines the options used to create the mesh
  42. * @param scene defines the hosting scene
  43. * @returns the icosahedron mesh
  44. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/polyhedra#icosphere
  45. */
  46. export declare function CreateIcoSphere(name: string, options?: {
  47. radius?: number;
  48. radiusX?: number;
  49. radiusY?: number;
  50. radiusZ?: number;
  51. flat?: boolean;
  52. subdivisions?: number;
  53. sideOrientation?: number;
  54. frontUVs?: Vector4;
  55. backUVs?: Vector4;
  56. updatable?: boolean;
  57. }, scene?: Nullable<Scene>): Mesh;
  58. /**
  59. * Class containing static functions to help procedurally build meshes
  60. * @deprecated use the function directly from the module
  61. */
  62. export declare const IcoSphereBuilder: {
  63. CreateIcoSphere: typeof CreateIcoSphere;
  64. };