Thin Windows entry, preview shell, and platform legacy state
This commit is contained in:
@@ -28,8 +28,7 @@ void NodeStrokePreview::clone_children(Node* dest) const
|
||||
|
||||
void NodeStrokePreview::clone_finalize(Node* dest) const
|
||||
{
|
||||
NodeStrokePreview* n = (NodeStrokePreview*)dest;
|
||||
n->init_controls();
|
||||
pp::panopainter::initialize_legacy_node_stroke_preview_clone(dest);
|
||||
}
|
||||
|
||||
void NodeStrokePreview::init_controls()
|
||||
@@ -40,21 +39,18 @@ void NodeStrokePreview::init_controls()
|
||||
|
||||
void NodeStrokePreview::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2& bb_sz)
|
||||
{
|
||||
const auto& b = m_brush;
|
||||
const bool mix_ok = pp::panopainter::execute_legacy_node_stroke_preview_mix_pass(
|
||||
pp::panopainter::LegacyNodeStrokePreviewMixPassExecutionRequest {
|
||||
.brush = *b,
|
||||
.preview_size = m_size,
|
||||
.mixer_rtt = m_rtt_mixer,
|
||||
.bb_min = bb_min,
|
||||
.bb_sz = bb_sz,
|
||||
.linear_sampler = m_sampler_linear,
|
||||
.background_texture = m_tex_background,
|
||||
.stroke_texture = m_tex,
|
||||
.dual_texture = m_tex_dual,
|
||||
.draw_mix = [this] {
|
||||
m_plane.draw_fill();
|
||||
},
|
||||
*m_brush,
|
||||
m_size,
|
||||
m_rtt_mixer,
|
||||
bb_min,
|
||||
bb_sz,
|
||||
m_sampler_linear,
|
||||
m_tex_background,
|
||||
m_tex,
|
||||
m_tex_dual,
|
||||
[this] {
|
||||
m_plane.draw_fill();
|
||||
});
|
||||
assert(mix_ok);
|
||||
}
|
||||
@@ -64,97 +60,26 @@ glm::vec4 NodeStrokePreview::stroke_draw_samples(
|
||||
Texture2D& blend_tex,
|
||||
bool copy_stroke_destination)
|
||||
{
|
||||
const glm::vec2 size = { m_rtt.getWidth(), m_rtt.getHeight() };
|
||||
return pp::panopainter::execute_legacy_node_stroke_preview_sample_pass(
|
||||
pp::panopainter::LegacyNodeStrokePreviewSamplePassRequest {
|
||||
.target_size = size,
|
||||
.vertices = P,
|
||||
.brush_shape = m_brush_shape,
|
||||
.copy_stroke_destination = copy_stroke_destination,
|
||||
.bind_destination_texture = [&] {
|
||||
pp::panopainter::bind_legacy_node_stroke_preview_destination_texture(blend_tex);
|
||||
},
|
||||
.copy_framebuffer_to_destination_texture = [](
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height) {
|
||||
pp::panopainter::copy_legacy_node_stroke_preview_destination_texture_region(
|
||||
src_x,
|
||||
src_y,
|
||||
dst_x,
|
||||
dst_y,
|
||||
width,
|
||||
height);
|
||||
},
|
||||
.unbind_destination_texture = [&] {
|
||||
pp::panopainter::unbind_legacy_node_stroke_preview_destination_texture(blend_tex);
|
||||
},
|
||||
});
|
||||
m_rtt,
|
||||
P,
|
||||
m_brush_shape,
|
||||
blend_tex,
|
||||
copy_stroke_destination);
|
||||
}
|
||||
|
||||
std::vector<NodeStrokePreview::StrokeFrame> NodeStrokePreview::stroke_draw_compute(const Stroke& stroke, float zoom) const
|
||||
{
|
||||
return pp::panopainter::plan_legacy_node_stroke_preview_stroke_frames(
|
||||
pp::panopainter::LegacyNodeStrokePreviewStrokeComputeRequest {
|
||||
.stroke = stroke,
|
||||
.zoom = zoom,
|
||||
.mixer_size = glm::vec2(m_rtt.getWidth(), m_rtt.getHeight()),
|
||||
});
|
||||
stroke,
|
||||
zoom,
|
||||
glm::vec2(m_rtt.getWidth(), m_rtt.getHeight()));
|
||||
}
|
||||
|
||||
void NodeStrokePreview::draw_stroke_immediate()
|
||||
{
|
||||
if (m_size.x == 0 || m_size.y == 0)
|
||||
return;
|
||||
const bool sequence_ok = pp::panopainter::execute_legacy_node_stroke_preview_immediate_draw(
|
||||
pp::panopainter::LegacyNodeStrokePreviewImmediateDrawRequest {
|
||||
.brush = m_brush,
|
||||
.preview_size = m_size,
|
||||
.zoom = root()->m_zoom,
|
||||
.min_flow = m_min_flow,
|
||||
.stroke_max_size_override = m_max_size,
|
||||
.pad_override = 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 = m_rtt,
|
||||
.preview_rtt_mixer = m_rtt_mixer,
|
||||
.preview_stroke_texture = m_tex,
|
||||
.preview_dual_texture = m_tex_dual,
|
||||
.preview_background_texture = m_tex_background,
|
||||
.preview_image_texture = m_tex_preview,
|
||||
.linear_sampler = m_sampler_linear,
|
||||
.repeat_sampler = m_sampler_linear_repeat,
|
||||
.prepare_render_target = [&] {
|
||||
pp::panopainter::apply_legacy_node_stroke_preview_viewport(0, 0, m_rtt.getWidth(), m_rtt.getHeight());
|
||||
m_rtt.bindFramebuffer();
|
||||
m_rtt.clear();
|
||||
pp::panopainter::bind_legacy_node_stroke_preview_live_samplers(
|
||||
m_sampler_mipmap,
|
||||
m_sampler_linear,
|
||||
m_sampler_linear_repeat);
|
||||
},
|
||||
.finish_render_target = [&] {
|
||||
m_rtt.unbindFramebuffer();
|
||||
},
|
||||
.compute_frames = [&](const Stroke& stroke, float frame_zoom) {
|
||||
return stroke_draw_compute(stroke, frame_zoom);
|
||||
},
|
||||
.draw_samples = [&](std::array<vertex_t, 4>& shapes, Texture2D& texture, bool copy_stroke_destination) {
|
||||
return stroke_draw_samples(shapes, texture, copy_stroke_destination);
|
||||
},
|
||||
.draw_mix = [&](const glm::vec2& bb_min, const glm::vec2& bb_sz) {
|
||||
stroke_draw_mix(bb_min, bb_sz);
|
||||
},
|
||||
.draw_checkerboard = [&] {
|
||||
m_plane.draw_fill();
|
||||
},
|
||||
.draw_composite = [&] {
|
||||
m_plane.draw_fill();
|
||||
},
|
||||
});
|
||||
const bool sequence_ok = pp::panopainter::execute_legacy_node_stroke_preview_immediate_draw(*this);
|
||||
assert(sequence_ok);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user