Tramway SDK
firstperson.h
Go to the documentation of this file.
1// Tramway Drifting and Dungeon Exploration Simulator SDK Runtime
2
3#ifndef TRAM_SDK_EXTENSIONS_CAMERA_FIRSTPERSON_H
4#define TRAM_SDK_EXTENSIONS_CAMERA_FIRSTPERSON_H
5
7
8namespace tram::Ext::Camera {
9
10class FirstPersonCamera : public Camera {
11public:
14
15 void Update ();
16
17 void SetTilt(float tilt);
18 void SetMouselook(bool mouselook);
20 void SetBobbing(float bobbing_weight);
22 void SetBobbingTilt(float bobbing_tilt);
24 void SetBobSpeed(float speed);
25
26 float GetBob();
27 float GetWeight();
28
29 inline void SetFollowingInterpolation(float following_interpolation) { this->following_interpolation = following_interpolation; }
30 inline void SetFollowingOffset(vec3 offset) { this->following_offset = offset; }
31
32protected:
33 float tilt = 0.0f;
34 float tilt_goal = 0.0f;
35 float tilt_last = 0.0f;
36 float bob = 0.0f;
37 float bobbing_weight_goal = 0.0f;
38 float bobbing_weight = 0.0f;
39 float bobbing_distance = 0.2f;
40 float bobbing_tilt_goal = 0.0f;
41 float bobbing_tilt = 0.0f;
42 float bob_speed = 0.1f;
44 void (*bob_callback)(FirstPersonCamera*) = nullptr;
45
46 bool mouselook = false;
47 bool rotate_following = false;
48 float yaw = 0.0f;
49 float pitch = 0.0f;
50
51 vec3 following_offset = vec3 (0.0f, 0.0f, 0.0f);
53};
54
55}
56
57#endif // TRAM_SDK_EXTENSIONS_CAMERA_FIRSTPERSON_H
Interface API for cameras.
Definition: camera.h:12
Definition: firstperson.h:10
bool rotate_following
Definition: firstperson.h:47
void SetFollowingInterpolation(float following_interpolation)
Definition: firstperson.h:29
float bobbing_tilt_goal
Definition: firstperson.h:40
void SetFollowingOffset(vec3 offset)
Definition: firstperson.h:30
void SetTilt(float tilt)
Definition: firstperson.cpp:28
void SetBobSpeed(float speed)
Sets the speed of the bobs during bobbing.
Definition: firstperson.cpp:63
~FirstPersonCamera()
Definition: firstperson.h:13
float pitch
Definition: firstperson.h:49
float bobbing_tilt
Definition: firstperson.h:41
float bobbing_distance
Definition: firstperson.h:39
void SetBobbingTilt(float bobbing_tilt)
Sets the tilt bobbed during bobbing.
Definition: firstperson.cpp:58
float GetWeight()
Definition: firstperson.cpp:78
float bob_speed
Definition: firstperson.h:42
float tilt_last
Definition: firstperson.h:35
int callback_count
Definition: firstperson.h:43
float bobbing_weight_goal
Definition: firstperson.h:37
void SetRotateFollowing(bool rotate_following)
Definition: firstperson.cpp:36
float bob
Definition: firstperson.h:36
void SetBobbingCallback(void(*bob_callback)(FirstPersonCamera *))
Sets the bobbing callback.
Definition: firstperson.cpp:70
float yaw
Definition: firstperson.h:48
vec3 following_offset
Definition: firstperson.h:51
float tilt_goal
Definition: firstperson.h:34
FirstPersonCamera()
Definition: firstperson.h:12
void SetBobbingDistance(float bobbing_distance)
Sets the distance bobbed during bobbing.
Definition: firstperson.cpp:50
bool mouselook
Definition: firstperson.h:46
void SetMouselook(bool mouselook)
Definition: firstperson.cpp:32
float bobbing_weight
Definition: firstperson.h:38
float GetBob()
Definition: firstperson.cpp:74
void(* bob_callback)(FirstPersonCamera *)
Definition: firstperson.h:44
void Update()
Definition: firstperson.cpp:82
float following_interpolation
Definition: firstperson.h:52
void SetBobbing(float bobbing_weight)
Sets the weight of the bobbing.
Definition: firstperson.cpp:44
float tilt
Definition: firstperson.h:33
Several different camera implementations.
glm::vec3 vec3
Definition: math.h:11