Пример #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            LocalPlayerRegistry.InitialisePlayer(PlayerIndex.One);
            // TODO: Add your initialization logic here
            _inputManager = new Input(this);
            _inputManager.AddCommandToCheckKeyboard(Keys.W, Keys.A, Keys.S, Keys.D, Keys.Q, Keys.E);
            _inputs = _inputManager.RetrieveInputContainer;

            //_test = new ANSKTest(this, Vector3.Zero, 3, Content.Load<ANSKModelContent>("CubeTest"));

            //_test._model.PlayAnimation("One");
            //_test._model.PauseAnimation();

            //_camera = new Camera(this, Vector3.Backward * 15, Vector3.Forward, Vector3.Up);
            _camera = new Camera(this, Vector3.Backward * 20, Vector3.Forward, Vector3.Up);
            _camera.Target = new GameObject(this, Matrix.Identity.Translation);
            //_camera.TargetPos = Matrix.Identity.Translation;
            //_camera.Target = _test;
            _camera.TargetSpecified = true;

            _model = new ANSKModel(Content.Load<ANSKModelContent>("CubeTest"));
            _model.ManualInitialise(GraphicsDevice, Content.Load<Effect>("Effects/AnimatableModel"), this);
            _model.PlayAnimation("One");
            //_camera.Translate(Vector3.Left * 15);
            //_camera.Translate(Vector3.Forward * 15);

            //_model = Content.Load<ANSKModel>("CubeTest");
            world = Matrix.CreateTranslation(0, 0, 0);
            view = Matrix.CreateLookAt(new Vector3(0, 0, 3), new Vector3(0, 0, 0), new Vector3(0, 1, 0));
            proj = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), 800f / 480f, 0.01f, 100f);

            _modelTrans = Matrix.CreateTranslation(Vector3.Zero);// *Matrix.CreateScale(50);

            base.Initialize();
        }
Пример #2
0
        public void Draw(GameTime gameTime, Matrix transform, Camera c)
        {
            /*Matrix[] bones = _player.GetSkinTransforms();
            Matrix[] transforms = new Matrix[_model.Bones.Count];

            _model.CopyAbsoluteBoneTransformsTo(transforms);

            foreach (ModelMesh mesh in _model.Meshes)
            {
                Matrix worldProj = transforms[mesh.ParentBone.Index] * c.View * c.Projection;

                foreach (Effect effect in mesh.Effects)
                {
                    effect.Parameters["worldProj"].SetValue(worldProj);
                    //effect.Parameters["modelTexture"].SetValue(_modelTexture);
                    effect.Parameters["bones"].SetValue(bones);
                    effect.Parameters["vsArrayIndex"].SetValue(vsindex);
                    effect.Parameters["psArrayIndex"].SetValue(psindex);

                    effect.CurrentTechnique.Passes[0].Apply();
                }

                mesh.Draw();
            }*/
        }
Пример #3
0
        public void Draw(GameTime gameTime, Camera cam)
        {
            base.Draw(gameTime);

            _model.Draw(gameTime, _main, cam);
        }