]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
reworked transparent sorting of MATERIALFLAG_BLENDED to not sort water
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 10 Jan 2008 02:36:32 +0000 (02:36 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 10 Jan 2008 02:36:32 +0000 (02:36 +0000)
surfaces with refraction rendering (which are opaque but use a texture)

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

gl_rmain.c
gl_rsurf.c
model_brush.h

index d41416db0a01544d7dfe19f6508c65d24f1c0c00..847bc140256cffa225b3cd6baba4107dac191829 100644 (file)
@@ -1379,6 +1379,7 @@ int R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting, fl
                                mode = SHADERMODE_LIGHTDIRECTIONMAP_MODELSPACE;
                        else
                                mode = SHADERMODE_LIGHTDIRECTIONMAP_TANGENTSPACE;
+                       permutation |= SHADERPERMUTATION_DIFFUSE;
                        if (specularscale > 0)
                                permutation |= SHADERPERMUTATION_SPECULAR | SHADERPERMUTATION_DIFFUSE;
                }
@@ -1386,6 +1387,7 @@ int R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting, fl
                {
                        // fake deluxemapping (uniform light direction in tangentspace)
                        mode = SHADERMODE_LIGHTDIRECTIONMAP_TANGENTSPACE;
+                       permutation |= SHADERPERMUTATION_DIFFUSE;
                        if (specularscale > 0)
                                permutation |= SHADERPERMUTATION_SPECULAR | SHADERPERMUTATION_DIFFUSE;
                }
@@ -4161,8 +4163,12 @@ 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 & MATERIALFLAGMASK_DEPTHSORTED))
+       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;
 
        // make sure that the waterscroll matrix is used on water surfaces when
        // there is no tcmod
@@ -5515,7 +5521,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 & MATERIALFLAGMASK_DEPTHSORTED))
+       if ((rsurface.texture->currentmaterialflags & MATERIALFLAG_SORTTRANSPARENT))
                return;
        if (rsurface.mode != RSURFMODE_SKY)
        {
@@ -5685,9 +5691,6 @@ static void R_DrawTextureSurfaceList_GL20(int texturenumsurfaces, msurface_t **t
                else
                        RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
        }
-       if (rsurface.texture->backgroundnumskinframes && !(rsurface.texture->currentmaterialflags & MATERIALFLAGMASK_DEPTHSORTED))
-       {
-       }
 }
 
 static void R_DrawTextureSurfaceList_GL13(int texturenumsurfaces, msurface_t **texturesurfacelist)
@@ -6129,7 +6132,7 @@ void R_QueueSurfaceList(entity_render_t *ent, int numsurfaces, msurface_t **surf
                                ;
                        continue;
                }
-               if (rsurface.texture->currentmaterialflags & MATERIALFLAGMASK_DEPTHSORTED)
+               if (rsurface.texture->currentmaterialflags & MATERIALFLAG_SORTTRANSPARENT)
                {
                        // transparent surfaces get pushed off into the transparent queue
                        const msurface_t *surface = surfacelist[i];
index 17de2ac8aebc61cbc839c86a54271d6dff60cd27..3dad14f3aefc2cc9e29bc85d6917f6255c87b202 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 & MATERIALFLAGMASK_DEPTHSORTED)
+                               if (rsurface.texture->currentmaterialflags & MATERIALFLAG_SORTTRANSPARENT)
                                {
                                        vec3_t tempcenter, center;
                                        for (l = k;l < kend;l++)
index 7fcd23e3dbd10169b733b89ad00646abd7cbbc55..20dd05b2c315a31ff5fa7b281514624608e5ee49 100644 (file)
@@ -110,8 +110,6 @@ mplane_t;
 #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_SORTTRANSPARENT | MATERIALFLAG_BLENDED | MATERIALFLAG_NODEPTHTEST)
 
 typedef struct medge_s
 {