Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TArray<int32> heightMap = CalculateNoise();
- for (int32 x = 0; x < 16; ++x)
- {
- for (int32 y = 0; y<16; ++y)
- {
- for (int32 z = 0; z< 64; ++z)
- {
- int32 voxelIndex = x + (y * 16) + (z * (16*16));
- int heightmapValue = heightMap[voxelIndex];
- if (z == 30 + heightmapValue)
- ChunkIDs[voxelIndex] = 1;
- else if (z == 29 + heightmapValue)
- ChunkIDs[voxelIndex] = 2;
- else
- ChunkIDs[voxelIndex] = 0;
- }
- }
- }
- TArray<int32> heightMap = CalculateNoise();
- for (int32 x = 0; x < 16; ++x)
- {
- for (int32 y = 0; y<16; ++y)
- {
- for (int32 z = 0; z< 64; ++z)
- {
- int32 voxelIndex = x + (y * 16) + (z * (16*16));
- int heightmapValue = heightMap[voxelIndex];
- //If the block we're looking at is at the same level as the height map it must be on the surface
- if (z == heightmapValue)
- ChunkIDs[voxelIndex] = 1;
- else if (z < heightmapValue) //If it's less than that then it's underground
- ChunkIDs[voxelIndex] = 2;
- else //If it's not below or equal to then it must be air.
- ChunkIDs[voxelIndex] = 0;
- }
- }
- }
Add Comment
Please, Sign In to add comment