Guest User

Untitled

a guest
Oct 17th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. private void GenerateInstanceInformation()
  2. {
  3. Random rand = new Random();
  4.  
  5. for (int x = 0; x < chunkWidth; x++)
  6. {
  7. for (int z = 0; z < chunkDepth; z++)
  8. {
  9. for (int y = 0; y < chunkHeight; y++)
  10. {
  11. Cube cubeToAdd = new Cube();
  12.  
  13. cubeToAdd.World = Matrix.CreateTranslation(new Vector3(chunkStart.X + x, chunkStart.Y + y, chunkStart.Z + z));
  14. cubeToAdd.AtlasCoordinate = new Vector2(rand.Next(0, 2), rand.Next(0, 2));
  15.  
  16. Cubes.Add(cubeToAdd);
  17. cubeArray[x, y, z] = cubeToAdd;
  18. }
  19. }
  20. }
  21.  
  22. //CheckAdjacentCubes(Cubes, CubesToDraw);
  23.  
  24. instanceBuffer = new VertexBuffer(device, instanceVertexDeclaration, Cubes.Count, BufferUsage.WriteOnly);
  25. instanceBuffer.SetData(Cubes.ToArray()); //edit this when ready to draw
  26. }
Advertisement
Add Comment
Please, Sign In to add comment