private void GenerateIndices() { List <StaticVertex> tempVertices = new List <StaticVertex>(); List <int> tempIndices = new List <int>(); foreach (StaticVertex v in VertexData) { //verifica se esiste un vertice giĆ nella lista int i = 0; bool found = false; foreach (StaticVertex v2 in tempVertices) { if (StaticVertex.Compare(v, v2)) { //travato found = true; break; } i++; } if (found) { tempIndices.Add(i); StaticVertex v2 = tempVertices[i]; //somma le normali } else { i = tempVertices.Count; tempVertices.Add(v); tempIndices.Add(i); } //normali StaticVertex vTemp = tempVertices[i]; vTemp.Normal += v.Normal; tempVertices[i] = vTemp; } //normalizzazione finale VertexData.Clear(); //foreach (VertexFormat v in tempVertices) //{ // v.Normal.Normalize(); // Vertices.Add(v); //} VertexData.AddRange(tempVertices); IndexData.Clear(); IndexData.AddRange(tempIndices); }