minor .vb model reader break up

This commit is contained in:
devZoGok
2021-10-19 19:06:41 +03:00
parent 0614f7b034
commit 10cd0af99a
7 changed files with 485 additions and 143 deletions
+6 -5
View File
@@ -29,21 +29,22 @@ namespace vb01{
Vector3 boneIkPos[chainLength];
Vector3 targetPos = rootBone->globalToLocalPosition(ikTarget->localToGlobalPosition(Vector3::VEC_ZERO));
float sumLengths = 0;
for(int i = 0; i < chainLength; i++){
sumLengths += ikBoneAncestor->getLength();
boneChain[i] = ikBoneAncestor;
ikBoneAncestor = (Bone*)ikBoneAncestor->getParent();
boneIkPos[i] = boneChain[i]->getModelSpacePos();
}
calculateFabrik(chainLength, boneChain, boneIkPos, targetPos, sumLengths);
calculateFabrik(chainLength, boneChain, boneIkPos, targetPos);
transformIkChain(chainLength, boneChain, boneIkPos, targetPos);
}
void Skeleton::calculateFabrik(int chainLength, Bone *boneChain[], Vector3 boneIkPos[], Vector3 targetPos, float sumLengths){
void Skeleton::calculateFabrik(int chainLength, Bone *boneChain[], Vector3 boneIkPos[], Vector3 targetPos){
float sumLengths = 0;
for(int i = 0; i < chainLength; i++)
sumLengths += boneChain[i]->getLength();
Vector3 startPos = boneChain[chainLength - 1]->getModelSpacePos();
if(startPos.getDistanceFrom(targetPos) < sumLengths){
int numIterations = 200;