]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix bug with transparency sorting introduced by vortex in r11822 where
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 22 Dec 2012 07:49:40 +0000 (07:49 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Mon, 31 Dec 2012 14:31:19 +0000 (15:31 +0100)
.transparentsort was not initialized in a lot of materials, which meant
TRANSPARENTSORT_SKY was used rather than TRANSPARENTSORT_DISTANCE

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11866 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=dca2be00eb17f4c160d83b754d7739fd8082b4cd

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

index d24f3a95999b628b5c0c934f673e5332fc96acd0..6d9147a7f56211804220e59c2228c48ea694d830 100644 (file)
@@ -11867,6 +11867,9 @@ void R_DrawCustomSurface(skinframe_t *skinframe, const matrix4x4_t *texmatrix, i
        texture.offsetscale = 1;
        texture.specularscalemod = 1;
        texture.specularpowermod = 1;
+       texture.transparentsort = TRANSPARENTSORT_DISTANCE;
+       // WHEN ADDING DEFAULTS HERE, REMEMBER TO PUT DEFAULTS IN ALL LOADERS
+       // JUST GREP FOR "specularscalemod = 1".
 
        surface.texture = &texture;
        surface.num_triangles = numtriangles;
index 17d486dcbb9320e1e0ccde43867b0baf70f28401..14c385bd345b5a944e5f349369c24e350dde290b 100644 (file)
@@ -824,6 +824,9 @@ static void Mod_BuildAliasSkinFromSkinFrame(texture_t *texture, skinframe_t *ski
        texture->supercontents = SUPERCONTENTS_SOLID;
        if (!(texture->basematerialflags & MATERIALFLAG_BLENDED))
                texture->supercontents |= SUPERCONTENTS_OPAQUE;
+       texture->transparentsort = TRANSPARENTSORT_DISTANCE;
+       // WHEN ADDING DEFAULTS HERE, REMEMBER TO PUT DEFAULTS IN ALL LOADERS
+       // JUST GREP FOR "specularscalemod = 1".
 }
 
 void Mod_BuildAliasSkinsFromSkinFiles(texture_t *skin, skinfile_t *skinfile, const char *meshname, const char *shadername)
index d5fad783b518788cfda2652c95de15ec26832ae4..f6453414e4726dfd4024028b76f4f8c11dbd5b8f 100644 (file)
@@ -1680,6 +1680,9 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb)
                tx->offsetbias = 0;
                tx->specularscalemod = 1;
                tx->specularpowermod = 1;
+               tx->transparentsort = TRANSPARENTSORT_DISTANCE;
+               // WHEN ADDING DEFAULTS HERE, REMEMBER TO PUT DEFAULTS IN ALL LOADERS
+               // JUST GREP FOR "specularscalemod = 1".
        }
 
        if (!sb->cursize)
index 41ad9db23e3003b3181dce676e4cc618c86ab844..1b1b29cd15a2a2238f093da54cca817c0bc12b0e 100644 (file)
@@ -1734,6 +1734,24 @@ void Mod_LoadQ3Shaders(void)
                while (COM_ParseToken_QuakeC(&text, false))
                {
                        memset (&shader, 0, sizeof(shader));
+                       shader.name[0] = 0;
+                       shader.surfaceparms = 0;
+                       shader.surfaceflags = 0;
+                       shader.textureflags = 0;
+                       shader.numlayers = 0;
+                       shader.lighting = false;
+                       shader.vertexalpha = false;
+                       shader.textureblendalpha = false;
+                       shader.primarylayer = 0;
+                       shader.backgroundlayer = 0;
+                       shader.skyboxname[0] = 0;
+                       shader.deforms[0].deform = Q3DEFORM_NONE;
+                       shader.dpnortlight = false;
+                       shader.dpshadow = false;
+                       shader.dpnoshadow = false;
+                       shader.dpmeshcollisions = false;
+                       shader.dpshaderkill = false;
+                       shader.dpreflectcube[0] = 0;
                        shader.reflectmin = 0;
                        shader.reflectmax = 1;
                        shader.refractfactor = 1;
@@ -1741,14 +1759,19 @@ void Mod_LoadQ3Shaders(void)
                        shader.reflectfactor = 1;
                        Vector4Set(shader.reflectcolor4f, 1, 1, 1, 1);
                        shader.r_water_wateralpha = 1;
+                       shader.r_water_waterscroll[0] = 0;
+                       shader.r_water_waterscroll[1] = 0;
                        shader.offsetmapping = (mod_q3shader_default_offsetmapping.value) ? OFFSETMAPPING_DEFAULT : OFFSETMAPPING_OFF;
                        shader.offsetscale = mod_q3shader_default_offsetmapping_scale.value;
                        shader.offsetbias = mod_q3shader_default_offsetmapping_bias.value;
-                       shader.specularscalemod = 1;
-                       shader.specularpowermod = 1;
                        shader.biaspolygonoffset = mod_q3shader_default_polygonoffset.value;
                        shader.biaspolygonfactor = mod_q3shader_default_polygonfactor.value;
                        shader.transparentsort = TRANSPARENTSORT_DISTANCE;
+                       shader.specularscalemod = 1;
+                       shader.specularpowermod = 1;
+                       shader.rtlightambient = 0;
+                       // WHEN ADDING DEFAULTS HERE, REMEMBER TO PUT DEFAULTS IN ALL LOADERS
+                       // JUST GREP FOR "specularscalemod = 1".
 
                        strlcpy(shader.name, com_token, sizeof(shader.name));
                        if (!COM_ParseToken_QuakeC(&text, false) || strcasecmp(com_token, "{"))
@@ -2455,8 +2478,8 @@ qboolean Mod_LoadTextureFromQ3Shader(texture_t *texture, const char *name, qbool
        texture->specularscalemod = 1;
        texture->specularpowermod = 1; 
        texture->rtlightambient = 0;
-       // WHEN ADDING DEFAULTS HERE, REMEMBER TO SYNC TO SHADER LOADING ABOVE
-       // HERE, AND Q1BSP LOADING
+       texture->transparentsort = TRANSPARENTSORT_DISTANCE;
+       // WHEN ADDING DEFAULTS HERE, REMEMBER TO PUT DEFAULTS IN ALL LOADERS
        // JUST GREP FOR "specularscalemod = 1".
 
        if (shader)
index dedd4d8ce04d589a8bfd76a9d384e967e9106663..84fba405900608931071226dd5033afe2a5ce77b 100644 (file)
@@ -491,7 +491,7 @@ typedef struct q3shaderinfo_s
        float specularscalemod;
        float specularpowermod;
 
-       // rtlightning ambient addition
+       // rtlighting ambient addition
        float rtlightambient;
 #define Q3SHADERINFO_COMPARE_END rtlightambient
 }
index c4d2b088234a61962243ae9ef565a32efe442581..e24c8421ce84eae2e99afcb78eb6735ed2c698c7 100644 (file)
@@ -80,6 +80,9 @@ static void Mod_SpriteSetupTexture(texture_t *texture, skinframe_t *skinframe, q
        texture->supercontents = SUPERCONTENTS_SOLID;
        if (!(texture->basematerialflags & MATERIALFLAG_BLENDED))
                texture->supercontents |= SUPERCONTENTS_OPAQUE;
+       texture->transparentsort = TRANSPARENTSORT_DISTANCE;
+       // WHEN ADDING DEFAULTS HERE, REMEMBER TO PUT DEFAULTS IN ALL LOADERS
+       // JUST GREP FOR "specularscalemod = 1".
 }
 
 extern cvar_t gl_texturecompression_sprites;