Commit 840a4b6d authored by Stefan Pfeifer's avatar Stefan Pfeifer

Fix wrong orientation of the limb geometry in the view

parent 76944895
Pipeline #40774648 passed with stage
in 15 minutes and 44 seconds
......@@ -210,7 +210,7 @@ void LimbView::paintGL()
glEnable(GL_CULL_FACE);
m_world.setToIdentity();
m_world.rotate(180.0f - rot_x, 1.0f, 0.0f, 0.0f);
m_world.rotate(rot_x, 1.0f, 0.0f, 0.0f);
m_world.rotate(rot_y, 0.0f, 1.0f, 0.0f);
m_world.scale(1.0f/limb_mesh.aabbDiagonal());
m_world.translate(-limb_mesh.aabbCenter());
......@@ -247,8 +247,8 @@ void LimbView::mouseMoveEvent(QMouseEvent *event)
if(event->buttons() & Qt::LeftButton)
{
rot_x += ROT_SPEED*delta_y;
rot_y += ROT_SPEED*delta_x;
rot_x -= ROT_SPEED*delta_y;
rot_y -= ROT_SPEED*delta_x;
update();
}
else if(event->buttons() & Qt::MiddleButton)
......
......@@ -16,8 +16,8 @@ QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)
class LimbView: public QOpenGLWidget, protected QOpenGLFunctions
{
private:
const float DEFAULT_ROT_X = 20.0f; // Magic number
const float DEFAULT_ROT_Y = -30.0f; // Magic number
const float DEFAULT_ROT_X = -20.0f; // Magic number
const float DEFAULT_ROT_Y = 30.0f; // Magic number
const float DEFAULT_ZOOM = 1.1f; // Magic number
const float ZOOM_SPEED = 0.2f; // Magic number
const float ROT_SPEED = 0.15f; // Magic number
......
#pragma once
#include "bow/input/InputData.hpp"
#include "LimbMesh.hpp"
#include "LayerLegend.hpp"
#include <QtWidgets>
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
#include <QMatrix4x4>
QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)
// Based on Qt's "Hello GL2" example, http://doc.qt.io/qt-5/qtopengl-hellogl2-example.html
class LimbView: public QOpenGLWidget, protected QOpenGLFunctions
{
private:
const float DEFAULT_ROT_X = -20.0f; // Magic number
const float DEFAULT_ROT_Y = 30.0f; // Magic number
const float DEFAULT_ZOOM = 1.1f; // Magic number
const float ZOOM_SPEED = 0.2f; // Magic number
const float ROT_SPEED = 0.15f; // Magic number
public:
LimbView();
~LimbView() override;
void setData(const InputData& data);
void viewProfile();
void viewTop();
void view3D();
void viewSymmetric(bool checked);
void viewFit();
private:
void cleanup();
void initializeGL() override;
void paintGL() override;
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void wheelEvent(QWheelEvent* event) override;
LayerLegend* legend;
LimbMesh limb_mesh;
QOpenGLBuffer limb_mesh_vbo;
QOpenGLShaderProgram* shader_program;
int loc_projectionMatrix;
int loc_modelViewMatrix;
int loc_normalMatrix;
int loc_lightPosition;
QMatrix4x4 m_projection;
QMatrix4x4 m_camera;
QMatrix4x4 m_world;
QPoint mouse_pos;
float shift_x;
float shift_y;
float rot_x;
float rot_y;
float zoom;
};
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