From f24115c62d015da9043aaac835abe2740f802459 Mon Sep 17 00:00:00 2001 From: codereader Date: Sun, 16 Jan 2022 08:27:09 +0100 Subject: [PATCH] #5584: Merge branch 'renderer3' into renderer4, resolving conflicts against latest master # Conflicts: # radiantcore/entity/light/Light.cpp # radiantcore/entity/light/Light.h # radiantcore/entity/light/LightNode.cpp # radiantcore/entity/light/LightNode.h --- radiantcore/entity/light/LightNode.cpp | 29 ++++++++++---------------- radiantcore/entity/light/LightNode.h | 11 ++++------ 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/radiantcore/entity/light/LightNode.cpp b/radiantcore/entity/light/LightNode.cpp index 04e0911e26..ace90ad7f9 100644 --- a/radiantcore/entity/light/LightNode.cpp +++ b/radiantcore/entity/light/LightNode.cpp @@ -145,30 +145,25 @@ void LightNode::construct() m_shader.valueChanged(_spawnArgs.getKeyValue("texture")); } -bool LightNode::isProjected() const -{ - return _light.isProjected(); -} - const Frustum& LightNode::getLightFrustum() const { - if (!_light.isProjected()) throw std::logic_error("getLightFrustum can be called on projected lights only"); + if (!isProjected()) throw std::logic_error("getLightFrustum can be called on projected lights only"); - return _light._frustum; + return _frustum; } const Vector3& LightNode::getLightStart() const { - if (!_light.isProjected()) throw std::logic_error("getLightStart can be called on projected lights only"); + if (!isProjected()) throw std::logic_error("getLightStart can be called on projected lights only"); - return _light._projVectors.transformed.start; + return _projVectors.transformed.start; } const Vector3& LightNode::getLightRadius() const { - if (_light.isProjected()) throw std::logic_error("getLightRadius can be called on point lights only"); + if (isProjected()) throw std::logic_error("getLightRadius can be called on point lights only"); - return _light.m_doom3Radius.m_radiusTransformed; + return m_doom3Radius.m_radiusTransformed; } AABB LightNode::getSelectAABB() const @@ -380,7 +375,7 @@ void LightNode::onPreRender(const VolumeTest& volume) { if (isProjected()) { - _light.updateProjection(); + updateProjection(); } _renderableLightVolume.update(colourShader); @@ -417,8 +412,6 @@ void LightNode::renderHighlights(IRenderableCollector& collector, const VolumeTe collector.addHighlightRenderable(_renderableOctagon, Matrix4::getIdentity()); collector.addHighlightRenderable(_renderableLightVolume, Matrix4::getIdentity()); - if (isProjected()) - updateProjection(); EntityNode::renderHighlights(collector, volume); } @@ -973,13 +966,13 @@ Doom3LightRadius& LightNode::getDoom3Radius() { return m_doom3Radius; } -void LightNode::renderProjectionPoints(RenderableCollector& collector, +void LightNode::renderProjectionPoints(IRenderableCollector& collector, const VolumeTest& volume, const Matrix4& localToWorld) const { // Add the renderable light target - collector.setHighlightFlag(RenderableCollector::Highlight::Primitives, false); - collector.setHighlightFlag(RenderableCollector::Highlight::Faces, false); + collector.setHighlightFlag(IRenderableCollector::Highlight::Primitives, false); + collector.setHighlightFlag(IRenderableCollector::Highlight::Faces, false); collector.addRenderable(*_rRight.getShader(), _rRight, localToWorld); collector.addRenderable(*_rUp.getShader(), _rUp, localToWorld); @@ -997,7 +990,7 @@ void LightNode::renderProjectionPoints(RenderableCollector& collector, } // Adds the light centre renderable to the given collector -void LightNode::renderLightCentre(RenderableCollector& collector, const VolumeTest& volume, +void LightNode::renderLightCentre(IRenderableCollector& collector, const VolumeTest& volume, const Matrix4& localToWorld) const { collector.addRenderable(*_rCentre.getShader(), _rCentre, localToWorld); diff --git a/radiantcore/entity/light/LightNode.h b/radiantcore/entity/light/LightNode.h index 4edc8a23bc..9ae7a8077d 100644 --- a/radiantcore/entity/light/LightNode.h +++ b/radiantcore/entity/light/LightNode.h @@ -31,7 +31,6 @@ class LightNode : public ComponentEditable, public ComponentSnappable, public PlaneSelectable, - public OpenGLRenderable, public RendererLight { OriginKey m_originKey; @@ -204,6 +203,7 @@ class LightNode : void onEntitySettingsChanged() override; + // Is this light projected or omni? bool isProjected() const; // Returns the frustum structure (calling this on point lights will throw) @@ -256,14 +256,14 @@ class LightNode : void destroy(); // Renderable submission functions - void renderWireframe(RenderableCollector& collector, + void renderWireframe(IRenderableCollector& collector, const VolumeTest& volume, const Matrix4& localToWorld, bool selected) const; // Adds the light centre renderable to the given collector - void renderLightCentre(RenderableCollector& collector, const VolumeTest& volume, const Matrix4& localToWorld) const; - void renderProjectionPoints(RenderableCollector& collector, const VolumeTest& volume, const Matrix4& localToWorld) const; + void renderLightCentre(IRenderableCollector& collector, const VolumeTest& volume, const Matrix4& localToWorld) const; + void renderProjectionPoints(IRenderableCollector& collector, const VolumeTest& volume, const Matrix4& localToWorld) const; // Returns a reference to the member class Doom3LightRadius (used to set colours) Doom3LightRadius& getDoom3Radius(); @@ -287,9 +287,6 @@ class LightNode : void revertLightTransform(); void freezeLightTransform(); - // Is this light projected or omni? - bool isProjected() const; - // Set the projection-changed flag void projectionChanged();