From 6ed0ef2aaa8c87162d1a92b349e4fc8ae59ca3a1 Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 5 Oct 2009 07:59:44 +0000 Subject: [PATCH] new shader keyword: dp_specularpowermod 2, makes gloss have 2x the usual specular power git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9305 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 1 + model_shared.c | 7 +++++++ model_shared.h | 8 +++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gl_rmain.c b/gl_rmain.c index 5794e317..0af9edb5 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -5508,6 +5508,7 @@ texture_t *R_GetCurrentTexture(texture_t *t) t->specularpower = r_shadow_gloss2exponent.value; } } + t->specularpower *= t->specularpowermod; // lightmaps mode looks bad with dlights using actual texturing, so turn // off the colormap and glossmap, but leave the normalmap on as it still diff --git a/model_shared.c b/model_shared.c index bc6a98b5..2a0895a7 100644 --- a/model_shared.c +++ b/model_shared.c @@ -1416,6 +1416,7 @@ void Mod_LoadQ3Shaders(void) shader.reflectfactor = 1; Vector4Set(shader.reflectcolor4f, 1, 1, 1, 1); shader.r_water_wateralpha = 1; + shader.specularpowermod = 1; strlcpy(shader.name, com_token, sizeof(shader.name)); if (!COM_ParseToken_QuakeC(&text, false) || strcasecmp(com_token, "{")) @@ -1814,6 +1815,10 @@ void Mod_LoadQ3Shaders(void) Vector4Set(shader.reflectcolor4f, atof(parameter[8]), atof(parameter[9]), atof(parameter[10]), 1); shader.r_water_wateralpha = atof(parameter[11]); } + else if (!strcasecmp(parameter[0], "dp_specularpowermod") && numparameters >= 2) + { + shader.specularpowermod = atof(parameter[1]); + } else if (!strcasecmp(parameter[0], "deformvertexes") && numparameters >= 2) { int i, deformindex; @@ -1922,6 +1927,7 @@ qboolean Mod_LoadTextureFromQ3Shader(texture_t *texture, const char *name, qbool texflagsmask &= ~TEXF_PICMIP; if(!(defaulttexflags & TEXF_COMPRESS)) texflagsmask &= ~TEXF_COMPRESS; + texture->specularpowermod = 1; // unless later loaded from the shader if (shader) { @@ -2056,6 +2062,7 @@ nothing GL_ZERO GL_ONE texture->reflectfactor = shader->reflectfactor; Vector4Copy(shader->reflectcolor4f, texture->reflectcolor4f); texture->r_water_wateralpha = shader->r_water_wateralpha; + texture->specularpowermod = shader->specularpowermod; } else if (!strcmp(texture->name, "noshader") || !texture->name[0]) { diff --git a/model_shared.h b/model_shared.h index 9f02b21c..c5489910 100644 --- a/model_shared.h +++ b/model_shared.h @@ -384,7 +384,10 @@ typedef struct q3shaderinfo_s float reflectfactor; // amount of reflection distort (1.0 = like the cvar specifies) vec4_t reflectcolor4f; // color tint of reflection (including alpha factor) float r_water_wateralpha; // additional wateralpha to apply when r_water is active -#define Q3SHADERINFO_COMPARE_END r_water_wateralpha + + // gloss + float specularpowermod; +#define Q3SHADERINFO_COMPARE_END specularpowermod } q3shaderinfo_t; @@ -514,6 +517,9 @@ typedef struct texture_s float reflectfactor; // amount of reflection distort (1.0 = like the cvar specifies) vec4_t reflectcolor4f; // color tint of reflection (including alpha factor) float r_water_wateralpha; // additional wateralpha to apply when r_water is active + + // gloss + float specularpowermod; } texture_t; -- 2.39.2