Guest User

Untitled

a guest
Oct 21st, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. TArray<int32> heightMap = CalculateNoise();
  2.  
  3. for (int32 x = 0; x < 16; ++x)
  4. {
  5. for (int32 y = 0; y<16; ++y)
  6. {
  7. for (int32 z = 0; z< 64; ++z)
  8. {
  9. int32 voxelIndex = x + (y * 16) + (z * (16*16));
  10.  
  11. int heightmapValue = heightMap[voxelIndex];
  12.  
  13. if (z == 30 + heightmapValue)
  14. ChunkIDs[voxelIndex] = 1;
  15. else if (z == 29 + heightmapValue)
  16. ChunkIDs[voxelIndex] = 2;
  17. else
  18. ChunkIDs[voxelIndex] = 0;
  19.  
  20. }
  21. }
  22. }
  23.  
  24. TArray<int32> heightMap = CalculateNoise();
  25.  
  26. for (int32 x = 0; x < 16; ++x)
  27. {
  28. for (int32 y = 0; y<16; ++y)
  29. {
  30. for (int32 z = 0; z< 64; ++z)
  31. {
  32. int32 voxelIndex = x + (y * 16) + (z * (16*16));
  33.  
  34. int heightmapValue = heightMap[voxelIndex];
  35.  
  36. //If the block we're looking at is at the same level as the height map it must be on the surface
  37. if (z == heightmapValue)
  38. ChunkIDs[voxelIndex] = 1;
  39. else if (z < heightmapValue) //If it's less than that then it's underground
  40. ChunkIDs[voxelIndex] = 2;
  41. else //If it's not below or equal to then it must be air.
  42. ChunkIDs[voxelIndex] = 0;
  43.  
  44. }
  45. }
  46. }
Add Comment
Please, Sign In to add comment