mirror of
https://github.com/glest/glest-source.git
synced 2025-08-10 18:34:05 +02:00
- turned off the interpolation cache which was taking too much memory. Please test this to see if performance is affected, this should REALLY help with memory usage.
This commit is contained in:
@@ -25,6 +25,8 @@
|
|||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
#include <platform_util.h>
|
#include <platform_util.h>
|
||||||
|
//#include "interpolation.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -62,6 +64,7 @@ const string g3dviewerVersionString= "v1.3.6";
|
|||||||
string fileFormat = "png";
|
string fileFormat = "png";
|
||||||
|
|
||||||
namespace Glest { namespace Game {
|
namespace Glest { namespace Game {
|
||||||
|
|
||||||
string getGameReadWritePath(string lookupKey) {
|
string getGameReadWritePath(string lookupKey) {
|
||||||
string path = "";
|
string path = "";
|
||||||
if(path == "" && getenv("GLESTHOME") != NULL) {
|
if(path == "" && getenv("GLESTHOME") != NULL) {
|
||||||
@@ -2035,6 +2038,8 @@ END_EVENT_TABLE()
|
|||||||
// ===============================================
|
// ===============================================
|
||||||
|
|
||||||
bool App::OnInit() {
|
bool App::OnInit() {
|
||||||
|
//InterpolationData::setEnableCache(false);
|
||||||
|
|
||||||
SystemFlags::VERBOSE_MODE_ENABLED = false;
|
SystemFlags::VERBOSE_MODE_ENABLED = false;
|
||||||
//Renderer::windowW = 1920;
|
//Renderer::windowW = 1920;
|
||||||
//Renderer::windowH = 1440;
|
//Renderer::windowH = 1440;
|
||||||
|
@@ -35,12 +35,14 @@ private:
|
|||||||
|
|
||||||
std::map<float, std::map<bool, Vec3f *> > cacheVertices;
|
std::map<float, std::map<bool, Vec3f *> > cacheVertices;
|
||||||
std::map<float, std::map<bool, Vec3f *> > cacheNormals;
|
std::map<float, std::map<bool, Vec3f *> > cacheNormals;
|
||||||
bool enableCache;
|
static bool enableCache;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InterpolationData(const Mesh *mesh);
|
InterpolationData(const Mesh *mesh);
|
||||||
~InterpolationData();
|
~InterpolationData();
|
||||||
|
|
||||||
|
static void setEnableCache(bool enabled) { enableCache = enabled; }
|
||||||
|
|
||||||
const Vec3f *getVertices() const {return vertices==NULL? mesh->getVertices(): vertices;}
|
const Vec3f *getVertices() const {return vertices==NULL? mesh->getVertices(): vertices;}
|
||||||
const Vec3f *getNormals() const {return normals==NULL? mesh->getNormals(): normals;}
|
const Vec3f *getNormals() const {return normals==NULL? mesh->getNormals(): normals;}
|
||||||
|
|
||||||
|
@@ -30,6 +30,8 @@ namespace Shared{ namespace Graphics{
|
|||||||
// class InterpolationData
|
// class InterpolationData
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
|
bool InterpolationData::enableCache = false;
|
||||||
|
|
||||||
InterpolationData::InterpolationData(const Mesh *mesh) {
|
InterpolationData::InterpolationData(const Mesh *mesh) {
|
||||||
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||||
|
|
||||||
@@ -43,8 +45,6 @@ InterpolationData::InterpolationData(const Mesh *mesh) {
|
|||||||
normals= new Vec3f[mesh->getVertexCount()];
|
normals= new Vec3f[mesh->getVertexCount()];
|
||||||
}
|
}
|
||||||
|
|
||||||
enableCache = true;
|
|
||||||
|
|
||||||
cacheVertices.clear();
|
cacheVertices.clear();
|
||||||
cacheNormals.clear();
|
cacheNormals.clear();
|
||||||
}
|
}
|
||||||
|
@@ -117,6 +117,9 @@ void Mesh::end() {
|
|||||||
// ========================== shadows & interpolation =========================
|
// ========================== shadows & interpolation =========================
|
||||||
|
|
||||||
void Mesh::buildInterpolationData(){
|
void Mesh::buildInterpolationData(){
|
||||||
|
if(interpolationData != NULL) {
|
||||||
|
printf("**WARNING possible memory leak [Mesh::buildInterpolationData()]\n");
|
||||||
|
}
|
||||||
interpolationData= new InterpolationData(this);
|
interpolationData= new InterpolationData(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user