## face

face — Face manipulation

## Functions

gboolean | g3d_face_get_normal ()
void | g3d_face_free ()

## Types and Values

#define | G3D_FLAG_MAT_TWOSIDE
#define | G3D_FLAG_FAC_NORMALS
#define | G3D_FLAG_FAC_TEXMAP
| G3DFace

## Includes

    #include <g3d/face.h>

## Description

A face is plane bordered by at least 3 vertices.

## Functions

### g3d_face_get_normal ()

    gboolean
    g3d_face_get_normal (G3DFace *face,
                         G3DObject *object,
                         G3DFloat *nx,
                         G3DFloat *ny,
                         G3DFloat *nz);

calculates the normal of a face.

#### Parameters

face | face to calculate normal of |
object | object containing vertices of face |
nx | x component of resulting normal |
ny | y component of resulting normal |
nz | z component of resulting normal |

#### Returns

TRUE on success, FALSE else

### g3d_face_free ()

    void
    g3d_face_free (G3DFace *face);

Frees all memory allocated for this face.

#### Parameters

face | the face to free |

## Types and Values

### G3D_FLAG_MAT_TWOSIDE

    #define G3D_FLAG_MAT_TWOSIDE    (1L << 0)

Faces using this material should be rendered two-sided as the direction is unknown.

### G3D_FLAG_FAC_NORMALS

    #define G3D_FLAG_FAC_NORMALS    (1L << 0)

The face has custom normals.

### G3D_FLAG_FAC_TEXMAP

    #define G3D_FLAG_FAC_TEXMAP     (1L << 1)

The face has a texture map and texture coordinates.

### G3DFace

    typedef struct {
    	guint32 vertex_count;
    	guint32 *vertex_indices;

    	G3DMaterial *material;

    	guint32 flags;

    	G3DVector *normals;

    	G3DImage *tex_image;
    	guint32 tex_vertex_count;
    	G3DVector *tex_vertex_data;
    } G3DFace;

An object representing a surface.

#### Members

guint32 `vertex_count`; | number of vertices |
guint32 *`vertex_indices`; | indices of vertices in G3DObject |
G3DMaterial *`material`; | material to use for surface |
guint32 `flags`; | flags |
G3DVector *`normals`; | optional normal array (one vector - 3 G3DVector values - for each vertex) |
G3DImage *`tex_image`; | optional texture image |
guint32 `tex_vertex_count`; | number of texture vertices, should be 0 or match vertex_count |
G3DVector *`tex_vertex_data`; | array of texture vertices |