VectorSpace<double> constraintSpace() const { VectorSpace<double> rtn = createW().range(); return rtn; }
VectorSpace<double> stateSpace() const { VectorSpace<double> rtn = createW().domain(); return rtn; }
void MainApplication::update(Ogre::Real dt) { // Necessary for GUI... m_trayManager->adjustTrays() ; //dt = ::std::min(dt,0.01f) ; static double time = 0 ; time += dt ; //if(time>4) //{ // for(float cpt=-3 ; cpt<3 ; cpt+=0.6) // { // //new GameElements::Bullet(GlobalConfiguration::getGeometryLoader()->load("JetEngine.scene"), 2, 0, Math::Vector2<Config::Real>(-6,cpt), Math::Vector2<Config::Real>(0.5+double(rand())/RAND_MAX,0), 12) ; // //new GameElements::Bullet(GlobalConfiguration::getGeometryLoader()->load("JetEngine.scene"), 2, 0, Math::Vector2<Config::Real>(6,cpt), Math::Vector2<Config::Real>(-0.5-+double(rand())/RAND_MAX,0), 12) ; // new GameElements::StraightBullet(GlobalConfiguration::getGeometryLoader()->load("JetEngine.scene"), 2, 0, Math::Vector2<Config::Real>(-6,cpt), Math::Vector2<Config::Real>(0.5+double(rand())/RAND_MAX,0), 12) ; // //new GameElements::StraightBullet(GlobalConfiguration::getGeometryLoader()->load("JetEngine.scene"), 2, 0, Math::Vector2<Config::Real>(6,cpt), Math::Vector2<Config::Real>(-0.5-+double(rand())/RAND_MAX,0), 12) ; // //new GameElements::BallisticBullet(GlobalConfiguration::getGeometryLoader()->load("JetEngine.scene"), 2, 0, Math::Vector2<Config::Real>(-6,cpt), 2+double(rand())/RAND_MAX, Math::Vector2<Config::Real>(4-8*double(rand())/RAND_MAX,4-8*double(rand())/RAND_MAX), 2) ; // new GameElements::BallisticBullet(GlobalConfiguration::getGeometryLoader()->load("JetEngine.scene"), 2, 0, Math::Vector2<Config::Real>(6,cpt), 2+double(rand())/RAND_MAX, Math::Vector2<Config::Real>(4-8*double(rand())/RAND_MAX,4-8*double(rand())/RAND_MAX), 2) ; // } // //new GameElements::Bullet(GlobalConfiguration::getGeometryLoader()->load("JetEngine.scene"), 20, 0, Math::Vector2<Config::Real>(-2,1)*3.0, Math::Vector2<Config::Real>(0.5,0), 4*3.0) ; // //new GameElements::Bullet(GlobalConfiguration::getGeometryLoader()->load("JetEngine.scene"), 20, 0, Math::Vector2<Config::Real>(-2,0)*3.0, Math::Vector2<Config::Real>(0.5,0), 4*3.0) ; // //new GameElements::Bullet(GlobalConfiguration::getGeometryLoader()->load("JetEngine.scene"), 20, 0, Math::Vector2<Config::Real>(2,0)*3.0, Math::Vector2<Config::Real>(-0.5,0), 4*3.0) ; // time = 0 ; //} //m_trayManager->showAll(); //Ogre::AxisAlignedBox box = Ext::Ogre::computeBoundingBox(m_shipShape) ; //::std::cout<<box.getMinimum()<<" / "<<box.getMaximum()<<::std::endl ; static Ogre::Real absoluteTime = 0.0 ; absoluteTime += dt ; //m_entityAdapter->setPosition(Math::Vector3<Config::Real>((int(absoluteTime*1000)%10000)/2000.0, (int(absoluteTime*1000)%10000)/2000.0, 0.0)) ; //m_entityAdapter->setOrientation(0.0,0.0,absoluteTime) ; // Updates camera manager m_cameraManager->update(dt) ; if(CINE){ Ogre::Real dist = cibles[current_cible].squaredDistance(m_camera->getPosition()) ; if( dist < 50 ) current_cible++; // TO DO !! if(current_cible >= cibles.size()) {CINE = false ;DEF_VIEW = true;} else{ Ogre::Vector3 v = cibles[current_cible] - m_camera->getPosition(); if(m_camera->getPosition()[2] < 50) m_camera->move((v/v.normalise())* 400*dt); else m_camera->move((v/v.normalise())* 800*dt); } } if(DEF_VIEW){ //std::cout << "DEF_VIEW" << std::endl; m_camera->setPosition(Ogre::Vector3(0,0,70)); createW(); m_trayManager->getWidget("Mode")->show(); m_trayManager->getWidget("Map")->show(); m_trayManager->getWidget("Val")->show(); DEF_VIEW = false; } if(START) { m_trayManager->destroyWidget("Val"); m_trayManager->destroyWidget("Val_armee"); m_trayManager->destroyWidget("Info"); START = false; PLAYING = true; } // Updates (animation, behavoir & son on) are called here :) GlobalConfiguration::getController()->update(dt) ; //static bool explosionFired = false ; //if(absoluteTime>10.0 && !explosionFired) //{ // explosionFired = true ; // // Trying explosion // // create a particle system named explosions using the explosionTemplate // Ogre::ParticleSystem* particleSystem = m_sceneManager->createParticleSystem("explosions2", "explosionTemplate"); // particleSystem->setParameter("particle_width", "1") ; // particleSystem->setParameter("particle_height", "1") ; // // fast forward 1 second to the point where the particle has been emitted // particleSystem->fastForward(1.0); // // attach the particle system to a scene node // getRootSceneNode()->attachObject(particleSystem); //} if(PLAYING && ( (MainApplication::nbB == 0) || (MainApplication::nbR == 0))){ std::string caption =" "; if(MainApplication::nbR == 0) {caption = "You win !" ;} else {caption = "You lose :(";} m_trayManager->createLabel(OgreBites::TL_CENTER,"Win",caption,250); m_trayManager->createButton(OgreBites::TL_CENTER, "Quit", "Quit",100) ; PLAYING = false; } }