};
void TextureDirectory_loadTexture( const char* directory, const char* texture ){
+ // Doom3-like dds/ prefix (used by DarkPlaces).
+ // When we list dds/textures/ folder,
+ // store the texture names without dds/ prefix.
+ if ( !strncmp( "dds/", directory, 4 ) )
+ {
+ directory = &directory[ 4 ];
+ }
+
StringOutputStream name( 256 );
name << directory << StringRange( texture, path_get_filename_base_end( texture ) );
{
LoadShaderVisitor visitor;
archive->forEachFile( Archive::VisitorFunc( visitor, Archive::eFiles, 0 ), "textures/" );
+
+ // Doom3-like dds/ prefix (used by DarkPlaces).
+ archive->forEachFile( Archive::VisitorFunc( visitor, Archive::eFiles, 0 ), "dds/textures/" );
}
else if ( extension_equal_i( path_get_extension( directory ), "wad" ) )
{
StringOutputStream dirstring( 64 );
dirstring << "textures/" << directory;
- Radiant_getImageModules().foreachModule( LoadTexturesByTypeVisitor( dirstring.c_str() ) );
+ {
+ LoadTexturesByTypeVisitor visitor( dirstring.c_str() );
+ Radiant_getImageModules().foreachModule( visitor );
+ }
+
+ // Doom3-like dds/ prefix (used by DarkPlaces).
+ dirstring.clear();
+ dirstring << "dds/textures/" << directory;
+
+ {
+ LoadTexturesByTypeVisitor visitor( dirstring.c_str() );
+ Radiant_getImageModules().foreachModule( visitor );
+ }
}
}
LoadTexturesByTypeVisitor visitor( dirstring.c_str() );
Radiant_getImageModules().foreachModule( visitor );
}
+
+ // Doom3-like dds/ prefix (used by DarkPlaces).
+ dirstring.clear();
+ dirstring << "dds/textures/" << directory;
+
+ {
+ LoadTexturesByTypeVisitor visitor( dirstring.c_str() );
+ Radiant_getImageModules().foreachModule( visitor );
+ }
}
// we'll display the newly loaded textures + all the ones already in use
return FALSE;
}
-gboolean TextureBrowser_expose( ui::Widget widget, GdkEventExpose* event, TextureBrowser* textureBrowser ){
+void TextureBrowser_redraw( TextureBrowser* textureBrowser ){
if ( glwidget_make_current( textureBrowser->m_gl_widget ) != FALSE ) {
GlobalOpenGL_debugAssertNoErrors();
TextureBrowser_evaluateHeight( *textureBrowser );
GlobalOpenGL_debugAssertNoErrors();
glwidget_swap_buffers( textureBrowser->m_gl_widget );
}
+}
+
+gboolean TextureBrowser_expose( ui::Widget widget, GdkEventExpose* event, TextureBrowser* textureBrowser ){
+ TextureBrowser_redraw( textureBrowser );
return FALSE;
}
textureBrowser.m_vframe.set_child_packing( textureBrowser.m_hframe, TRUE, TRUE, 0, ui::Packing::START );
textureBrowser.m_vframe.set_child_packing( textureBrowser.m_hfiller, FALSE, FALSE, 0, ui::Packing::START );
textureBrowser.m_vframe.set_child_packing( textureBrowser.m_gl_widget, TRUE, TRUE, 0, ui::Packing::START );
+
textureBrowser.m_gl_widget.show();
}
}
textureBrowser.m_vframe.set_child_packing( textureBrowser.m_hframe, FALSE, FALSE, 0, ui::Packing::END );
textureBrowser.m_vframe.set_child_packing( textureBrowser.m_hfiller, TRUE, TRUE, 0, ui::Packing::START);
textureBrowser.m_vframe.set_child_packing( textureBrowser.m_gl_widget, FALSE, FALSE, 0, ui::Packing::END );
- GdkEventExpose event = {};
- TextureBrowser_expose( GlobalTextureBrowser().m_gl_widget, &event, &GlobalTextureBrowser() );
+
// The hack needs the GL widget to not be hidden to work,
// so resizing it triggers the redraw of it with the new size.
// GlobalTextureBrowser().m_gl_widget.hide();
+
+ // Trigger the redraw.
+ TextureBrowser_redraw( &GlobalTextureBrowser() );
+ ui::process();
}
}
#endif // WORKAROUND_MACOS_GTK2_GLWIDGET