Extract preview dual pass live body

This commit is contained in:
2026-06-13 23:51:52 +02:00
parent a2e805f991
commit 3672f9a514
4 changed files with 88 additions and 28 deletions

View File

@@ -748,34 +748,13 @@ void NodeStrokePreview::draw_stroke_immediate()
bind_stroke_preview_dual_pass_textures(*dual_brush);
},
.execute_dual_pass = [&] {
pp::panopainter::execute_legacy_stroke_preview_live_pass(
[&] {
m_rtt.clear();
},
[&] {
return stroke_draw_compute(m_dual_stroke, zoom);
},
[](auto& frame) {
frame.col = { 0, 0, 0, 1 };
},
[&](auto& frame) {
pp::panopainter::use_legacy_stroke_shader();
pp::panopainter::apply_legacy_stroke_sample_uniforms(
pp::panopainter::LegacyStrokeSampleUniforms {
.color = frame.col,
.alpha = frame.flow,
.opacity = frame.opacity,
});
},
[&](auto& frame) {
/*auto rect =*/ stroke_draw_samples(frame.shapes, m_tex_dual, copy_stroke_destination);
},
[&] {
copy_stroke_preview_framebuffer_to_texture(
m_tex_dual,
size,
stroke_preview_composite_slots::kStroke);
});
execute_stroke_draw_immediate_dual_pass(
*b,
pass_orchestration,
dual_brush,
copy_stroke_destination,
zoom,
size);
},
.capture_background = [&] {
execute_stroke_preview_background_capture_pass(
@@ -893,6 +872,46 @@ NodeStrokePreview::make_stroke_draw_immediate_main_live_pass_request(
};
}
void NodeStrokePreview::execute_stroke_draw_immediate_dual_pass(
const Brush& brush,
const pp::panopainter::LegacyNodeStrokePreviewPassOrchestrationPlan& pass_orchestration,
std::shared_ptr<Brush> dual_brush,
bool copy_stroke_destination,
float zoom,
const glm::vec2& size)
{
(void)pass_orchestration;
(void)dual_brush;
pp::panopainter::execute_legacy_stroke_preview_live_pass(
[&] {
m_rtt.clear();
},
[&] {
return stroke_draw_compute(m_dual_stroke, zoom);
},
[](auto& frame) {
frame.col = { 0, 0, 0, 1 };
},
[&](auto& frame) {
pp::panopainter::use_legacy_stroke_shader();
pp::panopainter::apply_legacy_stroke_sample_uniforms(
pp::panopainter::LegacyStrokeSampleUniforms {
.color = frame.col,
.alpha = frame.flow,
.opacity = frame.opacity,
});
},
[&](auto& frame) {
/*auto rect =*/ stroke_draw_samples(frame.shapes, m_tex_dual, copy_stroke_destination);
},
[&] {
copy_stroke_preview_framebuffer_to_texture(
m_tex_dual,
size,
stroke_preview_composite_slots::kStroke);
});
}
Image NodeStrokePreview::render_to_image()
{
std::lock_guard<std::mutex> _lock(s_render_mutex);

View File

@@ -59,6 +59,13 @@ public:
bool copy_stroke_destination,
float zoom,
const glm::vec2& size);
void execute_stroke_draw_immediate_dual_pass(
const Brush& brush,
const pp::panopainter::LegacyNodeStrokePreviewPassOrchestrationPlan& pass_orchestration,
std::shared_ptr<Brush> dual_brush,
bool copy_stroke_destination,
float zoom,
const glm::vec2& size);
void draw_stroke();
void draw_stroke_immediate();
Image render_to_image();