mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 07:34:45 +00:00
ease member vars tagged as member vars
This commit is contained in:
parent
d979cf9d2d
commit
300d9eefbf
4 changed files with 88 additions and 88 deletions
|
|
@ -6,158 +6,158 @@
|
||||||
|
|
||||||
EaseF::EaseF()
|
EaseF::EaseF()
|
||||||
{
|
{
|
||||||
dir = 0;
|
mDir = 0;
|
||||||
type = 0;
|
mType = 0;
|
||||||
param[0] = param[1] = -1.0f;
|
mParam[0] = mParam[1] = -1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
EaseF::EaseF(const EaseF &ease)
|
EaseF::EaseF(const EaseF &ease)
|
||||||
{
|
{
|
||||||
this->dir = ease.dir;
|
this->mDir = ease.mDir;
|
||||||
this->type = ease.type;
|
this->mType = ease.mType;
|
||||||
this->param[0] = ease.param[0];
|
this->mParam[0] = ease.mParam[0];
|
||||||
this->param[1] = ease.param[1];
|
this->mParam[1] = ease.mParam[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
EaseF::EaseF(const S32 dir, const S32 type)
|
EaseF::EaseF(const S32 dir, const S32 type)
|
||||||
{
|
{
|
||||||
this->dir = dir;
|
this->mDir = dir;
|
||||||
this->type = type;
|
this->mType = type;
|
||||||
this->param[0] = this->param[1] = -1.0f;
|
this->mParam[0] = this->mParam[1] = -1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
EaseF::EaseF(const S32 dir, const S32 type, F32 param[2])
|
EaseF::EaseF(const S32 dir, const S32 type, F32 param[2])
|
||||||
{
|
{
|
||||||
this->dir = dir;
|
this->mDir = dir;
|
||||||
this->type = type;
|
this->mType = type;
|
||||||
this->param[0] = param[0];
|
this->mParam[0] = param[0];
|
||||||
this->param[1] = param[1];
|
this->mParam[1] = param[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
void EaseF::set(const S32 dir, const S32 type)
|
void EaseF::set(const S32 dir, const S32 type)
|
||||||
{
|
{
|
||||||
this->dir = dir;
|
this->mDir = dir;
|
||||||
this->type = type;
|
this->mType = type;
|
||||||
this->param[0] = this->param[1] = -1.0f;
|
this->mParam[0] = this->mParam[1] = -1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EaseF::set(const S32 dir, const S32 type, F32 param[2])
|
void EaseF::set(const S32 dir, const S32 type, F32 param[2])
|
||||||
{
|
{
|
||||||
this->dir = dir;
|
this->mDir = dir;
|
||||||
this->type = type;
|
this->mType = type;
|
||||||
this->param[0] = param[0];
|
this->mParam[0] = param[0];
|
||||||
this->param[1] = param[1];
|
this->mParam[1] = param[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
void EaseF::set(const S32 dir, const S32 type, F32 param0, F32 param1)
|
void EaseF::set(const S32 dir, const S32 type, F32 param0, F32 param1)
|
||||||
{
|
{
|
||||||
this->dir = dir;
|
this->mDir = dir;
|
||||||
this->type = type;
|
this->mType = type;
|
||||||
this->param[0] = param0;
|
this->mParam[0] = param0;
|
||||||
this->param[1] = param1;
|
this->mParam[1] = param1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EaseF::set(const char *s)
|
void EaseF::set(const char *s)
|
||||||
{
|
{
|
||||||
dSscanf(s,"%d %d %f %f",&dir,&type,¶m[0],¶m[1]);
|
dSscanf(s,"%d %d %f %f",&mDir,&mType,&mParam[0],&mParam[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
F32 EaseF::getValue(F32 t, F32 b, F32 c, F32 d) const
|
F32 EaseF::getValue(F32 t, F32 b, F32 c, F32 d) const
|
||||||
{
|
{
|
||||||
F32 value = 0;
|
F32 value = 0;
|
||||||
|
|
||||||
if (type == Ease::Linear)
|
if (mType == Ease::Linear)
|
||||||
{
|
{
|
||||||
value = mLinearTween(t,b, c, d);
|
value = mLinearTween(t,b, c, d);
|
||||||
}
|
}
|
||||||
else if (type == Ease::Quadratic)
|
else if (mType == Ease::Quadratic)
|
||||||
{
|
{
|
||||||
if (dir == Ease::In)
|
if (mDir == Ease::In)
|
||||||
value = mEaseInQuad(t,b, c, d);
|
value = mEaseInQuad(t,b, c, d);
|
||||||
else if (dir == Ease::Out)
|
else if (mDir == Ease::Out)
|
||||||
value = mEaseOutQuad(t,b, c, d);
|
value = mEaseOutQuad(t,b, c, d);
|
||||||
else if (dir == Ease::InOut)
|
else if (mDir == Ease::InOut)
|
||||||
value = mEaseInOutQuad(t,b, c, d);
|
value = mEaseInOutQuad(t,b, c, d);
|
||||||
}
|
}
|
||||||
else if (type == Ease::Cubic)
|
else if (mType == Ease::Cubic)
|
||||||
{
|
{
|
||||||
if (dir == Ease::In)
|
if (mDir == Ease::In)
|
||||||
value = mEaseInCubic(t,b, c, d);
|
value = mEaseInCubic(t,b, c, d);
|
||||||
else if (dir == Ease::Out)
|
else if (mDir == Ease::Out)
|
||||||
value = mEaseOutCubic(t,b, c, d);
|
value = mEaseOutCubic(t,b, c, d);
|
||||||
else if (dir == Ease::InOut)
|
else if (mDir == Ease::InOut)
|
||||||
value = mEaseInOutCubic(t,b, c, d);
|
value = mEaseInOutCubic(t,b, c, d);
|
||||||
}
|
}
|
||||||
else if (type == Ease::Quartic)
|
else if (mType == Ease::Quartic)
|
||||||
{
|
{
|
||||||
if (dir == Ease::In)
|
if (mDir == Ease::In)
|
||||||
value = mEaseInQuart(t,b, c, d);
|
value = mEaseInQuart(t,b, c, d);
|
||||||
else if (dir == Ease::Out)
|
else if (mDir == Ease::Out)
|
||||||
value = mEaseOutQuart(t,b, c, d);
|
value = mEaseOutQuart(t,b, c, d);
|
||||||
else if (dir == Ease::InOut)
|
else if (mDir == Ease::InOut)
|
||||||
value = mEaseInOutQuart(t,b, c, d);
|
value = mEaseInOutQuart(t,b, c, d);
|
||||||
}
|
}
|
||||||
else if (type == Ease::Quintic)
|
else if (mType == Ease::Quintic)
|
||||||
{
|
{
|
||||||
if (dir == Ease::In)
|
if (mDir == Ease::In)
|
||||||
value = mEaseInQuint(t,b, c, d);
|
value = mEaseInQuint(t,b, c, d);
|
||||||
else if (dir == Ease::Out)
|
else if (mDir == Ease::Out)
|
||||||
value = mEaseOutQuint(t,b, c, d);
|
value = mEaseOutQuint(t,b, c, d);
|
||||||
else if (dir == Ease::InOut)
|
else if (mDir == Ease::InOut)
|
||||||
value = mEaseInOutQuint(t,b, c, d);
|
value = mEaseInOutQuint(t,b, c, d);
|
||||||
}
|
}
|
||||||
else if (type == Ease::Sinusoidal)
|
else if (mType == Ease::Sinusoidal)
|
||||||
{
|
{
|
||||||
if (dir == Ease::In)
|
if (mDir == Ease::In)
|
||||||
value = mEaseInSine(t,b, c, d);
|
value = mEaseInSine(t,b, c, d);
|
||||||
else if (dir == Ease::Out)
|
else if (mDir == Ease::Out)
|
||||||
value = mEaseOutSine(t,b, c, d);
|
value = mEaseOutSine(t,b, c, d);
|
||||||
else if (dir == Ease::InOut)
|
else if (mDir == Ease::InOut)
|
||||||
value = mEaseInOutSine(t,b, c, d);
|
value = mEaseInOutSine(t,b, c, d);
|
||||||
}
|
}
|
||||||
else if (type == Ease::Exponential)
|
else if (mType == Ease::Exponential)
|
||||||
{
|
{
|
||||||
if (dir == Ease::In)
|
if (mDir == Ease::In)
|
||||||
value = mEaseInExpo(t,b, c, d);
|
value = mEaseInExpo(t,b, c, d);
|
||||||
else if (dir == Ease::Out)
|
else if (mDir == Ease::Out)
|
||||||
value = mEaseOutExpo(t,b, c, d);
|
value = mEaseOutExpo(t,b, c, d);
|
||||||
else if (dir == Ease::InOut)
|
else if (mDir == Ease::InOut)
|
||||||
value = mEaseInOutExpo(t,b, c, d);
|
value = mEaseInOutExpo(t,b, c, d);
|
||||||
}
|
}
|
||||||
else if (type == Ease::Circular)
|
else if (mType == Ease::Circular)
|
||||||
{
|
{
|
||||||
if (dir == Ease::In)
|
if (mDir == Ease::In)
|
||||||
value = mEaseInCirc(t,b, c, d);
|
value = mEaseInCirc(t,b, c, d);
|
||||||
else if (dir == Ease::Out)
|
else if (mDir == Ease::Out)
|
||||||
value = mEaseOutCirc(t,b, c, d);
|
value = mEaseOutCirc(t,b, c, d);
|
||||||
else if (dir == Ease::InOut)
|
else if (mDir == Ease::InOut)
|
||||||
value = mEaseInOutCirc(t,b, c, d);
|
value = mEaseInOutCirc(t,b, c, d);
|
||||||
}
|
}
|
||||||
else if (type == Ease::Elastic)
|
else if (mType == Ease::Elastic)
|
||||||
{
|
{
|
||||||
if (dir == Ease::In)
|
if (mDir == Ease::In)
|
||||||
value = mEaseInElastic(t,b, c, d, param[0], param[1]);
|
value = mEaseInElastic(t,b, c, d, mParam[0], mParam[1]);
|
||||||
else if (dir == Ease::Out)
|
else if (mDir == Ease::Out)
|
||||||
value = mEaseOutElastic(t,b, c, d, param[0], param[1]);
|
value = mEaseOutElastic(t,b, c, d, mParam[0], mParam[1]);
|
||||||
else if (dir == Ease::InOut)
|
else if (mDir == Ease::InOut)
|
||||||
value = mEaseInOutElastic(t,b, c, d, param[0], param[1]);
|
value = mEaseInOutElastic(t,b, c, d, mParam[0], mParam[1]);
|
||||||
}
|
}
|
||||||
else if (type == Ease::Back)
|
else if (mType == Ease::Back)
|
||||||
{
|
{
|
||||||
if (dir == Ease::In)
|
if (mDir == Ease::In)
|
||||||
value = mEaseInBack(t,b, c, d, param[0]);
|
value = mEaseInBack(t,b, c, d, mParam[0]);
|
||||||
else if (dir == Ease::Out)
|
else if (mDir == Ease::Out)
|
||||||
value = mEaseOutBack(t,b, c, d, param[0]);
|
value = mEaseOutBack(t,b, c, d, mParam[0]);
|
||||||
else if (dir == Ease::InOut)
|
else if (mDir == Ease::InOut)
|
||||||
value = mEaseInOutBack(t,b, c, d, param[0]);
|
value = mEaseInOutBack(t,b, c, d, mParam[0]);
|
||||||
}
|
}
|
||||||
else if (type == Ease::Bounce)
|
else if (mType == Ease::Bounce)
|
||||||
{
|
{
|
||||||
if (dir == Ease::In)
|
if (mDir == Ease::In)
|
||||||
value = mEaseInBounce(t,b, c, d);
|
value = mEaseInBounce(t,b, c, d);
|
||||||
else if (dir == Ease::Out)
|
else if (mDir == Ease::Out)
|
||||||
value = mEaseOutBounce(t,b, c, d);
|
value = mEaseOutBounce(t,b, c, d);
|
||||||
else if (dir == Ease::InOut)
|
else if (mDir == Ease::InOut)
|
||||||
value = mEaseInOutBounce(t,b, c, d);
|
value = mEaseInOutBounce(t,b, c, d);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,9 @@ class EaseF : public Ease
|
||||||
{
|
{
|
||||||
//-------------------------------------- Public data
|
//-------------------------------------- Public data
|
||||||
public:
|
public:
|
||||||
S32 dir; // inout, in, out
|
S32 mDir; // inout, in, out
|
||||||
S32 type; // linear, etc...
|
S32 mType; // linear, etc...
|
||||||
F32 param[2]; // optional params
|
F32 mParam[2]; // optional params
|
||||||
|
|
||||||
//-------------------------------------- Public interface
|
//-------------------------------------- Public interface
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -142,10 +142,10 @@ inline bool mathRead(Stream& stream, QuatF* q)
|
||||||
|
|
||||||
inline bool mathRead(Stream& stream, EaseF* e)
|
inline bool mathRead(Stream& stream, EaseF* e)
|
||||||
{
|
{
|
||||||
bool success = stream.read( &e->dir );
|
bool success = stream.read( &e->mDir );
|
||||||
success &= stream.read( &e->type );
|
success &= stream.read( &e->mType );
|
||||||
success &= stream.read( &e->param[ 0 ] );
|
success &= stream.read( &e->mParam[ 0 ] );
|
||||||
success &= stream.read( &e->param[ 1 ] );
|
success &= stream.read( &e->mParam[ 1 ] );
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,10 +270,10 @@ inline bool mathWrite(Stream& stream, const QuatF& q)
|
||||||
|
|
||||||
inline bool mathWrite(Stream& stream, const EaseF& e)
|
inline bool mathWrite(Stream& stream, const EaseF& e)
|
||||||
{
|
{
|
||||||
bool success = stream.write(e.dir);
|
bool success = stream.write(e.mDir);
|
||||||
success &= stream.write(e.type);
|
success &= stream.write(e.mType);
|
||||||
success &= stream.write(e.param[0]);
|
success &= stream.write(e.mParam[0]);
|
||||||
success &= stream.write(e.param[1]);
|
success &= stream.write(e.mParam[1]);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -557,7 +557,7 @@ ConsoleGetType( TypeEaseF )
|
||||||
static const U32 bufSize = 256;
|
static const U32 bufSize = 256;
|
||||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||||
dSprintf(returnBuffer, bufSize, "%d %d %g %g",
|
dSprintf(returnBuffer, bufSize, "%d %d %g %g",
|
||||||
pEase->dir, pEase->type, pEase->param[0], pEase->param[1]);
|
pEase->mDir, pEase->mType, pEase->mParam[0], pEase->mParam[1]);
|
||||||
|
|
||||||
return returnBuffer;
|
return returnBuffer;
|
||||||
}
|
}
|
||||||
|
|
@ -567,11 +567,11 @@ ConsoleSetType( TypeEaseF )
|
||||||
EaseF* pDst = (EaseF*)dptr;
|
EaseF* pDst = (EaseF*)dptr;
|
||||||
|
|
||||||
// defaults...
|
// defaults...
|
||||||
pDst->param[0] = -1.0f;
|
pDst->mParam[0] = -1.0f;
|
||||||
pDst->param[1] = -1.0f;
|
pDst->mParam[1] = -1.0f;
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
U32 args = dSscanf(argv[0], "%d %d %f %f", // the two params are optional and assumed -1 if not present...
|
U32 args = dSscanf(argv[0], "%d %d %f %f", // the two params are optional and assumed -1 if not present...
|
||||||
&pDst->dir, &pDst->type, &pDst->param[0],&pDst->param[1]);
|
&pDst->mDir, &pDst->mType, &pDst->mParam[0],&pDst->mParam[1]);
|
||||||
if( args < 2 )
|
if( args < 2 )
|
||||||
Con::warnf( "Warning, EaseF probably not read properly" );
|
Con::warnf( "Warning, EaseF probably not read properly" );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue