Skip to content

Commit

Permalink
#6106: Don't render hidden light scene nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Sep 23, 2022
1 parent 07f593a commit f468198
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
7 changes: 3 additions & 4 deletions include/irender.h
@@ -1,19 +1,16 @@
#pragma once

#include "imodule.h"
#include "ivolumetest.h"
#include "irenderview.h"
#include "iwindingrenderer.h"
#include "igeometryrenderer.h"
#include "isurfacerenderer.h"
#include <functional>
#include <vector>

#include "math/Vector3.h"
#include "math/Vector4.h"
#include "render/Colour4.h"
#include "math/AABB.h"
#include "render/MeshVertex.h"

#include "ishaderlayer.h"
#include <sigc++/signal.h>
Expand Down Expand Up @@ -115,7 +112,6 @@ const unsigned RENDER_OVERRIDE = 1 << 21;
typedef unsigned RenderStateFlags;
///@}

class AABB;
class Matrix4;

template<typename Element> class BasicVector3;
Expand Down Expand Up @@ -208,6 +204,9 @@ class RendererLight
public:
virtual ~RendererLight() {}

// Returns true when this light is visible in the scene, false otherwise
virtual bool isVisible() = 0;

/**
* \brief Return the render entity associated with this light
*
Expand Down
5 changes: 5 additions & 0 deletions radiantcore/entity/light/LightNode.cpp
Expand Up @@ -1235,6 +1235,11 @@ const ShaderPtr& LightNode::getShader() const
return m_shader.get();
}

bool LightNode::isVisible()
{
return visible();
}

const IRenderEntity& LightNode::getLightEntity() const
{
return *this;
Expand Down
1 change: 1 addition & 0 deletions radiantcore/entity/light/LightNode.h
Expand Up @@ -263,6 +263,7 @@ class LightNode :

public:
// RendererLight implementation
bool isVisible() override;
const IRenderEntity& getLightEntity() const override;
Matrix4 getLightTextureTransformation() const override;
Vector3 getLightOrigin() const override;
Expand Down
2 changes: 2 additions & 0 deletions radiantcore/rendersystem/backend/LightingModeRenderer.cpp
Expand Up @@ -122,6 +122,8 @@ void LightingModeRenderer::collectLights(const IRenderView& view)
// Categorise all visible lights
for (const auto& light : _lights)
{
if (!light->isVisible()) continue;

if (light->isBlendLight())
{
collectBlendLight(*light, view);
Expand Down

0 comments on commit f468198

Please sign in to comment.