thatscringebro 9dfd911bff Init
2023-02-16 09:26:40 -05:00

34 lines
780 B
C++
Executable File

#ifndef CHUNK_H__
#define CHUNK_H__
#include "array3d.h"
#include "vertexbuffer.h"
#include "blockinfo.h"
#include "perlin.h"
#include <iostream>
class Chunk
{
public:
Chunk();
Chunk(float x, float z);
~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 Update(BlockInfo bi[BTYPE_LAST]);
void AddBlockToMesh(VertexBuffer::VertexData* vd, int& count, BlockType bt, int x, int y, int z, BlockInfo bi[BTYPE_LAST]);
void Render() const;
bool IsDirty() const;
private:
Array3d<BlockType> m_blocks;
VertexBuffer m_vertexBuffer;
bool m_isDirty;
float m_posx;
float m_posz;
float m_posy = -10;
};
#endif // CHUNK_H__