#ifndef INCLUDED_BILLBOARD
#define INCLUDED_BILLBOARD

#include <Math/CoordinateSpace.h>

#include <memory>
#include <vector>

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

class PngImage;
typedef std::shared_ptr<PngImage> PngImagePtr;

/// @brief A flat billboard that always faces the camera
///
/// Used to draw 2D things that always face the camera
/// no matter how it's rotated.  Useful for things like
/// explosions
class Billboard
{
public:
	Billboard( PngImagePtr pImage );
	~Billboard();

	// The billboard can have multiple textures drawn on top of
	// each other.  Each layer can be rotated.  It's a little
	// bit awkward that each layer also holds position information
	// as that's not respected, but bullet doesn't really have
	// a separate rotation objects that can get an OpenGL matrix.
	// The position of the billboard is represented as
	// m_Layers[0].CoordinateSpace().Position();
	struct Layer
	{
		Math::CoordinateSpace CoordinateSpace;
		PngImagePtr		pImage;
	};
	typedef std::vector<Layer> LayerVect;

	LayerVect&			Layers() { return m_Layers; }
	const LayerVect&	Layers() const { return m_Layers; }

	float				Size() const { return m_Size; }
	float&				Size() { return m_Size; }

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

	LayerVect			m_Layers;
	float				m_Size;
};

}
}

#endif
