Unravel Engine C++ Reference
Loading...
Searching...
No Matches
animation_blend_space.h
Go to the documentation of this file.
1#pragma once
2
3#include "animation_pose.h"
5
6namespace unravel
7{
8
9auto blend(const math::transform& lhs, const math::transform& rhs, float factor) -> math::transform;
10
11void blend_poses(const animation_pose& pose1, const animation_pose& pose2, float factor, animation_pose& result_pose);
12
13auto blend_additive(const math::transform& base,
14 const math::transform& additive,
15 const math::transform& ref,
16 float weight) -> math::transform;
17void blend_poses_additive(const animation_pose& base,
18 const animation_pose& additive,
19 const animation_pose& ref_pose,
20 float weight,
21 animation_pose& result);
22
24{
25 std::vector<float> parameters; // The parameter values for this point
26 asset_handle<animation_clip> clip; // The animation clip associated with this point
27};
28
30{
31public:
32 using parameter_t = float;
33 using parameters_t = std::vector<parameter_t>;
34
35 // Add an animation clip to the blend space at specified parameter values
36 void add_clip(const parameters_t& params, const asset_handle<animation_clip>& clip);
37
38 // Compute the blending weights for the current parameters
39 void compute_blend(const parameters_t& current_params,
40 std::vector<std::pair<asset_handle<animation_clip>, float>>& out_clips) const;
41
42 // Get the number of parameters in the blend space
43 auto get_parameter_count() const -> size_t;
44
45private:
46 void compute_blend_1d(const parameters_t& current_params,
47 std::vector<std::pair<asset_handle<animation_clip>, float>>& out_clips) const;
48
49 void compute_blend_2d(const parameters_t& current_params,
50 std::vector<std::pair<asset_handle<animation_clip>, float>>& out_clips) const;
51
52 std::vector<blend_space_point> points_;
53 size_t parameter_count_{0};
54};
55
56} // namespace unravel
General purpose transformation class designed to maintain each component of the transformation separa...
Definition transform.hpp:27
void add_clip(const parameters_t &params, const asset_handle< animation_clip > &clip)
void compute_blend(const parameters_t &current_params, std::vector< std::pair< asset_handle< animation_clip >, float > > &out_clips) const
std::vector< parameter_t > parameters_t
auto get_parameter_count() const -> size_t
transform_t< float > transform
void blend_poses(const animation_pose &pose1, const animation_pose &pose2, float factor, animation_pose &result_pose)
void blend_poses_additive(const animation_pose &base, const animation_pose &additive, const animation_pose &ref_pose, float weight, animation_pose &result)
auto blend_additive(const math::transform &base, const math::transform &additive, const math::transform &ref, float weight) -> math::transform
auto blend(const math::transform &lhs, const math::transform &rhs, float factor) -> math::transform
Represents a handle to an asset, providing access and management functions.
Struct representing an animation.
Definition animation.h:99
asset_handle< animation_clip > clip