Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

c:/home/kevn/src/animaniac/gator/SetEqualOperator.h

Go to the documentation of this file.
00001 #ifndef EQUAL_OPER
00002 #define EQUAL_OPER
00003 #include <vector>
00004 #include "ani/Dynamics/Operator.h"
00005 #include "ani/Dynamics/DynamicSystem.h"
00006 
00007 namespace gator
00008 {
00010    class SetEqualOperator : public ani::Operator<ani::Body>
00011    {
00012    public:
00013       typedef boost::shared_ptr<ani::Body> EntityTypePtr;
00014 
00015    public:
00016       SetEqualOperator( EntityTypePtr& e1, EntityTypePtr& e2 ) :
00017                                          ani::Operator<ani::Body>(),
00018                                          mE1( e1 ), mE2( e2 ), 
00019                                          mOffset( 0.0f, 0.0f, 0.0f )
00020       {
00021       }
00022       
00023       virtual ~SetEqualOperator()
00024       {
00025       }
00026 
00028       void setOffset( const gmtl::Vec3f& offset )
00029       {
00030          mOffset = offset;
00031       }
00032       
00034       void setEntities( EntityTypePtr& e1, EntityTypePtr& e2 )
00035       {
00036          mE1 = e1;
00037          mE2 = e2;
00038       }
00039 
00041       virtual void exec( ani::DynamicSystem<ani::Body>& ps, float timeDelta )
00042       {
00043          *mE1 = *mE2;
00044          mE1->setPosition( mE1->position() + (mE1->rotation() * mOffset) );
00045          
00046       }
00047 
00048    private:
00049       EntityTypePtr& mE1;
00050       EntityTypePtr& mE2;
00051       gmtl::Vec3f mOffset;
00052    };
00053 } // end namespace gator
00054    
00055 
00056 
00057 
00058 #endif

Generated on Wed Jun 12 01:54:03 2002 for Animaniac by doxygen1.2.15