summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-02-12 00:13:55 +0100
committerTreeki <treeki@gmail.com>2011-02-12 00:13:55 +0100
commitc7bfaabd5d2e3a07be51dcc4dd2837a0e8e70e81 (patch)
tree7ed793a4d415b90a566ad9cd933cb2fd522ca7b6
parent6d779d24736ad2ddb2a95e36a4122886308ecf13 (diff)
downloadnw4rtools-c7bfaabd5d2e3a07be51dcc4dd2837a0e8e70e81.tar.gz
nw4rtools-c7bfaabd5d2e3a07be51dcc4dd2837a0e8e70e81.zip
collada writer now exports basic meshes
Diffstat (limited to '')
-rw-r--r--NW4RTools/ColladaWriter.cs46
-rw-r--r--NW4RTools/NW4RTools.pidbbin524942 -> 525316 bytes
-rwxr-xr-xNW4RTools/bin/Debug/NW4RTools.dllbin157184 -> 157696 bytes
-rw-r--r--NW4RTools/bin/Debug/NW4RTools.dll.mdbbin87288 -> 87412 bytes
-rwxr-xr-xTestApp/bin/Debug/NW4RTools.dllbin157184 -> 157696 bytes
-rw-r--r--TestApp/bin/Debug/NW4RTools.dll.mdbbin87288 -> 87412 bytes
-rwxr-xr-xTestApp/bin/Debug/TestApp.exebin4096 -> 4096 bytes
-rw-r--r--TestApp/bin/Debug/TestApp.exe.mdbbin464 -> 464 bytes
8 files changed, 44 insertions, 2 deletions
diff --git a/NW4RTools/ColladaWriter.cs b/NW4RTools/ColladaWriter.cs
index 85b6867..60a3a75 100644
--- a/NW4RTools/ColladaWriter.cs
+++ b/NW4RTools/ColladaWriter.cs
@@ -18,6 +18,7 @@ namespace NW4RTools {
COLLADA Collada;
library_geometries LibGeometries;
+ library_visual_scenes LibVisualScenes;
private ColladaWriter(ResFile file) {
CurrentFile = file;
@@ -39,8 +40,10 @@ namespace NW4RTools {
Collada.asset.unit.meter = 1.0;
Collada.asset.up_axis = UpAxisType.Y_UP;
- Collada.Items = new object[1];
- Collada.Items[0] = LibGeometries = new library_geometries();
+ List<object> ColladaItems = new List<object>();
+
+ LibGeometries = new library_geometries();
+ ColladaItems.Add(LibGeometries);
LibGeometries.geometry = new geometry[CurrentModel.Shapes.Count];
@@ -208,6 +211,7 @@ namespace NW4RTools {
// Ok, we've written all the raw float data, now set up vertices
+ // TODO: Vertex colours
m.vertices = new vertices();
m.vertices.id = String.Format("{0}-lib-Vertex", kv.Key);
m.vertices.input = new InputLocal[1];
@@ -337,6 +341,44 @@ namespace NW4RTools {
geoIndex += 1;
}
+
+
+ // SHAPES ARE DONE.
+ // Next up: Visual Scenes (I will just create one atm)
+
+ LibVisualScenes = new library_visual_scenes();
+ ColladaItems.Add(LibVisualScenes);
+
+ LibVisualScenes.visual_scene = new visual_scene[1];
+ var mainScene = LibVisualScenes.visual_scene[0] = new visual_scene();
+
+ // TODO: Change this so it doesn't have the possibility of name collisions with shapes
+ mainScene.id = "RootNode";
+ mainScene.name = "RootNode";
+ var mainSceneNodeList = new List<node>();
+
+ // Right now: just make a node for each shape.
+ foreach (var kv in CurrentModel.Shapes) {
+ var thisNode = new node();
+
+ thisNode.id = kv.Key;
+ thisNode.name = kv.Key;
+ thisNode.instance_geometry = new instance_geometry[1];
+ thisNode.instance_geometry[0] = new instance_geometry();
+ thisNode.instance_geometry[0].url = String.Format("#{0}-lib", kv.Key);
+
+ mainSceneNodeList.Add(thisNode);
+ }
+
+ mainScene.node = mainSceneNodeList.ToArray();
+
+
+ // Finally, create a scene
+ Collada.scene = new COLLADAScene();
+ Collada.scene.instance_visual_scene = new InstanceWithExtra();
+ Collada.scene.instance_visual_scene.url = "#RootNode";
+
+ Collada.Items = ColladaItems.ToArray();
Collada.Save(outputStream);
}
}
diff --git a/NW4RTools/NW4RTools.pidb b/NW4RTools/NW4RTools.pidb
index 2c749c8..d136108 100644
--- a/NW4RTools/NW4RTools.pidb
+++ b/NW4RTools/NW4RTools.pidb
Binary files differ
diff --git a/NW4RTools/bin/Debug/NW4RTools.dll b/NW4RTools/bin/Debug/NW4RTools.dll
index 5d89012..85d9abd 100755
--- a/NW4RTools/bin/Debug/NW4RTools.dll
+++ b/NW4RTools/bin/Debug/NW4RTools.dll
Binary files differ
diff --git a/NW4RTools/bin/Debug/NW4RTools.dll.mdb b/NW4RTools/bin/Debug/NW4RTools.dll.mdb
index 662ff6c..f87c22c 100644
--- a/NW4RTools/bin/Debug/NW4RTools.dll.mdb
+++ b/NW4RTools/bin/Debug/NW4RTools.dll.mdb
Binary files differ
diff --git a/TestApp/bin/Debug/NW4RTools.dll b/TestApp/bin/Debug/NW4RTools.dll
index 5d89012..85d9abd 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 662ff6c..f87c22c 100644
--- a/TestApp/bin/Debug/NW4RTools.dll.mdb
+++ b/TestApp/bin/Debug/NW4RTools.dll.mdb
Binary files differ
diff --git a/TestApp/bin/Debug/TestApp.exe b/TestApp/bin/Debug/TestApp.exe
index 5955864..c53c4cf 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 b921fad..6f4ba2c 100644
--- a/TestApp/bin/Debug/TestApp.exe.mdb
+++ b/TestApp/bin/Debug/TestApp.exe.mdb
Binary files differ