Skip to content

Commit

Permalink
#5584: Merge branch 'renderer3' into renderer4, resolving conflicts a…
Browse files Browse the repository at this point in the history
…gainst latest master

# Conflicts:
#	radiantcore/entity/light/Light.cpp
#	radiantcore/entity/light/Light.h
#	radiantcore/entity/light/LightNode.cpp
#	radiantcore/entity/light/LightNode.h
  • Loading branch information
codereader committed Jan 16, 2022
1 parent 50d2837 commit f24115c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
29 changes: 11 additions & 18 deletions radiantcore/entity/light/LightNode.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -380,7 +375,7 @@ void LightNode::onPreRender(const VolumeTest& volume)
{
if (isProjected())
{
_light.updateProjection();
updateProjection();
}

_renderableLightVolume.update(colourShader);
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
11 changes: 4 additions & 7 deletions radiantcore/entity/light/LightNode.h
Expand Up @@ -31,7 +31,6 @@ class LightNode :
public ComponentEditable,
public ComponentSnappable,
public PlaneSelectable,
public OpenGLRenderable,
public RendererLight
{
OriginKey m_originKey;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand All @@ -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();

Expand Down

0 comments on commit f24115c

Please sign in to comment.