diff --git a/libs/video/renderer/gl/gl_mod_alias.c b/libs/video/renderer/gl/gl_mod_alias.c index 50481a1f6..aa29022c3 100644 --- a/libs/video/renderer/gl/gl_mod_alias.c +++ b/libs/video/renderer/gl/gl_mod_alias.c @@ -769,8 +769,10 @@ R_DrawAliasModel (entity_t *e) qfglColor4fv (e->colormod); - qfglBindTexture (GL_TEXTURE_2D, fb_texture); + qfglBindTexture (GL_TEXTURE_2D, fb_texture); + Fog_StartAdditive (); GL_DrawAliasFrameTri (vo); + Fog_StopAdditive (); if (gl_vector_light->int_val) { qfglEnable (GL_LIGHTING); @@ -790,7 +792,9 @@ R_DrawAliasModel (entity_t *e) qfglColor4fv (e->colormod); qfglBindTexture (GL_TEXTURE_2D, fb_texture); + Fog_StartAdditive (); GL_DrawAliasFrame (vo); + Fog_StopAdditive (); if (gl_vector_light->int_val) { qfglEnable (GL_LIGHTING); diff --git a/libs/video/renderer/gl/gl_rmain.c b/libs/video/renderer/gl/gl_rmain.c index d95abc43f..d6da026be 100644 --- a/libs/video/renderer/gl/gl_rmain.c +++ b/libs/video/renderer/gl/gl_rmain.c @@ -407,6 +407,8 @@ R_SetupFrame (void) r_framecount++; + Fog_SetupFrame (); + // build the transformation matrix for the given view angles VectorCopy (r_refdef.vieworg, r_origin); @@ -524,6 +526,7 @@ R_RenderScene (void) R_SetupFrame (); R_SetupGL (); + Fog_EnableGFog (); R_MarkLeaves (); // done here so we know if we're in water R_PushDlights (vec3_origin); R_DrawWorld (); // adds static entities to the list @@ -531,6 +534,13 @@ R_RenderScene (void) R_DrawEntitiesOnList (); R_RenderDlights (); + R_DrawWaterSurfaces (); + R_DrawParticles (); + + Fog_DisableGFog (); + + R_DrawViewModel (); + if (R_TestErrors (0)) R_DisplayErrors (); R_ClearErrors (); @@ -628,9 +638,6 @@ R_RenderView_ (void) // render normal view R_RenderScene (); - R_DrawViewModel (); - R_DrawWaterSurfaces (); - R_DrawParticles (); // render mirror view R_Mirror (); diff --git a/libs/video/renderer/gl/gl_rmisc.c b/libs/video/renderer/gl/gl_rmisc.c index 1f225d2ba..bd4343084 100644 --- a/libs/video/renderer/gl/gl_rmisc.c +++ b/libs/video/renderer/gl/gl_rmisc.c @@ -153,6 +153,7 @@ R_Init (void) r_init = 1; R_InitParticles (); R_InitSprites (); + Fog_Init (); } VISIBLE void diff --git a/libs/video/renderer/gl/gl_rsurf.c b/libs/video/renderer/gl/gl_rsurf.c index 262b7ed5e..ef80348eb 100644 --- a/libs/video/renderer/gl/gl_rsurf.c +++ b/libs/video/renderer/gl/gl_rsurf.c @@ -638,10 +638,11 @@ test_node (mnode_t *node) static void R_RecursiveWorldNode (mnode_t *node) { +#define NODE_STACK 1024 struct { mnode_t *node; int side; - } *node_ptr, node_stack[1024]; + } *node_ptr, node_stack[NODE_STACK]; mnode_t *front; int side; @@ -652,8 +653,7 @@ R_RecursiveWorldNode (mnode_t *node) side = get_side (node); front = node->children[side]; if (test_node (front)) { - if (node_ptr - node_stack - == sizeof (node_stack) / sizeof (node_stack[0])) + if (node_ptr - node_stack == NODE_STACK) Sys_Error ("node_stack overflow"); node_ptr->node = node; node_ptr->side = side;