Mesh Handle

template<IsSpectral TSpectral>
class MeshHandle : public huira::Handle<Mesh<TSpectral>>

Handle for referencing a Mesh asset in the scene.

MeshHandle provides safe, type-checked access to Mesh assets, allowing manipulation and querying of mesh data within the scene. Used by Scene, FrameHandle, and ModelLoader for mesh management.

Template Parameters:

TSpectral – Spectral type for the scene

Public Functions

MeshHandle() = delete
inline std::size_t get_vertex_count() const
inline std::shared_ptr<Mesh<TSpectral>> get_shared() const
bool valid() const

Checks if the handle points to a valid, scene-owned object.

Returns:

true if valid, false otherwise

std::shared_ptr<U> get() const

Gets a shared_ptr to the referenced object, optionally downcasting to a derived type.

Template Parameters:

U – Type to cast to (default: T)

Throws:

std::runtime_error

Returns:

std::shared_ptr

Protected Functions

std::shared_ptr<T> get_() const

Gets a shared_ptr to the referenced object, enforcing validity.

Throws:

std::runtime_error – if the handle is invalid

Returns:

std::shared_ptr<T> Shared pointer to the object

Protected Attributes

std::weak_ptr<T> ptr_

Friends

friend class Scene< TSpectral >
friend class FrameHandle< TSpectral >
friend class ModelLoader< TSpectral >