Extract fill modes, preview runtime pockets, and brush item UI
This commit is contained in:
@@ -24,6 +24,79 @@
|
||||
|
||||
namespace pp::panopainter {
|
||||
|
||||
void execute_legacy_node_stroke_preview_background_capture_pass(
|
||||
const LegacyNodeStrokePreviewBackgroundCaptureRequest& request)
|
||||
{
|
||||
if (!request.draw_checkerboard) {
|
||||
return;
|
||||
}
|
||||
|
||||
const float aspect = request.size.x / request.size.y;
|
||||
pp::panopainter::setup_legacy_canvas_draw_merge_checkerboard_shader(
|
||||
pp::panopainter::LegacyCanvasDrawMergeCheckerboardUniforms {
|
||||
.mvp = glm::ortho(-.5f, .5f, -.5f / aspect, .5f / aspect, -1.f, 1.f),
|
||||
.colorize = request.colorize,
|
||||
});
|
||||
request.draw_checkerboard();
|
||||
const auto copy_status = pp::paint_renderer::copy_stroke_preview_result_to_texture(
|
||||
[&] {
|
||||
request.background_texture.bind();
|
||||
},
|
||||
[](
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height) {
|
||||
copy_framebuffer_to_texture_2d(src_x, src_y, dst_x, dst_y, width, height);
|
||||
},
|
||||
pp::paint_renderer::StrokePreviewCopySize {
|
||||
.width = static_cast<int>(request.size.x),
|
||||
.height = static_cast<int>(request.size.y),
|
||||
});
|
||||
assert(copy_status.ok());
|
||||
}
|
||||
|
||||
std::vector<LegacyNodeStrokePreviewFrame> plan_legacy_node_stroke_preview_stroke_frames(
|
||||
const LegacyNodeStrokePreviewStrokeComputeRequest& request)
|
||||
{
|
||||
auto samples = const_cast<Stroke&>(request.stroke).compute_samples();
|
||||
StrokeSample previous_sample = request.stroke.m_prev_sample;
|
||||
previous_sample.size *= request.zoom;
|
||||
for (auto& sample : samples) {
|
||||
sample.size *= request.zoom;
|
||||
}
|
||||
|
||||
return pp::panopainter::plan_legacy_canvas_stroke_frames(
|
||||
pp::panopainter::LegacyCanvasStrokeComputeRequest {
|
||||
.previous_sample = previous_sample,
|
||||
.samples = samples,
|
||||
.zoom = 1.0f,
|
||||
.mixer_size = request.mixer_size,
|
||||
},
|
||||
[](
|
||||
std::array<vertex_t, 4>& brush_quad,
|
||||
bool /*project_3d*/,
|
||||
glm::mat4 /*model_view*/) {
|
||||
return brush_quad;
|
||||
},
|
||||
[](
|
||||
glm::vec4 mixer_rect,
|
||||
glm::vec4 color,
|
||||
float flow,
|
||||
float opacity,
|
||||
std::array<vertex_t, 4>&& shapes) -> LegacyNodeStrokePreviewFrame {
|
||||
return LegacyNodeStrokePreviewFrame {
|
||||
.col = color,
|
||||
.flow = flow,
|
||||
.opacity = opacity,
|
||||
.shapes = std::move(shapes),
|
||||
.mixer_rect = mixer_rect,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
bool execute_legacy_node_stroke_preview_immediate_runtime(
|
||||
const LegacyNodeStrokePreviewImmediateRuntimeRequest& request)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user