Skip to content

Commit

Permalink
#5893: Remove RendererLight parameter from OpenGLShaderPass::addRende…
Browse files Browse the repository at this point in the history
…rable
  • Loading branch information
codereader committed Feb 19, 2022
1 parent b73af9b commit 95d16e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
2 changes: 1 addition & 1 deletion radiantcore/rendersystem/backend/OpenGLShader.cpp
Expand Up @@ -96,7 +96,7 @@ void OpenGLShader::addRenderable(const OpenGLRenderable& renderable,
for (const OpenGLShaderPassPtr& pass : _shaderPasses)
{
// Submit the renderable to each pass
pass->addRenderable(renderable, modelview, nullptr);
pass->addRenderable(renderable, modelview);
}
}

Expand Down
18 changes: 3 additions & 15 deletions radiantcore/rendersystem/backend/OpenGLShaderPass.cpp
Expand Up @@ -504,12 +504,9 @@ void OpenGLShaderPass::deactivateShaderProgram(OpenGLState& current)

// Add a Renderable to this bucket
void OpenGLShaderPass::addRenderable(const OpenGLRenderable& renderable,
const Matrix4& modelview,
const RendererLight* light)
const Matrix4& modelview)
{
_renderablesWithoutEntity.push_back(
TransformedRenderable(renderable, modelview, light, nullptr)
);
_renderablesWithoutEntity.emplace_back(renderable, modelview);
}

// Render the bucket contents
Expand Down Expand Up @@ -629,7 +626,7 @@ void OpenGLShaderPass::renderAllContained(const Renderables& renderables,
glPushMatrix();

// Iterate over each transformed renderable in the vector
for (const TransformedRenderable& r : renderables)
for (const auto& r : renderables)
{
// If the current iteration's transform matrix was different from the
// last, apply it and store for the next iteration
Expand All @@ -652,15 +649,6 @@ void OpenGLShaderPass::renderAllContained(const Renderables& renderables,
}
}

// If we are using a lighting program and this renderable is lit, set
// up the lighting calculation
const RendererLight* light = r.light;
if (current.glProgram && light)
{
setUpLightingCalculation(current, light, light->getLightTextureTransformation(),
viewer, *transform, time, _glState.isColourInverted());
}

// Render the renderable
RenderInfo info(current.getRenderFlags(), viewer, current.cubeMapMode);
r.renderable->render(info);
Expand Down
17 changes: 3 additions & 14 deletions radiantcore/rendersystem/backend/OpenGLShaderPass.h
Expand Up @@ -44,21 +44,11 @@ class OpenGLShaderPass
// The modelview transform for this renderable
const Matrix4 transform;

// The light falling on this obejct
const RendererLight* light;

// The entity attached to this renderable
const IRenderEntity* entity;

// Constructor
TransformedRenderable(const OpenGLRenderable& r,
const Matrix4& t,
const RendererLight* l,
const IRenderEntity* e)
const Matrix4& t)
: renderable(&r),
transform(t),
light(l),
entity(e)
transform(t)
{}
};

Expand Down Expand Up @@ -116,8 +106,7 @@ class OpenGLShaderPass
* renderable will be submitted once for each light).
*/
void addRenderable(const OpenGLRenderable& renderable,
const Matrix4& modelview,
const RendererLight* light = nullptr);
const Matrix4& modelview);

/**
* Return the OpenGL state associated with this bucket.
Expand Down

0 comments on commit 95d16e3

Please sign in to comment.