Struct blender_armature::BlenderArmature [−][src]
pub struct BlenderArmature { pub joint_index: HashMap<String, u8>, pub inverse_bind_poses: Vec<Bone>, pub actions: HashMap<String, Vec<Keyframe>>, }
All of the data about a Blender armature that we've exported from Blender. A BlenderArmature should have all of the data that you need to implement skeletal animation.
If you have other needs, such as a way to know the model space position of any bone at any time so that you can, say, render a baseball in on top of your hand bone.. Open an issue. (I plan to support this specific example in the future)
Fields
joint_index: HashMap<String, u8>
inverse_bind_poses: Vec<Bone>
actions: HashMap<String, Vec<Keyframe>>
Methods
impl BlenderArmature
[src]
impl BlenderArmature
pub fn interpolate_bones(
&self,
opts: &InterpolationSettings
) -> HashMap<u8, Bone>
[src]
pub fn interpolate_bones(
&self,
opts: &InterpolationSettings
) -> HashMap<u8, Bone>
Interpolate in between the keyframes of your BlenderArmature. This is useful for skeletal animation.
We return a hashmap so that you can easily merge the results of interpolating different sets of bone groups.
Panics
We don't yet support interpolating matrix bones, so we panic if your bones aren't dual quaternions.
Panics if you pass in previous actions that do not have the exact same joint indices as your current action.
impl BlenderArmature
[src]
impl BlenderArmature
pub fn from_json(json_str: &str) -> Result<BlenderArmature, Error>
[src]
pub fn from_json(json_str: &str) -> Result<BlenderArmature, Error>
Given a string of JSON we deserialize a BlenderArmature. This is here as a convenience
since we already depend on serde anyway.
In a real application you might want to serialize and deserialize to a smaller file
format.. such as bincode
.
pub fn matrix_to_dual_quat(bone: &Bone) -> Bone
[src]
pub fn matrix_to_dual_quat(bone: &Bone) -> Bone
Convert a matrix into a dual quaternion
https://github.com/chinedufn/mat4-to-dual-quat/blob/master/src/mat4-to-dual-quat.js
Note that we use w, x, y, z
and not x, y, z, w
for our quaternion representation
pub fn dual_quat_to_matrix(bone: &Bone) -> Bone
[src]
pub fn dual_quat_to_matrix(bone: &Bone) -> Bone
https://github.com/chinedufn/dual-quat-to-mat4/blob/master/src/dual-quat-to-mat4.js
impl BlenderArmature
[src]
impl BlenderArmature
pub fn apply_inverse_bind_poses(&mut self)
[src]
pub fn apply_inverse_bind_poses(&mut self)
Iterate over all of the action bones and apply and multiply in the inverse bind pose.
TODO: another function to apply bind shape matrix? Most armatures seem to export an identity bind shape matrix but that might not be the same for every armature.
pub fn transpose_actions(&mut self)
[src]
pub fn transpose_actions(&mut self)
Tranpose all of the bone matrices in our armature's action keyframes. Blender uses row major matrices, but OpenGL uses column major matrices so you'll usually want to transpose your matrices before using them.
impl BlenderArmature
[src]
impl BlenderArmature
pub fn actions_to_dual_quats(&mut self)
[src]
pub fn actions_to_dual_quats(&mut self)
Convert your action matrices into dual quaternions so that you can implement dual quaternion linear blending.
Trait Implementations
impl Debug for BlenderArmature
[src]
impl Debug for BlenderArmature
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for BlenderArmature
[src]
impl PartialEq for BlenderArmature
fn eq(&self, other: &BlenderArmature) -> bool
[src]
fn eq(&self, other: &BlenderArmature) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &BlenderArmature) -> bool
[src]
fn ne(&self, other: &BlenderArmature) -> bool
This method tests for !=
.
Auto Trait Implementations
impl Send for BlenderArmature
impl Send for BlenderArmature
impl Sync for BlenderArmature
impl Sync for BlenderArmature