/*****************************************************************************
 * $Id: eng_lod.hh,v 1.3 2006/08/03 02:17:21 devel Exp $
 * @file
 * @author	Jim E. Brooks  http://www.jimbrooks.org
 * @brief	Level-of-detail.
 *//*
 * LEGAL:	COPYRIGHT (C) 2005 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE (GPL).
 *****************************************************************************/

#ifndef ENG_LOD_HH
#define ENG_LOD_HH 1

// There are two kinds of LODs: the global user-selected LOD (LodUser)
// and the LOD relative to a particular Object (LodObj).
// To avoid confusion, LodObj and LodUser are written explicitly rather than simply Lod.

/// @brief Level-of-detail values.
/// Methods make assumptions about the amount and order of these.
/// The 5 user LODs (min,low,mid,high,max) are collapsed into 3 to minimize footprint
/// of the Object class.
enum eLodObj
{
	// 3 levels (to minimize ObjectPoly).
	eLodObj_MIN,
	eLodObj_MID,
	eLodObj_MAX,
	eLodObj_LEVELS,
};
enum eLodUser
{
	// 5 levels.
    eLodUser_MIN,
    eLodUser_LOW,
    eLodUser_MID,	eLodUser_DEFAULT = eLodUser_MID,
    eLodUser_HIGH,
    eLodUser_MAX,
	eLodUser_LEVELS,
};

////////////////////////////////////////////////////////////////////////////////
// @brief User-select level-of-detail.
class LodUser
{
PREVENT_COPYING(LodUser)
public:
				LodUser( void )		{ mLod = eLodUser_DEFAULT; }
    /// Methods for user-selected level-of-detail (LOD) (get methods are hifreq).
    bool        IfReducedLod( void ) { return mLod != eLodUser_MAX; }
    eLodUser    Get( void )          { return mLod; }
    void        Set( eLodUser lod );
    void        Reset( void );
    void        Inc( void );

    /// Helpers to compare LOD.
    /// IfAtLeastLod() means if an equal or greater level-of-detail.
    bool        IfAtLeastLod( eLodUser lod ) { return mLod >= lod; }
    bool        IfLessLod( eLodUser lod )    { return mLod < lod; }
    bool        IfMaxLod( void )             { return mLod == eLodUser_MAX; }
    bool        IfMinLod( void )             { return mLod == eLodUser_MIN; }

    /// LOD/string conversion.
    const string&	Lod2String( eLodUser lod );
    eLodUser		String2Lod( const string& lod );

private:
    eLodUser		mLod;
};

#endif // ENG_LOD_HH
