From 766b0d5713115df5491db53489671e6473b939e3 Mon Sep 17 00:00:00 2001 From: gez Date: Wed, 26 Dec 2012 21:50:01 +0000 Subject: [PATCH] - Fixed: the OpenGL renderer ignored the VisibleToTeam/Class properties. - Updated the software shader with Korshun's latest version. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1498 b0f79afe-0144-0410-b225-9a4edf0717df --- src/gl/scene/gl_sprite.cpp | 7 +++++-- wadsrc/static/shaders/glsl/main.fp | 11 ++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index 3f3cdcff..4a9105ee 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -444,8 +444,11 @@ void GLSprite::Process(AActor* thing,sector_t * sector) // don't draw the thing that's used as camera (for viewshifts during quakes!) if (thing==GLRenderer->mViewActor) return; - // invisible things - if (thing->sprite==0) return; + // Don't waste time projecting sprites that are definitely not visible. + if (thing == NULL || thing->sprite == 0 || !thing->IsVisibleToPlayer()) + { + return; + } if (thing->renderflags & RF_INVISIBLE || !thing->RenderStyle.IsVisible(thing->alpha)) { diff --git a/wadsrc/static/shaders/glsl/main.fp b/wadsrc/static/shaders/glsl/main.fp index 79a35fee..3c017a3f 100644 --- a/wadsrc/static/shaders/glsl/main.fp +++ b/wadsrc/static/shaders/glsl/main.fp @@ -1,4 +1,9 @@ +// Changing this constant gives resuluts very similar to changing r_visibility. +// Default is 232, it seems to give exactly the same light bands as software renderer. +#define DOOMLIGHTFACTOR 232.0 + + #ifdef DYNLIGHT // ATI does not like this inside an #ifdef so it will be prepended by the compiling code inside the .EXE now. @@ -50,8 +55,12 @@ float R_DoomLightingEquation(float light, float dist) float min_L = clamp(36.0/31.0 - L, 0.0, 1.0); + // Fix objects getting totally black when close. + if (dist < 0.0001) + dist = 0.0001; + float scale = 1.0 / dist; - float index = (59.0/31.0 - L) - (scale * 232.0/31.0 - 232.0/31.0); + float index = (59.0/31.0 - L) - (scale * DOOMLIGHTFACTOR/31.0 - DOOMLIGHTFACTOR/31.0); /* result is colormap index (0 bright .. 31 dark) */ return clamp(index, min_L, 1.0);