Xface Core Library: XEngine::IndexedFaceSet Class Reference

XFace / XEngine / XMath

XEngine::IndexedFaceSet Class Reference
[XEngine]

#include <IndexedFaceSet.h>

Inheritance diagram for XEngine::IndexedFaceSet:

XEngine::Geometry XEngine::NamedObj XEngine::DeformableGeometry List of all members.

Detailed Description

Author:
Koray Balci
Version:
1.0
Date:
May 2003
Implements the indexed face set from the Geometry class. Each polygon is a triangle in the geometry, if not they are corrected automatically when the indices are set by the loader.

See base class documentation for use and more info.

See also:
Geometry


Public Member Functions

void computeVertexNormals ()
IndexedFaceSetcopyFrom (const IndexedFaceSet &rhs)
 overriding base class virtual method
size_t getIndexCount () const
 Returns the number of indices.
const unsigned short * getIndices () const
 Accessor for the indices to the triangles.
void setIndices (const std::vector< std::vector< unsigned short > > &indices)

Member Function Documentation

void XEngine::IndexedFaceSet::computeVertexNormals  ) 
 

Computes the vertex normals if the mesh has an indexed structure. For computing the vertex normals, simply the face normals for each polygon is found by crossing two edges of the polygon, then corresponding vertices' normals are summed up with the face normal. At last, all the vertex normals are normalized. Might be implemented faster, but since this step is done only once in the initialization of the mesh, it is not a bottleneck. However, for dynamically changing geometry, some optimizations can be considered.

void XEngine::IndexedFaceSet::setIndices const std::vector< std::vector< unsigned short > > &  indices  ) 
 

Indices are set here. If a face is not a triangle it is divided into triangles so that the final geometry contains only triangles (which is a Good Thing!).

Parameters:
indices A vector of vector of unsigned short values representing indices to vertices. Inner vector represents each face (polygon) and the outer vector is the whole colection of faces.


The documentation for this class was generated from the following files:
Generated on Mon Aug 28 15:39:25 2006 for Xface Core Library by  doxygen 1.4.6-NO