/*****************************************************************************
 * $Id: eng_debug.hh,v 1.16 2006/07/04 23:38:33 devel Exp $
 * @file
 * @author	Jim E. Brooks  http://www.jimbrooks.org
 * @brief	Debug/profiling support, statistics, etc.
 *//*
 * LEGAL:	COPYRIGHT (C) 2004 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE (GPL).
 *****************************************************************************/

// ----- ! DEBUG ---------------------------------------------------------------

#if ! DEBUG
#define ENGINE_STATS_CODE( CODE )
#endif

// ----- DEBUG -----------------------------------------------------------------

#if DEBUG
#ifndef ENG_DEBUG_HH
#define ENG_DEBUG_HH 1

// Statistics code macro.
#undef  ENGINE_STATS_CODE
#if STATS && COMPILING_ENGINE
#define ENGINE_STATS_CODE( CODE ) { CODE }
#else
#define ENGINE_STATS_CODE( CODE )
#endif

#define STATS_CODE ERROR_USE_SPECIFIC_STATS_CODE_MACRO

void
EngineAssertHandler( bool cond, const char* fileName, int fileLine );

uint
MemUsed( void );

//------------------------------------------------------------------------------

#if STATS

extern ostream* gStreamStats;

////////////////////////////////////////////////////////////////////////////////
/// @brief Statistics.
class EngineStats
{
public:
			EngineStats( void );
	void	PreDrawViews( void );

	int		mPolygonAttribs;
	int		mCacheMissVertexs;
	int		mCacheMissNormals;
	int		mObjectGroupVisible;
	int		mObjectGroupInvisible;
};

ostream&
operator<<( ostream& strm, const EngineStats& o );

#endif // STATS

//------------------------------------------------------------------------------

#endif // ENG_DEBUG_HH
#endif // DEBUG
