From 27042ea7b29185b89e972dd540905f8676ccf01e Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 18 Feb 2012 01:37:50 +0100 Subject: updates I made to Collada Exporter in November and never committed --- NW4RTools/ColladaExporter.cs | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'NW4RTools') 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 triStrips = new List(); - + List lineStrips = new List(); + // 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! -- cgit v1.2.3