Пример #1
0
        public BinBVHAnimation GenerateRandomAnimation()
        {
            int             rnditerations = 3;
            BinBVHAnimation anim          = new BinBVHAnimation();
            List <string>   parts         = new List <string>();

            parts.Add("mPelvis"); parts.Add("mHead"); parts.Add("mTorso");
            parts.Add("mHipLeft"); parts.Add("mHipRight"); parts.Add("mHipLeft"); parts.Add("mKneeLeft");
            parts.Add("mKneeRight"); parts.Add("mCollarLeft"); parts.Add("mCollarRight"); parts.Add("mNeck");
            parts.Add("mElbowLeft"); parts.Add("mElbowRight"); parts.Add("mWristLeft"); parts.Add("mWristRight");
            parts.Add("mShoulderLeft"); parts.Add("mShoulderRight"); parts.Add("mAnkleLeft"); parts.Add("mAnkleRight");
            parts.Add("mEyeRight"); parts.Add("mChest"); parts.Add("mToeLeft"); parts.Add("mToeRight");
            parts.Add("mFootLeft"); parts.Add("mFootRight"); parts.Add("mEyeLeft");
            anim.HandPose       = 1;
            anim.InPoint        = 0;
            anim.OutPoint       = (rnditerations * .10f);
            anim.Priority       = 7;
            anim.Loop           = false;
            anim.Length         = (rnditerations * .10f);
            anim.ExpressionName = "afraid";
            anim.EaseInTime     = 0;
            anim.EaseOutTime    = 0;

            string[] strjoints = parts.ToArray();
            anim.Joints = new binBVHJoint[strjoints.Length];
            for (int j = 0; j < strjoints.Length; j++)
            {
                anim.Joints[j]              = new binBVHJoint();
                anim.Joints[j].Name         = strjoints[j];
                anim.Joints[j].Priority     = 7;
                anim.Joints[j].positionkeys = new binBVHJointKey[rnditerations];
                anim.Joints[j].rotationkeys = new binBVHJointKey[rnditerations];
                Random rnd = new Random();
                for (int i = 0; i < rnditerations; i++)
                {
                    anim.Joints[j].rotationkeys[i]               = new binBVHJointKey();
                    anim.Joints[j].rotationkeys[i].time          = (i * .10f);
                    anim.Joints[j].rotationkeys[i].key_element.X = ((float)rnd.NextDouble() * 2 - 1);
                    anim.Joints[j].rotationkeys[i].key_element.Y = ((float)rnd.NextDouble() * 2 - 1);
                    anim.Joints[j].rotationkeys[i].key_element.Z = ((float)rnd.NextDouble() * 2 - 1);
                    anim.Joints[j].positionkeys[i]               = new binBVHJointKey();
                    anim.Joints[j].positionkeys[i].time          = (i * .10f);
                    anim.Joints[j].positionkeys[i].key_element.X = 0;
                    anim.Joints[j].positionkeys[i].key_element.Y = 0;
                    anim.Joints[j].positionkeys[i].key_element.Z = 0;
                }
            }

            AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation, m_scenePresence.UUID.ToString());

            Animasset.Data        = anim.ToBytes();
            Animasset.Temporary   = true;
            Animasset.Local       = true;
            Animasset.Description = "dance";
            //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data);

            m_scenePresence.Scene.AssetService.Store(Animasset);
            AddAnimation(Animasset.FullID, m_scenePresence.UUID);
            return(anim);
        }
        public BinBVHAnimation GenerateRandomAnimation()
        {
            int             rnditerations = 3;
            BinBVHAnimation anim          = new BinBVHAnimation();
            List <string>   parts         = new List <string>();

            /// Torso and Head
            parts.Add("mPelvis");
            parts.Add("mTorso");
            parts.Add("mChest");
            parts.Add("mNeck");
            parts.Add("mHead");
            parts.Add("mSkull");
            parts.Add("mEyeRight");
            parts.Add("mEyeLeft");
            /// Arms
            parts.Add("mCollarLeft");
            parts.Add("mShoulderLeft");
            parts.Add("mElbowLeft");
            parts.Add("mWristLeft");
            parts.Add("mCollarRight");
            parts.Add("mShoulderRight");
            parts.Add("mElbowRight");
            parts.Add("mWristRight");
            /// Legs
            parts.Add("mHipLeft");
            parts.Add("mKneeLeft");
            parts.Add("mAnkleLeft");
            parts.Add("mFootLeft");
            parts.Add("mToeLeft");
            parts.Add("mHipRight");
            parts.Add("mKneeRight");
            parts.Add("mAnkleRight");
            parts.Add("mFootRight");
            parts.Add("mToeRight");
            ///Hands
            parts.Add("mHandThumb1Left");
            parts.Add("mHandThumb1Right");
            parts.Add("mHandThumb2Left");
            parts.Add("mHandThumb2Right");
            parts.Add("mHandThumb3Left");
            parts.Add("mHandThumb3Right");
            parts.Add("mHandIndex1Left");
            parts.Add("mHandIndex1Right");
            parts.Add("mHandIndex2Left");
            parts.Add("mHandIndex2Right");
            parts.Add("mHandIndex3Left");
            parts.Add("mHandIndex3Right");
            parts.Add("mHandMiddle1Left");
            parts.Add("mHandMiddle1Right");
            parts.Add("mHandMiddle2Left");
            parts.Add("mHandMiddle2Right");
            parts.Add("mHandMiddle3Left");
            parts.Add("mHandMiddle3Right");
            parts.Add("mHandRing1Left");
            parts.Add("mHandRing1Right");
            parts.Add("mHandRing2Left");
            parts.Add("mHandRing2Right");
            parts.Add("mHandRing3Left");
            parts.Add("mHandRing3Right");
            parts.Add("mHandPinky1Left");
            parts.Add("mHandPinky1Right");
            parts.Add("mHandPinky2Left");
            parts.Add("mHandPinky2Right");
            parts.Add("mHandPinky3Left");
            parts.Add("mHandPinky3Right");
            ///Face
            parts.Add("mFaceForeheadLeft");
            parts.Add("mFaceForeheadCenter");
            parts.Add("mFaceForeheadRight");
            parts.Add("mFaceEyebrowOuterLeft");
            parts.Add("mFaceEyebrowCenterLeft");
            parts.Add("mFaceEyebrowInnerLeft");
            parts.Add("mFaceEyebrowOuterRight");
            parts.Add("mFaceEyebrowCenterRight");
            parts.Add("mFaceEyebrowInnerRight");
            parts.Add("mFaceEyeLidUpperLeft");
            parts.Add("mFaceEyeLidLowerLeft");
            parts.Add("mFaceEyeLidUpperRight");
            parts.Add("mFaceEyeLidLowerRight");
            parts.Add("mFaceEyeAltLeft");
            parts.Add("mFaceEyeAltRight");
            parts.Add("mFaceEyecornerInnerLeft");
            parts.Add("mFaceEyecornerInnerRight");
            parts.Add("mFaceEar1Left");
            parts.Add("mFaceEar2Left");
            parts.Add("mFaceEar1Right");
            parts.Add("mFaceEar2Right");
            parts.Add("mFaceNoseLeft");
            parts.Add("mFaceNoseCenter");
            parts.Add("mFaceNoseRight");
            parts.Add("mFaceNoseBase");
            parts.Add("mFaceNoseBridge");
            parts.Add("mFaceCheekUpperInnerLeft");
            parts.Add("mFaceCheekUpperOuterLeft");
            parts.Add("mFaceCheekUpperInnerRight");
            parts.Add("mFaceCheekUpperOuterRight");
            parts.Add("mFaceJaw");
            parts.Add("mFaceLipUpperLeft");
            parts.Add("mFaceLipUpperCenter");
            parts.Add("mFaceLipUpperRight");
            parts.Add("mFaceLipCornerLeft");
            parts.Add("mFaceLipCornerRight");
            parts.Add("mFaceTongueBase");
            parts.Add("mFaceTongueTip");
            parts.Add("mFaceLipLowerLeft");
            parts.Add("mFaceLipLowerCenter");
            parts.Add("mFaceLipLowerRight");
            parts.Add("mFaceTeethLower");
            parts.Add("mFaceTeethUpper");
            parts.Add("mFaceChin");
            ///Spine
            parts.Add("mSpine1");
            parts.Add("mSpine2");
            parts.Add("mSpine3");
            parts.Add("mSpine4");
            ///Wings
            parts.Add("mWingsRoot");
            parts.Add("mWing1Left");
            parts.Add("mWing2Left");
            parts.Add("mWing3Left");
            parts.Add("mWing4Left");
            parts.Add("mWing1Right");
            parts.Add("mWing2Right");
            parts.Add("mWing3Right");
            parts.Add("mWing4Right");
            parts.Add("mWing4FanRight");
            parts.Add("mWing4FanLeft");
            ///Hind Limbs
            parts.Add("mHindLimbsRoot");
            parts.Add("mHindLimb1Left");
            parts.Add("mHindLimb2Left");
            parts.Add("mHindLimb3Left");
            parts.Add("mHindLimb4Left");
            parts.Add("mHindLimb1Right");
            parts.Add("mHindLimb2Right");
            parts.Add("mHindLimb3Right");
            parts.Add("mHindLimb4Right");
            ///Tail
            parts.Add("mTail1");
            parts.Add("mTail2");
            parts.Add("mTail3");
            parts.Add("mTail4");
            parts.Add("mTail5");
            parts.Add("mTail6");

            anim.HandPose       = 1;
            anim.InPoint        = 0;
            anim.OutPoint       = (rnditerations * .10f);
            anim.Priority       = 7;
            anim.Loop           = false;
            anim.Length         = (rnditerations * .10f);
            anim.ExpressionName = "afraid";
            anim.EaseInTime     = 0;
            anim.EaseOutTime    = 0;

            string[] strjoints = parts.ToArray();
            anim.Joints = new binBVHJoint[strjoints.Length];
            for (int j = 0; j < strjoints.Length; j++)
            {
                anim.Joints[j]              = new binBVHJoint();
                anim.Joints[j].Name         = strjoints[j];
                anim.Joints[j].Priority     = 7;
                anim.Joints[j].positionkeys = new binBVHJointKey[rnditerations];
                anim.Joints[j].rotationkeys = new binBVHJointKey[rnditerations];
                Random rnd = new Random();
                for (int i = 0; i < rnditerations; i++)
                {
                    anim.Joints[j].rotationkeys[i]               = new binBVHJointKey();
                    anim.Joints[j].rotationkeys[i].time          = (i * .10f);
                    anim.Joints[j].rotationkeys[i].key_element.X = ((float)rnd.NextDouble() * 2 - 1);
                    anim.Joints[j].rotationkeys[i].key_element.Y = ((float)rnd.NextDouble() * 2 - 1);
                    anim.Joints[j].rotationkeys[i].key_element.Z = ((float)rnd.NextDouble() * 2 - 1);
                    anim.Joints[j].positionkeys[i]               = new binBVHJointKey();
                    anim.Joints[j].positionkeys[i].time          = (i * .10f);
                    anim.Joints[j].positionkeys[i].key_element.X = 0;
                    anim.Joints[j].positionkeys[i].key_element.Y = 0;
                    anim.Joints[j].positionkeys[i].key_element.Z = 0;
                }
            }

            AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation, m_scenePresence.UUID.ToString());

            Animasset.Data        = anim.ToBytes();
            Animasset.Temporary   = true;
            Animasset.Local       = true;
            Animasset.Description = "dance";
            //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data);

            m_scenePresence.Scene.AssetService.Store(Animasset);
            AddAnimation(Animasset.FullID, m_scenePresence.UUID);
            return(anim);
        }
        public BinBVHAnimation GenerateRandomAnimation()
        {
            int rnditerations = 3;
            BinBVHAnimation anim = new BinBVHAnimation();
            List<string> parts = new List<string>();
            parts.Add("mPelvis");parts.Add("mHead");parts.Add("mTorso");
            parts.Add("mHipLeft");parts.Add("mHipRight");parts.Add("mHipLeft");parts.Add("mKneeLeft");
            parts.Add("mKneeRight");parts.Add("mCollarLeft");parts.Add("mCollarRight");parts.Add("mNeck");
            parts.Add("mElbowLeft");parts.Add("mElbowRight");parts.Add("mWristLeft");parts.Add("mWristRight");
            parts.Add("mShoulderLeft");parts.Add("mShoulderRight");parts.Add("mAnkleLeft");parts.Add("mAnkleRight");
            parts.Add("mEyeRight");parts.Add("mChest");parts.Add("mToeLeft");parts.Add("mToeRight");
            parts.Add("mFootLeft");parts.Add("mFootRight");parts.Add("mEyeLeft");
            anim.HandPose = 1;
            anim.InPoint = 0;
            anim.OutPoint = (rnditerations * .10f);
            anim.Priority = 7;
            anim.Loop = false;
            anim.Length = (rnditerations * .10f);
            anim.ExpressionName = "afraid";
            anim.EaseInTime = 0;
            anim.EaseOutTime = 0;

            string[] strjoints = parts.ToArray();
            anim.Joints = new binBVHJoint[strjoints.Length];
            for (int j = 0; j < strjoints.Length; j++)
            {
                anim.Joints[j] = new binBVHJoint();
                anim.Joints[j].Name = strjoints[j];
                anim.Joints[j].Priority = 7;
                anim.Joints[j].positionkeys = new binBVHJointKey[rnditerations];
                anim.Joints[j].rotationkeys = new binBVHJointKey[rnditerations];
                Random rnd = new Random();
                for (int i = 0; i < rnditerations; i++)
                {
                    anim.Joints[j].rotationkeys[i] = new binBVHJointKey();
                    anim.Joints[j].rotationkeys[i].time = (i*.10f);
                    anim.Joints[j].rotationkeys[i].key_element.X = ((float) rnd.NextDouble()*2 - 1);
                    anim.Joints[j].rotationkeys[i].key_element.Y = ((float) rnd.NextDouble()*2 - 1);
                    anim.Joints[j].rotationkeys[i].key_element.Z = ((float) rnd.NextDouble()*2 - 1);
                    anim.Joints[j].positionkeys[i] = new binBVHJointKey();
                    anim.Joints[j].positionkeys[i].time = (i*.10f);
                    anim.Joints[j].positionkeys[i].key_element.X = 0;
                    anim.Joints[j].positionkeys[i].key_element.Y = 0;
                    anim.Joints[j].positionkeys[i].key_element.Z = 0;
                }
            }

            AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation, m_scenePresence.UUID.ToString());
            Animasset.Data = anim.ToBytes();
            Animasset.Temporary = true;
            Animasset.Local = true;
            Animasset.Description = "dance";
            //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data);

            m_scenePresence.Scene.AssetService.Store(Animasset);
            AddAnimation(Animasset.FullID, m_scenePresence.UUID);
            return anim;
        }