public void buildVertices(IBoneOrientations currentBones) { foreach (MD5Vertex v in vertices) { Vec3 pos = new Vec3(); pos.set(0, 0, 0); for (int i = 0; i < v.getNumWeights(); i++) { MD5Weight w = weights[v.getFirstWeightIndex() + i]; Quat q = currentBones.getBoneQuat(w.getBoneIndex()); Vec3 p = currentBones.getBonePos(w.getBoneIndex()); // get weight position rotated by joint quaternion Vec3 ofsRotated = q.rotatePoint(w.getOfs()); // get weight position in world coordinates Vec3 ofsWorld = ofsRotated + p; pos += ofsWorld * w.getWeight(); } v.setCurrentPos(pos); } }
public void addWeight(MD5Weight w) { weights.Add(w); }