diff --git a/mk/linux/Jamrules b/mk/linux/Jamrules index 9c6f72d3..d886e69e 100644 --- a/mk/linux/Jamrules +++ b/mk/linux/Jamrules @@ -4,7 +4,7 @@ if ! $(top_builddir) } top_srcdir = $(TOP) ; -MGFLAGS = -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -msse2 ; +MGFLAGS = -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse ; JAMCONFIG ?= $(top_builddir)/Jamconfig ; include $(JAMCONFIG) ; @@ -24,8 +24,6 @@ if $(USE_STLPORT_DEBUG) # if using streflop then add some special compiler defines if $(USE_STREFLOP) { -# COMPILER_CFLAGS_optimize += -mfpmath=sse -msse -fsingle-precision-constant -pipe -fno-strict-aliasing $(MGFLAGS) -mieee-fp -mno-tls-direct-seg-refs ; -# COMPILER_CXXFLAGS_optimize += -mfpmath=sse -msse -fsingle-precision-constant -frounding-math -pipe -fno-strict-aliasing $(MGFLAGS) -mieee-fp -mno-tls-direct-seg-refs ; CPPFLAGS += $(MGFLAGS) ; COMPILER_CFLAGS += $(MGFLAGS) ; COMPILER_CFLAGS_optimize += $(MGFLAGS) ; diff --git a/source/shared_lib/include/graphics/interpolation.h b/source/shared_lib/include/graphics/interpolation.h index 4f571ee1..5e3958fb 100644 --- a/source/shared_lib/include/graphics/interpolation.h +++ b/source/shared_lib/include/graphics/interpolation.h @@ -34,6 +34,7 @@ private: std::map > cacheVertices; std::map > cacheNormals; + bool enableCache; public: InterpolationData(const Mesh *mesh); diff --git a/source/shared_lib/sources/graphics/interpolation.cpp b/source/shared_lib/sources/graphics/interpolation.cpp index 7155f183..c98aa3ce 100644 --- a/source/shared_lib/sources/graphics/interpolation.cpp +++ b/source/shared_lib/sources/graphics/interpolation.cpp @@ -39,6 +39,8 @@ InterpolationData::InterpolationData(const Mesh *mesh){ normals= new Vec3f[mesh->getVertexCount()]; } + enableCache = true; + cacheVertices.clear(); cacheNormals.clear(); } @@ -77,21 +79,20 @@ void InterpolationData::updateVertices(float t, bool cycle) { uint32 vertexCount= mesh->getVertexCount(); if(frameCount > 1) { - - std::map >::iterator iterFind = cacheVertices.find(t); - if(iterFind != cacheVertices.end()) { - std::map::iterator iterFind2 = iterFind->second.find(cycle); - if(iterFind2 != iterFind->second.end()) { - //for(uint32 j=0; j< vertexCount; ++j){ - // vertices[j] = iterFind2->second[j]; - //} - memcpy(vertices,iterFind2->second,sizeof(Vec3f) * vertexCount); - return; + if(enableCache == true) { + std::map >::iterator iterFind = cacheVertices.find(t); + if(iterFind != cacheVertices.end()) { + std::map::iterator iterFind2 = iterFind->second.find(cycle); + if(iterFind2 != iterFind->second.end()) { + //for(uint32 j=0; j< vertexCount; ++j){ + // vertices[j] = iterFind2->second[j]; + //} + memcpy(vertices,iterFind2->second,sizeof(Vec3f) * vertexCount); + return; + } } + cacheVertices[t][cycle] = new Vec3f[vertexCount]; } - cacheVertices[t][cycle] = new Vec3f[vertexCount]; - - const Vec3f *meshVertices= mesh->getVertices(); @@ -110,7 +111,9 @@ void InterpolationData::updateVertices(float t, bool cycle) { for(uint32 j=0; jgetVertexCount(); if(frameCount > 1) { - - std::map >::iterator iterFind = cacheNormals.find(t); - if(iterFind != cacheNormals.end()) { - std::map::iterator iterFind2 = iterFind->second.find(cycle); - if(iterFind2 != iterFind->second.end()) { - //for(uint32 j=0; j< vertexCount; ++j){ - // normals[j] = iterFind2->second[j]; - //} - memcpy(normals,iterFind2->second,sizeof(Vec3f) * vertexCount); - return; + if(enableCache == true) { + std::map >::iterator iterFind = cacheNormals.find(t); + if(iterFind != cacheNormals.end()) { + std::map::iterator iterFind2 = iterFind->second.find(cycle); + if(iterFind2 != iterFind->second.end()) { + //for(uint32 j=0; j< vertexCount; ++j){ + // normals[j] = iterFind2->second[j]; + //} + memcpy(normals,iterFind2->second,sizeof(Vec3f) * vertexCount); + return; + } } + cacheNormals[t][cycle] = new Vec3f[vertexCount]; } - cacheNormals[t][cycle] = new Vec3f[vertexCount]; - const Vec3f *meshNormals= mesh->getNormals(); @@ -154,7 +157,9 @@ void InterpolationData::updateNormals(float t, bool cycle){ for(uint32 j=0; j