예제 #1
0
        /// <summary>
        /// Copies only the geometry (Mesh,
        /// MinimumBoundingBox, MinimumBoundingSphere, TriangleCount and Transforms)
        /// </summary>
        /// <param name="model">A source model from which to copy</param>
        public override void CopyGeometry(IModel model)
        {
            if (!(model is AnimatedModel))
            {
                return;
            }

            AnimatedModel srcModel = (AnimatedModel)model;

            skinnedModel = srcModel.SkinnedModel;

            vertices.AddRange(((IPhysicsMeshProvider)model).Vertices);
            indices.AddRange(((IPhysicsMeshProvider)model).Indices);

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

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

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

            triangleCount        = srcModel.TriangleCount;
            boundingBox          = srcModel.MinimumBoundingBox;
            boundingSphere       = srcModel.MinimumBoundingSphere;
            UseInternalMaterials = srcModel.UseInternalMaterials;
        }
예제 #2
0
        public IModel Load(String path, String modelAssetName)
        {
            path = (path.Equals("")) ? State.GetSettingVariable("ModelDirectory") : path;
            String   filePath = Path.Combine(path, modelAssetName);
            XNAModel xnaModel = State.Content.Load <XNAModel>(@"" + filePath);

            // Get matrix transformations of the model
            if (xnaModel != null)
            {
                IModel model = new AnimatedModel(xnaModel);
                return(model);
            }
            else
            {
                Log.Write("SkinnedModel " + filePath + " does not exist ");
                return(null);
            }
        }
예제 #3
0
 public IModel Load(String path, String modelAssetName)
 {
     path = (path.Equals("")) ? State.GetSettingVariable("ModelDirectory") : path;
     String filePath = Path.Combine(path, modelAssetName);
     XNAModel xnaModel = State.Content.Load<XNAModel>(@"" + filePath);
     
     // Get matrix transformations of the model
     if (xnaModel != null)
     {   
         IModel model = new AnimatedModel(xnaModel);
         return model;
     }
     else
     {
         Log.Write("SkinnedModel " + filePath + " does not exist ");
         return null;
     }
 }
예제 #4
0
        private void LoadModel()
        {
            AnimatedModelLoader loader = new AnimatedModelLoader();

            animatedModel = (AnimatedModel)loader.Load("", "dude");
            animatedModel.UseInternalMaterials = true;

            GeometryNode modelNode = new GeometryNode("Dude");

            modelNode.Model = animatedModel;

            animatedModel.LoadAnimationClip("Take 001");

            modelTransNode             = new TransformNode();
            modelTransNode.Translation = new Vector3(20, 0, 0);

            scene.RootNode.AddChild(modelTransNode);
            modelTransNode.AddChild(modelNode);
        }
예제 #5
0
        private void LoadModel()
        {
            AnimatedModelLoader loader = new AnimatedModelLoader();
            animatedModel = (AnimatedModel)loader.Load("", "dude");
            animatedModel.UseInternalMaterials = true;

            GeometryNode modelNode = new GeometryNode("Dude");
            modelNode.Model = animatedModel;

            animatedModel.LoadAnimationClip("Take 001");

            modelTransNode = new TransformNode();
            modelTransNode.Translation = new Vector3(20, 0, 0);

            scene.RootNode.AddChild(modelTransNode);
            modelTransNode.AddChild(modelNode);
        }