using System; using System.IO; using System.Collections.Generic; using NW4RTools; using OpenTK; using OpenTK.Graphics; using OpenTK.Graphics.OpenGL; namespace TestApp { class MainClass { public static void Main(string[] args) { string mdlPath = "/home/me/Games/Newer/ModelRev/"; //string mdlName = "CS_W1"; //string mdlName = "bgB_4502"; //string mdlName = "cobKoopaCastle"; string mdlName = "CS_W9"; string whatever = (mdlName == "CS_W2" || mdlName == "CS_W3" || mdlName == "CS_W6") ? "a" : ""; byte[] file = File.ReadAllBytes(mdlPath + mdlName + ".brres"); ResFile rf = BrresReader.LoadFile(file); File.WriteAllBytes(mdlPath + mdlName + "_rewritten.brres", BrresWriter.WriteFile(rf)); /*using (var gw = new RenderWindow()) { gw.Title = mdlName; gw.SetModel(rf, mdlName); gw.Run(1, 1); }*/ /*var texs = rf.GetGroup("Textures(NW4R)"); // wtf C#?! foreach (var kv in (IEnumerable>)texs) { kv.Value.BaseImage.Save(mdlPath + "images/" + kv.Key + ".png"); } //var objFile = File.Open(mdlPath + mdlName + ".obj", FileMode.OpenOrCreate); var objFile = File.Open(mdlPath + mdlName + ".dae", FileMode.OpenOrCreate); //var sw = new StreamWriter(objFile); //ObjWriter.WriteModel(sw, rf, mdlName); ColladaWriter.WriteModel(objFile, rf, mdlName + whatever); objFile.Close();*/ } } }