OMKOgreObject.cpp

Go to the documentation of this file.
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 "OMKOgreObject.h"
00022 #include "OMKOgreVis.h"
00023 #include "OMKConversion.h"
00024 #include "OMKAnimator.h"
00025 #include "OMKParametersAccessor.inl"
00026 #include "OMKMaterial.h" 
00027 using namespace OBT ;
00028 using namespace OMK ;
00029 using namespace OMK::Vis ;
00030 using namespace Wm4 ;
00031 
00032 //-------------------------------------------------------------------------
00033 // constructor
00034 //-------------------------------------------------------------------------
00035 OgreObject::OgreObject(
00036   VisBase& vis, const Name& id, const ConfigurationParameterDescriptor* node )
00037   : VisualObject( vis, id, node ),
00038     _ogreVis( static_cast< OgreVis& >( vis ) ),
00039     // create a new ogre scene node
00040     _sceneNode( *_ogreVis.touchRoot().getSceneManager( "sceneManager" )->getRootSceneNode()->createChildSceneNode( getId().getCString() ) ),
00041   _nodeMaterial( 0 )
00042 {
00043   // converts the transform value read by VisualObject to the ogre node
00044   convert( getTransform(), _sceneNode ) ;
00045 }
00046 
00047 //-------------------------------------------------------------------------
00048 // destructor
00049 //-------------------------------------------------------------------------
00050 OgreObject::~OgreObject()
00051 {
00052   //Animator Destruction before OgreStuff
00053   for( AnimatorsMap::iterator a( _animators.begin() ) ;
00054        a != _animators.end() ;
00055        a++ )
00056   {
00057     delete a->second ;
00058   }
00059   _animators.clear() ;
00060   _ogreVis.touchRoot().getSceneManager( "sceneManager" )->destroySceneNode( _sceneNode.getName() ) ;
00061 
00062   delete _nodeMaterial ;
00063 }
00064 
00065 //-------------------------------------------------------------------------
00066 // visualise
00067 //-------------------------------------------------------------------------
00068 void
00069 OgreObject::visualise()
00070 {
00071 }
00072 
00073 NodeMaterialOrig* OgreObject::getNodeMaterialOrig() 
00074 {
00075   if( !_nodeMaterial )
00076   {
00077     _nodeMaterial = new NodeMaterialOrig( &_sceneNode ) ;
00078   }
00079   return _nodeMaterial ;
00080 }
00081 
00082 
00083 
00084 
00085 
00086 

logo OpenMask

Documentation generated on Mon Jun 9 11:45:57 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007