#ifndef __batch_h__
#define __batch_h__
#include "Wumbo-Renderer.h"
typedef struct
{
	float x, y, z;// 12
	unsigned int color;//4
	float u, v;//8
	float nx, ny, nz; // 12
} LD29Vertex;//36 total

const unsigned int MAX_TRIANGLE_COUNT = 4096;// 2048 triangles max supported
class Batch
{
public:
	LD29Vertex vertices[3 * MAX_TRIANGLE_COUNT];
	unsigned int vertexCount;
	GLuint vertexArray;
	GLuint vertexBuffer;
public:
	Batch();
	void clear();
	void addVertex(float x, float y, float z, unsigned int color, float u, float v, float nx, float ny, float nz);
	void compile();
	void draw(int count = -1);
	void begin();
	void finish();
	void addFloor(float x1, float y1, float z1, float x2, float y2, float z2, unsigned int color);
	void addCube(float x1, float y1, float z1, float x2, float y2, float z2, unsigned int color, bool left = true, bool right = true, bool up = true, bool down = true, bool top = true, bool bottom = true);
	void addUVTile(float x1, float y1, float z1, float x2, float y2, float z2, unsigned int color, float u, float v, float w, float h);
	void addTriangle(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, unsigned int color, float nx, float ny, float nz);
};
#endif