--- deliantra/Deliantra-Client/texcache.c 2007/12/25 19:08:31 1.6 +++ deliantra/Deliantra-Client/texcache.c 2009/11/26 07:19:11 1.7 @@ -58,37 +58,42 @@ } void -tc_backup (void) +tex_backup (tc_texture *tex) { - tc_texture *tex = first_texture; - while (tex) - { - tex->saved = g_slice_alloc (TC_WIDTH * TC_HEIGHT); - - glBindTexture (GL_TEXTURE_2D, tex->name); - glGetTexImage (GL_TEXTURE_2D, 0, GL_ALPHA, GL_UNSIGNED_BYTE, tex->saved); + tex->saved = g_slice_alloc (TC_WIDTH * TC_HEIGHT); - tex = tex->next; - } + glBindTexture (GL_TEXTURE_2D, tex->name); + glGetTexImage (GL_TEXTURE_2D, 0, GL_ALPHA, GL_UNSIGNED_BYTE, tex->saved); } void -tc_restore (void) +tex_restore (tc_texture *tex) { - tc_texture *tex = first_texture; + glBindTexture (GL_TEXTURE_2D, tex->name); + glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, TC_WIDTH, TC_HEIGHT, 0, GL_ALPHA, GL_UNSIGNED_BYTE, tex->saved); - while (tex) - { - glBindTexture (GL_TEXTURE_2D, tex->name); - glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, TC_WIDTH, TC_HEIGHT, 0, GL_ALPHA, GL_UNSIGNED_BYTE, tex->saved); + g_slice_free1 (TC_WIDTH * TC_HEIGHT, tex->saved); + tex->saved = 0; +} - g_slice_free1 (TC_WIDTH * TC_HEIGHT, tex->saved); - tex->saved = 0; +void +tc_backup (void) +{ + tc_texture *tex; + + for (tex = first_texture; tex; tex = tex->next) + tex_backup (tex); +} - tex = tex->next; - } +void +tc_restore (void) +{ + tc_texture *tex; + + for (tex = first_texture; tex; tex = tex->next) + tex_restore (tex); } void