From 497a0b060c3cb3398bd85398f45072dec2242912 Mon Sep 17 00:00:00 2001 From: Faerbit Date: Thu, 13 Nov 2014 17:17:46 +0100 Subject: [PATCH] Added simple camera class. --- camera.cc | 30 ++++++++++++++++++++++++++++++ camera.hh | 20 ++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 camera.cc create mode 100644 camera.hh diff --git a/camera.cc b/camera.cc new file mode 100644 index 0000000..ab74395 --- /dev/null +++ b/camera.cc @@ -0,0 +1,30 @@ +#include "camera.hh" + +Camera::Camera(glm::vec3 rotation, float distance) { + this->rotation = rotation; + this->distance = distance; +} + +Camera::Camera() { + rotation = glm::vec3(0.0f, 0.0f, 0.0f); + distance = 1.0f; +} + +Camera::~Camera() { +} + +float Camera::getDistance() { + return distance; +} + +void Camera::setDistance(float distance) { + this->distance = distance; +} + +glm::vec3 Camera::getRotation() { + return rotation; +} + +void Camera::updateRotation(glm::vec3 rotation) { + this->rotation += rotation;; +} diff --git a/camera.hh b/camera.hh new file mode 100644 index 0000000..de936dd --- /dev/null +++ b/camera.hh @@ -0,0 +1,20 @@ +#ifndef CAMERA_HH_INCLUDED +#define CAMERA_HH_INCLUDED + +#include + +class Camera { + public: + Camera(glm::vec3 rotation, float distance); + Camera(); + ~Camera(); + float getDistance(); + void setDistance(float distance); + glm::vec3 getRotation(); + void updateRotation(glm::vec3 rotation); //adds to current rotation + private: + float distance; + glm::vec3 rotation; +}; + +#endif