NTrace
GPU ray tracing framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
FW::MeshBase Class Reference

#include <Mesh.hpp>

Inherited by FW::Mesh< V >, and FW::Mesh< FW::VertexPNT >.

Classes

struct  AttribSpec
 
struct  Material
 

Public Types

enum  AttribType {
  AttribType_Position = 0, AttribType_Normal, AttribType_Color, AttribType_TexCoord,
  AttribType_AORadius, AttribType_Max
}
 
enum  AttribFormat { AttribFormat_U8 = 0, AttribFormat_S32, AttribFormat_F32, AttribFormat_Max }
 
enum  TextureType {
  TextureType_Diffuse = 0, TextureType_Alpha, TextureType_Displacement, TextureType_Normal,
  TextureType_Environment, TextureType_Max
}
 

Public Member Functions

 MeshBase (void)
 
 MeshBase (const MeshBase &other)
 
 ~MeshBase (void)
 
int addAttrib (AttribType type, AttribFormat format, int length)
 
void addAttribs (const MeshBase &other)
 
int numAttribs (void) const
 
const AttribSpecattribSpec (int attrib) const
 
int findAttrib (AttribType type) const
 
int findNextAttrib (AttribType type, int prevAttrib) const
 
bool isCompatible (const MeshBase &other) const
 
void clear (void)
 
void set (const MeshBase &other)
 
void append (const MeshBase &other)
 
void compact (void)
 
int numVertices (void) const
 
int vertexStride (void) const
 
void resetVertices (int num)
 
void clearVertices (void)
 
void resizeVertices (int num)
 
const U8getVertexPtr (int idx=0) const
 
U8getMutableVertexPtr (int idx=0)
 
const U8vertex (int idx) const
 
U8mutableVertex (int idx)
 
void setVertex (int idx, const void *ptr)
 
void setVertices (int idx, const void *ptr, int num)
 
U8addVertex (const void *ptr=NULL)
 
U8addVertices (const void *ptr, int num)
 
Vec4f getVertexAttrib (int idx, int attrib) const
 
void setVertexAttrib (int idx, int attrib, const Vec4f &v)
 
int numSubmeshes (void) const
 
int numTriangles (void) const
 
void resizeSubmeshes (int num)
 
void clearSubmeshes (void)
 
const Array< Vec3i > & indices (int submesh) const
 
Array< Vec3i > & mutableIndices (int submesh)
 
void setIndices (int submesh, const Vec3i *ptr, int size)
 
void setIndices (int submesh, const S32 *ptr, int size)
 
void setIndices (int submesh, const Array< Vec3i > &v)
 
const Materialmaterial (int submesh) const
 
Materialmaterial (int submesh)
 
int addSubmesh (void)
 
BuffergetVBO (void)
 
int vboAttribOffset (int attrib)
 
int vboAttribStride (int attrib)
 
int vboIndexOffset (int submesh)
 
int vboIndexSize (int submesh)
 
void setGLAttrib (GLContext *gl, int attrib, int loc)
 
void draw (GLContext *gl, const Mat4f &posToCamera, const Mat4f &projection, GLContext::Program *prog=NULL, bool gouraud=false)
 
bool isInMemory (void) const
 
void freeMemory (void)
 
bool isInVBO (void) const
 
void freeVBO (void)
 
void xformPositions (const Mat4f &mat)
 
void xformNormals (const Mat3f &mat, bool normalize=true)
 
void xform (const Mat4f &mat)
 
void getBBox (Vec3f &lo, Vec3f &hi) const
 
void recomputeNormals (void)
 
void flipTriangles (void)
 
void clean (void)
 
void collapseVertices (void)
 
void dupVertsPerSubmesh (void)
 
void fixMaterialColors (void)
 
void simplify (F32 maxError)
 
const U8operator[] (int vidx) const
 
U8operator[] (int vidx)
 
MeshBaseoperator= (const MeshBase &other)
 
MeshBaseoperator+= (const MeshBase &other)
 

Detailed Description

Definition at line 36 of file Mesh.hpp.

Member Enumeration Documentation

Enumerator
AttribFormat_U8 
AttribFormat_S32 
AttribFormat_F32 
AttribFormat_Max 

Definition at line 51 of file Mesh.hpp.

Enumerator
AttribType_Position 
AttribType_Normal 
AttribType_Color 
AttribType_TexCoord 
AttribType_AORadius 
AttribType_Max 

