go back to using MATERIALFLAGMASK_DEPTHSORTED for transparent sorting
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 13 Jan 2008 08:55:59 +0000 (08:55 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 13 Jan 2008 08:55:59 +0000 (08:55 +0000)
decisions
clear MATERIALFLAG_BLENDED on watershader materials

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7955 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
gl_rsurf.c
model_brush.h

index 6d36bde..175e047 100644 (file)
@@ -4194,12 +4194,17 @@ void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t)
                t->currentmaterialflags |= MATERIALFLAG_SHORTDEPTHRANGE;
        if (ent->flags & RENDER_VIEWMODEL)
                t->currentmaterialflags |= MATERIALFLAG_SHORTDEPTHRANGE;
-       if (t->backgroundnumskinframes && !(t->currentmaterialflags & MATERIALFLAG_BLENDED))
-               t->currentmaterialflags |= MATERIALFLAG_VERTEXTEXTUREBLEND;
-       if (t->currentmaterialflags & (MATERIALFLAG_BLENDED | MATERIALFLAG_NODEPTHTEST))
-               t->currentmaterialflags |= MATERIALFLAG_SORTTRANSPARENT;
-       if (t->currentmaterialflags & (MATERIALFLAG_REFRACTION | MATERIALFLAG_WATER))
-               t->currentmaterialflags &= ~MATERIALFLAG_SORTTRANSPARENT;
+       if (t->currentmaterialflags & MATERIALFLAG_BLENDED)
+       {
+               if (t->currentmaterialflags & (MATERIALFLAG_REFRACTION | MATERIALFLAG_WATERSHADER))
+                       t->currentmaterialflags &= ~MATERIALFLAG_BLENDED;
+       }
+       else
+       {
+               if (t->backgroundnumskinframes)
+                       t->currentmaterialflags |= MATERIALFLAG_VERTEXTEXTUREBLEND;
+               t->currentmaterialflags &= ~(MATERIALFLAG_REFRACTION | MATERIALFLAG_WATERSHADER);
+       }
 
        // make sure that the waterscroll matrix is used on water surfaces when
        // there is no tcmod
@@ -5552,7 +5557,7 @@ static void R_DrawTextureSurfaceList_ShowSurfaces(int texturenumsurfaces, msurfa
 static void R_DrawTextureSurfaceList_Sky(int texturenumsurfaces, msurface_t **texturesurfacelist)
 {
        // transparent sky would be ridiculous
-       if ((rsurface.texture->currentmaterialflags & MATERIALFLAG_SORTTRANSPARENT))
+       if (rsurface.texture->currentmaterialflags & MATERIALFLAGMASK_DEPTHSORTED)
                return;
        if (rsurface.mode != RSURFMODE_SKY)
        {
@@ -6140,7 +6145,7 @@ void R_QueueSurfaceList(entity_render_t *ent, int numsurfaces, msurface_t **surf
                                ;
                        continue;
                }
-               if (rsurface.texture->currentmaterialflags & MATERIALFLAG_SORTTRANSPARENT)
+               if (rsurface.texture->currentmaterialflags & MATERIALFLAGMASK_DEPTHSORTED)
                {
                        // transparent surfaces get pushed off into the transparent queue
                        const msurface_t *surface = surfacelist[i];
index 3dad14f..17de2ac 100644 (file)
@@ -1077,7 +1077,7 @@ void R_Q1BSP_DrawLight(entity_render_t *ent, int numsurfaces, const int *surface
                        // now figure out what to do with this particular range of surfaces
                        if (rsurface.texture->currentmaterialflags & (MATERIALFLAG_WALL | MATERIALFLAG_WATER))
                        {
-                               if (rsurface.texture->currentmaterialflags & MATERIALFLAG_SORTTRANSPARENT)
+                               if (rsurface.texture->currentmaterialflags & MATERIALFLAGMASK_DEPTHSORTED)
                                {
                                        vec3_t tempcenter, center;
                                        for (l = k;l < kend;l++)
index 20dd05b..7ec6c1a 100644 (file)
@@ -104,12 +104,12 @@ mplane_t;
 #define MATERIALFLAG_REFRACTION 524288
 // render reflection
 #define MATERIALFLAG_REFLECTION 1048576
-// render water, comprising refraction and reflection (note: this is always opaque, the shader does the alpha effect)
-#define MATERIALFLAG_SORTTRANSPARENT 2097152
 // use model lighting on this material (q1bsp lightmap sampling or q3bsp lightgrid, implies FULLBRIGHT is false)
 #define MATERIALFLAG_MODELLIGHT 4194304
 // add directional model lighting to this material (q3bsp lightgrid only)
 #define MATERIALFLAG_MODELLIGHT_DIRECTIONAL 8388608
+// combined mask of all attributes that require depth sorted rendering
+#define MATERIALFLAGMASK_DEPTHSORTED (MATERIALFLAG_BLENDED | MATERIALFLAG_NODEPTHTEST)
 
 typedef struct medge_s
 {