summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2013-02-25 16:56:39 +0400
committerAndrey Nazarov <skuller@skuller.net>2013-02-25 16:56:39 +0400
commit1d77c76a9c90a346fa139a994d4ba99fbc56c46a (patch)
tree297dd550a89e600ae2932849601e756aebe4fe4a
parent10e058882fc623f853a30ef69a4abc52608dee44 (diff)
Fix texture animation on BSP submodels.
Only world auto cycles, regular BSP submodels use entity frame number for texture animation.
-rw-r--r--src/refresh/gl/gl.h2
-rw-r--r--src/refresh/gl/main.c2
-rw-r--r--src/refresh/gl/tess.c7
-rw-r--r--src/refresh/gl/world.c5
4 files changed, 13 insertions, 3 deletions
diff --git a/src/refresh/gl/gl.h b/src/refresh/gl/gl.h
index c775266..bd7fe77 100644
--- a/src/refresh/gl/gl.h
+++ b/src/refresh/gl/gl.h
@@ -99,6 +99,8 @@ extern glStatic_t gl_static;
extern glConfig_t gl_config;
extern glRefdef_t glr;
+extern entity_t gl_world;
+
typedef struct {
int nodesVisible;
int nodesDrawn;
diff --git a/src/refresh/gl/main.c b/src/refresh/gl/main.c
index b41e038..2d02de5 100644
--- a/src/refresh/gl/main.c
+++ b/src/refresh/gl/main.c
@@ -28,6 +28,8 @@ glStatic_t gl_static;
glConfig_t gl_config;
statCounters_t c;
+entity_t gl_world;
+
refcfg_t r_config;
int registration_sequence;
diff --git a/src/refresh/gl/tess.c b/src/refresh/gl/tess.c
index deb339f..3a671a3 100644
--- a/src/refresh/gl/tess.c
+++ b/src/refresh/gl/tess.c
@@ -397,13 +397,12 @@ static int GL_CopyVerts(mface_t *surf)
static int GL_TextureAnimation(mtexinfo_t *tex)
{
- int frame, c;
+ int c;
if (!tex->next)
return tex->image->texnum;
- frame = (int)(glr.fd.time * 2);
- c = frame % tex->numframes;
+ c = glr.ent->frame % tex->numframes;
while (c) {
tex = tex->next;
c--;
@@ -503,6 +502,8 @@ void GL_DrawSolidFaces(void)
void GL_DrawAlphaFaces(void)
{
+ glr.ent = &gl_world;
+
GL_BindArrays();
GL_Bits(GLS_BLEND_BLEND | GLS_DEPTHMASK_FALSE);
diff --git a/src/refresh/gl/world.c b/src/refresh/gl/world.c
index f8e7d70..8c0a1b4 100644
--- a/src/refresh/gl/world.c
+++ b/src/refresh/gl/world.c
@@ -544,6 +544,11 @@ static void GL_WorldNode_r(mnode_t *node, int clipflags)
void GL_DrawWorld(void)
{
+ // auto cycle the world frame for texture animation
+ gl_world.frame = (int)(glr.fd.time * 2);
+
+ glr.ent = &gl_world;
+
GL_MarkLeaves();
#if USE_DLIGHTS