|
Unravel Engine C++ Reference
|
Main class representing a 3D mesh with support for different LODs, submeshes, and skinning. More...
#include <mesh.h>
Classes | |
| struct | adjacent_edge_key |
| struct | armature_node |
| struct | bone_combination_key |
| struct | face_influences |
| struct | info |
| struct | load_data |
| Struct used for mesh construction. More... | |
| struct | lod_level |
| Structure describing a LOD level with its own index buffer and submeshes. More... | |
| struct | lod_load_data |
| Structure describing a LOD level in load_data (for serialization). More... | |
| struct | mesh_submesh_key |
| struct | optimizer_triangle_info |
| struct | optimizer_vertex_info |
| struct | preparation_data |
| struct | submesh |
| Structure describing an individual "piece" of the mesh, often grouped by material, but can be any arbitrary collection of triangles. More... | |
| struct | triangle |
| Structure describing data for a single triangle in the mesh. More... | |
| struct | weld_key |
Public Types | |
| using | triangle_array_t = std::vector<triangle> |
| using | submesh_array_t = std::vector<submesh*> |
| using | bone_palette_array_t = std::vector<bone_palette> |
| using | submesh_array_indices_t = std::vector<size_t> |
| using | submesh_array_map_t = std::map<uint32_t, submesh_array_indices_t> |
| using | data_group_submesh_map_t = std::map<uint32_t, submesh_array_t> |
| using | byte_array_t = std::vector<uint8_t> |
Public Member Functions | |
| mesh () | |
| Constructs a mesh object. | |
| ~mesh () | |
| Destructor. | |
| void | dispose () |
| Clears out all the mesh data. | |
| auto | get_info () const -> info |
| void | bind_render_buffers_for_submesh (const submesh *submesh, uint32_t lod_index=0) |
| Binds the mesh data for rendering the selected batch of primitives. | |
| auto | prepare_mesh (const gfx::vertex_layout &vertex_format) -> bool |
| Prepares the mesh with the specified vertex format. | |
| auto | set_vertex_source (void *source, uint32_t vertex_count, const gfx::vertex_layout &source_format) -> bool |
| Sets the source of the vertex buffer to pull data from while preparing the mesh. | |
| auto | set_vertex_source (byte_array_t &&source, uint32_t vertex_count, const gfx::vertex_layout &source_format) -> bool |
| auto | set_bounding_box (const math::bbox &box) -> bool |
| auto | set_submeshes (const std::vector< submesh > &submeshes) -> bool |
| auto | set_primitives (triangle_array_t &&triangles) -> bool |
| Adds primitives (triangles) to the mesh. | |
| auto | bind_skin (const skin_bind_data &bind_data) -> bool |
| Binds the mesh as a skin with the specified skin binding data. | |
| auto | bind_armature (std::unique_ptr< armature_node > &root) -> bool |
| Binds the armature tree. | |
| auto | load_mesh (load_data &&data) -> bool |
| auto | create_plane (const gfx::vertex_layout &format, float width, float height, uint32_t width_segments, uint32_t height_segments, mesh_create_origin origin, bool hardware_copy=true) -> bool |
| Creates a plane geometry. | |
| auto | create_heightfield (const gfx::vertex_layout &format, hpp::span< const float > heights, uint32_t segments_x, uint32_t segments_z, float half_extent_x, float half_extent_z, float height_scale, mesh_create_origin origin, bool hardware_copy=true) -> bool |
| Creates a heightfield on the XZ plane (Y up): vertex grid (segments_x+1)*(segments_z+1). | |
| auto | create_cube (const gfx::vertex_layout &format, float width, float height, float depth, uint32_t width_segments, uint32_t height_segments, uint32_t depth_segments, mesh_create_origin origin, bool hardware_copy=true) -> bool |
| Creates a cube geometry. | |
| auto | create_rounded_cube (const gfx::vertex_layout &format, float width, float height, float depth, uint32_t width_segments, uint32_t height_segments, uint32_t depth_segments, mesh_create_origin origin, bool hardware_copy=true) -> bool |
| auto | create_sphere (const gfx::vertex_layout &format, float radius, uint32_t stacks, uint32_t slices, mesh_create_origin origin, bool hardware_copy=true) -> bool |
| Creates a sphere geometry. | |
| auto | create_cylinder (const gfx::vertex_layout &format, float radius, float height, uint32_t stacks, uint32_t slices, mesh_create_origin origin, bool hardware_copy=true) -> bool |
| Creates a cylinder geometry. | |
| auto | create_capsule (const gfx::vertex_layout &format, float radius, float height, uint32_t stacks, uint32_t slices, mesh_create_origin origin, bool hardware_copy=true) -> bool |
| Creates a capsule geometry. | |
| auto | create_cone (const gfx::vertex_layout &format, float radius, float radius_tip, float height, uint32_t stacks, uint32_t slices, mesh_create_origin origin, bool hardware_copy=true) -> bool |
| Creates a cone geometry. | |
| auto | create_torus (const gfx::vertex_layout &format, float outer_radius, float inner_radius, uint32_t bands, uint32_t sides, mesh_create_origin origin, bool hardware_copy=true) -> bool |
| Creates a torus geometry. | |
| auto | create_teapot (const gfx::vertex_layout &format, bool hardware_copy=true) -> bool |
| Creates a teapot geometry. | |
| auto | create_icosahedron (const gfx::vertex_layout &format, bool hardware_copy=true) -> bool |
| Creates an icosahedron geometry. | |
| auto | create_dodecahedron (const gfx::vertex_layout &format, bool hardware_copy=true) -> bool |
| Creates a dodecahedron geometry. | |
| auto | create_icosphere (const gfx::vertex_layout &format, int tesselation_level, bool hardware_copy=true) -> bool |
| Creates an icosphere geometry. | |
| auto | end_prepare (bool hardware_copy=true, bool build_buffers=true, bool weld=false, bool optimize=false) -> bool |
| Ends the preparation of the mesh and builds the render data. | |
| void | build_vb (bool hardware_copy=true) |
| Builds the internal vertex buffer. | |
| void | build_ib (bool hardware_copy=true) |
| Builds the internal index buffer. | |
| auto | generate_adjacency (std::vector< uint32_t > &adjacency) -> bool |
| Generates edge-triangle adjacency information for the mesh data. | |
| auto | get_face_count () const -> uint32_t |
| Determines the number of faces stored in the mesh. | |
| auto | get_vertex_count () const -> uint32_t |
| Determines the number of vertices stored in the mesh. | |
| auto | get_system_vb () -> uint8_t * |
| Retrieves the underlying vertex data from the mesh. | |
| auto | get_system_ib () -> uint32_t * |
| Retrieves the underlying index data from the mesh. | |
| auto | get_vertex_format () const -> const gfx::vertex_layout & |
| Retrieves the format of the underlying mesh vertex data. | |
| auto | get_hardware_vb () const -> std::shared_ptr< gfx::vertex_buffer > |
| Retrieves the hardware vertex buffer for the mesh (shared across all LODs). | |
| auto | get_hardware_ib (uint32_t lod_index=0) const -> std::shared_ptr< gfx::index_buffer > |
| Retrieves the hardware index buffer for a given LOD. | |
| auto | get_skin_bind_data () const -> const skin_bind_data & |
| Retrieves the skin bind data if this mesh has been bound as a skin. | |
| auto | get_bone_palettes () const -> const bone_palette_array_t & |
| Retrieves the compiled bone combination palette data if this mesh has been bound as a skin. | |
| auto | get_armature () const -> const std::unique_ptr< armature_node > & |
| Retrieves the armature tree of the mesh. | |
| auto | get_submesh_node_transforms (uint32_t lod_index=0) const -> std::vector< math::transform > |
| Computes the accumulated node transform for each submesh. | |
| auto | calculate_screen_rect (const math::transform &world, const camera &cam) const -> irect32_t |
| Calculates the screen rectangle of the mesh based on its world transform and the camera. This version uses a conservative approach - if any corners are behind the camera, it returns the full viewport as the screen rect. Fast but may overestimate coverage. | |
| auto | calculate_screen_rect_precise (const math::transform &world, const camera &cam) const -> irect32_t |
| Calculates the screen rectangle of the mesh with precise near-plane clipping. This version properly clips edges that cross the near plane for accurate screen coverage. More accurate but slightly more expensive than calculate_screen_rect. | |
| auto | get_submeshes (uint32_t lod_index=0) const -> const submesh_array_t & |
| Retrieves information about the submesh of the mesh associated with the specified data group identifier. | |
| auto | get_submesh (uint32_t submesh_index=0, uint32_t lod_index=0) const -> const submesh * |
| auto | get_bounds () const -> const math::bbox & |
| Gets the local bounding box for this mesh. | |
| auto | get_status () const -> mesh_status |
| Gets the preparation status for this mesh. | |
| auto | get_data_groups_count () const -> size_t |
| Gets the number of data groups(materials) for this mesh. | |
| auto | get_default_material_uids () const -> const std::vector< hpp::uuid > & |
| Gets the default material UIDs generated during import. | |
| auto | get_imported_materials () const -> std::vector< asset_handle< material > > |
| Gets the imported materials generated during import. | |
| auto | get_submeshes_count (uint32_t lod_index=0) const -> size_t |
| Gets the number of submeshes for this mesh. | |
| auto | find_submesh_index_by_stable_id (uint32_t stable_id, uint32_t lod_index=0) const -> int |
| Finds the submesh array index matching an import-stable submesh identifier. | |
| auto | get_skinned_submeshes_count (uint32_t lod_index=0) const -> size_t |
| Gets the number of skinned submeshes for this mesh. | |
| auto | get_skinned_submeshes_indices (uint32_t data_group_id, uint32_t lod_index=0) const -> const submesh_array_indices_t & |
| Gets the indices of skinned submeshes for a specific data group. | |
| auto | get_non_skinned_submeshes_count (uint32_t lod_index=0) const -> size_t |
| Gets the number of non-skinned submeshes for this mesh. | |
| auto | get_non_skinned_submeshes_indices (uint32_t data_group_id, uint32_t lod_index=0) const -> const submesh_array_indices_t & |
| Gets the indices of non-skinned submeshes for a specific data group. | |
| auto | get_submesh_index (const submesh *s, uint32_t lod_index=0) const -> int |
| Gets the index of a submesh within the submesh array. | |
| auto | get_lod_count () const -> uint32_t |
| Gets the number of LOD levels available. | |
| auto | get_lod_submeshes (uint32_t lod_index) const -> const submesh_array_t * |
| Gets submeshes for a specific LOD level. | |
| auto | get_lod_face_count (uint32_t lod_index) const -> uint32_t |
| Gets the face count for a specific LOD level. | |
| auto | get_lod_index_data (uint32_t lod_index, std::vector< uint32_t > &out_indices, float &out_error) const -> bool |
| Gets index buffer data for a specific LOD level (for serialization). | |
| auto | restore_lods_from_load_data (const load_data &data) -> bool |
| Restores LOD levels from load_data into the mesh. | |
Static Public Member Functions | |
| static auto | get_max_lod_count () -> uint32_t |
| Gets the maximum number of LODs that can be used for this mesh including base LOD. | |
| static auto | get_max_generated_lod_count () -> uint32_t |
| Gets the maximum number of LODs that can be generated for a mesh. | |
| static auto | generate_default_lod_configs (const load_data &data, float target_error=0.01f) -> std::vector< std::pair< size_t, float > > |
| Generates default LOD configurations based on mesh triangle count. | |
| static auto | apply_skin_to_load_data (load_data &data) -> bool |
| Applies skinning vertex duplication to load_data (for offline LOD generation). | |
| static auto | generate_lods_for_load_data (load_data &data, const std::vector< std::pair< size_t, float > > &lod_configs) -> bool |
| Generates LOD levels directly in load_data without creating GPU buffers. | |
Protected Types | |
| using | submesh_key_map_t = std::map<mesh_submesh_key, submesh*> |
| using | submesh_key_array_t = std::vector<mesh_submesh_key> |
| using | bone_combination_map_t = std::map<bone_combination_key, std::vector<uint32_t>*> |
Protected Member Functions | |
| void | check_for_degenerates () |
| auto | generate_vertex_components (bool weld) -> bool |
| Generates any vertex components that may be missing, such as normals, tangents, or binormals. | |
| auto | generate_vertex_normals (uint32_t *adjacency_ptr, std::vector< uint32_t > *remap_array_ptr=nullptr) -> bool |
| Generates vertex normals for the mesh. | |
| auto | generate_vertex_barycentrics (uint32_t *adjacency) -> bool |
| Generates vertex barycentric coordinates for the mesh. | |
| auto | generate_vertex_tangents () -> bool |
| Generates vertex tangents for the mesh. | |
| auto | weld_vertices (float tolerance=0.000001f, std::vector< uint32_t > *vertex_remap_ptr=nullptr) -> bool |
| Welds the vertices together that can be combined. | |
| auto | sort_mesh_data () -> bool |
| Sorts the data in the mesh into material and data group order. | |
Protected Attributes | |
| bool | force_tangent_generation_ = false |
| < Whether to force the generation of tangent space vectors. | |
| bool | force_normal_generation_ = false |
| Whether to force the generation of vertex barycentric coordinates. | |
| bool | force_barycentric_generation_ = false |
| Whether to disable the automatic re-sort operation. | |
| bool | disable_final_sort_ = false |
| The vertex data during data insertion and system memory copy. | |
| uint8_t * | system_vb_ = nullptr |
| The vertex format used for the mesh internal vertex data. | |
| gfx::vertex_layout | vertex_format_ |
| The final system memory copy of the index buffer (LOD 0 - base mesh). | |
| uint32_t * | system_ib_ = nullptr |
| Material and data group information for each triangle. | |
| submesh_key_array_t | triangle_data_ |
| The actual hardware vertex buffer resource (shared by all LODs). | |
| std::shared_ptr< void > | hardware_vb_ |
| The actual hardware index buffer resource (LOD 0 - base mesh). | |
| std::shared_ptr< void > | hardware_ib_ |
| Additional LOD levels (LOD 1, 2, 3, ...) with simplified index buffers. | |
| std::vector< lod_level > | lods_ |
| Current LOD count (including base LOD 0). | |
| uint32_t | lod_count_ = 1 |
| The actual list of submeshes maintained by this mesh. | |
| submesh_array_t | mesh_submeshes_ |
| Indices in the subset array which are skinned. | |
| submesh_array_map_t | skinned_submesh_indices_ |
| size_t | skinned_submesh_count_ {} |
| Indices in the subset array which are not skinned. | |
| submesh_array_map_t | non_skinned_submesh_indices_ |
| size_t | non_skinned_submesh_count_ {} |
| Lookup information mapping data groups to submeshes batched by material. | |
| data_group_submesh_map_t | data_groups_ |
| Whether the mesh uses a hardware vertex/index buffer. | |
| bool | hardware_mesh_ = true |
| Whether the mesh was optimized when it was prepared. | |
| bool | optimize_mesh_ = false |
| Axis aligned bounding box describing object dimensions in object space. | |
| math::bbox | bbox_ |
| Total number of faces in the prepared mesh. | |
| uint32_t | face_count_ = 0 |
| Total number of vertices in the prepared mesh. | |
| uint32_t | vertex_count_ = 0 |
| Preparation status of the mesh. | |
| mesh_status | prepare_status_ = mesh_status::not_prepared |
| Input data used for constructing the final mesh. | |
| preparation_data | preparation_data_ |
| Data describing how the mesh should be bound as a skin with supplied bone matrices. | |
| skin_bind_data | skin_bind_data_ |
| List of unique combinations of bones to use during rendering. | |
| bone_palette_array_t | bone_palettes_ |
| List of armature nodes. | |
| std::unique_ptr< armature_node > | root_ = nullptr |
| UIDs of default materials generated during import, indexed by data_group_id. | |
| std::vector< hpp::uuid > | default_material_uids_ |
Friends | |
| auto | operator< (const adjacent_edge_key &key1, const adjacent_edge_key &key2) -> bool |
| auto | operator< (const mesh_submesh_key &key1, const mesh_submesh_key &key2) -> bool |
| auto | operator< (const weld_key &key1, const weld_key &key2) -> bool |
| auto | operator< (const bone_combination_key &key1, const bone_combination_key &key2) -> bool |
Main class representing a 3D mesh with support for different LODs, submeshes, and skinning.
|
protected |
| using unravel::mesh::bone_palette_array_t = std::vector<bone_palette> |
| using unravel::mesh::byte_array_t = std::vector<uint8_t> |
| using unravel::mesh::data_group_submesh_map_t = std::map<uint32_t, submesh_array_t> |
| using unravel::mesh::submesh_array_indices_t = std::vector<size_t> |
| using unravel::mesh::submesh_array_map_t = std::map<uint32_t, submesh_array_indices_t> |
| using unravel::mesh::submesh_array_t = std::vector<submesh*> |
|
protected |
|
protected |
| using unravel::mesh::triangle_array_t = std::vector<triangle> |
|
static |
| auto unravel::mesh::bind_armature | ( | std::unique_ptr< armature_node > & | root | ) | -> bool |
| void unravel::mesh::bind_render_buffers_for_submesh | ( | const submesh * | submesh, |
| uint32_t | lod_index = 0 ) |
| auto unravel::mesh::bind_skin | ( | const skin_bind_data & | bind_data | ) | -> bool |
| void unravel::mesh::build_ib | ( | bool | hardware_copy = true | ) |
| void unravel::mesh::build_vb | ( | bool | hardware_copy = true | ) |
| auto unravel::mesh::calculate_screen_rect | ( | const math::transform & | world, |
| const camera & | cam ) const -> irect32_t |
Calculates the screen rectangle of the mesh based on its world transform and the camera. This version uses a conservative approach - if any corners are behind the camera, it returns the full viewport as the screen rect. Fast but may overestimate coverage.
| world | The world transform of the mesh. |
| cam | The camera. |
| auto unravel::mesh::calculate_screen_rect_precise | ( | const math::transform & | world, |
| const camera & | cam ) const -> irect32_t |
Calculates the screen rectangle of the mesh with precise near-plane clipping. This version properly clips edges that cross the near plane for accurate screen coverage. More accurate but slightly more expensive than calculate_screen_rect.
| world | The world transform of the mesh. |
| cam | The camera. |
| auto unravel::mesh::create_capsule | ( | const gfx::vertex_layout & | format, |
| float | radius, | ||
| float | height, | ||
| uint32_t | stacks, | ||
| uint32_t | slices, | ||
| mesh_create_origin | origin, | ||
| bool | hardware_copy = true ) -> bool |
Creates a capsule geometry.
| format | The vertex format. |
| radius | The radius of the capsule. |
| height | The height of the capsule. |
| stacks | The number of stacks. |
| slices | The number of slices. |
| origin | The origin of the capsule. |
| hardware_copy | Whether to use hardware copy. |
| auto unravel::mesh::create_cone | ( | const gfx::vertex_layout & | format, |
| float | radius, | ||
| float | radius_tip, | ||
| float | height, | ||
| uint32_t | stacks, | ||
| uint32_t | slices, | ||
| mesh_create_origin | origin, | ||
| bool | hardware_copy = true ) -> bool |
Creates a cone geometry.
| format | The vertex format. |
| radius | The base radius of the cone. |
| radius_tip | The tip radius of the cone. |
| height | The height of the cone. |
| stacks | The number of stacks. |
| slices | The number of slices. |
| origin | The origin of the cone. |
| hardware_copy | Whether to use hardware copy. |
| auto unravel::mesh::create_cube | ( | const gfx::vertex_layout & | format, |
| float | width, | ||
| float | height, | ||
| float | depth, | ||
| uint32_t | width_segments, | ||
| uint32_t | height_segments, | ||
| uint32_t | depth_segments, | ||
| mesh_create_origin | origin, | ||
| bool | hardware_copy = true ) -> bool |
Creates a cube geometry.
| format | The vertex format. |
| width | The width of the cube. |
| height | The height of the cube. |
| depth | The depth of the cube. |
| width_segments | The number of segments along the width. |
| height_segments | The number of segments along the height. |
| depth_segments | The number of segments along the depth. |
| origin | The origin of the cube. |
| hardware_copy | Whether to use hardware copy. |
| auto unravel::mesh::create_cylinder | ( | const gfx::vertex_layout & | format, |
| float | radius, | ||
| float | height, | ||
| uint32_t | stacks, | ||
| uint32_t | slices, | ||
| mesh_create_origin | origin, | ||
| bool | hardware_copy = true ) -> bool |
Creates a cylinder geometry.
| format | The vertex format. |
| radius | The radius of the cylinder. |
| height | The height of the cylinder. |
| stacks | The number of stacks. |
| slices | The number of slices. |
| origin | The origin of the cylinder. |
| hardware_copy | Whether to use hardware copy. |
| auto unravel::mesh::create_dodecahedron | ( | const gfx::vertex_layout & | format, |
| bool | hardware_copy = true ) -> bool |
| auto unravel::mesh::create_heightfield | ( | const gfx::vertex_layout & | format, |
| hpp::span< const float > | heights, | ||
| uint32_t | segments_x, | ||
| uint32_t | segments_z, | ||
| float | half_extent_x, | ||
| float | half_extent_z, | ||
| float | height_scale, | ||
| mesh_create_origin | origin, | ||
| bool | hardware_copy = true ) -> bool |
Creates a heightfield on the XZ plane (Y up): vertex grid (segments_x+1)*(segments_z+1).
| heights | Row-major samples indexed by z * (segments_x+1) + x, values in arbitrary units scaled by height_scale. |
| half_extent_x | Half world size along X; vertices span [-half_extent_x, half_extent_x]. |
| half_extent_z | Half world size along Z. |
| height_scale | Multiplier applied to each height sample before placing along Y. |
| auto unravel::mesh::create_icosahedron | ( | const gfx::vertex_layout & | format, |
| bool | hardware_copy = true ) -> bool |
| auto unravel::mesh::create_icosphere | ( | const gfx::vertex_layout & | format, |
| int | tesselation_level, | ||
| bool | hardware_copy = true ) -> bool |
| auto unravel::mesh::create_plane | ( | const gfx::vertex_layout & | format, |
| float | width, | ||
| float | height, | ||
| uint32_t | width_segments, | ||
| uint32_t | height_segments, | ||
| mesh_create_origin | origin, | ||
| bool | hardware_copy = true ) -> bool |
Creates a plane geometry.
| format | The vertex format. |
| width | The width of the plane. |
| height | The height of the plane. |
| width_segments | The number of segments along the width. |
| height_segments | The number of segments along the height. |
| origin | The origin of the plane. |
| hardware_copy | Whether to use hardware copy. |
| auto unravel::mesh::create_rounded_cube | ( | const gfx::vertex_layout & | format, |
| float | width, | ||
| float | height, | ||
| float | depth, | ||
| uint32_t | width_segments, | ||
| uint32_t | height_segments, | ||
| uint32_t | depth_segments, | ||
| mesh_create_origin | origin, | ||
| bool | hardware_copy = true ) -> bool |
| auto unravel::mesh::create_sphere | ( | const gfx::vertex_layout & | format, |
| float | radius, | ||
| uint32_t | stacks, | ||
| uint32_t | slices, | ||
| mesh_create_origin | origin, | ||
| bool | hardware_copy = true ) -> bool |
Creates a sphere geometry.
| format | The vertex format. |
| radius | The radius of the sphere. |
| stacks | The number of stacks. |
| slices | The number of slices. |
| origin | The origin of the sphere. |
| hardware_copy | Whether to use hardware copy. |
| auto unravel::mesh::create_teapot | ( | const gfx::vertex_layout & | format, |
| bool | hardware_copy = true ) -> bool |
| auto unravel::mesh::create_torus | ( | const gfx::vertex_layout & | format, |
| float | outer_radius, | ||
| float | inner_radius, | ||
| uint32_t | bands, | ||
| uint32_t | sides, | ||
| mesh_create_origin | origin, | ||
| bool | hardware_copy = true ) -> bool |
Creates a torus geometry.
| format | The vertex format. |
| outer_radius | The outer radius of the torus. |
| inner_radius | The inner radius of the torus. |
| bands | The number of bands. |
| sides | The number of sides. |
| origin | The origin of the torus. |
| hardware_copy | Whether to use hardware copy. |
| void unravel::mesh::dispose | ( | ) |
| auto unravel::mesh::end_prepare | ( | bool | hardware_copy = true, |
| bool | build_buffers = true, | ||
| bool | weld = false, | ||
| bool | optimize = false ) -> bool |
Ends the preparation of the mesh and builds the render data.
| hardware_copy | Whether to use hardware copy. |
| weld | Whether to weld vertices. |
| optimize | Whether to optimize the mesh. |
| build_buffers | Whether to build the render buffers. |
| auto unravel::mesh::find_submesh_index_by_stable_id | ( | uint32_t | stable_id, |
| uint32_t | lod_index = 0 ) const -> int |
Finds the submesh array index matching an import-stable submesh identifier.
| stable_id | The stable identifier assigned at import time (see submesh::stable_id). |
| lod_index | LOD index (0 = base, 1+ = simplified) |
| auto unravel::mesh::generate_adjacency | ( | std::vector< uint32_t > & | adjacency | ) | -> bool |
|
static |
Generates default LOD configurations based on mesh triangle count.
| data | The load_data to generate LOD configs for |
| target_error | Base target error for LOD generation (default: 0.01) |
|
static |
Generates LOD levels directly in load_data without creating GPU buffers.
| data | The load_data to generate LODs for (will be modified) |
| lod_configs | Vector of LOD configurations: {target_triangle_count, target_error} |
| options | meshoptimizer simplification options (default: 0) |
|
protected |
|
protected |
|
protected |
Generates vertex normals for the mesh.
| adjacency_ptr | Pointer to the adjacency information. |
| remap_array_ptr | Pointer to the vertex remap array. |
|
protected |
| auto unravel::mesh::get_armature | ( | ) | const -> const std::unique_ptr<armature_node>& |
| auto unravel::mesh::get_bone_palettes | ( | ) | const -> const bone_palette_array_t& |
| auto unravel::mesh::get_bounds | ( | ) | const -> const math::bbox& |
Gets the local bounding box for this mesh.
| auto unravel::mesh::get_data_groups_count | ( | ) | const -> size_t |
| auto unravel::mesh::get_default_material_uids | ( | ) | const -> const std::vector<hpp::uuid>& |
| auto unravel::mesh::get_face_count | ( | ) | const -> uint32_t |
| auto unravel::mesh::get_hardware_ib | ( | uint32_t | lod_index = 0 | ) | const -> std::shared_ptr<gfx::index_buffer> |
Retrieves the hardware index buffer for a given LOD.
The buffer is created with BGFX_BUFFER_COMPUTE_READ so it can be bound to compute-style read buffers in shaders (e.g. vertex pulling).
| lod_index | The LOD level (0 = base). |
| auto unravel::mesh::get_hardware_vb | ( | ) | const -> std::shared_ptr<gfx::vertex_buffer> |
Retrieves the hardware vertex buffer for the mesh (shared across all LODs).
The buffer is created with BGFX_BUFFER_COMPUTE_READ so it can be bound to compute-style read buffers in shaders (e.g. vertex pulling).
| auto unravel::mesh::get_imported_materials | ( | ) | const -> std::vector<asset_handle<material>> |
| auto unravel::mesh::get_lod_count | ( | ) | const -> uint32_t |
| auto unravel::mesh::get_lod_face_count | ( | uint32_t | lod_index | ) | const -> uint32_t |
| auto unravel::mesh::get_lod_index_data | ( | uint32_t | lod_index, |
| std::vector< uint32_t > & | out_indices, | ||
| float & | out_error ) const -> bool |
Gets index buffer data for a specific LOD level (for serialization).
| lod_index | LOD index (0 = base, 1+ = simplified) |
| out_indices | Output vector to store index data |
| out_error | Output simplification error |
| auto unravel::mesh::get_lod_submeshes | ( | uint32_t | lod_index | ) | const -> const submesh_array_t* |
|
static |
|
static |
| auto unravel::mesh::get_non_skinned_submeshes_count | ( | uint32_t | lod_index = 0 | ) | const -> size_t |
| auto unravel::mesh::get_non_skinned_submeshes_indices | ( | uint32_t | data_group_id, |
| uint32_t | lod_index = 0 ) const -> const submesh_array_indices_t& |
| auto unravel::mesh::get_skin_bind_data | ( | ) | const -> const skin_bind_data& |
Retrieves the skin bind data if this mesh has been bound as a skin.
| auto unravel::mesh::get_skinned_submeshes_count | ( | uint32_t | lod_index = 0 | ) | const -> size_t |
| auto unravel::mesh::get_skinned_submeshes_indices | ( | uint32_t | data_group_id, |
| uint32_t | lod_index = 0 ) const -> const submesh_array_indices_t& |
| auto unravel::mesh::get_status | ( | ) | const -> mesh_status |
| auto unravel::mesh::get_submesh | ( | uint32_t | submesh_index = 0, |
| uint32_t | lod_index = 0 ) const -> const submesh* |
| auto unravel::mesh::get_submesh_index | ( | const submesh * | s, |
| uint32_t | lod_index = 0 ) const -> int |
| auto unravel::mesh::get_submesh_node_transforms | ( | uint32_t | lod_index = 0 | ) | const -> std::vector<math::transform> |
Computes the accumulated node transform for each submesh.
The mesh vertex buffer stores positions in node-local space; the renderer applies each submesh's accumulated armature node transform (relative to the model root) on top. This helper walks the armature tree and returns, for every submesh index, the transform (relative to the model root) of the node that owns that submesh. Submeshes not referenced by any node receive identity.
| lod_index | The LOD level whose submesh count is used to size the result. |
| auto unravel::mesh::get_submeshes | ( | uint32_t | lod_index = 0 | ) | const -> const submesh_array_t& |
| auto unravel::mesh::get_submeshes_count | ( | uint32_t | lod_index = 0 | ) | const -> size_t |
| auto unravel::mesh::get_system_ib | ( | ) | -> uint32_t* |
| auto unravel::mesh::get_system_vb | ( | ) | -> uint8_t* |
| auto unravel::mesh::get_vertex_count | ( | ) | const -> uint32_t |
| auto unravel::mesh::get_vertex_format | ( | ) | const -> const gfx::vertex_layout& |
Retrieves the format of the underlying mesh vertex data.
| auto unravel::mesh::prepare_mesh | ( | const gfx::vertex_layout & | vertex_format | ) | -> bool |
| auto unravel::mesh::restore_lods_from_load_data | ( | const load_data & | data | ) | -> bool |
| auto unravel::mesh::set_bounding_box | ( | const math::bbox & | box | ) | -> bool |
| auto unravel::mesh::set_primitives | ( | triangle_array_t && | triangles | ) | -> bool |
| auto unravel::mesh::set_submeshes | ( | const std::vector< submesh > & | submeshes | ) | -> bool |
| auto unravel::mesh::set_vertex_source | ( | byte_array_t && | source, |
| uint32_t | vertex_count, | ||
| const gfx::vertex_layout & | source_format ) -> bool |
| auto unravel::mesh::set_vertex_source | ( | void * | source, |
| uint32_t | vertex_count, | ||
| const gfx::vertex_layout & | source_format ) -> bool |
Sets the source of the vertex buffer to pull data from while preparing the mesh.
| source | The source vertex data. |
| vertex_count | The number of vertices. |
| source_format | The format of the source vertex data. |
|
protected |
|
protected |
|
friend |
|
friend |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |