Commit 9a9bd4f3 by Kai Westerkamp

bewegen richtig

parent e5a95c53
......@@ -42,13 +42,17 @@ void Controler::mouseMoveEvent(GLView* view, QMouseEvent *event)
bool ctrlPressed = QApplication::keyboardModifiers() & Qt::ControlModifier;
QVector3D vec;
if(event->delta()<0)
vec = QVector3D(0.0,0.0,1.0);
else
vec = QVector3D(0.0,0.0,-1.0);
if((viewMode == CAMERA) ^ ctrlPressed){
if(event->delta()<0)
activeView->getCamera()->move(QVector3D(0.0,0.0,1.0));
else
activeView->getCamera()->move(QVector3D(0.0,0.0,-1.0));
activeView->getCamera()->move(vec);
} else if((viewMode == EDIT) ^ ctrlPressed){
vec = activeView->getCamera()->rotation->conjugate().rotatedVector(vec);
scene->moveActive(vec);
} else{
qDebug()<<"möp"<<viewMode<<" "<<CAMERA<<" "<<EDIT;
}
......@@ -85,7 +89,7 @@ void Controler::rotate(QVector3D *newPos )
if((viewMode == CAMERA) ^ ctrlPressed){
activeView->getCamera()->rotate(QQuaternion::fromAxisAndAngle(axis, angle));
} else if((viewMode == EDIT) ^ ctrlPressed){
scene->rotateActive(QQuaternion::fromAxisAndAngle(axis, angle));
} else{
qDebug()<<"möp"<<viewMode<<" "<<CAMERA<<" "<<EDIT;
}
......@@ -107,7 +111,8 @@ void Controler::move(QPointF * newPos){
if((viewMode == CAMERA) ^ ctrlPressed){
activeView->getCamera()->move(QVector3D(dx,dy,0.0));
} else if((viewMode == EDIT) ^ ctrlPressed){
scene->moveActive(activeView->getCamera()->rotation->rotatedVector(QVector3D(dx,dy,0.0)));
QVector3D vec = activeView->getCamera()->rotation->conjugate().rotatedVector(QVector3D(dx,dy,0.0));
scene->moveActive(vec);
} else{
qDebug()<<"möp"<<viewMode<<" "<<CAMERA<<" "<<EDIT;
}
......
......@@ -21,7 +21,10 @@ void SceneObject::move(QVector3D dir)
}
void SceneObject::rotate(QQuaternion rot)
{
rotation *= QQuaternion(rotation*rot);
rotation = rot * rotation;
}
void SceneObject::draw(){qDebug()<<"Drawing abstract Scene Element";}
......
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