From c04b83259e65b694388feea425b4313cf8c1284c Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 6 Jul 2010 10:11:56 +0000 Subject: [PATCH] - attempt to improve rendering speed --- source/glest_game/graphics/renderer.cpp | 1 + .../shared_lib/include/graphics/interpolation.h | 4 ++-- .../sources/graphics/interpolation.cpp | 16 ++++++++++------ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 92c4911f..0f574b27 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -455,6 +455,7 @@ void Renderer::renderParticleManager(ResourceScope rs){ void Renderer::swapBuffers(){ //glFlush(); // should not be required - http://www.opengl.org/wiki/Common_Mistakes + glFlush(); GraphicsInterface::getInstance().getCurrentContext()->swapBuffers(); } diff --git a/source/shared_lib/include/graphics/interpolation.h b/source/shared_lib/include/graphics/interpolation.h index 77dd6fcb..716345d1 100644 --- a/source/shared_lib/include/graphics/interpolation.h +++ b/source/shared_lib/include/graphics/interpolation.h @@ -29,8 +29,8 @@ private: Vec3f *vertices; Vec3f *normals; - std::map cacheVertices; - std::map cacheNormals; + //std::map cacheVertices; + //std::map cacheNormals; public: InterpolationData(const Mesh *mesh); diff --git a/source/shared_lib/sources/graphics/interpolation.cpp b/source/shared_lib/sources/graphics/interpolation.cpp index e2c12049..24cb6869 100644 --- a/source/shared_lib/sources/graphics/interpolation.cpp +++ b/source/shared_lib/sources/graphics/interpolation.cpp @@ -39,14 +39,15 @@ InterpolationData::InterpolationData(const Mesh *mesh){ normals= new Vec3f[mesh->getVertexCount()]; } - cacheVertices.clear(); - cacheNormals.clear(); + //cacheVertices.clear(); + //cacheNormals.clear(); } InterpolationData::~InterpolationData(){ delete [] vertices; delete [] normals; +/* for(std::map::iterator iterVert = cacheVertices.begin(); iterVert != cacheVertices.end(); iterVert++) { delete [] iterVert->second; @@ -55,6 +56,7 @@ InterpolationData::~InterpolationData(){ iterVert != cacheNormals.end(); iterVert++) { delete [] iterVert->second; } +*/ } void InterpolationData::update(float t, bool cycle){ @@ -69,6 +71,7 @@ void InterpolationData::updateVertices(float t, bool cycle) { uint32 vertexCount= mesh->getVertexCount(); if(frameCount > 1) { +/* std::string lookupKey = floatToStr(t) + "_" + boolToStr(cycle); std::map::iterator iterFind = cacheVertices.find(lookupKey); @@ -82,7 +85,7 @@ void InterpolationData::updateVertices(float t, bool cycle) { cacheVertices[lookupKey] = new Vec3f[vertexCount]; iterFind = cacheVertices.find(lookupKey); } - +*/ const Vec3f *meshVertices= mesh->getVertices(); //misc vars @@ -99,7 +102,7 @@ void InterpolationData::updateVertices(float t, bool cycle) { //interpolate vertices for(uint32 j=0; jsecond[j] = vertices[j]; +// iterFind->second[j] = vertices[j]; } } } @@ -111,6 +114,7 @@ void InterpolationData::updateNormals(float t, bool cycle){ uint32 vertexCount= mesh->getVertexCount(); if(frameCount > 1) { +/* std::string lookupKey = floatToStr(t) + "_" + boolToStr(cycle); std::map::iterator iterFind = cacheNormals.find(lookupKey); if(iterFind != cacheNormals.end()) { @@ -123,7 +127,7 @@ void InterpolationData::updateNormals(float t, bool cycle){ cacheNormals[lookupKey] = new Vec3f[mesh->getVertexCount()]; iterFind = cacheNormals.find(lookupKey); } - +*/ const Vec3f *meshNormals= mesh->getNormals(); //misc vars @@ -140,7 +144,7 @@ void InterpolationData::updateNormals(float t, bool cycle){ //interpolate vertices for(uint32 j=0; jsecond[j] = normals[j]; +// iterFind->second[j] = normals[j]; } } }