-
Notifications
You must be signed in to change notification settings - Fork 47
/
icamera.h
59 lines (49 loc) · 1.27 KB
/
icamera.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once
#include "imodule.h"
#include "icameraview.h"
#include "math/Vector3.h"
namespace ui
{
enum
{
CAMERA_PITCH = 0, // up / down
CAMERA_YAW = 1, // left / right
CAMERA_ROLL = 2, // fall over
};
/**
* The "global" interface of DarkRadiant's camera module.
*/
class ICamera :
public RegisterableModule
{
public:
/**
* greebo: Sets the camera origin to the given <point> using the given <angles>.
*/
virtual void focusCamera(const Vector3& point, const Vector3& angles) = 0;
// A reference to the currently active view. Will throw a std::runtime_error if no camera is present
virtual ICameraView& getActiveView() = 0;
};
typedef std::shared_ptr<ICamera> ICameraPtr;
} // namespace
const char* const MODULE_CAMERA("Camera");
// Accessor
// (this is named CameraView to avoid name conflicts with the existing GlobalCamera() accessor)
inline ui::ICamera& GlobalCameraView()
{
// Cache the reference locally
static ui::ICamera& _camera(
*std::static_pointer_cast<ui::ICamera>(
module::GlobalModuleRegistry().getModule(MODULE_CAMERA)
)
);
return _camera;
}
class Matrix4;
class CameraView
{
public:
virtual ~CameraView() {}
virtual void setModelview(const Matrix4& modelview) = 0;
virtual void setFieldOfView(float fieldOfView) = 0;
};