Skip to content

[Feature] Skeleton and bone hierarchy #160

@vmarcella

Description

@vmarcella

Overview

Add a skeleton data structure representing a hierarchy of bones for skeletal
animation.

Current State

No response

Scope

Goals:

  • Bone structure with parent references
  • Local and world transform per bone
  • Bind pose (rest pose) storage
  • Pose application

Non-Goals:

  • Animation playback
  • Skinning/mesh deformation
  • IK

Proposed API

impl Skeleton {
pub fn new(bones: Vec) -> Self;
pub fn bone_count(&self) -> usize;
pub fn bone(&self, index: usize) -> &Bone;
pub fn find_bone(&self, name: &str) -> Option;
pub fn parent(&self, index: usize) -> Option;
}

pub struct Pose {
local_transforms: Vec,
world_matrices: Vec<[[f32; 4]; 4]>,
}

impl Pose {
pub fn from_skeleton(skeleton: &Skeleton) -> Self;
pub fn set_local(&mut self, bone: usize, transform: Transform);
pub fn compute_world_matrices(&mut self, skeleton: &Skeleton);
pub fn skin_matrices(&self, skeleton: &Skeleton) -> Vec<[[f32; 4]; 4]>;
}


### Acceptance Criteria

- [ ] Skeleton stores bone hierarchy
- [ ] Bones reference parents by index
- [ ] Pose stores per-bone transforms
- [ ] World matrices computed from hierarchy
- [ ] Skin matrices combine world and inverse bind

### Affected Crates

lambda-rs

### Notes

- Inverse bind = inverse of bind pose world matrix
- Skin matrix = world * inverse_bind

Metadata

Metadata

Assignees

No one assigned

    Labels

    animationAll things related to animationsenhancementNew feature or requestlambda-rsIssues pertaining to the core framework

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions