From e962fd89af865d6e01522e9752f5fbd855ce128a Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 5 Mar 2011 05:25:14 +0100 Subject: partially working obj importer. still untested in-game --- TestApp/Main.cs | 19 +++++++++++++++++-- TestApp/RenderWindow.cs | 2 +- TestApp/TestApp.pidb | Bin 4288 -> 4240 bytes TestApp/bin/Debug/NW4RTools.dll | Bin 206336 -> 232960 bytes TestApp/bin/Debug/NW4RTools.dll.mdb | Bin 102677 -> 112922 bytes TestApp/bin/Debug/TestApp.exe | Bin 5632 -> 5632 bytes TestApp/bin/Debug/TestApp.exe.mdb | Bin 965 -> 979 bytes 7 files changed, 18 insertions(+), 3 deletions(-) (limited to 'TestApp') diff --git a/TestApp/Main.cs b/TestApp/Main.cs index b9a8f13..a5db889 100644 --- a/TestApp/Main.cs +++ b/TestApp/Main.cs @@ -11,7 +11,7 @@ namespace TestApp { public static void Main(string[] args) { string mdlPath = "/home/me/Games/Newer/ModelRev/"; - //string mdlName = "CS_W1"; + /*//string mdlName = "CS_W1"; //string mdlName = "bgB_4502"; //string mdlName = "cobKoopaCastle"; string mdlName = "waterPlate_W4boss"; @@ -22,7 +22,22 @@ namespace TestApp { byte[] file = File.ReadAllBytes(mdlPath + mdlName + ".brres"); ResFile rf = BrresReader.LoadFile(file); - File.WriteAllBytes(mdlPath + mdlName + "_rewritten.brres", BrresWriter.WriteFile(rf)); + File.WriteAllBytes(mdlPath + mdlName + "_rewritten.brres", BrresWriter.WriteFile(rf));*/ + + // Going to create a model! + ResFile rf = new ResFile(); + + ObjImporter.ImportModel(mdlPath, File.OpenText(mdlPath + "crapmap.obj"), rf, "CrapMap"); + + File.WriteAllBytes(mdlPath + "crapmap.brres", BrresWriter.WriteFile(rf)); + + + ResFile rf2 = BrresReader.LoadFile(File.ReadAllBytes(mdlPath + "crapmap.brres")); + using (var gw = new RenderWindow()) { + gw.Title = "crapmap"; + gw.SetModel(rf2, "CrapMap"); + gw.Run(1, 1); + } /*using (var gw = new RenderWindow()) { gw.Title = mdlName; diff --git a/TestApp/RenderWindow.cs b/TestApp/RenderWindow.cs index 3215190..2f29d0f 100644 --- a/TestApp/RenderWindow.cs +++ b/TestApp/RenderWindow.cs @@ -46,7 +46,7 @@ namespace TestApp { GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); //Matrix4 modelview = Matrix4.LookAt(new Vector3(1000, 600, 1000), new Vector3(1000, 0, 0), Vector3.UnitY); - Matrix4 modelview = Matrix4.LookAt(new Vector3(0, 0, 1000), new Vector3(0, 0, 0), Vector3.UnitY); + Matrix4 modelview = Matrix4.LookAt(new Vector3(0, 2, 4), 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 ad64e77..bbc694a 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 aa8cfdd..e4c2ea1 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 02e5217..62014b8 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 d0238aa..a5251b0 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 2998706..7508ce0 100644 Binary files a/TestApp/bin/Debug/TestApp.exe.mdb and b/TestApp/bin/Debug/TestApp.exe.mdb differ -- cgit v1.2.3