Thin Windows entry, preview shell, and platform legacy state

This commit is contained in:
2026-06-17 00:42:50 +02:00
parent 9b1e593477
commit 5fdc9a9dd6
17 changed files with 368 additions and 216 deletions

View File

@@ -14,6 +14,7 @@
#include "legacy_canvas_stroke_shader_services.h"
#include "legacy_canvas_stroke_services.h"
#include "legacy_node_stroke_preview_execution_services.h"
#include "legacy_node_stroke_preview_sample_services.h"
#include "legacy_ui_gl_dispatch.h"
#include "paint_renderer/compositor.h"
#include "renderer_gl/opengl_capabilities.h"
@@ -299,6 +300,19 @@ std::vector<LegacyNodeStrokePreviewFrame> plan_legacy_node_stroke_preview_stroke
});
}
std::vector<LegacyNodeStrokePreviewFrame> plan_legacy_node_stroke_preview_stroke_frames(
const Stroke& stroke,
float zoom,
glm::vec2 mixer_size)
{
return plan_legacy_node_stroke_preview_stroke_frames(
LegacyNodeStrokePreviewStrokeComputeRequest {
.stroke = stroke,
.zoom = zoom,
.mixer_size = mixer_size,
});
}
bool execute_legacy_node_stroke_preview_immediate_runtime(
const LegacyNodeStrokePreviewImmediateRuntimeRequest& request)
{
@@ -375,6 +389,92 @@ bool execute_legacy_node_stroke_preview_immediate_runtime(
return sequence_ok;
}
void initialize_legacy_node_stroke_preview_clone(Node* dest)
{
static_cast<NodeStrokePreview*>(dest)->init_controls();
}
bool execute_legacy_node_stroke_preview_immediate_draw(NodeStrokePreview& preview)
{
if (preview.m_size.x == 0 || preview.m_size.y == 0) {
return false;
}
const bool sequence_ok = pp::panopainter::execute_legacy_node_stroke_preview_immediate_draw(
pp::panopainter::LegacyNodeStrokePreviewImmediateDrawRequest {
.brush = preview.m_brush,
.preview_size = preview.m_size,
.zoom = preview.root()->m_zoom,
.min_flow = preview.m_min_flow,
.stroke_max_size_override = preview.m_max_size,
.pad_override = preview.m_pad_override,
.camera_fov = Canvas::I->m_cam_fov,
.camera_rot = Canvas::I->m_cam_rot,
.render_device_features = pp::panopainter::stroke_preview_render_device_features(),
.preview_rtt = preview.m_rtt,
.preview_rtt_mixer = preview.m_rtt_mixer,
.preview_stroke_texture = preview.m_tex,
.preview_dual_texture = preview.m_tex_dual,
.preview_background_texture = preview.m_tex_background,
.preview_image_texture = preview.m_tex_preview,
.linear_sampler = preview.m_sampler_linear,
.repeat_sampler = preview.m_sampler_linear_repeat,
.prepare_render_target = [&] {
pp::panopainter::apply_legacy_node_stroke_preview_viewport(
0,
0,
preview.m_rtt.getWidth(),
preview.m_rtt.getHeight());
preview.m_rtt.bindFramebuffer();
preview.m_rtt.clear();
pp::panopainter::bind_legacy_node_stroke_preview_live_samplers(
preview.m_sampler_mipmap,
preview.m_sampler_linear,
preview.m_sampler_linear_repeat);
},
.finish_render_target = [&] {
preview.m_rtt.unbindFramebuffer();
},
.compute_frames = [&](const Stroke& stroke, float frame_zoom) {
return plan_legacy_node_stroke_preview_stroke_frames(
stroke,
frame_zoom,
glm::vec2(preview.m_rtt.getWidth(), preview.m_rtt.getHeight()));
},
.draw_samples = [&](std::array<vertex_t, 4>& shapes, Texture2D& texture, bool copy_stroke_destination) {
return pp::panopainter::execute_legacy_node_stroke_preview_sample_pass(
preview.m_rtt,
shapes,
preview.m_brush_shape,
texture,
copy_stroke_destination);
},
.draw_mix = [&](const glm::vec2& bb_min, const glm::vec2& bb_sz) {
pp::panopainter::execute_legacy_node_stroke_preview_mix_pass(
*preview.m_brush,
preview.m_size,
preview.m_rtt_mixer,
bb_min,
bb_sz,
preview.m_sampler_linear,
preview.m_tex_background,
preview.m_tex,
preview.m_tex_dual,
[&] {
preview.m_plane.draw_fill();
});
},
.draw_checkerboard = [&] {
preview.m_plane.draw_fill();
},
.draw_composite = [&] {
preview.m_plane.draw_fill();
},
});
assert(sequence_ok);
return sequence_ok;
}
} // namespace pp::panopainter
std::atomic_int NodeStrokePreview::s_instances{ 0 };