GClasses
GClasses::GRayTraceTriMesh Class Reference

Detailed Description

Represents a triangle mesh in a ray-tracing scene.

#include <GRayTrace.h>

Public Member Functions

 GRayTraceTriMesh (GRayTraceMaterial *pMaterial, size_t nPoints, size_t nTriangles, size_t nNormals, size_t nTextureCoords)
 
 GRayTraceTriMesh (GDomNode *pNode, GRayTraceScene *pScene)
 
 ~GRayTraceTriMesh ()
 
void activateCulling ()
 
void adjustBoundingBox (size_t nIndex, G3DVector *pMin, G3DVector *pMax)
 
void center (G3DVector *pOutPoint, size_t nIndex)
 
void computePhongNormals ()
 Automatically compute phong normals at the vertices to make the object appear smooth. More...
 
bool isCulled ()
 
GRayTraceMaterialmaterial ()
 
void normalVector (GRayTraceRay *pRay, size_t nIndex)
 
G3DReal rayDistanceToTriangle (size_t nTriangle, G3DVector *pRayOrigin, G3DVector *pRayDirection)
 
GDomNodeserialize (GDom *pDoc, const GRayTraceScene *pScene) const
 
void setNormal (size_t nIndex, G3DVector *pNormal)
 
void setPoint (size_t nIndex, const G3DVector *pPoint)
 
void setTextureCoord (size_t nIndex, G3DReal x, G3DReal y)
 
void setTriangle (size_t nIndex, size_t v1, size_t v2, size_t v3)
 
void triangle (size_t index, size_t *v1, size_t *v2, size_t *v3)
 
size_t triangleCount ()
 
G3DVectorvertex (size_t nIndex, size_t nVertex)
 

Static Public Member Functions

static GRayTraceTriMeshmakeCylinder (GRayTraceMaterial *pMaterial, G3DVector *pCenter1, G3DVector *pCenter2, G3DReal radius, size_t nSides, bool bEndCaps)
 
static GRayTraceTriMeshmakeQuadSurface (GRayTraceMaterial *pMaterial, G3DVector *p1, G3DVector *p2, G3DVector *p3, G3DVector *p4)
 The vertices must go around the surface. Don't cut across corners. More...
 
static GRayTraceTriMeshmakeSingleTriangle (GRayTraceMaterial *pMaterial, G3DVector *p1, G3DVector *p2, G3DVector *p3)
 

Protected Member Functions

bool isPointWithinPlanarPolygon (G3DVector *pPoint, G3DVector **ppVertices, size_t nVertices)
 

Protected Attributes

bool m_bCulling
 
size_t m_nPoints
 
size_t m_nTriangles
 
GRayTraceMaterialm_pMaterial
 
G3DVectorm_pNormals
 
G3DVectorm_pPoints
 
G3DRealm_pTextureCoords
 
size_t * m_pTriangles
 

Constructor & Destructor Documentation

GClasses::GRayTraceTriMesh::GRayTraceTriMesh ( GRayTraceMaterial pMaterial,
size_t  nPoints,
size_t  nTriangles,
size_t  nNormals,
size_t  nTextureCoords 
)
GClasses::GRayTraceTriMesh::GRayTraceTriMesh ( GDomNode pNode,
GRayTraceScene pScene 
)
GClasses::GRayTraceTriMesh::~GRayTraceTriMesh ( )

Member Function Documentation

void GClasses::GRayTraceTriMesh::activateCulling ( )
inline
void GClasses::GRayTraceTriMesh::adjustBoundingBox ( size_t  nIndex,
G3DVector pMin,
G3DVector pMax 
)
void GClasses::GRayTraceTriMesh::center ( G3DVector pOutPoint,
size_t  nIndex 
)
void GClasses::GRayTraceTriMesh::computePhongNormals ( )

Automatically compute phong normals at the vertices to make the object appear smooth.

bool GClasses::GRayTraceTriMesh::isCulled ( )
inline
bool GClasses::GRayTraceTriMesh::isPointWithinPlanarPolygon ( G3DVector pPoint,
G3DVector **  ppVertices,
size_t  nVertices 
)
protected
static GRayTraceTriMesh* GClasses::GRayTraceTriMesh::makeCylinder ( GRayTraceMaterial pMaterial,
G3DVector pCenter1,
G3DVector pCenter2,
G3DReal  radius,
size_t  nSides,
bool  bEndCaps 
)
static
static GRayTraceTriMesh* GClasses::GRayTraceTriMesh::makeQuadSurface ( GRayTraceMaterial pMaterial,
G3DVector p1,
G3DVector p2,
G3DVector p3,
G3DVector p4 
)
static

The vertices must go around the surface. Don't cut across corners.

static GRayTraceTriMesh* GClasses::GRayTraceTriMesh::makeSingleTriangle ( GRayTraceMaterial pMaterial,
G3DVector p1,
G3DVector p2,
G3DVector p3 
)
static
GRayTraceMaterial* GClasses::GRayTraceTriMesh::material ( )
inline
void GClasses::GRayTraceTriMesh::normalVector ( GRayTraceRay *  pRay,
size_t  nIndex 
)
G3DReal GClasses::GRayTraceTriMesh::rayDistanceToTriangle ( size_t  nTriangle,
G3DVector pRayOrigin,
G3DVector pRayDirection 
)
GDomNode* GClasses::GRayTraceTriMesh::serialize ( GDom pDoc,
const GRayTraceScene pScene 
) const
void GClasses::GRayTraceTriMesh::setNormal ( size_t  nIndex,
G3DVector pNormal 
)
void GClasses::GRayTraceTriMesh::setPoint ( size_t  nIndex,
const G3DVector pPoint 
)
void GClasses::GRayTraceTriMesh::setTextureCoord ( size_t  nIndex,
G3DReal  x,
G3DReal  y 
)
void GClasses::GRayTraceTriMesh::setTriangle ( size_t  nIndex,
size_t  v1,
size_t  v2,
size_t  v3 
)
void GClasses::GRayTraceTriMesh::triangle ( size_t  index,
size_t *  v1,
size_t *  v2,
size_t *  v3 
)
size_t GClasses::GRayTraceTriMesh::triangleCount ( )
inline
G3DVector* GClasses::GRayTraceTriMesh::vertex ( size_t  nIndex,
size_t  nVertex 
)

Member Data Documentation

bool GClasses::GRayTraceTriMesh::m_bCulling
protected
size_t GClasses::GRayTraceTriMesh::m_nPoints
protected
size_t GClasses::GRayTraceTriMesh::m_nTriangles
protected
GRayTraceMaterial* GClasses::GRayTraceTriMesh::m_pMaterial
protected
G3DVector* GClasses::GRayTraceTriMesh::m_pNormals
protected
G3DVector* GClasses::GRayTraceTriMesh::m_pPoints
protected
G3DReal* GClasses::GRayTraceTriMesh::m_pTextureCoords
protected
size_t* GClasses::GRayTraceTriMesh::m_pTriangles
protected