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);
        }
Esempio n. 2
0
        public BlendShapeManager(List<BlendShapeContent> shapes, ANSKModel model, Game game)
        {
            /* _bShapes = new List<BlendShapeComplex>();
            for (int i = 0; i < shapes.Count; i++)
                _bShapes.Add(new BlendShapeComplex(new BlendShape(shapes[i]), model, game));

            _model = model;*/
        }
Esempio n. 3
0
        public ANSK(ANSKModel model, Game game)
        {
            _aac = new AAC();

            //_skin = model.TagData.SkinData;

            /*if (data.BlendShapes.Count > 0)
            {
                _aac.LoadModel(model);
                _aac.LoadBlendShapes(data.BlendShapes, game);
            }*/

            _model = model;
        }
Esempio n. 4
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();
        }
Esempio n. 5
0
 public void LoadModel(ANSKModel model)
 {
     _model = model;
 }
Esempio n. 6
0
            private void ExtractBlendShapeVerts(ANSKModel model)
            {
                List<short> check = new List<short>();
                Vector3[] verts;
                short[] inds;

                /*for (int i = 0; i < model.Meshes.Count; i++)
                {
                    for (int q = 0; q < model.Meshes[i].MeshParts.Count; q++)
                    {
                        //verts = new Vector3[model.Meshes[i].MeshParts[q].VertexBuffer.VertexCount];
                        //inds = new short[model.Meshes[i].MeshParts[q].IndexBuffer.IndexCount];

                        VertexDeclaration vertexDec = model.Meshes[i].MeshParts[q].VertexBuffer.VertexDeclaration;
                        var vertEle = vertexDec.GetVertexElements();

                        var posEle = vertEle.First(e => e.VertexElementUsage == VertexElementUsage.Position);
                        if (posEle.VertexElementFormat != VertexElementFormat.Vector3)
                            throw new NotSupportedException();

                        var positions = new Vector3[model.Meshes[i].MeshParts[q].NumVertices];
                        model.Meshes[i].MeshParts[q].VertexBuffer.GetData(model.Meshes[i].MeshParts[q].VertexOffset * vertexDec.VertexStride + posEle.Offset, positions, 0, model.Meshes[i].MeshParts[q].NumVertices, vertexDec.VertexStride);

                        var indexElementSize = (model.Meshes[i].MeshParts[q].IndexBuffer.IndexElementSize == IndexElementSize.SixteenBits) ? 2 : 4;
                        if (indexElementSize != 2)
                        throw new NotSupportedException();

                        var indices = new short[model.Meshes[i].MeshParts[q].PrimitiveCount * 3];
                        model.Meshes[i].MeshParts[q].IndexBuffer.GetData(model.Meshes[i].MeshParts[q].StartIndex * 2, indices, 0, model.Meshes[i].MeshParts[q].PrimitiveCount * 3);

                        //model.Meshes[i].MeshParts[q].VertexBuffer.GetData<Vector3>(verts);
                        //model.Meshes[i].MeshParts[q].IndexBuffer.GetData<short>(inds);

                        for (int p = 0; p < _shape.Indices.Count; p++)
                        {
                            for (int w = 0; w < indices.Length; w++)
                            {
                                if (_shape.Indices[p] == indices[w] && !check.Exists(temp => temp == _shape.Indices[p]))
                                {
                                    _verts.Add(new BlendShapeVert(i, q, indices[w], p, _shape.Vertices[p]));
                                    check.Add(indices[w]);
                                }
                            }
                        }
                    }
                }*/
            }
Esempio n. 7
0
 public BlendShapeComplex(BlendShape shape, ANSKModel model, Game game)
 {
     _shape = shape;
     _min = 0;
     _max = 1;
     _toValue = 0;
     _timePassed = 0.0f;
     _timeToWait = 0.0f;
     _blend = false;
     _verts = new List<BlendShapeVert>();
     ExtractBlendShapeVerts(model);
     _game = game;
 }