/*****************************************************************************
 * $Id: mod_pony_cloud_cirrus.hh,v 1.1 2006/11/24 21:56:58 devel Exp $
 * @file
 * @author	Jim E. Brooks  http://www.jimbrooks.org
 * @brief	CirrusCloud class.
 *//*
 * LEGAL:	COPYRIGHT (C) 2006 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE (GPL).
 *****************************************************************************/

#if COMPILING_MODULE_PONY
#ifndef MOD_PONY_CLOUD_CIRRUS_HH
#define MOD_PONY_CLOUD_CIRRUS_HH 1

#include "eng_billboard.hh"
#include "mod_pony_cloud.hh"

////////////////////////////////////////////////////////////////////////////////
/// @brief CirrusCloud class.
///
class CirrusCloud : public FixedData, public BillboardOwner
{
private:
	PREVENT_COPYING(CirrusCloud)
	typedef FixedData Parent;

private:
    static const uint TEXTURE_WIDTH          = 1024/4;
    static const uint TEXTURE_WIDTH_TUNED    = 1024;         // width which texture's visual appearance was tuned
    static const uint SLICES                 = 1;
    static const uint SLICE_TEXTURE_RATIO    = 1;            // must be integral and < sliceCnt

public:
	////////////////////////////////////////////////////////////////////////////
    /// Parameters defining the shape of a cloud.
    ///
	/// Radius is omitted.  Rather, radius is a member of the Object class,
	/// and can be used to differently scale clouds with the same Shape.
    ///
    class Shape
    {
	public:
        // Use texture name as STL container's key.
        Shape( const string& textureName ) { mTextureNames.push_back( textureName ); }
		friend bool operator<( const Shape& a, const Shape& b ) { return a.mTextureNames[0] < b.mTextureNames[0]; }
        friend class CirrusCloud;        
	private:
        Billboard::Parm::TextureNameContainer  mTextureNames;  // only one, single-slice billboard
    };

public:
					CirrusCloud( QuadrantPtrConst q, const Position& pos, const fp radius, const Shape& shape, const bool asBillboard = false );
					~CirrusCloud();
	void			FinalConstruction( void ) { }
	const string	GetName( void ) { return string("CirrusCloud"); }
    bool            Reproducible( void ) { return true; }
    int             Visible( void );
	void			Draw( void );

private:
	// Methods required by BillboardOwner:
	// GetDistance() exists in BillboardOwner and Object.
    void            Paint( Billboard& billboard, const uint sliceIdx,
                           Billboard::Texel* const texels, const uint texelCnt );
	fp				GetDistance( void ) { return Object::GetDistance(); }

	TexQuad								mTexQuad;
	static SafePtr<const Shape>  		msShape;        		// implied arg for Paint()
	static CloudBillboardMap<Shape>     msCloudBillboardMap;	// associates a particular cloud shape with a Billboard object
};

#endif // MOD_PONY_CLOUD_CIRRUS_HH
#endif // COMPILING_MODULE_PONY
