mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Eliminate hsScalar and hsFixed
Modern CPUs support floats just fine... hsFixed was crazy.
This commit is contained in:
@ -949,9 +949,9 @@ hsBool pfObjectFlocker::MsgReceive(plMessage* msg)
|
||||
plKey newKey = cloneMsg->GetCloneKey();
|
||||
cloneMsg->Send();
|
||||
|
||||
hsScalar xAdjust = (2 * RAND()) - 1; // produces a random number between -1 and 1
|
||||
hsScalar yAdjust = (2 * RAND()) - 1;
|
||||
hsScalar zAdjust = (2 * RAND()) - 1;
|
||||
float xAdjust = (2 * RAND()) - 1; // produces a random number between -1 and 1
|
||||
float yAdjust = (2 * RAND()) - 1;
|
||||
float zAdjust = (2 * RAND()) - 1;
|
||||
hsPoint3 boidPos(pos.fX + xAdjust, pos.fY + yAdjust, pos.fZ + zAdjust);
|
||||
fFlock.AddBoid(this, newKey, boidPos);
|
||||
}
|
||||
@ -979,7 +979,7 @@ hsBool pfObjectFlocker::MsgReceive(plMessage* msg)
|
||||
return plSingleModifier::MsgReceive(msg);
|
||||
}
|
||||
|
||||
hsBool pfObjectFlocker::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
hsBool pfObjectFlocker::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
fFlock.Update(fTarget, del);
|
||||
|
||||
|
@ -448,7 +448,7 @@ protected:
|
||||
hsBool fUseTargetRotation;
|
||||
hsBool fRandomizeAnimationStart;
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -51,13 +51,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
plRandom plBlower::fRandom;
|
||||
|
||||
static const hsScalar kDefaultMasterPower = 20.f;
|
||||
static const hsScalar kDefaultMasterFrequency = 2.f;
|
||||
static const hsScalar kDefaultDirectRate = 1.f;
|
||||
static const hsScalar kDefaultImpulseRate = 1.e2f;
|
||||
static const hsScalar kDefaultSpringKonst = 20.f;
|
||||
static const hsScalar kDefaultBias = 0.25f;
|
||||
static const hsScalar kInitialMaxOffDist = 1.f;
|
||||
static const float kDefaultMasterPower = 20.f;
|
||||
static const float kDefaultMasterFrequency = 2.f;
|
||||
static const float kDefaultDirectRate = 1.f;
|
||||
static const float kDefaultImpulseRate = 1.e2f;
|
||||
static const float kDefaultSpringKonst = 20.f;
|
||||
static const float kDefaultBias = 0.25f;
|
||||
static const float kInitialMaxOffDist = 1.f;
|
||||
|
||||
plBlower::plBlower()
|
||||
:
|
||||
@ -82,7 +82,7 @@ plBlower::~plBlower()
|
||||
{
|
||||
}
|
||||
|
||||
void plBlower::IBlow(double secs, hsScalar delSecs)
|
||||
void plBlower::IBlow(double secs, float delSecs)
|
||||
{
|
||||
hsPoint3 worldPos = fTarget->GetLocalToWorld().GetTranslate();
|
||||
hsPoint3 localPos = fTarget->GetLocalToParent().GetTranslate();
|
||||
@ -93,13 +93,13 @@ void plBlower::IBlow(double secs, hsScalar delSecs)
|
||||
|
||||
// Strength = Strength + rnd01 * (MaxStrength - Strength)
|
||||
|
||||
hsScalar t = (fAccumTime += delSecs);
|
||||
float t = (fAccumTime += delSecs);
|
||||
|
||||
hsScalar strength = 0;
|
||||
float strength = 0;
|
||||
int i;
|
||||
for( i = 0; i < fOscillators.GetCount(); i++ )
|
||||
{
|
||||
hsScalar c, s;
|
||||
float c, s;
|
||||
t *= fOscillators[i].fFrequency * fMasterFrequency;
|
||||
t += fOscillators[i].fPhase;
|
||||
hsFastMath::SinCosAppr(t, s, c);
|
||||
@ -116,25 +116,25 @@ void plBlower::IBlow(double secs, hsScalar delSecs)
|
||||
|
||||
hsFastMath::NormalizeAppr(fDirection);
|
||||
|
||||
hsScalar offDist = hsVector3(&fRestPos, &worldPos).Magnitude();
|
||||
float offDist = hsVector3(&fRestPos, &worldPos).Magnitude();
|
||||
if( offDist > fMaxOffsetDist )
|
||||
fMaxOffsetDist = offDist;
|
||||
|
||||
hsVector3 force = fDirection * strength;
|
||||
|
||||
static hsScalar kOffsetDistFrac = 0.5f; // make me const
|
||||
static float kOffsetDistFrac = 0.5f; // make me const
|
||||
if( offDist > fMaxOffsetDist * kOffsetDistFrac )
|
||||
{
|
||||
offDist /= fMaxOffsetDist;
|
||||
offDist *= fMasterPower;
|
||||
|
||||
hsScalar impulse = offDist * delSecs * fImpulseRate;
|
||||
float impulse = offDist * delSecs * fImpulseRate;
|
||||
|
||||
force.fX += impulse * fRandom.RandMinusOneToOne();
|
||||
force.fY += impulse * fRandom.RandMinusOneToOne();
|
||||
force.fZ += impulse * fRandom.RandMinusOneToOne();
|
||||
}
|
||||
const hsScalar kOffsetDistDecay = 0.999f;
|
||||
const float kOffsetDistDecay = 0.999f;
|
||||
fMaxOffsetDist *= kOffsetDistDecay;
|
||||
|
||||
hsVector3 accel = force;
|
||||
@ -145,9 +145,9 @@ void plBlower::IBlow(double secs, hsScalar delSecs)
|
||||
fCurrDel = del;
|
||||
}
|
||||
|
||||
hsBool plBlower::IEval(double secs, hsScalar delSecs, uint32_t dirty)
|
||||
hsBool plBlower::IEval(double secs, float delSecs, uint32_t dirty)
|
||||
{
|
||||
const hsScalar kMaxDelSecs = 0.1f;
|
||||
const float kMaxDelSecs = 0.1f;
|
||||
if( delSecs > kMaxDelSecs )
|
||||
delSecs = kMaxDelSecs;
|
||||
IBlow(secs, delSecs);
|
||||
@ -212,20 +212,20 @@ void plBlower::Write(hsStream* s, hsResMgr* mgr)
|
||||
|
||||
void plBlower::IInitOscillators()
|
||||
{
|
||||
const hsScalar kBasePower = 5.f;
|
||||
const float kBasePower = 5.f;
|
||||
fOscillators.SetCount(5);
|
||||
int i;
|
||||
for( i = 0; i < fOscillators.GetCount(); i++ )
|
||||
{
|
||||
hsScalar fi = hsScalar(i+1);
|
||||
fOscillators[i].fFrequency = fi / hsScalarPI * fRandom.RandRangeF(0.75f, 1.25f);
|
||||
// fOscillators[i].fFrequency = 1.f / hsScalarPI * fRandom.RandRangeF(0.5f, 1.5f);
|
||||
float fi = float(i+1);
|
||||
fOscillators[i].fFrequency = fi / M_PI * fRandom.RandRangeF(0.75f, 1.25f);
|
||||
// fOscillators[i].fFrequency = 1.f / M_PI * fRandom.RandRangeF(0.5f, 1.5f);
|
||||
fOscillators[i].fPhase = fRandom.RandZeroToOne();
|
||||
fOscillators[i].fPower = kBasePower * fRandom.RandRangeF(0.75f, 1.25f);
|
||||
}
|
||||
}
|
||||
|
||||
void plBlower::SetConstancy(hsScalar f)
|
||||
void plBlower::SetConstancy(float f)
|
||||
{
|
||||
if( f < 0 )
|
||||
f = 0;
|
||||
@ -235,7 +235,7 @@ void plBlower::SetConstancy(hsScalar f)
|
||||
fBias = f;
|
||||
}
|
||||
|
||||
hsScalar plBlower::GetConstancy() const
|
||||
float plBlower::GetConstancy() const
|
||||
{
|
||||
return fBias;
|
||||
}
|
||||
|
@ -58,21 +58,21 @@ protected:
|
||||
class Oscillator
|
||||
{
|
||||
public:
|
||||
hsScalar fFrequency;
|
||||
hsScalar fPhase;
|
||||
hsScalar fPower;
|
||||
float fFrequency;
|
||||
float fPhase;
|
||||
float fPower;
|
||||
};
|
||||
static plRandom fRandom;
|
||||
|
||||
// Parameters
|
||||
hsScalar fMasterPower;
|
||||
hsScalar fMasterFrequency;
|
||||
hsScalar fDirectRate;
|
||||
hsScalar fImpulseRate;
|
||||
hsScalar fSpringKonst;
|
||||
hsScalar fBias;
|
||||
float fMasterPower;
|
||||
float fMasterFrequency;
|
||||
float fDirectRate;
|
||||
float fImpulseRate;
|
||||
float fSpringKonst;
|
||||
float fBias;
|
||||
|
||||
hsScalar fAccumTime;
|
||||
float fAccumTime;
|
||||
hsTArray<Oscillator> fOscillators;
|
||||
|
||||
// CurrentState
|
||||
@ -80,13 +80,13 @@ protected:
|
||||
hsPoint3 fRestPos;
|
||||
hsPoint3 fLocalRestPos;
|
||||
hsVector3 fCurrDel;
|
||||
hsScalar fMaxOffsetDist;
|
||||
float fMaxOffsetDist;
|
||||
|
||||
void IInitOscillators();
|
||||
void ISetTargetTransform();
|
||||
void IBlow(double secs, hsScalar delSecs);
|
||||
void IBlow(double secs, float delSecs);
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
public:
|
||||
~plBlower();
|
||||
plBlower();
|
||||
@ -99,19 +99,19 @@ public:
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
void SetMasterPower(hsScalar f) { fMasterPower = f; }
|
||||
void SetMasterFrequency(hsScalar f) { fMasterFrequency = f; }
|
||||
void SetDirectRate(hsScalar f) { fDirectRate = f; }
|
||||
void SetImpulseRate(hsScalar f) { fImpulseRate = f; }
|
||||
void SetSpringKonst(hsScalar f) { fSpringKonst = f; }
|
||||
void SetConstancy(hsScalar f);
|
||||
void SetMasterPower(float f) { fMasterPower = f; }
|
||||
void SetMasterFrequency(float f) { fMasterFrequency = f; }
|
||||
void SetDirectRate(float f) { fDirectRate = f; }
|
||||
void SetImpulseRate(float f) { fImpulseRate = f; }
|
||||
void SetSpringKonst(float f) { fSpringKonst = f; }
|
||||
void SetConstancy(float f);
|
||||
|
||||
hsScalar GetMasterPower() const { return fMasterPower; }
|
||||
hsScalar GetMasterFrequency() const { return fMasterFrequency; }
|
||||
hsScalar GetDirectRate() const { return fDirectRate; }
|
||||
hsScalar GetImpulseRate() const { return fImpulseRate; }
|
||||
hsScalar GetSpringKonst() const { return fSpringKonst; }
|
||||
hsScalar GetConstancy() const;
|
||||
float GetMasterPower() const { return fMasterPower; }
|
||||
float GetMasterFrequency() const { return fMasterFrequency; }
|
||||
float GetDirectRate() const { return fDirectRate; }
|
||||
float GetImpulseRate() const { return fImpulseRate; }
|
||||
float GetSpringKonst() const { return fSpringKonst; }
|
||||
float GetConstancy() const;
|
||||
};
|
||||
|
||||
#endif // plBlower_inc
|
||||
|
@ -50,7 +50,7 @@ static hsMatrix44* InvTRS(const hsMatrix44& trs, hsMatrix44& inv)
|
||||
{
|
||||
inv.NotIdentity();
|
||||
|
||||
hsScalar invSSq[3];
|
||||
float invSSq[3];
|
||||
invSSq[0] = 1.f / (trs.fMap[0][0] * trs.fMap[0][0] + trs.fMap[1][0] * trs.fMap[1][0] + trs.fMap[2][0] * trs.fMap[2][0]);
|
||||
invSSq[1] = 1.f / (trs.fMap[0][1] * trs.fMap[0][1] + trs.fMap[1][1] * trs.fMap[1][1] + trs.fMap[2][1] * trs.fMap[2][1]);
|
||||
invSSq[2] = 1.f / (trs.fMap[0][2] * trs.fMap[0][2] + trs.fMap[1][2] * trs.fMap[1][2] + trs.fMap[2][2] * trs.fMap[2][2]);
|
||||
|
@ -218,7 +218,7 @@ void plFollowMod::IMoveTarget()
|
||||
GetTarget()->SetTransform(l2w, w2l);
|
||||
}
|
||||
|
||||
hsBool plFollowMod::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
hsBool plFollowMod::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
if( ICheckLeader() )
|
||||
IMoveTarget();
|
||||
|
@ -87,7 +87,7 @@ protected:
|
||||
hsBool ICheckLeader();
|
||||
void IMoveTarget();
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
|
||||
public:
|
||||
plFollowMod();
|
||||
|
@ -141,7 +141,7 @@ void plLightModifier::IApplyDynamic()
|
||||
|
||||
void plLightModifier::DefaultAnimation()
|
||||
{
|
||||
hsScalar len = MaxAnimLength(0);
|
||||
float len = MaxAnimLength(0);
|
||||
fTimeConvert.SetBegin(0);
|
||||
fTimeConvert.SetEnd(len);
|
||||
fTimeConvert.SetLoopPoints(0, len);
|
||||
@ -149,7 +149,7 @@ void plLightModifier::DefaultAnimation()
|
||||
fTimeConvert.Start();
|
||||
}
|
||||
|
||||
hsScalar plLightModifier::MaxAnimLength(hsScalar len) const
|
||||
float plLightModifier::MaxAnimLength(float len) const
|
||||
{
|
||||
if( fColorCtl && (fColorCtl->GetLength() > len) )
|
||||
len = fColorCtl->GetLength();
|
||||
@ -229,7 +229,7 @@ void plOmniModifier::IApplyDynamic()
|
||||
}
|
||||
}
|
||||
|
||||
hsScalar plOmniModifier::MaxAnimLength(hsScalar len) const
|
||||
float plOmniModifier::MaxAnimLength(float len) const
|
||||
{
|
||||
len = plLightModifier::MaxAnimLength(len);
|
||||
if( fAttenCtl && (fAttenCtl->GetLength() > len) )
|
||||
@ -302,20 +302,20 @@ void plSpotModifier::IApplyDynamic()
|
||||
{
|
||||
plOmniModifier::IApplyDynamic();
|
||||
|
||||
hsScalar f;
|
||||
float f;
|
||||
if( fInnerCtl )
|
||||
{
|
||||
fInnerCtl->Interp(fCurrentTime, &f);
|
||||
fSpot->SetSpotInner(hsScalarDegToRad(f)*0.5f);
|
||||
fSpot->SetSpotInner(hsDegreesToRadians(f)*0.5f);
|
||||
}
|
||||
if( fOuterCtl )
|
||||
{
|
||||
fOuterCtl->Interp(fCurrentTime, &f);
|
||||
fSpot->SetSpotOuter(hsScalarDegToRad(f)*0.5f);
|
||||
fSpot->SetSpotOuter(hsDegreesToRadians(f)*0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
hsScalar plSpotModifier::MaxAnimLength(hsScalar len) const
|
||||
float plSpotModifier::MaxAnimLength(float len) const
|
||||
{
|
||||
len = plOmniModifier::MaxAnimLength(len);
|
||||
if( fInnerCtl && (fInnerCtl->GetLength() > len) )
|
||||
@ -397,7 +397,7 @@ void plLtdDirModifier::IApplyDynamic()
|
||||
{
|
||||
plLightModifier::IApplyDynamic();
|
||||
|
||||
hsScalar f;
|
||||
float f;
|
||||
if( fWidthCtl )
|
||||
{
|
||||
fWidthCtl->Interp(fCurrentTime, &f);
|
||||
@ -415,7 +415,7 @@ void plLtdDirModifier::IApplyDynamic()
|
||||
}
|
||||
}
|
||||
|
||||
hsScalar plLtdDirModifier::MaxAnimLength(hsScalar len) const
|
||||
float plLtdDirModifier::MaxAnimLength(float len) const
|
||||
{
|
||||
len = plLightModifier::MaxAnimLength(len);
|
||||
if( fWidthCtl && (fWidthCtl->GetLength() > len) )
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
void SetSpecularCtl(plController* ctl) { fSpecularCtl = ctl; }
|
||||
|
||||
virtual void DefaultAnimation();
|
||||
virtual hsScalar MaxAnimLength(hsScalar len) const;
|
||||
virtual float MaxAnimLength(float len) const;
|
||||
};
|
||||
|
||||
class plOmniModifier : public plLightModifier
|
||||
@ -121,7 +121,7 @@ public:
|
||||
void SetAttenCtl(plController* ctl) { fAttenCtl = ctl; }
|
||||
void SetInitAtten(const hsPoint3& p) { fInitAtten = p; }
|
||||
|
||||
virtual hsScalar MaxAnimLength(hsScalar len) const;
|
||||
virtual float MaxAnimLength(float len) const;
|
||||
};
|
||||
|
||||
class plSpotModifier : public plOmniModifier
|
||||
@ -155,7 +155,7 @@ public:
|
||||
void SetInnerCtl(plController* ctl) { fInnerCtl = ctl; }
|
||||
void SetOuterCtl(plController* ctl) { fOuterCtl = ctl; }
|
||||
|
||||
virtual hsScalar MaxAnimLength(hsScalar len) const;
|
||||
virtual float MaxAnimLength(float len) const;
|
||||
};
|
||||
|
||||
class plLtdDirModifier : public plLightModifier
|
||||
@ -191,7 +191,7 @@ public:
|
||||
void SetHeightCtl(plController* ctl) { fHeightCtl = ctl; }
|
||||
void SetDepthCtl(plController* ctl) { fDepthCtl = ctl; }
|
||||
|
||||
virtual hsScalar MaxAnimLength(hsScalar len) const;
|
||||
virtual float MaxAnimLength(float len) const;
|
||||
};
|
||||
|
||||
#endif // plLightModifier_inc
|
||||
|
@ -79,7 +79,7 @@ plLineFollowMod::~plLineFollowMod()
|
||||
delete fPath;
|
||||
}
|
||||
|
||||
void plLineFollowMod::SetSpeedClamp(hsScalar fps)
|
||||
void plLineFollowMod::SetSpeedClamp(float fps)
|
||||
{
|
||||
fSpeedClamp = fps;
|
||||
if( fSpeedClamp > 0 )
|
||||
@ -93,7 +93,7 @@ void plLineFollowMod::SetSpeedClamp(hsScalar fps)
|
||||
|
||||
}
|
||||
|
||||
void plLineFollowMod::SetOffsetFeet(hsScalar f)
|
||||
void plLineFollowMod::SetOffsetFeet(float f)
|
||||
{
|
||||
fOffset = f;
|
||||
if( fOffset != 0 )
|
||||
@ -115,9 +115,9 @@ void plLineFollowMod::SetForceToLine(hsBool on)
|
||||
fFollowFlags &= ~kForceToLine;
|
||||
}
|
||||
|
||||
void plLineFollowMod::SetOffsetDegrees(hsScalar f)
|
||||
void plLineFollowMod::SetOffsetDegrees(float f)
|
||||
{
|
||||
fOffset = hsScalarDegToRad(f);
|
||||
fOffset = hsDegreesToRadians(f);
|
||||
if( fOffset != 0 )
|
||||
{
|
||||
fFollowFlags &= ~kOffsetFeet;
|
||||
@ -130,7 +130,7 @@ void plLineFollowMod::SetOffsetDegrees(hsScalar f)
|
||||
}
|
||||
}
|
||||
|
||||
void plLineFollowMod::SetOffsetClamp(hsScalar f)
|
||||
void plLineFollowMod::SetOffsetClamp(float f)
|
||||
{
|
||||
fOffsetClamp = f;
|
||||
if( fOffsetClamp > 0 )
|
||||
@ -337,7 +337,7 @@ void plLineFollowMod::IRegister()
|
||||
}
|
||||
}
|
||||
|
||||
hsBool plLineFollowMod::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
hsBool plLineFollowMod::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
if( !fPath )
|
||||
return false;
|
||||
@ -366,7 +366,7 @@ hsBool plLineFollowMod::IOffsetTargetTransform(hsMatrix44& tgtXfm)
|
||||
hsPoint3 tgtPos = tgtXfm.GetTranslate();
|
||||
|
||||
hsVector3 tgt2src(&fSearchPos, &tgtPos);
|
||||
hsScalar t2sLen = tgt2src.Magnitude();
|
||||
float t2sLen = tgt2src.Magnitude();
|
||||
hsFastMath::NormalizeAppr(tgt2src);
|
||||
|
||||
hsVector3 out;
|
||||
@ -374,7 +374,7 @@ hsBool plLineFollowMod::IOffsetTargetTransform(hsMatrix44& tgtXfm)
|
||||
|
||||
if( fFollowFlags & kOffsetAng )
|
||||
{
|
||||
hsScalar del = t2sLen * fTanOffset;
|
||||
float del = t2sLen * fTanOffset;
|
||||
if( fFollowFlags & kOffsetClamp )
|
||||
{
|
||||
if( del > fOffsetClamp )
|
||||
@ -409,7 +409,7 @@ hsBool plLineFollowMod::IOffsetTargetTransform(hsMatrix44& tgtXfm)
|
||||
|
||||
hsBool plLineFollowMod::IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm)
|
||||
{
|
||||
hsScalar t = fPath->GetExtremePoint(searchPos);
|
||||
float t = fPath->GetExtremePoint(searchPos);
|
||||
if( fFollowFlags & kFullMatrix )
|
||||
{
|
||||
fPath->SetCurTime(t, plAnimPath::kNone);
|
||||
@ -441,12 +441,12 @@ void plLineFollowMod::ICheckForPop(const hsPoint3& oldPos, const hsPoint3& newPo
|
||||
{
|
||||
hsVector3 del(&oldPos, &newPos);
|
||||
|
||||
hsScalar elapsed = hsTimer::GetDelSysSeconds();
|
||||
hsScalar speedSq = 0.f;
|
||||
float elapsed = hsTimer::GetDelSysSeconds();
|
||||
float speedSq = 0.f;
|
||||
if (elapsed > 0.f)
|
||||
speedSq = del.MagnitudeSquared() / elapsed;
|
||||
|
||||
const hsScalar kMaxSpeedSq = 30.f * 30.f; // (feet per sec)^2
|
||||
const float kMaxSpeedSq = 30.f * 30.f; // (feet per sec)^2
|
||||
if( speedSq > kMaxSpeedSq )
|
||||
fFollowFlags |= kSearchPosPop;
|
||||
else
|
||||
@ -497,7 +497,7 @@ hsBool plLineFollowMod::IGetSearchPos()
|
||||
return true;
|
||||
}
|
||||
|
||||
hsMatrix44 plLineFollowMod::IInterpMatrices(const hsMatrix44& m0, const hsMatrix44& m1, hsScalar parm)
|
||||
hsMatrix44 plLineFollowMod::IInterpMatrices(const hsMatrix44& m0, const hsMatrix44& m1, float parm)
|
||||
{
|
||||
hsMatrix44 retVal;
|
||||
int i, j;
|
||||
@ -524,14 +524,14 @@ hsMatrix44 plLineFollowMod::ISpeedClamp(plCoordinateInterface* ci, const hsMatri
|
||||
const hsPoint3 oldPos = currL2W.GetTranslate();
|
||||
const hsPoint3 newPos = unclTgtXfm.GetTranslate();
|
||||
const hsVector3 del(&newPos, &oldPos);
|
||||
hsScalar elapsed = hsTimer::GetDelSysSeconds();
|
||||
hsScalar speed = 0.f;
|
||||
float elapsed = hsTimer::GetDelSysSeconds();
|
||||
float speed = 0.f;
|
||||
if (elapsed > 0.f)
|
||||
speed = del.Magnitude() / elapsed;
|
||||
|
||||
if( speed > fSpeedClamp )
|
||||
{
|
||||
hsScalar parm = fSpeedClamp / speed;
|
||||
float parm = fSpeedClamp / speed;
|
||||
|
||||
hsMatrix44 clTgtXfm = IInterpMatrices(currL2W, unclTgtXfm, parm);
|
||||
|
||||
@ -658,9 +658,9 @@ hsBool plRailCameraMod::IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tg
|
||||
return true;
|
||||
}
|
||||
|
||||
hsPoint3 plRailCameraMod::GetGoal(double secs, hsScalar speed)
|
||||
hsPoint3 plRailCameraMod::GetGoal(double secs, float speed)
|
||||
{
|
||||
hsScalar delTime;
|
||||
float delTime;
|
||||
int dir;
|
||||
if (fTargetTime == fCurrentTime)
|
||||
return fGoal;
|
||||
@ -681,7 +681,7 @@ hsPoint3 plRailCameraMod::GetGoal(double secs, hsScalar speed)
|
||||
if (delTime <= (secs * speed))
|
||||
fCurrentTime = fTargetTime;
|
||||
else
|
||||
fCurrentTime += (hsScalar)((secs * speed) * dir);
|
||||
fCurrentTime += (float)((secs * speed) * dir);
|
||||
|
||||
if (fPath->GetWrap())
|
||||
{
|
||||
|
@ -92,12 +92,12 @@ protected:
|
||||
|
||||
hsTArray<plStereizer*> fStereizers;
|
||||
|
||||
hsScalar fTanOffset;
|
||||
hsScalar fOffset;
|
||||
hsScalar fOffsetClamp;
|
||||
hsScalar fSpeedClamp;
|
||||
float fTanOffset;
|
||||
float fOffset;
|
||||
float fOffsetClamp;
|
||||
float fSpeedClamp;
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
|
||||
virtual hsBool IGetSearchPos();
|
||||
virtual void ISetTargetTransform(int iTarg, const hsMatrix44& tgtXfm);
|
||||
@ -106,7 +106,7 @@ protected:
|
||||
virtual hsBool IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm);
|
||||
virtual hsBool IOffsetTargetTransform(hsMatrix44& tgtXfm);
|
||||
virtual hsMatrix44 ISpeedClamp(plCoordinateInterface* ci, const hsMatrix44& unclTgtXfm);
|
||||
hsMatrix44 IInterpMatrices(const hsMatrix44& m0, const hsMatrix44& m1, hsScalar parm);
|
||||
hsMatrix44 IInterpMatrices(const hsMatrix44& m0, const hsMatrix44& m1, float parm);
|
||||
void ICheckForPop(const hsPoint3& oldPos, const hsPoint3& newPos);
|
||||
|
||||
void ISetupStereizers(const plListenerMsg* listMsg);
|
||||
@ -138,20 +138,20 @@ public:
|
||||
hsBool HasOffsetClamp() const { return 0 != (fFollowFlags & kOffsetClamp); }
|
||||
hsBool HasSpeedClamp() const { return 0 != (fFollowFlags & kSpeedClamp); }
|
||||
|
||||
void SetOffsetFeet(hsScalar f);
|
||||
hsScalar GetOffsetFeet() const { return fOffset; }
|
||||
void SetOffsetFeet(float f);
|
||||
float GetOffsetFeet() const { return fOffset; }
|
||||
|
||||
void SetOffsetDegrees(hsScalar f);
|
||||
hsScalar GetOffsetDegrees() const { return hsScalarRadToDeg(fOffset); }
|
||||
void SetOffsetDegrees(float f);
|
||||
float GetOffsetDegrees() const { return hsRadiansToDegrees(fOffset); }
|
||||
|
||||
void SetOffsetClamp(hsScalar f);
|
||||
hsScalar GetOffsetClamp() const { return fOffsetClamp; }
|
||||
void SetOffsetClamp(float f);
|
||||
float GetOffsetClamp() const { return fOffsetClamp; }
|
||||
|
||||
void SetForceToLine(hsBool on);
|
||||
hsBool GetForceToLine() const { return 0 != (fFollowFlags & kForceToLine); }
|
||||
|
||||
void SetSpeedClamp(hsScalar feetPerSec);
|
||||
hsScalar GetSpeedClamp() const { return fSpeedClamp; }
|
||||
void SetSpeedClamp(float feetPerSec);
|
||||
float GetSpeedClamp() const { return fSpeedClamp; }
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
@ -175,7 +175,7 @@ public:
|
||||
GETINTERFACE_ANY( plRailCameraMod, plLineFollowMod );
|
||||
|
||||
void Init() { fCurrentTime = -1; } // twiddle ourselves so we get ready to go...
|
||||
hsPoint3 GetGoal(double secs, hsScalar speed);
|
||||
hsPoint3 GetGoal(double secs, float speed);
|
||||
|
||||
protected:
|
||||
|
||||
@ -183,8 +183,8 @@ protected:
|
||||
virtual hsBool IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm);
|
||||
|
||||
hsMatrix44 fDesiredMatrix;
|
||||
hsScalar fCurrentTime;
|
||||
hsScalar fTargetTime;
|
||||
float fCurrentTime;
|
||||
float fTargetTime;
|
||||
hsPoint3 fGoal;
|
||||
hsBool fFarthest;
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsTimer.h"
|
||||
#include "hsUtils.h"
|
||||
|
||||
static const hsScalar kRandNormalize = 1.f / 32767.f;
|
||||
static const float kRandNormalize = 1.f / 32767.f;
|
||||
|
||||
plRandomCommandMod::plRandomCommandMod()
|
||||
{
|
||||
@ -126,11 +126,11 @@ int plRandomCommandMod::IExcludeSelections(int ncmds)
|
||||
return ncmds;
|
||||
}
|
||||
|
||||
hsScalar plRandomCommandMod::IGetDelay(hsScalar len) const
|
||||
float plRandomCommandMod::IGetDelay(float len) const
|
||||
{
|
||||
hsScalar r = float(hsRand() * kRandNormalize);
|
||||
float r = float(hsRand() * kRandNormalize);
|
||||
|
||||
hsScalar delay = fMinDelay + (fMaxDelay - fMinDelay) * r;
|
||||
float delay = fMinDelay + (fMaxDelay - fMinDelay) * r;
|
||||
|
||||
if( fMode & kDelayFromEnd )
|
||||
delay += len;
|
||||
@ -156,7 +156,7 @@ hsBool plRandomCommandMod::ISelectNext(int ncmds)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
hsScalar r = float(hsRand() * kRandNormalize);
|
||||
float r = float(hsRand() * kRandNormalize);
|
||||
|
||||
int nSelect = ncmds;
|
||||
|
||||
@ -294,7 +294,7 @@ void plRandomCommandMod::Write(hsStream* s, hsResMgr* mgr)
|
||||
s->WriteLEScalar(fMaxDelay);
|
||||
}
|
||||
|
||||
void plRandomCommandMod::IRetry(hsScalar secs)
|
||||
void plRandomCommandMod::IRetry(float secs)
|
||||
{
|
||||
IStop();
|
||||
|
||||
|
@ -73,18 +73,18 @@ protected:
|
||||
uint8_t fMode; // static, if it becomes dynamic, move to SynchedValue
|
||||
hsTArray<double> fEndTimes;
|
||||
|
||||
hsScalar fMinDelay;
|
||||
hsScalar fMaxDelay;
|
||||
float fMinDelay;
|
||||
float fMaxDelay;
|
||||
|
||||
void IStart();
|
||||
virtual void IStop();
|
||||
hsBool IStopped() const;
|
||||
void IRetry(hsScalar secs);
|
||||
void IRetry(float secs);
|
||||
virtual void IPlayNextIfMaster();
|
||||
|
||||
void IReset();
|
||||
|
||||
hsScalar IGetDelay(hsScalar len) const;
|
||||
float IGetDelay(float len) const;
|
||||
|
||||
int IExcludeSelections(int ncmds);
|
||||
hsBool ISelectNext(int nAnim); // return false if we should stop, else set fCurrent to next index
|
||||
@ -94,7 +94,7 @@ protected:
|
||||
virtual void IPlayNext() = 0;
|
||||
|
||||
// We only act in response to messages.
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; }
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; }
|
||||
|
||||
public:
|
||||
plRandomCommandMod();
|
||||
@ -115,11 +115,11 @@ public:
|
||||
void SetState(uint8_t s) { fState = s; }
|
||||
uint8_t GetState() const { return fState; }
|
||||
|
||||
void SetMinDelay(hsScalar f) { fMinDelay = f; }
|
||||
hsScalar GetMinDelay() const { return fMinDelay; }
|
||||
void SetMinDelay(float f) { fMinDelay = f; }
|
||||
float GetMinDelay() const { return fMinDelay; }
|
||||
|
||||
void SetMaxDelay(hsScalar f) { fMaxDelay = f; }
|
||||
hsScalar GetMaxDelay() const { return fMaxDelay; }
|
||||
void SetMaxDelay(float f) { fMaxDelay = f; }
|
||||
float GetMaxDelay() const { return fMaxDelay; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -119,7 +119,7 @@ hsBool plStereizer::MsgReceive(plMessage* msg)
|
||||
return plSingleModifier::MsgReceive(msg);
|
||||
}
|
||||
|
||||
hsBool plStereizer::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
hsBool plStereizer::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -135,7 +135,7 @@ hsBool plStereizer::Stereize()
|
||||
// Find distance to listener
|
||||
hsPoint3 pos = IGetUnStereoPos();
|
||||
hsVector3 posToList(&fListPos, &pos);
|
||||
hsScalar dist = posToList.Magnitude();
|
||||
float dist = posToList.Magnitude();
|
||||
|
||||
// If distance less than ambient distance
|
||||
// setup as pure ambient
|
||||
@ -210,14 +210,14 @@ hsPoint3 plStereizer::IGetAmbientPos() const
|
||||
return pos;
|
||||
}
|
||||
|
||||
hsPoint3 plStereizer::IGetLocalizedPos(const hsVector3& posToList, hsScalar distToList) const
|
||||
hsPoint3 plStereizer::IGetLocalizedPos(const hsVector3& posToList, float distToList) const
|
||||
{
|
||||
hsPoint3 pos = IGetUnStereoPos();
|
||||
|
||||
hsVector3 axOut(-posToList.fY, posToList.fX, 0);
|
||||
hsFastMath::NormalizeAppr(axOut);
|
||||
|
||||
hsScalar distOut = distToList * fTanAng;
|
||||
float distOut = distToList * fTanAng;
|
||||
if( distOut > fMaxSepDist )
|
||||
distOut = fMaxSepDist;
|
||||
else if( distOut < fMinSepDist )
|
||||
@ -232,12 +232,12 @@ hsPoint3 plStereizer::IGetLocalizedPos(const hsVector3& posToList, hsScalar dist
|
||||
return pos;
|
||||
}
|
||||
|
||||
void plStereizer::SetSepAngle(hsScalar rads)
|
||||
void plStereizer::SetSepAngle(float rads)
|
||||
{
|
||||
fTanAng = hsScalar(tan(rads));
|
||||
fTanAng = float(tan(rads));
|
||||
}
|
||||
|
||||
hsScalar plStereizer::GetSepAngle() const
|
||||
float plStereizer::GetSepAngle() const
|
||||
{
|
||||
return atan(fTanAng);
|
||||
}
|
||||
|
@ -67,13 +67,13 @@ protected:
|
||||
};
|
||||
|
||||
// Static properties
|
||||
hsScalar fAmbientDist;
|
||||
hsScalar fTransition;
|
||||
float fAmbientDist;
|
||||
float fTransition;
|
||||
|
||||
hsScalar fMaxSepDist;
|
||||
hsScalar fMinSepDist;
|
||||
float fMaxSepDist;
|
||||
float fMinSepDist;
|
||||
|
||||
hsScalar fTanAng;
|
||||
float fTanAng;
|
||||
|
||||
hsPoint3 fInitPos;
|
||||
|
||||
@ -82,9 +82,9 @@ protected:
|
||||
hsVector3 fListDirection;
|
||||
hsVector3 fListUp;
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
|
||||
hsPoint3 IGetLocalizedPos(const hsVector3& posToList, hsScalar distToList) const;
|
||||
hsPoint3 IGetLocalizedPos(const hsVector3& posToList, float distToList) const;
|
||||
hsPoint3 IGetAmbientPos() const;
|
||||
void ISetNewPos(const hsPoint3& newPos);
|
||||
|
||||
@ -109,20 +109,20 @@ public:
|
||||
hsBool Stereize();
|
||||
void SetFromListenerMsg(const plListenerMsg* listMsg);
|
||||
|
||||
void SetAmbientDist(hsScalar d) { fAmbientDist = d; }
|
||||
hsScalar GetAmbientDist() const { return fAmbientDist; }
|
||||
void SetAmbientDist(float d) { fAmbientDist = d; }
|
||||
float GetAmbientDist() const { return fAmbientDist; }
|
||||
|
||||
void SetTransition(hsScalar d) { fTransition = d; }
|
||||
hsScalar GetTransition() const { return fTransition; }
|
||||
void SetTransition(float d) { fTransition = d; }
|
||||
float GetTransition() const { return fTransition; }
|
||||
|
||||
void SetMaxSepDist(hsScalar d) { fMaxSepDist = d; }
|
||||
hsScalar GetMaxSepDist() const { return fMaxSepDist; }
|
||||
void SetMaxSepDist(float d) { fMaxSepDist = d; }
|
||||
float GetMaxSepDist() const { return fMaxSepDist; }
|
||||
|
||||
void SetMinSepDist(hsScalar d) { fMinSepDist = d; }
|
||||
hsScalar GetMinSepDist() const { return fMinSepDist; }
|
||||
void SetMinSepDist(float d) { fMinSepDist = d; }
|
||||
float GetMinSepDist() const { return fMinSepDist; }
|
||||
|
||||
void SetSepAngle(hsScalar rads);
|
||||
hsScalar GetSepAngle() const;
|
||||
void SetSepAngle(float rads);
|
||||
float GetSepAngle() const;
|
||||
|
||||
void SetAsLeftChannel(hsBool on) { if(on)SetFlag(kLeftChannel); else ClearFlag(kLeftChannel); }
|
||||
hsBool IsLeftChannel() const { return HasFlag(kLeftChannel); }
|
||||
|
@ -129,7 +129,7 @@ void plViewFaceModifier::SetTarget(plSceneObject* so)
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plArmatureUpdateMsg::Index(), GetKey());
|
||||
}
|
||||
|
||||
hsBool plViewFaceModifier::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
hsBool plViewFaceModifier::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -157,7 +157,7 @@ hsBool plViewFaceModifier::IFacePoint(plPipeline* pipe, const hsPoint3& at)
|
||||
}
|
||||
|
||||
hsPoint3 localAt = worldToLocal * at;
|
||||
hsScalar len = localAt.MagnitudeSquared();
|
||||
float len = localAt.MagnitudeSquared();
|
||||
if( len <= 0 )
|
||||
return false;
|
||||
len = -hsFastMath::InvSqrtAppr(len);
|
||||
@ -220,7 +220,7 @@ hsBool plViewFaceModifier::IFacePoint(plPipeline* pipe, const hsPoint3& at)
|
||||
x.fMap[3][0] = x.fMap[3][1] = x.fMap[3][2] = 0;
|
||||
xInv.fMap[0][3] = xInv.fMap[1][3] = xInv.fMap[2][3] = 0;
|
||||
|
||||
xInv.fMap[3][3] = x.fMap[3][3] = hsScalar1;
|
||||
xInv.fMap[3][3] = x.fMap[3][3] = 1.f;
|
||||
|
||||
x.NotIdentity();
|
||||
xInv.NotIdentity();
|
||||
@ -239,7 +239,7 @@ hsBool plViewFaceModifier::IFacePoint(plPipeline* pipe, const hsPoint3& at)
|
||||
x.fMap[2][1] *= fScale.fZ;
|
||||
x.fMap[2][2] *= fScale.fZ;
|
||||
|
||||
hsScalar inv = 1.f / fScale.fX;
|
||||
float inv = 1.f / fScale.fX;
|
||||
xInv.fMap[0][0] *= inv;
|
||||
xInv.fMap[1][0] *= inv;
|
||||
xInv.fMap[2][0] *= inv;
|
||||
|
@ -84,7 +84,7 @@ protected:
|
||||
hsBounds3Ext fMaxBounds;
|
||||
|
||||
virtual hsBool IFacePoint(plPipeline* pipe, const hsPoint3& at);
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
|
||||
enum RefType
|
||||
{
|
||||
|
Reference in New Issue
Block a user