00001 /************************************************************************/ 00002 /* This file is part of openMask(c) INRIA, CNRS, Universite de Rennes 1 */ 00003 /* 1993-2002, thereinafter the Software */ 00004 /* */ 00005 /* The Software has been developped within the Siames Project. */ 00006 /* INRIA, the University of Rennes 1 and CNRS jointly hold intellectual */ 00007 /* property rights */ 00008 /* */ 00009 /* The Software has been registered with the Agence pour la Protection */ 00010 /* des Programmes (APP) under registration number */ 00011 /* IDDN.FR.001.510008.00.S.P.2001.000.41200 */ 00012 /* */ 00013 /* This file may be distributed under the terms of the Q Public License */ 00014 /* version 1.0 as defined by Trolltech AS of Norway and appearing in */ 00015 /* the file LICENSE.QPL included in the packaging of this file. */ 00016 /* */ 00017 /* Licensees holding valid specific licenses issued by INRIA, CNRS or */ 00018 /* Universite Rennes 1 for the software may use this file in */ 00019 /* acordance with that specific license */ 00020 /************************************************************************/ 00021 #include "OMKOgreObjectScene.h" 00022 #include "OMKOgreVis.h" 00023 #include "OMKParametersAccessor.inl" 00024 00025 using namespace OBT ; 00026 using namespace OMK ; 00027 using namespace OMK::Vis ; 00028 using namespace Wm4 ; 00029 00030 OMK::Name OgreObjectScene::OMK_CLASS_ID( "OgreObjectScene" ) ; 00031 const bool OgreObjectScene::REGISTERED_IN_VISUAL_OBJECT_FACTORY( 00032 OMK::Vis::VisualObjectFactory::getInstance().registerCreator< OMK::Vis::VisualObjectCreatorT< OgreObjectScene > >( OgreObjectScene::OMK_CLASS_ID ) 00034 && OMK::Vis::VisualObjectFactory::getInstance().registerCreator< OMK::Vis::VisualObjectCreatorT< OgreObjectScene > >( "OgreObject" ) ) ; 00035 00036 //------------------------------------------------------------------------- 00037 // constructor 00038 //------------------------------------------------------------------------- 00039 OgreObjectScene::OgreObjectScene( VisBase& vis, const Name& id, 00040 const ConfigurationParameterDescriptor* node ) 00041 : OgreObject( vis, id, node ) 00042 { 00043 loadConfigurationParameters( node ) ; 00044 if ( !_geometryFileName.empty() ) 00045 { 00046 loadGeometry() ; 00047 } 00048 } 00049 00050 //------------------------------------------------------------------------- 00051 // destructor 00052 //------------------------------------------------------------------------- 00053 OgreObjectScene::~OgreObjectScene() 00054 { 00055 } 00056 00057 //------------------------------------------------------------------------- 00058 // loadConfigurationParameters 00059 //------------------------------------------------------------------------- 00060 void 00061 OgreObjectScene::loadConfigurationParameters( const ConfigurationParameterDescriptor* node ) 00062 { 00063 OMTRACEID( OMK_DEBUG_VIS_EXEC, "Loading configuration for " << debugMsg( this ) ) ; 00064 00065 // Retrieve the resource group name 00066 if( !ParametersAccessor::get( node, "ResourceGroup", _resourceGroupName ) ) 00067 { 00068 OMTRACEID( OMK_DEBUG_VIS, "Warning for " << debugMsg( this ) << std::endl 00069 << ">>> :-| no resource group name provided, will use \"General\" by default" ) ; 00070 } 00071 00072 // Retrieve geometry file name 00073 if( !ParametersAccessor::get( node, "GeometryFile", _geometryFileName ) ) 00074 { 00075 OMTRACEID( OMK_DEBUG_VIS, "Warning for " << debugMsg( this ) << std::endl 00076 << ">>> :-| no geometry file name provided" ) ; 00077 } 00078 } 00079 00080 //------------------------------------------------------------------------- 00081 // loadGeometry 00082 //------------------------------------------------------------------------- 00083 void 00084 OgreObjectScene::loadGeometry() 00085 { 00086 OMTRACEID( OMK_DEBUG_VIS_EXEC, "Loading geometry of the " << debugMsg( this ) ) ; 00087 00088 // load the scene associated to the simulated object OgreVis 00089 Ogre::Root& root( _ogreVis.touchRoot() ) ; 00090 00091 Singleton< Ogre::dsi::dotSceneLoader >::getInstance().load( 00092 _geometryFileName, 00093 _resourceGroupName, 00094 root.getSceneManager( "sceneManager" ), 00095 root.getAutoCreatedWindow(), 00096 &_sceneNode, 00097 false, 00098 false, 00099 true ) ; 00100 00101 // check for load errors 00102 Ogre::dsi::dotSceneInfo::itLoadLog it( Ogre::dsi::dotSceneInfo::getSceneLoadingLog() ) ; 00103 std::string errs ; 00104 while ( it.hasMoreElements() ) 00105 { 00106 errs += it.getNext() + "\n"; 00107 } 00108 if ( !errs.empty() ) 00109 { 00110 OMTRACEID( OMK_DEBUG_VIS_EXEC, "Warning for " << debugMsg( this ) << std::endl 00111 << ">>> :-| errors occured during scene loading" << std::endl << errs ) ; 00112 } 00113 } 00114 00115 00116
Documentation generated on Mon Jun 9 11:45:57 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |