void TextTestApp::onPassiveSceneComplete( /* SceneBase* sceneInstance */) { int sceneId = currentScene->getId(); currentScene->getSignal()->disconnect_all_slots(); switch(sceneId){ case 1: currentScene = new PassiveScene2(); break; case 2: currentScene = new PassiveScene3(); break; case 3: currentScene = new PassiveScene4(); break; case 4: currentScene = new PassiveScene1(); break; case 101 : currentScene = new ActiveScene2(); break; case 102 : currentScene = new PassiveScene3(); break; } currentScene->getSignal()->connect( boost::bind(&TextTestApp::onPassiveSceneComplete, this )); currentScene->setup( myFont, iconFactory, fgParticles, mbackground.gridLayer1 ); }
/******************************************************************************* contextMenuEvent *******************************************************************************/ void BrowserView::contextMenuEvent ( QContextMenuEvent * event ) { //Debug::debug() << " [BrowserView] contextMenuEvent "; SceneBase * scene = m_scenes[ VIEW::Id(SETTINGS()->_viewMode) ]; if(scene->mouseGrabberItem()) { QGraphicsView::contextMenuEvent(event) ; } else { if(!m_menu) m_menu = new QMenu(this); m_menu->clear(); m_menu->addActions(scene->actions()); m_menu->addSeparator(); m_menu->addAction(ACTIONS()->value(BROWSER_JUMP_TO_ARTIST)); m_menu->addAction(ACTIONS()->value(BROWSER_JUMP_TO_ALBUM)); m_menu->addAction(ACTIONS()->value(BROWSER_JUMP_TO_TRACK)); m_menu->popup(mapToGlobal(event->pos())); event->accept(); } }
/******************************************************************************* eventFilter *******************************************************************************/ bool BrowserView::eventFilter(QObject *obj, QEvent *ev) { if(!is_started) return false; //Debug::debug() << "BrowserView eventFilter obj" << obj; int type = ev->type(); QWidget *wid = qobject_cast<QWidget*>(obj); if (obj == this) { return false; } if (wid && (wid == m_scrollbar )) { if(type == QEvent::Hide || type == QEvent::Show) { SceneBase * scene = m_scenes.value( VIEW::Id(SETTINGS()->_viewMode) ); if( scene->isInit() ) scene->resizeScene(); } } return QWidget::eventFilter(obj, ev); }
void TextTestApp::beginActiveScene(){ currentScene->getSignal()->disconnect_all_slots(); //timeline().clear(); currentScene = new ActiveScene1(); currentScene->getSignal()->connect( boost::bind(&TextTestApp::onPassiveSceneComplete, this )); currentScene->setup( myFont, iconFactory, fgParticles, mbackground.gridLayer1 ); }
/******************************************************************************* resizeEvent *******************************************************************************/ void BrowserView::resizeEvent( QResizeEvent * event) { Debug::debug() << " [BrowserView] resizeEvent"; if(!is_started) return; SceneBase * scene = m_scenes.value( VIEW::Id(SETTINGS()->_viewMode) ); if( scene->isInit() ) scene->resizeScene(); event->accept(); }
void TestApp::changeCurrentScene(const std::string& sceneId_) { //try { std::string sceneId = sceneId_; if (sceneId == "default") { sceneId = SceneHandler::getDefaultSceneId(); } SceneBase* scene = SceneHandler::getSceneHandler()->createScene(sceneId, mOgreRoot); if (scene == 0) { //error() << dc_funcinfo << "could not create scene " << sceneId; if (mScene) { // continue using current scene return; } else { if (sceneId == SceneHandler::getDefaultSceneId()) { // use a fallback scene sceneId = "general"; } //warning() << dc_funcinfo << "trying fallback scene " << sceneId; scene = SceneHandler::getSceneHandler()->createScene(sceneId, mOgreRoot); if (!scene) { //throw Exception("Could create neither default scene nor fallback scene"); } } } if (!scene->initScene()) { //std::cerr << "Could not initialize the scene " << sceneId << std::endl; SceneHandler::getSceneHandler()->deleteScene(scene); return; } else { // force an initial update of Ogre scenenodes here //scene->updateOgreRepresentations(true); } if (scene) { setCurrentScene(scene); } else { //std::cerr << dc_funcinfo << "NULL scene created: don't know scene ID " << sceneId_ << std::endl; } //} catch (Exception e) { // std::cerr << "Unhandled exception reached main-program: \n" // << e.getErrorMessage() <<std::endl; // e.printBacktrace(); // exit(1); //} }
/******************************************************************************* switch_view *******************************************************************************/ void BrowserView::switch_view(BrowserParam& param) { Debug::debug() << " [BrowserView] switch_view param.mode " << param.mode; //Debug::debug() << " [BrowserView] switch_view param.filter" << param.filter; //Debug::debug() << " [BrowserView] switch_view param.data" << param.data; /* save current state */ SETTINGS()->_viewMode = param.mode; CentralToolBar::instance()->showHideGoUp(param.mode); /* handle scene switch view */ SceneBase * scene = m_scenes[ param.mode ]; if( !scene->isInit() ) scene->initScene(); scene->setMode( param.mode ); scene->setFilter( param.filter ); scene->setData( param.data ); scene->populateScene(); this->setFocus(); show_bottom_panel( m_scenes[param.mode]->bottomWidget() ); CentralToolBar::instance()->setExplorerFilterText(param.filter); switch( VIEW::typeForView(VIEW::Id(param.mode)) ) { case VIEW::LOCAL : setScene(static_cast<LocalScene*>(m_scenes[param.mode])); break; case VIEW::RADIO : setScene(static_cast<StreamScene*>(m_scenes[param.mode])); break; case VIEW::CONTEXT : setScene(static_cast<ContextScene*>(m_scenes[param.mode])); break; case VIEW::SETTING : setScene(static_cast<SettingsScene*>(m_scenes[param.mode])); break; case VIEW::FILESYSTEM : setScene(static_cast<FileScene*>(m_scenes[param.mode])); break; case VIEW::ABOUT : setScene(static_cast<AboutScene*>(m_scenes[param.mode])); break; } /* restore scroll position */ m_scrollbar->setSliderPosition(param.scroll); /* status widget update */ do_statuswidget_update(); }
void TextTestApp::drawSkeleton(){ //if(mSkeletons.size()<1) // { // return; // } // We're capturing if ( mKinect->isCapturing() ) { // Set up 3D view //gl::pushMatrices(); //gl::setMatrices( mCamera ); // Iterate through skeletons uint32_t i = 0; int skeletonCount = 0; for ( vector<Skeleton>::const_iterator skeletonIt = mSkeletons.cbegin(); skeletonIt != mSkeletons.cend(); ++skeletonIt, i++ ) { if (skeletonIt->size() > 0){ skeletonCount +=1; } if (significantInteractionTimer.isStopped()){ significantInteractionTimer.start(); } if (activeUserPresent != true && significantInteractionTimer.getSeconds() > 3.0){ activeUserPresent = true; //if we are in passive mode, tell the existing scene to exit. currentScene->exitNow(); // clear any old references to this timer incase it doubles up timeline().remove( mCue ); // TODO - should be an event given back from exit now. not a timer. for now this will do ill sort later. mCue = timeline().add( boost::bind(&TextTestApp::beginActiveScene, this), timeline().getCurrentTime() + 2 ); } // Set color Colorf color = mKinect->getUserColor( i ); int boneIndex = 0; // Iterate through joints for ( Skeleton::const_iterator boneIt = skeletonIt->cbegin(); boneIt != skeletonIt->cend(); ++boneIt, boneIndex++ ) { // Set user color //gl::color( color ); // Get position and rotation const Bone& bone = boneIt->second; Vec3f position = bone.getPosition(); Matrix44f transform = bone.getAbsoluteRotationMatrix(); Vec3f direction = transform.transformPoint( position ).normalized(); direction *= 0.05f; position.z *= -1.0f; Vec3f destination = skeletonIt->at( bone.getStartJoint() ).getPosition(); Vec3f end = skeletonIt->at( bone.getEndJoint() ).getPosition(); //add the current bone position to the gesture tracker history gestureTracker->addPoint(boneIndex,end); Vec2f endScreen = Vec2f( mKinect->getSkeletonVideoPos( end ) ); Vec2f positionScreen = Vec2f( mKinect->getSkeletonVideoPos( position ) ); Vec2f destinationScreen = Vec2f( mKinect->getSkeletonVideoPos( destination ) ); //boneIt->first //draw bone specific stuff here repelClips[boneIndex].x = endScreen.x * 2; repelClips[boneIndex].y = endScreen.y * 2; repelClips[boneIndex].zDist = position.z; float midPointDist = OutlineParams::getInstance()->getMidpointForIndex(boneIndex); Vec2f midPoint = getPointOnLine(destinationScreen,endScreen,midPointDist ); if (midPointDist == 0){ //if the distance is 0, the joint doesn't need a midpoint. repelClips[boneIndex+20].x = -200; repelClips[boneIndex+20].y = -200; repelClips[boneIndex+20].zDist = position.z; }else{ repelClips[boneIndex+20].x = midPoint.x*2; repelClips[boneIndex+20].y = midPoint.y*2; repelClips[boneIndex+20].zDist = position.z; } switch(boneIt->first){ case NUI_SKELETON_POSITION_HIP_CENTER: //draw hip center break; case NUI_SKELETON_POSITION_SPINE: //draw spine break; case NUI_SKELETON_POSITION_SHOULDER_CENTER: //draw shoulder center break; case NUI_SKELETON_POSITION_HEAD: //draw head break; case NUI_SKELETON_POSITION_SHOULDER_LEFT: //draw left shoulder break; case NUI_SKELETON_POSITION_ELBOW_LEFT: //draw left elbow midPoint = getPointOnLine(destinationScreen,endScreen,0.25 ); midPointDist = OutlineParams::getInstance()->getMidpointForIndex(boneIndex); repelClips[20].x = midPoint.x*2; repelClips[20].y = midPoint.y*2; repelClips[20].zDist = position.z; midPoint = getPointOnLine(destinationScreen,endScreen,0.75 ); midPointDist = OutlineParams::getInstance()->getMidpointForIndex(boneIndex); repelClips[21].x = midPoint.x*2; repelClips[21].y = midPoint.y*2; repelClips[21].zDist = position.z; break; case NUI_SKELETON_POSITION_WRIST_LEFT: //draw left wrist break; case NUI_SKELETON_POSITION_HAND_LEFT: //draw left hand break; case NUI_SKELETON_POSITION_SHOULDER_RIGHT: //draw right shoulder break; case NUI_SKELETON_POSITION_ELBOW_RIGHT: //draw right elbow midPoint = getPointOnLine(destinationScreen,endScreen,0.25 ); midPointDist = OutlineParams::getInstance()->getMidpointForIndex(boneIndex); repelClips[23].x = midPoint.x*2; repelClips[23].y = midPoint.y*2; repelClips[23].zDist = position.z; midPoint = getPointOnLine(destinationScreen,endScreen,0.75 ); midPointDist = OutlineParams::getInstance()->getMidpointForIndex(boneIndex); repelClips[24].x = midPoint.x*2; repelClips[24].y = midPoint.y*2; repelClips[24].zDist = position.z; break; case NUI_SKELETON_POSITION_WRIST_RIGHT: //draw right wrist break; case NUI_SKELETON_POSITION_HAND_RIGHT: //draw right hand break; case NUI_SKELETON_POSITION_HIP_LEFT: //draw left hip break; case NUI_SKELETON_POSITION_KNEE_LEFT: //draw left knee midPoint = getPointOnLine(destinationScreen,endScreen,0.25 ); midPointDist = OutlineParams::getInstance()->getMidpointForIndex(boneIndex); repelClips[27].x = midPoint.x*2; repelClips[27].y = midPoint.y*2; repelClips[27].zDist = position.z; midPoint = getPointOnLine(destinationScreen,endScreen,0.75 ); midPointDist = OutlineParams::getInstance()->getMidpointForIndex(boneIndex); repelClips[31].x = midPoint.x*2; repelClips[31].y = midPoint.y*2; repelClips[31].zDist = position.z; break; case NUI_SKELETON_POSITION_ANKLE_LEFT: //draw left ankle break; case NUI_SKELETON_POSITION_FOOT_LEFT: //draw left foot break; case NUI_SKELETON_POSITION_HIP_RIGHT: //draw right hip break; case NUI_SKELETON_POSITION_KNEE_RIGHT: //draw right knee midPoint = getPointOnLine(destinationScreen,endScreen,0.25 ); midPointDist = OutlineParams::getInstance()->getMidpointForIndex(boneIndex); repelClips[32].x = midPoint.x*2; repelClips[32].y = midPoint.y*2; repelClips[32].zDist = position.z; midPoint = getPointOnLine(destinationScreen,endScreen,0.75 ); midPointDist = OutlineParams::getInstance()->getMidpointForIndex(boneIndex); repelClips[35].x = midPoint.x*2; repelClips[35].y = midPoint.y*2; repelClips[35].zDist = position.z; break; case NUI_SKELETON_POSITION_ANKLE_RIGHT: //draw right ankle break; case NUI_SKELETON_POSITION_FOOT_RIGHT: //draw right foot break; default : break; } } } //if there are no skeletons, there's nobody in the frame, so clean up the skeleton stuff. if (skeletonCount == 0){ activeUserPresent = false;// reset the active user timer significantInteractionTimer = Timer(); //first clip is reserved for random background for(unsigned int k=1;k<repelClips.size();k++){ repelClips[k].x = -200; repelClips[k].y = -200; } if (bgAnimationTimer.isStopped()){ bgAnimationTimer.start(); } if (bgAnimationTimer.getSeconds() > 2.0){ repelClips[0].x = randFloat(0,1280); repelClips[0].y = randFloat(0,800); //bgAnimationTimer = Timer(); } if (bgAnimationTimer.getSeconds() > 3.0){ bgAnimationTimer = Timer(); repelClips[0].x = -200; repelClips[0].y = -200; } } } gl::enableAlphaBlending(); //show the repel clip forces if (OutlineParams::getInstance()->showForces == true){ for (int i = 0;i < repelClips.size(); i++){ repelClips[i].k = OutlineParams::getInstance()->getForceForIndex(i); repelClips[i].minDist = OutlineParams::getInstance()->getMinDistForIndex(i); float alpha = 0.8 / repelClips.size() * i; //gl::color(ColorA(1.0,0.0,0.0,0.2)); //gl::drawSolidCircle(ci::Vec2f(repelClips[i].x, repelClips[i].y),OutlineParams::getInstance()->getForceForIndex(i) + (repelClips[i].zDist*repelClips[i].zDist)); gl::color(ColorA(0.0,1.0,0.0,0.2 + alpha)); gl::drawSolidCircle(ci::Vec2f(repelClips[i].x, repelClips[i].y),OutlineParams::getInstance()->getMinDistForIndex(i) + (repelClips[i].zDist*repelClips[i].zDist)); } gl::color(ColorA(1.0,1.0,1.0,1.0)); } //draw the user in particles bool drawUser = false; if (drawUser==true){ for (int i = 0;i < repelClips.size(); i++){ userParticles[i].xpos = repelClips[i].x; userParticles[i].ypos = repelClips[i].y; userParticles[i].rad = OutlineParams::getInstance()->getMinDistForIndex(i) - (repelClips[i].zDist*repelClips[i].zDist); userParticles[i].update(getElapsedSeconds()); userParticles[i].draw(); } } gl::enableAlphaBlending(); gl::disableAlphaBlending(); };
void TextTestApp::draw() { // this pair of lines is the standard way to clear the screen in OpenGL glClearColor( 0,0,0,1 ); glClear( GL_COLOR_BUFFER_BIT ); if (flipScreen==true){ gl::pushMatrices(); gl::scale( Vec3f(-1, 1, 1) ); gl::translate( Vec2f(-ci::app::getWindowWidth(), 0 ) ); gl::translate( Vec3f(-1, 1, 1) ); } gl::enableAlphaBlending(); gl::enableAdditiveBlending(); mbackground.draw(); drawSkeleton(); // FONT NOW GETS RENDERED AFTER SCENE SO WE CAN OVERRIDE DRAW OPERATION IF REQUIRED currentScene->draw(); myFont.draw(); // kill this all and refresh gl::disableAlphaBlending(); gl::enableAdditiveBlending(); // store our viewport, so we can restore it later Area viewport = gl::getViewport(); // render a simple scene into mFboScene gl::setViewport( mFboScene.getBounds() ); mFboScene.bindFramebuffer(); gl::pushMatrices(); gl::setMatricesWindow( viewport.getWidth(), viewport.getHeight(), false ); gl::clear( ColorA( 0,0,0,1 )); fgParticles.draw(); //gl::drawSolidCircle( Vec2f(50,50), 20 ); //gl::draw( mFboScene.getTexture() );//TODO - screenshot? gl::popMatrices(); mFboScene.unbindFramebuffer(); // bind the blur shader mShaderBlur.bind(); mShaderBlur.uniform("tex0", 0); // use texture unit 0 // tell the shader to blur horizontally and the size of 1 pixel mShaderBlur.uniform("sampleOffset", Vec2f(1.0f/mFboBlur1.getWidth(), 0.0f)); // copy a horizontally blurred version of our scene into the first blur Fbo gl::setViewport( mFboBlur1.getBounds() ); mFboBlur1.bindFramebuffer(); mFboScene.bindTexture(0); gl::pushMatrices(); gl::setMatricesWindow( viewport.getWidth(), viewport.getHeight(), false ); gl::clear( Color::black() ); gl::drawSolidRect( mFboBlur1.getBounds() ); gl::popMatrices(); mFboScene.unbindTexture(); mFboBlur1.unbindFramebuffer(); // tell the shader to blur vertically and the size of 1 pixel mShaderBlur.uniform("sampleOffset", Vec2f(0.0f, 1.0f/mFboBlur2.getHeight())); // copy a vertically blurred version of our blurred scene into the second blur Fbo gl::setViewport( mFboBlur2.getBounds() ); mFboBlur2.bindFramebuffer(); mFboBlur1.bindTexture(0); gl::pushMatrices(); gl::setMatricesWindow( viewport.getWidth(), viewport.getHeight(), false ); gl::clear( Color::black() ); gl::drawSolidRect( mFboBlur2.getBounds() ); gl::popMatrices(); mFboBlur1.unbindTexture(); mFboBlur2.unbindFramebuffer(); // unbind the shader mShaderBlur.unbind(); // restore the viewport gl::setViewport( viewport ); // because the Fbo's have their origin in the LOWER-left corner, // flip the Y-axis before drawing gl::pushModelView(); gl::translate( Vec2f(0, 0 ) );// viewport.getHeight() ) ); gl::scale( Vec3f(1, 1, 1) ); // draw the 3 Fbo's //gl::color( Color::white() ); //gl::draw( mFboScene.getTexture(), Rectf(0, 0, 256, 256) ); //gl::draw( mFboBlur1.getTexture(), Rectf(260, 0, 260 + 256, 256) ); //gl::draw( mFboBlur2.getTexture(), Rectf(520, 0, 520 + 256, 256) ); // draw our scene with the blurred version added as a blend gl::color( Color::white() ); gl::enableAdditiveBlending(); gl::draw( mFboScene.getTexture(), Rectf(0, 0, viewport.getWidth(), viewport.getHeight() )); gl::draw( mFboBlur2.getTexture(), Rectf(0, 0, viewport.getWidth(), viewport.getHeight() )); gl::disableAlphaBlending(); // restore the modelview matrix gl::popModelView(); if (flipScreen == true){ gl::popMatrices(); } gl::color( Color(1.0,1.0,1.0) ); //These are for debug only //drawTitleSafeArea(); //OutlineParams::getInstance()->draw(); }
void TextTestApp::setup() { hideBackground = false; activeUserPresent = false; // SET UP BLUR STUFF // setup our scene Fbo mFboScene = gl::Fbo( getWindowWidth(), getWindowHeight() ); // setup our blur Fbo's, smaller ones will generate a bigger blur mFboBlur1 = gl::Fbo(getWindowWidth()/8, getWindowHeight()/8); mFboBlur2 = gl::Fbo(getWindowWidth()/8, getWindowHeight()/8); OutlineParams::getInstance()->init(); // load and compile the shaders try { mShaderBlur = gl::GlslProg( loadFile("../shaders/blur_vert.glsl"), loadFile("../shaders/blur_frag.glsl")); } catch(...) { console() << "Can't load/compile blur shader" << endl; quit(); } try { mShaderPhong = gl::GlslProg( loadFile("../shaders/phong_vert.glsl"), loadFile("../shaders/phong_frag.glsl")); } catch(...) { console() << "Can't load/compile phong shader" << endl; quit(); } mTransform.setToIdentity(); gestureTracker = GestureTracker::getInstance(); gl::Texture::Format format; format.enableMipmapping(true); mCamera.setEyePoint( Vec3f(2.5f, 5.0f, 5.0f) ); mCamera.setCenterOfInterestPoint( Vec3f(0.0f, 2.0f, 0.0f) ); mCamera.setPerspective( 60.0f, getWindowAspectRatio(), 1.0f, 1000.0f ); for (int i=0; i<40; i++) { CinderClip cinderClip = CinderClip(); cinderClip.x = -200; cinderClip.y = -200; repelClips.push_back(cinderClip); //// // TweenParticle userParticle = TweenParticle(cinderClip.x, cinderClip.y,10,true); //userParticles.push_back(userParticle); } mbackground.setup(); mbackground.setRepelClips( repelClips ); // I KNOW THEY ON SCREEN //load store config cinder::XmlTree configXml(ci::app::loadAsset( "shopconfig.xml" ) ); ShopConfig::getInstance()->parseConfig(configXml); ci::gl::Texture bubbleManWaveTexture = cinder::loadImage(ci::app::loadResource(BUBBLEMAN_WAVE)); mBubbleManWave = new SpriteSheet(); mBubbleManWave->init(bubbleManWaveTexture, "./spritesheetdata/bubbleman_wave.xml", SpriteSheet::FORMAT_TEXTUREPACKER_GENERIC_XML); ci::gl::Texture bubbleManRunTexture = cinder::loadImage(ci::app::loadResource(BUBBLEMAN_RUN)); mBubbleManRun = new SpriteSheet(); mBubbleManRun->init(bubbleManRunTexture, "./spritesheetdata/bubbleman_run.xml", SpriteSheet::FORMAT_TEXTUREPACKER_GENERIC_XML); TextureGlobals::getInstance()->setSpriteSheet(mBubbleManRun,TextureGlobals::SPRITE_BUBBLEMAN_RUN); TextureGlobals::getInstance()->setSpriteSheet(mBubbleManWave,TextureGlobals::SPRITE_BUBBLEMAN_WAVE); gl::Texture particleTexture0 = loadImage(loadAsset( "ParticleFullON.png" ) ); TextureGlobals::getInstance()->setParticleTexture(particleTexture0,0); gl::Texture particleTexture1 = loadImage(loadAsset( "ParticlePatial01.png" ) ); TextureGlobals::getInstance()->setParticleTexture(particleTexture1,1); gl::Texture particleTexture2 = loadImage(loadAsset( "ParticlePatial02.png" ) ); TextureGlobals::getInstance()->setParticleTexture(particleTexture2,2); gl::Texture particleTexture3 = loadImage(loadAsset( "ParticlePatial03.png" ) ); TextureGlobals::getInstance()->setParticleTexture(particleTexture3,3); gl::Texture particleTexture4 = loadImage(loadAsset( "ParticlePatial04.png" ) ); TextureGlobals::getInstance()->setParticleTexture(particleTexture4,4); gl::Texture particleTexture5 = loadImage(loadAsset( "ParticlePatial05.png" ) ); TextureGlobals::getInstance()->setParticleTexture(particleTexture5,5); gl::Texture particleTexture6 = loadImage(loadAsset( "background-particle.png" ) ); TextureGlobals::getInstance()->setParticleTexture(particleTexture6,6); gl::Texture particleTexture7 = loadImage(loadAsset( "ParticleFullONYellow.png" ) ); TextureGlobals::getInstance()->setParticleTexture(particleTexture6,7); gl::Texture terms1Texture = loadImage(loadAsset( "terms1.png" ) ); TextureGlobals::getInstance()->setParticleTexture(terms1Texture,8); gl::Texture terms2Texture = loadImage(loadAsset( "terms2.png" ) ); TextureGlobals::getInstance()->setParticleTexture(terms2Texture,9); //gl::Texture terms2Texture = loadImage(loadAsset( "terms2.png" ) ); //TextureGlobals::getInstance()->setParticleTexture(particleTexture6,9); myFont = FontRenderer(); fgParticles.setup( 100 ); fgParticles.setRepelClips(repelClips); // TO VIEW ACTIVE SCENE //currentScene = new ActiveScene1(); //currentScene->getSignal()->connect( boost::bind(&TextTestApp::onPassiveSceneComplete, this, ::_1 )); //currentScene->setup( myFont, iconFactory, fgParticles ); currentScene = new PassiveScene1(); currentScene->getSignal()->connect( boost::bind(&TextTestApp::onPassiveSceneComplete, this )); currentScene->setup( myFont, iconFactory, fgParticles, mbackground.gridLayer1 ); iconFactory.init(); bgAnimationTimer = Timer(); significantInteractionTimer = Timer(); setupSkeletonTracker(); }
void ScriptIdle(float fElapsedTime) { SceneManager& manag = SceneManager::getInstance(); SceneBase* pScene = manag.getCurrentScenePointer(); assert(pScene); static std::string tSceneName[8] = {"terrain", "test_shadowmapping", "terrain", "test_refraction", "terrain", "toon", "terrain", "test_fur"}; switch(current) { case -1: { manag.setCurrent(tSceneName[0]); SceneTerrain* pTerrain = (SceneTerrain*)manag.getCurrentScenePointer(); pTerrain->LoadCameraTrajFromFile("terrain_1.txt"); pTerrain->setSunAngle(vec2(0.0f, RADIANS(45.0f))); current = 0; break;} case 0: { manag.setCurrent(tSceneName[0]); if(pScene->getCamEyeSpline()->isFinished()) { manag.setCurrent(tSceneName[1]); current = 1; } break;} case 1: { manag.setCurrent(tSceneName[1]); if(pScene->getCamEyeSpline()->isFinished()) { manag.setCurrent(tSceneName[2]); SceneTerrain* pTerrain = (SceneTerrain*)manag.getCurrentScenePointer(); pTerrain->LoadCameraTrajFromFile("terrain_2.txt"); pTerrain->setSunAngle(vec2(0.0f, RADIANS(-30.0f))); current = 2; } break;} case 2: { manag.setCurrent(tSceneName[2]); if(pScene->getCamEyeSpline()->isFinished()) { manag.setCurrent(tSceneName[3]); current = 3; } break;} case 3: { manag.setCurrent(tSceneName[3]); if(pScene->getCamEyeSpline()->isFinished()) { manag.setCurrent(tSceneName[4]); SceneTerrain* pTerrain = (SceneTerrain*)manag.getCurrentScenePointer(); pTerrain->LoadCameraTrajFromFile("terrain_3.txt"); pTerrain->setSunAngle(vec2(RADIANS(-5.0f), RADIANS(71.0f))); current = 4; } break;} case 4: { manag.setCurrent(tSceneName[4]); if(pScene->getCamEyeSpline()->isFinished()) { manag.setCurrent(tSceneName[5]); current = 5; } break;} case 5: { manag.setCurrent(tSceneName[5]); if(pScene->getCamEyeSpline()->isFinished()) { manag.setCurrent(tSceneName[6]); SceneTerrain* pTerrain = (SceneTerrain*)manag.getCurrentScenePointer(); pTerrain->LoadCameraTrajFromFile("terrain_4.txt"); pTerrain->setSunAngle(vec2(RADIANS(50.0f), RADIANS(-65.0f))); current = 6; } break;} case 6: { manag.setCurrent(tSceneName[6]); if(pScene->getCamEyeSpline()->isFinished()) { manag.setCurrent(tSceneName[7]); current = 7; } break;} case 7: { manag.setCurrent(tSceneName[7]); if(pScene->getCamEyeSpline()->isFinished()) { manag.setCurrent(tSceneName[0]); SceneTerrain* pTerrain = (SceneTerrain*)manag.getCurrentScenePointer(); pTerrain->LoadCameraTrajFromFile("terrain_1.txt"); pTerrain->setSunAngle(vec2(0.0f, RADIANS(45.0f))); current = 0; } break;} default: assert(0); } }