Class PolygonBuilder
Hierarchy
- PolygonBuilder
Index
Methods
Methods
Static Create PolygonSearch playground for CreatePolygon
-
Creates a polygon mesh The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh
- The parameter
shape
is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors - You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
- The mesh can be set to updatable with the boolean parameter
updatable
(default false) if its internal geometry is supposed to change once created - 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
andbackUVs
(Vector4) - Remember you can only change the shape positions, not their number when updating a polygon
Parameters
-
name: string
defines the name of the mesh
-
options: { backUVs?: Vector4; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; holes?: Vector3[][]; shape: Vector3[]; sideOrientation?: number; smoothingThreshold?: number; updatable?: boolean; wrap?: boolean }
defines the options used to create the mesh
-
Optional backUVs?: Vector4
-
Optional depth?: number
-
Optional face
Colors?: Color4[] -
Optional faceUV?: Vector4[]
-
Optional frontUVs?: Vector4
-
Optional holes?: Vector3[][]
-
shape: Vector3[]
-
Optional side
Orientation?: number -
Optional smoothing
Threshold?: number -
Optional updatable?: boolean
-
Optional wrap?: boolean
-
-
Optional scene: Nullable<Scene>
defines the hosting scene
-
Optional earcutInjection: any
can be used to inject your own earcut reference
Returns Mesh
the polygon mesh
- The parameter
Static Extrude PolygonSearch playground for ExtrudePolygon
-
Creates an extruded polygon mesh, with depth in the Y direction.
- You can set different colors and different images to the top, bottom and extruded side by using the parameters
faceColors
(an array of 3 Color3 elements) andfaceUV
(an array of 3 Vector4 elements)
Parameters
-
name: string
defines the name of the mesh
-
options: { backUVs?: Vector4; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; holes?: Vector3[][]; shape: Vector3[]; sideOrientation?: number; updatable?: boolean; wrap?: boolean }
defines the options used to create the mesh
-
Optional scene: Nullable<Scene>
defines the hosting scene
-
Optional earcutInjection: any
can be used to inject your own earcut reference
Returns Mesh
the polygon mesh
- You can set different colors and different images to the top, bottom and extruded side by using the parameters
Class containing static functions to help procedurally build meshes