summaryrefslogtreecommitdiff
path: root/NW4RTools/ColladaExporter.cs
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-09-23 17:43:33 +0200
committerTreeki <treeki@gmail.com>2012-09-23 17:43:33 +0200
commitc9bfbf84244c8aa4e26ece994ef6b93386c708e3 (patch)
treed267d5732bed21c666750263d2ca62dcdfa9e44f /NW4RTools/ColladaExporter.cs
parent31380b4bb93d1fb65faff8f71753de80fb0a8c9d (diff)
downloadnw4rtools-c9bfbf84244c8aa4e26ece994ef6b93386c708e3.tar.gz
nw4rtools-c9bfbf84244c8aa4e26ece994ef6b93386c708e3.zip
tons of junk I'll clean up eventually
Diffstat (limited to '')
-rw-r--r--NW4RTools/ColladaExporter.cs22
1 files changed, 21 insertions, 1 deletions
diff --git a/NW4RTools/ColladaExporter.cs b/NW4RTools/ColladaExporter.cs
index 645b8dc..8ee111e 100644
--- a/NW4RTools/ColladaExporter.cs
+++ b/NW4RTools/ColladaExporter.cs
@@ -643,6 +643,7 @@ namespace NW4RTools {
List<string> triStrips = new List<string>();
List<string> lineStrips = new List<string>();
+ File.WriteAllBytes("DL.bin", shape.DisplayList2);
// Now go through the display list
while (true) {
@@ -651,7 +652,26 @@ namespace NW4RTools {
byte cmd = dl.ReadByte();
if (cmd == 0)
- break;
+ continue;
+
+ // These can contain other stuff. Who knew.
+
+ if ((cmd & 0x80) == 0) {
+ GXCommand castCmd = (GXCommand)cmd;
+
+ switch (castCmd) {
+ case GXCommand.LoadPosMtxFromArray:
+ case GXCommand.LoadNrmMtxFromArray:
+ case GXCommand.LoadTexCoordMtxFromArray:
+ case GXCommand.LoadLightFromArray:
+ dl.Skip(4);
+ break;
+ default:
+ Console.WriteLine("UNIMPLEMENTED GX COMMAND: {0}", castCmd);
+ break;
+ }
+ continue; // don't process it as a primitive
+ }
PrimitiveType prim = (PrimitiveType)((cmd >> 3) & 7);
int vtxCount = dl.ReadUInt16();