Skip to content

Commit

Permalink
#219: Respect the registry setting in LightingModeRenderer.
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Mar 26, 2022
1 parent 7b03fa6 commit 16bc9c1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions radiant/camera/CamWnd.cpp
Expand Up @@ -128,6 +128,11 @@ CamWnd::CamWnd(wxWindow* parent) :
sigc::mem_fun(this, &CamWnd::handleTextureChanged)));

_renderer.reset(new render::CamRenderer(_view, _shaders));

// Refresh the camera view when shadows are enabled/disabled
GlobalRegistry().signalForKey(RKEY_ENABLE_SHADOW_MAPPING).connect(
sigc::mem_fun(this, &CamWnd::queueDraw)
);
}

wxWindow* CamWnd::getMainWidget() const
Expand Down
4 changes: 2 additions & 2 deletions radiant/camera/CamWnd.h
Expand Up @@ -29,8 +29,8 @@
#include "render/CamRenderer.h"
#include "messages/TextureChanged.h"

const int CAMWND_MINSIZE_X = 240;
const int CAMWND_MINSIZE_Y = 200;
constexpr int CAMWND_MINSIZE_X = 240;
constexpr int CAMWND_MINSIZE_Y = 200;

#define SPEED_MOVE 32
#define SPEED_TURN 22.5
Expand Down
6 changes: 5 additions & 1 deletion radiantcore/rendersystem/backend/LightingModeRenderer.cpp
Expand Up @@ -30,6 +30,8 @@ LightingModeRenderer::LightingModeRenderer(GLProgramFactory& programFactory,

void LightingModeRenderer::ensureShadowMapSetup()
{
if (!_shadowMappingEnabled.get()) return;

if (!_shadowMapFbo)
{
_shadowMapFbo = FrameBuffer::CreateShadowMapBuffer();
Expand Down Expand Up @@ -131,7 +133,7 @@ void LightingModeRenderer::determineLightInteractions(const IRenderView& view)
auto& moved = _interactingLights.emplace_back(std::move(interaction));

// Check the distance of shadow casting lights to the viewer
if (moved.isShadowCasting())
if (_shadowMappingEnabled.get() && moved.isShadowCasting())
{
addToShadowLights(moved, view.getViewer());
}
Expand Down Expand Up @@ -218,6 +220,8 @@ void LightingModeRenderer::drawLightInteractions(OpenGLState& current, RenderSta

void LightingModeRenderer::drawShadowMaps(OpenGLState& current,std::size_t renderTime)
{
if (!_shadowMappingEnabled.get()) return;

// Draw the shadow maps of each light
// Save the viewport set up in the camera code
GLint previousViewport[4];
Expand Down

0 comments on commit 16bc9c1

Please sign in to comment.