Engine → Renderer → mesh_asset.h
mesh_asset
| Type | Class |
| Namespace | conjure::renderer |
| Include File Path | engine/include/conjure/renderer/mesh_asset.h |
| Source File Path | engine/src/renderer/assets/mesh_asset.cpp |
| API ↗ | Rendering, Renderer assets |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | mesh_asset(); | |
| public | mesh_asset(
const mesh_asset &) = default; | |
| public | mesh_asset(
mesh_asset &&) noexcept = default; |
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~mesh_asset(); |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mBounds | math::aabb | {} | |
| private | mName | std::string | {} | |
| private | mStreams | mesh_streams | {} | |
| private | mSubmeshes | std::vector<submesh> | {} |
Functions
Public
bounds
bounds[[nodiscard]] const math::aabb &bounds() const noexcept;cpu_geometry
cpu_geometry[[nodiscard]] cpu_geometry_view cpu_geometry() const noexcept;Positions and indices for the editor's CPU picking.
from_geometry
from_geometry[[nodiscard]] static core::result<mesh_asset> from_geometry(
const mesh_geometry &geometry,
std::string name = {},
tangent_generation missingTangents = tangent_generation::FROM_UVS);Packs geometry into streams. Fails with INVALID_ARGUMENT for no positions, an attribute array whose size differs from the position count, an index count that is not a multiple of three, an index out of range, a non-finite position, or submesh counts that do not partition the index list. Missing attributes are generated as described above; missingTangents chooses how and is not read when the geometry has tangents.
gpu_byte_size
gpu_byte_size[[nodiscard]] u64 gpu_byte_size() const noexcept;Bytes of stream 0, stream 1 and the index buffer together.
index_count
index_count[[nodiscard]] u32 index_count() const noexcept;name
name[[nodiscard]] std::string_view name() const noexcept;parse_blob
parse_blob[[nodiscard]] static core::result<mesh_asset> parse_blob(
std::span<const std::byte> bytes);Parses a .cmesh blob. Fails with renderer_error::INVALID_ASSET naming the problem.
quad
quad[[nodiscard]] static mesh_asset quad(
f32 halfSize = 0.5f);A quad in the XY plane facing +Z with the given half size.
streams
streams[[nodiscard]] const mesh_streams &streams() const noexcept;submeshes
submeshes[[nodiscard]] std::span<const submesh> submeshes() const noexcept;triangle_count
triangle_count[[nodiscard]] u32 triangle_count() const noexcept;unit_cube
unit_cube[[nodiscard]] static mesh_asset unit_cube();A unit cube centred on the origin with flat normals: the fallback mesh.
uv_sphere
uv_sphere[[nodiscard]] static mesh_asset uv_sphere(
f32 radius,
u32 rings = 16,
u32 segments = 32);A UV sphere of the given radius.
vertex_count
vertex_count[[nodiscard]] u32 vertex_count() const noexcept;write_blob
write_blob[[nodiscard]] std::vector<std::byte> write_blob() const;Serialises the mesh as a .cmesh blob (little-endian, deterministic).
Operator Overloads
Public
operator=
operator=mesh_asset &operator=(
const mesh_asset &) = default;mesh_asset &operator=(
mesh_asset &&) noexcept = default;operator==
operator==[[nodiscard]] bool operator==(
const mesh_asset &other) const noexcept;