Reuse main stroke texture dispatch helper
This commit is contained in:
@@ -758,27 +758,27 @@ void Canvas::stroke_draw()
|
||||
},
|
||||
};
|
||||
const pp::panopainter::LegacyCanvasStrokeTextureInputDispatch main_pass_texture_dispatch {
|
||||
.activate_texture_unit = [&](int texture_slot) {
|
||||
set_active_texture_unit(texture_slot);
|
||||
},
|
||||
.bind_brush_tip = [&] {
|
||||
brush->m_tip_texture->bind();
|
||||
},
|
||||
.unbind_brush_tip = [&] {
|
||||
brush->m_tip_texture->unbind();
|
||||
},
|
||||
.bind_pattern = [&] {
|
||||
brush->m_pattern_texture ?
|
||||
brush->m_pattern_texture->bind() :
|
||||
unbind_texture_2d();
|
||||
},
|
||||
.bind_mixer = [&] {
|
||||
m_mixer.bindTexture();
|
||||
},
|
||||
.unbind_mixer = [&] {
|
||||
m_mixer.unbindTexture();
|
||||
},
|
||||
};
|
||||
pp::panopainter::make_legacy_canvas_stroke_main_pass_texture_dispatch(
|
||||
[&](int texture_slot) {
|
||||
set_active_texture_unit(texture_slot);
|
||||
},
|
||||
[&] {
|
||||
brush->m_tip_texture->bind();
|
||||
},
|
||||
[&] {
|
||||
brush->m_tip_texture->unbind();
|
||||
},
|
||||
[&] {
|
||||
brush->m_pattern_texture ?
|
||||
brush->m_pattern_texture->bind() :
|
||||
unbind_texture_2d();
|
||||
},
|
||||
[&] {
|
||||
m_mixer.bindTexture();
|
||||
},
|
||||
[&] {
|
||||
m_mixer.unbindTexture();
|
||||
});
|
||||
pp::panopainter::bind_legacy_canvas_stroke_sampler_inputs(
|
||||
live_pass_sampler_bindings,
|
||||
live_pass_sampler_dispatch);
|
||||
|
||||
@@ -86,6 +86,24 @@ struct LegacyCanvasStrokeTextureInputDispatch {
|
||||
std::function<void()> unbind_mixer;
|
||||
};
|
||||
|
||||
[[nodiscard]] inline LegacyCanvasStrokeTextureInputDispatch make_legacy_canvas_stroke_main_pass_texture_dispatch(
|
||||
std::function<void(int)> activate_texture_unit,
|
||||
std::function<void()> bind_brush_tip,
|
||||
std::function<void()> unbind_brush_tip,
|
||||
std::function<void()> bind_pattern,
|
||||
std::function<void()> bind_mixer,
|
||||
std::function<void()> unbind_mixer)
|
||||
{
|
||||
return LegacyCanvasStrokeTextureInputDispatch {
|
||||
.activate_texture_unit = std::move(activate_texture_unit),
|
||||
.bind_brush_tip = std::move(bind_brush_tip),
|
||||
.unbind_brush_tip = std::move(unbind_brush_tip),
|
||||
.bind_pattern = std::move(bind_pattern),
|
||||
.bind_mixer = std::move(bind_mixer),
|
||||
.unbind_mixer = std::move(unbind_mixer),
|
||||
};
|
||||
}
|
||||
|
||||
[[nodiscard]] inline LegacyCanvasStrokeTextureInputDispatch make_legacy_canvas_stroke_brush_tip_texture_dispatch(
|
||||
std::function<void(int)> activate_texture_unit,
|
||||
std::function<void()> bind_brush_tip,
|
||||
|
||||
Reference in New Issue
Block a user