1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-18 19:29:09 +00:00

Eliminate hsScalar and hsFixed

Modern CPUs support floats just fine... hsFixed was crazy.
This commit is contained in:
2012-01-21 02:03:37 -05:00
parent 5027b5a4ac
commit e020651e4b
584 changed files with 5401 additions and 6399 deletions

View File

@ -88,7 +88,7 @@ protected:
uint32_t fCompFlags;
uint32_t fLoadFlags;
hsScalar fLastUpdateTime;
float fLastUpdateTime;
void IClearLayers();
uint32_t IMakeExtraLayer();
@ -120,9 +120,9 @@ public:
uint32_t GetCompositeFlags() const { return fCompFlags; }
uint32_t GetLoadFlags() const { return fLoadFlags; }
hsScalar GetLastUpdateTime() const { return fLastUpdateTime; }
void SetLastUpdateTime(hsScalar f) { fLastUpdateTime = f; }
hsBool IShouldUpdate(hsScalar secs, uint32_t flags) { return GetLastUpdateTime() != secs || (flags & kUpdateAgain); }
float GetLastUpdateTime() const { return fLastUpdateTime; }
void SetLastUpdateTime(float f) { fLastUpdateTime = f; }
hsBool IShouldUpdate(float secs, uint32_t flags) { return GetLastUpdateTime() != secs || (flags & kUpdateAgain); }
hsBool IsDynamic() const { return (fCompFlags & kCompDynamic); }
hsBool IsDecal() const { return (fCompFlags & kCompDecal); }

View File

