2010-08-13 15:26:29 +02:00
|
|
|
/* Copyright (C) 2010 Wildfire Games.
|
2009-04-18 19:00:33 +02:00
|
|
|
* This file is part of 0 A.D.
|
|
|
|
*
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 0 A.D. 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2007-05-07 18:33:24 +02:00
|
|
|
#ifndef INCLUDED_GAMEVIEW
|
|
|
|
#define INCLUDED_GAMEVIEW
|
2004-07-27 23:00:53 +02:00
|
|
|
|
2005-10-19 19:16:34 +02:00
|
|
|
// needed by minimap
|
|
|
|
extern float g_MaxZoomHeight; //note: Max terrain height is this minus YMinOffset
|
|
|
|
extern float g_YMinOffset;
|
|
|
|
|
2006-09-24 13:25:11 +02:00
|
|
|
#include "renderer/Scene.h"
|
|
|
|
|
2007-01-13 19:32:03 +01:00
|
|
|
#include "lib/input.h" // InReaction - can't forward-declare enum
|
|
|
|
|
2004-07-27 23:00:53 +02:00
|
|
|
class CGame;
|
2007-01-08 02:56:46 +01:00
|
|
|
class CObjectManager;
|
|
|
|
class CCamera;
|
|
|
|
class CCinemaManager;
|
|
|
|
class CVector3D;
|
2010-06-03 21:07:59 +02:00
|
|
|
struct SViewPort;
|
2004-07-27 23:00:53 +02:00
|
|
|
|
2007-01-08 02:56:46 +01:00
|
|
|
struct JSObject;
|
|
|
|
|
|
|
|
class CGameViewImpl;
|
|
|
|
|
2009-01-03 19:40:28 +01:00
|
|
|
class CGameView : private Scene
|
2004-07-27 23:00:53 +02:00
|
|
|
{
|
2009-01-03 19:40:28 +01:00
|
|
|
NONCOPYABLE(CGameView);
|
2006-03-21 21:55:45 +01:00
|
|
|
public:
|
2010-05-21 20:31:47 +02:00
|
|
|
static const float defaultFOV, defaultCullFOV, defaultNear, defaultFar;
|
2006-03-21 21:55:45 +01:00
|
|
|
|
|
|
|
private:
|
2010-09-04 14:50:27 +02:00
|
|
|
static const float cameraPivotMargin;
|
2007-01-08 02:56:46 +01:00
|
|
|
CGameViewImpl* m;
|
2006-02-15 01:45:16 +01:00
|
|
|
|
|
|
|
// Check whether lighting environment has changed and update vertex data if necessary
|
|
|
|
void CheckLightEnv();
|
|
|
|
|
2006-09-24 13:25:11 +02:00
|
|
|
//BEGIN: Implementation of Scene
|
|
|
|
void EnumerateObjects(const CFrustum& frustum, SceneCollector* c);
|
|
|
|
//END: Implementation of Scene
|
2006-02-15 01:45:16 +01:00
|
|
|
|
2004-07-31 17:57:18 +02:00
|
|
|
// InitResources(): Load all graphics resources (textures, actor objects and
|
|
|
|
// alpha maps) required by the game
|
2005-10-31 19:57:03 +01:00
|
|
|
//void InitResources();
|
2004-12-16 13:41:54 +01:00
|
|
|
|
|
|
|
// UnloadResources(): Unload all graphics resources loaded by InitResources
|
|
|
|
void UnloadResources();
|
2006-02-15 01:45:16 +01:00
|
|
|
|
2004-07-27 23:00:53 +02:00
|
|
|
public:
|
|
|
|
CGameView(CGame *pGame);
|
2004-12-16 13:41:54 +01:00
|
|
|
~CGameView();
|
2006-02-15 01:45:16 +01:00
|
|
|
|
2010-06-03 21:07:59 +02:00
|
|
|
void SetViewport(const SViewPort& vp);
|
|
|
|
|
2010-06-30 23:41:04 +02:00
|
|
|
void RegisterInit();
|
|
|
|
int Initialize();
|
2005-03-22 03:17:55 +01:00
|
|
|
|
2007-01-08 02:56:46 +01:00
|
|
|
CObjectManager& GetObjectManager() const;
|
|
|
|
|
2006-02-15 01:45:16 +01:00
|
|
|
// Update: Update all the view information (i.e. rotate camera, scroll,
|
2004-07-31 17:57:18 +02:00
|
|
|
// whatever). This will *not* change any World information - only the
|
|
|
|
// *presentation*
|
|
|
|
void Update(float DeltaTime);
|
2006-02-15 01:45:16 +01:00
|
|
|
|
2004-07-31 17:57:18 +02:00
|
|
|
// Render: Render the World
|
2004-07-27 23:00:53 +02:00
|
|
|
void Render();
|
2005-09-28 05:49:11 +02:00
|
|
|
|
2006-08-26 23:52:18 +02:00
|
|
|
InReaction HandleEvent(const SDL_Event_* ev);
|
2005-09-29 01:57:55 +02:00
|
|
|
|
2010-08-13 15:26:29 +02:00
|
|
|
void MoveCameraTarget(const CVector3D& target);
|
|
|
|
void ResetCameraTarget(const CVector3D& target);
|
2010-08-14 02:52:19 +02:00
|
|
|
void ResetCameraAngleZoom();
|
2006-02-15 01:45:16 +01:00
|
|
|
|
2007-01-08 02:56:46 +01:00
|
|
|
CCamera *GetCamera();
|
|
|
|
CCinemaManager* GetCinema();
|
2006-02-15 01:45:16 +01:00
|
|
|
|
2007-01-08 02:56:46 +01:00
|
|
|
JSObject* GetScript();
|
2008-04-06 16:03:23 +02:00
|
|
|
static void ScriptingInit();
|
2004-07-27 23:00:53 +02:00
|
|
|
};
|
2006-08-26 23:52:18 +02:00
|
|
|
extern InReaction game_view_handler(const SDL_Event_* ev);
|
2005-08-15 01:34:37 +02:00
|
|
|
|
2004-07-27 23:00:53 +02:00
|
|
|
#endif
|