From 0688522507278c3221de3d3025f576f67e87d6f9 Mon Sep 17 00:00:00 2001 From: plagman Date: Sat, 6 Jun 2009 16:00:48 +0000 Subject: [PATCH] Adds r_pr_shadowfiltering and r_pr_atiworkaround cvars. git-svn-id: https://svn.eduke32.com/eduke32@1408 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/polymer.h | 2 ++ polymer/eduke32/build/src/engine.c | 3 ++- polymer/eduke32/build/src/polymer.c | 22 +++++++++++++--------- polymer/eduke32/build/src/polymost.c | 2 ++ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index e2b2cccf5..a7746234e 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -36,6 +36,7 @@ extern int32_t pr_specularmapping; extern int32_t pr_shadows; extern int32_t pr_shadowcount; extern int32_t pr_shadowdetail; +extern int32_t pr_shadowfiltering; extern int32_t pr_maxlightpasses; extern int32_t pr_maxlightpriority; extern int32_t pr_fov; @@ -50,6 +51,7 @@ extern float pr_parallaxbias; extern int32_t pr_overridespecular; extern float pr_specularpower; extern float pr_specularfactor; +extern int32_t pr_atiworkaround; // MATERIAL typedef enum { diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 420c014ab..4dfe104b1 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -7569,7 +7569,8 @@ int32_t loadmaphack(char *filename) scriptfile_getnumber(script, &value); light.tilenum = value; - polymer_addlight(&light); + if (rendmode == 4) + polymer_addlight(&light); break; } diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 7e88f63ea..63eaf22f0 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -12,6 +12,7 @@ int32_t pr_specularmapping = 1; int32_t pr_shadows = 1; int32_t pr_shadowcount = 5; int32_t pr_shadowdetail = 4; +int32_t pr_shadowfiltering = 1; int32_t pr_maxlightpasses = 5; int32_t pr_maxlightpriority = PR_MAXLIGHTPRIORITY; int32_t pr_fov = 426; // appears to be the classic setting. @@ -26,6 +27,7 @@ float pr_parallaxbias = 0.0f; int32_t pr_overridespecular = 0; float pr_specularpower = 15.0f; float pr_specularfactor = 1.0f; +int32_t pr_atiworkaround = 0; GLenum mapvbousage = GL_STREAM_DRAW_ARB; GLenum modelvbousage = GL_STATIC_DRAW_ARB; @@ -4640,22 +4642,24 @@ static void polymer_initrendertargets(int32_t count) prrts[i].ydim = 128 << pr_shadowdetail; prrts[i].color = 0; - bglGenTextures(1, &prrts[i].color); - bglBindTexture(prrts[i].target, prrts[i].color); + if (pr_atiworkaround) { + bglGenTextures(1, &prrts[i].color); + bglBindTexture(prrts[i].target, prrts[i].color); - bglTexImage2D(prrts[i].target, 0, GL_RGBA, prrts[i].xdim, prrts[i].ydim, 0, GL_RGBA, GL_SHORT, NULL); - bglTexParameteri(prrts[i].target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - bglTexParameteri(prrts[i].target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_S, GL_CLAMP); - bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_T, GL_CLAMP); + bglTexImage2D(prrts[i].target, 0, GL_RGBA, prrts[i].xdim, prrts[i].ydim, 0, GL_RGBA, GL_SHORT, NULL); + bglTexParameteri(prrts[i].target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + bglTexParameteri(prrts[i].target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_S, GL_CLAMP); + bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_T, GL_CLAMP); + } } bglGenTextures(1, &prrts[i].z); bglBindTexture(prrts[i].target, prrts[i].z); bglTexImage2D(prrts[i].target, 0, GL_DEPTH_COMPONENT, prrts[i].xdim, prrts[i].ydim, 0, GL_DEPTH_COMPONENT, GL_SHORT, NULL); - bglTexParameteri(prrts[i].target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - bglTexParameteri(prrts[i].target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + bglTexParameteri(prrts[i].target, GL_TEXTURE_MIN_FILTER, pr_shadowfiltering ? GL_LINEAR : GL_NEAREST); + bglTexParameteri(prrts[i].target, GL_TEXTURE_MAG_FILTER, pr_shadowfiltering ? GL_LINEAR : GL_NEAREST); bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_S, GL_CLAMP); bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_T, GL_CLAMP); bglTexParameteri(prrts[i].target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 27ee7fab0..06f30ea42 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -5980,6 +5980,7 @@ void polymost_initosdfuncs(void) { "r_pr_shadows", "r_pr_shadows: enable/disable dynamic shadows", (void*)&pr_shadows, CVAR_BOOL, 0, 0, 1 }, { "r_pr_shadowcount", "r_pr_shadowcount: maximal amount of shadow emitting lights on screen - you need to restart the renderer for it to take effect", (void*)&pr_shadowcount, CVAR_INT, 0, 0, 64 }, { "r_pr_shadowdetail", "r_pr_shadowdetail: sets the shadow map resolution - you need to restart the renderer for it to take effect", (void*)&pr_shadowdetail, CVAR_INT, 0, 0, 5 }, + { "r_pr_shadowfiltering", "r_pr_shadowfiltering: enable/disable shadow edges filtering - you need to restart the renderer for it to take effect", (void*)&pr_shadowfiltering, CVAR_BOOL, 0, 0, 1 }, { "r_pr_maxlightpasses", "r_pr_maxlightpasses: the maximal amount of lights a single object can by affected by", (void*)&pr_maxlightpasses, CVAR_INT, 0, 0, 512 }, { "r_pr_maxlightpriority", "r_pr_maxlightpriority: lowering that value removes less meaningful lights from the scene", (void*)&pr_maxlightpriority, CVAR_INT, 0, 0, PR_MAXLIGHTPRIORITY }, { "r_pr_fov", "r_pr_fov: sets the field of vision in build angle", (void*)&pr_fov, CVAR_INT, 0, 0, 1023}, @@ -5994,6 +5995,7 @@ void polymost_initosdfuncs(void) { "r_pr_overridespecular", "r_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 | CVAR_NOSAVE, 0, 0, 1 }, { "r_pr_specularpower", "r_pr_specularpower: overriden specular material power", (void*)&pr_specularpower, CVAR_FLOAT | CVAR_NOSAVE, 0, -10, 1000 }, { "r_pr_specularfactor", "r_pr_specularfactor: overriden specular material factor", (void*)&pr_specularfactor, CVAR_FLOAT | CVAR_NOSAVE, 0, -10, 1000 }, + { "r_pr_atiworkaround", "r_pr_atiworkaround: enable this to workaround an ATI driver bug that causes sprite shadows to be square - you need to restart the renderer for it to take effect", (void*)&pr_atiworkaround, CVAR_BOOL, 0, 0, 1 }, #endif { "r_models","r_models: enable/disable model rendering in >8-bit mode",(void *)&usemodels, CVAR_BOOL, 0, 0, 1 },