-
Notifications
You must be signed in to change notification settings - Fork 5
/
Camera.h
51 lines (46 loc) · 1.26 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
#pragma once
#include "common.h"
#include "Pool.h"
class TrackerCamera;
class Client;
class Layer;
class Camera {
public:
static int id_gen;
int id;
Vec3 loc;
Vec3 look_at, look_up;
TrackerCamera *tracker;
Client *remote_client;
ObjectPool<Layer> target_layers;
Camera() : tracker(0), remote_client(0) { id = id_gen++; }
Camera(Client *cl);
inline void setLoc(Vec2 lc) {
loc.x = lc.x;
loc.y = lc.y;
loc.z = 0;
}
inline void setLoc(Vec3 lc) {
loc = lc;
}
inline void setLoc(float x,float y){
loc.x = x;
loc.y = y;
}
inline void setLoc( float x, float y, float z ) {
loc.x = x; loc.y = y; loc.z = z;
}
inline void setLookAt( Vec3 at, Vec3 up ) {
look_at = at;
look_up = up;
}
inline Vec3 getLookAt() { return look_at; }
static void screenToGL( int scr_x, int scr_y, int scrw, int scrh, Vec2 *out );
Vec2 screenToWorld( int scr_x, int scr_y, int scr_w, int scr_h );
Vec3 getDirection() { return look_at - loc; }
void adjustInsideDisplay( Vec2 scrsz, Vec2 area_min, Vec2 area_max, float zoom_rate );
void onTrack( RemoteHead *rh ); // Send changes to all clients
void onTrackDynamic(); // Function for dynamic_cameras. send changes to only a client.
void addTargetLayer(Layer *l);
void delTargetLayer(Layer *l);
};