Extract dialog workflow, bootstrap, and canvas tail helpers
This commit is contained in:
@@ -395,6 +395,101 @@ pp::panopainter::LegacyCanvasDrawMergeLayerPathExecution make_node_canvas_layer_
|
||||
draw_layer_frame);
|
||||
}
|
||||
|
||||
void execute_node_canvas_draw_merge_tail(
|
||||
NodeCanvas& node_canvas,
|
||||
const glm::mat4& ortho_proj,
|
||||
const glm::mat4& proj,
|
||||
const glm::mat4& camera,
|
||||
const glm::ivec4& c)
|
||||
{
|
||||
apply_node_canvas_capability(pp::renderer::gl::depth_test_state(), false);
|
||||
|
||||
pp::panopainter::execute_legacy_canvas_draw_merge_post_draw_callbacks(
|
||||
node_canvas.m_canvas->m_smask_active,
|
||||
node_canvas.m_canvas->m_current_mode == kCanvasMode::Copy || node_canvas.m_canvas->m_current_mode == kCanvasMode::Cut,
|
||||
node_canvas.m_canvas->m_smask_mode,
|
||||
node_canvas.m_canvas->m_current_mode != kCanvasMode::Grid,
|
||||
[&] {
|
||||
node_canvas.m_canvas->modes[(int)kCanvasMode::MaskFree][0]->on_Draw(ortho_proj, proj, camera);
|
||||
},
|
||||
[&] {
|
||||
node_canvas.m_canvas->modes[(int)kCanvasMode::MaskLine][0]->on_Draw(ortho_proj, proj, camera);
|
||||
},
|
||||
[&] {
|
||||
pp::panopainter::execute_legacy_canvas_draw_merge_smask_faces(
|
||||
pp::panopainter::LegacyCanvasDrawMergeTextureMaskUniforms {
|
||||
.texture_slot = 0,
|
||||
.pattern_offset = node_canvas.m_outline_pan,
|
||||
},
|
||||
proj,
|
||||
camera,
|
||||
node_canvas.m_canvas->m_layers.size() + 500.f,
|
||||
std::to_array(node_canvas.m_canvas->m_plane_transform),
|
||||
{
|
||||
.set_active_texture_unit = [&] {
|
||||
set_active_texture_unit(0);
|
||||
},
|
||||
.enable_blend = [&] {
|
||||
apply_node_canvas_capability(pp::renderer::gl::blend_state(), true);
|
||||
},
|
||||
.bind_face_texture = [&](int plane_index) {
|
||||
node_canvas.m_canvas->m_smask.rtt(plane_index).bindTexture();
|
||||
},
|
||||
.draw_face = [&] {
|
||||
node_canvas.m_face_plane.draw_fill();
|
||||
},
|
||||
.unbind_face_texture = [&](int plane_index) {
|
||||
node_canvas.m_canvas->m_smask.rtt(plane_index).unbindTexture();
|
||||
},
|
||||
});
|
||||
},
|
||||
pp::panopainter::make_legacy_canvas_draw_merge_grid_modes_draw(
|
||||
&Canvas::modes[(int)kCanvasMode::Grid],
|
||||
ortho_proj,
|
||||
proj,
|
||||
camera),
|
||||
pp::panopainter::make_legacy_canvas_draw_merge_heightmap_draw(App::I->grid.get(), proj, camera),
|
||||
pp::panopainter::make_legacy_canvas_draw_merge_current_modes_draw(
|
||||
node_canvas.m_canvas->m_mode,
|
||||
ortho_proj,
|
||||
proj,
|
||||
camera));
|
||||
|
||||
if (node_canvas.m_density != 1.f) {
|
||||
pp::panopainter::execute_legacy_canvas_draw_merge_display_resolve(
|
||||
pp::panopainter::LegacyCanvasDrawMergeDisplayResolveUniforms {
|
||||
.texture = {
|
||||
.mvp = glm::ortho<float>(-1, 1, -1, 1),
|
||||
.texture_slot = 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
.unbind_resolve_framebuffer = [&] {
|
||||
node_canvas.m_rtt.unbindFramebuffer();
|
||||
},
|
||||
.clear_color_buffer = [&] {
|
||||
clear_node_canvas_color_buffer({ 1.f, 1.f, 1.f, 0.f });
|
||||
},
|
||||
.apply_viewport = [&] {
|
||||
apply_node_canvas_viewport(c.x + App::I->off_x, c.y + App::I->off_y, c.z, c.w);
|
||||
},
|
||||
.bind_sampler = [&] {
|
||||
node_canvas.m_sampler_nearest.bind(0);
|
||||
},
|
||||
.bind_resolve_texture = [&] {
|
||||
set_active_texture_unit(0);
|
||||
node_canvas.m_rtt.bindTexture();
|
||||
},
|
||||
.draw = [&] {
|
||||
node_canvas.m_face_plane.draw_fill();
|
||||
},
|
||||
.unbind_resolve_texture = [&] {
|
||||
node_canvas.m_rtt.unbindTexture();
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Node* NodeCanvas::clone_instantiate() const
|
||||
@@ -700,93 +795,7 @@ void NodeCanvas::draw()
|
||||
}
|
||||
}
|
||||
|
||||
apply_node_canvas_capability(pp::renderer::gl::depth_test_state(), false);
|
||||
|
||||
pp::panopainter::execute_legacy_canvas_draw_merge_post_draw_callbacks(
|
||||
m_canvas->m_smask_active,
|
||||
m_canvas->m_current_mode == kCanvasMode::Copy || m_canvas->m_current_mode == kCanvasMode::Cut,
|
||||
m_canvas->m_smask_mode,
|
||||
m_canvas->m_current_mode != kCanvasMode::Grid,
|
||||
[&] {
|
||||
m_canvas->modes[(int)kCanvasMode::MaskFree][0]->on_Draw(ortho_proj, proj, camera);
|
||||
},
|
||||
[&] {
|
||||
m_canvas->modes[(int)kCanvasMode::MaskLine][0]->on_Draw(ortho_proj, proj, camera);
|
||||
},
|
||||
[&] {
|
||||
pp::panopainter::execute_legacy_canvas_draw_merge_smask_faces(
|
||||
pp::panopainter::LegacyCanvasDrawMergeTextureMaskUniforms {
|
||||
.texture_slot = 0,
|
||||
.pattern_offset = m_outline_pan,
|
||||
},
|
||||
proj,
|
||||
camera,
|
||||
m_canvas->m_layers.size() + 500.f,
|
||||
std::to_array(m_canvas->m_plane_transform),
|
||||
{
|
||||
.set_active_texture_unit = [&] {
|
||||
set_active_texture_unit(0);
|
||||
},
|
||||
.enable_blend = [&] {
|
||||
apply_node_canvas_capability(pp::renderer::gl::blend_state(), true);
|
||||
},
|
||||
.bind_face_texture = [&](int plane_index) {
|
||||
m_canvas->m_smask.rtt(plane_index).bindTexture();
|
||||
},
|
||||
.draw_face = [&] {
|
||||
m_face_plane.draw_fill();
|
||||
},
|
||||
.unbind_face_texture = [&](int plane_index) {
|
||||
m_canvas->m_smask.rtt(plane_index).unbindTexture();
|
||||
},
|
||||
});
|
||||
},
|
||||
pp::panopainter::make_legacy_canvas_draw_merge_grid_modes_draw(
|
||||
&Canvas::modes[(int)kCanvasMode::Grid],
|
||||
ortho_proj,
|
||||
proj,
|
||||
camera),
|
||||
pp::panopainter::make_legacy_canvas_draw_merge_heightmap_draw(App::I->grid.get(), proj, camera),
|
||||
pp::panopainter::make_legacy_canvas_draw_merge_current_modes_draw(
|
||||
m_canvas->m_mode,
|
||||
ortho_proj,
|
||||
proj,
|
||||
camera));
|
||||
|
||||
if (m_density != 1.f)
|
||||
{
|
||||
pp::panopainter::execute_legacy_canvas_draw_merge_display_resolve(
|
||||
pp::panopainter::LegacyCanvasDrawMergeDisplayResolveUniforms {
|
||||
.texture = {
|
||||
.mvp = glm::ortho<float>(-1, 1, -1, 1),
|
||||
.texture_slot = 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
.unbind_resolve_framebuffer = [&] {
|
||||
m_rtt.unbindFramebuffer();
|
||||
},
|
||||
.clear_color_buffer = [&] {
|
||||
clear_node_canvas_color_buffer({ 1.f, 1.f, 1.f, 0.f });
|
||||
},
|
||||
.apply_viewport = [&] {
|
||||
apply_node_canvas_viewport(c.x + App::I->off_x, c.y + App::I->off_y, c.z, c.w);
|
||||
},
|
||||
.bind_sampler = [&] {
|
||||
m_sampler_nearest.bind(0);
|
||||
},
|
||||
.bind_resolve_texture = [&] {
|
||||
set_active_texture_unit(0);
|
||||
m_rtt.bindTexture();
|
||||
},
|
||||
.draw = [&] {
|
||||
m_face_plane.draw_fill();
|
||||
},
|
||||
.unbind_resolve_texture = [&] {
|
||||
m_rtt.unbindTexture();
|
||||
},
|
||||
});
|
||||
}
|
||||
execute_node_canvas_draw_merge_tail(*this, ortho_proj, proj, camera, c);
|
||||
|
||||
scissor ? apply_node_canvas_capability(pp::renderer::gl::scissor_test_state(), true) : apply_node_canvas_capability(pp::renderer::gl::scissor_test_state(), false);
|
||||
blend ? apply_node_canvas_capability(pp::renderer::gl::blend_state(), true) : apply_node_canvas_capability(pp::renderer::gl::blend_state(), false);
|
||||
|
||||
Reference in New Issue
Block a user