MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / Camera

Class Camera

framework/camera.h:34–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32};
33
34class Camera
35{
36 public:
37 void update(float deltaTime);
38
39 // Update camera passing separate axis data (gamepad)
40 // Returns true if view or position has been changed
41 bool update_gamepad(glm::vec2 axis_left, glm::vec2 axis_right, float delta_time);
42
43 CameraType type = CameraType::LookAt;
44
45 glm::vec3 rotation = glm::vec3();
46 glm::vec3 position = glm::vec3();
47
48 float rotation_speed = 1.0f;
49 float translation_speed = 1.0f;
50
51 bool updated = false;
52
53 struct
54 {
55 glm::mat4 perspective;
56 glm::mat4 view;
57 } matrices;
58
59 struct
60 {
61 bool left = false;
62 bool right = false;
63 bool up = false;
64 bool down = false;
65 } keys;
66
67 bool moving();
68
69 float get_near_clip();
70
71 float get_far_clip();
72
73 void set_perspective(float fov, float aspect, float znear, float zfar);
74
75 void update_aspect_ratio(float aspect);
76
77 void set_position(const glm::vec3 &position);
78
79 void set_rotation(const glm::vec3 &rotation);
80
81 void rotate(const glm::vec3 &delta);
82
83 void set_translation(const glm::vec3 &translation);
84
85 void translate(const glm::vec3 &delta);
86
87 private:
88 float fov;
89 float znear, zfar;
90
91 void update_view_matrix();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected