I have a CubeChunk class which creates indices and vertices for each "Cube" in my chunk. What I want to do is create a bounding box for each of these cubes, so what I'm wondering is what is the best way to do this? Should I create a separate list for each chunk and store the bounding boxes in that? Or should I call a CreateBoundingBox method each time the cube is created or drawn?
For Example
for (int x = 0; x < 50; x++)
{
for (int z = 0; z < 50; z++)
{
for (int y = 0; y <= map[x, z]; y++)
{
if (y >= 1)
{
SetUpIndicesAndVertices(x, map[x, z] - y, z, vertices, indices);
cubes.Add(new Cube.Stone(device, new Vector3(x, map[x, z] - y, z), stone));
CreateBoundingBox(some kind of vector3 values here);
}
else
{
SetUpIndicesAndVertices(x, map[x, z] - y, z, vertices, indices);
cubes.Add(new Cube.Grass(device, new Vector3(x, map[x, z] - y, z), grass));
CreateBoundingBox(some kind of vector3 values here);
}
}
}
Or I could replace the line with cubeBB.Add(new BoundingBox(some vector3 crap here). Which one would make more sense to use?