Helper Class for face manipulation
FaceHelper
public static function addFace(mesh:Mesh, v0:Vertex, v1:Vertex, v2:Vertex, uv0:UV, uv1:UV, uv2:UV, subGeomIndice:uint):void
Parameters
public static function addFaces(mesh:Mesh, v0s:Vector, v1s:Vector, v2s:Vector, uv0s:Vector, uv1s:Vector, uv2s:Vector, subGeomIndices:Vector):void
Adds a series of faces from a mesh. All vectors must have the same length.
Parameters
| mesh:Mesh — Mesh. The mesh to remove a face from
|
|
| v0s:Vector — Vector.. A vector with a series of Vertex Objects representing the v0 of a face.
|
|
| v1s:Vector — Vector.. A vector with a series of Vertex Objects representing the v1 of a face.
|
|
| v2s:Vector — Vector.. A vector with a series of Vertex Objects representing the v2 of a face.
|
|
| uv0s:Vector — Vector.. A vector with a series of UV Objects representing the uv0 of a face.
|
|
| uv1s:Vector — Vector.. A vector with a series of UV Objects representing the uv1 of a face.
|
|
| uv2s:Vector — Vector.. A vector with a series of UV Objects representing the uv2 of a face.
|
|
| subGeomIndices:Vector |
public static function quarterFace(mesh:Mesh, indice:uint, subGeomIndice:uint):void
Divides a face into 4 faces.
Parameters
| mesh:Mesh — The mesh holding the face to split in 4.
|
|
| indice:uint — The face index. The value represents the position in indices vector divided by 3.
For instance, to edit face [1], the parameter indice will be 1. The x value of the v0 at position 9 in vertices vector is then extracted from vertices[indices[indice]]
|
|
| subGeomIndice:uint — The index of the subgeometry holder this face.
|
public static function quarterFaces(mesh:Mesh):void
Divides all the faces of a mesh in 4 faces.
Parameters
| mesh:Mesh — The mesh holding the faces to split in 4
At this time of dev, quarterFaces method will abort if a subgeometry reaches max buffer limit of 65k
|
public static function removeFace(mesh:Mesh, index:uint, subGeomIndice:uint):void
Remove a face from a mesh
Parameters
| mesh:Mesh — Mesh. The mesh to remove a face from
|
|
| index:uint — uint. Index of the face in vertices. The value represents the position in indices vector divided by 3.
For instance, to edit face [1], the parameter indice will be 1. The x value of the v0 at position 3 in vertice vector is then extracted from vertices[indices[indice]]
|
|
| subGeomIndice:uint — uint. Index of vertex 1 of the face
|
public static function removeFaces(mesh:Mesh, indices:Vector, subGeomIndices:Vector):void
Remove a series of faces from a mesh. Indices and geomIndices must have the same length.
Meshes with less that 20k faces and single material, will generally only have one single subgeometry.
The geomIndices vector will then contain only zeros.
IMPORTANT: the code considers the indices as location in the mesh subgemeometry indices vector, not the value at the pointer location.
Parameters
| mesh:Mesh — Mesh. The mesh to remove a face from
|
|
| indices:Vector — Vector.. A vector with a series of uints indices: the indices of the faces to be removed.
|
|
| subGeomIndices:Vector — Vector.. A vector with a series of uints indices representing the subgeometries of the faces to be removed.
|
public static function spikeFace(mesh:Mesh, indice:uint, subGeomIndice:uint, distance:Number):void
Divides a face into 3 faces and displace the center according along the face normal by the factor distance set.
Parameters
| mesh:Mesh — The mesh holding the face to spike.
|
|
| indice:uint — The face index. The value represents the position in indices vector divided by 3.
For instance, to edit face [1], the parameter indice will be 1. The x value of the v0 at position 9 in vertices vector is then extracted from vertices[indices[indice]]
|
|
| subGeomIndice:uint — The index of the subgeometry holder this face.
|
|
| distance:Number |
public static function spikeFaces(mesh:Mesh, distance:Number):void
Divides all the faces of a mesh in 4 faces.
Parameters
| mesh:Mesh — The mesh holding the faces to spike
At this time of dev, spikeFaces method will abort if a subgeometry reaches max buffer limit of 65k
|
|
| distance:Number |
public static function splitFace(mesh:Mesh, indice:uint, subGeomIndice:uint, side:uint = 0):void
Divides a face into 2 faces.
Parameters
| mesh:Mesh — The mesh holding the face to split in 2
|
|
| indice:uint — The face index. The value represents the position in indices vector divided by 3.
For instance, to edit face [1], the parameter indice will be 1. The x value of the v0 at position 9 in vertices vector is then extracted from vertices[indices[indice]]
|
|
| subGeomIndice:uint — The index of the subgeometry holder this face.
|
|
| side:uint (default = 0 ) — [optional] The side of the face to split in two. 0 , 1 or 2. (clockwize).
|
public static function splitFaces(mesh:Mesh):void
Divides all the faces of a mesh in 2 faces.
Parameters
| mesh:Mesh — The mesh holding the faces to split in 2
|
public static function triFace(mesh:Mesh, indice:uint, subGeomIndice:uint):void
Divides a face into 3 faces.
Parameters
| mesh:Mesh — The mesh holding the face to split in 3.
|
|
| indice:uint — The face index. The value represents the position in indices vector divided by 3.
For instance, to edit face [1], the parameter indice will be 1. The x value of the v0 at position 9 in vertices vector is then extracted from vertices[indices[indice]]
|
|
| subGeomIndice:uint — The index of the subgeometry holder this face.
|
public static function triFaces(mesh:Mesh):void
Divides all the faces of a mesh in 3 faces.
Parameters
| mesh:Mesh — The mesh holding the faces to split in 3
At this time of dev, triFaces method will abort if a subgeometry reaches max buffer limit of 65k
|