// This file is part of ThriceBall.
//
// Author: Kai Hillenbrand (AnTeevY)
// © Copyright, 2009 by Kai Hillenbrand, http://www.anteevy.de

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

#pragma once
#ifndef RENDERER_H
#define RENDERER_H

// extern includes
#include "OgreCEGUIRenderer.h"
#include "OgreTextAreaOverlayElement.h"
#include "OgreFontManager.h"
#include "cegui/CEGUI.h"
#include <NxOgre.h>
#include <NxOgreOGRE3D.h>
#include <Nx.h>
#include <NxScene.h>
#include <NxPhysicsSDK.h>

// intern includes
#include "framelistener.h"
#include "baserenderer.h"
#include "interface.h"
#include "level.h"
#include "player.h"
#include "audio.h"

class CInterface;
class CLevel;
class CPlayer;
class CAudio;

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

class CRenderer : public CBaseRenderer , public NxOgre::Callback
{
public:
	CRenderer(){}

	void createCamera(void);			// create the main camera
	void createScene(void);				// create the scene
	void createFrameListener(void);		// create the frame listener
	void createArrowPlane();			// create the mouse arrow plane (for direction)
	void createCheckPointParticles();	// create the checkpoint partibles
	void initNxOgre();					// initialize NxOgre

	// get functions
	bool getContRend(){return m_bContRend;}				// should rendering continue?
	bool getDebugMode(){return m_bDebugMode;}			// is in debug mode?
	bool shadowsEnabled(){return m_bShadows;}			// are shadows enabled?
	int getResolution(){return m_iResolution;}			// get resolution number
	String getLevelName(){return m_sLevelName;}			// returns the level name
	CInterface* getInterface(){return m_pInterface;}	// get the interface pointer
	CPlayer* getPlayer(){return m_pPlayer;}				// get the player pointer
	CLevel* getLevel(){return m_pLevel;}				// get the level pointer
	CAudio* getAudio(){return m_pAudio;}				// get the audio pointer
	CBaseFrameListener*	getFrameListener(){return m_pFrameListener;}	// get the frame listener pointer
	Ogre::SceneManager* getSceneManager(){return m_pSceneMgr;}			// get the scene manager pointer
	Ogre::RenderWindow* getWindow(){return m_pWindow;}					// get the get window pointer
	NxOgre::Scene* getScene(){return m_pScene;}

	// set functions
	void setContRend(bool cr){m_bContRend = cr;}		// set false, if rendering should stop
	void setAudio(CAudio *audio){m_pAudio = audio;}		// set the audio pointer

private:
	bool m_bContRend;	// rendering should continue

	// pointers to instances
	CInterface *m_pInterface;
	CLevel *m_pLevel;
	CPlayer *m_pPlayer;
	CAudio *m_pAudio;

	// NxOgre
	NxOgre::World *m_pWorld;
	NxOgre::Scene *m_pScene;
	NxOgre::TimeController *m_pTimeController;
	OGRE3DRenderSystem *m_pRenderSystem;
};

#endif