This addon was began as an example in the Perfume Global Project written by Satoru Higa but has since been rewritten from scratch. The new version maintains some of the old functionality but also adds some important features.
- Faster file loading than before.
- Writing from modified skeletons back to motion data.
- Saving BVH files.
- Supports multiple (but not all) BVH formats.
- Playback doesn't accumulate error.
- Doesn't report all file reading errors.
- Playing in reverse past the beginning is undefined, but will not crash.
- Only loads one ROOT hierarchy per file (same as original addon).
Modifying matrices and raw data
Motion data in a BVH files is a list of real numbers (
double precision). ofxBvh converts this into local and global matrices. If you manually modify the
ofxBvhJoint::localMat, you should call
ofxBvh::update() to keep everything in sync. If you manually modify
ofxBvhJoint::raw data, you should call
ofxBvh::update() to keep everything in sync. More thoroughly, there are four representations:
- From 1 to 2:
- From 2 to 1:
- From 2 to 3 to 4:
- From 4 to 3 to 2:
- From 2 to 3:
- From 3 to 4:
- From 4 to 3:
- From 3 to 2:
Porting old ofxBvh code
ofxBvh::load() has been replaced by a constructor. Instead of
bvh = ofxBvh("...").
ofxBvh::unload() is not needed anymore and has been removed.
Some variables that are safe to read/write from have been made public, and methods for accessing them have been removed. ofxBvh now returns raw glm objects instead of
ofQuaternion, but openFrameworks will make the conversion automatically.
ofxBvh::getNumJoints(); // ofxBvh::getJoints().size() ofxBvh::getJoint(int i); // ofxBvh::getJoints()[i] ofxBvhJoint::getName(); // ofxBvhJoint::name ofxBvhJoint::getOffset(); // ofxBvhJoint::offset ofxBvhJoint::getMatrix(); // ofxBvhJoint::localMat ofxBvhJoint::getGlobalMatrix(); // ofxBvhJoint::globalMat