StartClip() public method

Starts decoding the specified animation clip.
public StartClip ( SkinnedModel.AnimationClip clip ) : void
clip SkinnedModel.AnimationClip
return void
コード例 #1
0
        SkinningData skinningData; // Skinning Data

        #endregion Fields

        #region Constructors

        /// <summary>
        /// ModelGeo with animation
        /// </summary>
        /// <param name="Go"></param>
        /// <param name="modelResource"></param>
        /// <param name="AniClip"></param>
        public ModelGeoAnim(GameObject Go, string modelResource, string AniClip)
            : base(Go, modelResource)
        {
            // Look up our custom skinning information.
            skinningData = mModel.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("Model '" + modelResource + "' does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip = skinningData.AnimationClips[AniClip];
            animationPlayer.StartClip(clip);

            //boneTransforms = new Matrix[skinningData.BindPose.Count];
            //animationPlayer.GetBoneTransforms().CopyTo(boneTransforms, 0);
            //mMatBones = animationPlayer.GetBoneTransforms();
            BoneTransformTemp = new Matrix[skinningData.BindPose.Count];

            animationPlayer.Update(new TimeSpan(0, 0, 0), true, mMatWorld);

            InitBoundingSpheres();
            UpdateBoundingBox();
        }
コード例 #2
0
        public StageData(int stageNumber)
        {
            // Reading of the data model
            this.LoadStage(stageNumber);

            this.active = false;

            // Initialization of each value
            this.pos = Vector3.Zero;
            this.scale = Vector3.One;
            this.rotation = Vector3.Zero;

            // Is not the first animation
            this.isPlayAnimation = false;

            // Get skinning data model
            SkinningData skinningData = Model_Stage.Tag as SkinningData;
            // Creating animation player
            animationPlayer = new AnimationPlayer(skinningData);
            // Set of animation
            AnimationClip clip = skinningData.AnimationClips["Take 001"];
            animationPlayer.StartClip(clip);

            shadow = new Shadows();
            shadow.Initialize();
        }
コード例 #3
0
ファイル: SpawnVortex.cs プロジェクト: Thinny-Hendrix/MoonCow
        public SpawnVortex(Vector3 pos, Vector3 rot, Game1 game)
            : base()
        {
            this.pos = pos;
            this.rot = rot;
            this.game = game;
            model = ModelLibrary.vortex;
            tex = game.Content.Load<Texture2D>(@"Models/Enemies/SpawnPoint/spiraltest");
            scale = new Vector3(0.8f,0.8f,0.7f);

            SkinningData skinningData = ModelLibrary.vortex.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animPlayer = new AnimationPlayer(skinningData);

            animClip = skinningData.AnimationClips["Take 001"];

            animPlayer.StartClip(animClip);

            SetupEffects();

            sb = new SpriteBatch(game.GraphicsDevice);
            targ1 = new RenderTarget2D(game.GraphicsDevice, 1024, 1024);
            targ2 = new RenderTarget2D(game.GraphicsDevice, 1024, 1024);
            texPos = Vector2.Zero;
        }
コード例 #4
0
ファイル: OBJ.cs プロジェクト: GodLesZ/svn-dump
		public void SkinningSetting(string startPose) {
			mSkinningData = Model.Tag as SkinningData;
			if (mSkinningData == null) {
				throw new InvalidOperationException("This model does not contain a SkinningData tag.");
			}
			AnimationPlayer = new AnimationPlayer(mSkinningData);
			AnimationSpeed = 0.04f;
			AnimationClip clip = mSkinningData.AnimationClips[startPose];
			AnimationPlayer.StartClip(clip);
			mTemppose = startPose;
		}
コード例 #5
0
ファイル: NPC.cs プロジェクト: lestermo/A03_Maze
        // Load Content
        public static void LoadContent(ContentManager content)
        {
            model = content.Load<Model>("Model\\dude");

            skinData = model.Tag as SkinningData;
            if(skinData == null)
            {
                throw new InvalidOperationException("This model does not contain a SkinningData tag");
            }

            player = new AnimationPlayer(skinData);
            clip = skinData.AnimationClips["Take 001"];

            player.StartClip(clip);

            random = new Random();
        }
コード例 #6
0
ファイル: AnimatedEntity.cs プロジェクト: KleinerMensch/CR4VE
        public AnimatedEntity(Vector3 pos, String modelName, ContentManager cm, BoundingBox bound)
            : base(pos, modelName, cm, bound)
        {
            // Look up our custom skinning information.
            SkinningData skinningData = model.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip = skinningData.AnimationClips["Take 001"/*Name der Animation*/];

            animationPlayer.StartClip(clip);
        }
コード例 #7
0
ファイル: AnimatedModel.cs プロジェクト: myko/tempusfugit
        public AnimatedModel(Model model)
        {
            this.Model = model;

            // Look up our custom skinning information.
            SkinningData skinningData = model.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            AnimationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip = skinningData.AnimationClips["Take 001"];

            AnimationPlayer.StartClip(clip);
            AnimationPlayer.Update(TimeSpan.Zero, true, Matrix.Identity);
        }
コード例 #8
0
ファイル: SkinnedDemo.cs プロジェクト: Nailz/MonoGame-Samples
        /// <summary>
        /// Loads content for this demo.
        /// </summary>
        protected override void LoadContent()
        {
            sky = Game.Content.Load<Sky>("sky");
            dude = Game.Content.Load<Model>("dude");

            // Look up our custom skinning information.
            SkinningData skinningData = dude.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip = skinningData.AnimationClips["Take 001"];

            animationPlayer.StartClip(clip);
        }
コード例 #9
0
ファイル: AnimatedFBX.cs プロジェクト: denniskb/densepcl
        public AnimatedFBX(ContentManager cm, string name)
        {
            model = cm.Load<Model>(name);

            player = null;

            SkinningData skinningData = model.Tag as SkinningData;
            if (skinningData == null)
                return;

            if (skinningData.AnimationClips.Values.Count == 0)
                return;

            player = new AnimationPlayer(skinningData);
            foreach (AnimationClip clip in skinningData.AnimationClips.Values)
            {
                player.StartClip(clip);
                break;
            }
        }
コード例 #10
0
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            // Load the model.
            currentModel = game.Content.Load<Model>("VisualisationModels/manrigged");

            // Look up our custom skinning information.
            SkinningData skinningData = currentModel.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData, currentModel);

            AnimationClip clip = skinningData.AnimationClips["Take 001"];

            animationPlayer.StartClip(clip, startFrame);
        }
コード例 #11
0
 private void InitializeAnimationPlayer()
 {
     animationPlayer = new AnimationPlayer(mainModelSkinningData);
     AnimationClip clip = mainModelSkinningData.AnimationClips["Take 001"];
     animationPlayer.StartClip(clip);
 }
コード例 #12
0
        public Zombie(int health, int maxHealth, ZombieType type, ref Model modelwalk, ref Model modelatt, ref Model modelhurt, ref Model modeldie, Action<Entity, Entity> attackFunction, Func<Vector3, Vector3, PathFinding.Node> astarGetter)
            : base()
        {
            this.astarGetter = astarGetter;
            this.model = modelwalk;
            this.HealthPoints = health;
            this.MaxHealth = maxHealth;

            this.MaxVelocity = 0.04f;
            this.MaxAcceleration = 0.04f;
            if (type == ZombieType.Boss)
            {
                this.MaxVelocity *= 2;
                this.MaxAcceleration *= 2;
                this.modelRadius *= 2;
            }
            ArriveRadius = 1;
            FleeRadius = 30;
            TimeToTarget = 0.070f;
            RotationTimeToTarget = 0.00025f;
            InterpolationSpeed = 10;
            TargetRotation = 0.02f;
            SlowRotationThreshold = (float)Math.PI;
            SlowRadiusThreshold = (float)Math.PI * 3;
            MaxRotationSpeed = (float)Math.PI / 12;
            MaxRotationAcceleration = (float)Math.PI;

            PosState = EntityPositionState.SteeringWander;
            OrState = EntityOrientationState.Face;
            BehaviouralState = BehaviourState.Wander;

            zombieType = type;
            MeleeAttack = new Weapon(WeaponType.ZombieHands);
            RangedAttack = new Weapon(WeaponType.Vomit);
            if (type == ZombieType.Boss)
            {
                MeleeAttack.FirePower *= 2;
                RangedAttack.FirePower *= 2;
            }
            this.AttackFunction = attackFunction;
            lastAttackTime = 0;

            // Look up our custom skinning information. for walking
            skinningDatawalk = (SkinningData)modelwalk.Tag;

            if (skinningDatawalk == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayerwalk = new AnimationPlayer(skinningDatawalk);
            clipwalk = skinningDatawalk.AnimationClips["Take 001"];
            animationPlayerwalk.StartClip(clipwalk);

            // Look up our custom skinning information. for dying
            skinningDatadie = (SkinningData)modeldie.Tag;

            if (skinningDatadie == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayerdie = new AnimationPlayer(skinningDatadie);
            clipdie = skinningDatadie.AnimationClips["Take 001"];
            animationPlayerdie.StartClip(clipdie);

            // Look up our custom skinning information. for attacking
            skinningDataattack = (SkinningData)modelatt.Tag;

            if (skinningDataattack == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayerattack = new AnimationPlayer(skinningDataattack);
            clipattack = skinningDataattack.AnimationClips["Take 001"];
            animationPlayerattack.StartClip(clipattack);

            // Look up our custom skinning information. for hurting
            skinningDatahurt = (SkinningData)modelhurt.Tag;

            if (skinningDatahurt == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayerhurt = new AnimationPlayer(skinningDatahurt);
            cliphurt = skinningDatahurt.AnimationClips["Take 001"];
            animationPlayerhurt.StartClip(cliphurt);
        }
コード例 #13
0
        private void LoadAnimations()
        {
            // Create an animation player, and start decoding an animation clip.
            mIdleEnemy = new AnimationPlayer( mSkinData );

            mIdleClip = mSkinData.AnimationClips[ "Default Take" ];
            mIdleEnemy.StartClip( mIdleClip );
        }
コード例 #14
0
        protected override void LoadContent()
        {
            _model = Content.Load<Model>(_fileName);
            var skinningData = _model.Tag as SkinningData;
            if (skinningData != null)
            {
                _animationPlayer = new AnimationPlayer(skinningData);
                var clip = skinningData.AnimationClips["Take 001"];
                _animationPlayer.StartClip(clip);

                _bones = _animationPlayer.GetSkinTransforms();
            }
            else
            {
                _bones = new Matrix[_model.Bones.Count];
                _model.CopyAbsoluteBoneTransformsTo(_bones);
            }

            var bestFit = new BoundingSphere();
            foreach (var mesh in _model.Meshes)
            {
                if (bestFit.Contains(mesh.BoundingSphere) != ContainmentType.Contains)
                    bestFit = BoundingSphere.CreateMerged(bestFit, mesh.BoundingSphere);
            }

            _worldMatrix = Matrix.Identity;
            _viewMatrix = Matrix.CreateTranslation(bestFit.Center) * Matrix.CreateTranslation(0, -bestFit.Radius * 1.5f, -bestFit.Radius * 4);
            _projMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, GraphicsDevice.Viewport.AspectRatio, 0.1f, bestFit.Radius * 2 * 10.0f);

            foreach (var mesh in _model.Meshes)
            {
                foreach (var effect in mesh.Effects)
                {
                    var em = effect as IEffectMatrices;
                    em.World = _worldMatrix;
                    em.View = _viewMatrix;
                    em.Projection = _projMatrix;

                    var basic = effect as BasicEffect;
                    if (basic != null)
                        basic.EnableDefaultLighting();

                    var skinned = effect as SkinnedEffect;
                    if (skinned != null)
                        skinned.EnableDefaultLighting();
                }
            }
        }
コード例 #15
0
ファイル: AnimatedModel.cs プロジェクト: holtkampw/UH-Engine
        private void SetupModel()
        {
            // Look up our custom skinning information.
            skinningData = Model.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip = skinningData.AnimationClips["Take 001"];

            animationPlayer.StartClip(clip);
        }
コード例 #16
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            c = new Camera(this);
            Components.Add(c);

            // Load model
            m = Content.Load<Model>("pet_hippo");

            // Load textures into an array
            textures[0] = Content.Load<Texture2D>("hippo_blueeyes_default");
            textures[1] = Content.Load<Texture2D>("hippo_blueeyes_pink");
            textures[2] = Content.Load<Texture2D>("hippo_blueeyes_blue");
            textures[3] = Content.Load<Texture2D>("hippo_blueeyes_camo");

            skinningData = m.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            // Set clip to an animation track as written in the .fbx file
            clip = skinningData.AnimationClips["Dance"];

            // initialize animation
            animationPlayer.StartClip(clip);
            animating = true;
        }
コード例 #17
0
        public Hero(int health, int maxHealth, ref Model modelwalk, ref Model  modeldie, ref Model modelhurt, Action<Entity, Entity> actionFunction)
            : base()
        {
            this.model = modelwalk;
            this.HealthPoints = health;
            this.MaxHealth = maxHealth;
            this.Stance = AnimationStance.Standing;

            PowerupsList = new List<Powerup>();
            ItemsList = new Dictionary<Item, int>();
            WeaponsList = new Dictionary<Weapon, int>();
            this.ActionFunction = actionFunction;

            //get animations
            // Look up our custom skinning information. for walking

            skinningDatawalk = (SkinningData)modelwalk.Tag;

            if (skinningDatawalk == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayerwalk = new AnimationPlayer(skinningDatawalk);
            clipwalk = skinningDatawalk.AnimationClips["Take 001"];
            animationPlayerwalk.StartClip(clipwalk);

            // Look up our custom skinning information. for dying
            skinningDatadie = (SkinningData)modeldie.Tag;

            if (skinningDatadie == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayerdie = new AnimationPlayer(skinningDatadie);
            clipdie = skinningDatadie.AnimationClips["Take 001"];
            animationPlayerdie.StartClip(clipdie);

            // Look up our custom skinning information. for hurting
            skinningDatahurt = (SkinningData)modelhurt.Tag;

            if (skinningDatahurt == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayerhurt = new AnimationPlayer(skinningDatahurt);
            cliphurt = skinningDatahurt.AnimationClips["Take 001"];
            animationPlayerhurt.StartClip(cliphurt);

            //adding flanking info
            for (int i = 0; i < 6; i++)
            {
                slots[i] = new Node();
            }
        }
コード例 #18
0
ファイル: Butterfly.cs プロジェクト: rocketeer13/KinderKinect
        public void LoadContent(ContentManager content)
        {
            myModel = content.Load<Model>(@"Models\butterfly");
            SkinningData data = myModel.Tag as SkinningData;

            if (data == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(data);

            AnimationClip clip = data.AnimationClips["ArmatureAction_001"];

            animationPlayer.StartClip(clip);
            animationPlayer.Update(new TimeSpan(0, 0, 0, msOffset), true, Matrix.Identity);
        }
コード例 #19
0
ファイル: MysteryBox.cs プロジェクト: CaKlassen/Titanium
        /// <summary>
        /// load the mysterbox model and texture
        /// </summary>
        /// <param name="cm">the content manager</param>
        public void LoadModel(ContentManager cm)
        {
            myModel = cm.Load<Model>("Models/Box");
            texture = cm.Load<Texture2D>("Models/BoxUV");

            // Look up our custom skinning information.
            data = myModel.Tag as SkinningData;

            if (data == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(data);

            AnimationClip clip = data.AnimationClips["Armature|open_box"];
            animationPlayer.StartClip(clip);
        }
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {

               

            // Load the model.
            currentModel = Content.Load<Model>("dude");

            // Look up our custom skinning information.
            skinningData = currentModel.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            boneTransforms = new Matrix[skinningData.BindPose.Count];

            // Load the baseball bat model.
            baseballBat = Content.Load<Model>("baseballbat");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip = skinningData.AnimationClips["Take 001"];

            animationPlayer.StartClip(clip);

            // Load the bounding spheres.
            skinnedSpheres = Content.Load<SkinnedSphere[]>("CollisionSpheres");
            boundingSpheres = new BoundingSphere[skinnedSpheres.Length];

            spherePrimitive = new SpherePrimitive(GraphicsDevice, 1, 12);

            // Create a new SpriteBatch, which can be used to draw textures.
            napis = new SpriteBatch(GraphicsDevice);
            Font1 = Content.Load<SpriteFont>("napis1");



            this.port.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.serialPort1_DataReceived);
            port.Open();   
        }
コード例 #21
0
        protected override void LoadContent()
        {
            hippo = parent.Content.Load<Model>(@"hippo/pet_hippo");
            textures[0] = parent.Content.Load<Texture2D>(@"hippo/hippo_blueeyes_default");
            textures[1] = parent.Content.Load<Texture2D>(@"hippo/hippo_blueeyes_pink");
            textures[2] = parent.Content.Load<Texture2D>(@"hippo/hippo_blueeyes_blue");
            textures[3] = parent.Content.Load<Texture2D>(@"hippo/hippo_blueeyes_camo");

            texture = textures[0];

            skinningData = hippo.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            // Set clip to an animation track as written in the .fbx file
            currentclip = clips[0];
            clip = skinningData.AnimationClips[currentclip];

            // initialize animation
            animationPlayer.StartClip(clip);
            animating = true;

            hipposound = parent.Content.Load<SoundEffect>(@"sound\hipposound");
            birds = parent.Content.Load<SoundEffect>(@"sound\birds");
        }
コード例 #22
0
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            // Load the model.
            currentModel = Content.Load<Model>("dude");

            // Look up our custom skinning information.
            #region BaamStudios XnaMixamoImporter Change
            //SkinningData skinningData = currentModel.Tag as SkinningData;
            SkinningData skinningData;
            using (var fileStream = new FileStream("Content/dude_idle.anim", FileMode.Open))
            {
                skinningData = Animation.LoadSkinningData(fileStream);
            }
            #endregion

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            #region BaamStudios XnaMixamoImporter Change
            //AnimationClip clip = skinningData.AnimationClips["Take 001"];
            AnimationClip clip = skinningData.AnimationClips.Values.First();
            #endregion

            animationPlayer.StartClip(clip);
        }
コード例 #23
0
ファイル: Main.cs プロジェクト: dantheman0207/GameOGO
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            // Load the model.
            modelChar = Content.Load<Model>("dude");

            modelWall = Content.Load<Model>("wall");
            modelFloor = Content.Load<Model>("floor");

            map = new Map(GRIDSIZE,modelFloor,modelWall);

            //==========ANIMATION LOADING=================
            // Look up our custom skinning information.
            SkinningData skinningData = modelChar.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip = skinningData.AnimationClips["Take 001"];

            animationPlayer.StartClip(clip);
        }
コード例 #24
0
ファイル: DynamicModelXna.cs プロジェクト: himapo/ccm
        public bool Init()
        {
            if (Initialized)
            {
                return true;
            }

            if (Model == null)
            {
                return false;
            }

            SkinningData = Model.Tag as SkinningData;

            if (SkinningData == null)
                throw new InvalidOperationException
                    ("このモデルのTagにはSkinningDataが設定されていません。\n" +
                        "プロセッサにSkinnedModelProcessorを指定してください");

            if (SkinningData.AnimationClips.Count == 0)
                throw new InvalidOperationException
                    ("このモデルにはAnimationClipが存在しません。");

            AnimationPlayer = new AnimationPlayer(SkinningData);

            MotionNames.AddRange(SkinningData.AnimationClips.Keys);

            // 適当に最初のモーションを再生
            foreach (var clip in SkinningData.AnimationClips)
            {
                AnimationPlayer.StartClip(clip.Value);
                CurrentMotionName = clip.Key;
                break;
            }

            BoneTransforms = new QuatTransform[SkinningData.BindPose.Count];

            int width = AnimationPlayer.GetSkinRotations().Length;
            int height = 1;

            RotationTexture = new FlipTexture2D(GraphicsDevice, width, height, false, SurfaceFormat.Vector4);

            TranslationTexture = new FlipTexture2D(GraphicsDevice, width, height, false, SurfaceFormat.Vector4);

            Initialized = true;

            return true;
        }
コード例 #25
0
ファイル: SkinningSample.cs プロジェクト: mmuzny/armwrestler
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            // Load the model.
            currentModel = Content.Load<Model>("dude");
            table = Content.Load<Model>("table");
            chair = Content.Load<Model>("chair");
            chair2 = Content.Load<Model>("chair");

            // Look up our custom skinning information.
            SkinningData skinningData = currentModel.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip = skinningData.AnimationClips["walky"];

            animationPlayer.StartClip(clip);
        }
コード例 #26
0
ファイル: Blasters.cs プロジェクト: rutger438/Blasters
        protected override void LoadContent()
        {
            modelPosition.Z = 120;
            font = Content.Load<SpriteFont>(@"SpriteFont1");
            modelPosition.X = 60;
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            myModel = Content.Load<Model>(@"dude");
            block = Content.Load<Model>(@"block");
            worldModel = Content.Load<Model>(@"plane");
            playerCollition2d = new Rectangle(0, 0, 20, 20);
            box1 = new Rectangle(0, 0, 50, 50);
            aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;

            // Look up our custom skinning information.
            SkinningData skinningData = myModel.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip1 = skinningData.AnimationClips["Take 001"];

            animationPlayer.StartClip(clip1);
        }
コード例 #27
0
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            // Load the model.
            currentModel = Content.Load<Model>("InfectedDruggie");

            // Look up our custom skinning information.
            SkinningData skinningData = currentModel.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            //AnimationClip clip = skinningData.AnimationClips["Take 001"];

            //animationPlayer.RegisteredEvents["Fall"].Add("FireFrame", new AnimationPlayer.EventCallBack(OnFire));

               // animations = new AnimationClip[3];
            //animations[0] = new AnimationClip[skinningData.AnimationClips];

            fpos = skinningData.AnimationClips["Fpos"];
            idle = skinningData.AnimationClips["Idle"];
            idle2 = skinningData.AnimationClips["Idle2"];
            run = skinningData.AnimationClips["Run"];
            attack = skinningData.AnimationClips["Attack"];
            die = skinningData.AnimationClips["Die"];

            /* animations[0] = idle;
             animations[1] = jump;
             animations[3] = fall;
             */

            // start with idle animation

                animationPlayer.StartClip(run, true);
        }
コード例 #28
0
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            spriteFont = Content.Load<SpriteFont>("MessageFont");
             // Load the model.
            currentModel = Content.Load<Model>("dude");

            SkinningData skinningData = currentModel.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            setupKinect();
            // Look up our custom skinning information.

            // Create an animation player, and start decoding an animation clip.

            //v1
            //Dictionary<JointType, int> jointMap = LoadJointMapDude();
            //animationPlayer = new AnimationPlayer(currentModel, graphics.GraphicsDevice.RasterizerState, jointMap);

            //v2
            animationPlayer = new AnimationPlayer(skinningData, graphics.GraphicsDevice.RasterizerState);

            AnimationClip clip = skinningData.AnimationClips["Take 001"];
            animationPlayer.StartClip(clip);
        }
コード例 #29
0
        private void LoadAnimations()
        {
            // Create an animation player, and start decoding an animation clip.
            mIdlePlayer = new AnimationPlayer( mSkinData );
            mRunPlayer = new AnimationPlayer( mSkinData );
            mJumpPlayer = new AnimationPlayer( mSkinData );
            mFallPlayer = new AnimationPlayer( mSkinData );

            mIdleClip = mSkinData.AnimationClips[ "idle" ];
            mRunClip = mSkinData.AnimationClips[ "run" ];
            mJumpClip = mSkinData.AnimationClips[ "jump" ];
            mFallClip = mSkinData.AnimationClips[ "fall" ];

            mRunPlayer.StartClip( mRunClip );
            mIdlePlayer.StartClip( mIdleClip );
            mJumpPlayer.StartClip( mJumpClip );
            mFallPlayer.StartClip( mFallClip );
        }
コード例 #30
0
        //--------------------------//
        // 関数名	Initialize		//
        //    Function initialize
        // 機能		初期化処理		//
        //    Initialization function
        // 引数		なし				//
        //    No argument
        // 戻り値	なし				//
        //    No return value
        //--------------------------//
        private void Initialize()
        {
            // I want to initialize the class to handle the skeleton data
            var boneIndices = new Dictionary<int, BoneType>
            {
                // Number of bones model has because it is different for each model,
                // I want to map the number and types of bone
                //{ 00, BoneType.Hip },
                //{ 01, BoneType.Spine },
                //{ 02, BoneType.UpperArmRight },
                //{ 03, BoneType.ForeArmRight },
                //{ 04, BoneType.HandRight },
                //{ 05, BoneType.UpperArmLeft },
                //{ 06, BoneType.ForeArmLeft },
                //{ 07, BoneType.HandLeft },
                //{ 08, BoneType.Head },
                //{ 09, BoneType.ThighLeft },
                //{ 10, BoneType.ShinLeft },
                //{ 11, BoneType.FootLeft },
                //{ 12, BoneType.ThighRight },
                //{ 13, BoneType.ShinRight },
                //{ 14, BoneType.FootRight }

                { 00, BoneType.SkateBoard },

                { 01, BoneType.Hip },

                { 02, BoneType.ThighLeft },
                { 03, BoneType.ShinLeft },
                { 04, BoneType.AnkleLeft },
                { 05, BoneType.FootLeft },

                { 06, BoneType.ThighRight },
                { 07, BoneType.ShinRight },
                { 08, BoneType.AnkleRight },
                { 09, BoneType.FootRight },

                { 10, BoneType.Spine },
                { 11, BoneType.ShoulderCenter },
                { 12, BoneType.Neck },
                { 13, BoneType.Head },

                { 14, BoneType.UpperArmLeft },
                { 15, BoneType.ForeArmLeft },
                { 16, BoneType.HandLeft },

                { 17, BoneType.UpperArmRight },
                { 18, BoneType.ForeArmRight },
                { 19, BoneType.HandRight },

            };
            // Initializes the handler Avatar
            avateerHandler = new AvateerHandler(Skeleton_Player, boneIndices);

            // frame specific animation
            // kicking 1 to 71 = 2.3seconds
            // jumping 71 to 156 = 2.5seconds
            // ducking 156 to 190 = 1.2seconds
            // knockback 160 to 185 = 0.5seconds

            //Boosting - 1 to 50
            //Jumping - 50 to 110
            //Ducking - 110 to 160

            SkinningData skinningData = Skeleton_Player.Tag as SkinningData;
            animationPlayer = new AnimationPlayer(skinningData);
            clip = skinningData.AnimationClips["Take 001"];
            animationPlayer.StartClip(clip);
            this.animationPlayer.Update(new GameTime().ElapsedGameTime, true, this.world);
        }