removed MATERIALFLAG_TRANSPARENT
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 6 Apr 2007 12:31:00 +0000 (12:31 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 6 Apr 2007 12:31:00 +0000 (12:31 +0000)
added MATERIALFLAGMASK_DEPTHSORTED - this solved a lack of sorting on EF_NODEPTHTEST entities

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

gl_rmain.c
model_alias.c
model_brush.c
model_brush.h
model_sprite.c

index 10fa60d..e616c3b 100644 (file)
@@ -2707,9 +2707,9 @@ void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t)
        if (!(ent->flags & RENDER_LIGHT))
                t->currentmaterialflags |= MATERIALFLAG_FULLBRIGHT;
        if (ent->effects & EF_ADDITIVE)
-               t->currentmaterialflags |= MATERIALFLAG_ADD | MATERIALFLAG_BLENDED | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_NOSHADOW;
+               t->currentmaterialflags |= MATERIALFLAG_ADD | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW;
        else if (t->currentalpha < 1)
-               t->currentmaterialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_NOSHADOW;
+               t->currentmaterialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW;
        if (ent->effects & EF_DOUBLESIDED)
                t->currentmaterialflags |= MATERIALFLAG_NOSHADOW | MATERIALFLAG_NOCULLFACE;
        if (ent->effects & EF_NODEPTHTEST)
@@ -2718,7 +2718,7 @@ void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t)
                t->currenttexmatrix = r_waterscrollmatrix;
        else
                t->currenttexmatrix = identitymatrix;
-       if (t->backgroundnumskinframes && !(t->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
+       if (t->backgroundnumskinframes && !(t->currentmaterialflags & MATERIALFLAGMASK_DEPTHSORTED))
                t->currentmaterialflags |= MATERIALFLAG_VERTEXTEXTUREBLEND;
 
        t->colormapping = VectorLength2(ent->colormap_pantscolor) + VectorLength2(ent->colormap_shirtcolor) >= (1.0f / 1048576.0f);
@@ -3584,7 +3584,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_TRANSPARENT))
+       if ((rsurface_texture->currentmaterialflags & MATERIALFLAGMASK_DEPTHSORTED))
                return;
        if (rsurface_mode != RSURFMODE_SKY)
        {
@@ -3683,7 +3683,7 @@ static void R_DrawTextureSurfaceList_GL20(int texturenumsurfaces, msurface_t **t
                RSurf_DrawBatch_WithLightmapSwitching(texturenumsurfaces, texturesurfacelist, 7, r_glsl_permutation->loc_Texture_Deluxemap >= 0 ? 8 : -1);
        else
                RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
-       if (rsurface_texture->backgroundnumskinframes && !(rsurface_texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
+       if (rsurface_texture->backgroundnumskinframes && !(rsurface_texture->currentmaterialflags & MATERIALFLAGMASK_DEPTHSORTED))
        {
        }
 }
@@ -4040,7 +4040,7 @@ void R_QueueSurfaceList(int numsurfaces, msurface_t **surfacelist, int flagsmask
                                ;
                        continue;
                }
-               if (rsurface_texture->currentmaterialflags & MATERIALFLAG_BLENDED)
+               if (rsurface_texture->currentmaterialflags & MATERIALFLAGMASK_DEPTHSORTED)
                {
                        // transparent surfaces get pushed off into the transparent queue
                        const msurface_t *surface = surfacelist[i];
index 9171289..e003a8a 100644 (file)
@@ -687,7 +687,7 @@ static void Mod_BuildAliasSkinFromSkinFrame(texture_t *texture, skinframe_t *ski
 
        texture->basematerialflags = MATERIALFLAG_WALL;
        if (texture->currentskinframe->fog)
-               texture->basematerialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_NOSHADOW;
+               texture->basematerialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW;
        texture->currentmaterialflags = texture->basematerialflags;
 }
 
index 66d4d27..d3ce374 100644 (file)
@@ -1514,7 +1514,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l)
                        tx->basematerialflags |= MATERIALFLAG_WALL;
                }
                if (tx->skinframes[0].fog)
-                       tx->basematerialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_NOSHADOW;
+                       tx->basematerialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW;
 
                // start out with no animation
                tx->currentframe = tx;
@@ -4485,7 +4485,7 @@ static void Mod_Q3BSP_LoadTextures(lump_t *l)
                        else
                                out->basematerialflags |= MATERIALFLAG_WALL;
                        if (shader->layers[0].alphatest)
-                               out->basematerialflags |= MATERIALFLAG_ALPHATEST | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_NOSHADOW;
+                               out->basematerialflags |= MATERIALFLAG_ALPHATEST | MATERIALFLAG_NOSHADOW;
                        if (shader->textureflags & Q3TEXTUREFLAG_TWOSIDED)
                                out->basematerialflags |= MATERIALFLAG_NOSHADOW | MATERIALFLAG_NOCULLFACE;
                        if (shader->textureflags & (Q3TEXTUREFLAG_AUTOSPRITE | Q3TEXTUREFLAG_AUTOSPRITE2))
@@ -4520,13 +4520,13 @@ Q3 shader blendfuncs actually used in the game (* = supported by DP)
                                if (shader->layers[0].blendfunc[0] != GL_ONE || shader->layers[0].blendfunc[1] != GL_ZERO)
                                {
                                        if (shader->layers[0].blendfunc[0] == GL_ONE && shader->layers[0].blendfunc[1] == GL_ONE)
-                                               out->basematerialflags |= MATERIALFLAG_ADD | MATERIALFLAG_BLENDED | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_NOSHADOW;
+                                               out->basematerialflags |= MATERIALFLAG_ADD | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW;
                                        else if (shader->layers[0].blendfunc[0] == GL_SRC_ALPHA && shader->layers[0].blendfunc[1] == GL_ONE)
-                                               out->basematerialflags |= MATERIALFLAG_ADD | MATERIALFLAG_BLENDED | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_NOSHADOW;
+                                               out->basematerialflags |= MATERIALFLAG_ADD | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW;
                                        else if (shader->layers[0].blendfunc[0] == GL_SRC_ALPHA && shader->layers[0].blendfunc[1] == GL_ONE_MINUS_SRC_ALPHA)
-                                               out->basematerialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_NOSHADOW;
+                                               out->basematerialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW;
                                        else
-                                               out->basematerialflags |= MATERIALFLAG_CUSTOMBLEND | MATERIALFLAG_FULLBRIGHT | MATERIALFLAG_BLENDED | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_NOSHADOW;
+                                               out->basematerialflags |= MATERIALFLAG_CUSTOMBLEND | MATERIALFLAG_FULLBRIGHT | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW;
                                }
                        }
                        if (!shader->lighting)
index 558f992..c4e3fb2 100644 (file)
@@ -63,8 +63,6 @@ mplane_t;
 
 //#define SURF_PLANEBACK 2
 
-// set for anything to be transparent sorted
-#define MATERIALFLAG_TRANSPARENT 1
 // use alpha blend on this material
 #define MATERIALFLAG_ALPHA 2
 // use additive blend on this material
@@ -99,6 +97,8 @@ mplane_t;
 #define MATERIALFLAG_VERTEXTEXTUREBLEND 32768
 // disables GL_CULL_FACE on this texture (making it double sided)
 #define MATERIALFLAG_NOCULLFACE 65536
+// combined mask of all attributes that require depth sorted rendering
+#define MATERIALFLAGMASK_DEPTHSORTED (MATERIALFLAG_BLENDED | MATERIALFLAG_NODEPTHTEST)
 
 typedef struct medge_s
 {
index f5d9e4e..6c18d9f 100644 (file)
@@ -44,9 +44,9 @@ static void Mod_SpriteSetupTexture(mspriteframe_t *frame, qboolean fullbright, q
        if (fullbright)
                texture->basematerialflags |= MATERIALFLAG_FULLBRIGHT;
        if (additive)
-               texture->basematerialflags |= MATERIALFLAG_ADD | MATERIALFLAG_BLENDED | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_NOSHADOW;
+               texture->basematerialflags |= MATERIALFLAG_ADD | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW;
        else if (texture->skinframes[0].fog)
-               texture->basematerialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_TRANSPARENT | MATERIALFLAG_NOSHADOW;
+               texture->basematerialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW;
        texture->currentmaterialflags = texture->basematerialflags;
        texture->currentskinframe = texture->skinframes + 0;
 }