Route stroke frame-face traversal through helper
This commit is contained in:
@@ -690,24 +690,21 @@ void Canvas::stroke_draw()
|
||||
std::array<glm::vec4, 6> box_face = SIXPLETTE(glm::vec4(m_size, 0, 0));
|
||||
std::array<bool, 6> box_dirty = SIXPLETTE(false);
|
||||
glm::vec4 pad_color;
|
||||
for (auto& f : frames)
|
||||
{
|
||||
if (brush->m_tip_mix > 0.f)
|
||||
{
|
||||
stroke_draw_mix(xy(f.m_mixer_rect), zw(f.m_mixer_rect));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
auto& P = f.shapes[i];
|
||||
if (P.size() < 3)
|
||||
continue;
|
||||
pp::panopainter::execute_legacy_canvas_stroke_frame_faces(
|
||||
frames,
|
||||
[&](auto& f) {
|
||||
if (brush->m_tip_mix > 0.f)
|
||||
{
|
||||
stroke_draw_mix(xy(f.m_mixer_rect), zw(f.m_mixer_rect));
|
||||
}
|
||||
},
|
||||
[&](auto& f, int i, auto& P) {
|
||||
m_dirty_face[i] = true;
|
||||
merge_faces[i] = true;
|
||||
box_dirty[i] = true;
|
||||
|
||||
m_tmp[i].bindFramebuffer();
|
||||
|
||||
|
||||
pp::panopainter::use_legacy_stroke_shader();
|
||||
pp::panopainter::apply_legacy_stroke_sample_uniforms(
|
||||
pp::panopainter::LegacyStrokeSampleUniforms {
|
||||
@@ -718,7 +715,7 @@ void Canvas::stroke_draw()
|
||||
auto box_sample = stroke_draw_samples(i, P, copy_stroke_destination);
|
||||
|
||||
m_tmp[i].unbindFramebuffer();
|
||||
|
||||
|
||||
const auto dirty_update = pp::panopainter::plan_legacy_canvas_stroke_face_dirty_update(
|
||||
pp::panopainter::LegacyCanvasStrokeFaceDirtyRequest {
|
||||
.extent = stroke_extent,
|
||||
@@ -731,8 +728,7 @@ void Canvas::stroke_draw()
|
||||
box_face[i] = dirty_update.pass_dirty_box;
|
||||
// TODO: maybe average color?
|
||||
pad_color = f.col;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
set_active_texture_unit(3);
|
||||
m_mixer.unbindTexture();
|
||||
@@ -812,19 +808,17 @@ void Canvas::stroke_draw()
|
||||
dual_brush->m_tip_texture->bind() :
|
||||
unbind_texture_2d();
|
||||
auto frames_dual = stroke_draw_compute(*m_dual_stroke);
|
||||
for (auto& f : frames_dual)
|
||||
{
|
||||
pp::panopainter::apply_legacy_stroke_sample_uniforms(
|
||||
pp::panopainter::LegacyStrokeSampleUniforms {
|
||||
.color = f.col,
|
||||
.alpha = f.flow,
|
||||
.opacity = f.opacity,
|
||||
});
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
auto& P = f.shapes[i];
|
||||
if (P.size() < 3)
|
||||
continue;
|
||||
pp::panopainter::execute_legacy_canvas_stroke_frame_faces(
|
||||
frames_dual,
|
||||
[&](auto& f) {
|
||||
pp::panopainter::apply_legacy_stroke_sample_uniforms(
|
||||
pp::panopainter::LegacyStrokeSampleUniforms {
|
||||
.color = f.col,
|
||||
.alpha = f.flow,
|
||||
.opacity = f.opacity,
|
||||
});
|
||||
},
|
||||
[&](auto&, int i, auto& P) {
|
||||
m_tmp_dual[i].bindFramebuffer();
|
||||
auto box_sample = stroke_draw_samples(i, P, copy_stroke_destination);
|
||||
m_tmp_dual[i].unbindFramebuffer();
|
||||
@@ -840,8 +834,7 @@ void Canvas::stroke_draw()
|
||||
stroke_material.composite_pass.dual_blend_mode == 0,
|
||||
});
|
||||
m_dirty_box[i] = dirty_update.accumulated_dirty_box;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
m_sampler_brush.unbind();
|
||||
|
||||
Reference in New Issue
Block a user