vk: fix changing textures on buttons, etc
Detect changes in alternate_anims sequences. Fixes #640
This commit is contained in:
parent
f8c0baf78d
commit
4509e2075d
|
@ -1,6 +1,7 @@
|
||||||
# 2023-11-06 E325
|
# 2023-11-06 E325
|
||||||
- [x] fix material asserts and inherit
|
- [x] fix material asserts and inherit
|
||||||
- [ ] changing textures on buttons, etc
|
- [x] fixup -vkverboselogs
|
||||||
|
- [x] changing textures on buttons, etc
|
||||||
|
|
||||||
# 2023-11-03 E324
|
# 2023-11-03 E324
|
||||||
- [x] add cvar for displaying only specified channel
|
- [x] add cvar for displaying only specified channel
|
||||||
|
|
|
@ -404,32 +404,35 @@ static void fillWaterSurfaces( const cl_entity_t *ent, vk_brush_model_t *bmodel,
|
||||||
|
|
||||||
static rt_light_add_polygon_t loadPolyLight(const model_t *mod, const int surface_index, const msurface_t *surf, const vec3_t emissive);
|
static rt_light_add_polygon_t loadPolyLight(const model_t *mod, const int surface_index, const msurface_t *surf, const vec3_t emissive);
|
||||||
|
|
||||||
static qboolean isSurfaceAnimated( const msurface_t *s ) {
|
static qboolean doesTextureChainChange( const texture_t *const base ) {
|
||||||
const texture_t *base = s->texinfo->texture;
|
const texture_t *cur = base;
|
||||||
|
if (!cur)
|
||||||
/* FIXME don't have ent here, need to check both explicitly
|
|
||||||
if( ent && ent->curstate.frame ) {
|
|
||||||
if( base->alternate_anims )
|
|
||||||
base = base->alternate_anims;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if( !base->anim_total )
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
cur = cur->anim_next;
|
||||||
|
while (cur && cur != base) {
|
||||||
|
if (cur->gl_texturenum != base->gl_texturenum)
|
||||||
|
return true;
|
||||||
|
cur = cur->anim_next;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean isSurfaceAnimated( const msurface_t *s ) {
|
||||||
|
const texture_t *const base = s->texinfo->texture;
|
||||||
|
|
||||||
|
if( !base->anim_total && !base->alternate_anims )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* TODO why did we do this? It doesn't seem to rule out animation really.
|
||||||
if( base->name[0] == '-' )
|
if( base->name[0] == '-' )
|
||||||
return false;
|
return false;
|
||||||
|
*/
|
||||||
|
|
||||||
// It is not an animation if all textures are the same
|
if (base->alternate_anims && base->gl_texturenum != base->alternate_anims->gl_texturenum)
|
||||||
const texture_t *prev = base;
|
return true;
|
||||||
base = base->anim_next;
|
|
||||||
while (base && base != prev) {
|
|
||||||
if (prev->gl_texturenum != base->gl_texturenum)
|
|
||||||
return true;
|
|
||||||
base = base->anim_next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return doesTextureChainChange(base) || doesTextureChainChange(base->alternate_anims);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -742,7 +745,6 @@ void VK_BrushModelDraw( const cl_entity_t *ent, int render_mode, float blend, co
|
||||||
const int geom_index = bmodel->animated_indexes[i];
|
const int geom_index = bmodel->animated_indexes[i];
|
||||||
vk_render_geometry_t *geom = bmodel->render_model.geometries + geom_index;
|
vk_render_geometry_t *geom = bmodel->render_model.geometries + geom_index;
|
||||||
const int surface_index = geom->surf_deprecate - mod->surfaces;
|
const int surface_index = geom->surf_deprecate - mod->surfaces;
|
||||||
const xvk_patch_surface_t *const patch_surface = R_VkPatchGetSurface(surface_index);
|
|
||||||
|
|
||||||
// Optionally patch by texture_s pointer and run animations
|
// Optionally patch by texture_s pointer and run animations
|
||||||
const texture_t *t = R_TextureAnimation(ent, geom->surf_deprecate);
|
const texture_t *t = R_TextureAnimation(ent, geom->surf_deprecate);
|
||||||
|
|
Loading…
Reference in New Issue