Skip to content

Commit

Permalink
#5936: Rename LightInteractions to InteractingLight to better reflect…
Browse files Browse the repository at this point in the history
… what it is
  • Loading branch information
codereader committed Apr 10, 2022
1 parent 136a90b commit a7da6bc
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 35 deletions.
2 changes: 1 addition & 1 deletion radiantcore/CMakeLists.txt
Expand Up @@ -220,7 +220,7 @@ add_library(radiantcore MODULE
rendersystem/backend/glprogram/ShadowMapProgram.cpp
rendersystem/backend/BuiltInShader.cpp
rendersystem/backend/ColourShader.cpp
rendersystem/backend/LightInteractions.cpp
rendersystem/backend/InteractingLight.cpp
rendersystem/backend/SceneRenderer.cpp
rendersystem/backend/FullBrightRenderer.cpp
rendersystem/backend/LightingModeRenderer.cpp
Expand Down
1 change: 0 additions & 1 deletion radiantcore/rendersystem/OpenGLRenderSystem.cpp
Expand Up @@ -11,7 +11,6 @@
#include "backend/GLProgramFactory.h"
#include "backend/BuiltInShader.h"
#include "backend/ColourShader.h"
#include "backend/LightInteractions.h"
#include "backend/LightingModeRenderer.h"
#include "backend/FullBrightRenderer.h"
#include "backend/ObjectRenderer.h"
Expand Down
@@ -1,4 +1,4 @@
#include "LightInteractions.h"
#include "InteractingLight.h"

#include "OpenGLShader.h"
#include "ObjectRenderer.h"
Expand All @@ -8,7 +8,7 @@
namespace render
{

LightInteractions::LightInteractions(RendererLight& light, IGeometryStore& store) :
InteractingLight::InteractingLight(RendererLight& light, IGeometryStore& store) :
_light(light),
_store(store),
_lightBounds(light.lightAABB()),
Expand All @@ -22,7 +22,7 @@ LightInteractions::LightInteractions(RendererLight& light, IGeometryStore& store
_isShadowCasting = _light.isShadowCasting() && _light.getShader() && _light.getShader()->getMaterial()->lightCastsShadows();
}

void LightInteractions::addObject(IRenderableObject& object, IRenderEntity& entity, OpenGLShader* shader)
void InteractingLight::addObject(IRenderableObject& object, IRenderEntity& entity, OpenGLShader* shader)
{
auto& objectsByMaterial = _objectsByEntity.emplace(
&entity, ObjectsByMaterial{}).first->second;
Expand All @@ -35,17 +35,17 @@ void LightInteractions::addObject(IRenderableObject& object, IRenderEntity& enti
++_objectCount;
}

bool LightInteractions::isInView(const IRenderView& view)
bool InteractingLight::isInView(const IRenderView& view)
{
return view.TestAABB(_lightBounds) != VOLUME_OUTSIDE;
}

bool LightInteractions::isShadowCasting() const
bool InteractingLight::isShadowCasting() const
{
return _isShadowCasting;
}

void LightInteractions::collectSurfaces(const IRenderView& view, const std::set<IRenderEntityPtr>& entities)
void InteractingLight::collectSurfaces(const IRenderView& view, const std::set<IRenderEntityPtr>& entities)
{
bool shadowCasting = isShadowCasting();

Expand Down Expand Up @@ -96,7 +96,7 @@ void LightInteractions::collectSurfaces(const IRenderView& view, const std::set<
}
}

void LightInteractions::fillDepthBuffer(OpenGLState& state, DepthFillAlphaProgram& program,
void InteractingLight::fillDepthBuffer(OpenGLState& state, DepthFillAlphaProgram& program,
std::size_t renderTime, std::vector<IGeometryStore::Slot>& untransformedObjectsWithoutAlphaTest)
{
std::vector<IGeometryStore::Slot> untransformedObjects;
Expand Down Expand Up @@ -150,7 +150,7 @@ void LightInteractions::fillDepthBuffer(OpenGLState& state, DepthFillAlphaProgra
}
}

void LightInteractions::drawShadowMap(OpenGLState& state, const Rectangle& rectangle,
void InteractingLight::drawShadowMap(OpenGLState& state, const Rectangle& rectangle,
ShadowMapProgram& program, std::size_t renderTime)
{
// Set up the viewport to write to a specific area within the shadow map texture
Expand Down Expand Up @@ -213,7 +213,7 @@ void LightInteractions::drawShadowMap(OpenGLState& state, const Rectangle& recta
debug::assertNoGlErrors();
}

void LightInteractions::drawInteractions(OpenGLState& state, InteractionProgram& program,
void InteractingLight::drawInteractions(OpenGLState& state, InteractionProgram& program,
const IRenderView& view, std::size_t renderTime)
{
if (_objectsByEntity.empty())
Expand Down Expand Up @@ -302,7 +302,7 @@ void LightInteractions::drawInteractions(OpenGLState& state, InteractionProgram&
OpenGLState::SetTextureState(state.texture4, 0, GL_TEXTURE4, GL_TEXTURE_2D);
}

void LightInteractions::setupAlphaTest(OpenGLState& state, OpenGLShader* shader, DepthFillPass* depthFillPass,
void InteractingLight::setupAlphaTest(OpenGLState& state, OpenGLShader* shader, DepthFillPass* depthFillPass,
ISupportsAlphaTest& program, std::size_t renderTime, IRenderEntity* entity)
{
const auto& material = shader->getMaterial();
Expand Down
Expand Up @@ -25,7 +25,7 @@ class DepthFillPass;
*
* Objects are grouped by entity, then by shader.
*/
class LightInteractions
class InteractingLight
{
private:
RendererLight& _light;
Expand All @@ -50,7 +50,7 @@ class LightInteractions
bool _isShadowCasting;

public:
LightInteractions(RendererLight& light, IGeometryStore& store);
InteractingLight(RendererLight& light, IGeometryStore& store);

const Vector3& getBoundsCenter() const
{
Expand Down
14 changes: 7 additions & 7 deletions radiantcore/rendersystem/backend/LightingModeRenderer.cpp
Expand Up @@ -2,7 +2,7 @@

#include "GLProgramFactory.h"
#include "LightingModeRenderResult.h"
#include "LightInteractions.h"
#include "InteractingLight.h"
#include "OpenGLShaderPass.h"
#include "OpenGLShader.h"
#include "ObjectRenderer.h"
Expand Down Expand Up @@ -63,7 +63,7 @@ IRenderResult::Ptr LightingModeRenderer::render(RenderStateFlags globalFlagsMask

ensureShadowMapSetup();

determineLightInteractions(view);
determineInteractingLight(view);

// Construct default OpenGL state
OpenGLState current;
Expand All @@ -90,7 +90,7 @@ IRenderResult::Ptr LightingModeRenderer::render(RenderStateFlags globalFlagsMask
drawDepthFillPass(current, globalFlagsMask, view, time);

// Draw the surfaces per light and material
drawLightInteractions(current, globalFlagsMask, view, time);
drawInteractingLight(current, globalFlagsMask, view, time);

// Draw any surfaces without any light interactions
drawNonInteractionPasses(current, globalFlagsMask, view, time);
Expand All @@ -107,14 +107,14 @@ IRenderResult::Ptr LightingModeRenderer::render(RenderStateFlags globalFlagsMask
return std::move(_result); // move-return our result reference
}

void LightingModeRenderer::determineLightInteractions(const IRenderView& view)
void LightingModeRenderer::determineInteractingLight(const IRenderView& view)
{
_interactingLights.reserve(_lights.size());

// Gather all visible lights and render the surfaces touched by them
for (const auto& light : _lights)
{
LightInteractions interaction(*light, _geometryStore);
InteractingLight interaction(*light, _geometryStore);

if (!interaction.isInView(view))
{
Expand Down Expand Up @@ -147,7 +147,7 @@ void LightingModeRenderer::determineLightInteractions(const IRenderView& view)
}
}

void LightingModeRenderer::addToShadowLights(LightInteractions& light, const Vector3& viewer)
void LightingModeRenderer::addToShadowLights(InteractingLight& light, const Vector3& viewer)
{
if (_nearestShadowLights.empty())
{
Expand Down Expand Up @@ -179,7 +179,7 @@ void LightingModeRenderer::addToShadowLights(LightInteractions& light, const Vec
}
}

void LightingModeRenderer::drawLightInteractions(OpenGLState& current, RenderStateFlags globalFlagsMask,
void LightingModeRenderer::drawInteractingLight(OpenGLState& current, RenderStateFlags globalFlagsMask,
const IRenderView& view, std::size_t renderTime)
{
// Draw the surfaces per light and material
Expand Down
12 changes: 6 additions & 6 deletions radiantcore/rendersystem/backend/LightingModeRenderer.h
Expand Up @@ -7,13 +7,13 @@
#include "FrameBuffer.h"
#include "render/Rectangle.h"
#include "glprogram/ShadowMapProgram.h"
#include "InteractingLight.h"
#include "registry/CachedKey.h"

namespace render
{

class GLProgramFactory;
class LightInteractions;
class LightingModeRenderResult;

class LightingModeRenderer final :
Expand Down Expand Up @@ -42,8 +42,8 @@ class LightingModeRenderer final :

// Data that is valid during a single render pass only

std::vector<LightInteractions> _interactingLights;
std::vector<LightInteractions*> _nearestShadowLights;
std::vector<InteractingLight> _interactingLights;
std::vector<InteractingLight*> _nearestShadowLights;
std::shared_ptr<LightingModeRenderResult> _result;

public:
Expand All @@ -55,9 +55,9 @@ class LightingModeRenderer final :
IRenderResult::Ptr render(RenderStateFlags globalFlagsMask, const IRenderView& view, std::size_t time) override;

private:
void determineLightInteractions(const IRenderView& view);
void determineInteractingLight(const IRenderView& view);

void drawLightInteractions(OpenGLState& current, RenderStateFlags globalFlagsMask,
void drawInteractingLight(OpenGLState& current, RenderStateFlags globalFlagsMask,
const IRenderView& view, std::size_t renderTime);

void drawDepthFillPass(OpenGLState& current, RenderStateFlags globalFlagsMask,
Expand All @@ -70,7 +70,7 @@ class LightingModeRenderer final :

void ensureShadowMapSetup();

void addToShadowLights(LightInteractions& light, const Vector3& viewer);
void addToShadowLights(InteractingLight& light, const Vector3& viewer);
};

}
4 changes: 2 additions & 2 deletions tools/msvc/DarkRadiantCore.vcxproj
Expand Up @@ -635,9 +635,9 @@
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLProgramBase.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\InteractionProgram.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\ShadowMapProgram.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\InteractingLight.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\InteractionPass.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\LightingModeRenderer.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\LightInteractions.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\ObjectRenderer.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\OpenGLShader.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\OpenGLShaderPass.cpp" />
Expand Down Expand Up @@ -1007,9 +1007,9 @@
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLProgramBase.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\InteractionProgram.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\ShadowMapProgram.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\InteractingLight.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\InteractionPass.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\LightingModeRenderer.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\LightInteractions.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\ObjectRenderer.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\OpenGLShader.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\OpenGLShaderPass.h" />
Expand Down
12 changes: 6 additions & 6 deletions tools/msvc/DarkRadiantCore.vcxproj.filters
Expand Up @@ -1111,9 +1111,6 @@
<ClCompile Include="..\..\radiantcore\rendersystem\backend\ColourShader.cpp">
<Filter>src\rendersystem\backend</Filter>
</ClCompile>
<ClCompile Include="..\..\radiantcore\rendersystem\backend\LightInteractions.cpp">
<Filter>src\rendersystem\backend</Filter>
</ClCompile>
<ClCompile Include="..\..\radiantcore\rendersystem\backend\InteractionPass.cpp">
<Filter>src\rendersystem\backend</Filter>
</ClCompile>
Expand Down Expand Up @@ -1147,6 +1144,9 @@
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\DepthFillAlphaProgram.cpp">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClCompile>
<ClCompile Include="..\..\radiantcore\rendersystem\backend\InteractingLight.cpp">
<Filter>src\rendersystem\backend</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\radiantcore\modulesystem\ModuleLoader.h">
Expand Down Expand Up @@ -2310,9 +2310,6 @@
<ClInclude Include="..\..\radiantcore\rendersystem\LightingModeRenderResult.h">
<Filter>src\rendersystem</Filter>
</ClInclude>
<ClInclude Include="..\..\radiantcore\rendersystem\backend\LightInteractions.h">
<Filter>src\rendersystem\backend</Filter>
</ClInclude>
<ClInclude Include="..\..\radiantcore\entity\RenderableObjectCollection.h">
<Filter>src\entity</Filter>
</ClInclude>
Expand Down Expand Up @@ -2367,5 +2364,8 @@
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\DepthFillAlphaProgram.h">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClInclude>
<ClInclude Include="..\..\radiantcore\rendersystem\backend\InteractingLight.h">
<Filter>src\rendersystem\backend</Filter>
</ClInclude>
</ItemGroup>
</Project>

0 comments on commit a7da6bc

Please sign in to comment.