bool ViewData::update() { if( _spinX == 0 && _spinY == 0 && _advance == 0 ) return false; spinModel( -0.001f * _spinX, -0.001f * _spinY, 0.f ); moveModel( 0.0f, 0.0f, 0.001f * _advance ); return true; }
ViewData::ViewData() : _modelMatrix( eq::Matrix4f::IDENTITY ) , _spinX( 5 ) , _spinY( 5 ) , _advance( 0 ) , _statistics( false ) { moveModel( 0.f, 0.f, -2.f ); }
Animation::Animation(QWidget *parent) : QWidget(parent), ui(new Ui::Animation) { ui->setupUi(this); animationScene = new AnimationScene; AnimationCanvas *canvas = new AnimationCanvas; animationScene->setCanvas(canvas); connect(canvas, SIGNAL(cameraMoved(float,float)), this, SLOT(transformCamera(float, float))); ui->horizontalLayout->addWidget(canvas->widget()); timer.setInterval(50); connect(&timer, SIGNAL(timeout()), this, SLOT(moveModel())); }
void InsertMode::update(const Ogre::FrameEvent& evt) { rEngine->mFPC->update(evt); moveModel(); }
bool ViewData::_handleEvent( const eq::Event& event ) { switch( event.type ) { case eq::Event::CHANNEL_POINTER_BUTTON_RELEASE: { const eq::PointerEvent& releaseEvent = event.pointerButtonRelease; if( releaseEvent.buttons == eq::PTR_BUTTON_NONE ) { if( releaseEvent.button == eq::PTR_BUTTON1 ) { _spinX = releaseEvent.dy; _spinY = releaseEvent.dx; return true; } if( releaseEvent.button == eq::PTR_BUTTON2 ) { _advance = -releaseEvent.dy; return true; } } return false; } case eq::Event::CHANNEL_POINTER_MOTION: switch( event.pointerMotion.buttons ) { case eq::PTR_BUTTON1: _spinX = 0; _spinY = 0; spinModel( -0.005f * event.pointerMotion.dy, -0.005f * event.pointerMotion.dx, 0.f ); return true; case eq::PTR_BUTTON2: _advance = -event.pointerMotion.dy; moveModel( 0.f, 0.f, .005f * _advance ); return true; case eq::PTR_BUTTON3: moveModel( .0005f * event.pointerMotion.dx, -.0005f * event.pointerMotion.dy, 0.f ); return true; default: return false; } case eq::Event::CHANNEL_POINTER_WHEEL: moveModel( -0.05f * event.pointerWheel.xAxis, 0.f, 0.05f * event.pointerWheel.yAxis ); return true; case eq::Event::MAGELLAN_AXIS: _spinX = 0; _spinY = 0; _advance = 0; spinModel( 0.0001f * event.magellan.zRotation, -0.0001f * event.magellan.xRotation, -0.0001f * event.magellan.yRotation ); moveModel( 0.0001f * event.magellan.xAxis, -0.0001f * event.magellan.zAxis, 0.0001f * event.magellan.yAxis ); return true; case eq::Event::KEY_PRESS: switch( event.keyPress.key ) { case 's': showStatistics( !getStatistics( )); return true; case 'o': setOrtho( !useOrtho( )); return true; } return false; default: return false; } }
void ModelPlotter::keyPressed(int key) { if(key == 'r') { _recordMode = !_recordMode; if (!_recordMode) { App::getInstance()->flagPageModelsChanged(); } } else if(key == 'L') { loadModels(); } else if(key == 'S') { saveModels(); } if(_recordMode) { // delete if(key == 127) { deleteSelectedModel(); } // right arrow else if (key == 358) { if(_selectedModel != DISABLED && _selectedPoint != DISABLED) { App::getInstance()->getPageModelByIndex(_selectedModel)->pts[_selectedPoint].x += 1; } } // left arrow else if (key == 356) { if(_selectedModel != DISABLED && _selectedPoint != DISABLED) { App::getInstance()->getPageModelByIndex(_selectedModel)->pts[_selectedPoint].x -= 1; } } // up arrow else if (key == 357) { if(_selectedModel != DISABLED && _selectedPoint != DISABLED) { App::getInstance()->getPageModelByIndex(_selectedModel)->pts[_selectedPoint].y -= 1; } } // down arrow else if (key == 359) { if(_selectedModel != DISABLED && _selectedPoint != DISABLED) { App::getInstance()->getPageModelByIndex(_selectedModel)->pts[_selectedPoint].y += 1; } } // d else if (key == 'd') { if(_selectedModel != DISABLED) { moveModel(true, +1); } } // a else if (key == 'a') { if(_selectedModel != DISABLED) { moveModel(true, -1); } } // w else if (key == 'w') { if(_selectedModel != DISABLED) { moveModel(false, -1); } } // s else if (key == 's') { if(_selectedModel != DISABLED) { moveModel(false, +1); } } } }
void game_engine::nextState(double timeElapsed) { gPhysics.update(timeElapsed); moveModel(*currentState.getPlayer()); }