Celled when pressing a key.
57{
58
59 const Qt::KeyboardModifiers modifiers = e->modifiers();
60 bool handled = false;
61 if ((e->key()==Qt::Key_R) &&
ptrScene != 0 )
62 {
63 int w = camera()->screenWidth();
64 int h = camera()->screenHeight();
66 qglviewer::Vec orig, dir;
67 camera()->convertClickToLine( QPoint( 0,0 ), orig, dir );
70 camera()->convertClickToLine( QPoint( w,0 ), orig, dir );
72 camera()->convertClickToLine( QPoint( 0, h ), orig, dir );
74 camera()->convertClickToLine( QPoint( w, h ), orig, dir );
76 renderer.setViewBox( origin, dirUL, dirUR, dirLL, dirLR );
77 if ( modifiers == Qt::ShiftModifier ) { w /= 2; h /= 2; }
78 else if ( modifiers == Qt::NoModifier ) { w /= 8; h /= 8; }
79 Image2D<Color> image( w, h );
80 renderer.setResolution( image.w(), image.h() );
82 ofstream output( "output.ppm" );
83 Image2DWriter<Color>::write( image, output, true );
84 output.close();
85 handled = true;
86 }
87 if (e->key()==Qt::Key_D)
88 {
89 if ( modifiers == Qt::ShiftModifier )
91 if ( modifiers == Qt::NoModifier )
93 std::cout <<
"Max depth is " <<
maxDepth << std::endl;
94 }
95
96 if (!handled) QGLViewer::keyPressEvent(e);
97}
PointVector< Real, 3 > Vector3
The type for representing a 3d point.