Sloth loves Chunk!

This commit is contained in:
Marc-Eric Martel
2021-10-11 11:37:58 -04:00
parent 2347a3f7e4
commit 6f3dd99ab7
27 changed files with 19795 additions and 194 deletions

View File

@@ -1,16 +1,29 @@
#ifndef CHUNK_H__
#define CHUNK_H__
#include "blockarray3d.h"
#include "define.h"
#include "array3d.h"
#include "vertexbuffer.h"
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;
void AddBlockToMesh(VertexBuffer::VertexData* vd, int& count, BlockType bt, int x, int y, int z);
class Chunk : public BlockArray3d
{
public:
Chunk();
~Chunk();
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);
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);
void Update();
void Render() const;
bool IsDirty() const;
};
#endif // CHUNK_H__