#ifndef INCLUDED_BILLBOARD_RENDERER
#define INCLUDED_BILLBOARD_RENDERER

#include <GLES/gl.h>

#include <map>
#include <memory>

//////////////////////////////////////////////////////////////
namespace Dubious {
namespace Renderer {

class Billboard;
class Camera;
class PngImage;
typedef std::shared_ptr<Billboard> BillboardPtr;
typedef std::shared_ptr<Camera> CameraPtr;
typedef std::shared_ptr<PngImage> PngImagePtr;

/// @brief Renders a Billboard
///
/// Billboards are very simple things, so the renderer
/// is pretty simple too.  Just draw the square and
/// splat the png into it.
class BillboardRenderer
{
public:
	BillboardRenderer();
	~BillboardRenderer();

	void				RenderBillboard( CameraPtr pCamera, BillboardPtr pBillboard );
	void				PreloadImage( PngImagePtr pImage );

	void				ResetGL();

private:
	BillboardRenderer( const BillboardRenderer& );
	BillboardRenderer& operator=( const BillboardRenderer& );

	void				BindToVBO();

	typedef std::map<PngImagePtr,GLuint> TextureMap;

	TextureMap			m_ImageTextures;
	GLuint				m_VertexID;
	GLuint				m_IndexID;
};

}
}

#endif
