-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCamera.h
60 lines (46 loc) · 1.01 KB
/
Camera.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
60
#pragma once
#include <memory>
#include <vector_types.h>
#include "float4x4.h"
class Camera
{
public:
Camera
(
float3 const & position, float3 const & lookAt,
float fov, float aspectRatio,
float nearPlane, float farPlane
);
// HACK for Light::camera()
// TODO: Improve design
Camera
(
float3 const & position, float3 const & lookAt,
float4x4 projectionMatrix
);
float3 position() const;
float4x4 viewMatrix() const;
float4x4 projectionMatrix() const;
float4x4 viewProjectionMatrix() const;
void update
(
double msLastFrameTime,
int windowWidthInPixels,
int windowHeightInPixels
);
void handleMouseButtonPress( int button, int state, int x, int y );
void handleMouseMovement( int newX, int newY );
private:
float3 m_position;
float3 m_lookAt;
float4x4 m_projectionMatrix;
// For handling GLUT events:
int m_startX;
int m_startY;
int m_startZ;
int m_endX;
int m_endY;
int m_endZ;
bool m_button1Down;
bool m_button2Down;
};