/* -----------------------------------------------------------------------------
	GSFramework
	Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */


#ifndef	__GPUTRIANGLEBATCH__
#define	__GPUTRIANGLEBATCH__


		#include "core/material.h"
		#include "core/render_data.h"
		#include "math/vector.h"
		#include "color/color.h"
		#include "container/narray.h"
		#include "ntypes.h"


namespace GS {
	namespace GPU {
		class Renderer;

class	TriangleBatch
{
		Renderer		&renderer;

		uint			batch_max_triangle_count;
		uint			batch_triangle_count, batch_attrib_offset;

		Array <ushort> batch_idx;
		Array <Vector4> batch_vtx;
		Array <Color> batch_col;
		Array <Vector2> batch_uv;

		const Render::Texture *batch_t;

		Core::Material::BlendOperator batch_blend_op;
		Core::Material::RenderWord batch_render_word;

public:

		void			DrawTriangle(uint triangle_count, uint attrib_count, const Vector4 *, const ushort *, const Color *, const Vector2 *uv, const Render::Texture *, Core::Material::BlendOperator, Core::Material::RenderWord);
		void			Flush();

		TriangleBatch(Renderer &, uint batch_max_tri = 1024);
};

	} // GPU
} // GS


#endif	// __GPUTRIANGLEBATCH__
