diff options
author | Treeki <treeki@gmail.com> | 2011-03-10 03:00:09 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-03-10 03:00:09 +0100 |
commit | 5926616de2bd346f1a1c69c93ff2aaa3c453a2b3 (patch) | |
tree | f282b05ae5616a05fb4db167fad20ec242775c27 /TestApp/Main.cs | |
parent | 7d391e33a0b3d9793c95fce832abb2c6d9002186 (diff) | |
download | nw4rtools-5926616de2bd346f1a1c69c93ff2aaa3c453a2b3.tar.gz nw4rtools-5926616de2bd346f1a1c69c93ff2aaa3c453a2b3.zip |
kinda hackish, but mostly working NSMBW lightmap support
Diffstat (limited to 'TestApp/Main.cs')
-rw-r--r-- | TestApp/Main.cs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/TestApp/Main.cs b/TestApp/Main.cs index fbaa7dc..3d7f063 100644 --- a/TestApp/Main.cs +++ b/TestApp/Main.cs @@ -28,12 +28,12 @@ namespace TestApp { File.WriteAllBytes(mdlPath + filename + ".brres", BrresWriter.WriteFile(rf)); - ResFile rf2 = BrresReader.LoadFile(File.ReadAllBytes(mdlPath + filename + ".brres")); + /*ResFile rf2 = BrresReader.LoadFile(File.ReadAllBytes(mdlPath + filename + ".brres")); using (var gw = new RenderWindow()) { gw.Title = filename; gw.SetModel(rf2, resmdlname); gw.Run(1, 1); - } + }*/ @@ -73,7 +73,7 @@ namespace TestApp { private static void oldBehaviour() { string mdlPath = "/home/me/Games/Newer/ModelRev/"; - string mdlName = "CS_W1"; + string mdlName = "lift_han_wood"; //string mdlName = "bgB_4502"; //string mdlName = "cobKoopaCastle"; //string mdlName = "waterPlate_W4boss"; @@ -84,14 +84,23 @@ namespace TestApp { byte[] file = File.ReadAllBytes(mdlPath + mdlName + ".brres"); ResFile rf = BrresReader.LoadFile(file); - using (var gw = new RenderWindow()) { + /*using (var gw = new RenderWindow()) { gw.Title = mdlName; gw.SetModel(rf, mdlName); gw.Run(1, 1); - } + }*/ //File.WriteAllBytes(mdlPath + mdlName + "_rewritten.brres", BrresWriter.WriteFile(rf)); + var texs = rf.GetGroup<Texture>("Textures(NW4R)"); + // wtf C#?! + foreach (var kv in (IEnumerable<KeyValuePair<string,Texture>>)texs) { + kv.Value.Images[0].Save(mdlPath + "images/" + kv.Key + ".png"); + } + + var objFile = File.Open(mdlPath + "lift_han_wood_M.dae", FileMode.OpenOrCreate); + ColladaExporter.WriteModel(objFile, rf, "lift_han_wood_M"); + objFile.Close(); } } } |