- 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

@@ -24,6 +24,7 @@ namespace Shared{ namespace Graphics{
const int Texture::defaultSize= 256;
const int Texture::defaultComponents = 4;
bool Texture::useTextureCompression = false;
Texture::Texture(){
mipmap= true;
@@ -49,6 +50,15 @@ void Texture1D::load(const string &path){
this->path= path;
}
string Texture1D::getPath() const {
return (pixmap.getPath() != "" ? pixmap.getPath() : path);
}
void Texture1D::deletePixels() {
//printf("+++> Texture pixmap deletion for [%s]\n",getPath().c_str());
pixmap.deletePixels();
}
// =====================================================
// class Texture2D
// =====================================================
@@ -64,6 +74,15 @@ void Texture2D::load(const string &path){
this->path= path;
}
string Texture2D::getPath() const {
return (pixmap.getPath() != "" ? pixmap.getPath() : path);
}
void Texture2D::deletePixels() {
//printf("+++> Texture pixmap deletion for [%s]\n",getPath().c_str());
pixmap.deletePixels();
}
// =====================================================
// class Texture3D
// =====================================================
@@ -79,6 +98,15 @@ void Texture3D::loadSlice(const string &path, int slice){
this->path= path;
}
string Texture3D::getPath() const {
return (pixmap.getPath() != "" ? pixmap.getPath() : path);
}
void Texture3D::deletePixels() {
//printf("+++> Texture pixmap deletion for [%s]\n",getPath().c_str());
pixmap.deletePixels();
}
// =====================================================
// class TextureCube
// =====================================================
@@ -94,4 +122,25 @@ void TextureCube::loadFace(const string &path, int face){
this->path= path;
}
string TextureCube::getPath() const {
string result = "";
for(int i = 0; i < 6; ++i) {
if(pixmap.getPath(i) != "") {
if(result != "") {
result += ",";
}
result += pixmap.getPath(i);
}
}
if(result == "") {
result = path;
}
return result;
}
void TextureCube::deletePixels() {
//printf("+++> Texture pixmap deletion for [%s]\n",getPath().c_str());
pixmap.deletePixels();
}
}}//end namespace