As in the subject, you could achieve no-overhead function calls by exploiting
generics programming.
For example, as you already have, define the Animation mode:
enum
{
EaseIn,
EaseOut,
EaseInOut
}
Then defines the equation solvers as static functions:
...
class Expo
{
public:
static float easeIn( float t, float b, float c, float d );
static float easeOut( float t, float b, float c, float d );
static float easeInOut( float t, float b, float c, float d );
};
Then, define the invoker:
template< class T, int mode >
float ease( float accuFrameTime )
{
...
float ret = iFrom;
switch( mode )
{
case EaseIn:
{
ret = T::easeIn( t, b, c, d );
break;
}
case EaseOut:
{
ret = T::easeOut( t, b, c, d );
break;
}
case EaseIn:
{
ret = T::easeInOut( t, b, c, d );
break;
}
}
return ret;
}
Original issue reported on code.google.com by manuel....@gmail.com on 14 Feb 2010 at 3:48
Original issue reported on code.google.com by
manuel....@gmail.com
on 14 Feb 2010 at 3:48