OMK::Vis::TransparencyAnimAnimator Class Reference
[Animators]

Animator to animate the transparency of an object. More...

#include <OMKTransparencyAnimator.h>

Inheritance diagram for OMK::Vis::TransparencyAnimAnimator:

Inheritance graph
[legend]
Collaboration diagram for OMK::Vis::TransparencyAnimAnimator:

Collaboration graph
[legend]
List of all members.

Protected Member Functions

virtual void update (NodeMaterial *node)
virtual Ogre::String getMaterialName (const Ogre::String &name) const

Protected Attributes

float _transparency
NodeMaterialOrig_node
 pointer to the node to animate

Private Member Functions

 DECLARE_ANIMATOR_FACTORY (TransparencyAnimAnimator)
virtual void selfProcessVis (const OMK::Type::StringType &value)
 Called by the partner to process the visualisation.

Detailed Description

Animator to animate the transparency of an object.

Author:
Xavier Larrodé, bunraku <xlarrode@irisa.fr>

Benoît Chanclou, bunraku <bchanclo@irisa.fr>

The transparency change each time the animator is called.
Configuration parameters :
The configuration parameters are those of any animator
  Animator
  {
      myTransparencyAnimator
      {
        Class TransparencyAnimator
        NodeName Robot
      }
  } 

Definition at line 53 of file OMKTransparencyAnimator.h.


Member Function Documentation

OMK::Vis::TransparencyAnimAnimator::DECLARE_ANIMATOR_FACTORY ( TransparencyAnimAnimator   )  [private]

void TransparencyAnimAnimator::selfProcessVis ( const OMK::Type::StringType 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 69 of file OMKTransparencyAnimator.cpp.

References _node, _transparency, OMK::Vis::NodeMaterialOrig::createCopyAndUpdateWith(), OMK::Vis::NodeMaterialOrig::find(), OMK::Vis::OgreAnimatorCommon::getNode(), OMK::Vis::OgreObject::getNodeMaterialOrig(), OMK::Vis::Animator::getVisualObject(), OMASSERTM, and OMK::Vis::NodeMaterialOrig::undoFor().

00070 {
00071   if (!_node)
00072   {
00073     Ogre::SceneNode* sceneNode = dynamic_cast< Ogre::SceneNode *>( &getNode() ) ;
00074     OMASSERTM( sceneNode, "No scene node found !" ) ;
00075     OgreObject* ogreObject = dynamic_cast< OgreObject* >( &getVisualObject() ) ;
00076     OMASSERTM( ogreObject, "The visual object must be a OgreObject" ) ;
00077     _node = ogreObject->getNodeMaterialOrig()->find( sceneNode ) ;
00078     _node->createCopyAndUpdateWith( this ) ;
00079   }
00080   _transparency -= 0.1f ;  
00081   if( _transparency < 0.0f  )
00082     _transparency = 1.0f ; 
00083   _node->undoFor( this, false ) ;
00084 }

void TransparencyAnimAnimator::update ( NodeMaterial node  )  [protected, virtual]

Implements OMK::Vis::IUpdateMaterial.

Definition at line 89 of file OMKTransparencyAnimator.cpp.

References _transparency, and OMK::Vis::NodeMaterial::doAction().

00090 {
00091   node->doAction( MaterialSetSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA ) ) ;
00092   node->doAction( MaterialSetTransparency( _transparency ) ) ;
00093 }

Ogre::String TransparencyAnimAnimator::getMaterialName ( const Ogre::String &  name  )  const [protected, virtual]

Reimplemented from OMK::Vis::IUpdateMaterial.

Definition at line 98 of file OMKTransparencyAnimator.cpp.

References OMK::Vis::IUpdateMaterial::getUniqueMaterialName().

00099 { 
00100   return  getUniqueMaterialName( name + "_Transparency" ) ;
00101 }


Member Data Documentation

float OMK::Vis::TransparencyAnimAnimator::_transparency [protected]

Definition at line 66 of file OMKTransparencyAnimator.h.

Referenced by selfProcessVis(), and update().

NodeMaterialOrig* OMK::Vis::TransparencyAnimAnimator::_node [protected]

pointer to the node to animate

Reimplemented from OMK::Vis::OgreAnimatorCommon.

Definition at line 67 of file OMKTransparencyAnimator.h.

Referenced by selfProcessVis().


logo OpenMask

Documentation generated on Mon Jun 9 11:46:05 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007