Engine → Renderer → model_asset.h
model_asset
| Type | Class |
| Namespace | conjure::renderer |
| Include File Path | engine/include/conjure/renderer/model_asset.h |
| Source File Path | engine/src/renderer/assets/model_asset.cpp |
| API ↗ | Rendering, Renderer assets |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | model_asset(); | |
| public | model_asset(
const model_asset &) = default; | |
| public | model_asset(
model_asset &&) noexcept = default; |
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~model_asset(); |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mMaterials | std:: | {} | |
| private | mMeshes | std:: | {} | |
| private | mName | std::string | {} | |
| private | mNodes | std::vector<model_node> | {} |
Functions
Public
add_material
add_materialu32 add_material(
const assets::asset_id &id);Appends a material id and returns its index.
add_node
add_nodeu32 add_node(
model_node node);Appends a node; the parent must already exist (or be INVALID_INDEX). Returns the index, or INVALID_INDEX (asserting) for a bad parent.
children_of
children_ofIndices of the direct children of a node, in order.
materials
materials[[nodiscard]] std::span<const assets::asset_id> materials() const noexcept;meshes
meshes[[nodiscard]] std::span<const assets::asset_id> meshes() const noexcept;name
name[[nodiscard]] std::string_view name() const noexcept;nodes
nodes[[nodiscard]] std::span<const model_node> nodes() const noexcept;parse_blob
parse_blob[[nodiscard]] static core::result<model_asset> parse_blob(
std::span<const std::byte> bytes);parse_json
parse_json[[nodiscard]] static core::result<model_asset> parse_json(
std::string_view text);Parses the JSON form. Fails with PARSE_FAILURE for invalid JSON and INVALID_ARGUMENT for a wrong member type, a parent index that is not smaller than the node's own index (the list is parent-first), or a mesh / material index out of range.
root_nodes
root_nodes[[nodiscard]] std::vector<u32> root_nodes() const;Indices of the nodes without a parent, in order.
set_name
set_namevoid set_name(
std::string name);to_json
to_json[[nodiscard]] std::string to_json() const;The canonical JSON form.
world_transform
world_transform[[nodiscard]] math::transform world_transform(
u32 node) const noexcept;The world transform of a node: the product of its ancestors' local transforms.
write_blob
write_blob[[nodiscard]] std::vector<std::byte> write_blob() const;Operator Overloads
Public
operator=
operator=model_asset &operator=(
const model_asset &) = default;model_asset &operator=(
model_asset &&) noexcept = default;operator==
operator==[[nodiscard]] bool operator==(
const model_asset &other) const noexcept;