Skip to content

Commit

Permalink
Remove some legacy light code
Browse files Browse the repository at this point in the history
For some reason BrushNode still had an internal light list which has been
obsolete since the switch to use addLitRenderable(). Also removed the
now-unused insertLight() and clearLights() methods from LitObject, which now
exposes only the intersectsLight() method.
  • Loading branch information
Matthew Mott committed Dec 1, 2020
1 parent 8e89d0b commit bfee6f6
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 34 deletions.
17 changes: 1 addition & 16 deletions include/irender.h
Expand Up @@ -241,16 +241,7 @@ inline std::ostream& operator<< (std::ostream& os, const RendererLight& l)
* Interface for an object which can test its intersection with a RendererLight.
*
* Objects which implement this interface define a intersectsLight() function
* which determines whether the given light intersects the object. They also
* provide methods to allow the renderer to provide the list of lights which
* will be illuminating the object, subsequent to the intersection test.
*
* \todo
* This interface seems to exist because of the design decision that lit objects
* should maintain a list of lights which illuminate them. This is a poor
* design because this should be the responsibility of the renderer. When the
* renderer is refactored to process the scene light-by-light this class will
* not be necessary.
* which determines whether the given light intersects the object.
*/
class LitObject
{
Expand All @@ -259,12 +250,6 @@ class LitObject

/// Test if the given light intersects the LitObject
virtual bool intersectsLight(const RendererLight& light) const = 0;

/// Add a light to the set of lights which do intersect this object
virtual void insertLight(const RendererLight& light) {}

/// Clear out all lights in the set of lights intersecting this object
virtual void clearLights() {}
};
typedef std::shared_ptr<LitObject> LitObjectPtr;

Expand Down
1 change: 0 additions & 1 deletion radiantcore/brush/Brush.cpp
Expand Up @@ -475,7 +475,6 @@ void Brush::onFacePlaneChanged()
{
m_planeChanged = true;
aabbChanged();
_owner.lightsChanged();
}

void Brush::onFaceShaderChanged()
Expand Down
11 changes: 0 additions & 11 deletions radiantcore/brush/BrushNode.cpp
Expand Up @@ -12,7 +12,6 @@
// Constructor
BrushNode::BrushNode() :
scene::SelectableNode(),
m_lightList(&GlobalRenderSystem().attachLitObject(*this)),
m_brush(*this),
_selectedPoints(GL_POINTS),
_faceCentroidPointsCulled(GL_POINTS),
Expand All @@ -21,8 +20,6 @@ BrushNode::BrushNode() :
_untransformedOriginChanged(true)
{
m_brush.attach(*this); // BrushObserver

SelectableNode::setTransformChangedCallback(std::bind(&BrushNode::lightsChanged, this));
}

// Copy Constructor
Expand All @@ -39,7 +36,6 @@ BrushNode::BrushNode(const BrushNode& other) :
PlaneSelectable(other),
LitObject(other),
Transformable(other),
m_lightList(&GlobalRenderSystem().attachLitObject(*this)),
m_brush(*this, other.m_brush),
_selectedPoints(GL_POINTS),
_faceCentroidPointsCulled(GL_POINTS),
Expand All @@ -61,11 +57,6 @@ scene::INode::Type BrushNode::getNodeType() const
return Type::Brush;
}

void BrushNode::lightsChanged()
{
m_lightList->setDirty();
}

const AABB& BrushNode::localAABB() const {
return m_brush.localAABB();
}
Expand Down Expand Up @@ -428,8 +419,6 @@ void BrushNode::renderSolid(RenderableCollector& collector,
const VolumeTest& volume,
const Matrix4& localToWorld) const
{
m_lightList->calculateIntersectingLights();

assert(_renderEntity); // brushes rendered without parent entity - no way!

// Check for the override status of this brush
Expand Down
4 changes: 0 additions & 4 deletions radiantcore/brush/BrushNode.h
Expand Up @@ -31,8 +31,6 @@ class BrushNode :
public Transformable,
public ITraceable
{
LightList* m_lightList;

// The actual contained brush (NO reference)
Brush m_brush;

Expand Down Expand Up @@ -84,8 +82,6 @@ class BrushNode :

Type getNodeType() const override;

void lightsChanged();

// Bounded implementation
virtual const AABB& localAABB() const override;

Expand Down
2 changes: 0 additions & 2 deletions radiantcore/rendersystem/LinearLightList.cpp
Expand Up @@ -13,15 +13,13 @@ void LinearLightList::calculateIntersectingLights() const
m_dirty = false;

_activeLights.clear();
_litObject.clearLights();

// Determine which lights intersect object
for (RendererLight* light : _allLights)
{
if (_litObject.intersectsLight(*light))
{
_activeLights.push_back(light);
_litObject.insertLight(*light);
}
}
}
Expand Down

0 comments on commit bfee6f6

Please sign in to comment.