![[]](/images/special/trans.gif)
LibN2L-4 Library Code ReferenceClassesCompounds Files Members Method Index Full Reference cGuiSEFollowB3Curve.cppGo to the documentation of this file.00001 00002 #include "cGuiSEFollowB3Curve.h" 00003 00004 #include "gui/cGuiElement.h" 00005 00006 namespace n2l 00007 { 00008 /**************************************************************************/ 00009 cGuiSEFollowB3Curve::cGuiSEFollowB3Curve() 00010 { 00011 init(); 00012 } 00013 00014 /**************************************************************************/ 00015 cGuiSEFollowB3Curve::cGuiSEFollowB3Curve( const cDynVar &iDef ) 00016 { 00017 init(); 00018 load( iDef ); 00019 } 00020 00021 /**************************************************************************/ 00022 cGuiSEFollowB3Curve::cGuiSEFollowB3Curve( const tString &iEffectName, 00023 const tVector3f &iStart, const tVector3f &iC1, 00024 const tVector3f &iEnd, const tUint &iLife ) : 00025 cGuiSEInt( iEffectName ) 00026 { 00027 init(); 00028 mCurve = tBezier33f( iStart, iC1, iEnd ); 00029 mLife = iLife; 00030 } 00031 00032 /**************************************************************************/ 00033 cGuiSEFollowB3Curve::~cGuiSEFollowB3Curve() 00034 { 00035 } 00036 00037 00038 /**************************************************************************/ 00039 void cGuiSEFollowB3Curve::load( const cDynVar &iDef ) 00040 { 00041 cGuiSEInt::load( iDef ); 00042 00043 mCurve = asBezier33f( iDef["curve"] ); 00044 mLife = iDef["time"]; 00045 } 00046 00047 /**************************************************************************/ 00048 const tBool cGuiSEFollowB3Curve::actOn( cGuiElement *const i_ioElement, 00049 const tUint iTimePassed ) 00050 { 00051 if (!alive()) return false; 00052 mAge += iTimePassed; 00053 mAge = n2lMin(mAge,mLife); 00054 i_ioElement->pos( mCurve.pointAt(mAge/tFloat(mLife)) ); 00055 return alive(mAge!=mLife); 00056 } 00057 00058 00059 /**************************************************************************/ 00060 const cAutoPtr<cGuiSEInt> 00061 cGuiSEFollowB3Curve::clone() const 00062 { 00063 cAutoPtr<cGuiSEFollowB3Curve> tmp = new cGuiSEFollowB3Curve; 00064 cloneInto( tmp ); 00065 return tmp; 00066 } 00067 00068 /**************************************************************************/ 00069 void cGuiSEFollowB3Curve::cloneInto( 00070 const cAutoPtr<cGuiSEFollowB3Curve> &ioElement ) const 00071 { 00072 cGuiSEInt::cloneInto( ioElement ); 00073 00074 ioElement->mCurve = mCurve; 00075 ioElement->mLife = mLife; 00076 ioElement->mAge = mAge; 00077 } 00078 00079 /**************************************************************************/ 00080 void cGuiSEFollowB3Curve::init() 00081 { 00082 mLife = 1000; 00083 mAge = 0; 00084 } 00085 } |