예제 #1
0
 void PopulateVoxelMap()
 {
     //Performs basic terrian generation
     for (int y = 0; y < VoxelData.ChunkHeight; y++)
     {
         for (int x = 0; x < VoxelData.ChunkWidth; x++)
         {
             for (int z = 0; z < VoxelData.ChunkWidth; z++)
             {
                 voxelMap[x, y, z] = worldGen.GenerateVoxel(new Vector3(x, y, z) + position).blockTypeIndex;
             }
         }
     }
     UpdateHeightMap();
     //Adds chunk to chunks in need of spawnable structures
     worldGen.GenerateSpawnableStructures(coord);
     _updateChunk();
     for (byte subChunkIndex = 0; subChunkIndex < VoxelData.ChunkSubdivisions; subChunkIndex++)
     {
         subchunks[subChunkIndex].Init();
     }
     lock (world.subchunksToDraw)
     {
         for (byte subChunkIndex = 0; subChunkIndex < VoxelData.ChunkSubdivisions; subChunkIndex++)
         {
             world.subchunksToDraw.Enqueue(subchunks[subChunkIndex].coord);
         }
     }
     isVoxelMapPopulated = true;
 }