Definition at line 39 of file Mesh.hpp.

Enumerator
TextureType_Diffuse 
TextureType_Alpha 
TextureType_Displacement 
TextureType_Normal 
TextureType_Environment 
TextureType_Max 

Definition at line 60 of file Mesh.hpp.

Constructor & Destructor Documentation

FW::MeshBase::MeshBase ( void  )
inline

Definition at line 119 of file Mesh.hpp.

FW::MeshBase::MeshBase ( const MeshBase other)
inline

Definition at line 120 of file Mesh.hpp.

FW::MeshBase::~MeshBase ( void  )
inline

Definition at line 121 of file Mesh.hpp.

Member Function Documentation

int MeshBase::addAttrib ( AttribType  type,
AttribFormat  format,
int  length 
)

Definition at line 39 of file Mesh.cpp.

void MeshBase::addAttribs ( const MeshBase other)

Definition at line 66 of file Mesh.cpp.

int FW::MeshBase::addSubmesh ( void  )
inline

Definition at line 163 of file Mesh.hpp.

U8* FW::MeshBase::addVertex ( const void ptr = NULL)
inline

Definition at line 147 of file Mesh.hpp.

U8* FW::MeshBase::addVertices ( const void ptr,
int  num 
)
inline

Definition at line 148 of file Mesh.hpp.

void MeshBase::append ( const MeshBase other)

Definition at line 135 of file Mesh.cpp.

const AttribSpec& FW::MeshBase::attribSpec ( int  attrib) const
inline

Definition at line 126 of file Mesh.hpp.

void MeshBase::clean ( void  )

Definition at line 681 of file Mesh.cpp.

void FW::MeshBase::clear ( void  )
inline

Definition at line 131 of file Mesh.hpp.

void FW::MeshBase::clearSubmeshes ( void  )
inline

Definition at line 155 of file Mesh.hpp.

void FW::MeshBase::clearVertices ( void  )
inline

Definition at line 139 of file Mesh.hpp.

void MeshBase::collapseVertices ( void  )

Definition at line 759 of file Mesh.cpp.

void MeshBase::compact ( void  )

Definition at line 200 of file Mesh.cpp.

void MeshBase::draw ( GLContext gl,
const Mat4f posToCamera,
const Mat4f projection,
GLContext::Program prog = NULL,
bool  gouraud = false 
)

Definition at line 367 of file Mesh.cpp.

void MeshBase::dupVertsPerSubmesh ( void  )

Definition at line 802 of file Mesh.cpp.

int FW::MeshBase::findAttrib ( AttribType  type) const
inline

Definition at line 127 of file Mesh.hpp.

int MeshBase::findNextAttrib ( AttribType  type,
int  prevAttrib 
) const

Definition at line 78 of file Mesh.cpp.

void MeshBase::fixMaterialColors ( void  )

Definition at line 846 of file Mesh.cpp.

void MeshBase::flipTriangles ( void  )

Definition at line 669 of file Mesh.cpp.

void MeshBase::freeMemory ( void  )

Definition at line 545 of file Mesh.cpp.

void FW::MeshBase::freeVBO ( void  )
inline

Definition at line 177 of file Mesh.hpp.

void MeshBase::getBBox ( Vec3f lo,
Vec3f hi 
) const

Definition at line 597 of file Mesh.cpp.

U8* FW::MeshBase::getMutableVertexPtr ( int  idx = 0)
inline

Definition at line 142 of file Mesh.hpp.

Buffer & MeshBase::getVBO ( void  )

Definition at line 310 of file Mesh.cpp.

Vec4f MeshBase::getVertexAttrib ( int  idx,
int  attrib 
) const

Definition at line 241 of file Mesh.cpp.

const U8* FW::MeshBase::getVertexPtr ( int  idx = 0) const
inline

Definition at line 141 of file Mesh.hpp.

const Array<Vec3i>& FW::MeshBase::indices ( int  submesh) const
inline

Definition at line 156 of file Mesh.hpp.

bool MeshBase::isCompatible ( const MeshBase other) const

Definition at line 88 of file Mesh.cpp.

bool FW::MeshBase::isInMemory ( void  ) const
inline

Definition at line 174 of file Mesh.hpp.

bool FW::MeshBase::isInVBO ( void  ) const
inline

