To use it with VertexBuffer, I needed to make it inherit from IVertexType, otherwhise it won't work. Also needed is the VertexDeclaration along with it's get Methode, so it is readable and usable for this purpose. length() is not required but I needed it to test some cases with it.

I chose to work with Lists for Vertices and Indices so I do not need to realloc memory all the time on arrays.

As I needed normalized Vectors for the whole smoothing-process (in any other case there will only be the Ico with subdivided Triangles but no sphere at all)

I also made a little function for Adding Vectors and not caring if they're already Normalized.

This code takes the List as it is as a parameter to add the VertexPositionColorNormal and returns it (As I still didn't check if it's getting done by refference haha).

Not much else to say here.

I packed the whole creation-algorithm into the Initialize()-Methode.

First of all, as I work with Lists, I needed to change them into Arrays at the end to get this whole thing to work, so there are member-variables in the gameclass along with the vertexBuffer and indexBuffer

Okay. This alone will create the Ico at its Basic State, positioned at 0,0,0 with the radius of the Corners of 1

Now comes the refining (subdividing/smoothing, whatever you call it). Note that I, when I'll pack it into its own Class, I will make the Refining-Grade an choosable option, so there will not be number in the first for-loop anymore. This code is a little bit more, so I give the explaination the the comments:

//First I need a new List to store the Vertices as I need them from the first List and do not want to overwrite them
List<int> indices2 = new List<int>();
for (int j = 0; j <3 ; j++) //Number of Iteration for making it even smoother
{
for (int i = 0; i < indices.Count; i++) //Go through all Indices
{
//Here I get the Vertices responsible for ONE Triangle and store their index
Vector3 p1 = vertices[indices[i]].Position;
int p1I = (int)i++;
Vector3 p2 = vertices[indices[i]].Position;
int p2I = (int)i++;
Vector3 p3 = vertices[indices[i]].Position;
int p3I = (int)i;
//Now I get the Index of the Vertex I want to add (as vertices.Count gives the actual Number, this will be
//correct (counting from 1 to x+1 instead of 0 to x)
//Next I need to get the middle between to vertices ( in this case from vertice p1 to p2) and add it as a new Vertex
int a = (int)vertices.Count;
vertices = AddNormalizedVertex(vertices, new Vector3((p1.X + p2.X) / 2, (p1.Y + p2.Y) / 2, (p1.Z + p2.Z) / 2), Color.Gray, new Vector3(0, 0, 0));
//Same here with p2 to p3
int b = (int)vertices.Count;
vertices = AddNormalizedVertex(vertices, new Vector3((p2.X + p3.X) / 2, (p2.Y + p3.Y) / 2, (p2.Z + p3.Z) / 2), Color.Gray, new Vector3(0, 0, 0));
//And again with p1 to p3
int c = (int)vertices.Count;
vertices = AddNormalizedVertex(vertices, new Vector3(((p1.X + p3.X) / 2), ((p1.Y + p3.Y) / 2), ((p1.Z + p3.Z) / 2)), Color.Gray, new Vector3(0, 0, 0));
//Now reassaign the Indices to make them right (carefull at the order)
indices2.Add(indices[p1I]); indices2.Add(a); indices2.Add(c);
indices2.Add(indices[p2I]); indices2.Add(b); indices2.Add(a);
indices2.Add(indices[p3I]); indices2.Add(c); indices2.Add(b);
indices2.Add(a); indices2.Add(b); indices2.Add(c);
}
//The first List now gets cleared and after that it gets all the indices from the second list so it stays up-to-date with
//the correct order
indices.Clear();
foreach (int index in indices2)
{
indices.Add(index);
}
}

Aight. The lists now contains the vertices and the correct order of indices. Everything is fine till here.

Now I need to convert them to the arrays that we already created at the start: