Пример #1
0
        public void LoadContent(GraphicsDevice device, ContentManager content)
        {
            LoadData loadData = LoadMapData(device, filepath);

            tiles         = loadData.Tiles;
            startPosition = loadData.StartPosition;
            minimap       = loadData.Minimap;
            var importer = new Assimp.AssimpImporter();


            string fileName = System.IO.Path.GetFullPath(content.RootDirectory + "/wall.3ds");

            Assimp.Scene scene = importer.ImportFile(fileName, Assimp.PostProcessSteps.MakeLeftHanded);
            wallModel = new Model(scene, device, content);

            fileName   = System.IO.Path.GetFullPath(content.RootDirectory + "/floor.3ds");
            scene      = importer.ImportFile(fileName, Assimp.PostProcessSteps.MakeLeftHanded);
            floorModel = new Model(scene, device, content);

            fileName      = System.IO.Path.GetFullPath(content.RootDirectory + "/floorKey.3ds");
            scene         = importer.ImportFile(fileName, Assimp.PostProcessSteps.MakeLeftHanded);
            floorKeyModel = new Model(scene, device, content);

            fileName     = System.IO.Path.GetFullPath(content.RootDirectory + "/ceiling.3ds");
            scene        = importer.ImportFile(fileName, Assimp.PostProcessSteps.MakeLeftHanded);
            ceilingModel = new Model(scene, device, content);


            fileName  = System.IO.Path.GetFullPath(content.RootDirectory + "/door.3ds");
            scene     = importer.ImportFile(fileName, Assimp.PostProcessSteps.MakeLeftHanded);
            doorModel = new Model(scene, device, content);
        }
Пример #2
0
        private void OpenFile(string filename)
        {
            var importer = new Assimp.AssimpImporter();

            Assimp.Scene aiScene = null;
            try
            {
                aiScene = importer.ImportFile(filename, Assimp.PostProcessSteps.GenerateSmoothNormals | Assimp.PostProcessSteps.Triangulate | Assimp.PostProcessSteps.FlipUVs);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); return; }

            var container = new AssimpSceneContainer(aiScene, filename);

            CreateAnimationNodes(aiScene, container);
            CreateSkeletonNode(aiScene, container);
            CreateJointNode(aiScene, container);

            {
                this.cmbAnimationIndex.Items.Clear();
                int count = container.aiScene.AnimationCount;
                for (int i = 0; i < count; i++)
                {
                    this.cmbAnimationIndex.Items.Add(string.Format("Animation {0}", i));
                }
            }
        }
Пример #3
0
 public AssimpTranslator(ContentManager content)
 {
     m_content  = content;
     m_importer = new Assimp.AssimpImporter();
 }