@ -211,7 +211,7 @@ void plGrassShaderMod::Read(hsStream *stream, hsResMgr *mgr)
plgDispatch::Dispatch()->RegisterForExactType(plAgeLoadedMsg::Index(), GetKey());
}
hsBool plGrassShaderMod::IEval(double secs, hsScalar del, uint32_t dirty)
hsBool plGrassShaderMod::IEval(double secs, float del, uint32_t dirty)
{
if (fVShader)
{
@ -235,7 +235,7 @@ void plGrassShaderMod::ISetupShaders()
vShader->SetNumConsts(plGrassVS::kNumConsts);
vShader->SetVector(plGrassVS::kNumericConsts, 0.f, 0.5f, 1.f, 2.f);
vShader->SetVector(plGrassVS::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f);
vShader->SetVector(plGrassVS::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f);
vShader->SetVector(plGrassVS::kSinConsts, -1.f/6.f, 1.f/120.f, -1.f/5040.f, 1.f/362880.f);
IRefreshWaves(vShader);

View File

@ -53,12 +53,12 @@ class plGrassWave
public:
plGrassWave() : fDistX(0.F), fDistY(0.F), fDistZ(0.F), fDirX(0.F), fDirY(0.F), fSpeed(0.F) {}
hsScalar fDistX;
hsScalar fDistY;
hsScalar fDistZ;
hsScalar fDirX;
hsScalar fDirY;
hsScalar fSpeed;
float fDistX;
float fDistY;
float fDistZ;
float fDirX;
float fDirY;
float fSpeed;
void Write(hsStream *s);
void Read(hsStream *s);
@ -99,7 +99,7 @@ public:
plGrassWave fWaves[kNumWaves];
protected:
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
virtual hsBool IEval(double secs, float del, uint32_t dirty);
virtual void IApplyDynamic() {}; // dummy function required by base class
void ISetupShaders();
void IRefreshWaves(plShader *vShader);

View File

@ -80,14 +80,14 @@ plLayer::plLayer()
fRuntimeColor = TRACKED_NEW hsColorRGBA;
fAmbientColor = TRACKED_NEW hsColorRGBA;
fSpecularColor = TRACKED_NEW hsColorRGBA;
fOpacity = TRACKED_NEW hsScalar;
fOpacity = TRACKED_NEW float;
fState = TRACKED_NEW hsGMatState;
fState->Reset();
fUVWSrc = TRACKED_NEW uint32_t;
fLODBias = TRACKED_NEW hsScalar;
fSpecularPower = TRACKED_NEW hsScalar;
fLODBias = TRACKED_NEW float;
fSpecularPower = TRACKED_NEW float;
fTexture = TRACKED_NEW plBitmap*;
*fTexture = nil;

View File

@ -79,11 +79,11 @@ public:
void SetRuntimeColor( const hsColorRGBA& col ) { *fRuntimeColor = col; }
void SetAmbientColor(const hsColorRGBA& col) { *fAmbientColor = col; }
void SetSpecularColor(const hsColorRGBA& col) { *fSpecularColor = col; }
void SetOpacity(hsScalar a) { *fOpacity = a; }
void SetOpacity(float a) { *fOpacity = a; }
void SetTransform(const hsMatrix44& xfm);
void SetUVWSrc(uint32_t chan) { *fUVWSrc = chan; }
void SetLODBias(hsScalar f) { *fLODBias = f; }
void SetSpecularPower(hsScalar f) { *fSpecularPower = f; }
void SetLODBias(float f) { *fLODBias = f; }
void SetSpecularPower(float f) { *fSpecularPower = f; }
void SetVertexShader(plShader* shader) { *fVertexShader = shader; }
void SetPixelShader(plShader* shader) { *fPixelShader = shader; }

View File

@ -98,7 +98,7 @@ void plLayerAnimationBase::Read(hsStream* s, hsResMgr* mgr)
if( fOpacityCtl )
{
fOwnedChannels |= kOpacity;
fOpacity = TRACKED_NEW hsScalar;
fOpacity = TRACKED_NEW float;
}
if( fPreshadeColorCtl )
{
@ -145,7 +145,7 @@ plLayerInterface* plLayerAnimationBase::Attach(plLayerInterface* prev)
return plLayerInterface::Attach(prev);
}
void plLayerAnimationBase::IEvalConvertedTime(hsScalar secs, uint32_t passChans, uint32_t evalChans, uint32_t &dirty)
void plLayerAnimationBase::IEvalConvertedTime(float secs, uint32_t passChans, uint32_t evalChans, uint32_t &dirty)
{
if( evalChans & kPreshadeColor )
{
@ -264,7 +264,7 @@ void plLayerAnimationBase::SetOpacityCtl(plController* opaCtl)
if( fOpacityCtl )
delete fOpacityCtl;
else
fOpacity = TRACKED_NEW hsScalar;
fOpacity = TRACKED_NEW float;
fOwnedChannels |= kOpacity;
fOpacityCtl = opaCtl;
@ -281,7 +281,7 @@ void plLayerAnimationBase::SetTransformCtl(plController* xfmCtl)
fTransformCtl = xfmCtl;
}
hsScalar plLayerAnimationBase::IMakeUniformLength()
float plLayerAnimationBase::IMakeUniformLength()
{
fLength = 0;
if( fPreshadeColorCtl && (fPreshadeColorCtl->GetLength() > fLength) )
@ -356,7 +356,7 @@ uint32_t plLayerAnimation::Eval(double wSecs, uint32_t frame, uint32_t ignore)
{
uint32_t evalChans = 0;
uint32_t passChans = dirty | fPassThruChannels;
hsScalar secs = fTimeConvert.WorldToAnimTime(wSecs);
float secs = fTimeConvert.WorldToAnimTime(wSecs);
if( secs != fCurrentTime )
{
evalChans = fOwnedChannels & ~ignore & ~fPassThruChannels;
@ -470,19 +470,19 @@ uint32_t plLayerLinkAnimation::Eval(double wSecs, uint32_t frame, uint32_t ignor
{
uint32_t evalChans = 0;
uint32_t passChans = dirty | fPassThruChannels;
hsScalar oldAnimTime = fTimeConvert.CurrentAnimTime();
hsScalar secs = oldAnimTime;
float oldAnimTime = fTimeConvert.CurrentAnimTime();
float secs = oldAnimTime;
if (fFadeFlagsDirty)
{
hsScalar goal = 0.f;
float goal = 0.f;
if (fFadeFlags & kFadeLinkPrep)
secs = goal = fLength;
else
{
hsScalar rate = 0.f;
hsScalar delta = (hsScalar)(wSecs - fEvalTime);
float rate = 0.f;
float delta = (float)(wSecs - fEvalTime);
if (fFadeFlags & kFadeLinking)
{
@ -703,7 +703,7 @@ uint32_t plLayerSDLAnimation::Eval(double wSecs, uint32_t frame, uint32_t ignore
}
}
}
hsScalar secs;
float secs;
if (fVar)
fVar->Get(&secs);
else

View File

@ -62,8 +62,8 @@ class plLayerAnimationBase : public plLayerInterface
protected:
char* fSegmentID;
double fEvalTime;
hsScalar fCurrentTime;
hsScalar fLength;
float fCurrentTime;
float fLength;
plController* fPreshadeColorCtl;
plController* fRuntimeColorCtl;
@ -72,8 +72,8 @@ protected:
plController* fOpacityCtl;
plController* fTransformCtl;
hsScalar IMakeUniformLength();
void IEvalConvertedTime(hsScalar secs, uint32_t passChans, uint32_t evalChans, uint32_t &dirty);
float IMakeUniformLength();
void IEvalConvertedTime(float secs, uint32_t passChans, uint32_t evalChans, uint32_t &dirty);
public:
plLayerAnimationBase();
@ -91,7 +91,7 @@ public:
virtual void Write(hsStream* s, hsResMgr* mgr);
// Specialized
hsScalar GetLength() const { return fLength; }
float GetLength() const { return fLength; }
char *GetSegmentID() const { return fSegmentID; }
void SetSegmentID(char *ID) { delete fSegmentID; fSegmentID = hsStrcpy(ID); }

View File

@ -114,7 +114,7 @@ protected:
hsColorRGBA* fRuntimeColor; // Diffuse color to be used with runtime lights vs. static preshading
hsColorRGBA* fAmbientColor;
hsColorRGBA* fSpecularColor;
hsScalar* fOpacity;
float* fOpacity;
// Would like to abstract out the mipmap, but we'll bring it
// along for now.
@ -123,8 +123,8 @@ protected:
// (Currently) unanimatables.
hsGMatState* fState;
uint32_t* fUVWSrc;
hsScalar* fLODBias;
hsScalar* fSpecularPower;
float* fLODBias;
float* fSpecularPower;
plShader** fVertexShader;
plShader** fPixelShader;
@ -153,14 +153,14 @@ public:
const hsColorRGBA& GetRuntimeColor() const { return *fRuntimeColor; }
const hsColorRGBA& GetAmbientColor() const { return *fAmbientColor; }
const hsColorRGBA& GetSpecularColor() const { return *fSpecularColor; }
hsScalar GetOpacity() const { return *fOpacity; }
float GetOpacity() const { return *fOpacity; }
plBitmap* GetTexture() const { return *fTexture; }
// (Currently) unanimatables
uint32_t GetUVWSrc() const { return *fUVWSrc; }
hsScalar GetLODBias() const { return *fLODBias; }
hsScalar GetSpecularPower() const { return *fSpecularPower; }
float GetLODBias() const { return *fLODBias; }
float GetSpecularPower() const { return *fSpecularPower; }
const hsGMatState& GetState() const { return *fState; }
uint32_t GetBlendFlags() const { return fState->fBlendFlags; }

View File

@ -60,7 +60,7 @@ void plLayerMultiply::Read(hsStream* s, hsResMgr* mgr)
fOwnedChannels = s->ReadLE32();
if (fOwnedChannels & kOpacity)
{
fOpacity = TRACKED_NEW hsScalar;
fOpacity = TRACKED_NEW float;
*fOpacity = fSrcOpacity = s->ReadLEScalar();
fDirtyChannels |= kOpacity;
}
@ -171,7 +171,7 @@ void plLayerMultiply::SetAmbientColor(const hsColorRGBA& col)
fDirtyChannels |= kAmbientColor;
}
void plLayerMultiply::SetOpacity(hsScalar a)
void plLayerMultiply::SetOpacity(float a)
{
fSrcOpacity = a;
fDirtyChannels |= kOpacity;

View File

@ -65,7 +65,7 @@ public:
void SetPreshadeColor(const hsColorRGBA& col);
void SetRuntimeColor(const hsColorRGBA& col);
void SetAmbientColor(const hsColorRGBA& col);
void SetOpacity(hsScalar a);
void SetOpacity(float a);
void SetTransform(const hsMatrix44& xfm);
protected:
@ -73,7 +73,7 @@ protected:
hsColorRGBA fSrcPreshadeColor;
hsColorRGBA fSrcRuntimeColor;
hsColorRGBA fSrcAmbientColor;
hsScalar fSrcOpacity;
float fSrcOpacity;
hsMatrix44 fSrcTransform;
};

View File

@ -147,7 +147,7 @@ void plShader::SetVector(int i, const hsScalarTriple& vec)
fConsts[i].fZ = vec.fZ;
}
void plShader::SetVector(int i, hsScalar x, hsScalar y, hsScalar z, hsScalar w)
void plShader::SetVector(int i, float x, float y, float z, float w)
{
fConsts[i].x = x;
fConsts[i].y = y;
@ -263,7 +263,7 @@ hsVector3 plShader::GetVector(int i) const
return hsVector3(fConsts[i].fX, fConsts[i].fY, fConsts[i].fZ);
}
void plShader::GetVector(int i, hsScalar& x, hsScalar& y, hsScalar& z, hsScalar& w) const
void plShader::GetVector(int i, float& x, float& y, float& z, float& w) const
{
x = fConsts[i].x;
y = fConsts[i].y;
@ -271,7 +271,7 @@ void plShader::GetVector(int i, hsScalar& x, hsScalar& y, hsScalar& z, hsScalar&
w = fConsts[i].w;
}
hsScalar plShader::GetFloat(int i, int chan) const
float plShader::GetFloat(int i, int chan) const
{
return fConsts[i].fArray[chan];
}

View File

@ -225,8 +225,8 @@ public:
hsColorRGBA GetColor(int i) const;
hsPoint3 GetPosition(int i) const;
hsVector3 GetVector(int i) const;
void GetVector(int i, hsScalar& x, hsScalar& y, hsScalar& z, hsScalar& w) const;
hsScalar GetFloat(int i, int chan) const;
void GetVector(int i, float& x, float& y, float& z, float& w) const;
float GetFloat(int i, int chan) const;
const float* const GetFloat4(int i) const;
void SetMatrix(int i, const plFloat44& xfm); // Will transpose
@ -236,8 +236,8 @@ public:
void SetMatrix24(int i, const hsMatrix44& xfm);
void SetColor(int i, const hsColorRGBA& col);
void SetVector(int i, const hsScalarTriple& vec); /* Doesn't touch .fW */
void SetVectorW(int i, const hsScalarTriple& vec, hsScalar w=1.f) { SetVector(i, vec.fX, vec.fY, vec.fZ, w); }
void SetVector(int i, hsScalar x, hsScalar y, hsScalar z, hsScalar w);
void SetVectorW(int i, const hsScalarTriple& vec, float w=1.f) { SetVector(i, vec.fX, vec.fY, vec.fZ, w); }
void SetVector(int i, float x, float y, float z, float w);
void SetFloat(int i, int chan, float v);
void SetFloat4(int i, const float* const f);