Files
Aethera/render_3D/render_3D/visual/Sphere_Visual.hpp
T
2026-08-29 00:38:34 +08:00

50 lines
1.7 KiB
C++

#pragma once
#include "Basic_Visual.hpp"
#include <vector>
namespace aethera::render_3d {
struct Sphere {
Vec3 center{};
Color color{Color::white()};
Coordinate_3D radius{0.1F};
bool operator==(const Sphere&) const = default;
};
struct Sphere_Frame_Tag {};
struct Sphere_Frame {
std::vector<Sphere> items{}; /* 本次提交的完整 Sphere 集合。 */
bool operator==(const Sphere_Frame&) const;
};
namespace detail {
struct Sphere_Prepared_Data {
std::vector<Prepared_Position> centers{};
std::vector<Prepared_Color> colors{};
std::vector<float> radii{};
};
struct Sphere_Spec {
using Item = Sphere;
using Prepared_Data = Sphere_Prepared_Data;
[[nodiscard]] static const Datoviz_Visual_Operations& datoviz_operations();
[[nodiscard]] static bool valid(const Item&) noexcept;
static void prepare(const std::vector<Item>&, Prepared_Data&);
};
}
struct Sphere_Visual : Def<Sphere_Visual, Basic_Visual,
Tagged_Buffer<Sphere_Frame_Tag, Sphere_Frame>> {
using Visual_Base = Sphere_Visual;
using Frame_Tag = Sphere_Frame_Tag;
using Frame = Sphere_Frame;
using Specification = detail::Sphere_Spec;
using Item = typename Specification::Item;
struct Prop : Prev_Prop { bool operator==(const Prop&) const; };
struct State : Prev_State {
std::size_t item_count{}; /* 最近一次发布的输入项数。 */
std::size_t prepared_item_count{}; /* 最近一次 Prepare 的后端项数。 */
std::uint64_t prepared_revision{}; /* 最近一次 Prepare 的提交版本。 */
bool operator==(const State&) const;
};
struct Private;
};
}
#include "Sphere_Visual.ipp"