Ignore:
Timestamp:
05/15/06 18:48:34 (18 years ago)
Author:
igarcia
Message:
 
Location:
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src

    • Property svn:ignore set to
      LBBCPointClusterGenerator.cpp
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/OBAOgreFrameListenerMode.cpp

    r900 r961  
    33 
    44namespace OBA { 
     5 
     6void OSceneCallback::OnCameraCreate(Ogre::Camera* pCamera, TiXmlElement* pCameraDesc)  
     7{ 
     8        // If a camera of name "FirstCamera" is loaded, it will be set as the default current  
     9        if(pCamera->getName() == "FirstCamera") 
     10                Ogre::Root::getSingleton().getAutoCreatedWindow()->getViewport(0)->setCamera(pCamera); 
     11} 
    512 
    613OgreFrameListenerMode::OgreFrameListenerMode(Ogre::RenderWindow *win, unsigned int ogreFrameListenerModeHandle, bool useBufferedInputKeys, bool useBufferedInputMouse) 
     
    121128        mCamera->yaw(mRotScale); 
    122129    } 
     130 
     131        // We can cycle cameras with the 'c' key 
     132        if (mInputDevice->isKeyDown(Ogre::KC_C) && (mTimeUntilNextToggle <= 0))  
     133        {                        
     134 
     135                Ogre::Camera* firstCam; 
     136                Ogre::Camera* currentCam = mWindow->getViewport(0)->getCamera(); 
     137 
     138                Ogre::Viewport* vp = mWindow->getViewport(0); 
     139 
     140                Ogre::SceneManager::CameraIterator it = mSceneMgr->getCameraIterator(); 
     141 
     142                if(it.hasMoreElements()) 
     143                { 
     144                        firstCam = it.peekNextValue(); 
     145                } 
     146 
     147                while(it.hasMoreElements())  
     148                {                        
     149                        Ogre::Camera* cam = it.getNext(); 
     150 
     151                        if(currentCam == cam)  
     152                        { 
     153                                Ogre::Camera* camera = it.hasMoreElements() ? it.getNext() : firstCam; 
     154                                vp->setCamera(camera);                                   
     155                        } 
     156                } 
     157                mTimeUntilNextToggle = 0.5f;             
     158        } 
    123159 
    124160        // see if switching is on, and you want to toggle  
     
    303339        } 
    304340 
     341        static Ogre::Real currentTime = 0; 
     342 
     343        // We update all loaded animations each frame 
     344        Ogre::SceneManager::AnimationIterator animationIt = mSceneMgr->getAnimationIterator(); 
     345 
     346        while(animationIt.hasMoreElements())  
     347        { 
     348                Ogre::Animation* animation = animationIt.getNext(); 
     349                 
     350                const Ogre::Animation::NodeTrackList& trackList = animation->_getNodeTrackList(); 
     351                 
     352                Ogre::Animation::NodeTrackList::const_iterator it = trackList.begin(); 
     353                Ogre::Animation::NodeTrackList::const_iterator iend = trackList.end(); 
     354 
     355                for(; it != iend; ++it) { 
     356                        const Ogre::NodeAnimationTrack* track = it->second; 
     357                        track->getAssociatedNode()->resetToInitialState(); 
     358                } 
     359                 
     360                currentTime += evt.timeSinceLastFrame; 
     361                animation->apply(currentTime); 
     362        }                
     363   
    305364        return true; 
    306365} 
     
    410469} 
    411470 
     471void OgreFrameListenerMode::loadScene(Ogre::String filename) 
     472{ 
     473        // Create an oE_Loader Callback object to post-process created objects 
     474        OSceneCallback oeCallback; 
     475         
     476        mOScene = new OSMScene(mSceneMgr, mWindow); 
     477 
     478        // Initialises with the scene to be loaded and the callback if requiered 
     479        mOScene->initialise(filename.c_str(), &oeCallback); 
     480 
     481        // create and setup the scene in the root node 
     482        mOScene->createScene(); 
     483} 
     484 
    412485void OgreFrameListenerMode::createScene() 
    413486{ 
Note: See TracChangeset for help on using the changeset viewer.