From 3d6b06e9589b726fa194ed9ac7b4760fdfcadf46 Mon Sep 17 00:00:00 2001 From: plagman Date: Sun, 29 Mar 2009 17:14:41 +0000 Subject: [PATCH] pr_specularoverride and less retarded default values for the parallax overrides. git-svn-id: https://svn.eduke32.com/eduke32@1285 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/polymer.h | 3 +++ polymer/eduke32/build/src/polymer.c | 29 ++++++++++++++++++------- polymer/eduke32/source/osdcmds.c | 3 +++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index 554b446ff..8d052a1c4 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -43,6 +43,9 @@ extern int32_t pr_gpusmoothing; extern int32_t pr_overrideparallax; extern float pr_parallaxscale; extern float pr_parallaxbias; +extern int32_t pr_overridespecular; +extern float pr_specularpower; +extern float pr_specularfactor; extern int32_t glerror; diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 51121cfb3..dec8d4ba4 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -14,8 +14,11 @@ int32_t pr_vbos = 2; int32_t pr_mirrordepth = 1; int32_t pr_gpusmoothing = 1; int32_t pr_overrideparallax = 0; -float pr_parallaxscale = 0.5f; -float pr_parallaxbias = 0.5f; +float pr_parallaxscale = 0.1f; +float pr_parallaxbias = 0.0f; +int32_t pr_overridespecular = 0; +float pr_specularpower = 15.0f; +float pr_specularfactor = 1.0f; int32_t glerror; @@ -478,7 +481,7 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = { " vec3 spotVector;\n" " vec2 spotCosRadius;\n" " float shadowResult = 1;\n" - " vec2 specularMaterial = vec2(1.0, 1.0);\n" + " vec2 specularMaterial = vec2(15.0, 1.0);\n" "\n", // frag_prog " gl_FragColor = result;\n" @@ -2968,7 +2971,8 @@ static void polymer_drawmdsprite(spritetype *tspr) sk->skinnum == tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum && sk->surfnum == surfi) { - mdspritematerial.specmaterial[0] = sk->specpower; + if (sk->specpower != 1.0) + mdspritematerial.specmaterial[0] = sk->specpower; mdspritematerial.specmaterial[1] = sk->specfactor; } @@ -3102,7 +3106,8 @@ static void polymer_getscratchmaterial(_prmaterial* material) // PR_BIT_SPECULAR_MAP material->specmap = 0; // PR_BIT_SPECULAR_MATERIAL - material->specmaterial[0] = material->specmaterial[1] = 1.0f; + material->specmaterial[0] = 15.0f; + material->specmaterial[1] = 1.0f; // PR_BIT_MIRROR_MAP material->mirrormap = 0; // PR_BIT_GLOW_MAP @@ -3189,7 +3194,8 @@ static void polymer_getbuildmaterial(_prmaterial* material, int16_t tile // PR_BIT_SPECULAR_MATERIAL if (pth->hicr) { - material->specmaterial[0] = pth->hicr->specpower; + if (pth->hicr->specpower != 1.0f) + material->specmaterial[0] = pth->hicr->specpower; material->specmaterial[1] = pth->hicr->specfactor; } @@ -3244,7 +3250,7 @@ static int32_t polymer_bindmaterial(_prmaterial material, char* lights, int programbits |= prprogrambits[PR_BIT_SPECULAR_MAP].bit; // PR_BIT_SPECULAR_MATERIAL - if ((material.specmaterial[0] != 1.0) || (material.specmaterial[1] != 1.0)) + if ((material.specmaterial[0] != 15.0) || (material.specmaterial[1] != 1.0) || pr_overridespecular) programbits |= prprogrambits[PR_BIT_SPECULAR_MATERIAL].bit; // PR_BIT_MIRROR_MAP @@ -3390,7 +3396,14 @@ static int32_t polymer_bindmaterial(_prmaterial material, char* lights, int // PR_BIT_SPECULAR_MATERIAL if (programbits & prprogrambits[PR_BIT_SPECULAR_MATERIAL].bit) { - bglUniform2fvARB(prprograms[programbits].uniform_specMaterial, 1, material.specmaterial); + float specmaterial[2]; + + if (pr_overridespecular) { + specmaterial[0] = pr_specularpower; + specmaterial[1] = pr_specularfactor; + bglUniform2fvARB(prprograms[programbits].uniform_specMaterial, 1, specmaterial); + } else + bglUniform2fvARB(prprograms[programbits].uniform_specMaterial, 1, material.specmaterial); } // PR_BIT_MIRROR_MAP diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 72aba16f4..ad50b5570 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -768,6 +768,9 @@ cvar_t cvars[] = { "pr_overrideparallax", "pr_overrideparallax: overrides parallax mapping scale and bias values with values from the pr_parallaxscale and pr_parallaxbias cvars; use it to fine-tune DEF tokens", (void*)&pr_overrideparallax, CVAR_BOOL, 0, 0, 1 }, { "pr_parallaxscale", "pr_parallaxscale: overriden parallax mapping offset scale", (void*)&pr_parallaxscale, CVAR_FLOAT, 0, -10, 10 }, { "pr_parallaxbias", "pr_parallaxbias: overriden parallax mapping offset bias", (void*)&pr_parallaxbias, CVAR_FLOAT, 0, -10, 10 }, + { "pr_overridespecular", "pr_overridespecular: overrides specular material power and factor values with values from the pr_specularpower and pr_specularfactor cvars; use it to fine-tune DEF tokens", (void*)&pr_overridespecular, CVAR_BOOL, 0, 0, 1 }, + { "pr_specularpower", "pr_specularpower: overriden specular material power", (void*)&pr_specularpower, CVAR_FLOAT, 0, -10, 1000 }, + { "pr_specularfactor", "pr_specularfactor: overriden specular material factor", (void*)&pr_specularfactor, CVAR_FLOAT, 0, -10, 1000 }, #endif #endif { "r_drawweapon", "r_drawweapon: enable/disable weapon drawing", (void*)&ud.drawweapon, CVAR_INT, 0, 0, 2 },