private static void BuildPolygonList(Geometry geometry, GeometryBuildInfo geometryBuildInfo, Dictionary <Vertex, int> weightedVertexIdLookup) { var currentMaterial = default(MaterialBuildInfo); var geometryWeightedVertexIdLookup = geometryBuildInfo.WeightedVertices.Select(x => weightedVertexIdLookup[x]).ToList(); for (var i = 0; i < geometryBuildInfo.Meshes.Count; i++) { var mesh = geometryBuildInfo.Meshes[i]; // Add material parameters AddChangedMaterialParameters(geometry.PolygonList, mesh.Material, currentMaterial, i == 0); currentMaterial = mesh.Material; if (mesh.UnweightedIndices.Count > 0) { var unweightedStrips = GenerateStrips(mesh.UnweightedIndices); geometry.PolygonList.Add(new StripUVNChunk { Strips = unweightedStrips, }); } if (mesh.WeightedIndices.Count > 0) { var weightedStrips = GenerateStrips(mesh.WeightedIndices); foreach (var strip in weightedStrips) { for (var j = 0; j < strip.Indices.Length; j++) { var index = strip.Indices[j]; strip.Indices[j].Index = ( ushort )geometryWeightedVertexIdLookup[index.Index]; } } geometry.PolygonList.Add(new StripUVNChunk { Strips = weightedStrips, }); } } }