Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

MilkShapeObject Class Reference

#include <MilkShapeObject.h>

Inherits OpenGLObject.

Inheritance diagram for MilkShapeObject:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 MilkShapeObject (const char *path, const char *filename)
virtual ~MilkShapeObject ()

Private Attributes

int m_nNumVertices
Vertexm_pVertices
int m_nNumindices
short * m_pIndices

Detailed Description

MilkShapeObject.h

Author: Petter Alstermark, petter@alstermark.com

Definition at line 14 of file MilkShapeObject.h.


Constructor & Destructor Documentation

MilkShapeObject::MilkShapeObject const char path,
const char filename
 

MilkShapeObject.cpp

Author: Petter Alstermark, petter@alstermark.com

MilkShape obj; obj.loadFromAsciiFile(path, filename);

this->m_pIndices = NULL; this->m_pVertices = NULL; this->m_nNumVertices = 0; this->m_nNumindices = 0;

int k, i, j; MS_Mesh *pMeshes = NULL; MS_Tri *pTri = NULL; MS_Vec *pVec = NULL; MS_Normal *pN = NULL; float v[3];

int numMeshes = obj.getNumMeshes(); int numTriangles; int numVertices;

pMeshes = obj.getMeshes();

for (k=0; k<numMeshes; k++) { numTriangles = pMeshes[k].getNumTriangles();

for each triangle for (i=0; i<pMeshes[k].numTriangles; i++) { pTri = pMeshes[k].triangles + i;

for each vertex for (j=0; j<3; j++) {

normal pN = pMeshes[k].normals + pTri->n[j]; glNormal3f(pN->x, pN->y, pN->z);

texture coordinate pVec = pMeshes[k].vertices + pTri->v[j]; glMultiTexCoord2fARB(GL_TEXTURE0_ARB, pVec->u, pVec->v);

glVertex3f(pVec->x, pVec->y, pVec->z); } } }

obj.clear();

Definition at line 12 of file MilkShapeObject.cpp.

MilkShapeObject::~MilkShapeObject  )  [virtual]
 

Definition at line 63 of file MilkShapeObject.cpp.


Member Data Documentation

int MilkShapeObject::m_nNumindices [private]
 

Definition at line 22 of file MilkShapeObject.h.

int MilkShapeObject::m_nNumVertices [private]
 

Definition at line 20 of file MilkShapeObject.h.

short* MilkShapeObject::m_pIndices [private]
 

Definition at line 23 of file MilkShapeObject.h.

Vertex* MilkShapeObject::m_pVertices [private]
 

Definition at line 21 of file MilkShapeObject.h.


Generated on Sun Jun 5 15:50:19 2005 for Defacto by  doxygen 1.4.3