Engine → Assets → asset_ref.h
asset_ref
| Type | Class |
| Namespace | conjure::assets |
| Include File Path | engine/include/conjure/assets/asset_ref.h |
| Source File Path | engine/src/assets/asset_ref.cpp |
| API ↗ | Assets, Referencing and loading assets |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | constexpr asset_ref() noexcept = default; | |
| public | constexpr explicit asset_ref(
const asset_id &id) noexcept; | An unbound reference: carries the uuid, reads nullptr until bound by the manager. |
| public | constexpr asset_ref(
const asset_id &id,
const asset_slot *slot) noexcept; | A bound reference. The slot must belong to id. |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mId | asset_id | {} | |
| private | mSlot | const asset_slot * | nullptr |
Functions
Public
get
get[[nodiscard]] AssetType *get() const noexcept;Hot path: one atomic load, no hashing, no locking. Returns nullptr unless LOADED. The pointer is valid until the end of the next frame.
id
id[[nodiscard]] constexpr const asset_id &id() const noexcept;is_bound
is_bound[[nodiscard]] constexpr bool is_bound() const noexcept;version
version[[nodiscard]] u32 version() const noexcept;Publish counter of the slot; 0 when unbound. Changes on every publish and unload.
Operator Overloads
Public
operator==
operator==[[nodiscard]] constexpr bool operator==(
const asset_ref &other) const noexcept;Equality is by uuid: two references to the same asset compare equal whether or not they are bound.