/*****************************************************************************
 * $Id: eng_class.cc,v 1.22 2006/08/27 18:47:42 devel Exp $
 * @file
 * @author	Jim E. Brooks  http://www.jimbrooks.org
 * @brief	Engine classes that serve as the engine's interface.
 *//*
 * LEGAL:   COPYRIGHT (C) 2004 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE (GPL).
 *****************************************************************************/

#define ENG_CLASS_CC 1
#include "eng.hh"
#include "eng_class.hh"

/*****************************************************************************
 * Constructor/destructor.
 *****************************************************************************/
Engine::Engine( void )
:   mCacheWorldVertex( DEFAULT_ENGINE_CACHE_SIZE, Cache<WorldVertex>::ARRAY ),  // interim size
    mCacheNormals(     DEFAULT_ENGINE_CACHE_SIZE, Cache<Normal>::ARRAY )        // interim size
{
	// nothing
}
Engine::~Engine()
{
    // nothing
}

/*****************************************************************************
 * Substitute for a constructor.
 * Initialization is split around processing of cmd-line args because
 * some members are assigned by cmd-line args.
 * @pre Must be called at run-time, not load-time (by static constructor).
 *****************************************************************************/
void
Engine::InitPreCmdarg( void )
{
	mTestFrameRate		= false;
	mSeed				= 0;
    mAtExitCalled       = false;
	mBusy				= 0;
	mVerbose			= 0;
	mQuiet				= 0;
	mSpeed				= eSpeed_NORMAL;
	mCacheSize			= DEFAULT_ENGINE_CACHE_SIZE;  // interim size
	mCollisions			= true;
	mStreamStatus		= &cout;
	mBackgroundRGBA.Set( RGB_SKYBLUE, 0.0 );
	mFogRGBA.Set( 0.60, 0.62, 0.67, 1.0 );
	mFogDensity			= 0.5;
#if SPEED
	mFSAA				= true;  // if video hw supports full-screen antialiasing
#else
	mFSAA				= false;
#endif
#if _WIN32
	mConsoleEnabled		= DEBUG_FLAG;
#endif
}
void Engine::InitPostCmdarg( void )
{
	// Caches are resized afterwards at eng_init.cc.
	SetCurrent( &mEye );
}

/*****************************************************************************
 * Set verbose level.
 * @return Previous verbose level.
 *****************************************************************************/
int
Engine::SetVerbose( int verbose )
{
	int prev = mVerbose;
	mVerbose = verbose;
	return prev;
}

/*****************************************************************************
 * Misc.
 *****************************************************************************/
void
Engine::EnableFog( bool enable )
{
	GFX_FOG( enable, GetFogDensity(), GetFogRGBA() );
}
