123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- import type { Scene } from "../../scene";
- import { Vector4 } from "../../Maths/math.vector";
- import { Color4 } from "../../Maths/math.color";
- import { Mesh } from "../mesh";
- import { VertexData } from "../mesh.vertexData";
- import type { Nullable } from "../../types";
- /**
- * Creates the VertexData for a Polyhedron
- * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
- * * type provided types are:
- * * 0 : Tetrahedron, 1 : Octahedron, 2 : Dodecahedron, 3 : Icosahedron, 4 : Rhombicuboctahedron, 5 : Triangular Prism, 6 : Pentagonal Prism, 7 : Hexagonal Prism, 8 : Square Pyramid (J1)
- * * 9 : Pentagonal Pyramid (J2), 10 : Triangular Dipyramid (J12), 11 : Pentagonal Dipyramid (J13), 12 : Elongated Square Dipyramid (J15), 13 : Elongated Pentagonal Dipyramid (J16), 14 : Elongated Pentagonal Cupola (J20)
- * * size the size of the IcoSphere, optional default 1
- * * sizeX allows stretching in the x direction, optional, default size
- * * sizeY allows stretching in the y direction, optional, default size
- * * sizeZ allows stretching in the z direction, optional, default size
- * * custom a number that overwrites the type to create from an extended set of polyhedron from https://www.babylonjs-playground.com/#21QRSK#15 with minimised editor
- * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively
- * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively
- * * flat when true creates a flat shaded mesh, optional, default true
- * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4
- * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
- * * 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)
- * * 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)
- * @returns the VertexData of the Polyhedron
- */
- export declare function CreatePolyhedronVertexData(options: {
- type?: number;
- size?: number;
- sizeX?: number;
- sizeY?: number;
- sizeZ?: number;
- custom?: any;
- faceUV?: Vector4[];
- faceColors?: Color4[];
- flat?: boolean;
- sideOrientation?: number;
- frontUVs?: Vector4;
- backUVs?: Vector4;
- }): VertexData;
- /**
- * Creates a polyhedron mesh
- * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type
- * * The parameter `size` (positive float, default 1) sets the polygon size
- * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)
- * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overrides the parameter `type`
- * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron
- * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)
- * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/features/featuresDeepDive/materials/using/texturePerBoxFace
- * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored
- * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
- * * 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
- * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
- * @param name defines the name of the mesh
- * @param options defines the options used to create the mesh
- * @param scene defines the hosting scene
- * @returns the polyhedron mesh
- * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/polyhedra
- */
- export declare function CreatePolyhedron(name: string, options?: {
- type?: number;
- size?: number;
- sizeX?: number;
- sizeY?: number;
- sizeZ?: number;
- custom?: any;
- faceUV?: Vector4[];
- faceColors?: Color4[];
- flat?: boolean;
- updatable?: boolean;
- sideOrientation?: number;
- frontUVs?: Vector4;
- backUVs?: Vector4;
- }, scene?: Nullable<Scene>): Mesh;
- /**
- * Class containing static functions to help procedurally build meshes
- * @deprecated use the function directly from the module
- */
- export declare const PolyhedronBuilder: {
- CreatePolyhedron: typeof CreatePolyhedron;
- };
|