void ObjectViewer::do_key_event( int key, int scancode, int action, int mods ) { //std::cerr << "key :" << key << " char: " << char(key) << std::endl; if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) close_window(); if ( action == GLFW_PRESS ) { switch( key ) { case 262: //arrow right transform_model( 1.f, 0.f ); break; case 263: //arrow left transform_model( -1.f, 0.f ); break; case 264: //arrow down transform_model( 0.f, 1.f ); break; case 265: //arrow up transform_model( 0.f, -1.f ); break; case 'H': show_help(); break; case 'F': toogle_culling(); break; case 'W': m_rendermode = static_cast<RenderMode>( (m_rendermode+1)%RENDER_SIZE ); break; default: fprintf( stderr, "unkown key:%c\n", key ); } } }
void ObjectViewer::do_cursor( double x, double y ) { m_mouse.x = x; m_mouse.y = double(m_height) - y; if ( m_mouse.press.button >= 0 ) { switch( m_mouse.press.mods ) { case 0: transform_model( false ); break; } } }
void ObjectViewer::do_mouse_button( int button, int action, int mods ) { if ( action == GLFW_PRESS ) { m_mouse.press.x = m_mouse.x; m_mouse.press.y = m_mouse.y; m_mouse.press.button = button; m_mouse.press.mods = mods; } else { switch ( button ) { case 0: transform_model( true ); break; } m_mouse.press.button = -1; } }
void operator()(CGeneModel& a) { transform_model(a); }
virtual void transform_align(CAlignModel& a) { transform_model(a); }