This commit is contained in:
2026-02-05 16:50:06 +08:00
parent 1dd41256ff
commit 1bcfb49b7a
2 changed files with 133 additions and 46 deletions

View File

@@ -45,7 +45,7 @@ public:
updateCameraVectors();
}
void mouseCallback(float xoffset, float yoffset, GLboolean constrainPitch = true) {
void mouseMoveCallback(float xoffset, float yoffset, GLboolean constrainPitch = true) {
xoffset *= mouseSensitivity_;
yoffset *= mouseSensitivity_;
@@ -63,10 +63,25 @@ public:
updateCameraVectors();
}
void mouseScrollCallback(float yoffset) {
zoom_ -= yoffset;
if (zoom_ < 1.0f) {
zoom_ = 1.0;
}
if (zoom_ > 45.0f) {
zoom_ = 45.0;
}
updateCameraVectors();
}
glm::mat4 getViewMatrix() {
return glm::lookAt(position_, position_ + front_, up_);
}
bool firstMouse() const { return firstMouse_; }
void triggleFirstMouse() { firstMouse_ = !firstMouse_; }
private:
void updateCameraVectors() {
glm::vec3 front;