Unravel Engine C++ Reference
Loading...
Searching...
No Matches
mesh.h
Go to the documentation of this file.
1#pragma once
2#include <engine/engine_export.h>
5#include <base/basetypes.hpp>
6#include <graphics/graphics.h>
7#include <hpp/span.hpp>
8#include <hpp/uuid.hpp>
9#include <math/math.h>
10
11#include <map>
12#include <memory>
13#include <vector>
14
15namespace gfx
16{
17struct vertex_buffer;
18struct index_buffer;
19} // namespace gfx
20
21namespace unravel
22{
23class camera;
24
25namespace triangle_flags
26{
27enum e
28{
29 none = 0,
31};
32} // namespace triangle_flags
33
34enum class mesh_status
35{
39};
40
42{
43 bottom,
44 center,
45 top
46};
47
53{
54public:
59 {
61 uint32_t vertex_index = 0;
63 float weight = 0.0f;
64 };
65 using vertex_influence_array_t = std::vector<vertex_influence>;
66
84 using bone_influence_array_t = std::vector<bone_influence>;
85
90 {
92 std::vector<int32_t> influences;
94 std::vector<float> weights;
96 int32_t palette;
99 };
100 using vertex_data_array_t = std::vector<vertex_data>;
101
107 void add_bone(const bone_influence& bone);
108
112 void remove_empty_bones();
113
121 void build_vertex_table(uint32_t vertex_count,
122 const std::vector<uint32_t>& vertex_remap,
123 vertex_data_array_t& table);
124
130 void remap_vertices(const std::vector<uint32_t>& remap);
131
137 auto get_bones() const -> const bone_influence_array_t&;
138
145
152 auto has_bones() const -> bool;
153
155 {
156 const bone_influence* bone{};
157 int index{-1};
158 };
159
166 auto find_bone_by_id(const std::string& id) const -> bone_query;
167
172
176 void clear();
177
178private:
180};
181
186{
187public:
188 using bone_index_map_t = std::map<uint32_t, uint32_t>;
189
195 bone_palette(uint32_t paletteSize);
196
205 auto get_skinning_matrices(const std::vector<math::transform>& node_transforms,
206 const skin_bind_data& bind_data) const -> const std::vector<math::mat4>&;
207
208 auto get_skinning_matrices(const std::vector<math::mat4>& node_transforms, const skin_bind_data& bind_data) const
209 -> const std::vector<math::mat4>&;
210
221 int32_t& current_space,
222 int32_t& common_base,
223 int32_t& additional_bones);
224
231 void assign_bones(bone_index_map_t& bones, std::vector<uint32_t>& faces);
232 void assign_bones(std::vector<bool>& bones, std::vector<uint32_t>& faces);
233
239 void assign_bones(const std::vector<uint32_t>& bones);
240
247 auto translate_bone_to_palette(uint32_t bone_index) const -> uint32_t;
248
254 auto get_maximum_blend_index() const -> int32_t;
255
261 auto get_maximum_size() const -> uint32_t;
262
269 auto get_data_group() const -> uint32_t;
270
276 auto get_influenced_faces() -> std::vector<uint32_t>&;
277
283 auto get_bones() const -> const std::vector<uint32_t>&;
284
291
297 void set_data_group(uint32_t group);
298
303
304protected:
308 std::vector<uint32_t> bones_;
310 std::vector<uint32_t> faces_;
317};
318
322class mesh
323{
324public:
329 struct submesh
330 {
332 uint32_t data_group_id{0};
334 int32_t vertex_start{-1};
336 uint32_t vertex_count{0};
338 int32_t face_start{-1};
340 uint32_t face_count{0};
341
343
344 bool skinned{};
345
349 uint32_t stable_id{0};
350 };
351
352 struct info
353 {
355 struct lod_info
356 {
358 uint32_t triangles = 0;
360 float percent = 0.0f;
361 };
362
364 uint32_t vertices = 0;
366 uint32_t triangles = 0;
368 uint32_t submeshes = 0;
370 uint32_t data_groups = 0;
372 std::vector<lod_info> lods;
373 };
374
378 struct triangle
379 {
381 uint32_t data_group_id = 0;
383 std::array<uint32_t, 3> indices = {0, 0, 0};
385 uint8_t flags = 0;
386 };
387
388 using triangle_array_t = std::vector<triangle>;
389 using submesh_array_t = std::vector<submesh*>;
390 using bone_palette_array_t = std::vector<bone_palette>;
391 using submesh_array_indices_t = std::vector<size_t>;
392 using submesh_array_map_t = std::map<uint32_t, submesh_array_indices_t>;
393
394 using data_group_submesh_map_t = std::map<uint32_t, submesh_array_t>;
395 using byte_array_t = std::vector<uint8_t>;
396
401 {
403 uint32_t* system_ib_{nullptr};
405 std::shared_ptr<void> hardware_ib_;
407 uint32_t face_count_{0};
415 float simplification_error_{0.0f};
416 };
417
419 {
421 std::string name;
425 std::vector<std::unique_ptr<armature_node>> children;
427 std::vector<uint32_t> submeshes;
428
429 int index{-1};
430 };
431
436 {
438 std::vector<uint32_t> index_data;
440 uint32_t face_count = 0;
442 std::vector<mesh::submesh> submeshes;
444 float simplification_error = 0.0f;
445 };
446
451 {
455 std::vector<uint8_t> vertex_data;
457 uint32_t vertex_count = 0;
461 uint32_t triangle_count = 0;
463 std::vector<mesh::submesh> submeshes;
465 uint32_t material_count = 0;
469 bool skin_is_prepared = false;
471 std::vector<std::vector<uint32_t>> bone_palette_bones;
473 std::unique_ptr<armature_node> root_node = nullptr;
474
476
478 std::vector<lod_load_data> lods;
479
481 std::vector<hpp::uuid> default_material_uids;
482 };
483
487 mesh();
488
492 ~mesh();
493
497 void dispose();
498
499 auto get_info() const -> info;
508 void bind_render_buffers_for_submesh(const submesh* submesh, uint32_t lod_index = 0);
509
517 auto prepare_mesh(const gfx::vertex_layout& vertex_format) -> bool;
518
528 auto set_vertex_source(void* source, uint32_t vertex_count, const gfx::vertex_layout& source_format) -> bool;
529 auto set_vertex_source(byte_array_t&& source, uint32_t vertex_count, const gfx::vertex_layout& source_format)
530 -> bool;
531
532 auto set_bounding_box(const math::bbox& box) -> bool;
533
534 auto set_submeshes(const std::vector<submesh>& submeshes) -> bool;
535
543 auto set_primitives(triangle_array_t&& triangles) -> bool;
544
552 auto bind_skin(const skin_bind_data& bind_data) -> bool;
553
561 auto bind_armature(std::unique_ptr<armature_node>& root) -> bool;
562
563 auto load_mesh(load_data&& data) -> bool;
564
578 auto create_plane(const gfx::vertex_layout& format,
579 float width,
580 float height,
581 uint32_t width_segments,
582 uint32_t height_segments,
583 mesh_create_origin origin,
584 bool hardware_copy = true) -> bool;
585
593 auto create_heightfield(const gfx::vertex_layout& format,
594 hpp::span<const float> heights,
595 uint32_t segments_x,
596 uint32_t segments_z,
597 float half_extent_x,
598 float half_extent_z,
599 float height_scale,
600 mesh_create_origin origin,
601 bool hardware_copy = true) -> bool;
602
618 auto create_cube(const gfx::vertex_layout& format,
619 float width,
620 float height,
621 float depth,
622 uint32_t width_segments,
623 uint32_t height_segments,
624 uint32_t depth_segments,
625 mesh_create_origin origin,
626 bool hardware_copy = true) -> bool;
627
628 auto create_rounded_cube(const gfx::vertex_layout& format,
629 float width,
630 float height,
631 float depth,
632 uint32_t width_segments,
633 uint32_t height_segments,
634 uint32_t depth_segments,
635 mesh_create_origin origin,
636 bool hardware_copy = true) -> bool;
637
650 auto create_sphere(const gfx::vertex_layout& format,
651 float radius,
652 uint32_t stacks,
653 uint32_t slices,
654 mesh_create_origin origin,
655 bool hardware_copy = true) -> bool;
656
670 auto create_cylinder(const gfx::vertex_layout& format,
671 float radius,
672 float height,
673 uint32_t stacks,
674 uint32_t slices,
675 mesh_create_origin origin,
676 bool hardware_copy = true) -> bool;
677
691 auto create_capsule(const gfx::vertex_layout& format,
692 float radius,
693 float height,
694 uint32_t stacks,
695 uint32_t slices,
696 mesh_create_origin origin,
697 bool hardware_copy = true) -> bool;
698
713 auto create_cone(const gfx::vertex_layout& format,
714 float radius,
715 float radius_tip,
716 float height,
717 uint32_t stacks,
718 uint32_t slices,
719 mesh_create_origin origin,
720 bool hardware_copy = true) -> bool;
721
735 auto create_torus(const gfx::vertex_layout& format,
736 float outer_radius,
737 float inner_radius,
738 uint32_t bands,
739 uint32_t sides,
740 mesh_create_origin origin,
741 bool hardware_copy = true) -> bool;
742
751 auto create_teapot(const gfx::vertex_layout& format, bool hardware_copy = true) -> bool;
752
761 auto create_icosahedron(const gfx::vertex_layout& format, bool hardware_copy = true) -> bool;
762
771 auto create_dodecahedron(const gfx::vertex_layout& format, bool hardware_copy = true) -> bool;
772
782 auto create_icosphere(const gfx::vertex_layout& format, int tesselation_level, bool hardware_copy = true) -> bool;
783
794 auto end_prepare(bool hardware_copy = true, bool build_buffers = true, bool weld = false, bool optimize = false)
795 -> bool;
796
802 void build_vb(bool hardware_copy = true);
803
809 void build_ib(bool hardware_copy = true);
810
818 auto generate_adjacency(std::vector<uint32_t>& adjacency) -> bool;
819
825 auto get_face_count() const -> uint32_t;
826
832 auto get_vertex_count() const -> uint32_t;
833
839 auto get_system_vb() -> uint8_t*;
840
846 auto get_system_ib() -> uint32_t*;
847
853 auto get_vertex_format() const -> const gfx::vertex_layout&;
854
863 auto get_hardware_vb() const -> std::shared_ptr<gfx::vertex_buffer>;
864
874 auto get_hardware_ib(uint32_t lod_index = 0) const -> std::shared_ptr<gfx::index_buffer>;
875
881 auto get_skin_bind_data() const -> const skin_bind_data&;
882
888 auto get_bone_palettes() const -> const bone_palette_array_t&;
889
895 auto get_armature() const -> const std::unique_ptr<armature_node>&;
896
909 auto get_submesh_node_transforms(uint32_t lod_index = 0) const -> std::vector<math::transform>;
910
920 auto calculate_screen_rect(const math::transform& world, const camera& cam) const -> irect32_t;
921
931 auto calculate_screen_rect_precise(const math::transform& world, const camera& cam) const -> irect32_t;
932
939 auto get_submeshes(uint32_t lod_index = 0) const -> const submesh_array_t&;
940 auto get_submesh(uint32_t submesh_index = 0, uint32_t lod_index = 0) const -> const submesh*;
946 auto get_bounds() const -> const math::bbox&;
947
953 auto get_status() const -> mesh_status;
954
960 auto get_data_groups_count() const -> size_t;
961
966 auto get_default_material_uids() const -> const std::vector<hpp::uuid>&;
967
972 auto get_imported_materials() const -> std::vector<asset_handle<material>>;
978 auto get_submeshes_count(uint32_t lod_index = 0) const -> size_t;
979
986 auto find_submesh_index_by_stable_id(uint32_t stable_id, uint32_t lod_index = 0) const -> int;
987
993 auto get_skinned_submeshes_count(uint32_t lod_index = 0) const -> size_t;
1000 auto get_skinned_submeshes_indices(uint32_t data_group_id, uint32_t lod_index = 0) const -> const submesh_array_indices_t&;
1001
1007 auto get_non_skinned_submeshes_count(uint32_t lod_index = 0) const -> size_t;
1014 auto get_non_skinned_submeshes_indices(uint32_t data_group_id, uint32_t lod_index = 0) const -> const submesh_array_indices_t&;
1015
1022 auto get_submesh_index(const submesh* s, uint32_t lod_index = 0) const -> int;
1023
1028 auto get_lod_count() const -> uint32_t;
1029
1035 auto get_lod_submeshes(uint32_t lod_index) const -> const submesh_array_t*;
1036
1042 auto get_lod_face_count(uint32_t lod_index) const -> uint32_t;
1043
1051 auto get_lod_index_data(uint32_t lod_index, std::vector<uint32_t>& out_indices, float& out_error) const -> bool;
1052
1053
1058 static auto get_max_lod_count() -> uint32_t;
1063 static auto get_max_generated_lod_count() -> uint32_t;
1070 static auto generate_default_lod_configs(const load_data& data, float target_error = 0.01f) -> std::vector<std::pair<size_t, float>>;
1071
1077 static auto apply_skin_to_load_data(load_data& data) -> bool;
1078
1086 static auto generate_lods_for_load_data(load_data& data, const std::vector<std::pair<size_t, float>>& lod_configs) -> bool;
1087
1093 auto restore_lods_from_load_data(const load_data& data) -> bool;
1094
1096 {
1098 {
1099 source_contains_normal = 0x1,
1100 source_contains_binormal = 0x2,
1101 source_contains_tangent = 0x4
1103
1105 uint8_t* vertex_source{nullptr};
1107 bool owns_source{false};
1111 std::vector<uint32_t> vertex_records;
1119 uint32_t triangle_count{0};
1121 uint32_t vertex_count{0};
1123 std::vector<submesh> submeshes;
1125 bool compute_normals{false};
1127 bool compute_binormals{false};
1129 bool compute_tangents{false};
1131 bool compute_barycentric{false};
1132
1133 bool check_for_degenerates{false};
1134
1135 bool compute_per_triangle_material_data{false};
1136 };
1137
1138protected:
1140 {
1142 int32_t cache_position{-1};
1144 float vertex_score{0.0f};
1146 uint32_t unused_triangle_references{0};
1148 std::vector<uint32_t> triangle_references;
1149 };
1150
1152 {
1154 float triangle_score{0.0f};
1156 bool added{false};
1157 };
1158
1160 {
1162 const math::vec3* vertex1{nullptr};
1164 const math::vec3* vertex2{nullptr};
1165 };
1166
1168 {
1170 uint32_t data_group_id{0};
1171 };
1172
1173 using submesh_key_map_t = std::map<mesh_submesh_key, submesh*>;
1174 using submesh_key_array_t = std::vector<mesh_submesh_key>;
1175
1177 {
1179 uint8_t* vertex{nullptr};
1183 float tolerance{};
1184 };
1185
1191
1193 {
1195 face_influences* influences{nullptr};
1197 uint32_t data_group_id{0};
1198 };
1199
1200 using bone_combination_map_t = std::map<bone_combination_key, std::vector<uint32_t>*>;
1201
1202 friend auto operator<(const adjacent_edge_key& key1, const adjacent_edge_key& key2) -> bool;
1203 friend auto operator<(const mesh_submesh_key& key1, const mesh_submesh_key& key2) -> bool;
1204 friend auto operator<(const weld_key& key1, const weld_key& key2) -> bool;
1205 friend auto operator<(const bone_combination_key& key1, const bone_combination_key& key2) -> bool;
1206
1207 void check_for_degenerates();
1208
1216 auto generate_vertex_components(bool weld) -> bool;
1217
1226 auto generate_vertex_normals(uint32_t* adjacency_ptr, std::vector<uint32_t>* remap_array_ptr = nullptr) -> bool;
1227
1235 auto generate_vertex_barycentrics(uint32_t* adjacency) -> bool;
1236
1243 auto generate_vertex_tangents() -> bool;
1244
1253 auto weld_vertices(float tolerance = 0.000001f, std::vector<uint32_t>* vertex_remap_ptr = nullptr) -> bool;
1254
1261 auto sort_mesh_data() -> bool;
1262
1263
1264protected:
1266 bool force_tangent_generation_ = false;
1268 bool force_normal_generation_ = false;
1270 bool force_barycentric_generation_ = false;
1272 bool disable_final_sort_ = false;
1273
1275 uint8_t* system_vb_ = nullptr;
1279 uint32_t* system_ib_ = nullptr;
1283 std::shared_ptr<void> hardware_vb_;
1285 std::shared_ptr<void> hardware_ib_;
1286
1288 std::vector<lod_level> lods_;
1290 uint32_t lod_count_ = 1;
1291
1294
1297 size_t skinned_submesh_count_{};
1298
1301 size_t non_skinned_submesh_count_{};
1302
1305
1307 bool hardware_mesh_ = true;
1309 bool optimize_mesh_ = false;
1313 uint32_t face_count_ = 0;
1315 uint32_t vertex_count_ = 0;
1316
1321
1327 std::unique_ptr<armature_node> root_ = nullptr;
1328
1330 std::vector<hpp::uuid> default_material_uids_;
1331};
1332
1333} // namespace unravel
uint32_t width
uint32_t height
gfx::texture_format format
General purpose transformation class designed to maintain each component of the transformation separa...
Definition transform.hpp:27
Outlines a collection of bones that influence a given set of faces/vertices in the mesh.
Definition mesh.h:186
std::map< uint32_t, uint32_t > bone_index_map_t
Definition mesh.h:188
auto get_bones() const -> const std::vector< uint32_t > &
Retrieves the indices of the bones referenced by this palette.
Definition mesh.cpp:4030
auto get_maximum_size() const -> uint32_t
Retrieves the maximum size of the palette.
Definition mesh.cpp:4015
bone_index_map_t bones_lut_
< Sorted list of bones in this palette.
Definition mesh.h:306
void clear_influenced_faces()
Clears out the temporary face influences array.
Definition mesh.cpp:4025
uint32_t data_group_id_
The maximum size of the palette.
Definition mesh.h:312
void assign_bones(bone_index_map_t &bones, std::vector< uint32_t > &faces)
Assigns the specified bones (and faces) to this bone palette.
Definition mesh.cpp:3871
std::vector< uint32_t > faces_
The data group identifier used to separate the mesh data into submeshes relevant tothis bone palette.
Definition mesh.h:310
auto get_maximum_blend_index() const -> int32_t
Retrieves the maximum vertex blend index for this palette.
Definition mesh.cpp:4005
auto get_influenced_faces() -> std::vector< uint32_t > &
Retrieves the list of faces assigned to this palette.
Definition mesh.cpp:4020
auto get_skinning_matrices(const std::vector< math::transform > &node_transforms, const skin_bind_data &bind_data) const -> const std::vector< math::mat4 > &
Gathers the bone/palette information and matrices ready for drawing the skinned mesh.
Definition mesh.cpp:3795
uint32_t maximum_size_
The maximum vertex blend index for this palette.
Definition mesh.h:314
void compute_palette_fit(bone_index_map_t &input, int32_t &current_space, int32_t &common_base, int32_t &additional_bones)
Determines the relevant "fit" information that can be used to discover if and how the specified combi...
Definition mesh.cpp:3950
void set_data_group(uint32_t group)
Sets the identifier of the data group assigned to the submesh of the mesh reserved for this bone pale...
Definition mesh.cpp:4000
void set_maximum_blend_index(int index)
Sets the maximum vertex blend index for this palette.
Definition mesh.cpp:4010
int32_t maximum_blend_index_
Definition mesh.h:316
auto translate_bone_to_palette(uint32_t bone_index) const -> uint32_t
Translates the specified bone index into its associated position in the palette.
Definition mesh.cpp:3987
bone_palette(uint32_t paletteSize)
Constructs a bone palette with the given size.
Definition mesh.cpp:3788
auto get_data_group() const -> uint32_t
Retrieves the identifier of the data group assigned to the submesh of the mesh reserved for this bone...
Definition mesh.cpp:3995
std::vector< uint32_t > bones_
List of faces assigned to this palette.
Definition mesh.h:308
Class representing a camera. Contains functionality for manipulating and updating a camera....
Definition camera.h:62
Base class for materials used in rendering.
Definition material.h:44
Main class representing a 3D mesh with support for different LODs, submeshes, and skinning.
Definition mesh.h:323
gfx::vertex_layout vertex_format_
The final system memory copy of the index buffer (LOD 0 - base mesh).
Definition mesh.h:1277
bone_palette_array_t bone_palettes_
List of armature nodes.
Definition mesh.h:1325
std::shared_ptr< void > hardware_vb_
The actual hardware index buffer resource (LOD 0 - base mesh).
Definition mesh.h:1283
submesh_array_map_t non_skinned_submesh_indices_
Definition mesh.h:1300
submesh_array_t mesh_submeshes_
Indices in the subset array which are skinned.
Definition mesh.h:1293
std::vector< mesh_submesh_key > submesh_key_array_t
Definition mesh.h:1174
std::map< uint32_t, submesh_array_indices_t > submesh_array_map_t
Definition mesh.h:392
std::vector< uint8_t > byte_array_t
Definition mesh.h:395
std::vector< hpp::uuid > default_material_uids_
Definition mesh.h:1330
math::bbox bbox_
Total number of faces in the prepared mesh.
Definition mesh.h:1311
data_group_submesh_map_t data_groups_
Whether the mesh uses a hardware vertex/index buffer.
Definition mesh.h:1304
std::shared_ptr< void > hardware_ib_
Additional LOD levels (LOD 1, 2, 3, ...) with simplified index buffers.
Definition mesh.h:1285
submesh_array_map_t skinned_submesh_indices_
Definition mesh.h:1296
std::vector< lod_level > lods_
Current LOD count (including base LOD 0).
Definition mesh.h:1288
skin_bind_data skin_bind_data_
List of unique combinations of bones to use during rendering.
Definition mesh.h:1323
preparation_data preparation_data_
Data describing how the mesh should be bound as a skin with supplied bone matrices.
Definition mesh.h:1320
std::vector< size_t > submesh_array_indices_t
Definition mesh.h:391
std::map< mesh_submesh_key, submesh * > submesh_key_map_t
Definition mesh.h:1173
std::vector< bone_palette > bone_palette_array_t
Definition mesh.h:390
std::vector< submesh * > submesh_array_t
Definition mesh.h:389
std::map< uint32_t, submesh_array_t > data_group_submesh_map_t
Definition mesh.h:394
std::vector< triangle > triangle_array_t
Definition mesh.h:388
submesh_key_array_t triangle_data_
The actual hardware vertex buffer resource (shared by all LODs).
Definition mesh.h:1281
std::map< bone_combination_key, std::vector< uint32_t > * > bone_combination_map_t
Definition mesh.h:1200
Structure describing how a skinned mesh should be bound to any bones that influence its vertices.
Definition mesh.h:53
void build_vertex_table(uint32_t vertex_count, const std::vector< uint32_t > &vertex_remap, vertex_data_array_t &table)
Constructs a list of bone influences and weights for each vertex based on the binding data provided.
Definition mesh.cpp:3697
void remap_vertices(const std::vector< uint32_t > &remap)
Remaps the vertex references stored in the binding based on the supplied remap array.
Definition mesh.cpp:3666
auto get_bones() const -> const bone_influence_array_t &
Retrieves a list of all bones that influence the skin in some way.
Definition mesh.cpp:3746
std::vector< vertex_data > vertex_data_array_t
Definition mesh.h:100
auto find_bone_by_id(const std::string &id) const -> bone_query
Finds a bone by its unique identifier.
Definition mesh.cpp:3761
void clear()
Clears out the bone information stored in this object.
Definition mesh.cpp:3661
auto has_bones() const -> bool
Checks whether the skin data has any bones.
Definition mesh.cpp:3756
void remove_empty_bones()
Removes any bones that do not contain any influences.
Definition mesh.cpp:3636
std::vector< vertex_influence > vertex_influence_array_t
Definition mesh.h:65
std::vector< bone_influence > bone_influence_array_t
Definition mesh.h:84
void clear_vertex_influences()
Releases memory allocated for vertex influences in each stored bone.
Definition mesh.cpp:3653
void add_bone(const bone_influence &bone)
Adds influence information for a specific bone.
Definition mesh.cpp:3631
uint16_t index
bgfx::VertexLayout vertex_layout
Definition vertex_decl.h:8
Definition bbox.cpp:5
Hash specialization for batch_key to enable use in std::unordered_map.
mesh_status
Definition mesh.h:35
auto operator<(const mesh::adjacent_edge_key &key1, const mesh::adjacent_edge_key &key2) -> bool
Definition mesh.cpp:2779
@ box
Box type reflection probe.
mesh_create_origin
Definition mesh.h:42
std::vector< uint32_t > indices
Thread-safe handle to an asset.
Storage for box vector values and wraps up common functionality.
Definition bbox.h:21
std::vector< uint32_t > submeshes
Definition mesh.h:427
std::string name
< Name of the armature node.
Definition mesh.h:421
math::transform local_transform
Children nodes of this armature node.
Definition mesh.h:423
std::vector< std::unique_ptr< armature_node > > children
submesh indices affected by this node
Definition mesh.h:425
bone_palette::bone_index_map_t bones
< List of unique bones that influence a given number of faces.
Definition mesh.h:1189
< Structure describing LOD level information. Total number of vertices.
Definition mesh.h:356
std::vector< lod_info > lods
Definition mesh.h:372
Struct used for mesh construction.
Definition mesh.h:451
triangle_array_t triangle_data
Total number of triangles.
Definition mesh.h:459
std::vector< hpp::uuid > default_material_uids
Definition mesh.h:481
std::vector< lod_load_data > lods
UIDs of default materials generated during import, indexed by data_group_id.
Definition mesh.h:478
std::vector< mesh::submesh > submeshes
Total number of materials.
Definition mesh.h:463
std::vector< uint8_t > vertex_data
Total number of vertices.
Definition mesh.h:455
gfx::vertex_layout vertex_format
< The format of the vertex data.
Definition mesh.h:453
skin_bind_data skin_data
True if skinning was baked into topology (vertex duplication + palette index encoding) during compila...
Definition mesh.h:467
std::vector< std::vector< uint32_t > > bone_palette_bones
Root node of the armature.
Definition mesh.h:471
Structure describing a LOD level with its own index buffer and submeshes.
Definition mesh.h:401
std::shared_ptr< void > hardware_ib_
Number of faces in this LOD.
Definition mesh.h:405
submesh_array_t submeshes_
Cached skinned submesh indices per data group.
Definition mesh.h:409
submesh_array_map_t non_skinned_submesh_indices_
Error metric for this LOD (from meshoptimizer)
Definition mesh.h:413
submesh_array_map_t skinned_submesh_indices_
Cached non-skinned submesh indices per data group.
Definition mesh.h:411
Structure describing a LOD level in load_data (for serialization).
Definition mesh.h:436
std::vector< uint32_t > index_data
< Index buffer data for this LOD (as uint32_t array)
Definition mesh.h:438
std::vector< mesh::submesh > submeshes
Error metric for this LOD (from meshoptimizer)
Definition mesh.h:442
std::vector< uint32_t > triangle_references
Definition mesh.h:1148
std::vector< uint32_t > vertex_records
Final vertex buffer currently being prepared.
Definition mesh.h:1111
triangle_array_t triangle_data
Total number of triangles currently stored.
Definition mesh.h:1117
gfx::vertex_layout source_format
Records the location in the vertex buffer that each vertex has been placed during data insertion.
Definition mesh.h:1109
std::vector< submesh > submeshes
Whether to compute vertex normals.
Definition mesh.h:1123
byte_array_t vertex_data
Additional descriptive information about the vertices.
Definition mesh.h:1113
byte_array_t vertex_flags
Stores the current face/triangle data.
Definition mesh.h:1115
Structure describing an individual "piece" of the mesh, often grouped by material,...
Definition mesh.h:330
Structure describing data for a single triangle in the mesh.
Definition mesh.h:379
gfx::vertex_layout format
Tolerance for welding vertices.
Definition mesh.h:1181
Describes the vertices that are connected to the referenced bone and how much influence it has on the...
Definition mesh.h:71
std::string bone_id
< The unique identifier of the bone.
Definition mesh.h:73
math::transform bind_pose_transform
List of vertices influenced by the bone.
Definition mesh.h:75
vertex_influence_array_t influences
Definition mesh.h:77
Contains per-vertex influence and weight information.
Definition mesh.h:90
int32_t palette
The index of the original vertex.
Definition mesh.h:96
std::vector< int32_t > influences
< List of bones that influence this vertex.
Definition mesh.h:92
std::vector< float > weights
Index of the palette to which this vertex has been assigned.
Definition mesh.h:94
Describes how a bone influences a specific vertex.
Definition mesh.h:59
uint32_t vertex_index
< The index of the vertex influenced by the bone.
Definition mesh.h:61