10 #include <fmt/format.h>
15 #include <type_traits>
19 namespace visualization {
50 static const std::uint16_t
kBadId = 0;
53 inline size_t Hash()
const {
54 return static_cast<std::uint16_t
>(
type) << 16 |
id;
69 explicit operator bool()
const {
return id !=
kBadId; }
73 std::uint16_t
GetId()
const {
return id; }
89 template <EntityType entityType>
94 const auto index =
static_cast<std::uint16_t
>(entityType);
105 if (
abstract.
type != entityType) {
124 template <EntityType entityType>
148 class hash<
cloudViewer::visualization::rendering::REHandle_abstract> {
159 template <
typename T>
162 std::enable_if_t<std::is_base_of<cloudViewer::visualization::rendering::
166 template <
typename FormatContext>
169 FormatContext& ctx)
const -> decltype(ctx.out()) {
170 return format_to(ctx.out(),
"[{}, {}, hash: {}]",
172 REHandle_abstract::TypeToString(uid.type),
173 uid.GetId(), uid.Hash());
176 template <
typename ParseContext>
177 constexpr
auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
filament::Texture::InternalFormat format
REHandle< EntityType::Camera > CameraHandle
REHandle< EntityType::Scene > SceneHandle
REHandle< EntityType::Geometry > GeometryHandle
REHandle< EntityType::Texture > TextureHandle
REHandle< EntityType::Material > MaterialHandle
REHandle< EntityType::VertexBuffer > VertexBufferHandle
REHandle< EntityType::RenderTarget > RenderTargetHandle
REHandle< EntityType::IndirectLight > IndirectLightHandle
REHandle< EntityType::Light > LightHandle
REHandle< EntityType::Skybox > SkyboxHandle
REHandle< EntityType::IndexBuffer > IndexBufferHandle
REHandle< EntityType::View > ViewHandle
std::ostream & operator<<(std::ostream &os, const REHandle_abstract &uid)
REHandle< EntityType::MaterialInstance > MaterialInstanceHandle
Generic file read and write utility for python interface.
bool operator<(const REHandle_abstract &other) const
static const char * TypeToString(EntityType type)
REHandle_abstract(const EntityType aType, const std::uint16_t aId)
static const std::uint16_t kBadId
std::uint16_t GetId() const
bool operator!=(const REHandle_abstract &other) const
bool operator==(const REHandle_abstract &other) const
static std::array< std::uint16_t, static_cast< size_t >EntityType::Count)> uid_table
REHandle & operator=(const REHandle &other)
REHandle(std::uint16_t id)
static const REHandle kBad
static REHandle Concretize(const REHandle_abstract &abstract)
REHandle(const REHandle &other)