Definition at line 176 of file Mesh.hpp.

const Material& FW::MeshBase::material ( int  submesh) const
inline

Definition at line 161 of file Mesh.hpp.

Material& FW::MeshBase::material ( int  submesh)
inline

Definition at line 162 of file Mesh.hpp.

Array<Vec3i>& FW::MeshBase::mutableIndices ( int  submesh)
inline

Definition at line 157 of file Mesh.hpp.

U8* FW::MeshBase::mutableVertex ( int  idx)
inline

Definition at line 144 of file Mesh.hpp.

int FW::MeshBase::numAttribs ( void  ) const
inline

Definition at line 125 of file Mesh.hpp.

int FW::MeshBase::numSubmeshes ( void  ) const
inline

Definition at line 152 of file Mesh.hpp.

int FW::MeshBase::numTriangles ( void  ) const
inline

Definition at line 153 of file Mesh.hpp.

int FW::MeshBase::numVertices ( void  ) const
inline

Definition at line 136 of file Mesh.hpp.

MeshBase& FW::MeshBase::operator+= ( const MeshBase other)
inline

Definition at line 195 of file Mesh.hpp.

MeshBase& FW::MeshBase::operator= ( const MeshBase other)
inline

Definition at line 194 of file Mesh.hpp.

const U8* FW::MeshBase::operator[] ( int  vidx) const
inline

Definition at line 192 of file Mesh.hpp.

U8* FW::MeshBase::operator[] ( int  vidx)
inline

Definition at line 193 of file Mesh.hpp.

void MeshBase::recomputeNormals ( void  )

Definition at line 623 of file Mesh.cpp.

void MeshBase::resetVertices ( int  num)

Definition at line 213 of file Mesh.cpp.

void MeshBase::resizeSubmeshes ( int  num)

Definition at line 281 of file Mesh.cpp.

void MeshBase::resizeVertices ( int  num)

Definition at line 227 of file Mesh.cpp.

void MeshBase::set ( const MeshBase other)

Definition at line 105 of file Mesh.cpp.

void MeshBase::setGLAttrib ( GLContext gl,
int  attrib,
int  loc 
)

Definition at line 342 of file Mesh.cpp.

void FW::MeshBase::setIndices ( int  submesh,
const Vec3i ptr,
int  size 
)
inline

Definition at line 158 of file Mesh.hpp.

void FW::MeshBase::setIndices ( int  submesh,
const S32 ptr,
int  size 
)
inline

Definition at line 159 of file Mesh.hpp.

void FW::MeshBase::setIndices ( int  submesh,
const Array< Vec3i > &  v 
)
inline

Definition at line 160 of file Mesh.hpp.

void FW::MeshBase::setVertex ( int  idx,
const void ptr 
)
inline

Definition at line 145 of file Mesh.hpp.

void MeshBase::setVertexAttrib ( int  idx,
int  attrib,
const Vec4f v 
)

Definition at line 262 of file Mesh.cpp.

void FW::MeshBase::setVertices ( int  idx,
const void ptr,
int  num 
)
inline

Definition at line 146 of file Mesh.hpp.

void MeshBase::simplify ( F32  maxError)

Definition at line 862 of file Mesh.cpp.

int FW::MeshBase::vboAttribOffset ( int  attrib)
inline

Definition at line 166 of file Mesh.hpp.

int FW::MeshBase::vboAttribStride ( int  attrib)
inline

Definition at line 167 of file Mesh.hpp.

int FW::MeshBase::vboIndexOffset ( int  submesh)
inline

Definition at line 168 of file Mesh.hpp.

int FW::MeshBase::vboIndexSize ( int  submesh)
inline

Definition at line 169 of file Mesh.hpp.

const U8* FW::MeshBase::vertex ( int  idx) const
inline

Definition at line 143 of file Mesh.hpp.

int FW::MeshBase::vertexStride ( void  ) const
inline

Definition at line 137 of file Mesh.hpp.

void FW::MeshBase::xform ( const Mat4f mat)
inline

Definition at line 181 of file Mesh.hpp.

void MeshBase::xformNormals ( const Mat3f mat,
bool  normalize = true 
)

Definition at line 579 of file Mesh.cpp.

void MeshBase::xformPositions ( const Mat4f mat)

Definition at line 561 of file Mesh.cpp.


The documentation for this class was generated from the following files: