diff --git a/source/graphics/TextureConverter.cpp b/source/graphics/TextureConverter.cpp index 68f2b075bb..8b48c66589 100644 --- a/source/graphics/TextureConverter.cpp +++ b/source/graphics/TextureConverter.cpp @@ -268,8 +268,8 @@ CTextureConverter::Settings CTextureConverter::ComputeSettings(const std::wstrin return settings; } -CTextureConverter::CTextureConverter(PIVFS vfs) : - m_VFS(vfs), m_Shutdown(false) +CTextureConverter::CTextureConverter(PIVFS vfs, bool highQuality) : + m_VFS(vfs), m_HighQuality(highQuality), m_Shutdown(false) { // Verify that we are running with at least the version we were compiled with, // to avoid bugs caused by ABI changes @@ -409,7 +409,7 @@ bool CTextureConverter::ConvertTexture(const CTexturePtr& texture, const VfsPath request->inputOptions.setWrapMode(nvtt::WrapMode_Mirror); // TODO: should this be configurable? - request->compressionOptions.setQuality(nvtt::Quality_Fastest); // TODO: allow running with higher quality + request->compressionOptions.setQuality(m_HighQuality ? nvtt::Quality_Production : nvtt::Quality_Fastest); // TODO: normal maps, gamma, etc diff --git a/source/graphics/TextureConverter.h b/source/graphics/TextureConverter.h index aebfac8db3..0de3d1ea00 100644 --- a/source/graphics/TextureConverter.h +++ b/source/graphics/TextureConverter.h @@ -148,7 +148,7 @@ public: /** * Construct texture converter, for use with files in the given vfs. */ - CTextureConverter(PIVFS vfs); + CTextureConverter(PIVFS vfs, bool highQuality); /** * Destroy texture converter and wait to shut down worker thread. @@ -200,6 +200,7 @@ private: static void* RunThread(void* data); PIVFS m_VFS; + bool m_HighQuality; pthread_t m_WorkerThread; pthread_mutex_t m_WorkerMutex; diff --git a/source/graphics/TextureManager.cpp b/source/graphics/TextureManager.cpp index b09280e6a1..c7e14bf307 100644 --- a/source/graphics/TextureManager.cpp +++ b/source/graphics/TextureManager.cpp @@ -68,8 +68,8 @@ class CTextureManagerImpl { friend class CTexture; public: - CTextureManagerImpl(PIVFS vfs, bool disableGL) - : m_VFS(vfs), m_DisableGL(disableGL), m_TextureConverter(vfs), m_DefaultHandle(0), m_ErrorHandle(0) + CTextureManagerImpl(PIVFS vfs, bool highQuality, bool disableGL) + : m_VFS(vfs), m_DisableGL(disableGL), m_TextureConverter(vfs, highQuality), m_DefaultHandle(0), m_ErrorHandle(0) { // Initialise some textures that will always be available, // without needing to load any files @@ -677,8 +677,8 @@ u32 CTexture::GetBaseColour() const // CTextureManager: forward all calls to impl: -CTextureManager::CTextureManager(PIVFS vfs, bool disableGL) : - m(new CTextureManagerImpl(vfs, disableGL)) +CTextureManager::CTextureManager(PIVFS vfs, bool highQuality, bool disableGL) : + m(new CTextureManagerImpl(vfs, highQuality, disableGL)) { } diff --git a/source/graphics/TextureManager.h b/source/graphics/TextureManager.h index 49ee51eb44..8c2a2d5c53 100644 --- a/source/graphics/TextureManager.h +++ b/source/graphics/TextureManager.h @@ -74,9 +74,10 @@ public: /** * Construct texture manager. vfs must be the VFS instance used for all textures * loaded from this object. + * highQuality is slower and intended for batch-conversion modes. * disableGL is intended for tests, and will disable all GL uploads. */ - CTextureManager(PIVFS vfs, bool disableGL = false); + CTextureManager(PIVFS vfs, bool highQuality, bool disableGL); ~CTextureManager(); diff --git a/source/graphics/tests/test_TextureManager.h b/source/graphics/tests/test_TextureManager.h index ea9c33ea46..96219ff951 100644 --- a/source/graphics/tests/test_TextureManager.h +++ b/source/graphics/tests/test_TextureManager.h @@ -59,7 +59,7 @@ public: void test_load_basic() { { - CTextureManager texman(m_VFS, true); + CTextureManager texman(m_VFS, false, true); CTexturePtr t1 = texman.CreateTexture(CTextureProperties(L"art/textures/a/demo.png")); @@ -90,7 +90,7 @@ public: // New texture manager - should use the cached file { - CTextureManager texman(m_VFS, true); + CTextureManager texman(m_VFS, false, true); CTexturePtr t1 = texman.CreateTexture(CTextureProperties(L"art/textures/a/demo.png")); @@ -102,7 +102,7 @@ public: void test_load_formats() { - CTextureManager texman(m_VFS, true); + CTextureManager texman(m_VFS, false, true); CTexturePtr t1 = texman.CreateTexture(CTextureProperties(L"art/textures/a/demo.tga")); CTexturePtr t2 = texman.CreateTexture(CTextureProperties(L"art/textures/a/demo-abgr.dds")); CTexturePtr t3 = texman.CreateTexture(CTextureProperties(L"art/textures/a/demo-dxt1.dds")); diff --git a/source/ps/ArchiveBuilder.cpp b/source/ps/ArchiveBuilder.cpp index 18f232446c..fc30f55861 100644 --- a/source/ps/ArchiveBuilder.cpp +++ b/source/ps/ArchiveBuilder.cpp @@ -68,7 +68,7 @@ void CArchiveBuilder::Build(const fs::wpath& archive) // Use CTextureManager instead of CTextureConverter directly, // so it can deal with all the loading of settings.xml files - CTextureManager texman(m_VFS, true); + CTextureManager texman(m_VFS, true, true); for (size_t i = 0; i < m_Files.size(); ++i) { diff --git a/source/renderer/Renderer.cpp b/source/renderer/Renderer.cpp index adbc69ef0d..595d258ea8 100644 --- a/source/renderer/Renderer.cpp +++ b/source/renderer/Renderer.cpp @@ -277,7 +277,7 @@ public: CRendererInternals() - : IsOpen(false), profileTable(g_Renderer.m_Stats), textureManager(g_VFS) + : IsOpen(false), profileTable(g_Renderer.m_Stats), textureManager(g_VFS, false, false) { terrainRenderer = new TerrainRenderer(); shadow = new ShadowMap();