add class for camera (just stub for now)

This commit is contained in:
selim mustafaev 2015-07-26 21:04:22 +03:00
parent 71cc39a922
commit 25d5f5bc11
2 changed files with 43 additions and 0 deletions

20
src/Camera.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "Camera.h"
#include <GL/glew.h>
Camera::Camera() {
glm::vec3 eye(0.0f, 0.0f, 4.0f), at(0.0f, 0.0f, 0.0f), up(0.0f, 1.0f, 0.0f);
_view = glm::lookAt(eye, at, up);
_projection = glm::perspective(45.0f, 1.0f, 2.0f, -2.0f);
}
Camera *Camera::instance() {
static Camera camera;
return &camera;
}
void Camera::storeUniformVars() {
// GLint view = glGetUniformLocation(program, "mView");
// glUniformMatrix4fv(view, 1, GL_FALSE, glm::value_ptr(mView));
// GLint projection = glGetUniformLocation(program, "mProjection");
// glUniformMatrix4fv(projection, 1, GL_FALSE, glm::value_ptr(mProjection));
}

23
src/Camera.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef GLTEST_CAMERA_H
#define GLTEST_CAMERA_H
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
class Camera {
private:
glm::mat4 _view;
glm::mat4 _projection;
private:
Camera();
Camera(Camera&) = delete;
void operator=(Camera&) = delete;
void storeUniformVars();
public:
static Camera* instance();
};
#endif //GLTEST_CAMERA_H