Try skin.tga in the model directory as a last-ditch-effort to load model skins. This fixes all of the Quake2World models in Radiant.

This commit is contained in:
jdolan 2013-06-29 10:16:29 -04:00
parent db226fb8d8
commit 33eff58869

View file

@ -33,6 +33,20 @@ CPicoSurface::CPicoSurface( picoSurface_t *pSurface ){
AccumulateBBox();
m_shader = QERApp_Shader_ForName( GetShaderName() );
// jdolan: If the shader fails to load, try skin.tga in the model's
// directory as a fall-back. This is a hack for malformed models.
if ( m_shader->IsDefault()) {
gchar *dir = g_path_get_dirname(m_pSurface->model->name);
gchar *skin = g_strdup_printf("%s/skin.tga", dir);
m_shader->DecRef();
m_shader = QERApp_Shader_ForName( skin );
g_free(skin);
g_free(dir);
}
}
CPicoSurface::~CPicoSurface(){