fix texture compression preference
This commit is contained in:
parent
4d870a381f
commit
7cefa2bae3
|
|
@ -763,6 +763,9 @@ void TextureModeExport( ETexturesMode& self, const IntImportCallback& importer )
|
||||||
}
|
}
|
||||||
typedef ReferenceCaller1<ETexturesMode, const IntImportCallback&, TextureModeExport> TextureModeExportCaller;
|
typedef ReferenceCaller1<ETexturesMode, const IntImportCallback&, TextureModeExport> TextureModeExportCaller;
|
||||||
|
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QEvent>
|
||||||
|
|
||||||
void Textures_constructPreferences( PreferencesPage& page ){
|
void Textures_constructPreferences( PreferencesPage& page ){
|
||||||
{
|
{
|
||||||
const char* percentages[] = { "100%", "50%", "25%", "12.5%", };
|
const char* percentages[] = { "100%", "50%", "25%", "12.5%", };
|
||||||
|
|
@ -790,25 +793,43 @@ void Textures_constructPreferences( PreferencesPage& page ){
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const char* compression_none[] = { "None" };
|
//. note workaround: openGL is initialised after prefs dlg is constructed
|
||||||
const char* compression_opengl[] = { "None", "OpenGL ARB" };
|
//. solution for now is to defer dependent preference construction
|
||||||
const char* compression_s3tc[] = { "None", "S3TC DXT1", "S3TC DXT3", "S3TC DXT5" };
|
class Filter : public QObject
|
||||||
const char* compression_opengl_s3tc[] = { "None", "OpenGL ARB", "S3TC DXT1", "S3TC DXT3", "S3TC DXT5" };
|
{
|
||||||
const StringArrayRange compression(
|
using QObject::QObject;
|
||||||
( g_texture_globals.m_bOpenGLCompressionSupported )
|
protected:
|
||||||
? ( g_texture_globals.m_bS3CompressionSupported )
|
bool eventFilter( QObject *obj, QEvent *event ) override {
|
||||||
? StringArrayRange( compression_opengl_s3tc )
|
if( event->type() == QEvent::Polish ) {
|
||||||
: StringArrayRange( compression_opengl )
|
const char* compression_none[] = { "None" };
|
||||||
: ( g_texture_globals.m_bS3CompressionSupported )
|
const char* compression_opengl[] = { "None", "OpenGL ARB" };
|
||||||
? StringArrayRange( compression_s3tc )
|
const char* compression_s3tc[] = { "None", "S3TC DXT1", "S3TC DXT3", "S3TC DXT5" };
|
||||||
: StringArrayRange( compression_none )
|
const char* compression_opengl_s3tc[] = { "None", "OpenGL ARB", "S3TC DXT1", "S3TC DXT3", "S3TC DXT5" };
|
||||||
);
|
const StringArrayRange compression(
|
||||||
page.appendCombo(
|
( g_texture_globals.m_bOpenGLCompressionSupported )
|
||||||
|
? ( g_texture_globals.m_bS3CompressionSupported )
|
||||||
|
? StringArrayRange( compression_opengl_s3tc )
|
||||||
|
: StringArrayRange( compression_opengl )
|
||||||
|
: ( g_texture_globals.m_bS3CompressionSupported )
|
||||||
|
? StringArrayRange( compression_s3tc )
|
||||||
|
: StringArrayRange( compression_none )
|
||||||
|
);
|
||||||
|
QComboBox *combo = static_cast<QComboBox *>( obj );
|
||||||
|
for( const char *c : compression )
|
||||||
|
combo->addItem( c );
|
||||||
|
obj->removeEventFilter( this );
|
||||||
|
}
|
||||||
|
return QObject::eventFilter( obj, event ); // standard event processing
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
QComboBox *combo = page.appendCombo(
|
||||||
"Hardware Texture Compression",
|
"Hardware Texture Compression",
|
||||||
compression,
|
StringArrayRange(),
|
||||||
TextureCompressionImportCaller( g_texture_globals.m_nTextureCompressionFormat ),
|
TextureCompressionImportCaller( g_texture_globals.m_nTextureCompressionFormat ),
|
||||||
IntExportCaller( reinterpret_cast<int&>( g_texture_globals.m_nTextureCompressionFormat ) )
|
IntExportCaller( reinterpret_cast<int&>( g_texture_globals.m_nTextureCompressionFormat ) )
|
||||||
);
|
);
|
||||||
|
combo->installEventFilter( new Filter( combo ) );
|
||||||
}
|
}
|
||||||
page.appendCheckBox( "", "Anisotropy",
|
page.appendCheckBox( "", "Anisotropy",
|
||||||
FreeCaller1<bool, Textures_SetAnisotropy>(),
|
FreeCaller1<bool, Textures_SetAnisotropy>(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user