Kale
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Kale::Skeleton Struct Reference

#include <SkeletalAnimatable.hpp>

Classes

struct  Bone
 

Public Member Functions

 Skeleton ()
 
 Skeleton (const std::vector< std::tuple< int, float, float > > &bones, AngleUnit unit)
 
 Skeleton (const std::vector< Bone > &bones)
 

Static Public Member Functions

static Bone calculateBone (const std::vector< Bone > &bones, int previousBone, float length, float rotation, AngleUnit unit)
 
static Vector2f transform (const std::vector< Transform > &offsets, Vector2f vert, const std::array< std::pair< int, float >, 4 > &weights)
 

Public Attributes

std::vector< Bonebones
 

Detailed Description

Represents a skeleton used for skeletal rigging. A collection of connected bones which allow for transforming vertices in unique ways

Definition at line 35 of file SkeletalAnimatable.hpp.

Constructor & Destructor Documentation

◆ Skeleton() [1/3]

Skeleton::Skeleton ( )

Creates an empty skeleton

Definition at line 24 of file SkeletalAnimatable.cpp.

◆ Skeleton() [2/3]

Skeleton::Skeleton ( const std::vector< std::tuple< int, float, float > > & bones,
AngleUnit unit )

Creates a skeleton given a vector of tuples containing the index of the previous bone, the bone length, and the bone rotation

Parameters
bonesThe vector of bones
unitThe unit of the rotation given

Definition at line 33 of file SkeletalAnimatable.cpp.

◆ Skeleton() [3/3]

Skeleton::Skeleton ( const std::vector< Bone > & bones)

Creates a skeleton from a vector of bones

Parameters
bonesThe list of bones

Definition at line 43 of file SkeletalAnimatable.cpp.

Member Function Documentation

◆ calculateBone()

static Bone Kale::Skeleton::calculateBone ( const std::vector< Bone > & bones,
int previousBone,
float length,
float rotation,
AngleUnit unit )
inlinestatic

Calculates a single bone

Parameters
bonesA vector of the existing bones, this must containt he parent of this bone if previousBone is not -1
previousBoneThe previous bone index, -1 if this is the base
lengthThe length of the bone
rotationThe rotation of the bone
unitThe unit the bone's rotation is given in
Returns
The calculated bone

Definition at line 105 of file SkeletalAnimatable.hpp.

◆ transform()

static Vector2f Kale::Skeleton::transform ( const std::vector< Transform > & offsets,
Vector2f vert,
const std::array< std::pair< int, float >, 4 > & weights )
inlinestatic

Transforms a single vertex given its weights

Parameters
offsetsThe offset matrices of the skeleton to transform with
vertThe vertex to transform
weightsThe weights of the vertex, 4 pairs of the index of the bone along with the significance. Must add up to 1, set the index of the bone to -1 if it is unassigned.
Returns
The transformed vertex

Definition at line 127 of file SkeletalAnimatable.hpp.

Member Data Documentation

◆ bones

std::vector<Bone> Kale::Skeleton::bones

A vector of the held bones

Definition at line 76 of file SkeletalAnimatable.hpp.


The documentation for this struct was generated from the following files: