diff --git a/radiantcore/CMakeLists.txt b/radiantcore/CMakeLists.txt index 7078cf9f77..d2b5eee819 100644 --- a/radiantcore/CMakeLists.txt +++ b/radiantcore/CMakeLists.txt @@ -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 diff --git a/radiantcore/rendersystem/OpenGLRenderSystem.cpp b/radiantcore/rendersystem/OpenGLRenderSystem.cpp index c49db446e5..b15f79b238 100644 --- a/radiantcore/rendersystem/OpenGLRenderSystem.cpp +++ b/radiantcore/rendersystem/OpenGLRenderSystem.cpp @@ -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" diff --git a/radiantcore/rendersystem/backend/LightInteractions.cpp b/radiantcore/rendersystem/backend/InteractingLight.cpp similarity index 93% rename from radiantcore/rendersystem/backend/LightInteractions.cpp rename to radiantcore/rendersystem/backend/InteractingLight.cpp index a9e4cc0d6e..62b9a63e64 100644 --- a/radiantcore/rendersystem/backend/LightInteractions.cpp +++ b/radiantcore/rendersystem/backend/InteractingLight.cpp @@ -1,4 +1,4 @@ -#include "LightInteractions.h" +#include "InteractingLight.h" #include "OpenGLShader.h" #include "ObjectRenderer.h" @@ -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()), @@ -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; @@ -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& entities) +void InteractingLight::collectSurfaces(const IRenderView& view, const std::set& entities) { bool shadowCasting = isShadowCasting(); @@ -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& untransformedObjectsWithoutAlphaTest) { std::vector untransformedObjects; @@ -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 @@ -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()) @@ -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(); diff --git a/radiantcore/rendersystem/backend/LightInteractions.h b/radiantcore/rendersystem/backend/InteractingLight.h similarity index 96% rename from radiantcore/rendersystem/backend/LightInteractions.h rename to radiantcore/rendersystem/backend/InteractingLight.h index 0241cf1964..97cdef8259 100644 --- a/radiantcore/rendersystem/backend/LightInteractions.h +++ b/radiantcore/rendersystem/backend/InteractingLight.h @@ -25,7 +25,7 @@ class DepthFillPass; * * Objects are grouped by entity, then by shader. */ -class LightInteractions +class InteractingLight { private: RendererLight& _light; @@ -50,7 +50,7 @@ class LightInteractions bool _isShadowCasting; public: - LightInteractions(RendererLight& light, IGeometryStore& store); + InteractingLight(RendererLight& light, IGeometryStore& store); const Vector3& getBoundsCenter() const { diff --git a/radiantcore/rendersystem/backend/LightingModeRenderer.cpp b/radiantcore/rendersystem/backend/LightingModeRenderer.cpp index 5d9306b54f..6207f936eb 100644 --- a/radiantcore/rendersystem/backend/LightingModeRenderer.cpp +++ b/radiantcore/rendersystem/backend/LightingModeRenderer.cpp @@ -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" @@ -63,7 +63,7 @@ IRenderResult::Ptr LightingModeRenderer::render(RenderStateFlags globalFlagsMask ensureShadowMapSetup(); - determineLightInteractions(view); + determineInteractingLight(view); // Construct default OpenGL state OpenGLState current; @@ -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); @@ -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)) { @@ -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()) { @@ -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 diff --git a/radiantcore/rendersystem/backend/LightingModeRenderer.h b/radiantcore/rendersystem/backend/LightingModeRenderer.h index c9af18d24f..8b41a86495 100644 --- a/radiantcore/rendersystem/backend/LightingModeRenderer.h +++ b/radiantcore/rendersystem/backend/LightingModeRenderer.h @@ -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 : @@ -42,8 +42,8 @@ class LightingModeRenderer final : // Data that is valid during a single render pass only - std::vector _interactingLights; - std::vector _nearestShadowLights; + std::vector _interactingLights; + std::vector _nearestShadowLights; std::shared_ptr _result; public: @@ -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, @@ -70,7 +70,7 @@ class LightingModeRenderer final : void ensureShadowMapSetup(); - void addToShadowLights(LightInteractions& light, const Vector3& viewer); + void addToShadowLights(InteractingLight& light, const Vector3& viewer); }; } diff --git a/tools/msvc/DarkRadiantCore.vcxproj b/tools/msvc/DarkRadiantCore.vcxproj index 7ceb12a33a..89c433bc11 100644 --- a/tools/msvc/DarkRadiantCore.vcxproj +++ b/tools/msvc/DarkRadiantCore.vcxproj @@ -635,9 +635,9 @@ + - @@ -1007,9 +1007,9 @@ + - diff --git a/tools/msvc/DarkRadiantCore.vcxproj.filters b/tools/msvc/DarkRadiantCore.vcxproj.filters index dead67e734..bf68b3fffc 100644 --- a/tools/msvc/DarkRadiantCore.vcxproj.filters +++ b/tools/msvc/DarkRadiantCore.vcxproj.filters @@ -1111,9 +1111,6 @@ src\rendersystem\backend - - src\rendersystem\backend - src\rendersystem\backend @@ -1147,6 +1144,9 @@ src\rendersystem\backend\glprogram + + src\rendersystem\backend + @@ -2310,9 +2310,6 @@ src\rendersystem - - src\rendersystem\backend - src\entity @@ -2367,5 +2364,8 @@ src\rendersystem\backend\glprogram + + src\rendersystem\backend + \ No newline at end of file