Exemplo n.º 1
0
        public Vector3 CalcVertexPosition(Md5Vertex v, Md5Joint[] joints)
        {
            Vector3 pos = Vector3.Zero;

            for (int i = v.WeightIndex; i < v.WeightIndex + v.WeightCount; ++i)
            {
                Md5Weight w = Weights[i];
                Md5Joint  j = joints[w.JointIndex];

                pos += w.Value * Transform(w.Position, j);
            }

            return(pos);
        }
Exemplo n.º 2
0
        public Vector3 CalcVertexPosition(Md5Vertex v, Md5Anim a, int frame)
        {
            Vector3 pos = Vector3.Zero;

            for (int i = v.WeightIndex; i < v.WeightIndex + v.WeightCount; ++i)
            {
                Md5Weight     w = Weights[i];
                Md5JointValue j = a.Frames[frame].Values[w.JointIndex];

                Matrix4 m = Matrix4Extensions.FromTranslation(j.Position) * Matrix4Extensions.FromQuaternion(j.Orientation);
                pos += w.Value * Vector3.Transform(w.Position, m);
            }

            return(pos);
        }