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

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

#include <OMKTransparencyAnimator.h>

Inheritance diagram for OMK::Vis::TransparencyValueAnimator:

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

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 (TransparencyValueAnimator)
virtual void selfProcessVis (const OMK::Type::FloatType &value)
 Called by the partner to process the visualisation.

Detailed Description

Animator to animate the transparency of an object.

Author:
BenoƮt Chanclou, bunraku <bchanclo@irisa.fr>
The floating value defines the object transparency (0.0 no transparency, 1.0 full transparency).
Configuration parameters :
The configuration parameters are those of any animator
  Animator
  {
      myTransparencyAnimator
      {
        Class TransparencyBoolAnimator
        NodeName Robot
      }
  } 

Definition at line 134 of file OMKTransparencyAnimator.h.


Member Function Documentation

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

void TransparencyValueAnimator::selfProcessVis ( const OMK::Type::FloatType 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 209 of file OMKTransparencyAnimator.cpp.

References _node, _transparency, OMK::Vis::NodeMaterialOrig::createCopyAndUpdateWith(), OMK::Vis::NodeMaterialOrig::find(), OMK::Vis::OgreAnimatorCommon::getNode(), OMK::Vis::OgreObject::getNodeMaterialOrig(), OMK::Type::SimpleTypeT< T >::getValue(), OMK::Vis::Animator::getVisualObject(), OMASSERTM, and OMK::Vis::NodeMaterialOrig::undoFor().

00210 {
00211   if (!_node)
00212   {
00213     Ogre::SceneNode* sceneNode = dynamic_cast< Ogre::SceneNode *>( &getNode() ) ;
00214     OMASSERTM( sceneNode, "No scene node found !" ) ;
00215     OgreObject* ogreObject = dynamic_cast< OgreObject* >( &getVisualObject() ) ;
00216     OMASSERTM( ogreObject, "The visual object must be a OgreObject" ) ;
00217     _node = ogreObject->getNodeMaterialOrig()->find( sceneNode ) ;
00218   }
00219   if( _transparency != value.getValue() )
00220   {
00221     if( 1.0f ==_transparency )
00222     {
00223       _transparency = value.getValue() ;
00224       _node->createCopyAndUpdateWith( this ) ;
00225     }
00226     else if( 1.0f == value.getValue() )
00227     {
00228       _transparency = value.getValue() ;
00229       _node->undoFor( this, true ) ;
00230     }
00231     else
00232     {
00233       _transparency = value.getValue() ;
00234       _node->undoFor( this, false ) ;
00235     }
00236   }
00237 }

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

Implements OMK::Vis::IUpdateMaterial.

Definition at line 242 of file OMKTransparencyAnimator.cpp.

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

00243 {
00244   node->doAction( MaterialSetSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA ) ) ;
00245   node->doAction( MaterialSetTransparency( _transparency ) ) ;
00246 }

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

Reimplemented from OMK::Vis::IUpdateMaterial.

Definition at line 251 of file OMKTransparencyAnimator.cpp.

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

00252 { 
00253   return  getUniqueMaterialName( name + "_Transparency" ) ;
00254 }


Member Data Documentation

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

Definition at line 147 of file OMKTransparencyAnimator.h.

Referenced by selfProcessVis(), and update().

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

pointer to the node to animate

Reimplemented from OMK::Vis::OgreAnimatorCommon.

Definition at line 148 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