gdk-graphics 0a0aef92e917cfbac53dffbc32c295e4de914093
Loading...
Searching...
No Matches
skinning.h
1// © Joseph Cameron - MIT License
2
3#ifndef GDK_GRAPHICS_EXT_ANIMATION_SKINNING_H
4#define GDK_GRAPHICS_EXT_ANIMATION_SKINNING_H
5
6#include <gdk/graphics/ext/animation/skeleton.h>
7
8#include <gdk/graphics/model_data.h>
9
10#include <cstddef>
11#include <vector>
12#include <span>
13
14namespace gdk::graphics::animation {
16 struct vertex_weights final {
17 std::size_t first = 0;
18 std::size_t second = 0;
19 float first_weight = 1.0f;
20 };
21
27 void skin(std::span<const vector3_type> aBindPositions,
28 std::span<const vertex_weights> aWeights,
29 std::span<const matrix4x4_type> aPalette,
31
33 struct skinned_mesh final {
35 std::vector<vector3_type> bind_positions;
36 std::vector<vertex_weights> weights;
37 };
38
40 [[nodiscard]] skinned_mesh make_bone_boxes(const skeleton &aSkeleton, const float aHalfWidth);
41}
42
43#endif
vertex data stored in system memory.
Definition model_data.h:25
a chain of bones in bind pose.
Definition skeleton.h:16
a mesh built from one box per bone segment, rigidly weighted
Definition skinning.h:33
what a vertex is attached to: bone indices and how much each one moves it.
Definition skinning.h:16