-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcamera.h
executable file
·71 lines (50 loc) · 1.66 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
61
62
63
64
65
66
67
68
69
70
71
/*
* Hostile Takeover:
* CS248 Final Project, Fall 2004
*
* Written by Jonathan Reeves
*
* A simple 3D video game demonstrating the use of OpenGL for graphics
* rendering with a number of advanced techniques and optimizations to make
* it interesting. See the README file which came with this package for more
* details. It also includes a list of sources which were consulted while
* building this software package.
*
*/
#ifndef __CAMERA_H__
#define __CAMERA_H__
#include "vector.h"
#include "player.h"
#ifndef CDAMPING
#define CDAMPING 0.20
#endif
typedef struct {
/* these three are treated as points */
vector_t position;
vector_t view;
vector_t up;
/* these two are treated as actual vectors */
vector_t forward;
vector_t right;
/* damping */
float dFactor;
} camera_t;
/* if needed */
camera_t *CameraAlloc(void);
void CameraDestroy(camera_t *cam);
void CameraInit(camera_t *cam);
void CameraZoom(camera_t *cam, float times);
/* most of these are pretty self explanatory */
void CameraUpdateView(camera_t *cam);
void CameraSetPosition(camera_t *cam, float x, float y, float z);
void CameraSetViewPoint(camera_t *cam, float x, float y, float z);
void CameraSetUpVector(camera_t *cam, float x, float y, float z);
void CameraFollowPlayer(camera_t *cam, player_t *player, float d, float h);
void CameraRotateView(camera_t *cam, float ang, float x, float y, float z);
void CameraMoveForward(camera_t *cam, float amt);
void CameraMoveBackward(camera_t *cam, float amt);
void CameraStrafeLeft(camera_t *cam, float amt);
void CameraStrafeRight(camera_t *cam, float amt);
void CameraCorrect(camera_t *cam, float yPos);
#endif