#include <OMKAwarenessAnimator.h>
Inheritance diagram for OMK::Vis::AwarenessColorAnimator:
Protected Member Functions | |
virtual void | update (NodeMaterial *node) |
virtual Ogre::String | getMaterialName (const Ogre::String &name) const |
Protected Attributes | |
NodeMaterialOrig * | _node |
pointer to the node to animate | |
bool | _awareness |
Ogre::Vector4 | _color |
Private Member Functions | |
DECLARE_ANIMATOR_FACTORY (AwarenessColorAnimator) | |
virtual void | selfProcessVis (const OMK::Type::ColorType &value) |
Called by the partner to process the visualisation. |
Animator { myAwarenessAnimator { Class AwarenessAnimator NodeName Robot ListenedEvent "awareness" }
Example:
visuOgre { Class OgreVis ... Extensions { ... awarenessWithColor { Class KeyColorEmitterExtension Key A VisuName visuOgre EventName "awarenessWithColor" Values [[1.0 0.0 0.0] [0.0 1.0 0.0] [0.0 0.0 1.0] [0.0 0.0 0.0 0.0]] // red, blue, green, none Signal on } ... } UserParams { OgreHome "${OGRE_HOME}" ... VisualObject { ... scene { Class OgreObjectScene ... Animator { awarenessWithColor { Class AwarenessColorAnimator NodeName NODE ListenedEvent "awarenessWithColor" } } } ... } } }
Definition at line 223 of file OMKAwarenessAnimator.h.
OMK::Vis::AwarenessColorAnimator::DECLARE_ANIMATOR_FACTORY | ( | AwarenessColorAnimator | ) | [private] |
void AwarenessColorAnimator::selfProcessVis | ( | const OMK::Type::ColorType & | value | ) | [private, virtual] |
Called by the partner to process the visualisation.
Called by the public version if the value was changed. Must be overwrite by sons.
Definition at line 201 of file OMKAwarenessAnimator.cpp.
References _awareness, _color, _node, OMK::Vis::NodeMaterialOrig::createCopyAndUpdateWith(), OMK::Type::SimpleTypeT< T >::getValue(), OMTRACEID, and OMK::Vis::NodeMaterialOrig::undoFor().
00202 { 00203 00204 OMTRACEID("OMK::AwarenessAnimator"," got " << value ); 00205 //ON/OFF now 00206 Ogre::Vector4 newColor( value.getValue()[0], value.getValue()[1], value.getValue()[2], value.getValue()[3] ); 00207 bool newAwareness = 0.0f != value.getValue()[3] ; 00208 if( ( _awareness != newAwareness ) || ( newColor != _color ) ) 00209 { 00210 _color = newColor ; 00211 if( _awareness && newAwareness ) 00212 { 00213 _node->undoFor( this, false ) ; 00214 } 00215 else if( !_awareness && newAwareness ) 00216 { 00217 _awareness = true ; 00218 _node->createCopyAndUpdateWith( this ) ; 00219 } 00220 else if( _awareness && !newAwareness ) 00221 { 00222 _awareness = false ; 00223 _node->undoFor( this, true ) ; 00224 } 00225 } 00226 }
void AwarenessColorAnimator::update | ( | NodeMaterial * | node | ) | [protected, virtual] |
Implements OMK::Vis::IUpdateMaterial.
Definition at line 231 of file OMKAwarenessAnimator.cpp.
References _awareness, _color, OMK::Vis::NodeMaterial::doAction(), and OMASSERTM.
00232 { 00233 OMASSERTM( _awareness, "The awareness should be set to true" ) ; 00234 node->doAction( MaterialSetAwareness( _color ) ) ; 00235 }
Ogre::String AwarenessColorAnimator::getMaterialName | ( | const Ogre::String & | name | ) | const [protected, virtual] |
Reimplemented from OMK::Vis::IUpdateMaterial.
Definition at line 240 of file OMKAwarenessAnimator.cpp.
References _awareness, and OMK::Vis::IUpdateMaterial::getUniqueMaterialName().
00241 { 00242 return getUniqueMaterialName( name + "_Awareness" + ( _awareness ? "1" : "0" ) ) ; 00243 }
NodeMaterialOrig* OMK::Vis::AwarenessColorAnimator::_node [protected] |
pointer to the node to animate
Reimplemented from OMK::Vis::OgreAnimatorCommon.
Definition at line 236 of file OMKAwarenessAnimator.h.
Referenced by selfProcessVis().
bool OMK::Vis::AwarenessColorAnimator::_awareness [protected] |
Definition at line 237 of file OMKAwarenessAnimator.h.
Referenced by getMaterialName(), selfProcessVis(), and update().
Ogre::Vector4 OMK::Vis::AwarenessColorAnimator::_color [protected] |
Definition at line 238 of file OMKAwarenessAnimator.h.
Referenced by selfProcessVis(), and update().
Documentation generated on Mon Jun 9 11:46:05 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |