vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
skeleton_asset.h
1#pragma once
2
3#include <cstdint>
4#include <string>
5#include <string_view>
6#include <vector>
7
8#include <glm/glm.hpp>
9
10#include "ecs/component/core/transform.h"
11#include "resource/resource.h"
12#include "resource/resource_handle.h"
13
14namespace Vkm::Engine {
15
21struct Bone {
22 std::string name;
23 int32_t parent = -1;
24};
25
33struct SkeletonAsset : public Resource {
34 std::vector<Bone> bones;
35 std::vector<glm::mat4> inverseBind;
36
43 std::vector<Transform> bindPose;
44
53 int32_t indexOf(std::string_view name) const;
54};
55
65std::string findSkeletonFault(const SkeletonAsset& skeleton);
66
67using SkeletonHandle = Handle<SkeletonAsset>;
68
69} // namespace Vkm::Engine
const std::string & name() const noexcept
Serializable identity; non-empty and unique within its type once added.
Definition resource.h:41
One joint of a rig: its authoring name and the index of its parent.
Definition skeleton_asset.h:21
int32_t parent
-1 for a root. INVARIANT: parent < this bone's own index.
Definition skeleton_asset.h:23
Opaque, type-safe handle for resources, distinguished by ResourceType.
Definition resource_handle.h:16
A rig: a flat, parent-before-child bone array plus its bind pose.
Definition skeleton_asset.h:33
int32_t indexOf(std::string_view name) const
The index of the bone called name, or -1 when the rig has none.
std::vector< Transform > bindPose
Each bone's local TRS at bind, used wherever a clip has no channel for it.
Definition skeleton_asset.h:43
std::vector< glm::mat4 > inverseBind
Rig model space -> this bone's space, at bind.
Definition skeleton_asset.h:35