@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
70 lines (69 loc) • 4.42 kB
TypeScript
import type { Vector4 } from "../../Maths/math.vector.js";
import { Mesh } from "../mesh.js";
import { VertexData } from "../mesh.vertexData.js";
import type { Scene } from "../../scene.js";
import type { Nullable } from "../../types.js";
/**
* Creates the VertexData for an ellipsoid, defaults to a sphere
* @param options an object used to set the following optional parameters for the box, required but can be empty
* * segments sets the number of horizontal strips optional, default 32
* * diameter sets the axes dimensions, diameterX, diameterY and diameterZ to the value of diameter, optional default 1
* * diameterX sets the diameterX (x direction) of the ellipsoid, overwrites the diameterX set by diameter, optional, default diameter
* * diameterY sets the diameterY (y direction) of the ellipsoid, overwrites the diameterY set by diameter, optional, default diameter
* * diameterZ sets the diameterZ (z direction) of the ellipsoid, overwrites the diameterZ set by diameter, optional, default diameter
* * 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
* * 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
* * 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 ellipsoid
*/
export declare function CreateSphereVertexData(options: {
segments?: number;
diameter?: number;
diameterX?: number;
diameterY?: number;
diameterZ?: number;
arc?: number;
slice?: number;
sideOrientation?: number;
frontUVs?: Vector4;
backUVs?: Vector4;
dedupTopBottomIndices?: boolean;
}): VertexData;
/**
* Creates a sphere mesh
* * The parameter `diameter` sets the diameter size (float) of the sphere (default 1)
* * 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`)
* * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32)
* * 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
* * 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)
* * 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 sphere mesh
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#sphere
*/
export declare function CreateSphere(name: string, options?: {
segments?: number;
diameter?: number;
diameterX?: number;
diameterY?: number;
diameterZ?: number;
arc?: number;
slice?: number;
sideOrientation?: number;
frontUVs?: Vector4;
backUVs?: Vector4;
updatable?: boolean;
}, scene?: Nullable<Scene>): Mesh;
/**
* Class containing static functions to help procedurally build meshes
* @deprecated use CreateSphere directly
*/
export declare const SphereBuilder: {
CreateSphere: typeof CreateSphere;
};