Extract node canvas events and preview/node geometry shells
This commit is contained in:
@@ -24,6 +24,118 @@
|
||||
|
||||
namespace pp::panopainter {
|
||||
|
||||
pp::renderer::RenderDeviceFeatures stroke_preview_render_device_features() noexcept
|
||||
{
|
||||
return ShaderManager::render_device_features();
|
||||
}
|
||||
|
||||
void apply_legacy_node_stroke_preview_viewport(std::int32_t x, std::int32_t y, std::int32_t width, std::int32_t height)
|
||||
{
|
||||
pp::legacy::ui_gl::apply_viewport(x, y, width, height, "NodeStrokePreview");
|
||||
}
|
||||
|
||||
pp::renderer::gl::OpenGlViewportRect query_legacy_node_stroke_preview_viewport()
|
||||
{
|
||||
return pp::legacy::ui_gl::query_viewport_rect("NodeStrokePreview");
|
||||
}
|
||||
|
||||
std::array<float, 4> query_legacy_node_stroke_preview_clear_color()
|
||||
{
|
||||
return pp::legacy::ui_gl::query_clear_color("NodeStrokePreview");
|
||||
}
|
||||
|
||||
void apply_legacy_node_stroke_preview_clear_color(std::array<float, 4> color)
|
||||
{
|
||||
pp::legacy::ui_gl::set_clear_color(color, "NodeStrokePreview");
|
||||
}
|
||||
|
||||
void apply_legacy_node_stroke_preview_scissor(std::int32_t x, std::int32_t y, std::int32_t width, std::int32_t height)
|
||||
{
|
||||
pp::legacy::ui_gl::apply_scissor_rect(x, y, width, height, "NodeStrokePreview");
|
||||
}
|
||||
|
||||
void apply_legacy_node_stroke_preview_capability(std::uint32_t state, bool enabled)
|
||||
{
|
||||
pp::legacy::ui_gl::set_capability(state, enabled, "NodeStrokePreview");
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
namespace stroke_preview_live_slots {
|
||||
constexpr std::uint32_t kTip = 0U;
|
||||
constexpr std::uint32_t kDestination = 1U;
|
||||
constexpr std::uint32_t kPattern = 2U;
|
||||
constexpr std::uint32_t kMixer = 3U;
|
||||
constexpr std::uint32_t kReservedLinear = 4U;
|
||||
}
|
||||
|
||||
void set_active_texture_unit(std::uint32_t unit_index)
|
||||
{
|
||||
pp::legacy::ui_gl::activate_texture_unit(unit_index, "NodeStrokePreview");
|
||||
}
|
||||
|
||||
void unbind_texture_2d()
|
||||
{
|
||||
pp::legacy::ui_gl::unbind_texture_2d("NodeStrokePreview");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void bind_legacy_node_stroke_preview_live_samplers(
|
||||
Sampler& mipmap_sampler,
|
||||
Sampler& linear_sampler,
|
||||
Sampler& repeat_sampler)
|
||||
{
|
||||
mipmap_sampler.bind(stroke_preview_live_slots::kTip);
|
||||
linear_sampler.bind(stroke_preview_live_slots::kDestination);
|
||||
repeat_sampler.bind(stroke_preview_live_slots::kPattern);
|
||||
linear_sampler.bind(stroke_preview_live_slots::kMixer);
|
||||
linear_sampler.bind(stroke_preview_live_slots::kReservedLinear);
|
||||
}
|
||||
|
||||
void bind_legacy_node_stroke_preview_dual_pass_textures(const Brush& dual_brush)
|
||||
{
|
||||
set_active_texture_unit(stroke_preview_live_slots::kTip);
|
||||
dual_brush.m_tip_texture ?
|
||||
dual_brush.m_tip_texture->bind() :
|
||||
unbind_texture_2d();
|
||||
}
|
||||
|
||||
void bind_legacy_node_stroke_preview_pattern_texture(const Brush& brush)
|
||||
{
|
||||
set_active_texture_unit(stroke_preview_live_slots::kPattern);
|
||||
brush.m_pattern_texture ? brush.m_pattern_texture->bind() : unbind_texture_2d();
|
||||
}
|
||||
|
||||
void bind_legacy_node_stroke_preview_destination_texture(Texture2D& texture)
|
||||
{
|
||||
set_active_texture_unit(stroke_preview_live_slots::kDestination);
|
||||
texture.bind();
|
||||
}
|
||||
|
||||
void unbind_legacy_node_stroke_preview_destination_texture(Texture2D& texture)
|
||||
{
|
||||
set_active_texture_unit(stroke_preview_live_slots::kDestination);
|
||||
texture.unbind();
|
||||
}
|
||||
|
||||
void unbind_legacy_node_stroke_preview_mixer_texture(RTT& mixer_rtt)
|
||||
{
|
||||
set_active_texture_unit(stroke_preview_live_slots::kMixer);
|
||||
mixer_rtt.unbindTexture();
|
||||
}
|
||||
|
||||
void copy_legacy_node_stroke_preview_destination_texture_region(
|
||||
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);
|
||||
}
|
||||
|
||||
void execute_legacy_node_stroke_preview_background_capture_pass(
|
||||
const LegacyNodeStrokePreviewBackgroundCaptureRequest& request)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user