SQCSimulator2023/SQCSim-common/chunk.h

40 lines
1.1 KiB
C
Raw Normal View History

2023-09-18 15:56:17 -04:00
#ifndef CHUNK_H__
#define CHUNK_H__
2023-09-30 14:54:39 -04:00
2023-09-18 15:56:17 -04:00
#include "define.h"
#include "array2d.h"
2023-09-30 14:46:54 -04:00
#include "array3d.h"
2023-09-18 15:56:17 -04:00
#include "blockinfo.h"
#include "opensimplex.h"
class World;
class Chunk {
2023-09-30 14:46:54 -04:00
private:
2023-09-18 15:56:17 -04:00
Array3d<BlockType> m_blocks = Array3d<BlockType>(CHUNK_SIZE_X, CHUNK_SIZE_Y, CHUNK_SIZE_Z);
2023-09-30 14:46:54 -04:00
bool m_isDirty = true;
2023-09-18 15:56:17 -04:00
bool m_isModified = false;
unsigned int m_posX; // Position du chunk dans l'array constituant le monde.
unsigned int m_posY;
public:
2023-09-30 14:46:54 -04:00
Chunk(unsigned int x, unsigned int y, int64_t seed);
2023-09-18 15:56:17 -04:00
~Chunk();
void RemoveBlock(int x, int y, int z, World* world);
void SetBlock(int x, int y, int z, BlockType type, World* world);
BlockType GetBlock(int x, int y, int z);
2023-09-30 14:46:54 -04:00
void CheckNeighbors(unsigned int x, unsigned int z, World* world);
2023-09-18 15:56:17 -04:00
void GetPosition(unsigned int& x, unsigned int& y) const;
2023-11-27 16:47:10 -05:00
void PlaceTree(int x, int y, int z, int height);
2023-09-18 15:56:17 -04:00
2023-11-20 16:02:45 -05:00
void Structure(int x, int y, int z, int height);
2023-09-30 14:46:54 -04:00
bool IsDirty() const;
void MakeDirty();
void MakeClean();
2023-09-18 15:56:17 -04:00
void MakeModified();
};
#endif // CHUNK_H__