Commit 8cad1c31 by Kai Westerkamp

camera ++;

parent e5d9244a
...@@ -4,11 +4,25 @@ ...@@ -4,11 +4,25 @@
#include "quaternion_utils.h" #include "quaternion_utils.h"
Camera::Camera()
Camera::Camera() : Camera(vec3(10.0f, 5.0f, 0.0f))
{
}
Camera::Camera(vec3 position) : Camera(position, vec3(0.0f, 0.0f, 0.0f)) {
}
Camera::Camera(vec3 position, vec3 lookAt)
{ {
// rotation = glm::gtx::quaternion::angleAxis(degrees(45), RotationAxis); // rotation = glm::gtx::quaternion::angleAxis(degrees(45), RotationAxis);
position = glm::vec3(20, 10, 0); this->position = position;
//direction = normalize(-position); vec3 dir = normalize(lookAt -position);
verticalAngle = asinf(dir.y);
horizontalAngle = atan2(dir.x, dir.z);
rotate(0, 0); //sets direction rotate(0, 0); //sets direction
up = glm::vec3(0.0f, 1.0f, 0.0f); up = glm::vec3(0.0f, 1.0f, 0.0f);
......
...@@ -19,10 +19,12 @@ public: ...@@ -19,10 +19,12 @@ public:
float speed = 0.3f; float speed = 0.3f;
float mouseSpeed = 0.005f; float mouseSpeed = 0.005f;
float horizontalAngle = -M_PI/2; float horizontalAngle = (float) -M_PI/2;
float verticalAngle = -M_PI/8; float verticalAngle = (float) -M_PI/8;
Camera(); Camera();
Camera(glm::vec3 position);
Camera(glm::vec3 position, glm::vec3 lookAt);
~Camera(); ~Camera();
void move(glm::vec3 relative); void move(glm::vec3 relative);
......
...@@ -310,6 +310,9 @@ void mainRenderLoop() { ...@@ -310,6 +310,9 @@ void mainRenderLoop() {
//draw stored Point cloud //draw stored Point cloud
drawElementArray(exportData, GL_POINTS);
glPushMatrix();
//draw current Frame //draw current Frame
if(currentControlerPos) //applay controler Transformation if(currentControlerPos) //applay controler Transformation
glMultMatrixf(glm::value_ptr(*currentControlerPos)); glMultMatrixf(glm::value_ptr(*currentControlerPos));
...@@ -317,15 +320,9 @@ void mainRenderLoop() { ...@@ -317,15 +320,9 @@ void mainRenderLoop() {
glPointSize(1.f); glPointSize(1.f);
drawElementArray(framePoints, GL_POINTS); drawElementArray(framePoints, GL_POINTS);
drawElementArray(exportData, GL_POINTS);
drawElementArray(arrowData, GL_TRIANGLES); drawElementArray(arrowData, GL_TRIANGLES);
// draw hud arrow // draw hud arrow
glPushMatrix();
glTranslatef(0.0f, 1.5f, 0.0f); glTranslatef(0.0f, 1.5f, 0.0f);
float scale = 1.0f ; float scale = 1.0f ;
glScalef(scale, scale, scale); glScalef(scale, scale, scale);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment