- working VBO code for static objects in game, currently disabled in code but to enabled edit model.h and uncomment #define ENABLE_VBO_CODE

This commit is contained in:
Mark Vejvoda 2011-01-18 23:56:30 +00:00
parent 7c15f58286
commit 6b0bc35e3c
8 changed files with 195 additions and 65 deletions

View File

@ -2598,7 +2598,7 @@ void Renderer::renderMenuBackground(const MenuBackground *menuBackground){
glEnable(GL_ALPHA_TEST); glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.5f); glAlphaFunc(GL_GREATER, 0.5f);
modelRenderer->begin(true, true, true); modelRenderer->begin(true, true, true);
modelRenderer->render(menuBackground->getMainModel()); modelRenderer->render(menuBackground->getMainModelPtr());
modelRenderer->end(); modelRenderer->end();
glDisable(GL_ALPHA_TEST); glDisable(GL_ALPHA_TEST);
@ -2618,7 +2618,7 @@ void Renderer::renderMenuBackground(const MenuBackground *menuBackground){
glLoadIdentity(); glLoadIdentity();
glTranslatef(i*2.f-4.f, -1.4f, -7.5f); glTranslatef(i*2.f-4.f, -1.4f, -7.5f);
menuBackground->getCharacterModelPtr(i)->updateInterpolationData(menuBackground->getAnim(), true); menuBackground->getCharacterModelPtr(i)->updateInterpolationData(menuBackground->getAnim(), true);
modelRenderer->render(menuBackground->getCharacterModel(i)); modelRenderer->render(menuBackground->getCharacterModelPtr(i));
glPopMatrix(); glPopMatrix();
} }
modelRenderer->end(); modelRenderer->end();
@ -3319,7 +3319,7 @@ void Renderer::renderObjectsFast() {
visibleIndex < qCache.visibleObjectList.size(); ++visibleIndex) { visibleIndex < qCache.visibleObjectList.size(); ++visibleIndex) {
Object *o = qCache.visibleObjectList[visibleIndex]; Object *o = qCache.visibleObjectList[visibleIndex];
const Model *objModel= o->getModel(); Model *objModel= o->getModelPtr();
const Vec3f &v= o->getConstPos(); const Vec3f &v= o->getConstPos();
if(modelRenderStarted == false) { if(modelRenderStarted == false) {

View File

@ -87,6 +87,7 @@ public:
const Model *getCharacterModel(int i) const {return characterModels[i];} const Model *getCharacterModel(int i) const {return characterModels[i];}
Model *getCharacterModelPtr(int i) const {return characterModels[i];} Model *getCharacterModelPtr(int i) const {return characterModels[i];}
const Model *getMainModel() const {return mainModel;} const Model *getMainModel() const {return mainModel;}
Model *getMainModelPtr() const {return mainModel;}
float getFade() const {return fade;} float getFade() const {return fade;}
Vec2f getRaindropPos(int i) const {return raindropPos[i];} Vec2f getRaindropPos(int i) const {return raindropPos[i];}
float getRaindropState(int i) const {return raindropStates[i];} float getRaindropState(int i) const {return raindropStates[i];}

View File

@ -77,6 +77,7 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre
string path=dir+"/" + modelNode->getAttribute("path")->getRestrictedValue(); string path=dir+"/" + modelNode->getAttribute("path")->getRestrictedValue();
model= renderer.newModel(rsGame); model= renderer.newModel(rsGame);
model->setIsStaticModel(true);
model->load(path); model->load(path);
//default resources //default resources

View File

@ -34,16 +34,16 @@ public:
ModelRendererGl(); ModelRendererGl();
virtual void begin(bool renderNormals, bool renderTextures, bool renderColors, MeshCallback *meshCallback); virtual void begin(bool renderNormals, bool renderTextures, bool renderColors, MeshCallback *meshCallback);
virtual void end(); virtual void end();
virtual void render(const Model *model); virtual void render(Model *model);
virtual void renderNormalsOnly(const Model *model); virtual void renderNormalsOnly(Model *model);
void setDuplicateTexCoords(bool duplicateTexCoords) {this->duplicateTexCoords= duplicateTexCoords;} void setDuplicateTexCoords(bool duplicateTexCoords) {this->duplicateTexCoords= duplicateTexCoords;}
void setSecondaryTexCoordUnit(int secondaryTexCoordUnit) {this->secondaryTexCoordUnit= secondaryTexCoordUnit;} void setSecondaryTexCoordUnit(int secondaryTexCoordUnit) {this->secondaryTexCoordUnit= secondaryTexCoordUnit;}
private: private:
void renderMesh(const Mesh *mesh, bool isStaticModel); void renderMesh(Mesh *mesh, bool isStaticModel);
void renderMeshNormals(const Mesh *mesh, bool isStaticModel); void renderMeshNormals(Mesh *mesh, bool isStaticModel);
}; };
}}}//end namespace }}}//end namespace

View File

@ -76,8 +76,11 @@ private:
#if defined(ENABLE_VBO_CODE) #if defined(ENABLE_VBO_CODE)
// Vertex Buffer Object Names // Vertex Buffer Object Names
uint32 m_nVBOVertices; // Vertex VBO Name bool hasBuiltVBOs;
uint32 m_nVBOTexCoords; // Texture Coordinate VBO Name uint32 m_nVBOVertices; // Vertex VBO Name
uint32 m_nVBOTexCoords; // Texture Coordinate VBO Name
uint32 m_nVBONormals; // Normal VBO Name
uint32 m_nVBOIndexes; // Indexes VBO Name
#endif #endif
public: public:
@ -97,9 +100,15 @@ public:
uint32 getTriangleCount() const; uint32 getTriangleCount() const;
#if defined(ENABLE_VBO_CODE) #if defined(ENABLE_VBO_CODE)
uint32 getVBOVertices() const { return m_nVBOVertices;} uint32 getVBOVertices() const { return m_nVBOVertices;}
uint32 getVBOTexCoords() const { return m_nVBOTexCoords;} uint32 getVBOTexCoords() const { return m_nVBOTexCoords;}
uint32 getVBONormals() const { return m_nVBONormals;}
uint32 getVBOIndexes() const { return m_nVBOIndexes;}
bool hasBuiltVBOEntities() const { return hasBuiltVBOs;}
void BuildVBOs(); void BuildVBOs();
void ReleaseVBOs();
#endif #endif
//data //data
@ -159,6 +168,7 @@ private:
float lastTVertex; float lastTVertex;
bool lastCycleVertex; bool lastCycleVertex;
string fileName;
bool isStaticModel; bool isStaticModel;
public: public:
@ -177,6 +187,7 @@ public:
uint8 getFileVersion() const {return fileVersion;} uint8 getFileVersion() const {return fileVersion;}
uint32 getMeshCount() const {return meshCount;} uint32 getMeshCount() const {return meshCount;}
const Mesh *getMesh(int i) const {return &meshes[i];} const Mesh *getMesh(int i) const {return &meshes[i];}
Mesh *getMeshPtr(int i) const {return &meshes[i];}
uint32 getTriangleCount() const; uint32 getTriangleCount() const;
uint32 getVertexCount() const; uint32 getVertexCount() const;
@ -193,6 +204,8 @@ public:
bool getIsStaticModel() const { return isStaticModel; } bool getIsStaticModel() const { return isStaticModel; }
void setIsStaticModel(bool value) { isStaticModel = value; } void setIsStaticModel(bool value) { isStaticModel = value; }
string getFileName() const { return fileName; }
private: private:
void buildInterpolationData() const; void buildInterpolationData() const;
}; };

View File

@ -50,8 +50,8 @@ public:
virtual void begin(bool renderNormals, bool renderTextures, bool renderColors, MeshCallback *meshCallback= NULL)=0; virtual void begin(bool renderNormals, bool renderTextures, bool renderColors, MeshCallback *meshCallback= NULL)=0;
virtual void end()=0; virtual void end()=0;
virtual void render(const Model *model)=0; virtual void render(Model *model)=0;
virtual void renderNormalsOnly(const Model *model)=0; virtual void renderNormalsOnly(Model *model)=0;
}; };
}}//end namespace }}//end namespace

View File

@ -97,29 +97,34 @@ void ModelRendererGl::end() {
assertGl(); assertGl();
} }
void ModelRendererGl::render(const Model *model) { void ModelRendererGl::render(Model *model) {
//assertions //assertions
assert(rendering); assert(rendering);
assertGl(); assertGl();
//render every mesh //if(model->getIsStaticModel()) printf("In [%s::%s Line: %d] filename [%s] is static about to render...\n",__FILE__,__FUNCTION__,__LINE__,model->getFileName().c_str());
for(uint32 i=0; i<model->getMeshCount(); ++i) {
renderMesh(model->getMesh(i),model->getIsStaticModel());
}
//render every mesh
//if(model->getIsStaticModel() == true) {
for(uint32 i=0; i<model->getMeshCount(); ++i) {
renderMesh(model->getMeshPtr(i),model->getIsStaticModel());
}
//}
//assertions //assertions
assertGl(); assertGl();
} }
void ModelRendererGl::renderNormalsOnly(const Model *model) { void ModelRendererGl::renderNormalsOnly(Model *model) {
//assertions //assertions
assert(rendering); assert(rendering);
assertGl(); assertGl();
//render every mesh //render every mesh
//if(model->getIsStaticModel() == true) {
for(uint32 i=0; i<model->getMeshCount(); ++i) { for(uint32 i=0; i<model->getMeshCount(); ++i) {
renderMeshNormals(model->getMesh(i),model->getIsStaticModel()); renderMeshNormals(model->getMeshPtr(i),model->getIsStaticModel());
} }
//}
//assertions //assertions
assertGl(); assertGl();
@ -127,7 +132,7 @@ void ModelRendererGl::renderNormalsOnly(const Model *model) {
// ===================== PRIVATE ======================= // ===================== PRIVATE =======================
void ModelRendererGl::renderMesh(const Mesh *mesh, bool isStaticModel) { void ModelRendererGl::renderMesh(Mesh *mesh, bool isStaticModel) {
//assertions //assertions
assertGl(); assertGl();
@ -180,14 +185,21 @@ void ModelRendererGl::renderMesh(const Mesh *mesh, bool isStaticModel) {
#if defined(ENABLE_VBO_CODE) #if defined(ENABLE_VBO_CODE)
if(isStaticModel == true) { if(isStaticModel == true) {
if(mesh->hasBuiltVBOEntities() == false) {
mesh->BuildVBOs();
}
//vertices //vertices
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOVertices() ); glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOVertices() );
glVertexPointer( 3, GL_FLOAT, 0, (char *) NULL ); // Set The Vertex Pointer To The Vertex Buffer glVertexPointer( 3, GL_FLOAT, 0, (char *) NULL ); // Set The Vertex Pointer To The Vertex Buffer
glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
//normals //normals
if(renderNormals) { if(renderNormals) {
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBONormals() );
glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT, 0, mesh->getInterpolationData()->getNormals()); glNormalPointer(GL_FLOAT, 0, (char *) NULL);
glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
} }
else{ else{
glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_NORMAL_ARRAY);
@ -195,17 +207,55 @@ void ModelRendererGl::renderMesh(const Mesh *mesh, bool isStaticModel) {
//tex coords //tex coords
if(renderTextures && mesh->getTexture(mtDiffuse) != NULL ) { if(renderTextures && mesh->getTexture(mtDiffuse) != NULL ) {
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOTexCoords() );
if(duplicateTexCoords) { if(duplicateTexCoords) {
glActiveTexture(GL_TEXTURE0 + secondaryTexCoordUnit); glActiveTexture(GL_TEXTURE0 + secondaryTexCoordUnit);
//glEnableClientState(GL_TEXTURE_COORD_ARRAY);
//glTexCoordPointer(2, GL_FLOAT, 0, mesh->getTexCoords()); glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOTexCoords() );
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL ); // Set The TexCoord Pointer To The TexCoord Buffer
glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
}
glActiveTexture(GL_TEXTURE0);
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOTexCoords() );
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL ); // Set The TexCoord Pointer To The TexCoord Buffer
glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
}
else {
if(duplicateTexCoords) {
glActiveTexture(GL_TEXTURE0 + secondaryTexCoordUnit);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
glActiveTexture(GL_TEXTURE0);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
/*
//normals
if(renderNormals) {
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBONormals() );
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT, 0, (char *) NULL);
}
else{
glDisableClientState(GL_NORMAL_ARRAY);
}
//tex coords
if(renderTextures && mesh->getTexture(mtDiffuse) != NULL ) {
if(duplicateTexCoords) {
glActiveTexture(GL_TEXTURE0 + secondaryTexCoordUnit);
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOTexCoords() );
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL ); // Set The TexCoord Pointer To The TexCoord Buffer glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL ); // Set The TexCoord Pointer To The TexCoord Buffer
} }
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
//glEnableClientState(GL_TEXTURE_COORD_ARRAY); glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOTexCoords() );
//glTexCoordPointer(2, GL_FLOAT, 0, mesh->getTexCoords()); glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL ); // Set The TexCoord Pointer To The TexCoord Buffer glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL ); // Set The TexCoord Pointer To The TexCoord Buffer
} }
else { else {
@ -216,6 +266,7 @@ void ModelRendererGl::renderMesh(const Mesh *mesh, bool isStaticModel) {
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY);
} }
*/
} }
else else
#endif #endif
@ -254,14 +305,26 @@ void ModelRendererGl::renderMesh(const Mesh *mesh, bool isStaticModel) {
} }
} }
#if defined(ENABLE_VBO_CODE)
if(isStaticModel == true) {
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, mesh->getVBOIndexes() );
glDrawRangeElements(GL_TRIANGLES, 0, vertexCount-1, indexCount, GL_UNSIGNED_INT, (char *)NULL);
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
//glDrawRangeElements(GL_TRIANGLES, 0, vertexCount-1, indexCount, GL_UNSIGNED_INT, mesh->getIndices());
}
else
#endif
{
//draw model //draw model
glDrawRangeElements(GL_TRIANGLES, 0, vertexCount-1, indexCount, GL_UNSIGNED_INT, mesh->getIndices()); glDrawRangeElements(GL_TRIANGLES, 0, vertexCount-1, indexCount, GL_UNSIGNED_INT, mesh->getIndices());
}
//assertions //assertions
assertGl(); assertGl();
} }
void ModelRendererGl::renderMeshNormals(const Mesh *mesh,bool isStaticModel) { void ModelRendererGl::renderMeshNormals(Mesh *mesh,bool isStaticModel) {
glBegin(GL_LINES); glBegin(GL_LINES);
for(unsigned int i= 0; i<mesh->getIndexCount(); ++i){ for(unsigned int i= 0; i<mesh->getIndexCount(); ++i){

View File

@ -62,6 +62,16 @@ Mesh::Mesh() {
twoSided= false; twoSided= false;
customColor= false; customColor= false;
#if defined(ENABLE_VBO_CODE)
hasBuiltVBOs = false;
// Vertex Buffer Object Names
m_nVBOVertices = 0;
m_nVBOTexCoords = 0;
m_nVBONormals = 0;
m_nVBOIndexes = 0;
#endif
} }
Mesh::~Mesh() { Mesh::~Mesh() {
@ -76,6 +86,11 @@ void Mesh::init() {
} }
void Mesh::end() { void Mesh::end() {
#if defined(ENABLE_VBO_CODE)
void ReleaseVBOs();
#endif
delete [] vertices; delete [] vertices;
delete [] normals; delete [] normals;
delete [] texCoords; delete [] texCoords;
@ -113,21 +128,54 @@ void Mesh::updateInterpolationVertices(float t, bool cycle) {
#if defined(ENABLE_VBO_CODE) #if defined(ENABLE_VBO_CODE)
void Mesh::BuildVBOs() { void Mesh::BuildVBOs() {
// Generate And Bind The Vertex Buffer if(hasBuiltVBOs == false) {
glGenBuffersARB( 1, &m_nVBOVertices ); // Get A Valid Name //printf("In [%s::%s Line: %d] setting up a VBO...\n",__FILE__,__FUNCTION__,__LINE__);
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOVertices ); // Bind The Buffer
// Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, getVertexCount() * 3 * sizeof(float), vertices, GL_STATIC_DRAW_ARB );
// Generate And Bind The Texture Coordinate Buffer // Generate And Bind The Vertex Buffer
glGenBuffersARB( 1, &m_nVBOTexCoords ); // Get A Valid Name glGenBuffersARB( 1, &m_nVBOVertices ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOTexCoords ); // Bind The Buffer glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOVertices ); // Bind The Buffer
// Load The Data // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, getVertexCount() * 2 * sizeof(float), texCoords, GL_STATIC_DRAW_ARB ); glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, getInterpolationData()->getVertices(), GL_STATIC_DRAW_ARB );
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
// Our Copy Of The Data Is No Longer Necessary, It Is Safe In The Graphics Card // Generate And Bind The Texture Coordinate Buffer
delete [] vertices; vertices = NULL; glGenBuffersARB( 1, &m_nVBOTexCoords ); // Get A Valid Name
delete [] texCoords; texCoords = NULL; glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOTexCoords ); // Bind The Buffer
// Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f)*vertexCount, texCoords, GL_STATIC_DRAW_ARB );
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
// Generate And Bind The Normal Buffer
glGenBuffersARB( 1, &m_nVBONormals ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBONormals ); // Bind The Buffer
// Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, getInterpolationData()->getNormals(), GL_STATIC_DRAW_ARB );
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
// Generate And Bind The Index Buffer
glGenBuffersARB( 1, &m_nVBOIndexes ); // Get A Valid Name
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, m_nVBOIndexes ); // Bind The Buffer
// Load The Data
glBufferDataARB( GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(uint32)*indexCount, indices, GL_STATIC_DRAW_ARB );
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
// Our Copy Of The Data Is No Longer Necessary, It Is Safe In The Graphics Card
delete [] vertices; vertices = NULL;
delete [] texCoords; texCoords = NULL;
delete [] normals; normals = NULL;
delete [] indices; indices = NULL;
hasBuiltVBOs = true;
}
}
void Mesh::ReleaseVBOs() {
if(hasBuiltVBOs == true) {
glDeleteBuffersARB( 1, &m_nVBOVertices ); // Get A Valid Name
glDeleteBuffersARB( 1, &m_nVBOTexCoords ); // Get A Valid Name
glDeleteBuffersARB( 1, &m_nVBONormals ); // Get A Valid Name
glDeleteBuffersARB( 1, &m_nVBOIndexes ); // Get A Valid Name
}
} }
#endif #endif
@ -423,6 +471,7 @@ void Model::updateInterpolationData(float t, bool cycle) {
for(unsigned int i=0; i<meshCount; ++i){ for(unsigned int i=0; i<meshCount; ++i){
meshes[i].updateInterpolationData(t, cycle); meshes[i].updateInterpolationData(t, cycle);
} }
//if(isStaticModel) printf("In [%s::%s Line: %d] filename [%s] t = [%f] cycle = [%d] lastTData = [%f] lastCycleData [%d]\n",__FILE__,__FUNCTION__,__LINE__,this->fileName.c_str(),t,cycle,lastTData,lastCycleData);
lastTData = t; lastTData = t;
lastCycleData = cycle; lastCycleData = cycle;
} }
@ -433,6 +482,7 @@ void Model::updateInterpolationVertices(float t, bool cycle) {
for(unsigned int i=0; i<meshCount; ++i){ for(unsigned int i=0; i<meshCount; ++i){
meshes[i].updateInterpolationVertices(t, cycle); meshes[i].updateInterpolationVertices(t, cycle);
} }
//if(isStaticModel) printf("In [%s::%s Line: %d] filename [%s] t = [%f] cycle = [%d] lastTData = [%f] lastCycleData [%d]\n",__FILE__,__FUNCTION__,__LINE__,this->fileName.c_str(),t,cycle,lastTData,lastCycleData);
lastTVertex = t; lastTVertex = t;
lastCycleVertex = cycle; lastCycleVertex = cycle;
} }
@ -466,6 +516,8 @@ void Model::load(const string &path, bool deletePixMapAfterLoad) {
else{ else{
throw runtime_error("Unknown model format: " + extension); throw runtime_error("Unknown model format: " + extension);
} }
this->fileName = path;
} }
void Model::save(const string &path) { void Model::save(const string &path) {
@ -554,14 +606,14 @@ void Model::loadG3d(const string &path, bool deletePixMapAfterLoad) {
meshes[i].buildInterpolationData(); meshes[i].buildInterpolationData();
} }
#if defined(ENABLE_VBO_CODE) //#if defined(ENABLE_VBO_CODE)
if(isStaticModel == true) { // if(isStaticModel == true) {
this->updateInterpolationData(0.f, true); // this->updateInterpolationData(0.f, true);
for(uint32 i=0; i<meshCount; ++i){ // for(uint32 i=0; i<meshCount; ++i){
meshes[i].BuildVBOs(); // meshes[i].BuildVBOs();
} // }
} // }
#endif //#endif
} }
//version 3 //version 3
else if(fileHeader.version==3){ else if(fileHeader.version==3){
@ -573,14 +625,14 @@ void Model::loadG3d(const string &path, bool deletePixMapAfterLoad) {
meshes[i].buildInterpolationData(); meshes[i].buildInterpolationData();
} }
#if defined(ENABLE_VBO_CODE) //#if defined(ENABLE_VBO_CODE)
if(isStaticModel == true) { // if(isStaticModel == true) {
this->updateInterpolationData(0.f, true); // this->updateInterpolationData(0.f, true);
for(uint32 i=0; i<meshCount; ++i){ // for(uint32 i=0; i<meshCount; ++i){
meshes[i].BuildVBOs(); // meshes[i].BuildVBOs();
} // }
} // }
#endif //#endif
} }
//version 2 //version 2
else if(fileHeader.version==2) { else if(fileHeader.version==2) {
@ -591,14 +643,14 @@ void Model::loadG3d(const string &path, bool deletePixMapAfterLoad) {
meshes[i].buildInterpolationData(); meshes[i].buildInterpolationData();
} }
#if defined(ENABLE_VBO_CODE) //#if defined(ENABLE_VBO_CODE)
if(isStaticModel == true) { // if(isStaticModel == true) {
this->updateInterpolationData(0.f, true); // this->updateInterpolationData(0.f, true);
for(uint32 i=0; i<meshCount; ++i){ // for(uint32 i=0; i<meshCount; ++i){
meshes[i].BuildVBOs(); // meshes[i].BuildVBOs();
} // }
} // }
#endif //#endif
} }
else { else {
throw runtime_error("Invalid model version: "+ intToStr(fileHeader.version)); throw runtime_error("Invalid model version: "+ intToStr(fileHeader.version));