hide one's own refraction (NOT reflection)
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 12 Feb 2010 15:04:54 +0000 (15:04 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 12 Feb 2010 15:04:54 +0000 (15:04 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9955 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
render.h

index 604df14..86ff11e 100644 (file)
@@ -6790,7 +6790,10 @@ static void R_View_UpdateEntityVisible (void)
        int samples;
        entity_render_t *ent;
 
-       renderimask = r_refdef.envmap ? (RENDER_EXTERIORMODEL | RENDER_VIEWMODEL) : ((chase_active.integer || r_waterstate.renderingscene) ? RENDER_VIEWMODEL : RENDER_EXTERIORMODEL);
+       renderimask = r_refdef.envmap                                    ? (RENDER_EXTERIORMODEL | RENDER_VIEWMODEL)
+               : r_waterstate.renderingrefraction                       ? (RENDER_EXTERIORMODEL | RENDER_VIEWMODEL)
+               : (chase_active.integer || r_waterstate.renderingscene)  ? RENDER_VIEWMODEL
+               :                                                          RENDER_EXTERIORMODEL;
        if (!r_drawviewmodel.integer)
                renderimask |= RENDER_VIEWMODEL;
        if (r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->brush.BoxTouchingVisibleLeafs)
@@ -7414,6 +7417,7 @@ static void R_Water_ProcessPlanes(void)
                // (except that a clipping plane should be used to hide everything on one side of the water, and the viewer's weapon model should be omitted)
                if (p->materialflags & (MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFRACTION))
                {
+                       r_waterstate.renderingrefraction = true;
                        r_refdef.view = myview;
                        r_refdef.view.clipplane = p->plane;
                        VectorNegate(r_refdef.view.clipplane.normal, r_refdef.view.clipplane.normal);
@@ -7426,6 +7430,7 @@ static void R_Water_ProcessPlanes(void)
                        R_RenderScene();
 
                        R_Mesh_CopyToTexture(p->texture_refraction, 0, 0, r_refdef.view.viewport.x, r_refdef.view.viewport.y, r_refdef.view.viewport.width, r_refdef.view.viewport.height);
+                       r_waterstate.renderingrefraction = false;
                }
 
        }
index d5c8a7b..31a8367 100644 (file)
--- a/render.h
+++ b/render.h
@@ -489,6 +489,7 @@ typedef struct r_waterstate_s
        qboolean enabled;
 
        qboolean renderingscene; // true while rendering a refraction or reflection texture, disables water surfaces
+       qboolean renderingrefraction;
 
        int waterwidth, waterheight;
        int texturewidth, textureheight;