void Skeleton::UpdateBone(Gfx::pbone_t parentBone, Gfx::pbone_t currBone, std::vector<VertLine> &lineBuffer)
{
if (parentBone)
currBone->localMatrix_ = currBone->refMatrix_ * parentBone->localMatrix_;
else
currBone->localMatrix_ = currBone->refMatrix_;
currBone->finalMatrix_ = currBone->skinMatrix_ * currBone->localMatrix_;
//Loop through all children and call UpdateBone on the bones
for (uint32_t i=0; i < currBone->children_.size(); ++i)
UpdateBone(currBone, currBone->children_, lineBuffer);
}
format of frame transform matrices in .x files??
So, I'm writing a directX x file parser that will load into my 3DModel class in c++. The idea is that if I write a parser (w/o using specific dX functions) I will be API independent. Anyways, I loaded in the mesh fine, but I'm having a HUGE amount of trouble trying to skin it... or even display the bones correctly. I'm using the generic "Tiny" model to test all my code. So.. my problem is that I'm not sure what the matrices I'm reading in actually mean. I've read a lot on skinning, but can't figure it out for this specific file format. Do the matrices describe transformations relative to the parent bone? Are they relative to the initial root bone? My code right now looks like this::
Line buffer is the array of points to express the bones as lines, but I removed the code for cleanliness
Here, refMatrix refers to the reference pose matrix (that I read in from the FrameTransformation template), and skinMatrix refers to the matrix read in from the SkinWeight template. Am I doing something wrong? I feel like I've tried all possible combinations of matrices and it just won't work... I'm created small x files to try contrived examples of bone linking (right angles and stuff) and it works fine... any ideas?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement