10#include "core/math/bounds.h"
12#include "resource/resource.h"
13#include "resource/resource_handle.h"
15namespace Vkm::Engine {
42static_assert(
sizeof(
SkinVertex) == 12,
"SkinVertex layout changed - bump COOKER_VERSION");
44 std::is_trivially_copyable_v<SkinVertex>,
45 "SkinVertex must be trivially copyable to bulk-write"
52 std::vector<Vertex> vertices = {};
53 std::vector<uint32_t> indices = {};
60 std::vector<SkinVertex>
skin = {};
Opaque, type-safe handle for resources, distinguished by ResourceType.
Definition resource_handle.h:16
An axis-aligned box.
Definition bounds.h:14
CPU-side geometry: indexed triangle mesh plus a cached local-space AABB.
Definition mesh_asset.h:51
bool loading
True while an async decode is in flight.
Definition mesh_asset.h:92
glm::vec3 boundsMin
Local space.
Definition mesh_asset.h:77
void computeAndSetSkinRadius(const SkeletonAsset &rig)
Compute how far a vertex sits from the bones that drive it and store it in skinRadius.
float skinRadius
Largest distance from a vertex to any bone that influences it.
Definition mesh_asset.h:75
Math::AABB bounds() const noexcept
The local-space bounds as one box.
Definition mesh_asset.h:85
std::string skeleton
Name of the rig skin's indices address; empty when unskinned.
Definition mesh_asset.h:68
void computeAndSetBounds()
Compute the local-space AABB from vertex positions and store it in boundsMin / boundsMax.
glm::vec3 boundsMax
Local space.
Definition mesh_asset.h:78
std::vector< SkinVertex > skin
Per-vertex rig binding: empty, or exactly vertices.size() long.
Definition mesh_asset.h:60
A rig: a flat, parent-before-child bone array plus its bind pose.
Definition skeleton_asset.h:33
One vertex's binding to the rig, in a stream parallel to vertices.
Definition mesh_asset.h:38
uint8_t weights[4]
unorm8 influences, summing to exactly 255.
Definition mesh_asset.h:40
uint16_t bones[4]
Indices into the skeleton named by MeshAsset::skeleton.
Definition mesh_asset.h:39
One vertex: position, normal, texture coordinates and tangent frame.
Definition mesh_asset.h:24
glm::vec4 tangent
Along +U; w is the handedness, +1 or -1.
Definition mesh_asset.h:28
glm::vec2 uv
Texture coordinates.
Definition mesh_asset.h:27
glm::vec3 position
Model-space position.
Definition mesh_asset.h:25
glm::vec3 normal
Surface normal, model space.
Definition mesh_asset.h:26