[Opal-commits] opal/samples/src BaseOpalApp.h,1.10,1.11
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-05-02 16:41:08
|
Update of /cvsroot/opal/opal/samples/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9112/samples/src Modified Files: BaseOpalApp.h Log Message: Fixed bug in Joint class that crashed when applying a force/torque to a Joint connected to a single Solid. Index: BaseOpalApp.h =================================================================== RCS file: /cvsroot/opal/opal/samples/src/BaseOpalApp.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** BaseOpalApp.h 27 Apr 2005 02:28:18 -0000 1.10 --- BaseOpalApp.h 2 May 2005 16:40:59 -0000 1.11 *************** *** 58,133 **** } - protected: - /// Create a PhysicalCamera that uses the ExampleApplication's - /// Ogre camera. - virtual void createPhysicalCamera() - { - mPhysicalCamera = new PhysicalCamera(mSimulator, - ExampleApplication::mCamera, false); - } - - /// Register the frame listener with the Ogre root so it will - /// call the listener at the appropriate time. - virtual void createFrameListener() - { - ExampleFrameListener::init(ExampleApplication::mWindow, - ExampleApplication::mCamera); - mRoot->addFrameListener(this); - } - - /// Initial scene setup function. Create and position lights, load - /// models, create a camera, etc. - virtual void createScene() = 0; - - /// Called once per frame after input and physics have been updated. - /// This is a place for applications to do application-specific - /// updates per frame. It takes the dt since the last frame as a - /// parameter. This should return false if we should break out of - /// the main loop. - virtual bool appFrameStarted(opal::real dt) = 0; - - /// Called at the start of each frame. Calculate dt since the last - /// frame, update input, update physics, etc. Returns false if we - /// should break out of the main loop. Applications should not - /// override this; instead, they should override 'appFrameStarted'. - virtual bool frameStarted(const FrameEvent& evt) - { - if(ExampleApplication::mWindow->isClosed()) - { - return false; - } - - Ogre::Real dt = evt.timeSinceLastFrame; - - if (false == handleInput(dt)) - { - return false; - } - - if (!mPaused) - { - // Simulate physics. - mSimulator->simulate(dt); - - // Update the PhysicalEntities. - size_t size = mPhysicalEntityList.size(); - for(size_t i = 0; i<size; ++i) - { - mPhysicalEntityList.at(i)->update(dt); - } - } - - // Update the PhysicalCamera. - mPhysicalCamera->update(dt); - - // Notify the application about the new frame. - if (false == appFrameStarted((opal::real)dt)) - { - return false; - } - - return true; - } - /// Creates and returns a pointer to a PhysicalEntity. Takes /// the name of the new PhysicalEntity, the associated Ogre --- 58,61 ---- *************** *** 410,413 **** --- 338,413 ---- } + protected: + /// Create a PhysicalCamera that uses the ExampleApplication's + /// Ogre camera. + virtual void createPhysicalCamera() + { + mPhysicalCamera = new PhysicalCamera(mSimulator, + ExampleApplication::mCamera, false); + } + + /// Register the frame listener with the Ogre root so it will + /// call the listener at the appropriate time. + virtual void createFrameListener() + { + ExampleFrameListener::init(ExampleApplication::mWindow, + ExampleApplication::mCamera); + mRoot->addFrameListener(this); + } + + /// Initial scene setup function. Create and position lights, load + /// models, create a camera, etc. + virtual void createScene() = 0; + + /// Called once per frame after input and physics have been updated. + /// This is a place for applications to do application-specific + /// updates per frame. It takes the dt since the last frame as a + /// parameter. This should return false if we should break out of + /// the main loop. + virtual bool appFrameStarted(opal::real dt) = 0; + + /// Called at the start of each frame. Calculate dt since the last + /// frame, update input, update physics, etc. Returns false if we + /// should break out of the main loop. Applications should not + /// override this; instead, they should override 'appFrameStarted'. + virtual bool frameStarted(const FrameEvent& evt) + { + if(ExampleApplication::mWindow->isClosed()) + { + return false; + } + + Ogre::Real dt = evt.timeSinceLastFrame; + + if (false == handleInput(dt)) + { + return false; + } + + if (!mPaused) + { + // Simulate physics. + mSimulator->simulate(dt); + + // Update the PhysicalEntities. + size_t size = mPhysicalEntityList.size(); + for(size_t i = 0; i<size; ++i) + { + mPhysicalEntityList.at(i)->update(dt); + } + } + + // Update the PhysicalCamera. + mPhysicalCamera->update(dt); + + // Notify the application about the new frame. + if (false == appFrameStarted((opal::real)dt)) + { + return false; + } + + return true; + } + /// Returns false if we should break out of the main loop. bool handleInput(Ogre::Real dt) |