-
Notifications
You must be signed in to change notification settings - Fork 0
/
cameraWindow.h
69 lines (53 loc) · 1.82 KB
/
cameraWindow.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
61
62
63
64
65
66
67
68
#ifndef __CAMERA_WINDOW_H__
#define __CAMERA_WINDOW_H__
#include "glutMaster/glutMaster.h"
#include "Shader.h"
#include "Scene.h"
#include <time.h>
#include <vector>
class KeyAction {
public:
virtual void operator()(int deltaT) { };
};
class KeyHandler {
public:
KeyAction *action;
unsigned char key;
KeyHandler(KeyAction *a, unsigned char k) : action(a), key(k) { };
};
class CameraWindow : public GlutWindow{
bool camEnabled;
int height, width;
int initPositionX, initPositionY;
int startx, starty;
bool keyStates[256];
int time;
std::vector<KeyHandler> keyHandlers;
enum { moveSensitivity = 100, camSensitivity = 2};
void DisableView();
void EnableView(int x, int y);
void DrawGrass(GrassShader &shader, Grass &grass);
public:
Camera camera;
// These will go to scene class eventually
PhongShader *phongShader;
GrassShader *grassShader;
Scene *scene;
CameraWindow(GlutMaster &glutMaster,
int setWidth, int setHeight,
int setInitPositionX, int setInitPositionY,
const char *title);
~CameraWindow();
void CallBackDisplayFunc(void);
void CallBackReshapeFunc(int w, int h);
void CallBackIdleFunc(void);
void CallBackKeyboardFunc(unsigned char key, int x, int y);
void CallBackKeyboardUpFunc(unsigned char key, int x, int y);
void CallBackPassiveMotionFunc(int x, int y);
void CallBackMouseFunc(int button, int state, int x, int y);
void StartSpinning(GlutMaster &glutMaster);
void addKeyHandler(unsigned char key, KeyAction *a)
{ keyHandlers.push_back(KeyHandler(a,key)); }
KeyAction *removeKeyHandler(unsigned char key);
};
#endif