MCPcopy Create free account
hub / github.com/OpenImageDebugger/OpenImageDebugger / Camera

Class Camera

src/visualization/components/camera.h:34–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32namespace oid {
33
34class Camera final : public Component {
35 public:
36 Camera(const std::shared_ptr<GameObject>& game_object,
37 const std::shared_ptr<RenderCanvas>& gl_canvas);
38
39 ~Camera() noexcept override;
40
41 Camera(const Camera& cam);
42
43 Camera& operator=(const Camera& cam);
44
45 static constexpr float zoom_factor{1.1f};
46
47 [[nodiscard]] mat4& projection() noexcept {
48 return projection_;
49 }
50
51 [[nodiscard]] const mat4& projection() const noexcept {
52 return projection_;
53 }
54
55 void update() override;
56
57 void draw(const mat4&, const mat4&) override {
58 // Do nothing
59 }
60
61 [[nodiscard]] bool post_buffer_update() override;
62
63 [[nodiscard]] bool post_initialize() override;
64
65 EventProcessCode key_press_event(int key_code) override;
66
67 void window_resized(int w, int h);
68
69 void scroll_callback(float delta);
70
71 void recenter_camera();
72
73 void mouse_drag_event(int mouse_x, int mouse_y) override;
74
75 [[nodiscard]] float compute_zoom() const;
76
77 void move_to(float x, float y);
78
79 [[nodiscard]] vec4 get_position() const;
80
81 [[nodiscard]] float get_zoom_power() const;
82
83 void set_zoom_power(float zoom_power);
84
85 private:
86 void update_object_pose() const;
87
88 [[nodiscard]] std::pair<float, float> get_buffer_initial_dimensions() const;
89
90 void scale_at(const vec4& center_ndc, float delta);
91

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected