SQCSimulator2023/SQCSim2021/mesh.h

32 lines
803 B
C
Raw Normal View History

2023-09-30 14:46:54 -04:00
#ifndef MESH_H__
#define MESH_H__
#include "../SQCSim-common/chunk.h"
#include "../SQCSim-common/world.h"
#include "define.h"
#include "vertexbuffer.h"
class Mesh {
private:
VertexBuffer m_vertexBuffer;
VertexBuffer::VertexData* m_vd = nullptr;
int m_vcount = 0;
bool m_new = true;
Chunk* m_chunk; // NE PAS D<>TRUIRE ICI.
void AddBlockToMesh(VertexBuffer::VertexData* vd, int& count, BlockType bt, int x, int y, int z, float u, float v, float s, World* world);
public:
Mesh(Chunk* chunk);
~Mesh();
void FlushMeshToVBO();
void FlushVBO();
void Update(BlockInfo* blockinfo[BTYPE_LAST], World* world);
void Render() const;
bool IsDirty() const;
bool IsNew();
void GetPosition(unsigned int& x, unsigned int& y, World* world) const;
};
#endif