Adding updateDistance to camera.
This commit is contained in:
parent
53ca8caf56
commit
75c88681ee
12
camera.cc
12
camera.cc
@ -42,3 +42,15 @@ void Camera::updateRotation(glm::vec2 rotation) {
|
||||
this-> rotation += rotation;
|
||||
}
|
||||
}
|
||||
|
||||
void Camera:: updateDistance(float distance) {
|
||||
if (this->distance + distance <= 1.0f) {
|
||||
this->distance = 1.0f;
|
||||
}
|
||||
else if (this->distance + distance >= 100.0f) {
|
||||
this->distance = 100.f;
|
||||
}
|
||||
else {
|
||||
this->distance += distance;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ class Camera {
|
||||
~Camera();
|
||||
float getDistance();
|
||||
void setDistance(float distance);
|
||||
void updateDistance(float distance); //adds to current distance
|
||||
glm::vec2 getRotation();
|
||||
void setRotation(glm::vec2 rotation);
|
||||
void updateRotation(glm::vec2 rotation); //adds to current rotation
|
||||
|
Loading…
Reference in New Issue
Block a user