]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
new shader keyword: dp_specularpowermod 2, makes gloss have 2x the usual specular...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 5 Oct 2009 07:59:44 +0000 (07:59 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 5 Oct 2009 07:59:44 +0000 (07:59 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9305 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
model_shared.c
model_shared.h

index 5794e317410a550e16d0b5afd79015a9243a9f39..0af9edb5517abd32d5fbe4dc20dd4a5630170c51 100644 (file)
@@ -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
index bc6a98b5078c6495cc7128f08ff4436587820fff..2a0895a73875526bbc4d18291372615e31dc5963 100644 (file)
@@ -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])
        {
index 9f02b21c7bf1eda922d607189ddc30dd6f41dea9..c5489910a91b2680b0595ab40a15fd13e9bd2e83 100644 (file)
@@ -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;