Move NodeCanvas display resolve behind seam
This commit is contained in:
@@ -175,6 +175,20 @@ struct LegacyCanvasDrawMergeFinalPlaneCompositeExecution {
|
||||
std::function<void()> unbind_merged_texture;
|
||||
};
|
||||
|
||||
struct LegacyCanvasDrawMergeDisplayResolveUniforms {
|
||||
LegacyCanvasDrawMergeTextureUniforms texture;
|
||||
};
|
||||
|
||||
struct LegacyCanvasDrawMergeDisplayResolveExecution {
|
||||
std::function<void()> unbind_resolve_framebuffer;
|
||||
std::function<void()> clear_color_buffer;
|
||||
std::function<void()> apply_viewport;
|
||||
std::function<void()> bind_sampler;
|
||||
std::function<void()> bind_resolve_texture;
|
||||
std::function<void()> draw;
|
||||
std::function<void()> unbind_resolve_texture;
|
||||
};
|
||||
|
||||
[[nodiscard]] inline LegacyCanvasDrawMergeShaderExecution legacy_shader_manager_draw_merge_execution() noexcept
|
||||
{
|
||||
return {
|
||||
@@ -433,4 +447,18 @@ inline void execute_legacy_canvas_draw_merge_final_plane_composite(
|
||||
execution.unbind_merged_texture();
|
||||
}
|
||||
|
||||
inline void execute_legacy_canvas_draw_merge_display_resolve(
|
||||
const LegacyCanvasDrawMergeDisplayResolveUniforms& uniforms,
|
||||
const LegacyCanvasDrawMergeDisplayResolveExecution& execution)
|
||||
{
|
||||
execution.unbind_resolve_framebuffer();
|
||||
execution.clear_color_buffer();
|
||||
execution.apply_viewport();
|
||||
execution.bind_sampler();
|
||||
execution.bind_resolve_texture();
|
||||
setup_legacy_canvas_draw_merge_texture_shader(uniforms.texture);
|
||||
execution.draw();
|
||||
execution.unbind_resolve_texture();
|
||||
}
|
||||
|
||||
} // namespace pp::panopainter
|
||||
|
||||
@@ -762,22 +762,37 @@ void NodeCanvas::draw()
|
||||
|
||||
if (m_density != 1.f)
|
||||
{
|
||||
m_rtt.unbindFramebuffer();
|
||||
|
||||
clear_node_canvas_color_buffer({ 1.f, 1.f, 1.f, 0.f });
|
||||
apply_node_canvas_viewport(c.x + App::I->off_x, c.y + App::I->off_y, c.z, c.w);
|
||||
|
||||
// draw the canvas
|
||||
m_sampler_nearest.bind(0);
|
||||
set_active_texture_unit(0);
|
||||
m_rtt.bindTexture();
|
||||
pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader(
|
||||
pp::panopainter::LegacyCanvasDrawMergeTextureUniforms {
|
||||
.mvp = glm::ortho<float>(-1, 1, -1, 1),
|
||||
.texture_slot = 0,
|
||||
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();
|
||||
},
|
||||
});
|
||||
m_face_plane.draw_fill();
|
||||
m_rtt.unbindTexture();
|
||||
}
|
||||
|
||||
scissor ? apply_node_canvas_capability(pp::renderer::gl::scissor_test_state(), true) : apply_node_canvas_capability(pp::renderer::gl::scissor_test_state(), false);
|
||||
|
||||
Reference in New Issue
Block a user