Exemplo n.º 1
0
        private bool parseFrame(Parser p)
        {
            int frameIndex;

            if (p.readInt(out frameIndex))
            {
                return(true);
            }
            if (frameIndex != frames.Count)
            {
                return(true);
            }
            if (p.isAtToken("{") == false)
            {
                return(true);
            }
            MD5AnimFrame f = new MD5AnimFrame();

            for (int i = 0; i < numAnimatedComponents; i++)
            {
                float val;
                if (p.readFloat(out val))
                {
                    return(true);
                }
                f.addValue(val);
            }
            if (p.isAtToken("}") == false)
            {
                return(true);
            }
            frames.Add(f);
            return(false);
        }
Exemplo n.º 2
0
        public bool buildFrameLocalBone(int frameIndex, int jointIndex, out Quat q, out Vec3 v)
        {
            MD5AnimFrame f = frames[frameIndex];
            MD5AnimJoint j = animJoints[jointIndex];

            v = j.getLocalOfs();
            q = j.getLocalRot();
            int flags        = j.getComponentFlags();
            int componentOfs = j.getFirstComponent();

            if ((flags & 1) != 0)
            { // animated X component
                v.setX(f.getValue(componentOfs));
                componentOfs++;
            }
            if ((flags & 2) != 0)
            { // animated Y component
                v.setY(f.getValue(componentOfs));
                componentOfs++;
            }
            if ((flags & 4) != 0)
            { // animated Z component
                v.setZ(f.getValue(componentOfs));
                componentOfs++;
            }
            if ((flags & 8) != 0)
            { // animated QUAT X component
                q.setX(f.getValue(componentOfs));
                componentOfs++;
            }
            if ((flags & 16) != 0)
            { // animated QUAT Y component
                q.setY(f.getValue(componentOfs));
                componentOfs++;
            }
            if ((flags & 32) != 0)
            { // animated QUAT Z component
                q.setZ(f.getValue(componentOfs));
                componentOfs++;
            }
            q.calculateW();
            return(false);
        }