Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void GenerateInstanceInformation()
- {
- Random rand = new Random();
- for (int x = 0; x < chunkWidth; x++)
- {
- for (int z = 0; z < chunkDepth; z++)
- {
- for (int y = 0; y < chunkHeight; y++)
- {
- Cube cubeToAdd = new Cube();
- cubeToAdd.World = Matrix.CreateTranslation(new Vector3(chunkStart.X + x, chunkStart.Y + y, chunkStart.Z + z));
- cubeToAdd.AtlasCoordinate = new Vector2(rand.Next(0, 2), rand.Next(0, 2));
- Cubes.Add(cubeToAdd);
- cubeArray[x, y, z] = cubeToAdd;
- }
- }
- }
- //CheckAdjacentCubes(Cubes, CubesToDraw);
- instanceBuffer = new VertexBuffer(device, instanceVertexDeclaration, Cubes.Count, BufferUsage.WriteOnly);
- instanceBuffer.SetData(Cubes.ToArray()); //edit this when ready to draw
- }
Advertisement
Add Comment
Please, Sign In to add comment