From: havoc Date: Sat, 22 Dec 2012 07:49:40 +0000 (+0000) Subject: fix bug with transparency sorting introduced by vortex in r11822 where X-Git-Tag: xonotic-v0.8.0~96^2~172 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dca2be00eb17f4c160d83b754d7739fd8082b4cd;p=xonotic%2Fdarkplaces.git fix bug with transparency sorting introduced by vortex in r11822 where .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 --- diff --git a/gl_rmain.c b/gl_rmain.c index d24f3a95..6d9147a7 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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; diff --git a/model_alias.c b/model_alias.c index 17d486dc..14c385bd 100644 --- a/model_alias.c +++ b/model_alias.c @@ -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) diff --git a/model_brush.c b/model_brush.c index d5fad783..f6453414 100644 --- a/model_brush.c +++ b/model_brush.c @@ -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) diff --git a/model_shared.c b/model_shared.c index 41ad9db2..1b1b29cd 100644 --- a/model_shared.c +++ b/model_shared.c @@ -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) diff --git a/model_shared.h b/model_shared.h index dedd4d8c..84fba405 100644 --- a/model_shared.h +++ b/model_shared.h @@ -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 } diff --git a/model_sprite.c b/model_sprite.c index c4d2b088..e24c8421 100644 --- a/model_sprite.c +++ b/model_sprite.c @@ -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;