Change parameters.currentLayer to index instead of layerIndex (#2956)
This commit is contained in:
@@ -252,8 +252,11 @@ void Renderer::Impl::render(const RenderTree& renderTree,
|
||||
#endif
|
||||
|
||||
// Tweakers are run in the upload pass so they can set up uniforms.
|
||||
orchestrator.visitLayerGroups(
|
||||
[&](LayerGroupBase& layerGroup) { layerGroup.runTweakers(renderTree, parameters); });
|
||||
parameters.currentLayer = 0;
|
||||
orchestrator.visitLayerGroups([&](LayerGroupBase& layerGroup) {
|
||||
layerGroup.runTweakers(renderTree, parameters);
|
||||
parameters.currentLayer++;
|
||||
});
|
||||
orchestrator.visitDebugLayerGroups(
|
||||
[&](LayerGroupBase& layerGroup) { layerGroup.runTweakers(renderTree, parameters); });
|
||||
|
||||
@@ -315,10 +318,12 @@ void Renderer::Impl::render(const RenderTree& renderTree,
|
||||
assert(parameters.pass == RenderPass::Pass3D);
|
||||
|
||||
// draw layer groups, 3D pass
|
||||
const auto maxLayerIndex = orchestrator.maxLayerIndex();
|
||||
parameters.currentLayer = static_cast<uint32_t>(orchestrator.numLayerGroups()) - 1;
|
||||
orchestrator.visitLayerGroups([&](LayerGroupBase& layerGroup) {
|
||||
layerGroup.render(orchestrator, parameters);
|
||||
parameters.currentLayer = maxLayerIndex - layerGroup.getLayerIndex();
|
||||
if (parameters.currentLayer > 0) {
|
||||
parameters.currentLayer--;
|
||||
}
|
||||
});
|
||||
};
|
||||
#endif // MLN_DRAWABLE_RENDERER
|
||||
@@ -368,30 +373,31 @@ void Renderer::Impl::render(const RenderTree& renderTree,
|
||||
// Drawables
|
||||
const auto drawableOpaquePass = [&] {
|
||||
const auto debugGroup(parameters.renderPass->createDebugGroup("drawables-opaque"));
|
||||
const auto maxLayerIndex = orchestrator.maxLayerIndex();
|
||||
parameters.pass = RenderPass::Opaque;
|
||||
parameters.currentLayer = 0;
|
||||
parameters.depthRangeSize = 1 -
|
||||
(maxLayerIndex + 3) * PaintParameters::numSublayers * PaintParameters::depthEpsilon;
|
||||
parameters.depthRangeSize = 1 - (orchestrator.numLayerGroups() + 2) * PaintParameters::numSublayers *
|
||||
PaintParameters::depthEpsilon;
|
||||
|
||||
// draw layer groups, opaque pass
|
||||
orchestrator.visitLayerGroups([&](LayerGroupBase& layerGroup) {
|
||||
parameters.currentLayer = layerGroup.getLayerIndex();
|
||||
parameters.currentLayer = 0;
|
||||
orchestrator.visitLayerGroupsReversed([&](LayerGroupBase& layerGroup) {
|
||||
layerGroup.render(orchestrator, parameters);
|
||||
parameters.currentLayer++;
|
||||
});
|
||||
};
|
||||
|
||||
const auto drawableTranslucentPass = [&] {
|
||||
const auto debugGroup(parameters.renderPass->createDebugGroup("drawables-translucent"));
|
||||
const auto maxLayerIndex = orchestrator.maxLayerIndex();
|
||||
parameters.pass = RenderPass::Translucent;
|
||||
parameters.depthRangeSize = 1 -
|
||||
(maxLayerIndex + 3) * PaintParameters::numSublayers * PaintParameters::depthEpsilon;
|
||||
parameters.depthRangeSize = 1 - (orchestrator.numLayerGroups() + 2) * PaintParameters::numSublayers *
|
||||
PaintParameters::depthEpsilon;
|
||||
|
||||
// draw layer groups, translucent pass
|
||||
parameters.currentLayer = static_cast<uint32_t>(orchestrator.numLayerGroups()) - 1;
|
||||
orchestrator.visitLayerGroups([&](LayerGroupBase& layerGroup) {
|
||||
parameters.currentLayer = maxLayerIndex - layerGroup.getLayerIndex();
|
||||
layerGroup.render(orchestrator, parameters);
|
||||
if (parameters.currentLayer > 0) {
|
||||
parameters.currentLayer--;
|
||||
}
|
||||
});
|
||||
|
||||
// Finally, render any legacy layers which have not been converted to drawables.
|
||||
|
||||
Reference in New Issue
Block a user