public static Kn5 FromFile(string filename, IKn5TextureLoader textureLoader = null, IKn5MaterialLoader materialLoader = null, IKn5NodeLoader nodeLoader = null) { if (!File.Exists(filename)) { throw new FileNotFoundException(filename); } var kn5 = new Kn5(filename); (textureLoader = textureLoader ?? DefaultKn5TextureLoader.Instance).OnNewKn5(filename); (materialLoader = materialLoader ?? DefaultKn5MaterialLoader.Instance).OnNewKn5(filename); (nodeLoader = nodeLoader ?? DefaultKn5NodeLoader.Instance).OnNewKn5(filename); using (var reader = new Kn5Reader(filename)) { kn5.FromFile_Header(reader); kn5.FromFile_Textures(reader, textureLoader); if (nodeLoader != SkippingNodeLoader.Instance || materialLoader != SkippingMaterialLoader.Instance) { kn5.FromFile_Materials(reader, materialLoader); kn5.FromFile_Nodes(reader, nodeLoader); } } return(kn5); }
public static Kn5 FromFile(string filename, bool skipTextures, bool readNodesAsBytes = true) { if (!File.Exists(filename)) { throw new FileNotFoundException(filename); } var kn5 = new Kn5(filename); using (var reader = new Kn5Reader(filename)) { kn5.FromFile_Header(reader); if (skipTextures) { kn5.FromFile_Textures(reader, BlankKn5TextureLoader.Instance); } else { kn5.FromFile_Textures(reader, DefaultKn5TextureLoader.Instance); } kn5.FromFile_Materials(reader); kn5.FromFile_Nodes(reader, readNodesAsBytes); } return(kn5); }
public static Kn5 FromStream(Stream entry, IKn5TextureLoader textureLoader = null) { var kn5 = new Kn5(string.Empty); using (var reader = new Kn5Reader(entry)) { kn5.FromFile_Header(reader); kn5.FromFile_Textures(reader, textureLoader ?? DefaultKn5TextureLoader.Instance); kn5.FromFile_Materials(reader); kn5.FromFile_Nodes(reader, false); } return(kn5); }
public static Kn5 FromStream(Stream entry, IKn5TextureLoader textureLoader = null, IKn5MaterialLoader materialLoader = null, IKn5NodeLoader nodeLoader = null) { var kn5 = new Kn5(string.Empty); using (var reader = new Kn5Reader(entry)) { kn5.FromFile_Header(reader); kn5.FromFile_Textures(reader, textureLoader ?? DefaultKn5TextureLoader.Instance); if (nodeLoader != SkippingNodeLoader.Instance || materialLoader != SkippingMaterialLoader.Instance) { kn5.FromFile_Materials(reader, materialLoader ?? DefaultKn5MaterialLoader.Instance); kn5.FromFile_Nodes(reader, nodeLoader ?? DefaultKn5NodeLoader.Instance); } } return(kn5); }
public static Kn5 FromFile(string filename, IKn5TextureLoader textureLoader = null) { if (!File.Exists(filename)) { throw new FileNotFoundException(filename); } var kn5 = new Kn5(filename); using (var reader = new Kn5Reader(filename)) { kn5.FromFile_Header(reader); kn5.FromFile_Textures(reader, textureLoader ?? DefaultKn5TextureLoader.Instance); kn5.FromFile_Materials(reader); kn5.FromFile_Nodes(reader, false); } return(kn5); }
public static Kn5 FromStream(Stream entry, bool skipTextures = false) { var kn5 = new Kn5(string.Empty); using (var reader = new Kn5Reader(entry)) { kn5.FromFile_Header(reader); if (skipTextures) { kn5.FromFile_SkipTextures(reader); } else { kn5.FromFile_Textures(reader); } kn5.FromFile_Materials(reader); kn5.FromFile_Nodes(reader); } return kn5; }
public static Kn5 FromFile(string filename, bool skipTextures = false) { if (!File.Exists(filename)) { throw new FileNotFoundException(filename); } var kn5 = new Kn5(filename); using (var reader = new Kn5Reader(filename)) { kn5.FromFile_Header(reader); if (skipTextures) { kn5.FromFile_SkipTextures(reader); } else { kn5.FromFile_Textures(reader); } kn5.FromFile_Materials(reader); kn5.FromFile_Nodes(reader); } return kn5; }