From 5926616de2bd346f1a1c69c93ff2aaa3c453a2b3 Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 10 Mar 2011 03:00:09 +0100 Subject: kinda hackish, but mostly working NSMBW lightmap support --- TestApp/Main.cs | 19 ++++++++++++++----- TestApp/RenderWindow.cs | 4 ++-- TestApp/TestApp.pidb | Bin 4427 -> 4427 bytes TestApp/bin/Debug/NW4RTools.dll | Bin 233472 -> 235008 bytes TestApp/bin/Debug/NW4RTools.dll.mdb | Bin 112974 -> 113949 bytes TestApp/bin/Debug/TestApp.exe | Bin 7168 -> 7680 bytes TestApp/bin/Debug/TestApp.exe.mdb | Bin 1243 -> 1226 bytes 7 files changed, 16 insertions(+), 7 deletions(-) (limited to 'TestApp') 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("Textures(NW4R)"); + // wtf C#?! + foreach (var kv in (IEnumerable>)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(); } } } diff --git a/TestApp/RenderWindow.cs b/TestApp/RenderWindow.cs index 6013724..f314146 100644 --- a/TestApp/RenderWindow.cs +++ b/TestApp/RenderWindow.cs @@ -61,8 +61,8 @@ namespace TestApp { GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); - Matrix4 modelview = Matrix4.LookAt(new Vector3(1000, 400, 1000), new Vector3(1000, 0, 0), Vector3.UnitY); - //Matrix4 modelview = Matrix4.LookAt(new Vector3(-3, 2, 3), new Vector3(0, 0, 0), Vector3.UnitY); + //Matrix4 modelview = Matrix4.LookAt(new Vector3(1000, 400, 1000), new Vector3(1000, 0, 0), Vector3.UnitY); + Matrix4 modelview = Matrix4.LookAt(new Vector3(-50, 20, 50), new Vector3(0, 0, 0), Vector3.UnitY); GL.MatrixMode(MatrixMode.Modelview); GL.LoadMatrix(ref modelview); diff --git a/TestApp/TestApp.pidb b/TestApp/TestApp.pidb index e8df7af..9242abe 100644 Binary files a/TestApp/TestApp.pidb and b/TestApp/TestApp.pidb differ diff --git a/TestApp/bin/Debug/NW4RTools.dll b/TestApp/bin/Debug/NW4RTools.dll index 40356de..d8f19a2 100755 Binary files a/TestApp/bin/Debug/NW4RTools.dll and b/TestApp/bin/Debug/NW4RTools.dll differ diff --git a/TestApp/bin/Debug/NW4RTools.dll.mdb b/TestApp/bin/Debug/NW4RTools.dll.mdb index 92742d0..330c38e 100644 Binary files a/TestApp/bin/Debug/NW4RTools.dll.mdb and b/TestApp/bin/Debug/NW4RTools.dll.mdb differ diff --git a/TestApp/bin/Debug/TestApp.exe b/TestApp/bin/Debug/TestApp.exe index 5b808e0..75cf443 100755 Binary files a/TestApp/bin/Debug/TestApp.exe and b/TestApp/bin/Debug/TestApp.exe differ diff --git a/TestApp/bin/Debug/TestApp.exe.mdb b/TestApp/bin/Debug/TestApp.exe.mdb index 8ec2779..f6489a1 100644 Binary files a/TestApp/bin/Debug/TestApp.exe.mdb and b/TestApp/bin/Debug/TestApp.exe.mdb differ -- cgit v1.2.3