unsignedchariEndPointIndex;//since two polygons reference any one line, one needs to traverse the line backwards, this flags that behavior
};
structPolyhedron_IndexedPolygon_t
{
unsignedshortiFirstIndex;
unsignedshortiIndexCount;
VectorpolyNormal;
};
classCPolyhedron//made into a class because it's going virtual to support distinctions between temp and permanent versions
{
public:
Vector*pVertices;
Polyhedron_IndexedLine_t*pLines;
Polyhedron_IndexedLineReference_t*pIndices;
Polyhedron_IndexedPolygon_t*pPolygons;
unsignedshortiVertexCount;
unsignedshortiLineCount;
unsignedshortiIndexCount;
unsignedshortiPolygonCount;
virtual~CPolyhedron(void){};
virtualvoidRelease(void)=0;
VectorCenter(void);
};
classCPolyhedron_AllocByNew:publicCPolyhedron
{
public:
virtualvoidRelease(void);
staticCPolyhedron_AllocByNew*Allocate(unsignedshortiVertices,unsignedshortiLines,unsignedshortiIndices,unsignedshortiPolygons);//creates the polyhedron along with enough memory to hold all it's data in a single allocation
private:
CPolyhedron_AllocByNew(void){};//CPolyhedron_AllocByNew::Allocate() is the only way to create one of these.
};
CPolyhedron*GeneratePolyhedronFromPlanes(constfloat*pOutwardFacingPlanes,intiPlaneCount,floatfOnPlaneEpsilon,boolbUseTemporaryMemory=false);//be sure to polyhedron->Release()
CPolyhedron*ClipPolyhedron(constCPolyhedron*pExistingPolyhedron,constfloat*pOutwardFacingPlanes,intiPlaneCount,floatfOnPlaneEpsilon,boolbUseTemporaryMemory=false);//this does NOT modify/delete the existing polyhedron
CPolyhedron*GetTempPolyhedron(unsignedshortiVertices,unsignedshortiLines,unsignedshortiIndices,unsignedshortiPolygons);//grab the temporary polyhedron. Avoids new/delete for quick work. Can only be in use by one chunk of code at a time