summaryrefslogtreecommitdiff
path: root/TestApp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--TestApp/Main.cs16
-rw-r--r--TestApp/RenderWindow.cs57
-rw-r--r--TestApp/TestApp.csproj5
-rw-r--r--TestApp/TestApp.pidbbin2991 -> 3039 bytes
-rwxr-xr-xTestApp/bin/Debug/NW4RTools.dllbin166400 -> 173568 bytes
-rw-r--r--TestApp/bin/Debug/NW4RTools.dll.mdbbin90788 -> 93825 bytes
-rw-r--r--TestApp/bin/Debug/OpenTK.dllbin0 -> 2719744 bytes
-rw-r--r--TestApp/bin/Debug/OpenTK.dll.config12
-rwxr-xr-xTestApp/bin/Debug/TestApp.exebin4608 -> 5632 bytes
-rw-r--r--TestApp/bin/Debug/TestApp.exe.mdbbin548 -> 992 bytes
10 files changed, 88 insertions, 2 deletions
diff --git a/TestApp/Main.cs b/TestApp/Main.cs
index 3eb49a4..447f556 100644
--- a/TestApp/Main.cs
+++ b/TestApp/Main.cs
@@ -2,6 +2,9 @@ using System;
using System.IO;
using System.Collections.Generic;
using NW4RTools;
+using OpenTK;
+using OpenTK.Graphics;
+using OpenTK.Graphics.OpenGL;
namespace TestApp {
class MainClass {
@@ -10,13 +13,22 @@ namespace TestApp {
string mdlName = "CS_W1";
//string mdlName = "bgB_4502";
+ //string mdlName = "cobKoopaCastle";
string whatever = (mdlName == "CS_W2" || mdlName == "CS_W3" || mdlName == "CS_W6") ? "a" : "";
byte[] file = File.ReadAllBytes(mdlPath + mdlName + ".brres");
ResFile rf = BrresReader.LoadFile(file);
- var texs = rf.GetGroup<Texture>("Textures(NW4R)");
+ using (var gw = new RenderWindow()) {
+ gw.Title = mdlName;
+ gw.SetModel(rf, mdlName);
+ gw.Run(1, 1);
+ }
+
+
+
+ /*var texs = rf.GetGroup<Texture>("Textures(NW4R)");
// wtf C#?!
foreach (var kv in (IEnumerable<KeyValuePair<string,Texture>>)texs) {
kv.Value.BaseImage.Save(mdlPath + "images/" + kv.Key + ".png");
@@ -27,7 +39,7 @@ namespace TestApp {
//var sw = new StreamWriter(objFile);
//ObjWriter.WriteModel(sw, rf, mdlName);
ColladaWriter.WriteModel(objFile, rf, mdlName + whatever);
- objFile.Close();
+ objFile.Close();*/
}
}
}
diff --git a/TestApp/RenderWindow.cs b/TestApp/RenderWindow.cs
new file mode 100644
index 0000000..2dfe1ec
--- /dev/null
+++ b/TestApp/RenderWindow.cs
@@ -0,0 +1,57 @@
+using System;
+using NW4RTools;
+using OpenTK;
+using OpenTK.Graphics;
+using OpenTK.Graphics.OpenGL;
+using OpenTK.Input;
+
+namespace TestApp {
+ public class RenderWindow : GameWindow {
+ public RenderWindow() : base(800, 600, GraphicsMode.Default, "Test Model") {
+
+ }
+
+ private NW4RTools.Models.OpenGL.GLModel m_glModel;
+
+ public void SetModel(ResFile rf, string modelName) {
+ m_glModel = new NW4RTools.Models.OpenGL.GLModel(rf, modelName);
+ }
+
+
+ protected override void OnLoad(EventArgs e) {
+ base.OnLoad(e);
+
+ GL.ClearColor(0.1f, 0.2f, 0.5f, 0.0f);
+ GL.Enable(EnableCap.DepthTest);
+
+ m_glModel.Prepare(Context);
+ }
+
+ protected override void OnResize(EventArgs e) {
+ base.OnResize(e);
+
+ GL.Viewport(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height);
+
+ Matrix4 projection = Matrix4.CreatePerspectiveFieldOfView((float)Math.PI / 4, Width / (float)Height, 1.0f, 2000.0f);
+ GL.MatrixMode(MatrixMode.Projection);
+ GL.LoadMatrix(ref projection);
+ }
+
+ protected override void OnUpdateFrame(FrameEventArgs e) {
+ base.OnUpdateFrame(e);
+
+ GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
+
+ Matrix4 modelview = Matrix4.LookAt(new Vector3(0, 1200, 500), Vector3.UnitZ, Vector3.UnitY);
+ GL.MatrixMode(MatrixMode.Modelview);
+ GL.LoadMatrix(ref modelview);
+
+ m_glModel.Render(Context);
+
+ SwapBuffers();
+ }
+
+
+ }
+}
+
diff --git a/TestApp/TestApp.csproj b/TestApp/TestApp.csproj
index 5c96e3b..e979782 100644
--- a/TestApp/TestApp.csproj
+++ b/TestApp/TestApp.csproj
@@ -31,10 +31,15 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
+ <Reference Include="OpenTK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\CSharp\opentk\Binaries\OpenTK\Release\OpenTK.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AssemblyInfo.cs" />
+ <Compile Include="RenderWindow.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
diff --git a/TestApp/TestApp.pidb b/TestApp/TestApp.pidb
index bf2fb29..4b3557d 100644
--- a/TestApp/TestApp.pidb
+++ b/TestApp/TestApp.pidb
Binary files differ
diff --git a/TestApp/bin/Debug/NW4RTools.dll b/TestApp/bin/Debug/NW4RTools.dll
index 91a4b75..dbcb459 100755
--- a/TestApp/bin/Debug/NW4RTools.dll
+++ b/TestApp/bin/Debug/NW4RTools.dll
Binary files differ
diff --git a/TestApp/bin/Debug/NW4RTools.dll.mdb b/TestApp/bin/Debug/NW4RTools.dll.mdb
index 127ef0f..b67ce24 100644
--- a/TestApp/bin/Debug/NW4RTools.dll.mdb
+++ b/TestApp/bin/Debug/NW4RTools.dll.mdb
Binary files differ
diff --git a/TestApp/bin/Debug/OpenTK.dll b/TestApp/bin/Debug/OpenTK.dll
new file mode 100644
index 0000000..afff0dd
--- /dev/null
+++ b/TestApp/bin/Debug/OpenTK.dll
Binary files differ
diff --git a/TestApp/bin/Debug/OpenTK.dll.config b/TestApp/bin/Debug/OpenTK.dll.config
new file mode 100644
index 0000000..99aef86
--- /dev/null
+++ b/TestApp/bin/Debug/OpenTK.dll.config
@@ -0,0 +1,12 @@
+<configuration>
+ <dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
+ <dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
+ <dllmap os="linux" dll="openal32.dll" target="libopenal.so.1"/>
+ <dllmap os="linux" dll="alut.dll" target="libalut.so.0"/>
+ <dllmap os="linux" dll="opencl.dll" target="libOpenCL.so"/>
+ <dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
+ <dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
+ <dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
+ <dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
+ <dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/>
+</configuration>
diff --git a/TestApp/bin/Debug/TestApp.exe b/TestApp/bin/Debug/TestApp.exe
index 1bce1bb..bafaf4c 100755
--- a/TestApp/bin/Debug/TestApp.exe
+++ b/TestApp/bin/Debug/TestApp.exe
Binary files differ
diff --git a/TestApp/bin/Debug/TestApp.exe.mdb b/TestApp/bin/Debug/TestApp.exe.mdb
index 00eab08..3f3b216 100644
--- a/TestApp/bin/Debug/TestApp.exe.mdb
+++ b/TestApp/bin/Debug/TestApp.exe.mdb
Binary files differ