Skip to content

Commit

Permalink
fix terrain renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
hotstreams committed Aug 28, 2024
1 parent 5eacd69 commit 6c0adac
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/limitless/renderer/instance_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,22 @@ void InstanceRenderer::render(InstancedInstance &instance, const DrawParameters
}

void InstanceRenderer::render(TerrainInstance &instance, const DrawParameters &drawp) {
render(static_cast<ModelInstance&>(instance), drawp);
if (instance.isHidden()) {
return;
}

for (const auto& [_, mesh]: instance.getMeshes()) {
// skip mesh if blending is different
if (mesh.getMaterial()->getBlending() != drawp.blending) {
return;
}

// set render state: shaders, material, blending, etc
setRenderState(mesh, drawp, {InstanceType::Terrain, instance.getFinalMatrix(), instance.getDecalMask()});

// draw vertices
mesh.getMesh()->draw();
}
}

void InstanceRenderer::renderVisible(Instance &instance, const DrawParameters &drawp) {
Expand Down

0 comments on commit 6c0adac

Please sign in to comment.