Extract edit menu and Windows/bootstrap preview seams

This commit is contained in:
2026-06-16 12:53:49 +02:00
parent 184f662493
commit cb9d06c6dc
12 changed files with 493 additions and 409 deletions

View File

@@ -199,22 +199,6 @@ pp::panopainter::LegacyCanvasStrokeMixPassRequest make_stroke_preview_mix_pass_e
});
}
void copy_stroke_preview_framebuffer_to_texture(
Texture2D& texture,
glm::vec2 size,
std::uint32_t texture_unit)
{
set_active_texture_unit(texture_unit);
texture.bind();
copy_framebuffer_to_texture_2d(
0,
0,
0,
0,
static_cast<int>(size.x),
static_cast<int>(size.y));
}
void bind_stroke_preview_live_samplers(
Sampler& mipmap_sampler,
Sampler& linear_sampler,
@@ -235,38 +219,6 @@ void bind_stroke_preview_dual_pass_textures(const Brush& dual_brush)
unbind_texture_2d();
}
void bind_stroke_preview_main_pass_textures(
const Brush& brush,
Texture2D& stroke_destination_texture,
RTT& mixer_rtt,
bool copy_stroke_destination,
bool uses_mixer)
{
pp::panopainter::bind_legacy_node_stroke_preview_main_pass_textures(
pp::panopainter::make_legacy_node_stroke_preview_main_pass_texture_dispatch(
[&](int texture_slot) {
set_active_texture_unit(texture_slot);
},
[&] {
brush.m_tip_texture ?
brush.m_tip_texture->bind() :
unbind_texture_2d();
},
[&] {
stroke_destination_texture.bind();
},
[&] {
brush.m_pattern_texture ?
brush.m_pattern_texture->bind() :
unbind_texture_2d();
},
[&] {
mixer_rtt.bindTexture();
}),
copy_stroke_destination,
uses_mixer);
}
void bind_stroke_preview_destination_texture(Texture2D& texture)
{
set_active_texture_unit(stroke_preview_live_slots::kDestination);
@@ -782,29 +734,19 @@ NodeStrokePreview::make_stroke_draw_immediate_main_live_pass_request(
float zoom,
const glm::vec2& size)
{
return StrokeMainLivePassRequest {
.setup_blend_uniforms = [&] {
pp::panopainter::apply_legacy_stroke_blend_uniforms(
pass_orchestration.material.stroke_pass.uses_pattern,
brush.m_tip_mix,
brush.m_tip_wet,
brush.m_tip_noise);
},
.bind_main_pass_textures = [&] {
bind_stroke_preview_main_pass_textures(
brush,
m_tex,
m_rtt_mixer,
copy_stroke_destination,
pass_orchestration.material.stroke_pass.uses_mixer);
},
.clear_target = [&] {
m_rtt.clear();
},
.compute_frames = [&] {
return pp::panopainter::make_legacy_node_stroke_preview_main_live_pass_request<StrokeFrame>(
brush,
pass_orchestration,
m_tex,
m_rtt_mixer,
m_rtt,
copy_stroke_destination,
size,
pp::panopainter::kLegacyNodeStrokePreviewStrokeTextureSlot,
[&] {
return stroke_draw_compute(stroke, zoom);
},
.before_frame = [&](auto& frame) {
[&](auto& frame) {
if (brush.m_tip_mix > 0.f)
{
stroke_draw_mix(xy(frame.m_mixer_rect), zw(frame.m_mixer_rect));
@@ -815,24 +757,17 @@ NodeStrokePreview::make_stroke_draw_immediate_main_live_pass_request(
glm::vec4 { 0, 0, 0, 1 };
frame.flow = glm::max(frame.flow, m_min_flow);
},
.setup_sample_shader = [&](auto& frame) {
[&](auto& frame) {
execute_stroke_draw_immediate_main_live_sample_pass(
brush,
copy_stroke_destination,
frame,
size);
},
.draw_sample = [&](auto& frame) {
[&](auto& frame) {
/*auto rect =*/ stroke_draw_samples(frame.shapes, m_tex, copy_stroke_destination);
},
.copy_pass_result = [&] {
copy_stroke_preview_framebuffer_to_texture(
m_tex,
size,
stroke_preview_composite_slots::kStroke);
},
.finish_main_pass = [&] { set_active_texture_unit(stroke_preview_live_slots::kMixer); m_rtt_mixer.unbindTexture(); },
};
[&] { set_active_texture_unit(stroke_preview_live_slots::kMixer); m_rtt_mixer.unbindTexture(); });
}
void NodeStrokePreview::execute_stroke_draw_immediate_dual_pass(
@@ -869,7 +804,7 @@ void NodeStrokePreview::execute_stroke_draw_immediate_dual_pass(
/*auto rect =*/ stroke_draw_samples(frame.shapes, m_tex_dual, copy_stroke_destination);
},
[&] {
copy_stroke_preview_framebuffer_to_texture(
pp::panopainter::copy_legacy_node_stroke_preview_framebuffer_to_texture(
m_tex_dual,
size,
stroke_preview_composite_slots::kStroke);