This reference page is linked to from the following overview topics: Mesh Related Classes, 3DXI Mesh.
This class represents a single triangular face.
The class maintains three indices into the vertex list for the face, a 32-bit smoothing group for the face, and 32-bits of face flags. The flags also store information about the visibility of the face, the visibility of the three edges, and whether or not the face has texture vertices present. The most significant 16-bits of the face flags store the material index. All methods of this class are implemented by the system.
#include <mesh.h>
Public Member Functions |
|
Face () | |
Constructor. |
|
MtlID | getMatID () |
Retrieves the zero based material ID for
this face. |
|
void | setMatID (MtlID id) |
Sets the material ID for this face. |
|
void | setSmGroup (DWORD i) |
Sets the smoothing group bits for this face.
|
|
DWORD | getSmGroup (void) |
Returns the smoothing group bits for this
face. |
|
DllExport void | setVerts (DWORD *vrt) |
Sets the vertices of this face. |
|
void | setVerts (int a, int b, int c) |
Sets the vertices of this face. |
|
DllExport void | setEdgeVis (int edge, int visFlag) |
Sets the visibility of the specified edge.
|
|
DllExport void | setEdgeVisFlags (int va, int vb, int vc) |
Sets the visibility of the all the edges.
|
|
int | getEdgeVis (int edge) |
Retrieves the edge visibility for the
specified edge. |
|
DWORD | getVert (int index) |
Returns the index into the mesh vertex array
of the specified vertex. |
|
DWORD * | getAllVerts (void) |
Retrieves a pointer to the vertex array.
|
|
BOOL | Hidden () |
Determines if the face is hidden or visible.
|
|
void | Hide () |
Hides this face (makes it invisible in the
viewports). |
|
void | Show () |
Shows this face (makes it visible in the
viewports). |
|
void | SetHide (BOOL hide) |
Sets the hidden state of this face. |
|
BOOL | InForeground () |
void | PushToForeground () |
void | PushToBackground () |
void | SetInForegound (BOOL foreground) |
BOOL | IsBackFacing () |
void | SetBackFacing () |
void | SetFrontFacing () |
void | SetBackFacing (BOOL backFacing) |
DllExport DWORD | GetOtherIndex (DWORD v0, DWORD v1) |
Returns the first vertex in the face that
isn't v0 or v1. |
|
DllExport DWORD | GetEdgeIndex (DWORD v0, DWORD v1) |
Returns the index of the edge in the face
that goes from v0 to v1, or v1 to v0. |
|
DllExport int | Direction (DWORD v0, DWORD v1) |
Indicates order in which vertices v0 and v1
appear in the face. |
|
DllExport DWORD | GetVertIndex (DWORD v0) |
Returns the index of the specified vertex in
this face's vertex list (0, 1 or 2). |
|
DllExport void | OrderVerts (DWORD &v0, DWORD &v1) |
This method switches v0,v1 if needed to put
them in face-order. |
|
Public Attributes |
|
DWORD | v [3] |
These are zero-based indices into a mesh
object's array of vertices. |
|
DWORD | smGroup |
Smoothing group bits for the face. |
|
DWORD | flags |
The Face
Flags: Can be from the following list: |
Face | ( | ) | [inline] |
MtlID getMatID | ( | ) | [inline] |
Retrieves the zero based material ID for this face.
Note: typedef unsigned short MtlID;
{ return (int)( ( flags >> FACE_MATID_SHIFT ) & FACE_MATID_MASK); }
void setMatID | ( | MtlID | id | ) | [inline] |
Sets the material ID for this face.
id | Specifies the zero based material index. |
{flags &= 0xFFFF; flags |= (DWORD)(id<<FACE_MATID_SHIFT);}
void setSmGroup | ( | DWORD | i | ) | [inline] |
Sets the smoothing group bits for this face.
i | Specifies the smoothing group bits for this face. |
{ smGroup = i; }
DWORD getSmGroup | ( | void | ) | [inline] |
DllExport void setVerts | ( | DWORD * | vrt | ) |
Sets the vertices of this face.
vrt | An array of the 3 vertices to store. These are zero based indices into the mesh object's array of vertices. |
void setVerts | ( | int | a, |
int | b, | ||
int | c | ||
) | [inline] |
Sets the vertices of this face.
The specified indexes are zero based indices into the mesh object's array of vertices.
a | Specifies the first vertex. |
b | Specifies the second vertex. |
c | Specifies the third vertex. |
DllExport void setEdgeVis | ( | int | edge, |
int | visFlag | ||
) |
Sets the visibility of the specified edge.
edge | Specifies the edge to set the visibility of. You may use 0, 1, or 2. |
visFlag | One of the following values:
|
DllExport void setEdgeVisFlags | ( | int | va, |
int | vb, | ||
int | vc | ||
) |
Sets the visibility of the all the edges.
va | Specifies the visibility for edge 0. Use either EDGE_VIS or EDGE_INVIS. |
vb | Specifies the visibility for edge 1. Use either EDGE_VIS or EDGE_INVIS. |
vc | Specifies the visibility for edge 2. Use either EDGE_VIS or EDGE_INVIS. |
int getEdgeVis | ( | int | edge | ) | [inline] |
Retrieves the edge visibility for the specified edge.
edge | Specifies the edge. |
DWORD getVert | ( | int | index | ) | [inline] |
Returns the index into the mesh vertex array of the specified vertex.
index | Specifies the vertex to retrieve. You may use 0, 1 or 2. |
{ return v[index]; }
DWORD* getAllVerts | ( | void | ) | [inline] |
BOOL Hidden | ( | ) | [inline] |
Determines if the face is hidden or visible.
{return flags&FACE_HIDDEN?TRUE:FALSE;}
void Hide | ( | ) | [inline] |
Hides this face (makes it invisible in the viewports).
{flags|=FACE_HIDDEN;}
void Show | ( | ) | [inline] |
Shows this face (makes it visible in the viewports).
{flags&=~FACE_HIDDEN;}
void SetHide | ( | BOOL | hide | ) | [inline] |
Sets the hidden state of this face.
hide | Specifies the hidden state for the face. Pass TRUE to hide the face; FALSE to show it. |
BOOL InForeground | ( | ) | [inline] |
{return flags&FACE_INFOREGROUND?TRUE:FALSE;}
void PushToForeground | ( | ) | [inline] |
{flags|=FACE_INFOREGROUND;}
void PushToBackground | ( | ) | [inline] |
{flags&=~FACE_INFOREGROUND;}
void SetInForegound | ( | BOOL | foreground | ) | [inline] |
{if (foreground) PushToForeground(); else PushToBackground();}
BOOL IsBackFacing | ( | ) | [inline] |
{return flags&FACE_BACKFACING?TRUE:FALSE;}
void SetBackFacing | ( | ) | [inline] |
{flags|=FACE_BACKFACING;}
void SetFrontFacing | ( | ) | [inline] |
{flags&=~FACE_BACKFACING;}
void SetBackFacing | ( | BOOL | backFacing | ) | [inline] |
{if (backFacing) SetBackFacing(); else SetFrontFacing();}
DllExport DWORD GetOtherIndex | ( | DWORD | v0, |
DWORD | v1 | ||
) |
Returns the first vertex in the face that isn't v0 or v1.
v0 | The zero based index of one of the vertices to check. |
v1 | The zero based index of the other vertex to check. |
DllExport DWORD GetEdgeIndex | ( | DWORD | v0, |
DWORD | v1 | ||
) |
Returns the index of the edge in the face that goes from v0 to v1, or v1 to v0.
v0 | The zero based index of the vertex at one end of the edge. |
v1 | The zero based index of the vertex at the other end of the edge. |
DllExport int Direction | ( | DWORD | v0, |
DWORD | v1 | ||
) |
Indicates order in which vertices v0 and v1 appear in the face.
v0 | One vertex on this face. |
v1 | Another vertex on this face. |
DllExport DWORD GetVertIndex | ( | DWORD | v0 | ) |
Returns the index of the specified vertex in this face's vertex list (0, 1 or 2).
If not found 3 is returned.
v0 | The zero based index of the vertex to check. |
DllExport void OrderVerts | ( | DWORD & | v0, |
DWORD & | v1 | ||
) |
This method switches v0,v1 if needed to put them in face-order.
If v0 and v1 are in the order in which they appear in the face, or if one or both of them are not actually on the face, nothing happens. If however v0 follows v1, the values of the parameters are switched, so that they are then in the correct order for this face. Sample Code:
Face & f = mesh.faces[edge.f[0]]; DWORD v0 = edge.v[0]; DWORD v1 = edge.v[1]; // Switch v0, v1 if needed to match orientation in selected face. f.OrderVerts(v0,v1);
v0 | One vertex on this face. |
v1 | Another vertex on this face. |
DWORD v[3] |
These are zero-based indices into a mesh object's array of vertices.
DWORD smGroup |
Smoothing group bits for the face.
Each bit of this 32 bit value represents membership in a smoothing group. The least significant bit represents smoothing group #1 while the most significant bit represents group #32. If two adjacent faces are assigned the same smoothing group bit, the edge between them is rendered smoothly.
DWORD flags |
The Face Flags: Can be from the following list: