改造一些

This commit is contained in:
2026-08-11 23:17:03 +08:00
parent c89a678245
commit aca480d988
29 changed files with 1348 additions and 771 deletions
+27
View File
@@ -1,11 +1,14 @@
#pragma once
#include "../renderable/Renderable_Builder.h"
#include <renderive/base/property/Attach_Builder.hpp>
#include <renderive/scene/base/Scene_Base.hpp>
#include <renderive/state/Double_State_Strategy.hpp>
#include <algorithm>
#include <cmath>
#include <limits>
namespace renderive {
class Abs_Axis;
template <std::totally_ordered Value_Type, Value_Type Minimum, Value_Type Maximum, Value_Type Default>
class Clamped_Property {
public:
@@ -46,6 +49,8 @@ private:
double value{};
};
namespace detail {
class Paint_Overlay {};
template <Property_Set Properties_Type>
class Plottable_State : public Double_State_Strategy<Renderable, Properties_Type> {
public:
@@ -82,5 +87,27 @@ private:
};
template <class Control, class Properties>
using Attach_Plottable = Attach_Builder<Control, Properties, Renderable_Builder>;
template <class Renderable_Type, class Axis_Type>
requires std::derived_from<Renderable_Type, Renderable> && std::derived_from<Axis_Type, Abs_Axis>
void attach_renderable_dependency(Renderable_Type& renderable, const std::shared_ptr<Axis_Type>& axis) {
if (axis) {
renderable.scene().add_dependency_parent(renderable, *axis);
if constexpr (std::derived_from<Renderable_Type, Paint_Overlay>) {
renderable.scene().add_display_parent(renderable, *axis);
} else {
renderable.scene().add_display_parent(*axis, renderable);
}
}
}
template <class Renderable_Type, class Value>
void attach_renderable_dependency(Renderable_Type&, const Value&) {}
template <class Control, class... Args>
requires std::derived_from<Control, Renderable>
void attach_renderable_dependencies(Control& renderable, const Args&... args) {
(attach_renderable_dependency(renderable, args), ...);
}
}
}