- a bunch of in progress work related to texture compression and more timely texture memory management cleanup. For now to test texture compression use the following ini setting: EnableTextureCompression=true

This commit is contained in:
Mark Vejvoda
2010-10-28 00:51:25 +00:00
parent 3c57f16a4a
commit de3a92081d
24 changed files with 353 additions and 100 deletions

View File

@@ -29,7 +29,7 @@ protected:
public:
GLuint getHandle() const {return handle;}
void OutputTextureDebugInfo(const Pixmap2D *pixmap,Texture::Format format, int components, const string path);
void OutputTextureDebugInfo(Texture::Format format, int components, const string path);
};
// =====================================================

View File

@@ -43,6 +43,7 @@ class Mesh{
private:
//mesh data
Texture2D *textures[meshTextureCount];
bool texturesOwned[meshTextureCount];
string texturePaths[meshTextureCount];
//vertex data counts
@@ -68,6 +69,7 @@ private:
bool customColor;
InterpolationData *interpolationData;
TextureManager *textureManager;
public:
//init & end
@@ -111,11 +113,13 @@ public:
void updateInterpolationVertices(float t, bool cycle) const;
//load
void loadV2(const string &dir, FILE *f, TextureManager *textureManager);
void loadV3(const string &dir, FILE *f, TextureManager *textureManager);
void load(const string &dir, FILE *f, TextureManager *textureManager);
void loadV2(const string &dir, FILE *f, TextureManager *textureManager,bool deletePixMapAfterLoad);
void loadV3(const string &dir, FILE *f, TextureManager *textureManager,bool deletePixMapAfterLoad);
void load(const string &dir, FILE *f, TextureManager *textureManager,bool deletePixMapAfterLoad);
void save(const string &dir, FILE *f);
void deletePixels();
private:
void computeTangents();
};
@@ -156,12 +160,13 @@ public:
uint32 getVertexCount() const;
//io
void load(const string &path);
void load(const string &path,bool deletePixMapAfterLoad=false);
void save(const string &path);
void loadG3d(const string &path);
void loadG3d(const string &path,bool deletePixMapAfterLoad=false);
void saveS3d(const string &path);
void setTextureManager(TextureManager *textureManager) {this->textureManager= textureManager;}
void deletePixels();
private:
void buildInterpolationData() const;

View File

@@ -122,6 +122,7 @@ public:
int getW() const {return w;}
int getComponents() const {return components;}
uint8 *getPixels() const {return pixels;}
void deletePixels();
string getPath() const { return path;}
};
@@ -161,6 +162,7 @@ public:
int getH() const {return h;}
int getComponents() const {return components;}
uint8 *getPixels() const {return pixels;}
void deletePixels();
//get data
void getPixel(int x, int y, uint8 *value) const;
@@ -236,6 +238,7 @@ public:
int getD() const {return d;}
int getComponents() const {return components;}
uint8 *getPixels() const {return pixels;}
void deletePixels();
string getPath() const { return path;}
};
@@ -271,6 +274,7 @@ public:
//get
Pixmap2D *getFace(int face) {return &faces[face];}
const Pixmap2D *getFace(int face) const {return &faces[face];}
void deletePixels();
string getPath(int face) const { return path[face];}
};

View File

@@ -28,10 +28,11 @@ class TextureParams;
// class Texture
// =====================================================
class Texture{
class Texture {
public:
static const int defaultSize;
static const int defaultComponents;
static bool useTextureCompression;
enum WrapMode{
wmRepeat,
@@ -69,7 +70,6 @@ public:
WrapMode getWrapMode() const {return wrapMode;}
bool getPixmapInit() const {return pixmapInit;}
Format getFormat() const {return format;}
const string getPath() const {return path;}
void setMipmap(bool mipmap) {this->mipmap= mipmap;}
void setWrapMode(WrapMode wrapMode) {this->wrapMode= wrapMode;}
@@ -78,6 +78,8 @@ public:
virtual void init(Filter filter= fBilinear, int maxAnisotropy= 1)=0;
virtual void end()=0;
virtual string getPath() const = 0;
virtual void deletePixels() = 0;
virtual void reseInitState() { inited = false; }
};
@@ -95,6 +97,8 @@ public:
Pixmap1D *getPixmap() {return &pixmap;}
const Pixmap1D *getPixmap() const {return &pixmap;}
virtual string getPath() const;
virtual void deletePixels();
};
// =====================================================
@@ -110,6 +114,8 @@ public:
Pixmap2D *getPixmap() {return &pixmap;}
const Pixmap2D *getPixmap() const {return &pixmap;}
virtual string getPath() const;
virtual void deletePixels();
};
// =====================================================
@@ -125,6 +131,8 @@ public:
Pixmap3D *getPixmap() {return &pixmap;}
const Pixmap3D *getPixmap() const {return &pixmap;}
virtual string getPath() const;
virtual void deletePixels();
};
// =====================================================
@@ -140,6 +148,8 @@ public:
PixmapCube *getPixmap() {return &pixmap;}
const PixmapCube *getPixmap() const {return &pixmap;}
virtual string getPath() const;
virtual void deletePixels();
};
}}//end namespace

View File

@@ -48,6 +48,9 @@ public:
void endLastTexture(bool mustExistInList=false);
void reinitTextures();
Texture::Filter getTextureFilter() const {return textureFilter;}
int getMaxAnisotropy() const {return maxAnisotropy;}
Texture *getTexture(const string &path);
Texture1D *newTexture1D();
Texture2D *newTexture2D();