53 lines
1.7 KiB
C++
53 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include "Basic_Visual.hpp"
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace aethera::render_3d {
|
|
struct Text_Label {
|
|
Vec3 position{};
|
|
std::string text{};
|
|
Color color{Color::white()};
|
|
Pixel_Distance size_px{18.0F};
|
|
bool operator==(const Text_Label&) const = default;
|
|
};
|
|
struct Text_Frame_Tag {};
|
|
struct Text_Frame {
|
|
std::vector<Text_Label> items{}; /* 本次提交的完整 Text 集合。 */
|
|
bool operator==(const Text_Frame&) const;
|
|
};
|
|
namespace detail {
|
|
struct Text_Prepared_Data {
|
|
std::vector<Prepared_Position> positions{};
|
|
std::vector<Prepared_Color> colors{};
|
|
std::vector<float> sizes{};
|
|
std::vector<std::string> strings{};
|
|
};
|
|
struct Text_Spec {
|
|
using Item = Text_Label;
|
|
using Prepared_Data = Text_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 Text_Visual : Def<Text_Visual, Basic_Visual,
|
|
Tagged_Buffer<Text_Frame_Tag, Text_Frame>> {
|
|
using Visual_Base = Text_Visual;
|
|
using Frame_Tag = Text_Frame_Tag;
|
|
using Frame = Text_Frame;
|
|
using Specification = detail::Text_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 "Text_Visual.ipp"
|