Tramway SDK
firstperson.h
Go to the documentation of this file.
1// TRAMWAY DRIFT AND DUNGEON EXPLORATION SIMULATOR 2022
2// All rights reserved.
3
4#ifndef TRAM_SDK_EXTENSIONS_CAMERA_FIRSTPERSON_H
5#define TRAM_SDK_EXTENSIONS_CAMERA_FIRSTPERSON_H
6
8
9namespace tram::Ext::Camera {
10
11class FirstPersonCamera : public Camera {
12public:
15
16 void Update ();
17
18 void SetTilt(float tilt);
19 void SetMouselook(bool mouselook);
20 void SetRotateFollowing(bool rotate_following);
21 void SetBobbing(float bobbing_weight);
23 void SetBobbingTilt(float bobbing_tilt);
24 void SetBobbingCallback(void (*bob_callback)(FirstPersonCamera*));
25 void SetBobSpeed(float speed);
26
27 float GetBob();
28 float GetWeight();
29
30
31
32 //inline void SetFollowing(Entity* following) { this->following = following; }
33 inline void SetFollowingInterpolation(float following_interpolation) { this->following_interpolation = following_interpolation; }
34 inline void SetFollowingOffset(vec3 offset) { this->following_offset = offset; }
35
36protected:
37 float tilt = 0.0f;
38 float tilt_goal = 0.0f;
39 float tilt_last = 0.0f;
40 float bob = 0.0f;
41 float bobbing_weight_goal = 0.0f;
42 float bobbing_weight = 0.0f;
43 float bobbing_distance = 0.2f;
44 float bobbing_tilt_goal = 0.0f;
45 float bobbing_tilt = 0.0f;
46 float bob_speed = 0.1f;
48 void (*bob_callback)(FirstPersonCamera*) = nullptr;
49
50 bool mouselook = false;
51 bool rotate_following = false;
52 float yaw = 0.0f;
53 float pitch = 0.0f;
54
55 vec3 following_offset = vec3 (0.0f, 0.0f, 0.0f);
56 float following_interpolation = 1.0f;
57 //Entity* following = nullptr;
58};
59
60}
61
62#endif // TRAM_SDK_EXTENSIONS_CAMERA_FIRSTPERSON_H
Definition: camera.h:13
Definition: firstperson.h:11
void SetFollowingInterpolation(float following_interpolation)
Definition: firstperson.h:33
float bobbing_tilt_goal
Definition: firstperson.h:44
void SetFollowingOffset(vec3 offset)
Definition: firstperson.h:34
void SetTilt(float tilt)
Definition: firstperson.cpp:18
void SetBobSpeed(float speed)
Definition: firstperson.cpp:42
~FirstPersonCamera()
Definition: firstperson.h:14
float bobbing_tilt
Definition: firstperson.h:45
float bobbing_distance
Definition: firstperson.h:43
void SetBobbingTilt(float bobbing_tilt)
Definition: firstperson.cpp:38
float GetWeight()
Definition: firstperson.cpp:54
float bob_speed
Definition: firstperson.h:46
float tilt_last
Definition: firstperson.h:39
int callback_count
Definition: firstperson.h:47
float bobbing_weight_goal
Definition: firstperson.h:41
void SetRotateFollowing(bool rotate_following)
Definition: firstperson.cpp:26
float bob
Definition: firstperson.h:40
void SetBobbingCallback(void(*bob_callback)(FirstPersonCamera *))
Definition: firstperson.cpp:46
float tilt_goal
Definition: firstperson.h:38
FirstPersonCamera()
Definition: firstperson.h:13
void SetBobbingDistance(float bobbing_distance)
Definition: firstperson.cpp:34
void SetMouselook(bool mouselook)
Definition: firstperson.cpp:22
float bobbing_weight
Definition: firstperson.h:42
float GetBob()
Definition: firstperson.cpp:50
void Update()
Definition: firstperson.cpp:58
void SetBobbing(float bobbing_weight)
Definition: firstperson.cpp:30
float tilt
Definition: firstperson.h:37
Definition: camera.cpp:13
glm::vec3 vec3
Definition: math.h:12