Commit a4223e38 authored by Mike Kremer's avatar Mike Kremer

Implemented first person key navigation.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7024 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 4f9217cc
......@@ -2246,25 +2246,54 @@ void glViewer::updateCursorPosition (QPointF _scenePos)
void glViewer::moveForward() {
if(navigationMode_ == FIRSTPERSON_NAVIGATION) {
std::cerr << "Move forward" << std::endl;
ACG::Vec3d dir = glstate_->viewing_direction();
dir *= -0.1;
glstate_->translate(dir[0], dir[1], dir[2]);
updateGL();
lastMoveTime_.restart();
}
}
void glViewer::moveBack() {
if(navigationMode_ == FIRSTPERSON_NAVIGATION) {
std::cerr << "Move back" << std::endl;
ACG::Vec3d dir = glstate_->viewing_direction();
dir *= 0.1;
glstate_->translate(dir[0], dir[1], dir[2]);
updateGL();
lastMoveTime_.restart();
}
}
void glViewer::strafeLeft() {
if(navigationMode_ == FIRSTPERSON_NAVIGATION) {
std::cerr << "Strafe left" << std::endl;
ACG::Vec3d dir = glstate_->right();
dir *= 0.1;
glstate_->translate(dir[0], dir[1], dir[2]);
updateGL();
lastMoveTime_.restart();
}
}
void glViewer::strafeRight() {
if(navigationMode_ == FIRSTPERSON_NAVIGATION) {
std::cerr << "Strafe right" << std::endl;
ACG::Vec3d dir = glstate_->right();
dir *= -0.1;
glstate_->translate(dir[0], dir[1], dir[2]);
updateGL();
lastMoveTime_.restart();
}
}
......
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