Refine stroke mix pass boundary
This commit is contained in:
@@ -179,6 +179,45 @@ struct LegacyCanvasStrokeMixPassResult {
|
||||
std::size_t composed_planes = 0;
|
||||
};
|
||||
|
||||
[[nodiscard]] inline LegacyCanvasStrokeMixPassResult execute_legacy_canvas_stroke_mix_pass(
|
||||
const LegacyCanvasStrokeMixPassRequest& request);
|
||||
|
||||
template <std::size_t PlaneCount, typename HasTarget>
|
||||
[[nodiscard]] inline std::array<LegacyCanvasStrokeMixPassPlane, PlaneCount>
|
||||
plan_legacy_canvas_stroke_mix_pass_planes(
|
||||
bool visible,
|
||||
float opacity,
|
||||
const glm::mat4& mvp_base,
|
||||
const std::array<glm::mat4, PlaneCount>& plane_transforms,
|
||||
HasTarget&& has_target,
|
||||
const glm::mat4& plane_offset = glm::translate(glm::vec3(0.0f, 0.0f, -1.0f)))
|
||||
{
|
||||
std::array<LegacyCanvasStrokeMixPassPlane, PlaneCount> planes {};
|
||||
for (std::size_t plane_index = 0; plane_index < PlaneCount; ++plane_index) {
|
||||
planes[plane_index] = LegacyCanvasStrokeMixPassPlane {
|
||||
.index = static_cast<int>(plane_index),
|
||||
.visible = visible,
|
||||
.has_target = static_cast<bool>(has_target(static_cast<int>(plane_index))),
|
||||
.opacity = opacity,
|
||||
.mvp = mvp_base * plane_transforms[plane_index] * plane_offset,
|
||||
};
|
||||
}
|
||||
return planes;
|
||||
}
|
||||
|
||||
template <typename BeginMixPass, typename EndMixPass>
|
||||
[[nodiscard]] inline LegacyCanvasStrokeMixPassResult
|
||||
execute_legacy_canvas_stroke_mix_pass_with_setup(
|
||||
BeginMixPass&& begin_mix_pass,
|
||||
EndMixPass&& end_mix_pass,
|
||||
const LegacyCanvasStrokeMixPassRequest& request)
|
||||
{
|
||||
begin_mix_pass();
|
||||
const auto result = execute_legacy_canvas_stroke_mix_pass(request);
|
||||
end_mix_pass();
|
||||
return result;
|
||||
}
|
||||
|
||||
struct LegacyCanvasStrokeComputeRequest {
|
||||
StrokeSample previous_sample {};
|
||||
std::span<const StrokeSample> samples;
|
||||
|
||||
Reference in New Issue
Block a user