This commit is contained in:
Rachael Alexanderson 2017-07-09 20:09:12 -04:00
commit e1b4bb11ba
19 changed files with 114 additions and 71 deletions

View file

@ -40,6 +40,7 @@
EXTERN_CVAR(Bool, r_shadercolormaps)
EXTERN_CVAR(Int, screenblocks)
EXTERN_CVAR(Float, r_visibility)
void InitGLRMapinfoData();
/////////////////////////////////////////////////////////////////////////////
@ -122,6 +123,7 @@ void PolyRenderer::RenderActorView(AActor *actor, bool dontmaplines)
if (APART(R_OldBlend)) NormalLight.Maps = realcolormaps.Maps;
else NormalLight.Maps = realcolormaps.Maps + NUMCOLORMAPS * 256 * R_OldBlend;
Light.SetVisibility(Viewwindow, r_visibility);
PolyCameraLight::Instance()->SetCamera(Viewpoint, RenderTarget, actor);
//Viewport->SetupFreelook();

View file

@ -27,6 +27,11 @@
#include "poly_light.h"
#include "polyrenderer/poly_renderer.h"
void PolyLightVisibility::SetVisibility(FViewWindow &viewwindow, float vis)
{
GlobVis = R_GetGlobVis(viewwindow, vis);
}
fixed_t PolyLightVisibility::LightLevelToShade(int lightlevel, bool foggy)
{
bool nolightfade = !foggy && ((level.flags3 & LEVEL3_NOLIGHTFADE));
@ -42,8 +47,3 @@ fixed_t PolyLightVisibility::LightLevelToShade(int lightlevel, bool foggy)
return (NUMCOLORMAPS * 2 * FRACUNIT) - ((lightlevel + 12) * (FRACUNIT*NUMCOLORMAPS / 128));
}
}
double PolyLightVisibility::FocalTangent()
{
return PolyRenderer::Instance()->Viewwindow.FocalTangent;
}

View file

@ -24,6 +24,8 @@
#include "swrenderer/scene/r_light.h"
struct FViewWindow;
// Keep using the software renderer's camera light class, for now.
// The DFrameBuffer abstraction relies on this being globally shared
typedef swrenderer::CameraLight PolyCameraLight;
@ -31,9 +33,11 @@ typedef swrenderer::CameraLight PolyCameraLight;
class PolyLightVisibility
{
public:
double WallGlobVis(bool foggy) const { return (NoLightFade && !foggy) ? 0.0 : WallVisibility / FocalTangent(); }
double SpriteGlobVis(bool foggy) const { return (NoLightFade && !foggy) ? 0.0 : WallVisibility / FocalTangent(); }
double ParticleGlobVis(bool foggy) const { return (NoLightFade && !foggy) ? 0.0 : WallVisibility * 0.5 / FocalTangent(); }
void SetVisibility(FViewWindow &viewwindow, float vis);
double WallGlobVis(bool foggy) const { return (NoLightFade && !foggy) ? 0.0 : GlobVis; }
double SpriteGlobVis(bool foggy) const { return (NoLightFade && !foggy) ? 0.0 : GlobVis; }
double ParticleGlobVis(bool foggy) const { return (NoLightFade && !foggy) ? 0.0 : GlobVis * 0.5; }
// The vis value to pass into the GETPALOOKUP or LIGHTSCALE macros
double WallVis(double screenZ, bool foggy) const { return WallGlobVis(foggy) / screenZ; }
@ -43,9 +47,6 @@ public:
static fixed_t LightLevelToShade(int lightlevel, bool foggy);
private:
static double FocalTangent();
// 1706 is the value for walls on 1080p 16:9 displays.
double WallVisibility = 1706.0;
double GlobVis = 0.0f;
bool NoLightFade = false;
};