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.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 <glm/glm.hpp>
  22. namespace vtk {
  23. class World;
  24. class Chunk {
  25. public:
  26. Chunk(World& world);
  27. bool isVoxelSolid(const int& x, const int& y, const int& z); //Is the voxel not a transparent type?
  28. void setVoxelType(const int& x, const int& y, const int& z, const unsigned& type);
  29. unsigned getVoxelType(const unsigned& x, const unsigned& y, const unsigned& z);
  30. glm::ivec3 getWorldCoords(const int& x, const int& y, const int& z);
  31. void setPos(const glm::ivec3& pos);
  32. glm::ivec3 getPos();
  33. World& getWorld();
  34. ChunkRenderer renderer;
  35. protected:
  36. std::array<unsigned, 4096> voxels;
  37. World& mLinkedWorld;
  38. glm::ivec3 mPos;
  39. };
  40. }