SQCSimulator2023/SQCSim2021/chunk.h

31 lines
809 B
C
Raw Normal View History

#ifndef CHUNK_H__
#define CHUNK_H__
2021-10-11 11:37:58 -04:00
#include "define.h"
#include "array3d.h"
#include "vertexbuffer.h"
2021-10-31 00:31:08 -04:00
#include "blockinfo.h"
2021-10-11 11:37:58 -04:00
class Chunk {
private:
Array3d<BlockType> m_blocks = Array3d<BlockType>(CHUNK_SIZE_X, CHUNK_SIZE_Y, CHUNK_SIZE_Z);
VertexBuffer m_vertexBuffer;
bool m_isDirty = true;
2021-10-31 00:31:08 -04:00
void AddBlockToMesh(VertexBuffer::VertexData* vd, int& count, BlockType bt, int x, int y, int z, float u, float v, float s);
public:
2021-10-11 11:37:58 -04:00
Chunk();
~Chunk();
void RemoveBlock(int x, int y, int z);
void SetBlock(int x, int y, int z, BlockType type);
BlockType GetBlock(int x, int y, int z);
2021-10-31 00:31:08 -04:00
void Update(BlockInfo* blockinfo[BTYPE_LAST]);
2021-10-11 11:37:58 -04:00
void Render() const;
bool IsDirty() const;
};
#endif // CHUNK_H__