| 1 | using System; | 
 
 
 
 
 | 2 | using System.Collections.Generic; | 
 
 
 
 
 | 3 | using System.Globalization; | 
 
 
 
 
 | 4 | using System.IO; | 
 
 
 
 
 | 5 | using Oni.Imaging; | 
 
 
 
 
 | 6 |  | 
 
 
 
 
 | 7 | namespace Oni.Akira | 
 
 
 
 
 | 8 | { | 
 
 
 
 
 | 9 | internal class AkiraImporter : Importer | 
 
 
 
 
 | 10 | { | 
 
 
 
 
 | 11 | private bool debug; | 
 
 
 
 
 | 12 | //private string defaultTexture = "NONE"; | 
 
 
 
 
 | 13 | //private bool importLights; | 
 
 
 
 
 | 14 | //private bool noLight; | 
 
 
 
 
 | 15 | //private bool noTextures; | 
 
 
 
 
 | 16 |  | 
 
 
 
 
 | 17 | public AkiraImporter(string[] args) | 
 
 
 
 
 | 18 | { | 
 
 
 
 
 | 19 | foreach (string arg in args) | 
 
 
 
 
 | 20 | { | 
 
 
 
 
 | 21 | if (arg == "-debug") | 
 
 
 
 
 | 22 | { | 
 
 
 
 
 | 23 | debug = true; | 
 
 
 
 
 | 24 | } | 
 
 
 
 
 | 25 | //if (arg.StartsWith("-texdefault:", StringComparison.Ordinal)) | 
 
 
 
 
 | 26 | //{ | 
 
 
 
 
 | 27 | //    int i = arg.IndexOf(':'); | 
 
 
 
 
 | 28 | //    defaultTexture = arg.Substring(i + 1); | 
 
 
 
 
 | 29 | //} | 
 
 
 
 
 | 30 | //else if (arg.StartsWith("-lights", StringComparison.Ordinal)) | 
 
 
 
 
 | 31 | //{ | 
 
 
 
 
 | 32 | //    importLights = true; | 
 
 
 
 
 | 33 | //} | 
 
 
 
 
 | 34 | //else if (arg == "-env-notxmp") | 
 
 
 
 
 | 35 | //{ | 
 
 
 
 
 | 36 | //    noTextures = true; | 
 
 
 
 
 | 37 | //} | 
 
 
 
 
 | 38 | //else if (arg.StartsWith("-nolight", StringComparison.Ordinal)) | 
 
 
 
 
 | 39 | //{ | 
 
 
 
 
 | 40 | //    noLight = true; | 
 
 
 
 
 | 41 | //} | 
 
 
 
 
 | 42 | } | 
 
 
 
 
 | 43 | } | 
 
 
 
 
 | 44 |  | 
 
 
 
 
 | 45 | public override void Import(string filePath, string outputDirPath) | 
 
 
 
 
 | 46 | { | 
 
 
 
 
 | 47 | Import(new[] { filePath }, outputDirPath); | 
 
 
 
 
 | 48 | } | 
 
 
 
 
 | 49 |  | 
 
 
 
 
 | 50 | public void Import(IList<string> files, string outputDirPath) | 
 
 
 
 
 | 51 | { | 
 
 
 
 
 | 52 | Import(files, outputDirPath, Path.GetFileNameWithoutExtension(files[0])); | 
 
 
 
 
 | 53 | } | 
 
 
 
 
 | 54 |  | 
 
 
 
 
 | 55 | public void Import(IList<string> files, string outputDirPath, string name) | 
 
 
 
 
 | 56 | { | 
 
 
 
 
 | 57 | PolygonMesh mesh = AkiraDaeReader.Read(files); | 
 
 
 
 
 | 58 |  | 
 
 
 
 
 | 59 | BeginImport(); | 
 
 
 
 
 | 60 | AkiraDatWriter.Write(mesh, this, name, debug); | 
 
 
 
 
 | 61 | Write(outputDirPath); | 
 
 
 
 
 | 62 | } | 
 
 
 
 
 | 63 | } | 
 
 
 
 
 | 64 | } |