You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

chunk.h 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * =====================================================================================
  3. *
  4. * Filename: chunk.h
  5. *
  6. * Description: Stores chunk information
  7. *
  8. * Version: 1.0
  9. * Created: 04/03/2014 07:23:43 PM
  10. * Revision: none
  11. * Compiler: gcc
  12. *
  13. * Author: YOUR NAME (),
  14. * Organization:
  15. *
  16. * =====================================================================================
  17. */
  18. #pragma once
  19. #include "voxelutils.h"
  20. #include "chunkrenderer.h"
  21. #include "graphics/chunkmesh.h"
  22. #include <glm/glm.hpp>
  23. namespace vtk {
  24. class World;
  25. class Chunk {
  26. public:
  27. Chunk(World& world);
  28. bool isLoaded();
  29. bool isVoxelSolid(const int& x, const int& y, const int& z); //Is the voxel not a transparent type?
  30. void setVoxelType(const int& x, const int& y, const int& z, const unsigned& type, const bool& update = false);
  31. unsigned getVoxelType(const unsigned& x, const unsigned& y, const unsigned& z);
  32. glm::ivec3 getWorldCoords(const int& x, const int& y, const int& z);
  33. void setPos(const glm::ivec3& pos);
  34. glm::ivec3 getPos();
  35. World& getWorld();
  36. ChunkRenderer renderer;
  37. protected:
  38. std::array<unsigned, 4096> voxels;
  39. World& mLinkedWorld;
  40. glm::ivec3 mPos;
  41. std::atomic<bool> mLoaded;
  42. };
  43. }