Extract Canvas draw_merge final plane composite helper
This commit is contained in:
@@ -1581,37 +1581,45 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
||||
}
|
||||
}
|
||||
|
||||
set_active_texture_unit(2);
|
||||
m_merge_tex.bind();
|
||||
copy_framebuffer_to_texture_2d(0, 0, 0, 0, m_width, m_height);
|
||||
|
||||
// draw the grid behind the layers using a temporary copy
|
||||
if (use_blend)
|
||||
{
|
||||
apply_canvas_capability(blend_state(), true);
|
||||
|
||||
//draw the grid
|
||||
if (draw_checkerboard)
|
||||
{
|
||||
pp::panopainter::setup_legacy_canvas_draw_merge_checkerboard_shader(
|
||||
pp::panopainter::LegacyCanvasDrawMergeCheckerboardUniforms {
|
||||
pp::panopainter::execute_legacy_canvas_draw_merge_final_plane_composite(
|
||||
pp::panopainter::LegacyCanvasDrawMergeFinalPlaneCompositeUniforms {
|
||||
.checkerboard = {
|
||||
.mvp = ortho,
|
||||
.colorize = false,
|
||||
});
|
||||
m_plane.draw_fill();
|
||||
}
|
||||
|
||||
// draw the layers
|
||||
m_sampler.bind(0);
|
||||
set_active_texture_unit(0);
|
||||
m_merge_tex.bind();
|
||||
pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader(
|
||||
pp::panopainter::LegacyCanvasDrawMergeTextureUniforms {
|
||||
.mvp = ortho,
|
||||
.texture_slot = 0,
|
||||
},
|
||||
.texture = {
|
||||
.mvp = ortho,
|
||||
.texture_slot = 0,
|
||||
},
|
||||
.draw_checkerboard = draw_checkerboard,
|
||||
},
|
||||
pp::panopainter::LegacyCanvasDrawMergeFinalPlaneCompositeExecution {
|
||||
.bind_merged_texture_copy_target = [&] {
|
||||
set_active_texture_unit(2);
|
||||
m_merge_tex.bind();
|
||||
},
|
||||
.copy_merged_framebuffer = [&] {
|
||||
copy_framebuffer_to_texture_2d(0, 0, 0, 0, m_width, m_height);
|
||||
},
|
||||
.enable_blend = [&] {
|
||||
apply_canvas_capability(blend_state(), true);
|
||||
},
|
||||
.draw = [&] {
|
||||
m_plane.draw_fill();
|
||||
},
|
||||
.bind_sampler = [&] {
|
||||
m_sampler.bind(0);
|
||||
},
|
||||
.bind_merged_texture = [&] {
|
||||
set_active_texture_unit(0);
|
||||
m_merge_tex.bind();
|
||||
},
|
||||
.unbind_merged_texture = [&] {
|
||||
m_merge_tex.unbind();
|
||||
},
|
||||
});
|
||||
m_plane.draw_fill();
|
||||
m_merge_tex.unbind();
|
||||
}
|
||||
|
||||
m_layers_merge.rtt(plane_index).unbindFramebuffer();
|
||||
|
||||
Reference in New Issue
Block a user