public void GenerateVertexBuffer(List<VertexPositionColorNormalNormal> vertices)
{
if (type != NodeType.Leaf)
{
for (int i = 0; i < 8; i++)
{
if (children[i] != null)
children[i].GenerateVertexBuffer(vertices);
}
}
//if (type != NodeType.Internal)
{
if (vertices == null || this.vertices.Length == 0)
return;
if (index == 639)
{
}
for (int i = 0; i < this.vertices.Length; i++)
{
if (this.vertices[i] == null)
continue;
this.vertices[i].index = vertices.Count;
Vector3 nc = this.vertices[i].normal * 0.5f + Vector3.One * 0.5f;
nc.Normalize();
Color c = new Color(nc);
vertices.Add(new VertexPositionColorNormalNormal(this.vertices[i].qef.Solve(1e-6f, 4, 1e-6f), c, this.vertices[i].normal, this.vertices[i].normal));
}
}
}