Reads in a byte array of an Animation Asset created by the SecondLife(tm) client.
コード例 #1
0
 public bool Equals(BinBVHAnimationReader other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other.Loop.Equals(Loop) && other.OutPoint == OutPoint && other.InPoint == InPoint && other.Length == Length && other.HandPose == HandPose && other.JointCount == JointCount && Equals(other.joints, joints) && other.EaseInTime == EaseInTime && other.EaseOutTime == EaseOutTime && other.Priority == Priority && other.unknown1 == unknown1 && other.unknown0 == unknown0 && other.positionkeys == positionkeys && other.rotationkeys == rotationkeys);
 }
コード例 #2
0
 public animationwrapper(BinBVHAnimationReader anim)
 {
     this.anim = anim;
     playstate = animstate.STATE_EASEIN;
     mRunTime = 0;
 }
コード例 #3
0
ファイル: BVHDecoder.cs プロジェクト: kf6kjg/halcyon
 public bool Equals(BinBVHAnimationReader other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other.Loop.Equals(Loop) && other.OutPoint == OutPoint && other.InPoint == InPoint && other.Length == Length && other.HandPose == HandPose && other.JointCount == JointCount && Equals(other.joints, joints) && other.EaseInTime == EaseInTime && other.EaseOutTime == EaseOutTime && other.Priority == Priority && other.unknown1 == unknown1 && other.unknown0 == unknown0 && other.positionkeys == positionkeys && other.rotationkeys == rotationkeys;
 }
コード例 #4
0
        // Add animations to the global decoded list
        // TODO garbage collect unused animations somehow
        public static void addanimation(OpenMetaverse.Assets.Asset asset, UUID tid, BinBVHAnimationReader b, UUID animKey)
        {
            RenderAvatar av;
            mAnimationTransactions.TryGetValue(tid, out av);
            if (av == null)
                return;

            mAnimationTransactions.Remove(tid);

            if (asset != null)
            {
                b = new BinBVHAnimationReader(asset.AssetData);
                mAnimationCache[asset.AssetID] = b;
                Logger.Log("Adding new decoded animaton known animations " + asset.AssetID.ToString(), Helpers.LogLevel.Info);
            }

            if (!av.glavatar.skel.mAnimationsWrapper.ContainsKey(animKey))
            {
                Logger.Log(String.Format("Animation {0} is not in mAnimationsWrapper! ", animKey), Helpers.LogLevel.Warning);
                return;
            }

            // This sets the anim in the wrapper class;
            av.glavatar.skel.mAnimationsWrapper[animKey].anim = b;

            int pos = 0;
            foreach (binBVHJoint joint in b.joints)
            {
                binBVHJointState state;

                state.lastkeyframe_rot = 0;
                state.nextkeyframe_rot = 1;

                state.lastkeyframe_pos = 0;
                state.nextkeyframe_pos = 1;

                state.currenttime_rot = 0;
                state.currenttime_pos = 0;

                state.pos_loopinframe = 0;
                state.pos_loopoutframe = joint.positionkeys.Length - 1;

                state.rot_loopinframe = 0;
                state.rot_loopoutframe = joint.rotationkeys.Length - 1;

                state.easeoutfactor = 1.0f;
                state.easeoutrot = Quaternion.Identity;

                if (b.Loop == true)
                {
                    int frame = 0;
                    foreach (binBVHJointKey key in joint.rotationkeys)
                    {
                        if (key.time == b.InPoint)
                        {
                            state.rot_loopinframe = frame;
                        }

                        if (key.time == b.OutPoint)
                        {
                            state.rot_loopoutframe = frame;
                        }

                        frame++;
                    }

                    frame = 0;
                    foreach (binBVHJointKey key in joint.positionkeys)
                    {
                        if (key.time == b.InPoint)
                        {
                            state.pos_loopinframe = frame;
                        }

                        if (key.time == b.OutPoint)
                        {
                            state.pos_loopoutframe = frame;
                        }

                        frame++;
                    }

                }

                b.joints[pos].Tag = state;
                pos++;
            }

            av.glavatar.skel.mAnimationsWrapper[animKey].playstate = animationwrapper.animstate.STATE_EASEIN;
            recalcpriorities(av);
        }
コード例 #5
0
        // Add animations to the global decoded list
        // TODO garbage collect unused animations somehow
        public static void addanimation(OpenMetaverse.Assets.Asset asset,UUID tid, BinBVHAnimationReader b)
        {
            RenderAvatar av;
            mAnimationTransactions.TryGetValue(tid, out av);
            if (av == null)
                return;

            mAnimationTransactions.Remove(tid);

            if (asset != null)
            {
                b = new BinBVHAnimationReader(asset.AssetData);
                mAnimationCache[asset.AssetID] = b;
                Logger.Log("Adding new decoded animaton known animations " + asset.AssetID.ToString(), Helpers.LogLevel.Info);
            }

            int pos=0;
            foreach (binBVHJoint joint in b.joints)
            {
                binBVHJointState state;

                state.lastkeyframe_rot = 0;
                state.nextkeyframe_rot = 1;

                state.lastkeyframe_pos = 0;
                state.nextkeyframe_pos = 1;

                state.currenttime_rot = 0;
                state.currenttime_pos = 0;

                state.loopinframe = 0;
                state.loopoutframe = joint.rotationkeys.Length - 1;

                if (b.Loop == true)
                {
                    int frame=0;
                    foreach( binBVHJointKey key in joint.rotationkeys)
                    {
                        if (key.time == b.InPoint)
                        {
                            state.loopinframe = frame;
                        }

                        if (key.time == b.OutPoint)
                        {
                            state.loopoutframe = frame;
                        }

                        frame++;

                    }

                }

                b.joints[pos].Tag = state;
                pos++;
            }

            lock (av.glavatar.skel.mAnimations)
            {
                av.glavatar.skel.mAnimations.Add(b);
            }
        }