mirror of
https://github.com/glest/glest-source.git
synced 2025-09-30 17:39:02 +02:00
- 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:
@@ -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
|
||||
|
Reference in New Issue
Block a user