#include <OMKDistributedCameraListener.h>
Inheritance diagram for OMK::Inp::DistributedCameraListener:
Protected Member Functions | |
virtual void | windowResized (Ogre::RenderWindow *rw) |
virtual void | windowClosed (Ogre::RenderWindow *rw) |
virtual bool | processUnbufferedKeyInput (const Ogre::FrameEvent &evt) |
virtual bool | processUnbufferedMouseInput (const Ogre::FrameEvent &evt) |
virtual bool | frameStarted (const Ogre::FrameEvent &evt) |
virtual void | init () |
initialise the object. | |
virtual void | finish () |
finish calculation of evolution. | |
virtual void | compute () |
compute evolution of this object. | |
void | readConfigurationParameters () |
Protected Attributes | |
Vis::OgreVis * | _ogreVis |
Type::Transform | _transform |
bool | _updateTransform |
float | _translationSpeed |
float | _wheelTranslationSpeed |
float | _rotationSpeed |
OIS::InputManager * | _inputManager |
OIS::Mouse * | _mouse |
OIS::Keyboard * | _keyboard |
Private Member Functions | |
DECLARE_OBJECT_FACTORY (DistributedCameraListener) |
Definition at line 27 of file OMKDistributedCameraListener.h.
OMK::Inp::DistributedCameraListener::DECLARE_OBJECT_FACTORY | ( | DistributedCameraListener | ) | [private] |
virtual void OMK::Inp::DistributedCameraListener::windowResized | ( | Ogre::RenderWindow * | rw | ) | [protected, virtual] |
Referenced by init().
virtual void OMK::Inp::DistributedCameraListener::windowClosed | ( | Ogre::RenderWindow * | rw | ) | [protected, virtual] |
Referenced by finish().
virtual bool OMK::Inp::DistributedCameraListener::processUnbufferedKeyInput | ( | const Ogre::FrameEvent & | evt | ) | [protected, virtual] |
virtual bool OMK::Inp::DistributedCameraListener::processUnbufferedMouseInput | ( | const Ogre::FrameEvent & | evt | ) | [protected, virtual] |
virtual bool OMK::Inp::DistributedCameraListener::frameStarted | ( | const Ogre::FrameEvent & | evt | ) | [protected, virtual] |
void DistributedCameraListener::init | ( | ) | [protected, virtual] |
initialise the object.
Use this member function for any initilisation than can only be done when all the simulated objects have been created. In particular, plugging the input of the objects should be done here. By default, this member function calls the initialisation of the associated computational object.
Reimplemented from OMK::SimulatedObject.
Definition at line 45 of file OMKDistributedCameraListener.cpp.
References _inputManager, _keyboard, _mouse, _ogreVis, readConfigurationParameters(), OMK::Vis::OgreVis::touchRoot(), and windowResized().
00046 { 00047 readConfigurationParameters() ; 00048 00049 ParamList pl ; 00050 size_t windowHnd( 0 ) ; 00051 std::ostringstream windowHndStr ; 00052 00053 #if defined WIN32 00054 // Uncomment these two lines to allow users to switch keyboards via the language bar 00055 pl.insert(std::make_pair( std::string( "w32_keyboard" ), std::string( "DISCL_FOREGROUND" ) ) ); 00056 pl.insert(std::make_pair( std::string( "w32_keyboard" ), std::string( "DISCL_NONEXCLUSIVE" ) ) ); 00057 00058 #elif defined OIS_LINUX_PLATFORM 00059 pl.insert( std::make_pair( std::string( "XAutoRepeatOn" ), std::string( "true") ) ); 00060 pl.insert( std::make_pair( std::string( "x11_mouse_hide" ), std::string( "false" ) ) ); 00061 pl.insert( std::make_pair( std::string( "x11_mouse_grab" ), std::string( "false" ) ) ); 00062 pl.insert( std::make_pair( std::string( "x11_keyboard_grab" ), std::string( "false" ) ) ); 00063 #endif 00064 00065 _ogreVis->touchRoot().getAutoCreatedWindow()->getCustomAttribute( "WINDOW", &windowHnd ) ; 00066 windowHndStr << windowHnd ; 00067 pl.insert( std::make_pair( std::string( "WINDOW" ), windowHndStr.str() ) ) ; 00068 00069 _inputManager = InputManager::createInputSystem( pl ) ; 00070 00071 //create devices 00072 _keyboard = static_cast<Keyboard*>( _inputManager->createInputObject( OISKeyboard, false ) ) ; 00073 _mouse = static_cast<Mouse*>( _inputManager->createInputObject( OISMouse, false ) ) ; 00074 00075 //Set initial mouse clipping size 00076 windowResized( _ogreVis->touchRoot().getAutoCreatedWindow() ); 00077 00078 //Register as a Window listener 00079 WindowEventUtilities::addWindowEventListener( _ogreVis->touchRoot().getAutoCreatedWindow(), this ) ; 00080 00081 //register as a frame listener 00082 _ogreVis->touchRoot().addFrameListener( this ) ; 00083 }
void DistributedCameraListener::finish | ( | ) | [protected, virtual] |
finish calculation of evolution.
by default, this member function does nothing. Finish is usefull in the event of having the simulation restarted whitout complete destruction of the objects
Reimplemented from OMK::SimulatedObject.
Definition at line 89 of file OMKDistributedCameraListener.cpp.
References _ogreVis, OMK::Vis::OgreVis::touchRoot(), and windowClosed().
00090 { 00091 //Remove ourself as a Window listener 00092 WindowEventUtilities::removeWindowEventListener( _ogreVis->touchRoot().getAutoCreatedWindow(), this ) ; 00093 windowClosed( _ogreVis->touchRoot().getAutoCreatedWindow() ) ; 00094 }
void DistributedCameraListener::compute | ( | ) | [protected, virtual] |
compute evolution of this object.
Reimplemented from OMK::SimulatedObject.
Definition at line 100 of file OMKDistributedCameraListener.cpp.
References _transform, and _updateTransform.
00101 { 00102 if ( _updateTransform == true ) 00103 { 00104 // std::cerr << "DistributedCameraListener::compute() Signal" << std::endl ; 00105 fireValuedSignal< TransformType >( "moveCamera", _transform ) ; 00106 _updateTransform = false ; 00107 } 00108 }
void DistributedCameraListener::readConfigurationParameters | ( | ) | [protected] |
Definition at line 114 of file OMKDistributedCameraListener.cpp.
References _ogreVis, OMK::ParametersAccessor::get(), OMK::SimulatedObject::getConfigurationParameters(), OMK::SimulatedObject::getController(), OMK::Vis::OgreVis::getRoot(), and OMASSERT.
Referenced by init().
00115 { 00116 const ConfigurationParameterDescriptor* node( getConfigurationParameters() ) ; 00117 00118 // Retrieve the VisuName parameter 00119 std::string visuName ; 00120 ParametersAccessor::get( node, "VisuName", visuName ) ; 00121 OMASSERT( ( visuName.empty() == false ) && "The VisuName configuration parameter must be declared" ) ; 00122 SimulatedObject* vis( getController().getPointerToSimulatedObjectNamed( visuName ) ) ; 00123 OMASSERT( ( vis != NULL ) && "The VisuName configuration parameter is not a SimulatedObject" ) ; 00124 _ogreVis = dynamic_cast<OgreVis*>( vis ) ; 00125 OMASSERT( ( _ogreVis != NULL ) && "The VisuName configuration parameter is not an OgreVis" ) ; 00126 OMASSERT( ( _ogreVis->getRoot().isInitialised() == true ) && "The OgreVis 'VisuName' is incorrectly initialised" ) ; 00127 }
Definition at line 57 of file OMKDistributedCameraListener.h.
Referenced by finish(), init(), and readConfigurationParameters().
float OMK::Inp::DistributedCameraListener::_translationSpeed [protected] |
Definition at line 60 of file OMKDistributedCameraListener.h.
float OMK::Inp::DistributedCameraListener::_wheelTranslationSpeed [protected] |
Definition at line 61 of file OMKDistributedCameraListener.h.
float OMK::Inp::DistributedCameraListener::_rotationSpeed [protected] |
Definition at line 62 of file OMKDistributedCameraListener.h.
OIS::InputManager* OMK::Inp::DistributedCameraListener::_inputManager [protected] |
OIS::Mouse* OMK::Inp::DistributedCameraListener::_mouse [protected] |
OIS::Keyboard* OMK::Inp::DistributedCameraListener::_keyboard [protected] |
Documentation generated on Mon Jun 9 11:46:04 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |