Patch - Improves camera controls and movement. - V14.5.33
Refactors camera input handling for smoother and more intuitive control. This change introduces a dedicated CameraInput structure and updates the camera class to use it for movement and rotation based on user input. It removes the old position class camera related logic and integrates mouse delta for precise rotation control and scroll wheel for speed adjustments. Updates ImGui layout to reflect the new size for the docked space.
This commit is contained in:
@@ -129,10 +129,35 @@ public:
|
||||
* @param float deltaTime : time since last frame
|
||||
* @return void
|
||||
*/
|
||||
void move(float deltatime);
|
||||
void move(float deltatime, float delta_x, float delta_y);
|
||||
|
||||
/**
|
||||
* Rotate the camera
|
||||
* @param float delta_x : mouse delta x
|
||||
* @param float delta_y : mouse delta y
|
||||
* @return void
|
||||
*/
|
||||
void rotate(float delta_x, float delta_y);
|
||||
|
||||
/**
|
||||
* Update the camera input states based on the provided input_class instance.
|
||||
* This method updates the internal state of the camera's input handling.
|
||||
* @param imputs A pointer to an input_class instance containing the current input states.
|
||||
*/
|
||||
void update_camera_inputs_states(input_class* imputs);
|
||||
|
||||
/**
|
||||
* Set the camera inputs structure.
|
||||
* @param inputs A shared pointer to a CameraInput structure containing the input states.
|
||||
*/
|
||||
void set_camera_inputs(std::shared_ptr<CameraInput> inputs) { inputs_ = inputs; }
|
||||
|
||||
/**
|
||||
* Get the camera inputs structure.
|
||||
* @return A shared pointer to the CameraInput structure containing the input states.
|
||||
*/
|
||||
std::shared_ptr<CameraInput> get_camera_inputs() { return inputs_; }
|
||||
|
||||
private:
|
||||
float position_x_, position_y_, position_z_;
|
||||
float rotation_x_, rotation_y_, rotation_z_;
|
||||
@@ -141,6 +166,7 @@ private:
|
||||
|
||||
float camera_speed_;
|
||||
std::shared_ptr<CameraInput> inputs_;
|
||||
float camera_sensitivity_ = 0.1f;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user