Extract draw merge final plane composite
This commit is contained in:
@@ -1156,6 +1156,49 @@ void Canvas::draw_merge_branch_orchestration(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Canvas::draw_merge_final_plane_composite(
|
||||||
|
const glm::mat4& ortho,
|
||||||
|
bool draw_checkerboard)
|
||||||
|
{
|
||||||
|
execute_canvas_draw_merge_final_plane_composite(
|
||||||
|
pp::panopainter::LegacyCanvasDrawMergeFinalPlaneCompositeUniforms {
|
||||||
|
.checkerboard = {
|
||||||
|
.mvp = ortho,
|
||||||
|
.colorize = false,
|
||||||
|
},
|
||||||
|
.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();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void Canvas::stroke_draw_dual_pass(
|
void Canvas::stroke_draw_dual_pass(
|
||||||
const std::vector<StrokeFrame>& frames_dual,
|
const std::vector<StrokeFrame>& frames_dual,
|
||||||
const std::array<pp::panopainter::LegacyCanvasStrokeTextureBinding, 1>& dual_pass_texture_bindings,
|
const std::array<pp::panopainter::LegacyCanvasStrokeTextureBinding, 1>& dual_pass_texture_bindings,
|
||||||
@@ -1739,43 +1782,7 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
|||||||
|
|
||||||
if (use_blend)
|
if (use_blend)
|
||||||
{
|
{
|
||||||
execute_canvas_draw_merge_final_plane_composite(
|
draw_merge_final_plane_composite(ortho, draw_checkerboard);
|
||||||
pp::panopainter::LegacyCanvasDrawMergeFinalPlaneCompositeUniforms {
|
|
||||||
.checkerboard = {
|
|
||||||
.mvp = ortho,
|
|
||||||
.colorize = false,
|
|
||||||
},
|
|
||||||
.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_layers_merge.rtt(plane_index).unbindFramebuffer();
|
m_layers_merge.rtt(plane_index).unbindFramebuffer();
|
||||||
|
|||||||
@@ -276,6 +276,9 @@ private:
|
|||||||
bool use_blend,
|
bool use_blend,
|
||||||
bool copy_blend_destination,
|
bool copy_blend_destination,
|
||||||
bool draw_checkerboard);
|
bool draw_checkerboard);
|
||||||
|
void draw_merge_final_plane_composite(
|
||||||
|
const glm::mat4& ortho,
|
||||||
|
bool draw_checkerboard);
|
||||||
void stroke_draw_dual_pass(
|
void stroke_draw_dual_pass(
|
||||||
const std::vector<StrokeFrame>& frames_dual,
|
const std::vector<StrokeFrame>& frames_dual,
|
||||||
const std::array<pp::panopainter::LegacyCanvasStrokeTextureBinding, 1>& dual_pass_texture_bindings,
|
const std::array<pp::panopainter::LegacyCanvasStrokeTextureBinding, 1>& dual_pass_texture_bindings,
|
||||||
|
|||||||
Reference in New Issue
Block a user