www.pudn.com > RCApp-src.zip > Camera.h


/* 
	RedEye Project (http://members.ozemail.com.au/~ndmcevoy/) 
	Copyright (C) 2003  Nick McEvoy 
 
	This library is free software; you can redistribute it and/or 
	modify it under the terms of the GNU Library General Public 
	License as published by the Free Software Foundation; either 
	version 2 of the License, or (at your option) any later version. 
 
	This library is distributed in the hope that it will be useful, 
	but WITHOUT ANY WARRANTY; without even the implied warranty of 
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
	Library General Public License for more details. 
 
	You should have received a copy of the GNU Library General Public 
	License along with this library; if not, write to the Free 
	Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
 
	----------------------------------------------------------------- 
 
		Commented for use with Doxygen (http://www.doxygen.org) 
 
	----------------------------------------------------------------- 
*/ 
 
/*! \file Camera.h 
 *	\brief Game camera. 
 * 
 *		This file contains the game camera. 
 */ 
 
#ifndef _RE_GAME_CAMERA_H_ 
#define _RE_GAME_CAMERA_H_ 
 
// PLIB includes 
#include  
 
// Pre-declaration 
class reGameEntity; 
 
class reGameCamera 
{ 
public: 
	//! Constructor 
	reGameCamera(); 
 
	//! Destructor 
	~reGameCamera(){}; 
 
	//! Update camera 
	void Update(float fDeltaSec); 
 
	//! Position camera 
	void Display(); 
 
	//! Camera modes 
	enum eCameraMode 
	{ 
		eFixedView,				// Fixed pos 
		eFirstPersonView,		// Entity eye view 
		eExternalDetachedView,	// Free zoom & rotate, detached from entity hpr 
		eExternalAttachedView,	// Free zoom & rotate, attached to entity hpr 
		eExternalTrackingView	// Fixed pos & tracks entity 
	}; 
 
	//! Set 
	void SetCameraMode(eCameraMode eMode) {meCameraMode = eMode;}; 
	void SetCameraPos(sgCoord Pos) {sgCopyCoord(&mCameraPos, &Pos);}; 
	void SetViewOffset(sgCoord Pos) {sgCopyCoord(&mViewOffset, &Pos);}; 
	void SetExternalViewOffset(sgCoord Pos) {sgCopyCoord(&mExternalViewOffset, &Pos);}; 
	void SetAttachedViewOffset(sgCoord Pos) {sgCopyCoord(&mAttachedViewOffset, &Pos);}; 
	void SetEntityRef(reGameEntity* pEntity) {mpEntityRef = pEntity;}; 
	void SetTrackEntityRef(reGameEntity* pEntity) {mpTrackEntityRef = pEntity;}; 
	void SetViewZoomIn(bool bOn) {mbViewZoomIn = bOn;}; 
	void SetViewZoomOut(bool bOn) {mbViewZoomOut = bOn;}; 
	void SetViewUp(bool bOn) {mbViewUp = bOn;}; 
	void SetViewDown(bool bOn) {mbViewDown = bOn;}; 
	void SetViewLeft(bool bOn) {mbViewLeft = bOn;}; 
	void SetViewRight(bool bOn) {mbViewRight = bOn;}; 
 
	//! Get 
	eCameraMode& GetCameraMode() {return meCameraMode;}; 
	const sgCoord& GetCameraPos() {return mCameraPos;}; 
 
private: 
	eCameraMode meCameraMode; 
	sgCoord mCameraPos; 
	sgCoord mBlendCameraPos; 
	sgCoord mViewOffset; 
	sgCoord mExternalViewOffset; 
	sgCoord mAttachedViewOffset; 
	reGameEntity* mpEntityRef; 
	reGameEntity* mpTrackEntityRef; 
	bool mbViewZoomIn; 
	bool mbViewZoomOut; 
	bool mbViewUp; 
	bool mbViewDown; 
	bool mbViewLeft; 
	bool mbViewRight; 
}; 
 
#endif // _RE_GAME_CAMERA_H_