| 43 | } |
| 44 | |
| 45 | void ViewerWidget::init() { |
| 46 | |
| 47 | // setHandlerKeyboardModifiers(QGLViewer::CAMERA, Qt::AltModifier); |
| 48 | // setHandlerKeyboardModifiers(QGLViewer::FRAME, Qt::NoModifier); |
| 49 | // setHandlerKeyboardModifiers(QGLViewer::CAMERA, Qt::ControlModifier); |
| 50 | setMouseTracking(true); |
| 51 | |
| 52 | // Restore previous viewer state. |
| 53 | restoreStateFromFile(); |
| 54 | |
| 55 | // Make camera the default manipulated frame. |
| 56 | setManipulatedFrame( camera()->frame() ); |
| 57 | // invert mousewheel (more like Blender) |
| 58 | camera()->frame()->setWheelSensitivity(-1.0); |
| 59 | |
| 60 | |
| 61 | // Light initialization: |
| 62 | glEnable(GL_LIGHT0); |
| 63 | |
| 64 | float pos[4] = {-1.0, 1.0, 1.0, 0.0}; |
| 65 | // Directional light |
| 66 | glLightfv(GL_LIGHT0, GL_POSITION, pos); |
| 67 | |
| 68 | // background color defaults to white |
| 69 | this->setBackgroundColor( QColor(255,255,255) ); |
| 70 | } |
| 71 | |
| 72 | void ViewerWidget::resetView(){ |
| 73 | this->camera()->setOrientation((float) -M_PI_2, (float) M_PI_2); |