/
camera.h
62 lines (51 loc) · 2.3 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
/*
Copyright (c) 2017-2018 ByteBit
This file is part of BetterSpades.
BetterSpades is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
BetterSpades is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with BetterSpades. If not, see <http://www.gnu.org/licenses/>.
*/
#define CAMERAMODE_SELECTION 0
#define CAMERAMODE_FPS 1
#define CAMERAMODE_SPECTATOR 2
#define CAMERAMODE_BODYVIEW 3
#define CAMERA_DEFAULT_FOV 70.0F
extern unsigned char camera_mode;
extern float frustum[6][4];
extern float camera_rot_x, camera_rot_y;
extern float camera_x, camera_y, camera_z;
extern float camera_vx, camera_vy, camera_vz;
extern float camera_fov;
extern float camera_size;
extern float camera_height;
extern float camera_eye_height;
extern float camera_movement_x, camera_movement_y, camera_movement_z;
extern float camera_speed;
struct Camera_HitType {
char type;
float x,y,z,distance;
int xb,yb,zb;
unsigned char player_id, player_section;
};
#define CAMERA_HITTYPE_NONE 0
#define CAMERA_HITTYPE_BLOCK 1
#define CAMERA_HITTYPE_PLAYER 2
void camera_hit_fromplayer(struct Camera_HitType* hit, int player_id, float range);
void camera_hit(struct Camera_HitType* hit, int exclude_player, float x, float y, float z, float ray_x, float ray_y, float ray_z, float range);
void camera_hit_mask(struct Camera_HitType* hit, int exclude_player, float x, float y, float z, float ray_x, float ray_y, float ray_z, float range);
float camera_fov_scaled();
void camera_ExtractFrustum(void);
unsigned char camera_PointInFrustum(float x, float y, float z);
int camera_CubeInFrustum(float x, float y, float z, float size, float size_y);
int* camera_terrain_pick(unsigned char mode);
int* camera_terrain_pickEx(unsigned char mode, float x, float y, float z, float ray_x, float ray_y, float ray_z);
void camera_overflow_adjust(void);
void camera_apply(void);
void camera_update(float dt);