Skip to content

Commit

Permalink
#5893: For now we're rendering without vertex colours. Fix client sta…
Browse files Browse the repository at this point in the history
…te flags in LightInteractions passes
  • Loading branch information
codereader committed Jan 28, 2022
1 parent 9f0439c commit c151711
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
3 changes: 3 additions & 0 deletions radiantcore/rendersystem/OpenGLRenderSystem.cpp
Expand Up @@ -326,6 +326,9 @@ IRenderResult::Ptr OpenGLRenderSystem::renderLitScene(RenderStateFlags globalFla
entity->foreachSurfaceTouchingBounds(lightBounds,
[&](const render::IRenderableSurface::Ptr& surface, const ShaderPtr& shader)
{
// Skip empty surfaces
if (surface->getIndices().empty()) return;

auto glShader = static_cast<OpenGLShader*>(shader.get());

// We only consider materials designated for camera rendering
Expand Down
16 changes: 5 additions & 11 deletions radiantcore/rendersystem/backend/LightInteractions.cpp
Expand Up @@ -28,7 +28,6 @@ inline void submitSurface(IRenderableSurface& surface)
const auto& indices = surface.getIndices();

glVertexPointer(3, GL_DOUBLE, sizeof(ArbitraryMeshVertex), &vertices.front().vertex);
glColorPointer(4, GL_DOUBLE, sizeof(ArbitraryMeshVertex), &vertices.front().colour);

glVertexAttribPointer(ATTR_NORMAL, 3, GL_DOUBLE, 0, sizeof(ArbitraryMeshVertex), &vertices.front().normal);
glVertexAttribPointer(ATTR_TEXCOORD, 2, GL_DOUBLE, 0, sizeof(ArbitraryMeshVertex), &vertices.front().texcoord);
Expand Down Expand Up @@ -57,10 +56,10 @@ void LightInteractions::fillDepthBuffer(OpenGLState& state, RenderStateFlags glo
const IRenderView& view, std::size_t renderTime)
{
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
// Render surfaces without any vertex colours(?)

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);

for (auto& pair : _surfacesByEntity)
{
Expand Down Expand Up @@ -97,18 +96,15 @@ void LightInteractions::fillDepthBuffer(OpenGLState& state, RenderStateFlags glo
}

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
}

void LightInteractions::render(OpenGLState& state, RenderStateFlags globalFlagsMask, const IRenderView& view, std::size_t renderTime)
{
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);

// Render surfaces without any vertex colours(?)
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);

for (auto& pair : _surfacesByEntity)
{
Expand Down Expand Up @@ -149,8 +145,6 @@ void LightInteractions::render(OpenGLState& state, RenderStateFlags globalFlagsM
}

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
}

}

0 comments on commit c151711

Please sign in to comment.