private static void ProcessPoints(List <ObjPrimitive> primitiveGroup, IReadOnlyList <VertexInfo> vertexInfo, IReadOnlyList <int> indices) { var primitive = new ObjPrimitive(PrimitiveCategory.Point, indices.Count); primitive.Vertices.AddRange(indices.Select(i => vertexInfo[i])); primitiveGroup.Add(primitive); }
private static void ProcessLineList(List <ObjPrimitive> primitiveGroup, IReadOnlyList <VertexInfo> vertexInfo, IReadOnlyList <int> indices) { for (int i = 0; i < indices.Count; i += 2) { var primitive = new ObjPrimitive(PrimitiveCategory.Line, 2); primitive.Vertices.Add(vertexInfo[indices[i]]); primitive.Vertices.Add(vertexInfo[indices[i + 1]]); primitiveGroup.Add(primitive); } }
private static void ProcessTriFan(List <ObjPrimitive> primitiveGroup, IReadOnlyList <VertexInfo> vertexInfo, IReadOnlyList <int> indices) { var a = vertexInfo[indices[0]]; var b = vertexInfo[indices[1]]; for (int i = 2; i < indices.Count; ++i) { var c = vertexInfo[indices[i]]; var primitive = new ObjPrimitive(PrimitiveCategory.Triangle, 3); primitive.Vertices.Add(a); primitive.Vertices.Add(b); primitive.Vertices.Add(c); primitiveGroup.Add(primitive); b = c; } }