From 8dc32923fc2d7d54c02c1b7646fdb2c5fce858b1 Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 27 Feb 2012 18:31:30 +0000 Subject: [PATCH] fix for .alpha and other effects on sprites that use the same frame, they were all reusing the same alpha value, probably also broke interpolation at the same time git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11735 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 5 ++++- render.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gl_rmain.c b/gl_rmain.c index 4a537c0a..07faae9a 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -7769,7 +7769,7 @@ texture_t *R_GetCurrentTexture(texture_t *t) dp_model_t *model = ent->model; q3shaderinfo_layer_tcmod_t *tcmod; - if (t->update_lastrenderframe == r_textureframe && t->update_lastrenderentity == (void *)ent) + if (t->update_lastrenderframe == r_textureframe && t->update_lastrenderentity == (void *)ent && !rsurface.forcecurrenttextureupdate) return t->currentframe; t->update_lastrenderframe = r_textureframe; t->update_lastrenderentity = (void *)ent; @@ -8184,6 +8184,7 @@ void RSurf_ActiveWorldEntity(void) rsurface.passcolor4f = NULL; rsurface.passcolor4f_vertexbuffer = NULL; rsurface.passcolor4f_bufferoffset = 0; + rsurface.forcecurrenttextureupdate = false; } void RSurf_ActiveModelEntity(const entity_render_t *ent, qboolean wantnormals, qboolean wanttangents, qboolean prepass) @@ -8357,6 +8358,7 @@ void RSurf_ActiveModelEntity(const entity_render_t *ent, qboolean wantnormals, q rsurface.passcolor4f = NULL; rsurface.passcolor4f_vertexbuffer = NULL; rsurface.passcolor4f_bufferoffset = 0; + rsurface.forcecurrenttextureupdate = false; } void RSurf_ActiveCustomEntity(const matrix4x4_t *matrix, const matrix4x4_t *inversematrix, int entflags, double shadertime, float r, float g, float b, float a, int numvertices, const float *vertex3f, const float *texcoord2f, const float *normal3f, const float *svector3f, const float *tvector3f, const float *color4f, int numtriangles, const int *element3i, const unsigned short *element3s, qboolean wantnormals, qboolean wanttangents) @@ -8480,6 +8482,7 @@ void RSurf_ActiveCustomEntity(const matrix4x4_t *matrix, const matrix4x4_t *inve rsurface.passcolor4f = NULL; rsurface.passcolor4f_vertexbuffer = NULL; rsurface.passcolor4f_bufferoffset = 0; + rsurface.forcecurrenttextureupdate = true; if (rsurface.modelnumvertices && rsurface.modelelement3i) { diff --git a/render.h b/render.h index 60fc6afe..7e60e504 100644 --- a/render.h +++ b/render.h @@ -244,6 +244,7 @@ typedef struct rsurfacestate_s // // this indicates the model* arrays are pointed at array_model* buffers // (in other words, the model has been animated in software) + qboolean forcecurrenttextureupdate; // set for RSurf_ActiveCustomEntity to force R_GetCurrentTexture to recalculate the texture parameters (such as entity alpha) qboolean modelgeneratedvertex; float *modelvertex3f; const r_meshbuffer_t *modelvertex3f_vertexbuffer; -- 2.39.2