diff options
Diffstat (limited to 'NW4RTools/ColladaExporter.cs')
-rw-r--r-- | NW4RTools/ColladaExporter.cs | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/NW4RTools/ColladaExporter.cs b/NW4RTools/ColladaExporter.cs index ccdc6b0..645b8dc 100644 --- a/NW4RTools/ColladaExporter.cs +++ b/NW4RTools/ColladaExporter.cs @@ -411,7 +411,7 @@ namespace NW4RTools { ambientClr.Values = new double[] { 0, 0, 0, 1 }; pShader.ambient.Item = ambientClr; - pShader.transparent = new common_transparent_type(); + /*pShader.transparent = new common_transparent_type(); pShader.transparent.opaque = fx_opaque_enum.A_ONE; var transparentClr = new common_color_or_texture_typeColor(); transparentClr.Values = new double[] { 1, 1, 1, 1 }; @@ -421,7 +421,7 @@ namespace NW4RTools { bs.Value = 1; pShader.transparency.Item = bs; // we can reuse DiffuseTex! - pShader.transparent.Item = diffuseTex; + pShader.transparent.Item = diffuseTex;*/ profile.technique.Item = pShader; @@ -641,7 +641,8 @@ namespace NW4RTools { // Create a list for tristrips beforehand, because they're THE most common List<string> triStrips = new List<string>(); - + List<string> lineStrips = new List<string>(); + // Now go through the display list while (true) { @@ -654,7 +655,8 @@ namespace NW4RTools { PrimitiveType prim = (PrimitiveType)((cmd >> 3) & 7); int vtxCount = dl.ReadUInt16(); - + Console.WriteLine("Got {0} , {1}", prim, vtxCount); + // first, parse it into a list of vertices GXIndexedVertex[] vtxs = new GXIndexedVertex[vtxCount]; string[] pVtxs = new string[vtxCount]; @@ -688,7 +690,6 @@ namespace NW4RTools { pTriData.AppendFormat("{0} ", pVtxs[i]); } - pTri.p = pTriData.ToString(); meshItems.Add(pTri); @@ -701,13 +702,21 @@ namespace NW4RTools { pTriStripData.AppendFormat("{0} ", pVtxs[i]); } - triStrips.Add(pTriStripData.ToString()); break; + + case PrimitiveType.LineStrip: + StringBuilder pLineStripData = new StringBuilder(); + + for (int i = 0; i < vtxCount; i++) { + pLineStripData.AppendFormat("{0} ", pVtxs[i]); + } + + lineStrips.Add(pLineStripData.ToString()); + break; + default: - - - Console.WriteLine("UNIMPLEMENTED PRIMITIVE TYPE"); + Console.WriteLine("UNIMPLEMENTED PRIMITIVE TYPE : %s", prim); return geo; } } @@ -722,8 +731,17 @@ namespace NW4RTools { pTriStrips.p = triStrips.ToArray(); meshItems.Add(pTriStrips); } - - + + if (lineStrips.Count > 0) { + var pLineStrips = new linestrips(); + pLineStrips.material = "NW4R_MATERIAL"; + pLineStrips.input = inputArray; + pLineStrips.count = (ulong)lineStrips.Count; + pLineStrips.p = lineStrips.ToArray(); + meshItems.Add(pLineStrips); + } + + m.Items = meshItems.ToArray(); // FINALLY DONE! |