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<
open3d::visualization::rendering::REHandle_abstract> {
158 template <
typename T>
161 std::enable_if_t<std::is_base_of<open3d::visualization::rendering::
165 template <
typename FormatContext>
167 FormatContext& ctx)
const -> decltype(ctx.out()) {
168 return format_to(ctx.out(),
"[{}, {}, hash: {}]",
170 TypeToString(uid.type),
171 uid.
GetId(), uid.Hash());
174 template <
typename ParseContext>
175 constexpr
auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
filament::Texture::InternalFormat format
Definition: FilamentResourceManager.cpp:195
REHandle< EntityType::IndexBuffer > IndexBufferHandle
Definition: RendererHandle.h:139
std::ostream & operator<<(std::ostream &os, const REHandle_abstract &uid)
Definition: RendererHandle.cpp:19
REHandle< EntityType::Material > MaterialHandle
Definition: RendererHandle.h:134
REHandle< EntityType::VertexBuffer > VertexBufferHandle
Definition: RendererHandle.h:138
REHandle< EntityType::Scene > SceneHandle
Definition: RendererHandle.h:128
EntityType
Definition: RendererHandle.h:23
REHandle< EntityType::MaterialInstance > MaterialInstanceHandle
Definition: RendererHandle.h:135
REHandle< EntityType::Geometry > GeometryHandle
Definition: RendererHandle.h:129
REHandle< EntityType::Camera > CameraHandle
Definition: RendererHandle.h:133
REHandle< EntityType::RenderTarget > RenderTargetHandle
Definition: RendererHandle.h:137
REHandle< EntityType::Light > LightHandle
Definition: RendererHandle.h:130
REHandle< EntityType::Texture > TextureHandle
Definition: RendererHandle.h:136
REHandle< EntityType::Skybox > SkyboxHandle
Definition: RendererHandle.h:132
REHandle< EntityType::View > ViewHandle
Definition: RendererHandle.h:127
REHandle< EntityType::IndirectLight > IndirectLightHandle
Definition: RendererHandle.h:131
Definition: PinholeCameraIntrinsic.cpp:16
Definition: RendererHandle.h:47
bool operator!=(const REHandle_abstract &other) const
Definition: RendererHandle.h:61
std::uint16_t GetId() const
Definition: RendererHandle.h:73
bool operator<(const REHandle_abstract &other) const
Definition: RendererHandle.h:65
const EntityType type
Definition: RendererHandle.h:51
std::uint16_t id
Definition: RendererHandle.h:82
size_t Hash() const
Definition: RendererHandle.h:53
bool operator==(const REHandle_abstract &other) const
Definition: RendererHandle.h:57
REHandle_abstract(const EntityType aType, const std::uint16_t aId)
Definition: RendererHandle.h:76
REHandle_abstract()
Definition: RendererHandle.h:71
static const char * TypeToString(EntityType type)
Definition: RendererHandle.cpp:25
static std::array< std::uint16_t, static_cast< size_t >EntityType::Count)> uid_table
Definition: RendererHandle.h:80
static const std::uint16_t kBadId
Definition: RendererHandle.h:50
Definition: RendererHandle.h:90
REHandle(std::uint16_t id)
Definition: RendererHandle.h:116
static REHandle Next()
Definition: RendererHandle.h:93
REHandle(const REHandle &other)
Definition: RendererHandle.h:114
static REHandle Concretize(const REHandle_abstract &abstract)
Definition: RendererHandle.h:104
REHandle()
Definition: RendererHandle.h:113
REHandle & operator=(const REHandle &other)
Definition: RendererHandle.h:118
static const REHandle kBad
Definition: RendererHandle.h:91