mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
Merge pull request #1728 from Azaezel/alpha41/easyNow
adds a pathshape useEase value.-on by default.
This commit is contained in:
commit
dbfd4d322c
4 changed files with 15 additions and 10 deletions
|
|
@ -71,6 +71,7 @@ CameraSpline::CameraSpline()
|
||||||
mFront = NULL;
|
mFront = NULL;
|
||||||
mSize = 0;
|
mSize = 0;
|
||||||
mIsMapDirty = true;
|
mIsMapDirty = true;
|
||||||
|
mUseEase = true;
|
||||||
VECTOR_SET_ASSOCIATION(mTimeMap);
|
VECTOR_SET_ASSOCIATION(mTimeMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,7 +297,7 @@ F32 CameraSpline::getTime(F32 d)
|
||||||
void CameraSpline::value(F32 t, CameraSpline::Knot *result, bool skip_rotation)
|
void CameraSpline::value(F32 t, CameraSpline::Knot *result, bool skip_rotation)
|
||||||
{
|
{
|
||||||
// Do some easing in and out for t.
|
// Do some easing in and out for t.
|
||||||
if(!gBuilding)
|
if(!gBuilding && mUseEase)
|
||||||
{
|
{
|
||||||
F32 oldT = t;
|
F32 oldT = t;
|
||||||
if(oldT < 0.5f)
|
if(oldT < 0.5f)
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,8 @@ public:
|
||||||
void push_front(Knot *w) { push_back(w); mFront = w; mIsMapDirty = true; }
|
void push_front(Knot *w) { push_back(w); mFront = w; mIsMapDirty = true; }
|
||||||
|
|
||||||
Knot* getKnot(S32 i);
|
Knot* getKnot(S32 i);
|
||||||
Knot* next(Knot *k) { return (k && k->next == mFront) ? k : k->next; }
|
Knot* next(Knot *k) { return (k && k->next != mFront) ? k->next : mFront; }
|
||||||
Knot* prev(Knot *k) { return (k && k == mFront) ? k : k->prev; }
|
Knot* prev(Knot *k) { return (k && k->prev != mFront) ? k->prev : mFront; }
|
||||||
|
|
||||||
F32 advanceTime(F32 t, S32 delta_ms);
|
F32 advanceTime(F32 t, S32 delta_ms);
|
||||||
F32 advanceDist(F32 t, F32 meters);
|
F32 advanceDist(F32 t, F32 meters);
|
||||||
|
|
@ -85,7 +85,7 @@ public:
|
||||||
|
|
||||||
F32 getDistance(F32 t);
|
F32 getDistance(F32 t);
|
||||||
F32 getTime(F32 d);
|
F32 getTime(F32 d);
|
||||||
|
void useEase(bool ease = true) { mUseEase = ease; }
|
||||||
void renderTimeMap();
|
void renderTimeMap();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -93,7 +93,7 @@ private:
|
||||||
Knot *mFront;
|
Knot *mFront;
|
||||||
S32 mSize;
|
S32 mSize;
|
||||||
bool mIsMapDirty;
|
bool mIsMapDirty;
|
||||||
|
bool mUseEase;
|
||||||
struct TimeMap {
|
struct TimeMap {
|
||||||
F32 mTime;
|
F32 mTime;
|
||||||
F32 mDistance;
|
F32 mDistance;
|
||||||
|
|
@ -106,4 +106,4 @@ private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -46,16 +46,20 @@ void PathShapeData::initPersistFields()
|
||||||
{
|
{
|
||||||
docsURL;
|
docsURL;
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
|
addField("useEase", TypeBool, Offset(mUseEase, PathShapeData), "Whether to use ease in and out when moving along the path.\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathShapeData::packData(BitStream* stream)
|
void PathShapeData::packData(BitStream* stream)
|
||||||
{
|
{
|
||||||
Parent::packData(stream);
|
Parent::packData(stream);
|
||||||
|
stream->writeFlag(mUseEase);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathShapeData::unpackData(BitStream* stream)
|
void PathShapeData::unpackData(BitStream* stream)
|
||||||
{
|
{
|
||||||
Parent::unpackData(stream);
|
Parent::unpackData(stream);
|
||||||
|
mUseEase = stream->readFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -109,7 +113,7 @@ bool PathShape::onAdd()
|
||||||
CameraSpline::Knot::NORMAL, CameraSpline::Knot::SPLINE));
|
CameraSpline::Knot::NORMAL, CameraSpline::Knot::SPLINE));
|
||||||
mNodeCount = 1;
|
mNodeCount = 1;
|
||||||
}
|
}
|
||||||
|
mSpline.useEase(mDataBlock->mUseEase);
|
||||||
if (isServerObject()) scriptOnAdd();
|
if (isServerObject()) scriptOnAdd();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -135,6 +139,7 @@ bool PathShape::onNewDataBlock(GameBaseData* dptr, bool reload)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
scriptOnNewDataBlock(reload);
|
scriptOnNewDataBlock(reload);
|
||||||
|
mSpline.useEase(mDataBlock->mUseEase);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -152,9 +157,7 @@ void PathShape::initPersistFields()
|
||||||
addField( "Path", TYPEID< SimObjectRef<SimPath::Path> >(), Offset( mSimPath, PathShape ),
|
addField( "Path", TYPEID< SimObjectRef<SimPath::Path> >(), Offset( mSimPath, PathShape ),
|
||||||
"@brief Name of a Path to follow." );
|
"@brief Name of a Path to follow." );
|
||||||
|
|
||||||
addField("Controler", TypeString, Offset(mControl, PathShape), 4, "controlers");
|
addField("Controler", TypeString, Offset(mControl, PathShape), 4, "controlers"); Parent::initPersistFields();
|
||||||
|
|
||||||
Parent::initPersistFields();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ struct PathShapeData: public StaticShapeData {
|
||||||
static void initPersistFields();
|
static void initPersistFields();
|
||||||
void packData(BitStream* stream) override;
|
void packData(BitStream* stream) override;
|
||||||
void unpackData(BitStream* stream) override;
|
void unpackData(BitStream* stream) override;
|
||||||
|
bool mUseEase;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue