Ejemplo n.º 1
0
        public static Model ConvertFromAssimpScene(string filePath, ModelConverterOptions options)
        {
            // For importing textures
            string baseDirectoryPath = Path.GetDirectoryName(filePath);

            // Import scene
            var aiScene = AssimpSceneImporter.ImportFile(filePath);

            // Build textures & Materials
            var model = new Model(options.Version);

            model.Textures  = new TextureDictionary(options.Version);
            model.Materials = new MaterialDictionary(options.Version);

            foreach (var aiSceneMaterial in aiScene.Materials)
            {
                var material = ConvertMaterialAndTextures(aiSceneMaterial, options, baseDirectoryPath, model.Textures);
                model.Materials.Add(material);
            }

            // Create scene
            var sceneConverterOptions = new SceneConverterOptions()
            {
                Version              = options.Version,
                ConvertSkinToZUp     = options.ConvertSkinToZUp,
                GenerateVertexColors = options.GenerateVertexColors,
            };

            model.Scene = SceneConverter.ConvertFromAssimpScene(aiScene, sceneConverterOptions);

            return(model);
        }
Ejemplo n.º 2
0
        public static Animation ConvertFromAssimpScene(string filePath, AnimationConverterOptions options)
        {
            var aiScene = AssimpSceneImporter.ImportFile(filePath);

            return(ConvertFromAssimpScene(aiScene, options));
        }
Ejemplo n.º 3
0
 protected override Scene ImportCore(Stream stream, string filename = null)
 {
     return(AssimpSceneImporter.ImportFile(filename));
 }