diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/defaults.cpp | 2 | ||||
-rw-r--r-- | src/graphicsmanager.cpp | 39 | ||||
-rw-r--r-- | src/graphicsmanager.h | 1 | ||||
-rw-r--r-- | src/gui/setup_perfomance.cpp | 26 | ||||
-rw-r--r-- | src/gui/setup_perfomance.h | 8 | ||||
-rw-r--r-- | src/map.cpp | 4 |
6 files changed, 61 insertions, 19 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp index 6e36bc6db..4fb00525f 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -271,7 +271,7 @@ DefaultsData* getConfigDefaults() AddDEF("audioChannels", 2); AddDEF("repeateDelay", SDL_DEFAULT_REPEAT_DELAY); AddDEF("repeateInterval", SDL_DEFAULT_REPEAT_INTERVAL); - AddDEF("compresstextures", false); + AddDEF("compresstextures", 0); AddDEF("rectangulartextures", true); AddDEF("networksleep", 0); AddDEF("newtextures", true); diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index ba3ca95ad..f42aca9cb 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -493,7 +493,8 @@ bool GraphicsManager::supportExtension(const std::string &ext) void GraphicsManager::updateTextureFormat() { - if (config.getBoolValue("compresstextures")) + const int compressionFormat = config.getIntValue("compresstextures"); + if (compressionFormat) { // using extensions if can if (supportExtension("GL_ARB_texture_compression")) @@ -507,8 +508,12 @@ void GraphicsManager::updateTextureFormat() GLint *formats = new GLint[num > 10 ? num : 10]; glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats); for (int f = 0; f < num; f ++) + logger->log(" 0x%x", formats[f]); + + for (int f = 0; f < num; f ++) { - if (formats[f] == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) + if (formats[f] == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT + && compressionFormat == 1) { delete []formats; OpenGLImageHelper::setInternalTextureType( @@ -516,7 +521,8 @@ void GraphicsManager::updateTextureFormat() logger->log1("using s3tc texture compression"); return; } - else if (formats[f] == GL_COMPRESSED_RGBA_FXT1_3DFX) + else if (formats[f] == GL_COMPRESSED_RGBA_FXT1_3DFX + && compressionFormat == 2) { delete []formats; OpenGLImageHelper::setInternalTextureType( @@ -525,19 +531,30 @@ void GraphicsManager::updateTextureFormat() return; } } - OpenGLImageHelper::setInternalTextureType( - GL_COMPRESSED_RGBA_ARB); - logger->log1("using texture compression"); - return; + delete []formats; + if (compressionFormat == 3) + { + OpenGLImageHelper::setInternalTextureType( + GL_COMPRESSED_RGBA_ARB); + logger->log1("using ARB texture compression"); + return; + } } else { - OpenGLImageHelper::setInternalTextureType( - GL_COMPRESSED_RGBA_ARB); - logger->log1("using texture compression"); - return; + if (compressionFormat == 3) + { + OpenGLImageHelper::setInternalTextureType( + GL_COMPRESSED_RGBA_ARB); + logger->log1("using ARB texture compression"); + return; + } } } + else + { + logger->log("no correct compression format found"); + } } // using default formats diff --git a/src/graphicsmanager.h b/src/graphicsmanager.h index ad208dcb3..aab63c0d5 100644 --- a/src/graphicsmanager.h +++ b/src/graphicsmanager.h @@ -152,7 +152,6 @@ class GraphicsManager final int mSupportDebug; #endif bool mUseAtlases; - }; extern GraphicsManager graphicsManager; diff --git a/src/gui/setup_perfomance.cpp b/src/gui/setup_perfomance.cpp index 06838dcb6..9d99f6491 100644 --- a/src/gui/setup_perfomance.cpp +++ b/src/gui/setup_perfomance.cpp @@ -31,6 +31,7 @@ #include "gui/widgets/inttextfield.h" #include "gui/widgets/label.h" #include "gui/widgets/layouthelper.h" +#include "gui/widgets/namesmodel.h" #include "gui/widgets/scrollarea.h" #include "gui/widgets/setupitem.h" @@ -41,8 +42,19 @@ #include "debug.h" +static const int texturesListSize = 4; + +static const char *const texturesList[] = +{ + N_("no"), + N_("s3tc"), + N_("fxt1"), + N_("ARB") +}; + Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) : - SetupTabScroll(widget) + SetupTabScroll(widget), + mTexturesList(new NamesModel) { setName(_("Perfomance")); @@ -103,8 +115,10 @@ Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) : new SetupItemLabel(_("Different options (enable or disable can " "improve perfomance)"), "", this); - new SetupItemCheckBox(_("Enable texture compression (fast OpenGL)"), "", - "compresstextures", this, "compresstexturesEvent"); + + mTexturesList->fillFromArray(&texturesList[0], texturesListSize); + new SetupItemDropDown(_("Enable texture compression (fast OpenGL)"), "", + "compresstextures", this, "compresstexturesEvent", mTexturesList, 100); new SetupItemCheckBox(_("Enable rectangular texture extension (OpenGL)"), "", "rectangulartextures", this, "rectangulartexturesEvent"); @@ -118,6 +132,12 @@ Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) : setDimension(gcn::Rectangle(0, 0, 550, 350)); } +Setup_Perfomance::~Setup_Perfomance() +{ + delete mTexturesList; + mTexturesList = nullptr; +} + void Setup_Perfomance::apply() { SetupTabScroll::apply(); diff --git a/src/gui/setup_perfomance.h b/src/gui/setup_perfomance.h index ee6f729fc..7cfcee3b4 100644 --- a/src/gui/setup_perfomance.h +++ b/src/gui/setup_perfomance.h @@ -27,8 +27,9 @@ #include <guichan/actionlistener.hpp> -class IntTextField; class EditDialog; +class IntTextField; +class NamesModel; class Setup_Perfomance final : public SetupTabScroll { @@ -37,7 +38,12 @@ class Setup_Perfomance final : public SetupTabScroll A_DELETE_COPY(Setup_Perfomance) + ~Setup_Perfomance(); + void apply(); + + private: + NamesModel *mTexturesList; }; #endif diff --git a/src/map.cpp b/src/map.cpp index 7ec32ac12..c6aea4fcb 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -329,8 +329,8 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY) const int startX = scrollX / mTileWidth - 2; const int startY = scrollY / mTileHeight; const int endX = (graphics->mWidth + scrollX + mTileWidth - 1) - / mTileWidth; - const int endY = endPixelY / mTileHeight; + / mTileWidth + 1; + const int endY = endPixelY / mTileHeight + 1; // Make sure actors are sorted ascending by Y-coordinate // so that they overlap correctly |