Exemplo n.º 1
0
        public AnimatableModel(Game1 game, ANSKModelContent model, Vector3 pos)
        {
            _game = game;
            _model = new ANSKModel(model);
            _modelTexture = null;

            //_model = ModelRegistry.GetModel("TestNormalBlendOppCorners2");

            _ansk = new ANSK( _model, game);
            //_skinData = _model.Tag as ANSKTagData;

            //if (_skinData == null)
            if (_ansk.SkinningAndBasicAnims == null)
                throw new InvalidOperationException("The model " + _model.ToString() + " does not contain the data needed for animations.");

            //_player = new AnimationPlayer(_skinData);
            _player = new AnimationPlayer(_ansk.SkinningAndBasicAnims);

            _currentClip = null;

            _player.Looped = false;

            _collisionSphereRadius = 0.1f;
            _parentCollisionSphereRadius = 0.6f;

            GenerateBoundingSpheres(Matrix.Identity);
        }
Exemplo n.º 2
0
        public void ManualInitialise(GraphicsDevice device, Effect effect, Game game)
        {
            _effect = effect;
            _gDevice = device;
            _game = game;
            DebugShapeRenderer.Initialize(_game.GraphicsDevice);

            try
            {
                //_vertBuffer = new VertexBuffer(_gDevice, typeof(ANSKVertexDeclaration), _verts.Count, BufferUsage.None);
                //_indBuffer = new IndexBuffer(_gDevice, IndexElementSize.SixteenBits, sizeof(int) * _indicies.Count, BufferUsage.None);
                _vertBuffer = new VertexBuffer(_game.GraphicsDevice, typeof(ANSKVertexDeclaration), _verts.Count, BufferUsage.WriteOnly);
                //_vertBuffer = new VertexBuffer(_game.GraphicsDevice, typeof(VertexPositionColor), _verts.Count, BufferUsage.WriteOnly);
                _indBuffer = new IndexBuffer(_game.GraphicsDevice, IndexElementSize.SixteenBits, sizeof(short) * _indicies.Count, BufferUsage.WriteOnly);
            }
            catch (Exception e)
            {
                int poo = 0;
            }
            _ansk = new ANSK(this, game);
            _player = new AnimationPlayer(_tagData.SkinData);

            _indBuffer.SetData<short>(_indicies.ToArray());
            //_gDevice.Indices = _indBuffer;
            _game.GraphicsDevice.Indices = _indBuffer;
            CreateDeclarationList();
        }