00001 #include "Skinvert.h"
00002 #include "math/matrix34.h"
00003
00004 void SkinVert::SetPosition(Vector3 &_pos)
00005 {
00006 pos = _pos;
00007 }
00008
00009 void SkinVert::SetNormal(Vector3 &_normal)
00010 {
00011 normal = _normal;
00012 }
00013
00014 void SkinVert::Update(BallJoint *joints)
00015 {
00016 int i;
00017 drawPos->Zero();
00018 drawNormal->Zero();
00019 SkinVertWeight *currWeight = weights;
00020 BallJoint *currJoint;
00021 for(i = 0; i < numWeights; i++)
00022 {
00023 currJoint = joints + currWeight->joint;
00024
00025 Vector3 toAdd = pos;
00026 currJoint->binding.Transform(toAdd, toAdd);
00027 currJoint->world.Transform(toAdd, toAdd);
00028 toAdd.Scale(currWeight->weight);
00029 drawPos->Add(toAdd);
00030
00031
00032 toAdd = normal;
00033 currJoint->binding.Transform3x3(toAdd, toAdd);
00034 currJoint->world.Transform3x3(toAdd, toAdd);
00035 toAdd.Scale(currWeight->weight);
00036 drawNormal->Add(toAdd);
00037
00038 currWeight++;
00039 }
00040 drawNormal->Normalize();
00041 }