//////////////////////////////////////////////////////////////////////////////
/// \file BaseApp.h
///
/// Provides a lightweight interface that, when coupled with
/// GLUTFramework, provides a rapid-prototype solution for
/// creating realtime OpenGL applications.
///
/// Stephen Timothy Cooney, 2009
//////////////////////////////////////////////////////////////////////////////
#ifndef BASEAPP_H
#define BASEAPP_H

/// Describes a root interface that GLUTFramework expects
/// while running.
class BaseApp
{
public:
	/// constructor's/destructors
	/// don't do anything here, wait
	/// for calls to Initiate and Shutdown
	BaseApp(){}
	virtual ~BaseApp(){};
	
	// Initialization
	virtual bool Initiate(unsigned int numArguments=0, char* arguments[]=0){return true;} /// Called immediately.
	virtual bool InitiateGraphics(){return true;} /// Called when a graphics context is active.
	virtual void ShutdownGraphics(){} /// Called before losing a graphics context.
	
	// Runtime
	virtual void Update(float timeStep){} /// Idle update.
	virtual void UpdateFixed(float timeStep){} /// Fixed rate update.
	virtual void Reshape(int width, int height){} /// On window reshape/resize.
	virtual void OnKeyboard(unsigned char key, int x, int y){} /// Keyboard input.
	virtual void OnMouse(int button, int state, int x, int y){} /// Mouse button input.
	virtual void OnMouseMotion(int x, int y){} /// Mouse motion input.
	virtual void GetViewPoint(float &eyeX,float &eyeY,float &eyeZ,float &centerX,float &centerY,float &centerZ,float &upX,float &upY,float &upZ){eyeX=eyeY=eyeZ=centerX=centerY=centerZ=upX=upY=upZ=0.0f;} /// Return the current viewpoint. Returning 0 uses default.
	virtual void GetShadowTarget(float &xOut, float &yOut, float &zOut){xOut=0.0f;yOut=0.0f;zOut=0.0f;} /// Return the current shadow origin/target.
	virtual void PreRender(){} /// Before framework rendering has begun.
	virtual void DrawGeometry(){} /// In framework rendering, draw any geometry.
	virtual void PostRender(){} /// After framework rendering has finished, but before GUI rendering.
	virtual void SetupPostProcess(){} /// Just before the MRT (if enabled) is rendered to the screen.
	virtual void CleanupPostProcess(){} /// Just after the MRT (if enabled) was rendered to the screen.
	virtual void PostGUIRender(){} /// After framework rendering and GUI rendering has finished.
	
	// Checks/Gets
	virtual bool ShouldQuit(){return false;} /// Return true when you want the application to close.
	virtual unsigned int GetNumHelpItems(){return 0;} /// How many help items will GetHelpItem(index) return?
	virtual char* GetHelpItem(unsigned int itemIndex) {return 0;} /// Return one of the help items as a terminated string.
	
	// Shutdown
	virtual void Shutdown(){} /// Called before total destruction.
};

#endif