Adding updateDistance to camera.

This commit is contained in:
Faerbit 2014-11-15 14:26:17 +01:00
parent 53ca8caf56
commit 75c88681ee
2 changed files with 13 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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