Game Development Reference
In-Depth Information
a boundary edge and so a mid-point must be added using the border edge
equation given above, regardless of the vertex valences.
typedef struct stEDGE{
unsigned short a,b; //Indices of existing vertices
unsigned short v;
//Index of the middle vertex
typedef struct stPOINTCON{
unsigned char valence;
unsigned short p[MAX_VALENCE];
unsigned char border;
The first step in any subdivision is to store the original mesh topology.
This is stored in a new PATCHINFO structure.
typedef struct stPATCHINFO{
POINT3D *pts;
POLYGON *pchs;
int numpoints;
int numpatches;
This ensures that we can restore the original topology at any time.
//Copies the original vertex and polygon information into a
//new data structure PATCHINFO. This is the same as a OBJECTINFO
//without any surface information. The purpose of the function
//is to allow the transformation engine to restore the original
//vertex and polygon structure after having rendered the subdivided
BOOL CT3DObject::CreatePatchInfo()
if (pi.pts) delete [] pi.pts;
if (pi.pchs) delete [] pi.pchs;
pi.pts = new POINT3D[oi.numpoints];
Search Nedrilad ::

Custom Search