private PointCloud convertDataToArrays() { var vectors = new Vector3[Vertices.Count]; var normals = new Vector3[Vertices.Count]; Vector2[] textures = null; Vector3[] colors = null; if (Textures != null) { textures = new Vector2[Vertices.Count]; } if (Colors != null) { colors = new Vector3[Vertices.Count]; } for (int i = 0; i < Vertices.Count; i++) { VertexForCollada currentVertex = Vertices[i]; vectors[i] = currentVertex.Position; normals[i] = Normals[Convert.ToInt32(currentVertex.NormalIndex)]; if (textures != null) { textures[i] = Textures[Convert.ToInt32(currentVertex.TextureIndex)]; } if (colors != null) { colors[i] = Colors[Convert.ToInt32(currentVertex.ColorIndex)]; } } return(new PointCloud(vectors, colors, normals, PolyList.ToArray(), null, textures)); //return new PointCloud(verticesArray, normalsArray, texturesArray, colorsArray, PolyList.ToArray()); }
private void handleAlreadyProcessedVertex(VertexForCollada previousVertex, uint newNormalIndex, uint newTextureIndex, uint newColorIndex) { if (previousVertex.HasSameInformation(newNormalIndex, newTextureIndex, newColorIndex)) { PolyList.Add(previousVertex.Index); return; } if (previousVertex.DuplicateVertex != null) { handleAlreadyProcessedVertex(previousVertex.DuplicateVertex, newNormalIndex, newTextureIndex, newColorIndex); return; } var duplicateVertex = new VertexForCollada(System.Convert.ToUInt32(Vertices.Count), previousVertex.Position); duplicateVertex.NormalIndex = newNormalIndex; duplicateVertex.TextureIndex = newTextureIndex; duplicateVertex.ColorIndex = newColorIndex; previousVertex.DuplicateVertex = duplicateVertex; Vertices.Add(duplicateVertex); PolyList.Add(duplicateVertex.Index); }