Pyrogenesis  trunk
ICameraController.h
Go to the documentation of this file.
1 /* Copyright (C) 2019 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_ICAMERACONTROLLER
19 #define INCLUDED_ICAMERACONTROLLER
20 
21 #include "graphics/Camera.h"
23 
24 #include "lib/input.h" // InReaction - can't forward-declare enum
25 
26 /**
27  * @interface ICameraController defines a camera controller interface. The camera object
28  * is owned by the camera controller's owner. It is therefore guaranteed that the lifetime
29  * of the camera is at least the same as the lifetime of the camera controller.
30  * The camera object is stored by reference, ensuring that the camera controller has full
31  * control of the camera object during its own lifetime.
32  */
34 {
36 public:
37  explicit ICameraController(CCamera& camera);
38  virtual ~ICameraController();
39 
40  virtual void LoadConfig() = 0;
41 
42  virtual InReaction HandleEvent(const SDL_Event_* ev) = 0;
43 
44  virtual CVector3D GetCameraPivot() const = 0;
45  virtual CVector3D GetCameraPosition() const = 0;
46  virtual CVector3D GetCameraRotation() const = 0;
47  virtual float GetCameraZoom() const = 0;
48 
49  virtual void SetCamera(const CVector3D& pos, float rotX, float rotY, float zoom) = 0;
50  virtual void MoveCameraTarget(const CVector3D& target) = 0;
51  virtual void ResetCameraTarget(const CVector3D& target) = 0;
52  virtual void FollowEntity(entity_id_t entity, bool firstPerson) = 0;
53  virtual entity_id_t GetFollowedEntity() = 0;
54 
55  virtual void Update(const float deltaRealTime) = 0;
56  virtual void SetViewport(const SViewPort& vp) = 0;
57 
58  virtual bool GetConstrainCamera() const = 0;
59  virtual void SetConstrainCamera(bool constrain) = 0;
60 
61 protected:
63 };
64 
65 #endif // INCLUDED_ICAMERACONTROLLER
virtual void FollowEntity(entity_id_t entity, bool firstPerson)=0
virtual InReaction HandleEvent(const SDL_Event_ *ev)=0
Definition: Camera.h:33
camera controller interface.
Definition: ICameraController.h:33
virtual CVector3D GetCameraPosition() const =0
Definition: Vector3D.h:30
Definition: libsdl.h:52
virtual ~ICameraController()
virtual CVector3D GetCameraRotation() const =0
CCamera & m_Camera
Definition: ICameraController.h:62
virtual void LoadConfig()=0
NONCOPYABLE(ICameraController)
virtual void SetCamera(const CVector3D &pos, float rotX, float rotY, float zoom)=0
virtual entity_id_t GetFollowedEntity()=0
virtual void ResetCameraTarget(const CVector3D &target)=0
InReaction
Definition: input.h:34
ICameraController(CCamera &camera)
Definition: ICameraController.cpp:22
Definition: Camera.h:41
virtual void MoveCameraTarget(const CVector3D &target)=0
virtual float GetCameraZoom() const =0
virtual void SetViewport(const SViewPort &vp)=0
virtual void Update(const float deltaRealTime)=0
u32 entity_id_t
Entity ID type.
Definition: Entity.h:23
virtual CVector3D GetCameraPivot() const =0
virtual bool GetConstrainCamera() const =0
virtual void SetConstrainCamera(bool constrain)=0