Skip to content

Commit

Permalink
Remove LinearLightList and LightList
Browse files Browse the repository at this point in the history
LinearLightList was only used by the render system, which no longer stores
lights as of the previous commit. LightList was the public interface only
implemented by LinearLightList (VectorLightList, which still remains,
implements the simpler LightSources interface).
  • Loading branch information
Matthew Mott committed Dec 1, 2020
1 parent 6effed5 commit 0dfd7f8
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 211 deletions.
86 changes: 0 additions & 86 deletions include/irender.h
Expand Up @@ -303,92 +303,6 @@ inline std::ostream& operator<< (std::ostream& s, const LightSources* ls)
return s << "[no lightsources]";
}

/**
* \brief
* A list of lights which might (but don't necessarily) intersect a LitObject
*
* A LightList is responsible for calculating which lights intersect a
* particular object. Although there is nothing exposed in the interface, the
* LightList holds a reference to a single lit object, and it is the
* intersection with this object which is calculated.
*
* LightLists are constructed by the RenderSystem and returned to each
* LitObject as the result of calling RenderSystem::attachLitObject(). The
* LitObject is then responsible for storing the LightList and passing it (or a
* more optimised LightSources container based on additional tests) to the
* RenderableCollector at render time.
*
* \internal
* As of 2011-01-09/r6927 the calling sequence seems to be as follows:
*
* 1. Illuminated object (e.g. patch, brush) adds itself to the RenderSystem
* with attachLitObject() at construction.
* 2. attachLitObject() returns a reference to a (newly-created) LightList which
* manages the lights intersecting this lit object. The lit object stores this
* reference internally, while the LightList implementation also stores a
* reference to the LitObject.
* 3. When the lit object's renderSolid() method is invoked to set up a render,
* it invokes LightList::calculateIntersectingLights() on the stored LightList
* reference.
* 4. calculateIntersectingLights() first checks to see if the lights need
* updating, which is true if EITHER this LightList's setDirty() method OR the
* RenderSystem's lightChanged() has been called since the last calculation. If
* no update is needed, it returns.
* 5. If an update IS needed, the LightList iterates over all lights in the
* scene, and tests if each one intersects its associated lit object (which is
* the one that just invoked calculateIntersectingLights(), although nothing
* enforces this). This intersection test is performed by passing the light to
* the LitObject::intersectsLight() method.
* 6. For each light which passes the intersection test, the LightList both adds
* it to its internal list of "active" (i.e. intersecting) lights for its
* object, and passes it to the object's insertLight() method. Some object
* classes then use insertLight() to populate another internal LightList subject
* to additional (internal) intersection tests, but this is not required.
* 7. At this point, calculateIntersectingLights() has finished, and returns
* control to its calling renderSolid() method.
* 8. The renderSolid() method (or another method it calls) passes a LightList
* to the RenderableCollector with setLights(). The light list it passes may be
* the original list returned from attachLitObject(), or the additional internal
* list populated in step 6.
* 9. The RenderableCollector state machine stores the LightList as the
* "current" light list.
* 10. Any subsequent renderables submitted with
* RenderableCollector::addRenderable() are associated with the current
* LightList passed in the previous step, and passed to the current Shader.
* 11. The OpenGLShader accepts the renderable and LightList, and adds them to
* its internal OpenGLShaderPasses: once only if RENDER_BUMP is not active, not
* at all if RENDER_BUMP is active but the LightList is NULL, or once for each
* light in the LightList otherwise.
* 12. The OpenGLShaderPass now contains a list of TransformedRenderable
* structures, each associating a single renderable with a single light.
* Multiple TransformedRenderable will exist for the same renderable if there
* were multiple lights illuminating it.
*/
class LightList
: public LightSources
{
public:
virtual ~LightList() {}

/**
* \brief
* Trigger the LightList to recalculate which lights intersect its object
*
* For each light, this method will call the LitObject::intersectsLight()
* method to test whether the light intersects the contained lit object. If
* the light does intersect, it will be passed to the object's
* insertLight() method for internal storage (and possibly further
* intersection tests). The LightList will also store all the intersecting
* lights internally, and expose them through its own forEachLight()
* method, for objects which do not wish to perform additional tests but
* just return the LightList to the renderer directly.
*/
virtual void calculateIntersectingLights() const = 0;

/// Set the dirty flag, informing the LightList that an update is required
virtual void setDirty() = 0;
};

const int c_attr_TexCoord0 = 1;
const int c_attr_Tangent = 3;
const int c_attr_Binormal = 4;
Expand Down
9 changes: 2 additions & 7 deletions libs/render/VectorLightList.h
Expand Up @@ -12,13 +12,8 @@ namespace lib
* \brief
* A simple container of lights
*
* This is used by particular object types to store the list of intersecting
* lights passed into LitObject::insertLight() as a result of an earlier call
* to LightList::calculateIntersectingLights().
*
* Objects may use their insertLight() method to perform additional
* optimisations to exclude lights for object-specific reasons, then store the
* minimised light list in a VectorLightList for subsequent rendering.
* This is used by the CamRenderer to build a list of lights submitted with
* addLight().
*/
class VectorLightList: public LightSources
{
Expand Down
1 change: 0 additions & 1 deletion radiantcore/Makefile.am
Expand Up @@ -230,7 +230,6 @@ libradiantcore_la_SOURCES = Radiant.cpp \
rendersystem/backend/OpenGLShader.cpp \
rendersystem/backend/GLProgramFactory.cpp \
rendersystem/backend/OpenGLShaderPass.cpp \
rendersystem/LinearLightList.cpp \
rendersystem/OpenGLRenderSystem.cpp \
rendersystem/RenderSystemFactory.cpp \
rendersystem/SharedOpenGLContextModule.cpp \
Expand Down
43 changes: 0 additions & 43 deletions radiantcore/rendersystem/LinearLightList.cpp

This file was deleted.

73 changes: 0 additions & 73 deletions radiantcore/rendersystem/LinearLightList.h

This file was deleted.

1 change: 0 additions & 1 deletion radiantcore/rendersystem/OpenGLRenderSystem.h
Expand Up @@ -7,7 +7,6 @@
#include "backend/OpenGLStateManager.h"
#include "backend/OpenGLShader.h"
#include "backend/OpenGLStateLess.h"
#include "LinearLightList.h"

namespace render
{
Expand Down

0 comments on commit 0dfd7f8

Please sign in to comment.