Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

Transform.h

00001 #ifndef TRANSFORM_H
00002 #define TRANSFORM_H
00003 
00004 #include "SpecificProperty.h"
00005 
00006 class VShape;
00007 
00009 template<class T> class VTransform : public VSpecificProperty<T> {
00010 protected:
00011 
00013         VShape* ptshape;
00014 
00016         T m_CurrentValue;
00017 
00018         virtual void Do(T) = 0;
00019 
00020 public:
00021 
00022         VTransform(VTransform<T>* p) : VSpecificProperty<T>(p)
00023         {
00024                 m_CurrentValue = p->m_CurrentValue;
00025         }
00026 
00027         VTransform() { }
00028         virtual ~VTransform() {}
00029 
00032         virtual T Evaluate(int nFrame)
00033         {
00034                 if (m_pControl != NULL)
00035                         return m_pControl->Evaluate(nFrame) + m_BaseValue;
00036                 else
00037                         return m_BaseValue;
00038         }
00039 
00041         virtual T ApplyTransform( int nFrame ) {
00042                 T value = Evaluate(nFrame); // get value that current frame should be
00043                 value = value - m_CurrentValue; //difference that we need to account for
00044 
00045                 Do(value);
00046 
00047                 m_CurrentValue = m_CurrentValue + value;
00048                 return m_CurrentValue;
00049         }
00050 
00051 
00052 
00054         void SetShape( VShape *ps ) {
00055                 ptshape = ps;
00056         }
00057 
00058 };
00059 
00060 
00061 #endif

Generated at Wed Aug 29 19:58:55 2001 for Pocket Animator by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001