1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +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

@ -336,22 +336,22 @@ void plAccMeshSmooth::SetDiffuse(plAccessSpan& span, hsTArray<uint16_t>& shareVt
triSpan.Diffuse32(shareVtx[i]) = diff.ToARGB32();
}
void plAccMeshSmooth::SetAngle(hsScalar degs)
void plAccMeshSmooth::SetAngle(float degs)
{
fMinNormDot = hsCosine(hsScalarDegToRad(degs));
fMinNormDot = cos(hsDegreesToRadians(degs));
}
hsScalar plAccMeshSmooth::GetAngle() const
float plAccMeshSmooth::GetAngle() const
{
return hsScalarRadToDeg(hsACosine(fMinNormDot));
return hsRadiansToDegrees(acos(fMinNormDot));
}
void plAccMeshSmooth::SetDistTol(hsScalar dist)
void plAccMeshSmooth::SetDistTol(float dist)
{
fDistTolSq = dist * dist;
}
hsScalar plAccMeshSmooth::GetDistTol() const
float plAccMeshSmooth::GetDistTol() const
{
return hsSquareRoot(fDistTolSq);
return sqrt(fDistTolSq);
}

View File

@ -71,8 +71,8 @@ protected:
uint32_t fFlags;
hsScalar fMinNormDot;
hsScalar fDistTolSq;
float fMinNormDot;
float fDistTolSq;
plAccessGeometry fAccGeom;
hsTArray<plAccessSpan> fSpans;
@ -92,11 +92,11 @@ protected:
public:
plAccMeshSmooth() : fFlags(kSmoothNorm), fMinNormDot(0.25f), fDistTolSq(1.e-4f), fAccGeom() {}
void SetAngle(hsScalar degs);
hsScalar GetAngle() const; // returns degrees
void SetAngle(float degs);
float GetAngle() const; // returns degrees
void SetDistTol(hsScalar dist);
hsScalar GetDistTol() const;
void SetDistTol(float dist);
float GetDistTol() const;
void Smooth(hsTArray<plGeometrySpan*>& sets);

View File

@ -468,7 +468,7 @@ void plAccessGeometry::IAccessSpanFromVertexSpan(plAccessSpan& dst, plDrawableSp
{
acc.SetNumWeights(numWgts);
acc.WeightStream(ptr, (uint16_t)stride, offset);
ptr += numWgts * sizeof(hsScalar);
ptr += numWgts * sizeof(float);
if( grp->GetVertexFormat() & plGBufferGroup::kSkinIndices )
{
acc.WgtIndexStream(ptr, (uint16_t)stride, offset);
@ -513,7 +513,7 @@ void plAccessGeometry::IAccessSpanFromVertexSpan(plAccessSpan& dst, plDrawableSp
{
acc.SetNumWeights(numWgts);
acc.WeightStream(ptr, (uint16_t)stride, posOffset);
ptr += numWgts * sizeof(hsScalar);
ptr += numWgts * sizeof(float);
if( grp->GetVertexFormat() & plGBufferGroup::kSkinIndices )
{
acc.WgtIndexStream(ptr, (uint16_t)stride, posOffset);

View File

@ -185,7 +185,7 @@ uint32_t plAccessSnapShot::CopyFrom(const plAccessVtxSpan& src, uint32_t chanMas
// mask that we already have.
chanMask = ICheckAlloc(src, chanMask, kPosition, sizeof(hsPoint3));
chanMask = ICheckAlloc(src, chanMask, kWeight, sizeof(hsScalar) * src.fNumWeights);
chanMask = ICheckAlloc(src, chanMask, kWeight, sizeof(float) * src.fNumWeights);
if( fChanSize[kWeight] )
fNumWeights = src.fNumWeights;

View File

@ -80,7 +80,7 @@ private:
hsBounds3Ext* fLocalBounds;
hsBounds3Ext* fWorldBounds;
hsScalar* fWaterHeight;
float* fWaterHeight;
hsGMaterial* fMaterial;
@ -119,7 +119,7 @@ public:
void SetWorldBounds(const hsBounds3Ext& wBnd) { *fWorldBounds = wBnd; }
hsBool HasWaterHeight() const { return nil != fWaterHeight; }
hsScalar GetWaterHeight() const { hsAssert(HasWaterHeight(), "Check before asking"); return *fWaterHeight; }
float GetWaterHeight() const { hsAssert(HasWaterHeight(), "Check before asking"); return *fWaterHeight; }
};
inline plAccessVtxSpan& plAccessSpan::AccessVtx()

View File

@ -131,8 +131,8 @@ public:
hsPoint3& Position(int i) const { return *(hsPoint3*)(fChannels[kPosition] + i*fStrides[kPosition]); }
hsVector3& Normal(int i) const { return *(hsVector3*)(fChannels[kNormal] + i*fStrides[kNormal]); }
hsScalar& Weight(int iVtx, int iWgt) const { return *(hsScalar*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + iWgt*sizeof(hsScalar)); }
hsScalar* Weights(int i) const { return (hsScalar*)(fChannels[kWeight] + i*fStrides[kWeight]); }
float& Weight(int iVtx, int iWgt) const { return *(float*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + iWgt*sizeof(float)); }
float* Weights(int i) const { return (float*)(fChannels[kWeight] + i*fStrides[kWeight]); }
uint32_t& WgtIndices(int i) const { return *(uint32_t*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex]); }
uint8_t& WgtIndex(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + iWgt); }
@ -153,10 +153,10 @@ public:
hsPoint3& PositionOff(int i) const { return *(hsPoint3*)(fChannels[kPosition] + i*fStrides[kPosition] + fOffsets[kPosition]); }
hsVector3& NormalOff(int i) const { return *(hsVector3*)(fChannels[kNormal] + i*fStrides[kNormal] + fOffsets[kNormal]); }
hsScalar& WeightOff(int iVtx, int iWgt) const { return *(hsScalar*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + fOffsets[kWeight] + iWgt*sizeof(hsScalar)); }
hsScalar* WeightsOff(int i) const { return (hsScalar*)(fChannels[kWeight] + i*fStrides[kWeight] + fOffsets[kWeight]); }
uint32_t& WgtIndicesOff(int i) const { return *(uint32_t*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex] + fOffsets[kWgtIndex]); }
uint8_t& WgtIndexOff(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + fOffsets[kWgtIndex] + iWgt); }
float& WeightOff(int iVtx, int iWgt) const { return *(float*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + fOffsets[kWeight] + iWgt*sizeof(float)); }
float* WeightsOff(int i) const { return (float*)(fChannels[kWeight] + i*fStrides[kWeight] + fOffsets[kWeight]); }
uint32_t& WgtIndicesOff(int i) const { return *(uint32_t*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex] + fOffsets[kWgtIndex]); }
uint8_t& WgtIndexOff(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + fOffsets[kWgtIndex] + iWgt); }
uint32_t& Diffuse32Off(int i) const { return *(uint32_t*)(fChannels[kDiffuse] + i*fStrides[kDiffuse] + fOffsets[kDiffuse]); }
uint32_t& Specular32Off(int i) const { return *(uint32_t*)(fChannels[kSpecular] + i*fStrides[kSpecular] + fOffsets[kSpecular]); }
@ -410,7 +410,7 @@ class plAccVertexIterator
{
protected:
plAccIterator<hsPoint3> fPosition;
plAccIterator<hsScalar> fWeight;
plAccIterator<float> fWeight;
plAccIterator<uint8_t> fWgtIndex;
plAccIterator<hsVector3> fNormal;
plAccIterator<uint32_t> fDiffuse;
@ -440,8 +440,8 @@ public:
}
hsPoint3* Position() const { return fPosition.Value(); }
hsScalar* Weights() const { return fWeight.Value(); }
hsScalar* Weight(int i) const { return fWeight.Value() + i; }
float* Weights() const { return fWeight.Value(); }
float* Weight(int i) const { return fWeight.Value() + i; }
uint32_t* WgtIndices() const { return (uint32_t*)(fWgtIndex.Value()); }
uint8_t* WgtIndex(int i) const { return fWgtIndex.Value() + i; }
hsVector3* Normal() const { return fNormal.Value(); }

View File

@ -194,7 +194,7 @@ void plAvMeshSmooth::Smooth(hsTArray<XfmSpan>& srcSpans, hsTArray<XfmSpan>& dstS
else
dstDiff.Set(1.f, 1.f, 1.f, 1.f);
hsScalar maxDot = fMinNormDot;
float maxDot = fMinNormDot;
hsPoint3 smoothPos = dstPos;
hsVector3 smoothNorm = dstNorm;
@ -209,12 +209,12 @@ void plAvMeshSmooth::Smooth(hsTArray<XfmSpan>& srcSpans, hsTArray<XfmSpan>& dstS
hsPoint3 srcPos = IPositionToNeutral(srcSpans[k], srcEdgeVerts[k][m]);
hsVector3 srcNorm = INormalToNeutral(srcSpans[k], srcEdgeVerts[k][m]);
hsScalar dist = hsVector3(&dstPos, &srcPos).MagnitudeSquared();
float dist = hsVector3(&dstPos, &srcPos).MagnitudeSquared();
if( dist <= fDistTolSq )
{
smoothPos = srcPos;
hsScalar currDot = srcNorm.InnerProduct(dstNorm);
float currDot = srcNorm.InnerProduct(dstNorm);
if( currDot > maxDot )
{
maxDot = currDot;
@ -265,22 +265,22 @@ hsVector3 plAvMeshSmooth::INormalToSpan(XfmSpan& span, const hsVector3& wNorm) c
return ret;
}
void plAvMeshSmooth::SetAngle(hsScalar degs)
void plAvMeshSmooth::SetAngle(float degs)
{
fMinNormDot = hsCosine(hsScalarDegToRad(degs));
fMinNormDot = cos(hsDegreesToRadians(degs));
}
hsScalar plAvMeshSmooth::GetAngle() const
float plAvMeshSmooth::GetAngle() const
{
return hsScalarRadToDeg(hsACosine(fMinNormDot));
return hsRadiansToDegrees(acos(fMinNormDot));
}
void plAvMeshSmooth::SetDistTol(hsScalar dist)
void plAvMeshSmooth::SetDistTol(float dist)
{
fDistTolSq = dist * dist;
}
hsScalar plAvMeshSmooth::GetDistTol() const
float plAvMeshSmooth::GetDistTol() const
{
return hsSquareRoot(fDistTolSq);
return sqrt(fDistTolSq);
}

View File

@ -77,8 +77,8 @@ public:
protected:
uint32_t fFlags;
hsScalar fMinNormDot;
hsScalar fDistTolSq;
float fMinNormDot;
float fDistTolSq;
plAccessGeometry fAccGeom;
@ -93,11 +93,11 @@ protected:
public:
plAvMeshSmooth() : fFlags(kSmoothNorm), fMinNormDot(0.25f), fDistTolSq(1.e-4f), fAccGeom() {}
void SetAngle(hsScalar degs);
hsScalar GetAngle() const; // returns degrees
void SetAngle(float degs);
float GetAngle() const; // returns degrees
void SetDistTol(hsScalar dist);
hsScalar GetDistTol() const;
void SetDistTol(float dist);
float GetDistTol() const;
void Smooth(hsTArray<XfmSpan>& srcSpans, hsTArray<XfmSpan>& dstSpans);

View File

@ -94,8 +94,8 @@ void plCluster::Write(hsStream* s) const
}
inline void inlTESTPOINT(const hsPoint3& destP,
hsScalar& minX, hsScalar& minY, hsScalar& minZ,
hsScalar& maxX, hsScalar& maxY, hsScalar& maxZ)
float& minX, float& minY, float& minZ,
float& maxX, float& maxY, float& maxZ)
{
if( destP.fX < minX )
minX = destP.fX;
@ -115,13 +115,13 @@ inline void inlTESTPOINT(const hsPoint3& destP,
void plCluster::UnPack(uint8_t* vDst, uint16_t* iDst, int idxOffset, hsBounds3Ext& wBnd) const
{
hsScalar minX = 1.e33f;
hsScalar minY = 1.e33f;
hsScalar minZ = 1.e33f;
float minX = 1.e33f;
float minY = 1.e33f;
float minZ = 1.e33f;
hsScalar maxX = -1.e33f;
hsScalar maxY = -1.e33f;
hsScalar maxZ = -1.e33f;
float maxX = -1.e33f;
float maxY = -1.e33f;
float maxZ = -1.e33f;
hsAssert(fGroup->GetTemplate(), "Can't unpack without a template");
const plSpanTemplate& templ = *fGroup->GetTemplate();

View File

@ -62,15 +62,15 @@ class plDrawableSpans;
class plLODDist
{
public:
hsScalar fMinDist;
hsScalar fMaxDist;
float fMinDist;
float fMaxDist;
plLODDist(hsScalar minDist, hsScalar maxDist) : fMinDist(minDist), fMaxDist(maxDist) {}
plLODDist(float minDist, float maxDist) : fMinDist(minDist), fMaxDist(maxDist) {}
plLODDist() : fMinDist(0), fMaxDist(0) {}
plLODDist& Set(float minDist, float maxDist) { fMinDist = minDist; fMaxDist = maxDist; return *this; }
plLODDist& operator=(int d) { fMinDist = hsScalar(d); fMaxDist = hsScalar(d); return *this; }
plLODDist& operator=(int d) { fMinDist = float(d); fMaxDist = float(d); return *this; }
int operator==(const plLODDist& d) const { return (fMinDist == d.fMinDist)&&(fMaxDist == d.fMaxDist); }

View File

@ -134,7 +134,7 @@ void plCutter::Set(const hsPoint3& pos, const hsVector3& dir, const hsVector3& o
}
inline void plCutter::ISetPosNorm(hsScalar parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
inline void plCutter::ISetPosNorm(float parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
{
dst.fPos = outVtx.fPos;
dst.fPos += parm * (inVtx.fPos - outVtx.fPos);
@ -161,7 +161,7 @@ inline void plCutter::ISetPosNorm(hsScalar parm, const plCutoutVtx& inVtx, const
inline void plCutter::ICutoutVtxLoU(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
{
hsScalar parm = outVtx.fUVW.fX / (outVtx.fUVW.fX - inVtx.fUVW.fX);
float parm = outVtx.fUVW.fX / (outVtx.fUVW.fX - inVtx.fUVW.fX);
ISetPosNorm(parm, inVtx, outVtx, dst);
@ -172,7 +172,7 @@ inline void plCutter::ICutoutVtxLoU(const plCutoutVtx& inVtx, const plCutoutVtx&
inline void plCutter::ICutoutVtxLoV(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
{
hsScalar parm = outVtx.fUVW.fY / (outVtx.fUVW.fY - inVtx.fUVW.fY);
float parm = outVtx.fUVW.fY / (outVtx.fUVW.fY - inVtx.fUVW.fY);
ISetPosNorm(parm, inVtx, outVtx, dst);
@ -183,7 +183,7 @@ inline void plCutter::ICutoutVtxLoV(const plCutoutVtx& inVtx, const plCutoutVtx&
inline void plCutter::ICutoutVtxLoW(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
{
hsScalar parm = outVtx.fUVW.fZ / (outVtx.fUVW.fZ - inVtx.fUVW.fZ);
float parm = outVtx.fUVW.fZ / (outVtx.fUVW.fZ - inVtx.fUVW.fZ);
ISetPosNorm(parm, inVtx, outVtx, dst);
@ -198,7 +198,7 @@ inline void plCutter::ICutoutVtxLoW(const plCutoutVtx& inVtx, const plCutoutVtx&
// parm = (outVtx.fUVW - 1.f) / (outVtx.fUVW - inVtx.fUVW)
inline void plCutter::ICutoutVtxHiU(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
{
hsScalar parm = (outVtx.fUVW.fX - 1.f) / (outVtx.fUVW.fX - inVtx.fUVW.fX);
float parm = (outVtx.fUVW.fX - 1.f) / (outVtx.fUVW.fX - inVtx.fUVW.fX);
ISetPosNorm(parm, inVtx, outVtx, dst);
@ -209,7 +209,7 @@ inline void plCutter::ICutoutVtxHiU(const plCutoutVtx& inVtx, const plCutoutVtx&
inline void plCutter::ICutoutVtxHiV(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
{
hsScalar parm = (outVtx.fUVW.fY - 1.f) / (outVtx.fUVW.fY - inVtx.fUVW.fY);
float parm = (outVtx.fUVW.fY - 1.f) / (outVtx.fUVW.fY - inVtx.fUVW.fY);
ISetPosNorm(parm, inVtx, outVtx, dst);
@ -220,7 +220,7 @@ inline void plCutter::ICutoutVtxHiV(const plCutoutVtx& inVtx, const plCutoutVtx&
inline void plCutter::ICutoutVtxHiW(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
{
hsScalar parm = (outVtx.fUVW.fZ - 1.f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ);
float parm = (outVtx.fUVW.fZ - 1.f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ);
ISetPosNorm(parm, inVtx, outVtx, dst);
@ -236,7 +236,7 @@ inline void plCutter::ICutoutVtxHiW(const plCutoutVtx& inVtx, const plCutoutVtx&
// parm = (outVtx.fUVW - 0.5f) / (outVtx.fUVW - inVtx.fUVW)
inline void plCutter::ICutoutVtxMidU(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
{
hsScalar parm = (outVtx.fUVW.fX - 0.5f) / (outVtx.fUVW.fX - inVtx.fUVW.fX);
float parm = (outVtx.fUVW.fX - 0.5f) / (outVtx.fUVW.fX - inVtx.fUVW.fX);
ISetPosNorm(parm, inVtx, outVtx, dst);
@ -249,7 +249,7 @@ inline void plCutter::ICutoutVtxMidU(const plCutoutVtx& inVtx, const plCutoutVtx
inline void plCutter::ICutoutVtxMidV(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
{
hsScalar parm = (outVtx.fUVW.fY - 0.5f) / (outVtx.fUVW.fY - inVtx.fUVW.fY);
float parm = (outVtx.fUVW.fY - 0.5f) / (outVtx.fUVW.fY - inVtx.fUVW.fY);
ISetPosNorm(parm, inVtx, outVtx, dst);
@ -262,7 +262,7 @@ inline void plCutter::ICutoutVtxMidV(const plCutoutVtx& inVtx, const plCutoutVtx
inline void plCutter::ICutoutVtxMidW(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
{
hsScalar parm = (outVtx.fUVW.fZ - 0.5f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ);
float parm = (outVtx.fUVW.fZ - 0.5f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ);
ISetPosNorm(parm, inVtx, outVtx, dst);
@ -721,7 +721,7 @@ hsBool plCutter::FindHitPoints(const hsTArray<plCutoutPoly>& src, hsTArray<plCut
return hits.GetCount() > 0;
}
hsBool plCutter::FindHitPointsConstHeight(const hsTArray<plCutoutPoly>& src, hsTArray<plCutoutHit>& hits, hsScalar height) const
hsBool plCutter::FindHitPointsConstHeight(const hsTArray<plCutoutPoly>& src, hsTArray<plCutoutHit>& hits, float height) const
{
if( FindHitPoints(src, hits) )
{
@ -933,14 +933,14 @@ hsBool plCutter::MakeGrid(int nWid, int nLen, const hsPoint3& center, const hsVe
corner += -dux;
corner += -dvx;
hsScalar sWid = 1.f / hsScalar(nWid-1);
hsScalar sLen = 1.f / hsScalar(nLen-1);
float sWid = 1.f / float(nWid-1);
float sLen = 1.f / float(nLen-1);
dux *= 2.f * sWid;
dvx *= 2.f * sLen;
hsScalar du = sWid;
hsScalar dv = sLen;
float du = sWid;
float dv = sLen;
int j;
for( j = 0; j < nLen; j++ )
{
@ -950,8 +950,8 @@ hsBool plCutter::MakeGrid(int nWid, int nLen, const hsPoint3& center, const hsVe
plCutoutMiniVtx& vtx = grid.fVerts[j * nWid + i];
vtx.fPos = corner;
vtx.fPos += dux * (hsScalar)i;
vtx.fPos += dvx * (hsScalar)j;
vtx.fPos += dux * (float)i;
vtx.fPos += dvx * (float)j;
vtx.fUVW.fX = du * i;
vtx.fUVW.fY = dv * j;
@ -1168,7 +1168,7 @@ void TestCutter(const plKey& key, const hsVector3& size, const hsPoint3& pos)
uvw[iv] = dst[iPoly].fVerts[iVert].fUVW;
col[iv] = dst[iPoly].fVerts[iVert].fColor;
hsScalar opac = uvw[iv].fZ < 0.25f
float opac = uvw[iv].fZ < 0.25f
? uvw[iv].fZ * 4.f
: uvw[iv].fZ > 0.75f
? (1.f - uvw[iv].fZ) * 4.f
@ -1322,7 +1322,7 @@ void TestCutter2(const plKey& key, const hsVector3& size, const hsPoint3& pos, h
uvw[iv] = dst[iPoly].fVerts[iVert].fUVW;
col[iv] = dst[iPoly].fVerts[iVert].fColor;
hsScalar opac = uvw[iv].fZ < 0.25f
float opac = uvw[iv].fZ < 0.25f
? uvw[iv].fZ * 4.f
: uvw[iv].fZ > 0.75f
? (1.f - uvw[iv].fZ) * 4.f

View File

@ -105,14 +105,14 @@ class plCutter : public plCreatable
protected:
// Permanent attributes
hsScalar fLengthU;
hsScalar fLengthV;
hsScalar fLengthW;
float fLengthU;
float fLengthV;
float fLengthW;
// Internal cached stuff
hsScalar fDistU;
hsScalar fDistV;
hsScalar fDistW;
float fDistU;
float fDistV;
float fDistW;
hsVector3 fDirU;
hsVector3 fDirV;
hsVector3 fDirW;
@ -136,7 +136,7 @@ protected:
hsBool IFindHitPoint(const hsTArray<plCutoutVtx>& inPoly, plCutoutHit& hit) const;
inline void ISetPosNorm(hsScalar parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const;
inline void ISetPosNorm(float parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const;
void ICutoutTransformed(plAccessSpan& src, hsTArray<plCutoutPoly>& dst) const;
void ICutoutConstHeight(plAccessSpan& src, hsTArray<plCutoutPoly>& dst) const;
@ -155,7 +155,7 @@ public:
virtual void Write(hsStream* stream, hsResMgr* mgr);
hsBool FindHitPoints(const hsTArray<plCutoutPoly>& src, hsTArray<plCutoutHit>& hits) const;
hsBool FindHitPointsConstHeight(const hsTArray<plCutoutPoly>& src, hsTArray<plCutoutHit>& hits, hsScalar height) const;
hsBool FindHitPointsConstHeight(const hsTArray<plCutoutPoly>& src, hsTArray<plCutoutHit>& hits, float height) const;
void Set(const hsPoint3& pos, const hsVector3& dir, const hsVector3& out, hsBool flip=false);
@ -163,9 +163,9 @@ public:
hsBool CutoutGrid(int nWid, int nLen, plFlatGridMesh& dst) const;
void SetLength(const hsVector3& s) { fLengthU = s.fX; fLengthV = s.fY; fLengthW = s.fZ; }
hsScalar GetLengthU() const { return fLengthU; }
hsScalar GetLengthV() const { return fLengthV; }
hsScalar GetLengthW() const { return fLengthW; }
float GetLengthU() const { return fLengthU; }
float GetLengthV() const { return fLengthV; }
float GetLengthW() const { return fLengthW; }
const hsBounds3Ext& GetWorldBounds() const { return fWorldBounds; }
plBoundsIsect& GetIsect() { return fIsect; }

View File

@ -94,7 +94,7 @@ void plDrawableGenerator::IQuickShadeVerts( uint32_t count, hsVector3 *normal
scale = ( normals[ count ] * lightDir );
// pretend there are two opposing directional lights, but the
// one pointing downish is a little stronger.
const hsScalar kReverseLight = -0.8f;
const float kReverseLight = -0.8f;
if( scale < 0 )
scale = kReverseLight * scale;
colors[ count ] = fLiteColor * scale + fDarkColor * ( 1.f - scale );
@ -286,11 +286,11 @@ plDrawableSpans *plDrawableGenerator::GenerateDrawable( uint32_t vertCount, hsPo
//// GenerateSphericalDrawable ///////////////////////////////////////////////
plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoint3& pos, hsScalar radius, hsGMaterial *material,
plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoint3& pos, float radius, hsGMaterial *material,
const hsMatrix44 &localToWorld, hsBool blended,
const hsColorRGBA* multColor,
hsTArray<uint32_t> *retIndex, plDrawableSpans *toAddTo,
hsScalar qualityScalar )
float qualityScalar )
{
hsTArray<hsPoint3> points;
hsTArray<hsVector3> normals;
@ -314,13 +314,13 @@ plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoi
/// Generate points
for( i = 0; i <= numDivisions; i++ )
{
angle = (float)i * ( hsScalarPI ) / (float)numDivisions;
angle = (float)i * ( M_PI ) / (float)numDivisions;
hsFastMath::SinCosInRange( angle, internRad, z );
internRad *= radius;
for( j = 0; j < numDivisions; j++ )
{
angle = (float)j * ( 2 * hsScalarPI ) / (float)numDivisions;
angle = (float)j * ( 2 * M_PI ) / (float)numDivisions;
hsFastMath::SinCosInRange( angle, x, y );
point.Set( pos.fX + x * internRad, pos.fY + y * internRad, pos.fZ + z * radius );
@ -367,7 +367,7 @@ plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoi
//// GenerateBoxDrawable /////////////////////////////////////////////////////
plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( hsScalar width, hsScalar height, hsScalar depth,
plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( float width, float height, float depth,
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended,
const hsColorRGBA* multColor,
hsTArray<uint32_t> *retIndex, plDrawableSpans *toAddTo )
@ -537,7 +537,7 @@ plDrawableSpans *plDrawableGenerator::GenerateBoundsDrawable( hsBounds3Ext *
//// GenerateConicalDrawable /////////////////////////////////////////////////
plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsScalar radius, hsScalar height, hsGMaterial *material,
plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( float radius, float height, hsGMaterial *material,
const hsMatrix44 &localToWorld, hsBool blended,
const hsColorRGBA* multColor,
hsTArray<uint32_t> *retIndex, plDrawableSpans *toAddTo )
@ -555,7 +555,7 @@ plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsScalar radi
//// GenerateConicalDrawable /////////////////////////////////////////////////
plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, hsScalar radius, hsGMaterial *material,
plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, float radius, hsGMaterial *material,
const hsMatrix44 &localToWorld, hsBool blended,
const hsColorRGBA* multColor,
hsTArray<uint32_t> *retIndex, plDrawableSpans *toAddTo )
@ -604,7 +604,7 @@ plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &ape
normals.Append( -direction );
for( i = 0; i < numDivisions; i++ )
{
angle = (float)i * ( hsScalarPI * 2.f ) / (float)numDivisions;
angle = (float)i * ( M_PI * 2.f ) / (float)numDivisions;
hsFastMath::SinCosInRange( angle, x, y );
points.Append( baseCenter + ( xVec * x * radius ) + ( yVec * y * radius ) );

View File

@ -93,14 +93,14 @@ class plDrawableGenerator
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil );
// Generates a spherical drawable
static plDrawableSpans *GenerateSphericalDrawable( const hsPoint3& localPos, hsScalar radius, hsGMaterial *material,
static plDrawableSpans *GenerateSphericalDrawable( const hsPoint3& localPos, float radius, hsGMaterial *material,
const hsMatrix44 &localToWorld, hsBool blended = false,
const hsColorRGBA* multColor = nil,
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil,
hsScalar qualityScalar = 1.f );
float qualityScalar = 1.f );
// Generates a rectangular drawable
static plDrawableSpans *GenerateBoxDrawable( hsScalar width, hsScalar height, hsScalar depth,
static plDrawableSpans *GenerateBoxDrawable( float width, float height, float depth,
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false,
const hsColorRGBA* multColor = nil,
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil );
@ -117,13 +117,13 @@ class plDrawableGenerator
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil );
// Generates a conical drawable
static plDrawableSpans *GenerateConicalDrawable( hsScalar radius, hsScalar height, hsGMaterial *material,
static plDrawableSpans *GenerateConicalDrawable( float radius, float height, hsGMaterial *material,
const hsMatrix44 &localToWorld, hsBool blended = false,
const hsColorRGBA* multColor = nil,
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil );
// Generates a general conical drawable based on a center and direction
static plDrawableSpans *GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, hsScalar radius, hsGMaterial *material,
static plDrawableSpans *GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, float radius, hsGMaterial *material,
const hsMatrix44 &localToWorld, hsBool blended = false,
const hsColorRGBA* multColor = nil,
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil );

View File

@ -405,7 +405,7 @@ hsBool plDrawableSpans::IBoundsInvalid(const hsBounds3Ext& bnd) const
int i;
for( i = 0; i < 3; i++ )
{
const hsScalar kLimit(1.e5f);
const float kLimit(1.e5f);
if( bnd.GetMaxs()[i] > kLimit )
return true;
@ -1512,7 +1512,7 @@ hsGMaterial* plDrawableSpans::GetSubMaterial(int index) const
}
// return true if span invisible before minDist and/or after maxDist
hsBool plDrawableSpans::GetSubVisDists(int index, hsScalar& minDist, hsScalar& maxDist) const
hsBool plDrawableSpans::GetSubVisDists(int index, float& minDist, float& maxDist) const
{
return (minDist = fSpans[index]->GetMinDist()) < (maxDist = fSpans[index]->GetMaxDist());
}
@ -1540,7 +1540,7 @@ void plDrawableSpans::SortSpan( uint32_t index, plPipeline *pipe )
uint32_t numTris;
int i;
hsMatrix44 w2cMatrix = pipe->GetWorldToCamera() * pipe->GetLocalToWorld();
hsScalar dist;
float dist;
ICheckSpanForSortable(index);
@ -1566,7 +1566,7 @@ void plDrawableSpans::SortSpan( uint32_t index, plPipeline *pipe )
plProfile_BeginLap(FaceSort, "1");
hsVector3 vec(w2cMatrix.fMap[2][0], w2cMatrix.fMap[2][1], w2cMatrix.fMap[2][2]);
hsScalar trans = w2cMatrix.fMap[2][3];
float trans = w2cMatrix.fMap[2][3];
// Fill out the radix sort elements with our data
for( i = 0; i < numTris; i++ )
@ -1720,7 +1720,7 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray<int16_t>& visList, plPipel
int j;
for( j = 0; j < nTris; j++ )
{
hsScalar dist = -(viewPos - list[j].fCenter).MagnitudeSquared();
float dist = -(viewPos - list[j].fCenter).MagnitudeSquared();
elem[cnt].fKey.fFloat = dist;
elem[cnt].fBody = &list[j];
elem[cnt].fNext = elem + cnt + 1;
@ -1919,7 +1919,7 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray<int16_t>& visList, plPipel
int j;
for( j = 0; j < nTris; j++ )
{
hsScalar dist = -(viewPos - list[j].fCenter).MagnitudeSquared();
float dist = -(viewPos - list[j].fCenter).MagnitudeSquared();
elem[cnt].fKey.fFloat = dist;
elem[cnt].fBody = &list[j];
elem[cnt].fNext = elem + cnt + 1;
@ -2113,7 +2113,7 @@ void plDrawableSpans::SortVisibleSpansUnit(const hsTArray<int16_t>& visList, plP
uint16_t fIndex0;
uint16_t fIndex1;
uint16_t fIndex2;
hsScalar fDist;
float fDist;
};
static hsLargeArray<sortFace> sortList;
@ -2126,7 +2126,7 @@ void plDrawableSpans::SortVisibleSpansUnit(const hsTArray<int16_t>& visList, plP
};
hsPoint3 viewPos = fSpans[visList[0]]->fWorldToLocal * pipe->GetViewPositionWorld();
hsScalar dist1 = (fViewPos - face1->fCenter).MagnitudeSquared();
float dist1 = (fViewPos - face1->fCenter).MagnitudeSquared();
// First figure out the total number of tris to deal with.
sortList.SetCount(0);

View File

@ -332,7 +332,7 @@ class plDrawableSpans : public plDrawable
// Taking span index. DI Index doesn't make sense here, because one object's DI can dereference into many materials etc.
virtual hsGMaterial* GetSubMaterial(int index) const;
virtual hsBool GetSubVisDists(int index, hsScalar& minDist, hsScalar& maxDist) const; // return true if span invisible before minDist and/or after maxDist
virtual hsBool GetSubVisDists(int index, float& minDist, float& maxDist) const; // return true if span invisible before minDist and/or after maxDist
// Used by the pipeline to keep from reskinning on multiple renders per frame.
uint32_t GetSkinTime() const { return fSkinTime; }

View File

@ -45,9 +45,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plDynaDecal.h"
#include "plAuxSpan.h"
hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
hsBool plDynaSplot::Age(double t, float ramp, float decay, float life)
{
hsScalar age = hsScalar(t - fBirth);
float age = float(t - fBirth);
if( age >= life )
return true;
@ -55,7 +55,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
if( !n )
return true;
hsScalar atten = fInitAtten;
float atten = fInitAtten;
if( age < ramp )
{
atten *= age / ramp;
@ -98,13 +98,13 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
{
const int stride = sizeof(plDecalVtxFormat);
hsScalar* sPtr = &origUVW->fZ;
float* sPtr = &origUVW->fZ;
unsigned char* alpha = (unsigned char*)&fVtxBase->fDiffuse;
alpha += 3;
while( n-- )
{
hsScalar initOpac = *sPtr;
float initOpac = *sPtr;
*alpha = (unsigned char)(initOpac * atten * 255.99f);
alpha += stride;
@ -113,7 +113,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
}
else
{
hsScalar* sPtr = &origUVW->fZ;
float* sPtr = &origUVW->fZ;
char* oPtr = (char*)&fVtxBase->fUVW[1].fX;
@ -121,7 +121,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
while( n-- )
{
(*(hsScalar*)oPtr) = *sPtr * atten;
(*(float*)oPtr) = *sPtr * atten;
oPtr += stride;
sPtr += 3;
@ -130,9 +130,9 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
return false;
}
hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
hsBool plDynaRipple::Age(double t, float ramp, float decay, float life)
{
hsScalar age = hsScalar(t - fBirth);
float age = float(t - fBirth);
if( age >= life )
return true;
@ -140,7 +140,7 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
if( !n )
return true;
hsScalar atten = fInitAtten;
float atten = fInitAtten;
if( age < ramp )
{
atten *= age / ramp;
@ -150,8 +150,8 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
atten *= (life - age) / (life - decay);
}
hsScalar scaleU = fC1U / (age*fC2U + 1.f);
hsScalar scaleV = fC1V / (age*fC2V + 1.f);
float scaleU = fC1U / (age*fC2U + 1.f);
float scaleV = fC1V / (age*fC2V + 1.f);
hsPoint3* origUVW = &fAuxSpan->fOrigUVW[fStartVtx];
@ -210,9 +210,9 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
return false;
}
hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
hsBool plDynaWake::Age(double t, float ramp, float decay, float life)
{
hsScalar age = hsScalar(t - fBirth);
float age = float(t - fBirth);
if( age >= life )
return true;
@ -220,7 +220,7 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
if( !n )
return true;
hsScalar atten = fInitAtten;
float atten = fInitAtten;
if( age < ramp )
{
atten *= age / ramp;
@ -230,8 +230,8 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
atten *= (life - age) / (life - decay);
}
hsScalar scaleU = fC1U / (age*fC2U + 1.f);
hsScalar scaleV = fC1V / (age*fC2V + 1.f);
float scaleU = fC1U / (age*fC2U + 1.f);
float scaleV = fC1V / (age*fC2V + 1.f);
hsPoint3* origUVW = &fAuxSpan->fOrigUVW[fStartVtx];
@ -290,9 +290,9 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
return false;
}
hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
hsBool plDynaWave::Age(double t, float ramp, float decay, float life)
{
hsScalar age = hsScalar(t - fBirth);
float age = float(t - fBirth);
if( age >= life )
return true;
@ -300,7 +300,7 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
if( !n )
return true;
hsScalar atten = fInitAtten;
float atten = fInitAtten;
if( age < ramp )
{
atten *= age / ramp;
@ -310,8 +310,8 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
atten *= (life - age) / (life - decay);
}
hsScalar scale = 1.f + life * fScrollRate;
hsScalar scroll = -fScrollRate * age;
float scale = 1.f + life * fScrollRate;
float scroll = -fScrollRate * age;
hsPoint3* origUVW = &fAuxSpan->fOrigUVW[fStartVtx];
@ -370,9 +370,9 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
return false;
}
hsBool plDynaRippleVS::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
hsBool plDynaRippleVS::Age(double t, float ramp, float decay, float life)
{
hsScalar age = hsScalar(t - fBirth);
float age = float(t - fBirth);
if( age >= life )
return true;

View File

@ -85,7 +85,7 @@ protected:
uint16_t fNumIdx;
double fBirth;
hsScalar fInitAtten;
float fInitAtten;
hsBool fFlags;
plDecalVtxFormat* fVtxBase; // Safe pointer, the buffer data will outlive this decal
@ -95,7 +95,7 @@ protected:
friend class plDynaDecalMgr;
public:
virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) = 0;
virtual hsBool Age(double t, float ramp, float decay, float life) = 0;
};
// No expansion
@ -105,7 +105,7 @@ protected:
public:
virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life);
virtual hsBool Age(double t, float ramp, float decay, float life);
};
// Expands radially from center
@ -113,13 +113,13 @@ class plDynaRipple : public plDynaDecal
{
public:
virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life);
virtual hsBool Age(double t, float ramp, float decay, float life);
hsScalar fC1U;
hsScalar fC2U;
float fC1U;
float fC2U;
hsScalar fC1V;
hsScalar fC2V;
float fC1V;
float fC2V;
};
@ -128,13 +128,13 @@ class plDynaWake : public plDynaDecal
{
public:
virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life);
virtual hsBool Age(double t, float ramp, float decay, float life);
hsScalar fC1U;
hsScalar fC2U;
float fC1U;
float fC2U;
hsScalar fC1V;
hsScalar fC2V;
float fC1V;
float fC2V;
};
@ -143,9 +143,9 @@ class plDynaWave : public plDynaDecal
{
public:
virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life);
virtual hsBool Age(double t, float ramp, float decay, float life);
hsScalar fScrollRate;
float fScrollRate;
};
// About the same as a DynaRipple, but implemented with vertex/pixel shaders.
@ -154,7 +154,7 @@ class plDynaRippleVS : public plDynaRipple
{
public:
virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life);
virtual hsBool Age(double t, float ramp, float decay, float life);
};
#endif // plDynaDecal_inc

View File

@ -110,11 +110,11 @@ static const int kBinBlockSize = 20;
static const uint16_t kDefMaxNumVerts = 1000;
static const uint16_t kDefMaxNumIdx = kDefMaxNumVerts;
static const hsScalar kDefLifeSpan = 30.f;
static const hsScalar kDefDecayStart = kDefLifeSpan * 0.5f;
static const hsScalar kDefRampEnd = kDefLifeSpan * 0.1f;
static const float kDefLifeSpan = 30.f;
static const float kDefDecayStart = kDefLifeSpan * 0.5f;
static const float kDefRampEnd = kDefLifeSpan * 0.1f;
static const hsScalar kInitAuxSpans = 5;
static const float kInitAuxSpans = 5;
#define MF_NO_INIT_ALLOC
#define MF_NEVER_RUN_OUT
@ -582,7 +582,7 @@ void plDynaDecalMgr::IRemoveDecalInfos(const plKey& key)
}
}
hsScalar plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const
float plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const
{
// We aren't playing this wet/dry/enable/disable thing.
if( !fWaitOnEnable )
@ -601,7 +601,7 @@ hsScalar plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const
return 0;
// We're wet, let's see how wet.
hsScalar wet = (hsScalar)(1.f - (t - info.fWetTime) / info.fWetLength);
float wet = (float)(1.f - (t - info.fWetTime) / info.fWetLength);
if( wet > 1.f ) // This should never happen. It means t < info.fWetTime (we get wet in the future).
return fIntensity;
if( wet < 0 )
@ -1024,14 +1024,14 @@ hsBool plDynaDecalMgr::IConvertFlatGrid(plAuxSpan* auxSpan,
void plDynaDecalMgr::ISetDepthFalloff()
{
const hsScalar totalDepth = fCutter->GetLengthW();
const float totalDepth = fCutter->GetLengthW();
// Currently all constants, but these could be set per DecalMgr.
plConst(hsScalar) kMinFeet(3.f);
plConst(hsScalar) kMaxFeet(10.f);
plConst(float) kMinFeet(3.f);
plConst(float) kMaxFeet(10.f);
plConst(hsScalar) kMinDepth(0.25f);
plConst(hsScalar) kMaxDepth(0.75f);
plConst(float) kMinDepth(0.25f);
plConst(float) kMaxDepth(0.75f);
fMinDepth = kMinFeet / totalDepth;
if( fMinDepth > kMinDepth )
@ -1099,15 +1099,15 @@ hsBool plDynaDecalMgr::IConvertPolysAlpha(plAuxSpan* auxSpan,
hsColorRGBA col = src[iPoly].fVerts[iVert].fColor;
hsScalar depth = vtx->fUVW[0].fZ;
float depth = vtx->fUVW[0].fZ;
hsScalar opac = depth < fMinDepth
float opac = depth < fMinDepth
? depth * fMinDepthRange
: depth > fMaxDepth
? (1.f - depth) * fMaxDepthRange
: 1.f;
hsScalar normOpac = 1.f - vtx->fNorm.InnerProduct(backDir);
float normOpac = 1.f - vtx->fNorm.InnerProduct(backDir);
opac *= 1.f - normOpac * normOpac;
if( opac < 0 )
opac = 0;
@ -1197,14 +1197,14 @@ hsBool plDynaDecalMgr::IConvertPolysColor(plAuxSpan* auxSpan,
else
hiV = true;
hsScalar depth = vtx->fUVW[0].fZ;
hsScalar opac = depth < fMinDepth
float depth = vtx->fUVW[0].fZ;
float opac = depth < fMinDepth
? depth * fMinDepthRange
: depth > fMaxDepth
? (1.f - depth) * fMaxDepthRange
: 1.f;
hsScalar normOpac = 1.f - vtx->fNorm.InnerProduct(backDir);
float normOpac = 1.f - vtx->fNorm.InnerProduct(backDir);
opac *= 1.f - normOpac * normOpac;
if( opac < 0 )
opac = 0;
@ -1292,7 +1292,7 @@ hsBool plDynaDecalMgr::IConvertPolysVS(plAuxSpan* auxSpan,
origUVW->fX = vtx->fUVW[0].fX;
origUVW->fY = vtx->fUVW[0].fY;
origUVW->fZ = vtx->fUVW[0].fZ = (hsScalar)decal->fBirth;
origUVW->fZ = vtx->fUVW[0].fZ = (float)decal->fBirth;
vtx->fUVW[1].Set(0, 0, 0);
@ -1582,7 +1582,7 @@ hsGMaterial* plDynaDecalMgr::IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap
sprintf(buff, "%s_%s", GetKey()->GetName(), "EnvMat");
hsgResMgr::ResMgr()->NewKey(buff, newMat, GetKey()->GetUoid().GetLocation());
static plTweak<hsScalar> kSmooth(1.f);
static plTweak<float> kSmooth(1.f);
plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, plBumpMapGen::kBubbleTest, kSmooth);
// plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, plBumpMapGen::kNormalize, kSmooth);
// plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, 0, 0);
@ -1676,11 +1676,11 @@ hsVector3 plDynaDecalMgr::IRandomUp(hsVector3 dir) const
// Only problem here is that our random scalings might wind us up with
// a zero vector. Unlikely, which means almost certain to happen. So
// we keep trying till we get a non-zero vector.
hsScalar lenSq(-1.f);
float lenSq(-1.f);
do {
hsScalar ranXx = sRand.RandMinusOneToOne();
hsScalar ranXy = sRand.RandMinusOneToOne();
hsScalar ranXz = sRand.RandMinusOneToOne();
float ranXx = sRand.RandMinusOneToOne();
float ranXy = sRand.RandMinusOneToOne();
float ranXz = sRand.RandMinusOneToOne();
retVal.fX = -dir.fZ * ranXy + dir.fY * ranXz;
retVal.fY = dir.fZ * ranXx + -dir.fX * ranXz;
retVal.fZ = -dir.fY * ranXx + dir.fX * ranXy;
@ -1706,11 +1706,11 @@ hsVector3 plDynaDecalMgr::IReflectDir(hsVector3 dir) const
// Simplifying gives (2*K*(N dot B) + (1-K)) * N + K*B
// Or something.
plConst(hsScalar) parm(0.5f);
plConst(float) parm(0.5f);
hsVector3 b = -fCutter->GetBackDir();
hsScalar t = dir.InnerProduct(b);
float t = dir.InnerProduct(b);
t *= -2.f * parm;
t += (1.f - parm);
@ -1755,7 +1755,7 @@ hsMatrix44 plDynaDecalMgr::IL2WFromHit(hsPoint3 pos, hsVector3 dir) const
return l2w;
}
void plDynaDecalMgr::ICutoutCallback(const hsTArray<plCutoutPoly>& cutouts, hsBool hasWaterHeight, hsScalar waterHeight)
void plDynaDecalMgr::ICutoutCallback(const hsTArray<plCutoutPoly>& cutouts, hsBool hasWaterHeight, float waterHeight)
{
hsTArray<plCutoutHit> hits;

View File

@ -98,7 +98,7 @@ public:
double fLastTime;
hsPoint3 fLastPos;
double fWetTime;
hsScalar fWetLength;
float fWetLength;
uint32_t fFlags;
plDynaDecalInfo& Init(const plKey& key);
@ -150,31 +150,31 @@ protected:
hsTArray<plSceneObject*> fPartyObjects;
hsTArray<plParticleSystem*> fParticles;
hsScalar fPartyTime;
float fPartyTime;
uint16_t fMaxNumVerts;
uint16_t fMaxNumIdx;
uint32_t fWaitOnEnable;
hsScalar fWetLength;
hsScalar fRampEnd;
hsScalar fDecayStart;
hsScalar fLifeSpan;
hsScalar fIntensity;
float fWetLength;
float fRampEnd;
float fDecayStart;
float fLifeSpan;
float fIntensity;
hsScalar fGridSizeU;
hsScalar fGridSizeV;
float fGridSizeU;
float fGridSizeV;
hsVector3 fScale;
// some temp calculated stuff
hsScalar fInitAtten;
float fInitAtten;
// These 4 are in normalized units [0..1], not feet.
hsScalar fMinDepth;
hsScalar fMinDepthRange;
hsScalar fMaxDepth;
hsScalar fMaxDepthRange;
float fMinDepth;
float fMinDepthRange;
float fMaxDepth;
float fMaxDepthRange;
hsTArray<uint32_t> fPartIDs;
hsTArray<plKey> fNotifies;
@ -188,7 +188,7 @@ protected:
hsBool IWetParts(const plDynaDecalEnableMsg* enaMsg);
hsBool IWetPart(uint32_t id, const plDynaDecalEnableMsg* enaMsg);
void IWetInfo(plDynaDecalInfo& info, const plDynaDecalEnableMsg* enaMsg) const;
hsScalar IHowWet(plDynaDecalInfo& info, double t) const;
float IHowWet(plDynaDecalInfo& info, double t) const;
plDynaDecalInfo& IGetDecalInfo(uintptr_t id, const plKey& key);
void IRemoveDecalInfo(uint32_t id);
void IRemoveDecalInfos(const plKey& key);
@ -225,7 +225,7 @@ protected:
void ISetDepthFalloff(); // Sets from current cutter settings.
virtual void ICutoutCallback(const hsTArray<plCutoutPoly>& cutouts, hsBool hasWaterHeight=false, hsScalar waterHeight=0.f);
virtual void ICutoutCallback(const hsTArray<plCutoutPoly>& cutouts, hsBool hasWaterHeight=false, float waterHeight=0.f);
hsGMaterial* IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap);
@ -259,19 +259,19 @@ public:
void SetWaitOnEnable(hsBool on) { fWaitOnEnable = on; }
hsBool GetWaitOnEnable() const { return fWaitOnEnable; }
void SetWetLength(hsScalar f) { fWetLength = f; }
void SetRampEnd(hsScalar f) { fRampEnd = f; }
void SetDecayStart(hsScalar f) { fDecayStart = f; }
void SetLifeSpan(hsScalar f) { fLifeSpan = f; }
void SetIntensity(hsScalar f) { fIntensity = f; }
hsScalar GetWetLength() const { return fWetLength; }
hsScalar GetRampEnd() const { return fRampEnd; }
hsScalar GetDecayStart() const { return fDecayStart; }
hsScalar GetLifeSpan() const { return fLifeSpan; }
hsScalar GetIntensity() const { return fIntensity; }
void SetWetLength(float f) { fWetLength = f; }
void SetRampEnd(float f) { fRampEnd = f; }
void SetDecayStart(float f) { fDecayStart = f; }
void SetLifeSpan(float f) { fLifeSpan = f; }
void SetIntensity(float f) { fIntensity = f; }
float GetWetLength() const { return fWetLength; }
float GetRampEnd() const { return fRampEnd; }
float GetDecayStart() const { return fDecayStart; }
float GetLifeSpan() const { return fLifeSpan; }
float GetIntensity() const { return fIntensity; }
void SetPartyTime(hsScalar secs) { fPartyTime = secs; } // Duration of particle spewage
hsScalar GetPartyTime() const { return fPartyTime; }
void SetPartyTime(float secs) { fPartyTime = secs; } // Duration of particle spewage
float GetPartyTime() const { return fPartyTime; }
void ConvertToEnvMap(plBitmap* envMap);
const plMipmap* GetMipmap() const;

View File

@ -141,7 +141,7 @@ hsBool plDynaFootMgr::IPrintFromShape(const plPrintShape* shape, hsBool flip)
plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey());
double secs = hsTimer::GetSysSeconds();
hsScalar wetness = IHowWet(info, secs);
float wetness = IHowWet(info, secs);
fInitAtten = wetness;
if( wetness <= 0 )

View File

@ -92,7 +92,7 @@ int plDynaRippleMgr::INewDecal()
fDecals.Append(rip);
#else
plDynaWave* wave = TRACKED_NEW plDynaWave();
static hsScalar kDefScrollRate = 0.1f;
static float kDefScrollRate = 0.1f;
wave->fScrollRate = kDefScrollRate;
fDecals.Append(wave);
#endif
@ -186,10 +186,10 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force
const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld();
plConst(hsScalar) kMinDist(2.0f);
plConst(hsScalar) kMinTime(1.5f);
plConst(float) kMinDist(2.0f);
plConst(float) kMinTime(1.5f);
double t = hsTimer::GetSysSeconds();
hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne();
float dt = float(t - info.fLastTime) * sRand.RandZeroToOne();
hsBool longEnough = (dt >= kMinTime);
hsPoint3 xlate = shapeL2W.GetTranslate();
hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist);
@ -203,12 +203,12 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force
randPert.Normalize();
if( !farEnough )
{
plConst(hsScalar) kRandPert = 0.5f;
plConst(float) kRandPert = 0.5f;
randPert *= kRandPert;
}
else
{
plConst(hsScalar) kRandPert = 0.15f;
plConst(float) kRandPert = 0.15f;
randPert *= kRandPert;
}
pos += randPert;
@ -216,10 +216,10 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force
hsVector3 dir(0.f, 1.f, 0.f);
hsVector3 up(0.f, 0.f, 1.f);
plConst(hsScalar) kHeightScale = 1.f;
plConst(float) kHeightScale = 1.f;
pos.fZ += (shape->GetHeight() * fScale.fZ * kHeightScale) * 0.25f;
hsScalar wid = hsMaximum(shape->GetWidth(), shape->GetLength());
float wid = hsMaximum(shape->GetWidth(), shape->GetLength());
hsVector3 size(wid * fScale.fX, wid * fScale.fY, shape->GetHeight() * fScale.fZ * kHeightScale);
fCutter->SetLength(size);
fCutter->Set(pos, dir, up);

View File

@ -176,10 +176,10 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for
const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld();
plConst(hsScalar) kMinDist(2.0f);
plConst(hsScalar) kMinTime(1.5f);
plConst(float) kMinDist(2.0f);
plConst(float) kMinTime(1.5f);
double t = hsTimer::GetSysSeconds();
hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne();
float dt = float(t - info.fLastTime) * sRand.RandZeroToOne();
hsBool longEnough = (dt >= kMinTime);
hsPoint3 xlate = shapeL2W.GetTranslate();
hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist);
@ -193,18 +193,18 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for
randPert.Normalize();
if( !farEnough )
{
plConst(hsScalar) kRandPert = 0.5f;
plConst(float) kRandPert = 0.5f;
randPert *= kRandPert;
}
else
{
plConst(hsScalar) kRandPert = 0.15f;
plConst(float) kRandPert = 0.15f;
randPert *= kRandPert;
}
pos += randPert;
// Are we potentially touching the water?
hsScalar waterHeight = fWaveSetBase->GetHeight();
float waterHeight = fWaveSetBase->GetHeight();
if( (pos.fZ - fScale.fZ * shape->GetHeight() < waterHeight)
&&(pos.fZ + fScale.fZ * shape->GetHeight() > waterHeight) )
{
@ -212,9 +212,9 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for
hsVector3 dir(fWaveSetBase->GetWindDir());
hsVector3 up(0.f, 0.f, 1.f);
hsScalar wid = hsMaximum(shape->GetWidth(), shape->GetLength());
float wid = hsMaximum(shape->GetWidth(), shape->GetLength());
plConst(hsScalar) kMaxWaterDepth(1000.f);
plConst(float) kMaxWaterDepth(1000.f);
hsVector3 size(wid * fScale.fX, wid * fScale.fY, kMaxWaterDepth);
fCutter->SetLength(size);

View File

@ -78,7 +78,7 @@ void plDynaTorpedoMgr::Read(hsStream* stream, hsResMgr* mgr)
hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull)
{
hsScalar partyTime = fPartyTime;
float partyTime = fPartyTime;
plConst(int) kNumShots(3);
int i;
@ -87,8 +87,8 @@ hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull)
hsVector3 up = IRandomUp(bull->Dir());
hsVector3 pert = bull->Dir() % up;
plConst(hsScalar) kMaxPert(1.f);
hsScalar maxPert = i ? kMaxPert * bull->Radius() : 0;
plConst(float) kMaxPert(1.f);
float maxPert = i ? kMaxPert * bull->Radius() : 0;
pert *= sRand.RandMinusOneToOne() * maxPert * fScale.fX;
pert += up * (sRand.RandMinusOneToOne() * maxPert * fScale.fY);
@ -96,26 +96,26 @@ hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull)
hsPoint3 pos = bull->From() + bull->Dir() * (bull->Range() * 0.5f);
pos += pert;
hsScalar scaleX = bull->Radius() * fScale.fX * fInitUVW.fX;
hsScalar scaleY = bull->Radius() * fScale.fY * fInitUVW.fY;
float scaleX = bull->Radius() * fScale.fX * fInitUVW.fX;
float scaleY = bull->Radius() * fScale.fY * fInitUVW.fY;
#if 0
plConst(hsScalar) kMinScale(0.5f);
plConst(float) kMinScale(0.5f);
if( i )
{
scaleX *= sRand.RandRangeF(kMinScale, 1.f);
scaleY *= sRand.RandRangeF(kMinScale, 1.f);
}
#elif 0
hsScalar div = 1.f / (1.f + hsScalar(i));
float div = 1.f / (1.f + float(i));
scaleX *= div;
scaleY *= div;
#else
plConst(hsScalar) kMinScale(0.25f);
plConst(hsScalar) kMaxScale(0.75f);
plConst(float) kMinScale(0.25f);
plConst(float) kMaxScale(0.75f);
if( i )
{
hsScalar scale = sRand.RandRangeF(kMinScale, kMaxScale);
float scale = sRand.RandRangeF(kMinScale, kMaxScale);
scaleX *= scale;
scaleY *= scale;
}

View File

@ -140,7 +140,7 @@ hsVector3 plDynaWakeMgr::IGetDirection(const plDynaDecalInfo& info, const hsPoin
{
hsVector3 animDir;
hsPoint3 p = pos;
hsScalar t = fAnimPath->GetExtremePoint(p);
float t = fAnimPath->GetExtremePoint(p);
fAnimPath->SetCurTime(t, plAnimPath::kNone);
fAnimPath->GetVelocity(&animDir);
@ -151,8 +151,8 @@ hsVector3 plDynaWakeMgr::IGetDirection(const plDynaDecalInfo& info, const hsPoin
}
// Now if we want to factor in velocity, we can use (pos - info.fLastPos) / (hsTimer::GetSysSeconds() - info.fLastTime)
hsScalar dt = hsScalar(hsTimer::GetSysSeconds() - info.fLastTime);
const hsScalar kMinDt = 1.e-3f;
float dt = float(hsTimer::GetSysSeconds() - info.fLastTime);
const float kMinDt = 1.e-3f;
if( (info.fFlags & plDynaDecalInfo::kImmersed) && (dt > kMinDt) )
{
hsVector3 velDir(&pos, &info.fLastPos);
@ -177,10 +177,10 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force)
const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld();
static hsScalar kMinDist = 1.0f;
static hsScalar kMinTime = 0.25f;
static float kMinDist = 1.0f;
static float kMinTime = 0.25f;
double t = hsTimer::GetSysSeconds();
hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne();
float dt = float(t - info.fLastTime) * sRand.RandZeroToOne();
hsBool longEnough = (dt >= kMinTime);
hsPoint3 xlate = shapeL2W.GetTranslate();
hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist);
@ -197,19 +197,19 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force)
randPert.Normalize();
if( !farEnough )
{
static hsScalar kRandPert = 0.05f;
static float kRandPert = 0.05f;
randPert *= kRandPert * shape->GetWidth();
}
else
{
static hsScalar kRandPert = 0.05f;
static float kRandPert = 0.05f;
randPert *= kRandPert * shape->GetWidth();
}
pos += randPert;
hsVector3 up(0.f, 0.f, 1.f);
static hsScalar kHeightScale = 1.f;
static float kHeightScale = 1.f;
pos.fZ += (shape->GetHeight() * fScale.fZ * kHeightScale) * 0.25f;
pos += dir * shape->GetLength() * 0.5f * (1.f - fScale.fY);

View File

@ -54,8 +54,8 @@ protected:
hsVector3 fDefaultDir;
plAnimPath* fAnimPath;
hsScalar fAnimWgt;
hsScalar fVelWgt;
float fAnimWgt;
float fVelWgt;
virtual hsVector3 IGetDirection(const plDynaDecalInfo& info, const hsPoint3& pos) const;
@ -78,11 +78,11 @@ public:
void SetDefaultDir(const hsVector3& v);
const hsVector3& GetDefaultDir() const { return fDefaultDir; }
void SetAnimWeight(hsScalar f) { fAnimWgt = f; }
hsScalar GetAnimWeight() const { return fAnimWgt; }
void SetAnimWeight(float f) { fAnimWgt = f; }
float GetAnimWeight() const { return fAnimWgt; }
void SetVelocityWeight(hsScalar f) { fVelWgt = f; }
hsScalar GetVelocityWeight() const { return fVelWgt; }
void SetVelocityWeight(float f) { fVelWgt = f; }
float GetVelocityWeight() const { return fVelWgt; }
};

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsStream.h"
void plFixedWaterState7::WaveState::Set(const plFixedWaterState7::WaveState& w, hsScalar secs)
void plFixedWaterState7::WaveState::Set(const plFixedWaterState7::WaveState& w, float secs)
{
fMaxLength.Set(w.fMaxLength, secs);
fMinLength.Set(w.fMinLength, secs);
@ -54,7 +54,7 @@ void plFixedWaterState7::WaveState::Set(const plFixedWaterState7::WaveState& w,
fAngleDev.Set(w.fAngleDev, secs);
}
void plFixedWaterState7::Set(const plFixedWaterState7& t, hsScalar secs)
void plFixedWaterState7::Set(const plFixedWaterState7& t, float secs)
{
fWindDir.Set(t.fWindDir, secs);

View File

@ -55,13 +55,13 @@ public:
class WaveState
{
public:
plTimedSimple<hsScalar> fMaxLength;
plTimedSimple<hsScalar> fMinLength;
plTimedSimple<hsScalar> fAmpOverLen;
plTimedSimple<hsScalar> fChop;
plTimedSimple<hsScalar> fAngleDev;
plTimedSimple<float> fMaxLength;
plTimedSimple<float> fMinLength;
plTimedSimple<float> fAmpOverLen;
plTimedSimple<float> fChop;
plTimedSimple<float> fAngleDev;
void Set(const WaveState& w, hsScalar secs);
void Set(const WaveState& w, float secs);
void Read(hsStream* s);
void Write(hsStream* s) const;
@ -73,7 +73,7 @@ public:
// Texture waves
WaveState fTexState;
plTimedSimple<hsScalar> fRippleScale;
plTimedSimple<float> fRippleScale;
// Geometric and Texture share wind direction
plTimedCompound<hsVector3> fWindDir;
@ -89,7 +89,7 @@ public:
// Depth parameters. Affect how the depth of
// the water vertex is interpreted into water
// surface properties.
plTimedSimple<hsScalar> fWaterHeight;
plTimedSimple<float> fWaterHeight;
plTimedCompound<hsVector3> fWaterOffset;
plTimedCompound<hsVector3> fMaxAtten;
plTimedCompound<hsVector3> fMinAtten;
@ -98,17 +98,17 @@ public:
// Shore parameters
// Appearance
plTimedSimple<hsScalar> fWispiness;
plTimedSimple<float> fWispiness;
plTimedCompound<hsColorRGBA> fShoreTint;
// Next two only used in generation of bubble layer
plTimedCompound<hsColorRGBA> fMaxColor;
plTimedCompound<hsColorRGBA> fMinColor;
plTimedSimple<hsScalar> fEdgeOpac;
plTimedSimple<hsScalar> fEdgeRadius;
plTimedSimple<float> fEdgeOpac;
plTimedSimple<float> fEdgeRadius;
// Simulation
plTimedSimple<hsScalar> fPeriod;
plTimedSimple<hsScalar> fFingerLength;
plTimedSimple<float> fPeriod;
plTimedSimple<float> fFingerLength;
// The rest aren't really part of the state, that is they are normally controlled
// by something exterior to the state. They are included here to allow a convenient
@ -119,10 +119,10 @@ public:
plTimedCompound<hsColorRGBA> fSpecularTint;
plTimedCompound<hsPoint3> fEnvCenter;
plTimedSimple<hsScalar> fEnvRefresh;
plTimedSimple<hsScalar> fEnvRadius;
plTimedSimple<float> fEnvRefresh;
plTimedSimple<float> fEnvRadius;
void Set(const plFixedWaterState7& s, hsScalar secs);
void Set(const plFixedWaterState7& s, float secs);
void Read(hsStream* s);
void Write(hsStream* s) const;

View File

@ -121,7 +121,7 @@ hsBool plGeoSpanDice::IHalf(plGeometrySpan* src, hsTArray<plGeometrySpan*>& out,
if( iAxis < 0 )
return false;
hsScalar midPoint = src->fLocalBounds.GetCenter()[iAxis];
float midPoint = src->fLocalBounds.GetCenter()[iAxis];
hsTArray<uint32_t> loTris;
hsTArray<uint32_t> hiTris;
@ -170,7 +170,7 @@ hsBool plGeoSpanDice::IHalf(plGeometrySpan* src, hsTArray<plGeometrySpan*>& out,
int plGeoSpanDice::ISelectAxis(int exclAxis, plGeometrySpan* src) const
{
int iAxis = -1;
hsScalar maxDim = 0;
float maxDim = 0;
int i;
for( i = 0; i < 3; i++ )
@ -179,7 +179,7 @@ int plGeoSpanDice::ISelectAxis(int exclAxis, plGeometrySpan* src) const
if( exclAxis & (1 << i) )
continue;
hsScalar dim = src->fLocalBounds.GetMaxs()[i] - src->fLocalBounds.GetMins()[i];
float dim = src->fLocalBounds.GetMaxs()[i] - src->fLocalBounds.GetMins()[i];
if( dim > maxDim )
{
maxDim = dim;

View File

@ -1019,7 +1019,7 @@ void plGeometrySpan::AdjustBounds(hsBounds3Ext& bnd) const
hsBounds3Ext wBnd = bnd;
wBnd.Transform(&fLocalToWorld);
const hsScalar kMaxWaveHeight(5.f);
const float kMaxWaveHeight(5.f);
hsBounds3Ext rebound;
rebound.MakeEmpty();
hsPoint3 pos = wBnd.GetMins();

View File

@ -142,10 +142,10 @@ class plGeometrySpan
uint16_t fMaxBoneIdx;
uint32_t fPenBoneIdx;
hsScalar fMinDist;
hsScalar fMaxDist;
float fMinDist;
float fMaxDist;
hsScalar fWaterHeight;
float fWaterHeight;
uint8_t fFormat;
uint32_t fProps;

View File

@ -237,12 +237,12 @@ hsVector3& plInterMeshSmooth::GetNormal(plSpanHandle& set, uint16_t idx)
return set.fDrawable->CvtGetNormal(set.fSpanIdx, idx);
}
void plInterMeshSmooth::SetAngle(hsScalar degs)
void plInterMeshSmooth::SetAngle(float degs)
{
fMinNormDot = hsCosine(hsScalarDegToRad(degs));
fMinNormDot = cos(hsDegreesToRadians(degs));
}
hsScalar plInterMeshSmooth::GetAngle() const
float plInterMeshSmooth::GetAngle() const
{
return hsScalarRadToDeg(hsACosine(fMinNormDot));
return hsRadiansToDegrees(acos(fMinNormDot));
}

View File

@ -59,7 +59,7 @@ public:
class plInterMeshSmooth
{
protected:
hsScalar fMinNormDot;
float fMinNormDot;
void FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray<uint16_t>& edgeVerts);
void FindEdges(hsTArray<plSpanHandle>& sets, hsTArray<uint16_t>* edgeVerts);
@ -71,8 +71,8 @@ protected:
public:
plInterMeshSmooth() : fMinNormDot(0.25f) {}
void SetAngle(hsScalar degs);
hsScalar GetAngle() const; // returns degrees
void SetAngle(float degs);
float GetAngle() const; // returns degrees
void SmoothNormals(hsTArray<plSpanHandle>& sets);
};

View File

@ -53,7 +53,7 @@ plMorphArray::~plMorphArray()
// MorphArray - Apply
void plMorphArray::Apply(hsTArray<plAccessSpan>& dst, hsTArray<hsScalar>* weights /* = nil */) const
void plMorphArray::Apply(hsTArray<plAccessSpan>& dst, hsTArray<float>* weights /* = nil */) const
{
// Have our choice of cache thrashing here
// We can for each delta/for each vert

View File

@ -53,7 +53,7 @@ public:
plMorphArray();
virtual ~plMorphArray();
void Apply(hsTArray<plAccessSpan>& dst, hsTArray<hsScalar>* weights = nil) const;
void Apply(hsTArray<plAccessSpan>& dst, hsTArray<float>* weights = nil) const;
void Read(hsStream* s, hsResMgr* mgr);
void Write(hsStream* s, hsResMgr* mgr);
@ -62,8 +62,8 @@ public:
void AddDelta(const plMorphDelta& delta);
int GetNumDeltas() const { return fDeltas.GetCount(); }
hsScalar GetWeight(int iDel) { return fDeltas[iDel].GetWeight(); }
void SetWeight(int iDel, hsScalar w) { if( iDel < fDeltas.GetCount() )fDeltas[iDel].SetWeight(w); }
float GetWeight(int iDel) { return fDeltas[iDel].GetWeight(); }
void SetWeight(int iDel, float w) { if( iDel < fDeltas.GetCount() )fDeltas[iDel].SetWeight(w); }
};
#endif // plMorphArray_inc

View File

@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plTweak.h"
static const hsScalar kMinWeight = 1.e-2f;
static const float kMinWeight = 1.e-2f;
plMorphSpan::plMorphSpan()
: fUVWs(nil),
@ -91,7 +91,7 @@ plMorphDelta& plMorphDelta::operator=(const plMorphDelta& src)
return *this;
}
void plMorphDelta::Apply(hsTArray<plAccessSpan>& dst, hsScalar weight /* = -1.f */) const
void plMorphDelta::Apply(hsTArray<plAccessSpan>& dst, float weight /* = -1.f */) const
{
if( weight == -1.f)
weight = fWeight; // None passed in, use our stored value
@ -213,12 +213,12 @@ void plMorphDelta::ComputeDeltas(const hsTArray<plGeometrySpan*>& base, const hs
hsBool nonZero = false;
// These are actually min del SQUARED.
plConst(hsScalar) kMinDelPos(1.e-4f); // From Budtpueller's Handbook of Constants
plConst(hsScalar) kMinDelNorm(3.e-2f); // About 10 degrees
plConst(hsScalar) kMinDelUVW(1.e-4f); // From BHC
plConst(float) kMinDelPos(1.e-4f); // From Budtpueller's Handbook of Constants
plConst(float) kMinDelNorm(3.e-2f); // About 10 degrees
plConst(float) kMinDelUVW(1.e-4f); // From BHC
hsPoint3 mPos = d2b * *movedIter.Position();
hsVector3 delPos( &mPos, baseIter.Position());
hsScalar delPosSq = delPos.MagnitudeSquared();
float delPosSq = delPos.MagnitudeSquared();
if( delPosSq > kMinDelPos )
nonZero = true;
else
@ -226,7 +226,7 @@ void plMorphDelta::ComputeDeltas(const hsTArray<plGeometrySpan*>& base, const hs
hsVector3 delNorm = (d2bTInv * *movedIter.Normal()) - *baseIter.Normal();
hsScalar delNormSq = delNorm.MagnitudeSquared();
float delNormSq = delNorm.MagnitudeSquared();
if( delNormSq > kMinDelNorm )
nonZero = true;
else
@ -236,7 +236,7 @@ void plMorphDelta::ComputeDeltas(const hsTArray<plGeometrySpan*>& base, const hs
for( i = 0; i < numUVWs; i++ )
{
delUVWs[i] = *movedIter.UVW(i) - *baseIter.UVW(i);
hsScalar delUVWSq = delUVWs[i].MagnitudeSquared();
float delUVWSq = delUVWs[i].MagnitudeSquared();
if( delUVWSq > kMinDelUVW )
nonZero = true;
else

View File

@ -75,7 +75,7 @@ class plMorphDelta : public plCreatable
protected:
hsTArray<plMorphSpan> fSpans;
hsScalar fWeight;
float fWeight;
public:
plMorphDelta();
virtual ~plMorphDelta();
@ -86,10 +86,10 @@ public:
CLASSNAME_REGISTER( plMorphDelta );
GETINTERFACE_ANY( plMorphDelta, plCreatable );
void SetWeight(hsScalar w) { fWeight = w; }
hsScalar GetWeight() const { return fWeight; }
void SetWeight(float w) { fWeight = w; }
float GetWeight() const { return fWeight; }
void Apply(hsTArray<plAccessSpan>& dst, hsScalar weight = -1.f) const;
void Apply(hsTArray<plAccessSpan>& dst, float weight = -1.f) const;
void ComputeDeltas(const hsTArray<plAccessSpan>& base, const hsTArray<plAccessSpan>& moved);
void ComputeDeltas(const hsTArray<plGeometrySpan*>& base, const hsTArray<plGeometrySpan*>& moved, const hsMatrix44& d2b, const hsMatrix44& d2bTInv);

View File

@ -98,14 +98,14 @@ const uint32_t kChanMask = plAccessVtxSpan::kPositionMask
// that's what got loaded from disk.
// Use Access RW. That might already be handled in the customization stuff.
plConst(hsScalar) kMorphTime(0.5);
plConst(float) kMorphTime(0.5);
class plMorphTarget
{
public:
uint16_t fLayer;
uint16_t fDelta;
hsScalar fWeight;
float fWeight;
};
hsTArray<plMorphTarget> fTgtWgts;
@ -131,11 +131,11 @@ hsBool plMorphSequence::MsgReceive(plMessage* msg)
// Can always add it in later if desired.
if( fTgtWgts.GetCount() )
{
hsScalar delWgt = hsTimer::GetDelSysSeconds() / (kMorphTime > 0 ? kMorphTime : 1.e-3f);
float delWgt = hsTimer::GetDelSysSeconds() / (kMorphTime > 0 ? kMorphTime : 1.e-3f);
int i;
for( i = 0; i < fTgtWgts.GetCount(); i++ )
{
hsScalar currWgt = GetWeight(fTgtWgts[i].fLayer, fTgtWgts[i].fDelta);
float currWgt = GetWeight(fTgtWgts[i].fLayer, fTgtWgts[i].fDelta);
if( fTgtWgts[i].fWeight < currWgt )
{
if( fTgtWgts[i].fWeight >= (currWgt -= delWgt) )
@ -233,7 +233,7 @@ int plMorphSequence::GetNumDeltas(int iLay, plKey meshKey /* = nil */) const
return fSharedMeshes[index].fMesh->fMorphSet->fMorphs[iLay].GetNumDeltas();
}
hsScalar plMorphSequence::GetWeight(int iLay, int iDel, plKey meshKey /* = nil */) const
float plMorphSequence::GetWeight(int iLay, int iDel, plKey meshKey /* = nil */) const
{
int index = IFindSharedMeshIndex(meshKey);
if (index == -1)
@ -242,7 +242,7 @@ hsScalar plMorphSequence::GetWeight(int iLay, int iDel, plKey meshKey /* = nil *
return fSharedMeshes[index].fArrayWeights[iLay].fDeltaWeights[iDel];
}
void plMorphSequence::SetWeight(int iLay, int iDel, hsScalar w, plKey meshKey /* = nil */)
void plMorphSequence::SetWeight(int iLay, int iDel, float w, plKey meshKey /* = nil */)
{
int index = IFindSharedMeshIndex(meshKey);

View File

@ -54,7 +54,7 @@ class plMorphSequenceSDLMod;
class plMorphArrayWeights
{
public:
hsTArray<hsScalar> fDeltaWeights;
hsTArray<float> fDeltaWeights;
};
class plSharedMeshInfo
@ -121,7 +121,7 @@ protected:
const plDrawInterface* IGetDrawInterface() const;
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; }
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; }
void ISetHaveSnap(hsBool on) { if(on)fMorphFlags |= kHaveSnap; else fMorphFlags &= ~kHaveSnap; }
void ISetDirty(hsBool on);
@ -173,8 +173,8 @@ public:
void AddLayer(const plMorphArray& ma) { fMorphs.Append(ma); }
int GetNumDeltas(int iLay, plKey meshKey = nil) const;
hsScalar GetWeight(int iLay, int iDel, plKey meshKey = nil) const;
void SetWeight(int iLay, int iDel, hsScalar w, plKey meshKey = nil);
float GetWeight(int iLay, int iDel, plKey meshKey = nil) const;
void SetWeight(int iLay, int iDel, float w, plKey meshKey = nil);
hsBool GetHaveSnap() const { return 0 != (fMorphFlags & kHaveSnap); }
hsBool GetDirty() const { return 0 != (fMorphFlags & kDirty); }

View File

@ -169,8 +169,8 @@ void plMorphSequenceSDLMod::ISetCurrentStateFrom(const plStateDataRecord* srcSta
{
uint8_t weight;
weights->Get(&weight, j);
hsScalar posWeight = weight * 2.f / 255.f - 1.f;
hsScalar negWeight = 0;
float posWeight = weight * 2.f / 255.f - 1.f;
float negWeight = 0;
if (posWeight < 0)
{

View File

@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plParticleSystem/plParticleEmitter.h"
#include "plParticleSystem/plParticle.h"
static hsScalar sInvDelSecs;
static float sInvDelSecs;
//// Local Static Stuff ///////////////////////////////////////////////////////
@ -85,7 +85,7 @@ static hsScalar sInvDelSecs;
uint = dPtr[ 0 ]; ptr += sizeof( uint32_t ); }
static hsScalar sCurrMinWidth = 0;
static float sCurrMinWidth = 0;
///////////////////////////////////////////////////////////////////////////////
//// Particles ////////////////////////////////////////////////////////////////
@ -155,7 +155,7 @@ void inline IInlSetParticlePathStretch( const plParticleCore &particle, const hs
hsPoint3 xlate = viewToWorld.GetTranslate();
hsVector3 viewDir(&particle.fPos, &xlate);
hsScalar invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared());
float invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared());
viewDir *= invD;
zVec = viewDir;
@ -172,12 +172,12 @@ void inline IInlSetParticlePathStretch( const plParticleCore &particle, const hs
xVec = yVec % viewDir; // cross product of two orthonormal vectors, no need to normalize.
hsScalar xLen = particle.fHSize;
float xLen = particle.fHSize;
if( xLen * invD < sCurrMinWidth )
xLen = sCurrMinWidth / invD;
xVec *= xLen;
hsScalar len = yVec.InnerProduct(orientation);
float len = yVec.InnerProduct(orientation);
// Might want to give it a little boost to overlap itself (and compensate for the massive
// transparent border the artists love). But they can do that themselves with the VSize.
// len *= 1.5f;
@ -195,7 +195,7 @@ void inline IInlSetParticlePathFlow( const plParticleCore &particle, const hsMat
hsPoint3 xlate = viewToWorld.GetTranslate();
hsVector3 viewDir(&particle.fPos, &xlate);
hsScalar invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared());
float invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared());
viewDir *= invD;
zVec = viewDir;
@ -212,9 +212,9 @@ void inline IInlSetParticlePathFlow( const plParticleCore &particle, const hsMat
xVec = yVec % viewDir; // cross product of two orthonormal vectors, no need to normalize.
hsScalar len = yVec.InnerProduct(orientation);
float len = yVec.InnerProduct(orientation);
hsScalar xLen = particle.fHSize * hsFastMath::InvSqrtAppr(1.f + len * sInvDelSecs);
float xLen = particle.fHSize * hsFastMath::InvSqrtAppr(1.f + len * sInvDelSecs);
if( xLen * invD < sCurrMinWidth )
xLen = sCurrMinWidth / invD;
xVec *= xLen;

View File

@ -48,9 +48,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class plPrintShape : public plObjInterface
{
protected:
hsScalar fWidth;
hsScalar fLength;
hsScalar fHeight;
float fWidth;
float fLength;
float fHeight;
public:
plPrintShape();
virtual ~plPrintShape();
@ -65,13 +65,13 @@ public:
virtual void Read(hsStream* stream, hsResMgr* mgr);
virtual void Write(hsStream* stream, hsResMgr* mgr);
hsScalar GetWidth() const { return fWidth; }
hsScalar GetLength() const { return fLength; }
hsScalar GetHeight() const { return fHeight; }
float GetWidth() const { return fWidth; }
float GetLength() const { return fLength; }
float GetHeight() const { return fHeight; }
void SetWidth(hsScalar f) { fWidth = f; }
void SetLength(hsScalar f) { fLength = f; }
void SetHeight(hsScalar f) { fHeight = f; }
void SetWidth(float f) { fWidth = f; }
void SetLength(float f) { fLength = f; }
void SetHeight(float f) { fHeight = f; }
};
#endif // plPrintShape_inc

View File

@ -58,7 +58,7 @@ static hsTArray<plDrawableSpans*> fProxyDrawables;
static hsTArray<hsGMaterial*> fProxyMaterials;
static uint32_t fProxyKeyCounter = 0;
plProxyGen::plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, hsScalar opac)
plProxyGen::plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, float opac)
: fProxyMsgType(0),
fProxyDraw(nil),
fProxyMat(nil)
@ -153,7 +153,7 @@ hsGMaterial* plProxyGen::IMakeProxyMaterial() const
{
const hsColorRGBA& amb = fAmbient;
const hsColorRGBA& dif = fColor;
hsScalar opac = fAmbient.a;
float opac = fAmbient.a;
hsGMaterial* retVal = TRACKED_NEW hsGMaterial();

View File

@ -116,7 +116,7 @@ protected:
virtual void IRemoveProxy(uint32_t drawIdx) const;
virtual void IDestroyProxy();
public:
plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, hsScalar opac);
plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, float opac);
virtual ~plProxyGen();
virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l);

View File

@ -46,16 +46,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class plRipVSConsts
{
public:
hsScalar fC1U;
hsScalar fC2U;
hsScalar fC1V;
hsScalar fC2V;
float fC1U;
float fC2U;
float fC1V;
float fC2V;
hsScalar fInitAtten;
hsScalar fLife;
hsScalar fDecay;
float fInitAtten;
float fLife;
float fDecay;
hsScalar fRamp;
float fRamp;
};

View File

@ -172,7 +172,7 @@ void plSpaceTreeMaker::ISplitList(hsTArray<plSpacePrepNode*>& nodes, const hsVec
upper[i] = nodes[i + lowerCount];
}
hsBounds3Ext plSpaceTreeMaker::IFindDistToCenterAxis(hsTArray<plSpacePrepNode*>& nodes, hsScalar& length, hsVector3& axis)
hsBounds3Ext plSpaceTreeMaker::IFindDistToCenterAxis(hsTArray<plSpacePrepNode*>& nodes, float& length, hsVector3& axis)
{
hsBounds3Ext bnd;
bnd.MakeEmpty();
@ -189,14 +189,14 @@ hsBounds3Ext plSpaceTreeMaker::IFindDistToCenterAxis(hsTArray<plSpacePrepNode*>&
{
hsVector3 sep;
sep.Set(&bnd.GetCenter(), &nodes[i]->fWorldBounds.GetCenter());
hsScalar len = sep.MagnitudeSquared();
float len = sep.MagnitudeSquared();
if( len > length )
{
axis = sep;
length = len;
}
}
length = hsSquareRoot(length);
length = sqrt(length);
if( length > 1.e-3f )
axis /= length;
else
@ -231,7 +231,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeFatTreeRecur(hsTArray<plSpacePrepNode*>&
// Find the maximum length vector from nodes[i] center to list center.
// If that length is zero, just use the maximum dimension of overall bounds.
hsScalar length;
float length;
hsVector3 axis;
hsBounds3Ext bnd = IFindDistToCenterAxis(nodes, length, axis);
@ -249,7 +249,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeFatTreeRecur(hsTArray<plSpacePrepNode*>&
return subRoot;
}
hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray<plSpacePrepNode*>& nodes, hsScalar& length, hsVector3& axis)
hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray<plSpacePrepNode*>& nodes, float& length, hsVector3& axis)
{
hsBounds3Ext bnd;
bnd.MakeEmpty();
@ -258,7 +258,7 @@ hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray<plSpacePrepNode*>& nodes,
{
bnd.Union(&nodes[i]->fWorldBounds);
}
hsScalar maxLen = bnd.GetMaxs()[0] - bnd.GetMins()[0];
float maxLen = bnd.GetMaxs()[0] - bnd.GetMins()[0];
int maxAxis = 0;
if( bnd.GetMaxs()[1] - bnd.GetMins()[1] > maxLen )
@ -290,9 +290,9 @@ hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray<plSpacePrepNode*>& nodes,
return bnd;
}
void plSpaceTreeMaker::IFindBigList(hsTArray<plSpacePrepNode*>& nodes, hsScalar length, const hsVector3& axis, hsTArray<plSpacePrepNode*>& giants, hsTArray<plSpacePrepNode*>& strimps)
void plSpaceTreeMaker::IFindBigList(hsTArray<plSpacePrepNode*>& nodes, float length, const hsVector3& axis, hsTArray<plSpacePrepNode*>& giants, hsTArray<plSpacePrepNode*>& strimps)
{
const hsScalar kCutoffFrac = 0.5f;
const float kCutoffFrac = 0.5f;
giants.SetCount(0);
strimps.SetCount(0);
@ -332,7 +332,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeTreeRecur(hsTArray<plSpacePrepNode*>& no
StartTimer(kMakeTree);
// Find the maximum bounds dimension
hsScalar length;
float length;
hsVector3 axis;
hsBounds3Ext bnd = IFindSplitAxis(nodes, length, axis);
@ -487,7 +487,7 @@ void plSpaceTreeMaker::TestTree()
tree->SetViewPos(*hsPoint3().Set(0,0,0));
plConeIsect cone;
cone.SetAngle(hsScalarPI*0.25f);
cone.SetAngle(M_PI*0.25f);
cone.SetTransform(liX, invLiX);
StartTimer(kHarvestCone);
@ -498,7 +498,7 @@ void plSpaceTreeMaker::TestTree()
StopTimer(kHarvestCone);
plConeIsect capped;
capped.SetAngle(hsScalarPI*0.25f);
capped.SetAngle(M_PI*0.25f);
capped.SetLength(0.5f);
capped.SetTransform(liX, invLiX);

View File

@ -74,12 +74,12 @@ protected:
int16_t fTreeSize;
plSpacePrepNode* INewSubRoot(const hsBounds3Ext& bnd);
void IFindBigList(hsTArray<plSpacePrepNode*>& nodes, hsScalar length, const hsVector3& axis, hsTArray<plSpacePrepNode*>& giants, hsTArray<plSpacePrepNode*>& strimp);
void IFindBigList(hsTArray<plSpacePrepNode*>& nodes, float length, const hsVector3& axis, hsTArray<plSpacePrepNode*>& giants, hsTArray<plSpacePrepNode*>& strimp);
void ISortList(hsTArray<plSpacePrepNode*>& nodes, const hsVector3& axis);
void ISplitList(hsTArray<plSpacePrepNode*>& nodes, const hsVector3& axis, hsTArray<plSpacePrepNode*>& lower, hsTArray<plSpacePrepNode*>& upper);
hsBounds3Ext IFindDistToCenterAxis(hsTArray<plSpacePrepNode*>& nodes, hsScalar& length, hsVector3& axis);
hsBounds3Ext IFindDistToCenterAxis(hsTArray<plSpacePrepNode*>& nodes, float& length, hsVector3& axis);
plSpacePrepNode* IMakeFatTreeRecur(hsTArray<plSpacePrepNode*>& nodes);
hsBounds3Ext IFindSplitAxis(hsTArray<plSpacePrepNode*>& nodes, hsScalar& length, hsVector3& axis);
hsBounds3Ext IFindSplitAxis(hsTArray<plSpacePrepNode*>& nodes, float& length, hsVector3& axis);
plSpacePrepNode* IMakeTreeRecur(hsTArray<plSpacePrepNode*>& nodes);
void IMakeTree();

View File

@ -98,7 +98,7 @@ void plSpanInstance::Read(hsStream* stream, const plSpanEncoding& encoding, uint
{
Alloc(encoding, numVerts);
stream->Read(12 * sizeof(hsScalar), fL2W[0]);
stream->Read(12 * sizeof(float), fL2W[0]);
if( fPosDelta )
{
stream->Read(numVerts * PosStrideFromEncoding(encoding), fPosDelta);
@ -112,7 +112,7 @@ void plSpanInstance::Read(hsStream* stream, const plSpanEncoding& encoding, uint
void plSpanInstance::Write(hsStream* stream, const plSpanEncoding& encoding, uint32_t numVerts) const
{
stream->Write(12 * sizeof(hsScalar), fL2W[0]);
stream->Write(12 * sizeof(float), fL2W[0]);
if( fPosDelta )
{
stream->Write(numVerts * PosStrideFromEncoding(encoding), fPosDelta);

View File

@ -113,13 +113,13 @@ public:
};
uint32_t fCode;
hsScalar fPosScale;
float fPosScale;
plSpanEncoding() : fCode(kPosNone|kColNone), fPosScale(0) {}
plSpanEncoding(uint32_t c, hsScalar s) : fCode(c), fPosScale(s) {}
plSpanEncoding(uint32_t c, float s) : fCode(c), fPosScale(s) {}
uint32_t Code() const { return fCode; }
hsScalar Scale() const { return fPosScale; }
float Scale() const { return fPosScale; }
void Read(hsStream* s);
void Write(hsStream* s) const;
@ -131,7 +131,7 @@ protected:
uint8_t* fPosDelta;
uint8_t* fCol;
hsScalar fL2W[3][4];
float fL2W[3][4];
friend class plSpanInstanceIter;
public:

View File

@ -74,7 +74,7 @@ uint32_t plSpanTemplate::CalcStride()
if( NumUVWs() )
fStride += (uint8_t)(sizeof(hsPoint3) * NumUVWs());
if( NumWeights() )
fStride += (uint8_t)(sizeof(hsScalar) * NumWeights());
fStride += (uint8_t)(sizeof(float) * NumWeights());
return uint32_t(fStride);
}

View File

@ -140,7 +140,7 @@ public:
uint8_t PositionOffset() const { return uint8_t(0); }
uint8_t WgtIdxOffset() const { return uint8_t(PositionOffset() + NumPos() * sizeof(hsPoint3)); }
uint8_t WeightOffset() const { return uint8_t(WgtIdxOffset() + NumWgtIdx() * sizeof(uint32_t)); }
uint8_t NormalOffset() const { return uint8_t(WeightOffset() + NumWeights() * sizeof(hsScalar)); }
uint8_t NormalOffset() const { return uint8_t(WeightOffset() + NumWeights() * sizeof(float)); }
uint8_t ColorOffset() const { return uint8_t(NormalOffset() + NumNorm() * sizeof(hsVector3)); }
uint8_t Color2Offset() const { return uint8_t(ColorOffset() + NumColor() * sizeof(uint32_t)); }
uint8_t UVWOffset() const { return uint8_t(Color2Offset() + NumColor2() * sizeof(uint32_t)); }
@ -160,7 +160,7 @@ public:
uint32_t* Color2(int i) const { return (uint32_t*)GetData(kColor2, i); }
uint32_t* WgtIdx(int i) const { return (uint32_t*)GetData(kWgtIdx, i); }
hsPoint3* UVWs(int iv, int iuv) const { return (hsPoint3*)GetData(kUVW, iv, iuv); }
hsScalar* Weight(int iv, int iw) const { return (hsScalar*)GetData(kWeight, iv, iw); }
float* Weight(int iv, int iw) const { return (float*)GetData(kWeight, iv, iw); }
uint8_t* GetData(Channel chan, int i, int j=0) const
{
@ -173,33 +173,33 @@ public:
case kWeight:
return base
+ NumPos() * sizeof(hsPoint3)
+ j * sizeof(hsScalar);
+ j * sizeof(float);
case kWgtIdx:
return base
+ NumPos() * sizeof(hsPoint3)
+ NumWeights() * sizeof(hsScalar);
+ NumWeights() * sizeof(float);
case kNormal:
return base
+ NumPos() * sizeof(hsPoint3)
+ NumWeights() * sizeof(hsScalar)
+ NumWeights() * sizeof(float)
+ NumWgtIdx() * sizeof(uint32_t);
case kColor:
return base
+ NumPos() * sizeof(hsPoint3)
+ NumWeights() * sizeof(hsScalar)
+ NumWeights() * sizeof(float)
+ NumWgtIdx() * sizeof(uint32_t)
+ NumNorm() * sizeof(hsVector3);
case kColor2:
return base
+ NumPos() * sizeof(hsPoint3)
+ NumWeights() * sizeof(hsScalar)
+ NumWeights() * sizeof(float)
+ NumWgtIdx() * sizeof(uint32_t)
+ NumNorm() * sizeof(hsVector3)
+ NumColor() * sizeof(uint32_t);
case kUVW:
return base
+ NumPos() * sizeof(hsPoint3)
+ NumWeights() * sizeof(hsScalar)
+ NumWeights() * sizeof(float)
+ NumWgtIdx() * sizeof(uint32_t)
+ NumNorm() * sizeof(hsVector3)
+ NumColor() * sizeof(uint32_t)

View File

@ -172,11 +172,11 @@ void plSpan::RemovePermaLight(plLightInfo* li, hsBool proj)
//// AddLight ////////////////////////////////////////////////////////////////
// Smart function for maintaining the sorted list of lights for a plSpan.
void plSpan::AddLight( plLightInfo *li, hsScalar strength, hsScalar scale, hsBool proj ) const
void plSpan::AddLight( plLightInfo *li, float strength, float scale, hsBool proj ) const
{
hsTArray<plLightInfo*>& lights = proj ? fProjectors : fLights;
hsTArray<hsScalar>& strengths = proj ? fProjStrengths : fLightStrengths;
hsTArray<hsScalar>& scales = proj ? fProjScales : fLightScales;
hsTArray<float>& strengths = proj ? fProjStrengths : fLightStrengths;
hsTArray<float>& scales = proj ? fProjScales : fLightScales;
int i;
@ -187,7 +187,7 @@ void plSpan::AddLight( plLightInfo *li, hsScalar strength, hsScalar scale, hs
}
lights.Insert(i, li);
strengths.Insert(i, strength);
scales.Insert(i, hsScalar(uint32_t(scale * 127.9f)) / 127.f);
scales.Insert(i, float(uint32_t(scale * 127.9f)) / 127.f);
}
void plSpan::ClearLights() const
@ -266,14 +266,14 @@ hsBool plSpan::CanMergeInto( plSpan *other )
{
if( !HSMemory::EqualBlocks(fLights.AcquireArray(), other->fLights.AcquireArray(), fLights.GetCount() * sizeof(plLightInfo*)) )
return false;
if( !HSMemory::EqualBlocks(fLightScales.AcquireArray(), other->fLightScales.AcquireArray(), fLights.GetCount() * sizeof(hsScalar)) )
if( !HSMemory::EqualBlocks(fLightScales.AcquireArray(), other->fLightScales.AcquireArray(), fLights.GetCount() * sizeof(float)) )
return false;
}
if( fProjectors.GetCount() )
{
if( !HSMemory::EqualBlocks(fProjectors.AcquireArray(), other->fProjectors.AcquireArray(), fProjectors.GetCount() * sizeof(plLightInfo*)) )
return false;
if( !HSMemory::EqualBlocks(fProjScales.AcquireArray(), other->fProjScales.AcquireArray(), fProjectors.GetCount() * sizeof(hsScalar)) )
if( !HSMemory::EqualBlocks(fProjScales.AcquireArray(), other->fProjScales.AcquireArray(), fProjectors.GetCount() * sizeof(float)) )
return false;
}

View File

@ -137,10 +137,10 @@ class plSpan
plFogEnvironment *fFogEnvironment;
// Use setter/getters below.
hsScalar fMinDist;
hsScalar fMaxDist;
float fMinDist;
float fMaxDist;
hsScalar fWaterHeight;
float fWaterHeight;
hsBitVector fVisSet;
hsBitVector fVisNot;
@ -149,11 +149,11 @@ class plSpan
// mutable hsBitVector fLightBits;
mutable hsTArray<plLightInfo*> fLights;
mutable hsTArray<hsScalar> fLightStrengths;
mutable hsTArray<hsScalar> fLightScales;
mutable hsTArray<float> fLightStrengths;
mutable hsTArray<float> fLightScales;
mutable hsTArray<plLightInfo*> fProjectors;
mutable hsTArray<hsScalar> fProjStrengths;
mutable hsTArray<hsScalar> fProjScales;
mutable hsTArray<float> fProjStrengths;
mutable hsTArray<float> fProjScales;
mutable hsBitVector fShadowBits;
mutable hsBitVector fShadowSlaveBits;
@ -177,14 +177,14 @@ class plSpan
hsBool IsShadowBitSet(uint32_t idx) const { return fShadowBits.IsBitSet(idx); }
void ClearLights() const;
void AddLight( plLightInfo* li, hsScalar strength, hsScalar scale, hsBool proj ) const;
void AddLight( plLightInfo* li, float strength, float scale, hsBool proj ) const;
hsTArray<plLightInfo*>& GetLightList(hsBool proj) const { return proj ? fProjectors : fLights; }
uint32_t GetNumLights(hsBool proj) const { return proj ? fProjectors.GetCount() : fLights.GetCount(); }
plLightInfo* GetLight(int i, hsBool proj) const { return proj ? fProjectors[i] : fLights[i]; }
hsScalar GetLightStrength(int i, hsBool proj) const { return proj ? fProjStrengths[i] : fLightStrengths[i]; }
hsScalar GetLightScale(int i, hsBool proj) const { return proj ? fProjScales[i] : fLightScales[i]; }
float GetLightStrength(int i, hsBool proj) const { return proj ? fProjStrengths[i] : fLightStrengths[i]; }
float GetLightScale(int i, hsBool proj) const { return proj ? fProjScales[i] : fLightScales[i]; }
void AddPermaLight(plLightInfo* li, hsBool proj);
void RemovePermaLight(plLightInfo* li, hsBool proj);
@ -206,10 +206,10 @@ class plSpan
virtual void MergeInto( plSpan* other );
virtual void Destroy( void );
void SetMinDist(hsScalar minDist) { fMinDist = minDist; }
void SetMaxDist(hsScalar maxDist) { fMaxDist = maxDist; }
hsScalar GetMinDist() const { return fMinDist; }
hsScalar GetMaxDist() const { return fMaxDist; }
void SetMinDist(float minDist) { fMinDist = minDist; }
void SetMaxDist(float maxDist) { fMaxDist = maxDist; }
float GetMinDist() const { return fMinDist; }
float GetMaxDist() const { return fMaxDist; }
};
//// plVertexSpan Definition

View File

@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Requires class T to have the following members
// T& operator+=(const class T& t);
// T& operator-=(const class T& t);
// T& operator*=(hsScalar scale);
// T& operator*=(float scale);
// T& operator=(const class T&); // unless builtin = is adequate.
//
template <class T> class plTimedInterp
@ -72,7 +72,7 @@ protected:
const T& IEnd();
const T& IBegin();
const T& IEval(hsScalar parm);
const T& IEval(float parm);
public:
plTimedInterp();
plTimedInterp(const T& t);
@ -110,7 +110,7 @@ plTimedInterp<T>::Update(double t)
if( fDuration <= 0 )
return IEnd();
hsScalar parm = hsScalar((fEnd - t) / fDuration);
float parm = float((fEnd - t) / fDuration);
if( parm <= 0 )
return IEnd();
else if( parm >= 1.f )
@ -150,7 +150,7 @@ plTimedInterp<T>::IBegin()
template <class T>
const T&
plTimedInterp<T>::IEval(hsScalar parm)
plTimedInterp<T>::IEval(float parm)
{
fCurr = fInit;
fCurr -= fTarg;

View File

@ -84,7 +84,7 @@ hsBool plVisLOSMgr::ICheckSpaceTreeRecur(plSpaceTree* space, int which, hsTArray
if( node.fFlags & plSpaceTreeNode::kDisabled )
return false;
hsScalar closest;
float closest;
// If it's a hit
if( ICheckBound(node.fWorldBounds, closest) )
{
@ -149,7 +149,7 @@ hsBool plVisLOSMgr::ISetup(const hsPoint3& pStart, const hsPoint3& pEnd)
fMaxDist = hsVector3(&fCurrTarg, &fCurrFrom).Magnitude();
const hsScalar kMinMaxDist(0);
const float kMinMaxDist(0);
return fMaxDist > kMinMaxDist;
}
@ -263,7 +263,7 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit&
hsPoint3 currTarg = src.GetWorldToLocal() * fCurrTarg;
hsVector3 currDir(&currTarg, &currFrom);
hsScalar maxDist = currDir.Magnitude();
float maxDist = currDir.Magnitude();
currDir /= maxDist;
@ -272,9 +272,9 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit&
{
// Project the current ray onto the tri plane
hsVector3 norm = hsVector3(&tri.Position(1), &tri.Position(0)) % hsVector3(&tri.Position(2), &tri.Position(0));
hsScalar dotNorm = norm.InnerProduct(currDir);
float dotNorm = norm.InnerProduct(currDir);
const hsScalar kMinDotNorm = 1.e-3f;
const float kMinDotNorm = 1.e-3f;
if( dotNorm >= -kMinDotNorm )
{
if( !twoSided )
@ -282,7 +282,7 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit&
if( dotNorm <= kMinDotNorm )
continue;
}
hsScalar dist = hsVector3(&tri.Position(0), &currFrom).InnerProduct(norm);
float dist = hsVector3(&tri.Position(0), &currFrom).InnerProduct(norm);
if( dist > 0 )
continue;
dist /= dotNorm;
@ -295,13 +295,13 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit&
// Find the 3 cross products (v[i+1]-v[i]) X (proj - v[i]) dotted with current ray
hsVector3 cross0 = hsVector3(&tri.Position(1), &tri.Position(0)) % hsVector3(&projPt, &tri.Position(0));
hsScalar dot0 = cross0.InnerProduct(currDir);
float dot0 = cross0.InnerProduct(currDir);
hsVector3 cross1 = hsVector3(&tri.Position(2), &tri.Position(1)) % hsVector3(&projPt, &tri.Position(1));
hsScalar dot1 = cross1.InnerProduct(currDir);
float dot1 = cross1.InnerProduct(currDir);
hsVector3 cross2 = hsVector3(&tri.Position(0), &tri.Position(2)) % hsVector3(&projPt, &tri.Position(2));
hsScalar dot2 = cross2.InnerProduct(currDir);
float dot2 = cross2.InnerProduct(currDir);
// If all 3 are negative, projPt is a hit
// If all 3 are positive and we're two sided, projPt is a hit
@ -330,7 +330,7 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit&
return retVal;
}
hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest)
hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, float& closest)
{
if( bnd.GetType() != kBoundsNormal )
return false;
@ -360,7 +360,7 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest)
const hsPoint3& currTarg = fCurrTarg;
hsVector3 currDir(&currTarg, &currFrom);
const hsScalar maxDistSq = currDir.MagnitudeSquared();
const float maxDistSq = currDir.MagnitudeSquared();
currDir *= hsFastMath::InvSqrt(maxDistSq);
@ -374,14 +374,14 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest)
// Project the current ray onto the tri plane
hsVector3 norm = hsVector3(&p1, &p0) % hsVector3(&p2, &p0);
hsScalar dotNorm = norm.InnerProduct(currDir);
float dotNorm = norm.InnerProduct(currDir);
const hsScalar kMinDotNorm = 1.e-3f;
const float kMinDotNorm = 1.e-3f;
if( dotNorm >= -kMinDotNorm )
{
continue;
}
hsScalar dist = hsVector3(&p0, &currFrom).InnerProduct(norm);
float dist = hsVector3(&p0, &currFrom).InnerProduct(norm);
if( dist >= 0 )
continue;
dist /= dotNorm;
@ -395,16 +395,16 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest)
// Find the 3 cross products (v[i+1]-v[i]) X (proj - v[i]) dotted with current ray
hsVector3 cross0 = hsVector3(&p1, &p0) % hsVector3(&projPt, &p0);
hsScalar dot0 = cross0.InnerProduct(currDir);
float dot0 = cross0.InnerProduct(currDir);
hsVector3 cross1 = hsVector3(&p2, &p1) % hsVector3(&projPt, &p1);
hsScalar dot1 = cross1.InnerProduct(currDir);
float dot1 = cross1.InnerProduct(currDir);
hsVector3 cross2 = hsVector3(&p3, &p2) % hsVector3(&projPt, &p2);
hsScalar dot2 = cross2.InnerProduct(currDir);
float dot2 = cross2.InnerProduct(currDir);
hsVector3 cross3 = hsVector3(&p0, &p3) % hsVector3(&projPt, &p3);
hsScalar dot3 = cross3.InnerProduct(currDir);
float dot3 = cross3.InnerProduct(currDir);
// If all 4 are negative, projPt is a hit
if( (dot0 <= 0) && (dot1 <= 0) && (dot2 <= 0) && (dot3 <= 0) )
@ -422,7 +422,7 @@ hsBool plVisLOSMgr::CursorCheck(plVisHit& hit)
int32_t sy= int32_t(plMouseDevice::Instance()->GetCursorY() * fPipe->Height());
hsPoint3 from = fPipe->GetViewPositionWorld();
plConst(hsScalar) dist(1.e5f);
plConst(float) dist(1.e5f);
hsPoint3 targ;
fPipe->ScreenToWorldPoint(1, 0, &sx, &sy, dist, 0, &targ);

View File

@ -65,7 +65,7 @@ class plSpaceHit
{
public:
int fIdx;
hsScalar fClosest;
float fClosest;
};
class plVisLOSMgr
@ -74,13 +74,13 @@ protected:
plPageTreeMgr* fPageMgr;
plPipeline* fPipe;
hsScalar fMaxDist;
float fMaxDist;
hsPoint3 fCurrFrom;
hsPoint3 fCurrTarg;
hsBool ISetup(const hsPoint3& pStart, const hsPoint3& pEnd);
hsBool ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest);
hsBool ICheckBound(const hsBounds3Ext& bnd, float& closest);
hsBool ICheckSpaceTreeRecur(plSpaceTree* space, int which, hsTArray<plSpaceHit>& hits);
hsBool ICheckSpaceTree(plSpaceTree* space, hsTArray<plSpaceHit>& hits);
hsBool ICheckSceneNode(plSceneNode* node, plVisHit& hit);

View File

@ -115,29 +115,29 @@ using namespace plShaderID;
// #define TEST_UVWS
static const hsScalar kPiOverTwo = hsScalarPI * 0.5f;
static const float kPiOverTwo = M_PI * 0.5f;
static const hsScalar kGravConst = 30.f;
static const float kGravConst = 30.f;
static const hsScalar kOOEightNsqPI = 1.f / (8.f * hsScalarPI * 4.f * 4.f);
static hsScalar currOOEightNsqPI = kOOEightNsqPI;
static const float kOOEightNsqPI = 1.f / (8.f * M_PI * 4.f * 4.f);
static float currOOEightNsqPI = kOOEightNsqPI;
static inline hsScalar FreqToLen(hsScalar f) { return 2.f * hsScalarPI / f; }
static inline hsScalar LenToFreq(hsScalar l) { return 2.f * hsScalarPI / l; }
static inline float FreqToLen(float f) { return 2.f * M_PI / f; }
static inline float LenToFreq(float l) { return 2.f * M_PI / l; }
static inline hsScalar MPH2FPS(hsScalar f) { return f * 5280.f / 3600.f; }
static inline hsScalar FPS2MPH(hsScalar f) { return f / 5280.f * 3600.f; }
static inline float MPH2FPS(float f) { return f * 5280.f / 3600.f; }
static inline float FPS2MPH(float f) { return f / 5280.f * 3600.f; }
plCONST(hsScalar) kTimeClamp(0.3f);
plCONST(float) kTimeClamp(0.3f);
inline void plWorldWave7::Accumulate(hsPoint3& accumPos, hsVector3& accumNorm) const
{
hsScalar dist = accumPos.fX * fDir.fX + accumPos.fY * fDir.fY;
float dist = accumPos.fX * fDir.fX + accumPos.fY * fDir.fY;
dist *= fFreq;
dist += fPhase;
hsScalar s, c;
float s, c;
hsFastMath::SinCosAppr(dist, s, c);
// s += 1.f;
@ -153,11 +153,11 @@ inline void plWorldWave7::Accumulate(hsPoint3& accumPos, hsVector3& accumNorm) c
}
#ifndef PLASMA_EXTERNAL_RELEASE
inline void plWaveSet7::GraphLen(hsScalar len) const
inline void plWaveSet7::GraphLen(float len) const
{
if( fStatusGraph )
{
hsScalar maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale;
float maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale;
int32_t val = int32_t(len / maxLen * 100.f);
fStatusGraph->AddData(val);
}
@ -226,7 +226,7 @@ void plWaveSet7::StopLog()
fStatusLog = nil;
}
#else // PLASMA_EXTERNAL_RELEASE
inline void plWaveSet7::GraphLen(hsScalar len) const
inline void plWaveSet7::GraphLen(float len) const
{
}
@ -456,7 +456,7 @@ hsBool plWaveSet7::MsgReceive(plMessage* msg)
}
}
hsScalar dt = update->DelSeconds();
float dt = update->DelSeconds();
if( dt > kTimeClamp )
dt = kTimeClamp;
@ -474,7 +474,7 @@ hsBool plWaveSet7::MsgReceive(plMessage* msg)
fCurrTime = hsTimer::GetSysSeconds();
// Can't just use GetDelSysSeconds() or else we lose time if we skip a frame render because of high FPS.
hsScalar dt = fLastTime > 0 ? hsScalar(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds();
float dt = fLastTime > 0 ? float(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds();
if( dt > kTimeClamp )
dt = kTimeClamp;
@ -753,7 +753,7 @@ hsBool plWaveSet7::IOnRemove(plGenRefMsg* refMsg)
return false;
}
void plWaveSet7::SetState(const plFixedWaterState7& state, hsScalar dur)
void plWaveSet7::SetState(const plFixedWaterState7& state, float dur)
{
fState.Set(state, dur);
@ -764,7 +764,7 @@ void plWaveSet7::SetState(const plFixedWaterState7& state, hsScalar dur)
}
}
void plWaveSet7::IUpdateWaves(hsScalar dt)
void plWaveSet7::IUpdateWaves(float dt)
{
ITransition(dt);
ITransTex(dt);
@ -786,9 +786,9 @@ void plWaveSet7::IUpdateWaves(hsScalar dt)
}
// return true if we've finished this transition.
hsBool plWaveSet7::ITransContinue(hsScalar dt)
hsBool plWaveSet7::ITransContinue(float dt)
{
hsScalar currFade = (fFreqMod[fTransistor] += fTransDel * dt);
float currFade = (fFreqMod[fTransistor] += fTransDel * dt);
if( currFade <= 0 )
{
@ -814,24 +814,24 @@ hsBool plWaveSet7::ITransContinue(hsScalar dt)
return false;
}
void plWaveSet7::IStartTransition(hsScalar dt)
void plWaveSet7::IStartTransition(float dt)
{
// select the next wave for transitioning
if( ++fTransistor >= kNumWaves )
fTransistor = 0;
// set the transFade to be fading down.
plCONST(hsScalar) kTransDel(0.5f);
plCONST(float) kTransDel(0.5f);
fTransDel = -kTransDel;
}
hsScalar plWaveSet7::ITransitionDelay() const
float plWaveSet7::ITransitionDelay() const
{
plCONST(hsScalar) kTransDelay(2.f);
plCONST(float) kTransDelay(2.f);
return kTransDelay;
}
void plWaveSet7::ITransition(hsScalar dt)
void plWaveSet7::ITransition(float dt)
{
// If we're in a transition, keep transitioning till it's done.
if( fTransDel != 0 )
@ -847,9 +847,9 @@ void plWaveSet7::ITransition(hsScalar dt)
}
hsBool plWaveSet7::ITransTexContinue(hsScalar dt)
hsBool plWaveSet7::ITransTexContinue(float dt)
{
hsScalar currFade = (fTexWaveFade[fTexTrans] += fTexTransDel * dt);
float currFade = (fTexWaveFade[fTexTrans] += fTexTransDel * dt);
if( currFade <= 0 )
{
@ -875,22 +875,22 @@ hsBool plWaveSet7::ITransTexContinue(hsScalar dt)
return false;
}
void plWaveSet7::IStartTexTransition(hsScalar dt)
void plWaveSet7::IStartTexTransition(float dt)
{
if( ++fTexTrans >= kNumTexWaves )
fTexTrans = 0;
plConst(hsScalar) kTexTransDel(4.f);
plConst(float) kTexTransDel(4.f);
fTexTransDel = -kTexTransDel;
}
void plWaveSet7::ITransTex(hsScalar dt)
void plWaveSet7::ITransTex(float dt)
{
// If we're in a transition, keep with it.
if( fTexTransDel != 0 )
{
plConst(hsScalar) kTexTransDelay(0);
plConst(float) kTexTransDelay(0);
if( ITransTexContinue(dt) )
fTexTransCountDown = kTexTransDelay;
}
@ -905,20 +905,20 @@ void plWaveSet7::ICalcScale()
{
}
void plWaveSet7::IUpdateWave(hsScalar dt, int i)
void plWaveSet7::IUpdateWave(float dt, int i)
{
plWorldWave7& wave = fWorldWaves[i];
hsScalar len = FreqToLen(wave.fFreq);
float len = FreqToLen(wave.fFreq);
hsScalar speed = hsFastMath::InvSqrtAppr(len / (2.f * hsScalarPI * kGravConst));
float speed = hsFastMath::InvSqrtAppr(len / (2.f * M_PI * kGravConst));
static hsScalar speedHack = 1.f;
static float speedHack = 1.f;
speed *= speedHack;
wave.fPhase += speed * dt;
// wave.fPhase = fmod( speed * t, 2.f * hsScalarPI);
// wave.fPhase = fmod( speed * t, 2.f * M_PI);
hsScalar amp = GeoState().fAmpOverLen * len / hsScalar(kNumWaves);
float amp = GeoState().fAmpOverLen * len / float(kNumWaves);
amp *= fFreqMod[i] * fFreqScale;
@ -945,7 +945,7 @@ void plWaveSet7::IInitWave(int i)
wave.fLength = GeoState().fMinLength + fRand.RandZeroToOne() * (GeoState().fMaxLength - GeoState().fMinLength);
hsScalar len = wave.fLength;
float len = wave.fLength;
wave.fFreq = LenToFreq(len);
@ -956,18 +956,18 @@ void plWaveSet7::IInitWave(int i)
// Figure out the direction based on wind direction.
// Even waves go in the wind direction,
// odd waves go opposite direction
plConst(hsScalar) kMinRotDeg(15.f);
plConst(hsScalar) kMaxRotDeg(180.f);
plConst(float) kMinRotDeg(15.f);
plConst(float) kMaxRotDeg(180.f);
hsVector3 dir = fWindDir;
hsScalar rotBase = GeoState().fAngleDev;
float rotBase = GeoState().fAngleDev;
hsScalar rads = rotBase * fRand.RandMinusOneToOne();
hsScalar rx = hsScalar(cosf(rads));
hsScalar ry = hsScalar(sinf(rads));
float rads = rotBase * fRand.RandMinusOneToOne();
float rx = float(cosf(rads));
float ry = float(sinf(rads));
hsScalar x = dir.fX;
hsScalar y = dir.fY;
float x = dir.fX;
float y = dir.fY;
dir.fX = x * rx + y * ry;
dir.fY = x * -ry + y * rx;
@ -985,7 +985,7 @@ inline void plWaveSet7::IScrunch(hsPoint3& pos, hsVector3& norm) const
hsFastMath::NormalizeAppr(norm);
}
hsScalar plWaveSet7::EvalPoint(hsPoint3& pos, hsVector3& norm)
float plWaveSet7::EvalPoint(hsPoint3& pos, hsVector3& norm)
{
hsPoint3 accumPos;
hsVector3 accumNorm;
@ -1003,7 +1003,7 @@ hsScalar plWaveSet7::EvalPoint(hsPoint3& pos, hsVector3& norm)
IScrunch(accumPos, accumNorm);
// Project original pos along Z onto the plane tangent at accumPos with norm accumNorm
hsScalar t = hsVector3(&accumPos, &pos).InnerProduct(accumNorm);
float t = hsVector3(&accumPos, &pos).InnerProduct(accumNorm);
t /= accumNorm.fZ;
pos.fZ += t;
@ -1013,7 +1013,7 @@ hsScalar plWaveSet7::EvalPoint(hsPoint3& pos, hsVector3& norm)
return pos.fZ;
}
void plWaveSet7::IUpdateWindDir(hsScalar dt)
void plWaveSet7::IUpdateWindDir(float dt)
{
fWindDir = -State().fWindDir;
hsFastMath::NormalizeAppr(fWindDir);
@ -1025,10 +1025,10 @@ void plWaveSet7::IUpdateRefObject()
{
hsMatrix44 l2w = fRefObj->GetLocalToWorld();
hsScalar h = l2w.fMap[2][3];
float h = l2w.fMap[2][3];
hsScalar x = -l2w.fMap[0][1];
hsScalar y = -l2w.fMap[1][1];
float x = -l2w.fMap[0][1];
float y = -l2w.fMap[1][1];
fState.fWaterHeight = h;
@ -1036,7 +1036,7 @@ void plWaveSet7::IUpdateRefObject()
}
}
void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so)
void plWaveSet7::IFloatBuoy(float dt, plSceneObject* so)
{
// Compute force based on world bounds
hsBounds3Ext wBnd = so->GetDrawInterface()->GetWorldBounds();
@ -1052,8 +1052,8 @@ void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so)
// (in an approximation lazy hackish way).
hsPoint2 boxDepth;
wBnd.TestPlane(surfNorm, boxDepth);
hsScalar surfDepth = surfNorm.InnerProduct(surfPos);
hsScalar depth = surfDepth - boxDepth.fX;
float surfDepth = surfNorm.InnerProduct(surfPos);
float depth = surfDepth - boxDepth.fX;
if( depth < 0 )
return;
@ -1063,12 +1063,12 @@ void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so)
// We really want the cross section area as facing into the water,
// but life is full of little disappointments.
hsScalar area = (wBnd.GetMaxs().fX - wBnd.GetMins().fX) * (wBnd.GetMaxs().fY - wBnd.GetMins().fY);
float area = (wBnd.GetMaxs().fX - wBnd.GetMins().fX) * (wBnd.GetMaxs().fY - wBnd.GetMins().fY);
hsScalar volume = area * depth;
float volume = area * depth;
plCONST(hsScalar) kWaterDensity(1.0f);
hsScalar forceMag = volume * kWaterDensity;
plCONST(float) kWaterDensity(1.0f);
float forceMag = volume * kWaterDensity;
// surfNorm is now the impulse vector. But where to apply it.
// Don't currently have anything informative from the physical to use.
@ -1080,7 +1080,7 @@ void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so)
// iMsg->Send();
#if 0
plCONST(hsScalar) kRotScale(1.f);
plCONST(float) kRotScale(1.f);
hsVector3 rotAx = hsVector3(0, 0, 1.f) % surfNorm;
rotAx *= kRotScale * dt * volume;
@ -1088,12 +1088,12 @@ void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so)
aMsg->Send();
#endif
plCONST(hsScalar) kDampener(0.1f);
plCONST(hsScalar) kBaseDamp(0.1f);
plCONST(float) kDampener(0.1f);
plCONST(float) kBaseDamp(0.1f);
if( wBnd.GetMaxs().fZ > wBnd.GetMins().fZ )
{
// Remember, we've already limited depth to be <= Max.fZ - Min.fZ;
hsScalar damp = depth / (wBnd.GetMaxs().fZ - wBnd.GetMins().fZ);
float damp = depth / (wBnd.GetMaxs().fZ - wBnd.GetMins().fZ);
damp *= kDampener;
damp += kBaseDamp;
@ -1102,7 +1102,7 @@ void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so)
}
}
void plWaveSet7::IFloatBuoys(hsScalar dt)
void plWaveSet7::IFloatBuoys(float dt)
{
int i;
for( i = 0; i < fBuoys.GetCount(); i++ )
@ -1171,7 +1171,7 @@ void plWaveSet7::ICheckTargetMaterials()
if( !fTargBnds.GetCount() )
fTargBnds.SetCount(1);
plConst(hsScalar) kMaxWaveHeight(5.f);
plConst(float) kMaxWaveHeight(5.f);
hsPoint3 p;
p = targBnd.GetMins();
@ -1239,39 +1239,39 @@ class plFilterMask
{
protected:
int fExt;
hsScalar **fMask;
float **fMask;
public:
plFilterMask( hsScalar sig );
plFilterMask( float sig );
virtual ~plFilterMask();
int Begin() const { return -fExt; }
int End() const { return fExt; }
hsScalar Mask( int i, int j ) const { return fMask[ i ][ j ]; }
float Mask( int i, int j ) const { return fMask[ i ][ j ]; }
};
// End evil.
void plWaveSet7::IInitState()
{
plConst(hsScalar) kWaterTable(-10.f);
plConst(hsScalar) kWaterOffset[3] = { 3.f, 3.f, 0.f };
plConst(hsScalar) kMaxAtten[3] = { 1.f, 1.f, 1.f };
plConst(hsScalar) kMinAtten[3] = { 0.f, 0.f, 0.f };
plConst(hsScalar) kDepthFalloff[3] = { 4.f, 4.f, 6.f };
plConst(float) kWaterTable(-10.f);
plConst(float) kWaterOffset[3] = { 3.f, 3.f, 0.f };
plConst(float) kMaxAtten[3] = { 1.f, 1.f, 1.f };
plConst(float) kMinAtten[3] = { 0.f, 0.f, 0.f };
plConst(float) kDepthFalloff[3] = { 4.f, 4.f, 6.f };
plConst(hsScalar) kGeoMinLen(3.f);
plConst(hsScalar) kGeoMaxLen(8.f);
plConst(hsScalar) kGeoAmpOverLen(0.1f);
plConst(hsScalar) kGeoAngleDev(30.f * hsScalarPI / 180.f);
plConst(hsScalar) kGeoChop(1.f);
plConst(float) kGeoMinLen(3.f);
plConst(float) kGeoMaxLen(8.f);
plConst(float) kGeoAmpOverLen(0.1f);
plConst(float) kGeoAngleDev(30.f * M_PI / 180.f);
plConst(float) kGeoChop(1.f);
plConst(hsScalar) kTexMinLen(4.f);
plConst(hsScalar) kTexMaxLen(30.f);
plConst(hsScalar) kTexAmpOverLen(0.1f);
plConst(hsScalar) kTexAngleDev(30.f * hsScalarPI / 180.f);
plConst(hsScalar) kTexChop(1.f);
plConst(float) kTexMinLen(4.f);
plConst(float) kTexMaxLen(30.f);
plConst(float) kTexAmpOverLen(0.1f);
plConst(float) kTexAngleDev(30.f * M_PI / 180.f);
plConst(float) kTexChop(1.f);
plFixedWaterState7 state;
@ -1291,9 +1291,9 @@ void plWaveSet7::IInitState()
state.fRippleScale = 25.f;
plConst(hsScalar) kNoise(1.f);
plConst(hsScalar) kSpecStart(50.f);
plConst(hsScalar) kSpecEnd(10000.f);
plConst(float) kNoise(1.f);
plConst(float) kSpecStart(50.f);
plConst(float) kSpecEnd(10000.f);
hsVector3 spec;
spec[state.kNoise] = kNoise;
@ -1405,20 +1405,20 @@ void plWaveSet7::ISetupTextureWaves()
void plWaveSet7::IInitTexWave(int i)
{
hsScalar rads = fRand.RandMinusOneToOne() * TexState().fAngleDev;
hsScalar dx = sin(rads);
hsScalar dy = cos(rads);
float rads = fRand.RandMinusOneToOne() * TexState().fAngleDev;
float dx = sin(rads);
float dy = cos(rads);
hsScalar tx = dx;
float tx = dx;
dx = fWindDir.fY * dx - fWindDir.fX * dy;
dy = fWindDir.fX * tx + fWindDir.fY * dy;
hsScalar maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale;
hsScalar minLen = TexState().fMinLength * kCompositeSize / State().fRippleScale;
hsScalar len = hsScalar(i) / hsScalar(kNumTexWaves-1) * (maxLen - minLen) + minLen;
float maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale;
float minLen = TexState().fMinLength * kCompositeSize / State().fRippleScale;
float len = float(i) / float(kNumTexWaves-1) * (maxLen - minLen) + minLen;
hsScalar reps = hsScalar(kCompositeSize) / len;
float reps = float(kCompositeSize) / len;
dx *= reps;
dy *= reps;
@ -1428,9 +1428,9 @@ void plWaveSet7::IInitTexWave(int i)
fTexWaves[i].fRotScale00 = dx;
fTexWaves[i].fRotScale01 = dy;
hsScalar effK = hsFastMath::InvSqrt(dx*dx + dy*dy);
fTexWaves[i].fLen = hsScalar(kCompositeSize) * effK;
fTexWaves[i].fFreq = hsScalarPI * 2.f / fTexWaves[i].fLen;
float effK = hsFastMath::InvSqrt(dx*dx + dy*dy);
fTexWaves[i].fLen = float(kCompositeSize) * effK;
fTexWaves[i].fFreq = M_PI * 2.f / fTexWaves[i].fLen;
fTexWaves[i].fAmp = fTexWaves[i].fLen * TexState().fAmpOverLen;
fTexWaves[i].fPhase = fRand.RandZeroToOne();
@ -1470,20 +1470,20 @@ void plWaveSet7::RemoveDynaDecalMgr(plKey& key)
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
void plWaveSet7::IUpdateLayers(hsScalar dt)
void plWaveSet7::IUpdateLayers(float dt)
{
IUpdateBumpLayers(dt);
ISubmitRenderRequests();
}
void plWaveSet7::IUpdateBumpLayers(hsScalar dt)
void plWaveSet7::IUpdateBumpLayers(float dt)
{
plCONST(hsScalar) speedHack(1.f / 3.f);
plCONST(float) speedHack(1.f / 3.f);
int i;
for( i = 0; i < kNumTexWaves; i++ )
{
hsScalar speed = hsFastMath::InvSqrtAppr(fTexWaves[i].fLen / (2.f * hsScalarPI * kGravConst)) * speedHack;
float speed = hsFastMath::InvSqrtAppr(fTexWaves[i].fLen / (2.f * M_PI * kGravConst)) * speedHack;
fTexWaves[i].fPhase -= dt * speed;
fTexWaves[i].fPhase -= int(fTexWaves[i].fPhase);
@ -1518,7 +1518,7 @@ void plWaveSet7::ISubmitRenderRequests()
}
}
plMipmap* plWaveSet7::ICreateBumpBitmapFFP(hsScalar amp, hsScalar dx, hsScalar dy) const
plMipmap* plWaveSet7::ICreateBumpBitmapFFP(float amp, float dx, float dy) const
{
return nil;
}
@ -1627,8 +1627,8 @@ plMipmap* plWaveSet7::ICreateBiasNoiseMap()
int j;
for( j = 0; j < size; j++ )
{
hsScalar x = fRand.RandMinusOneToOne();
hsScalar y = fRand.RandMinusOneToOne();
float x = fRand.RandMinusOneToOne();
float y = fRand.RandMinusOneToOne();
uint8_t r = uint8_t((x * 0.5f + 0.5f) * 255.999f);
uint8_t g = uint8_t((y * 0.5f + 0.5f) * 255.999f);
@ -1681,13 +1681,13 @@ plMipmap* plWaveSet7::ICreateBumpMipmapPS()
int i;
for( i = 0; i < sizeU; i++ )
{
hsScalar y = hsScalar(i);
hsScalar dist = hsScalar(i) / hsScalar(sizeU-1) * 2.f * hsScalarPI;
hsScalar c = cos(dist);
hsScalar s = sin(dist);
float y = float(i);
float dist = float(i) / float(sizeU-1) * 2.f * M_PI;
float c = cos(dist);
float s = sin(dist);
s *= 0.5f;
s += 0.5f;
s = hsScalar(pow(s, TexState().fChop));
s = float(pow(s, TexState().fChop));
c *= s;
uint8_t cosDist = uint8_t((c * 0.5 + 0.5) * 255.999f);
int j;
@ -1888,7 +1888,7 @@ void plWaveSet7::IAddBumpBiasShaders(plLayer* layer)
2.f);
hsVector3 specVec = State().fSpecVec;
hsScalar biasScale = 0.5f * specVec[State().kNoise] / (hsScalar(kNumBumpShaders) + specVec[State().kNoise]);
float biasScale = 0.5f * specVec[State().kNoise] / (float(kNumBumpShaders) + specVec[State().kNoise]);
vShader->SetVector(plBiasVS::kScaleBias,
biasScale,
biasScale,
@ -2007,8 +2007,8 @@ void plWaveSet7::IAddBumpPixelShader(hsGMaterial* mat, int iShader, int iFirst,
for( iLay = 0; iLay < kBumpPerPass; iLay++ )
{
pShader->SetVector(plBumpPS::kWave0,
-fTexWaves[iBase + iLay].fDirX * (1.f / hsScalar(kBumpPerPass)),
-fTexWaves[iBase + iLay].fDirY * (1.f / hsScalar(kBumpPerPass)),
-fTexWaves[iBase + iLay].fDirX * (1.f / float(kBumpPerPass)),
-fTexWaves[iBase + iLay].fDirY * (1.f / float(kBumpPerPass)),
1.f,
1.f);
}
@ -2120,7 +2120,7 @@ plDrawableSpans* plWaveSet7::ICreateClearDrawable(plDrawableSpans* drawable, hsG
return drawable;
}
plRenderRequest* plWaveSet7::ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, hsScalar pri)
plRenderRequest* plWaveSet7::ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, float pri)
{
plRenderRequest* req = TRACKED_NEW plRenderRequest;
@ -2316,12 +2316,12 @@ void plWaveSet7::IAddShoreVertexShader(hsGMaterial* mat)
vShader->SetVector(plShoreVS::kSinConsts, 1.f, -1.f/6.f, 1.f/120.f, -1.f/5040.f);
vShader->SetVector(plShoreVS::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f);
vShader->SetVector(plShoreVS::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f);
vShader->SetVector(plShoreVS::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f);
vShader->SetVector(plShoreVS::kNumericConsts, 0, 0.5f, 1.f, 2.f);
plConst(hsScalar) kK1(0.5f);
plConst(hsScalar) kK2(1.5f);
hsScalar negK1OverK2Sq = -kK1 / (kK2 * kK2);
plConst(float) kK1(0.5f);
plConst(float) kK2(1.5f);
float negK1OverK2Sq = -kK1 / (kK2 * kK2);
vShader->SetVector(plShoreVS::kIncline, negK1OverK2Sq, kK1, 0.f, 0.f);
vShader->SetNumPipeConsts(5);
@ -2394,7 +2394,7 @@ void plWaveSet7::IAddFixedVertexShader(hsGMaterial* mat, const int numUVWs)
vShader->SetVector(plFixedVS7::kSinConsts, 1.f, -1.f/6.f, 1.f/120.f, -1.f/5040.f);
vShader->SetVector(plFixedVS7::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f);
vShader->SetVector(plFixedVS7::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f);
vShader->SetVector(plFixedVS7::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f);
vShader->SetVector(plFixedVS7::kNumericConsts, 0, 0.5f, 1.f, 2.f);
vShader->SetNumPipeConsts(5);
@ -2493,7 +2493,7 @@ void plWaveSet7::IAddRipVertexShader(hsGMaterial* mat, const plRipVSConsts& ripC
vShader->SetVector(plRipVS::kSinConsts, 1.f, -1.f/6.f, 1.f/120.f, -1.f/5040.f);
vShader->SetVector(plRipVS::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f);
vShader->SetVector(plRipVS::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f);
vShader->SetVector(plRipVS::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f);
vShader->SetVector(plRipVS::kNumericConsts, 0, 0.5f, 1.f, 2.f);
hsVector3 waterOffset = State().fWaterOffset;
@ -2533,7 +2533,7 @@ void plWaveSet7::IAddRipVertexShader(hsGMaterial* mat, const plRipVSConsts& ripC
ripConsts.fLife,
1.f / (ripConsts.fLife - ripConsts.fDecay));
plConst(hsScalar) kRipBias(0.1);
plConst(float) kRipBias(0.1);
vShader->SetVector(plRipVS::kRampBias,
ripConsts.fRamp,
1.f / ripConsts.fRamp,
@ -2639,7 +2639,7 @@ plShader* plWaveSet7::ICreateDecalVShader(DecalVType t)
vShader->SetVector(plWaveDecVS::kSinConsts, 1.f, -1.f/6.f, 1.f/120.f, -1.f/5040.f);
vShader->SetVector(plWaveDecVS::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f);
vShader->SetVector(plWaveDecVS::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f);
vShader->SetVector(plWaveDecVS::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f);
vShader->SetVector(plWaveDecVS::kNumericConsts, 0, 0.5f, 1.f, 2.f);
hsVector3 waterOffset = State().fWaterOffset;
@ -2665,7 +2665,7 @@ plShader* plWaveSet7::ICreateDecalVShader(DecalVType t)
0.f
);
plConst(hsScalar) kBias(0.1);
plConst(float) kBias(0.1);
vShader->SetVector(plWaveDecVS::kBias,
kBias,
0,
@ -2861,16 +2861,16 @@ void plWaveSet7::IUpdateBumpPShader(plPipeline* pipe, const hsMatrix44& l2w, con
int iTex = i*kBumpPerPass + j;
hsVector3 specVec = State().fSpecVec;
hsScalar scale = 1.f / (hsScalar(kNumBumpShaders) + specVec[State().kNoise]);
float scale = 1.f / (float(kNumBumpShaders) + specVec[State().kNoise]);
hsScalar maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale;
hsScalar rescale = fTexWaves[iTex].fLen / maxLen;
float maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale;
float rescale = fTexWaves[iTex].fLen / maxLen;
hsScalar bias = 0.5f * scale;
float bias = 0.5f * scale;
fBumpPShader[i]->SetVector(plBumpPS::kHalfOne, scale, scale, 1.f, 1.f);
fBumpPShader[i]->SetVector(plBumpPS::kBias, bias, bias, 1.f, 1.f);
hsScalar layScale = skip & (1 << iTex) ? 0.f : (1.f / hsScalar(kBumpPerPass));
float layScale = skip & (1 << iTex) ? 0.f : (1.f / float(kBumpPerPass));
layScale *= fTexWaveFade[iTex];
fBumpPShader[i]->SetVector(plBumpPS::kWave0 + j,
@ -2887,9 +2887,9 @@ void plWaveSet7::IUpdateBumpVShader(plPipeline* pipe, const hsMatrix44& l2w, con
{
}
static inline hsScalar IRound(hsScalar f)
static inline float IRound(float f)
{
return hsScalar(int(f + (f > 0 ? 0.5f : -0.5f)));
return float(int(f + (f > 0 ? 0.5f : -0.5f)));
}
void plWaveSet7::IUpdateBiasVShader()
@ -2898,24 +2898,24 @@ void plWaveSet7::IUpdateBiasVShader()
if( fBiasVShader )
{
// Can't just use GetDelSysSeconds() or else we lose time if we skip a frame render because of high FPS.
hsScalar dt = fLastTime > 0 ? hsScalar(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds();
plConst(hsScalar) kRate(-0.1f);
hsScalar tx = kRate * dt;
hsScalar ty = kRate * dt;
plConst(hsScalar) kScaleU(4.f);
plConst(hsScalar) kScaleV(1.f);
float dt = fLastTime > 0 ? float(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds();
plConst(float) kRate(-0.1f);
float tx = kRate * dt;
float ty = kRate * dt;
plConst(float) kScaleU(4.f);
plConst(float) kScaleV(1.f);
tx += fBiasVShader->GetFloat(plBiasVS::kTexU0, 3);
tx -= hsScalar(int(tx));
tx -= float(int(tx));
ty += fBiasVShader->GetFloat(plBiasVS::kTexV0, 3);
ty -= hsScalar(int(ty));
ty -= float(int(ty));
hsScalar scale = 1.f + (4.f - 1.f) * TexState().fAngleDev/hsScalarPI;
float scale = 1.f + (4.f - 1.f) * TexState().fAngleDev/M_PI;
hsScalar m00 = IRound(fWindDir.fY * scale);
hsScalar m01 = IRound(fWindDir.fX * scale);
hsScalar m10 = IRound(-fWindDir.fX * 4.f);
hsScalar m11 = IRound(fWindDir.fY * 4.f);
float m00 = IRound(fWindDir.fY * scale);
float m01 = IRound(fWindDir.fX * scale);
float m10 = IRound(-fWindDir.fX * 4.f);
float m11 = IRound(fWindDir.fY * 4.f);
fBiasVShader->SetVector(plBiasVS::kTexU0,
m00,
@ -2928,8 +2928,8 @@ void plWaveSet7::IUpdateBiasVShader()
0,
ty);
plConst(hsScalar) kUpperNoiseOffU(0.f);
plConst(hsScalar) kUpperNoiseOffV(0.3f);
plConst(float) kUpperNoiseOffU(0.f);
plConst(float) kUpperNoiseOffV(0.3f);
fBiasVShader->SetVector(plBiasVS::kTexU1,
m00,
m01,
@ -2942,7 +2942,7 @@ void plWaveSet7::IUpdateBiasVShader()
ty + kUpperNoiseOffV);
hsVector3 specVec = State().fSpecVec;
hsScalar biasScale = 0.5f * specVec[State().kNoise] / (hsScalar(kNumBumpShaders) + specVec[State().kNoise]);
float biasScale = 0.5f * specVec[State().kNoise] / (float(kNumBumpShaders) + specVec[State().kNoise]);
fBiasVShader->SetVector(plBiasVS::kScaleBias,
biasScale,
biasScale,
@ -3011,7 +3011,7 @@ void plWaveSet7::IUpdateRipVShader(plPipeline* pipe, const hsMatrix44& l2w, cons
int i;
for( i = 0; i < kNumWaves; i++ )
{
normQ[i] = GeoState().fChop / (2.f*hsScalarPI * GeoState().fAmpOverLen * kNumWaves);
normQ[i] = GeoState().fChop / (2.f*M_PI * GeoState().fAmpOverLen * kNumWaves);
}
fRipVShader->SetVector(plRipVS::kQADirX,
@ -3083,10 +3083,10 @@ void plWaveSet7::IUpdateDecVShader(int t, plPipeline* pipe)
hsPoint3 envCenter(State().fEnvCenter);
hsScalar envRadius = State().fEnvRadius;
float envRadius = State().fEnvRadius;
hsVector3 camToCen(&envCenter, &worldCam);
hsScalar G = camToCen.MagnitudeSquared() - envRadius * envRadius;
float G = camToCen.MagnitudeSquared() - envRadius * envRadius;
shader->SetVectorW(plWaveDecVS::kEnvAdjust, camToCen, G);
}
@ -3095,7 +3095,7 @@ void plWaveSet7::IUpdateDecVShader(int t, plPipeline* pipe)
int i;
for( i = 0; i < kNumWaves; i++ )
{
normQ[i] = GeoState().fChop / (2.f*hsScalarPI * GeoState().fAmpOverLen * kNumWaves);
normQ[i] = GeoState().fChop / (2.f*M_PI * GeoState().fAmpOverLen * kNumWaves);
}
shader->SetVector(plWaveDecVS::kQADirX,
@ -3213,16 +3213,16 @@ void plWaveSet7::IUpdateShoreVShader(plPipeline* pipe, const hsMatrix44& l2w, co
fWorldWaves[2].fLength,
fWorldWaves[3].fLength);
plConst(hsScalar) kK1(2.f);
plConst(hsScalar) kK2(5.f);
hsScalar negK1OverK2Sq = -kK1 / (kK2 * kK2);
plConst(float) kK1(2.f);
plConst(float) kK2(5.f);
float negK1OverK2Sq = -kK1 / (kK2 * kK2);
fShoreVShader->SetVector(plShoreVS::kIncline, negK1OverK2Sq, kK1, 0.f, 0.f);
float normQ[kNumWaves];
int i;
for( i = 0; i < kNumWaves; i++ )
{
normQ[i] = GeoState().fChop / (2.f*hsScalarPI * GeoState().fAmpOverLen * kNumWaves);
normQ[i] = GeoState().fChop / (2.f*M_PI * GeoState().fAmpOverLen * kNumWaves);
}
fShoreVShader->SetVector(plShoreVS::kQADirX,
@ -3279,18 +3279,18 @@ void plWaveSet7::IUpdateFixedVShader(plPipeline* pipe, const hsMatrix44& l2w, co
fWorldWaves[2].fDir.fY,
fWorldWaves[3].fDir.fY);
plCONST(hsScalar) kEnvRadius(500.f);
hsScalar envRadius = State().fEnvRadius;
plCONST(float) kEnvRadius(500.f);
float envRadius = State().fEnvRadius;
hsPoint3 worldCam = pipe->GetViewTransform().GetCameraToWorld().GetTranslate();
hsPoint3 envCenter(State().fEnvCenter);
hsVector3 camToCen(&envCenter, &worldCam);
hsScalar G = camToCen.MagnitudeSquared() - envRadius * envRadius;
float G = camToCen.MagnitudeSquared() - envRadius * envRadius;
fFixedVShader->SetVectorW(plFixedVS7::kEnvAdjust, camToCen, G);
hsScalar texScale = 1.f / State().fRippleScale;
float texScale = 1.f / State().fRippleScale;
fFixedVShader->SetVector(plFixedVS7::kUVScale,
texScale,
@ -3298,21 +3298,21 @@ void plWaveSet7::IUpdateFixedVShader(plPipeline* pipe, const hsMatrix44& l2w, co
0,
0);
hsScalar specAtten = State().fTexState.fAmpOverLen * hsScalarPI * 2.f;
float specAtten = State().fTexState.fAmpOverLen * M_PI * 2.f;
plCONST(hsScalar) kScaleHack(0.1f);
hsScalar baseScale = kScaleHack;
// baseScale *= hsScalar(kBumpPerPass) * (hsScalar(kNumBumpShaders) + State().fSpecVec[State().kNoise]);
plCONST(float) kScaleHack(0.1f);
float baseScale = kScaleHack;
// baseScale *= float(kBumpPerPass) * (float(kNumBumpShaders) + State().fSpecVec[State().kNoise]);
// Not sure what's right here. but we are currently scaling down by 1/(numBumpShaders + noise),
// so I guess we want to scale up by that amount here. Not sure we shouldn't figuring in bumpperpass
// on both, but at least now we're consistent.
hsVector3 specVec = State().fSpecVec;
baseScale *= (hsScalar(kNumBumpShaders) + specVec[State().kNoise]);
baseScale *= (float(kNumBumpShaders) + specVec[State().kNoise]);
baseScale *= (TexState().fChop + 1.f);
hsScalar specStart = specVec[State().kSpecStart];
hsScalar specEnd = specVec[State().kSpecEnd];
float specStart = specVec[State().kSpecStart];
float specEnd = specVec[State().kSpecEnd];
if( specStart > specEnd )
specEnd = specStart + 1.f;
fFixedVShader->SetVector(plFixedVS7::kSpecAtten,
@ -3370,7 +3370,7 @@ void plWaveSet7::IUpdateFixedVShader(plPipeline* pipe, const hsMatrix44& l2w, co
int i;
for( i = 0; i < kNumWaves; i++ )
{
normQ[i] = GeoState().fChop / (2.f*hsScalarPI * GeoState().fAmpOverLen * kNumWaves);
normQ[i] = GeoState().fChop / (2.f*M_PI * GeoState().fAmpOverLen * kNumWaves);
}
fFixedVShader->SetVector(plFixedVS7::kDirXK,
@ -3631,7 +3631,7 @@ plDrawableSpans* plWaveSet7::ICreateGraphDrawable(plDrawableSpans* drawable, hsG
int iDn = i << 1;
int iUp = iDn + 1;
hsScalar delX = hsScalar(i) / hsScalar(nWid-1);
float delX = float(i) / float(nWid-1);
pos[iDn].fX = delX * 2.f - 1.f;
pos[iDn].fY = -1.f;
@ -3762,8 +3762,8 @@ plMipmap* plWaveSet7::ICreateGraphShoreTex(int width, int height)
{
plMipmap* mipMap = ICreateBlankTex("Graph", width, height, kRefGraphShoreTex);
plConst(hsScalar) kRampFrac(0.4f);
plConst(hsScalar) kTruncFrac(0.8f);
plConst(float) kRampFrac(0.4f);
plConst(float) kTruncFrac(0.8f);
const int rampEnd = int(kRampFrac * height + 0.5f);
int truncEnd = int(kTruncFrac * height);
if( truncEnd >= (height-1) )
@ -3825,10 +3825,10 @@ void plWaveSet7::IRefillBubbleShoreTex()
int jLoc = (int)(fRand.RandZeroToOne() * height);
// Select a random radius
plConst(hsScalar) kMinRad(2.f);
plConst(hsScalar) kMaxRad(5.0f);
plConst(float) kMinRad(2.f);
plConst(float) kMaxRad(5.0f);
int radius = int(kMinRad + fRand.RandZeroToOne() * (kMaxRad - kMinRad));
hsScalar invRadiusSq = 1.f / hsScalar(radius*radius);
float invRadiusSq = 1.f / float(radius*radius);
// Carve out a hole.
int j;
@ -3849,17 +3849,17 @@ void plWaveSet7::IRefillBubbleShoreTex()
else if( ii >= width )
ii -= width;
hsScalar f = hsScalar(i*i + j*j) * invRadiusSq;
float f = float(i*i + j*j) * invRadiusSq;
if( f > 1.f )
f = 1.f;
plConst(hsScalar) kMinAlpha(0.8f);
plConst(hsScalar) kMaxAlpha(1.f);
plConst(float) kMinAlpha(0.8f);
plConst(float) kMaxAlpha(1.f);
f *= (kMaxAlpha - kMinAlpha);
f += kMinAlpha;
uint32_t* val = mipMap->GetAddr32(ii, jj);
uint32_t alpha = (*val) >> 24;
alpha = uint32_t(hsScalar(alpha) * f);
alpha = uint32_t(float(alpha) * f);
*val &= 0x00ffffff;
*val |= (alpha << 24);
}
@ -3877,7 +3877,7 @@ void plWaveSet7::IRefillBubbleShoreTex()
uint32_t* val = mipMap->GetAddr32(i, j);
hsColorRGBA col;
col.FromARGB32(*val);
hsScalar alpha = col.a;
float alpha = col.a;
col = maxColor - minColor;
col *= alpha;
col += minColor;
@ -3915,8 +3915,8 @@ void plWaveSet7::IRefillEdgeShoreTex()
const int width = mipMap->GetWidth();
const int height = mipMap->GetHeight();
plConst(hsScalar) kCenter(0.8f);
plConst(hsScalar) kRadius(0.025f);
plConst(float) kCenter(0.8f);
plConst(float) kRadius(0.025f);
const int center = int(kCenter * height);
@ -3924,11 +3924,11 @@ void plWaveSet7::IRefillEdgeShoreTex()
const int top = center + radius;
const int bot = center - radius;
const hsScalar invRadiusSq = 1.f / hsScalar(radius*radius);
const float invRadiusSq = 1.f / float(radius*radius);
hsAssert(top < height-1, "Center too high or radius too big");
const hsScalar maxAlpha = State().fEdgeOpac * 255.9f;
const float maxAlpha = State().fEdgeOpac * 255.9f;
int j;
for( j = 0; j < height; j++ )
{
@ -3936,21 +3936,21 @@ void plWaveSet7::IRefillEdgeShoreTex()
if( (j > bot)&&(j < top) )
{
#if 0 // like x^2
hsScalar a = hsScalar(j-center);
float a = float(j-center);
a *= a;
a *= invRadiusSq;
a = 1.f - a;
#elif 1 // like 1/x^2
hsScalar a = hsScalar(j-center);
float a = float(j-center);
if( a < 0 )
a = -a;
a /= hsScalar(radius);
a /= float(radius);
a = 1.f - a;
a *= a;
#else // like cos
hsScalar a = hsScalar(j - center);
a /= hsScalar(radius);
a *= hsScalarPI;
float a = float(j - center);
a /= float(radius);
a *= M_PI;
a = hsFastMath::CosInRange(a);
a += 1.f;
a *= 0.5f;
@ -4154,7 +4154,7 @@ void plWaveSet7::IAddGraphVShader(hsGMaterial* mat, int iPass)
vShader->SetNumConsts(plGraphVS::kNumConsts);
vShader->SetVector(plGraphVS::kNumericConsts, 0, 0.5f, 1.f, 2.f);
vShader->SetVector(plGraphVS::kPiConsts, 1.f / (2.f*hsScalarPI), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f);
vShader->SetVector(plGraphVS::kPiConsts, 1.f / (2.f*M_PI), M_PI/2.f, M_PI, M_PI*2.f);
vShader->SetVector(plGraphVS::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f);
#ifndef TEST_UVWS
@ -4333,9 +4333,9 @@ void plWaveSet7::IInitGraph(int iPass)
static int lastOne = 0;
plConst(hsScalar) kBasePeriod(3.f);
hsScalar life = State().fPeriod * kBasePeriod * (1.f + fRand.RandZeroToOne());
gs.fInvLife = (1.f + hsScalar(lastOne)/hsScalar(kGraphShorePasses-1)) / life;
plConst(float) kBasePeriod(3.f);
float life = State().fPeriod * kBasePeriod * (1.f + fRand.RandZeroToOne());
gs.fInvLife = (1.f + float(lastOne)/float(kGraphShorePasses-1)) / life;
lastOne = !lastOne;
@ -4348,7 +4348,7 @@ void plWaveSet7::IInitGraph(int iPass)
{
// Okay, phase we don't have to think too hard about,
// it doesn't matter as long as it's random.
gs.fPhase[i] = fRand.RandZeroToOne() * 2.f * hsScalarPI;
gs.fPhase[i] = fRand.RandZeroToOne() * 2.f * M_PI;
// Next up is frequency, but frequency is the hard one.
// Remember frequency has to preserve tiling, so freq = k * 2 * PI.
@ -4369,16 +4369,16 @@ void plWaveSet7::IInitGraph(int iPass)
}
// Input will be in range [0..2], so we'll omit the customary 2*PI here.
gs.fFreq[i] = k * hsScalarPI;
gs.fFreq[i] = k * M_PI;
// Amplitude depends on freqency, or roughly inversely proportional
// to frequency (randomized about linear on period).
// Divide by 4 because that's how many oscillators we have, and they
// are summed.
hsScalar period = 1.f / hsScalar(k);
plConst(hsScalar) kAmpScale(1.f / 4.f / 2.f);
plConst(hsScalar) kMinPeriodFrac(1.f);
plConst(hsScalar) kMaxPeriodFrac(2.f);
float period = 1.f / float(k);
plConst(float) kAmpScale(1.f / 4.f / 2.f);
plConst(float) kMinPeriodFrac(1.f);
plConst(float) kMaxPeriodFrac(2.f);
period *= kMinPeriodFrac + fRand.RandZeroToOne() * (kMaxPeriodFrac - kMinPeriodFrac);
period *= kAmpScale;
gs.fAmp[i] = period;
@ -4410,7 +4410,7 @@ void plWaveSet7::IShuffleDownGraphs(int iPass)
IInitGraph(kGraphShorePasses-1);
}
void plWaveSet7::IUpdateGraphShader(hsScalar dt, int iPass)
void plWaveSet7::IUpdateGraphShader(float dt, int iPass)
{
if( fGraphShoreDraw[iPass] )
{
@ -4418,15 +4418,15 @@ void plWaveSet7::IUpdateGraphShader(hsScalar dt, int iPass)
plShader* shader = fGraphVShader[iPass];
gs.fAge += dt;
hsScalar rads = gs.fAge * gs.fInvLife;
if( rads >= hsScalarPI )
float rads = gs.fAge * gs.fInvLife;
if( rads >= M_PI )
{
// Recycle this one and restart the upper.
IShuffleDownGraphs(iPass);
}
else
{
hsScalar sinAge = hsFastMath::SinInRange(rads);
float sinAge = hsFastMath::SinInRange(rads);
shader->SetVector(plGraphVS::kAmplitude,
gs.fAmp[0] * sinAge,
@ -4440,11 +4440,11 @@ void plWaveSet7::IUpdateGraphShader(hsScalar dt, int iPass)
tint.a *= sinAge;
shader->SetColor(plGraphVS::kColor, tint);
plConst(hsScalar) kCMax(1.f);
plConst(hsScalar) kCMin(3.f);
hsScalar cMin = kCMax + (kCMin - kCMax) * State().fFingerLength;
plConst(hsScalar) k2ndLayerScale(2.f);
plConst(hsScalar) k2ndLayerVoff(1.5f);
plConst(float) kCMax(1.f);
plConst(float) kCMin(3.f);
float cMin = kCMax + (kCMin - kCMax) * State().fFingerLength;
plConst(float) k2ndLayerScale(2.f);
plConst(float) k2ndLayerVoff(1.5f);
shader->SetVector(plGraphVS::kUVWConsts,
(kCMax - cMin) * sinAge + cMin,
gs.fUOff,
@ -4454,7 +4454,7 @@ void plWaveSet7::IUpdateGraphShader(hsScalar dt, int iPass)
}
}
void plWaveSet7::IUpdateGraphShaders(plPipeline* pipe, hsScalar dt)
void plWaveSet7::IUpdateGraphShaders(plPipeline* pipe, float dt)
{
if( fGraphShoreDraw[0] )
{

View File

@ -81,11 +81,11 @@ class plWorldWaveData7
{
public:
hsPoint3 fDir;
hsScalar fLength;
float fLength;
hsScalar fFreq;
hsScalar fPhase;
hsScalar fAmplitude;
float fFreq;
float fPhase;
float fAmplitude;
};
class plWorldWave7 : public plWorldWaveData7
@ -184,26 +184,26 @@ protected:
plFixedWaterState7 fState;
hsScalar fScrunchLen;
hsScalar fScrunchScale;
float fScrunchLen;
float fScrunchScale;
hsVector3 fWindDir;
hsScalar fMinLen;
hsScalar fMaxLen;
hsScalar fFreqScale;
float fMinLen;
float fMaxLen;
float fFreqScale;
hsScalar fTransCountDown;
float fTransCountDown;
int fTransistor;
hsScalar fTransDel;
float fTransDel;
hsScalar fTexTransCountDown;
float fTexTransCountDown;
int fTexTrans;
hsScalar fTexTransDel;
hsScalar fTexWaveFade[kNumTexWaves];
float fTexTransDel;
float fTexWaveFade[kNumTexWaves];
plWorldWave7 fWorldWaves[kNumWaves];
hsScalar fFreqMod[kNumWaves];
float fFreqMod[kNumWaves];
plRandom fRand;
@ -234,7 +234,7 @@ protected:
plBitmap* fEnvMap;
uint32_t fEnvSize;
hsScalar fEnvRefresh;
float fEnvRefresh;
plLayer* fFixedLayers[4];
@ -321,24 +321,24 @@ protected:
class TexWaveDesc
{
public:
hsScalar fPhase;
hsScalar fAmp;
hsScalar fLen;
hsScalar fFreq;
hsScalar fDirX;
hsScalar fDirY;
hsScalar fRotScale00;
hsScalar fRotScale01;
float fPhase;
float fAmp;
float fLen;
float fFreq;
float fDirX;
float fDirY;
float fRotScale00;
float fRotScale01;
};
TexWaveDesc fTexWaves[kNumTexWaves];
class TexWaveWindDep
{
public:
hsScalar fWindSpeed;
float fWindSpeed;
hsScalar fHeight;
hsScalar fSpecular;
float fHeight;
float fSpecular;
};
TexWaveWindDep fWindDeps[kNumWindDep];
@ -348,47 +348,47 @@ protected:
inline void IScrunch(hsPoint3& pos, hsVector3& norm) const;
void ICalcWindow(hsScalar dt);
void ICalcWindow(float dt);
void ICalcScale();
void IUpdateWaves(hsScalar dt);
void IUpdateWave(hsScalar dt, int i);
void IUpdateWaves(float dt);
void IUpdateWave(float dt, int i);
hsBool IAnyBoundsVisible(plPipeline* pipe) const;
void IInitWave(int i);
void IReInitWaves();
void IUpdateRefObject();
void IUpdateWindDir(hsScalar dt);
void IUpdateWindDir(float dt);
void IShiftCenter(plSceneObject* so) const;
void IFloatBuoys(hsScalar dt);
void IFloatBuoy(hsScalar dt, plSceneObject* so);
void IFloatBuoys(float dt);
void IFloatBuoy(float dt, plSceneObject* so);
// Bookkeeping
void IAddTarget(const plKey& key);
void IRemoveTarget(const plKey& key);
void ISetWindSpeed(hsScalar s);
void ISetWindSpeed(float s);
hsBool IOnReceive(plGenRefMsg* refMsg);
hsBool IOnRemove(plGenRefMsg* refMsg);
hsBool ITransContinue(hsScalar dt);
void IStartTransition(hsScalar dt);
hsScalar ITransitionDelay() const;
void ITransition(hsScalar dt);
hsBool ITransContinue(float dt);
void IStartTransition(float dt);
float ITransitionDelay() const;
void ITransition(float dt);
hsBool ITransTexContinue(hsScalar dt);
void IStartTexTransition(hsScalar dt);
void ITransTex(hsScalar dt);
hsBool ITransTexContinue(float dt);
void IStartTexTransition(float dt);
void ITransTex(float dt);
void IInitTexWave(int i);
void ISetupTextureWaves();
void IUpdateLayers(hsScalar dt);
void IUpdateBumpLayers(hsScalar dt);
void IUpdateLayers(float dt);
void IUpdateBumpLayers(float dt);
plRenderRequest* ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, hsScalar pri);
plRenderRequest* ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, float pri);
void ISubmitRenderRequests();
plRenderTarget* ICreateTransferRenderTarget(const char* name, int size);
@ -398,7 +398,7 @@ protected:
plMipmap* ICreateBiasNoiseMap();
void IAddBumpBiasLayer(hsGMaterial* mat);
plMipmap* ICreateBumpBitmapFFP(hsScalar amp, hsScalar dx, hsScalar dy) const;
plMipmap* ICreateBumpBitmapFFP(float amp, float dx, float dy) const;
hsGMaterial* ICreateBumpLayersFFP();
plMipmap* ICreateBumpMipmapPS();
plLayer* ICreateBumpLayerPS(plMipmap* mipMap, hsGMaterial* bumpMat, int which);
@ -440,7 +440,7 @@ protected:
void IAddGraphPShader(hsGMaterial* mat, int iPass);
void IAddGraphVShader(hsGMaterial* mat, int iPass);
void IUpdateGraphShader(hsScalar dt, int iPass);
void IUpdateGraphShader(float dt, int iPass);
void IInitGraph(int iPass);
void IShuffleDownGraphs(int iPass);
@ -474,7 +474,7 @@ protected:
void IUpdateShoreVShader(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l);
void IUpdateFixedVShader(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l);
void IUpdateFixedPShader(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l);
void IUpdateGraphShaders(plPipeline* pipe, hsScalar dt);
void IUpdateGraphShaders(plPipeline* pipe, float dt);
void IUpdateDecVShader(int t, plPipeline* pipe);
void IUpdateDecVShaders(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l);
@ -484,7 +484,7 @@ protected:
inline void LogF(const char *format, ...) const;
inline void LogF(uint32_t color, const char *format, ...) const;
inline void IRestartLog() const;
inline void GraphLen(hsScalar len) const;
inline void GraphLen(float len) const;
inline void IRestartGraph() const;
public:
@ -496,14 +496,14 @@ public:
virtual hsBool MsgReceive(plMessage* msg);
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; }
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; }
int32_t GetNumProperties() const { return kNumProps; }
virtual void Read(hsStream* stream, hsResMgr* mgr);
virtual void Write(hsStream* stream, hsResMgr* mgr);
hsScalar EvalPoint(hsPoint3& pos, hsVector3& norm);
float EvalPoint(hsPoint3& pos, hsVector3& norm);
// Getters and Setters for Python twiddling
//
@ -512,112 +512,112 @@ public:
//
// Geometric wave parameters. These are all safe to twiddle at any time or speed.
// The new settings take effect as new waves are spawned.
void SetGeoMaxLength(hsScalar s, hsScalar secs=0) { fState.fGeoState.fMaxLength.Set(s, secs); }
void SetGeoMinLength(hsScalar s, hsScalar secs=0) { fState.fGeoState.fMinLength.Set(s, secs); }
void SetGeoAmpOverLen(hsScalar s, hsScalar secs=0) { fState.fGeoState.fAmpOverLen.Set(s, secs); }
void SetGeoChop(hsScalar s, hsScalar secs=0) { fState.fGeoState.fChop.Set(s, secs); }
void SetGeoAngleDev(hsScalar s, hsScalar secs=0) { fState.fGeoState.fAngleDev.Set(s, secs); }
void SetGeoMaxLength(float s, float secs=0) { fState.fGeoState.fMaxLength.Set(s, secs); }
void SetGeoMinLength(float s, float secs=0) { fState.fGeoState.fMinLength.Set(s, secs); }
void SetGeoAmpOverLen(float s, float secs=0) { fState.fGeoState.fAmpOverLen.Set(s, secs); }
void SetGeoChop(float s, float secs=0) { fState.fGeoState.fChop.Set(s, secs); }
void SetGeoAngleDev(float s, float secs=0) { fState.fGeoState.fAngleDev.Set(s, secs); }
// Texture wave parameters. Safe to twiddle any time or speed.
// The new settings take effect as new waves are spawned.
void SetTexMaxLength(hsScalar s, hsScalar secs=0) { fState.fTexState.fMaxLength.Set(s, secs); }
void SetTexMinLength(hsScalar s, hsScalar secs=0) { fState.fTexState.fMinLength.Set(s, secs); }
void SetTexAmpOverLen(hsScalar s, hsScalar secs=0) { fState.fTexState.fAmpOverLen.Set(s, secs); }
void SetTexChop(hsScalar s, hsScalar secs=0) { fState.fTexState.fChop.Set(s, secs); }
void SetTexAngleDev(hsScalar s, hsScalar secs=0) { fState.fTexState.fAngleDev.Set(s, secs); }
void SetTexMaxLength(float s, float secs=0) { fState.fTexState.fMaxLength.Set(s, secs); }
void SetTexMinLength(float s, float secs=0) { fState.fTexState.fMinLength.Set(s, secs); }
void SetTexAmpOverLen(float s, float secs=0) { fState.fTexState.fAmpOverLen.Set(s, secs); }
void SetTexChop(float s, float secs=0) { fState.fTexState.fChop.Set(s, secs); }
void SetTexAngleDev(float s, float secs=0) { fState.fTexState.fAngleDev.Set(s, secs); }
// The size in feet of one tile of the ripple texture. If you change this (I don't
// recommend it), you need to change it very slowly or it will look very stupid.
void SetRippleScale(hsScalar s, hsScalar secs=0) { fState.fRippleScale.Set(s, secs); }
void SetRippleScale(float s, float secs=0) { fState.fRippleScale.Set(s, secs); }
// The direction the wind is blowing (waves will be more or less perpindicular to wind dir).
// Change somewhat slowly, like over 30 seconds.
void SetWindDir(const hsVector3& s, hsScalar secs=0) { fState.fWindDir.Set(s, secs); }
void SetWindDir(const hsVector3& s, float secs=0) { fState.fWindDir.Set(s, secs); }
// Change these gently, effect is immediate.
void SetSpecularNoise(hsScalar s, hsScalar secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kNoise] = s; fState.fSpecVec.Set(spec, secs); }
void SetSpecularStart(hsScalar s, hsScalar secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecStart] = s; fState.fSpecVec.Set(spec, secs); }
void SetSpecularEnd(hsScalar s, hsScalar secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecEnd] = s; fState.fSpecVec.Set(spec, secs); }
void SetSpecularNoise(float s, float secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kNoise] = s; fState.fSpecVec.Set(spec, secs); }
void SetSpecularStart(float s, float secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecStart] = s; fState.fSpecVec.Set(spec, secs); }
void SetSpecularEnd(float s, float secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecEnd] = s; fState.fSpecVec.Set(spec, secs); }
// Water Height is overriden if the ref object is animated.
void SetWaterHeight(hsScalar s, hsScalar secs=0) { fState.fWaterHeight.Set(s, secs); }
void SetWaterHeight(float s, float secs=0) { fState.fWaterHeight.Set(s, secs); }
// Water Offset and DepthFalloff are complicated, and not immediately interesting to animate.
void SetWaterOffset(const hsVector3& s, hsScalar secs=0) { fState.fWaterOffset.Set(s, secs); }
void SetOpacOffset(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fWaterOffset; off.fX = s; fState.fWaterOffset.Set(off, secs); }
void SetReflOffset(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fWaterOffset; off.fY = s; fState.fWaterOffset.Set(off, secs); }
void SetWaveOffset(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fWaterOffset; off.fZ = s; fState.fWaterOffset.Set(off, secs); }
void SetDepthFalloff(const hsVector3& s, hsScalar secs=0) { fState.fDepthFalloff.Set(s, secs); }
void SetOpacFalloff(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fDepthFalloff; off.fX = s; fState.fDepthFalloff.Set(off, secs); }
void SetReflFalloff(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fDepthFalloff; off.fY = s; fState.fDepthFalloff.Set(off, secs); }
void SetWaveFalloff(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fDepthFalloff; off.fZ = s; fState.fDepthFalloff.Set(off, secs); }
void SetWaterOffset(const hsVector3& s, float secs=0) { fState.fWaterOffset.Set(s, secs); }
void SetOpacOffset(float s, float secs=0) { hsVector3 off = fState.fWaterOffset; off.fX = s; fState.fWaterOffset.Set(off, secs); }
void SetReflOffset(float s, float secs=0) { hsVector3 off = fState.fWaterOffset; off.fY = s; fState.fWaterOffset.Set(off, secs); }
void SetWaveOffset(float s, float secs=0) { hsVector3 off = fState.fWaterOffset; off.fZ = s; fState.fWaterOffset.Set(off, secs); }
void SetDepthFalloff(const hsVector3& s, float secs=0) { fState.fDepthFalloff.Set(s, secs); }
void SetOpacFalloff(float s, float secs=0) { hsVector3 off = fState.fDepthFalloff; off.fX = s; fState.fDepthFalloff.Set(off, secs); }
void SetReflFalloff(float s, float secs=0) { hsVector3 off = fState.fDepthFalloff; off.fY = s; fState.fDepthFalloff.Set(off, secs); }
void SetWaveFalloff(float s, float secs=0) { hsVector3 off = fState.fDepthFalloff; off.fZ = s; fState.fDepthFalloff.Set(off, secs); }
// Max and Min Atten aren't very interesting, and will probably go away.
void SetMaxAtten(const hsVector3& s, hsScalar secs=0) { fState.fMaxAtten.Set(s, secs); }
void SetMinAtten(const hsVector3& s, hsScalar secs=0) { fState.fMinAtten.Set(s, secs); }
void SetMaxAtten(const hsVector3& s, float secs=0) { fState.fMaxAtten.Set(s, secs); }
void SetMinAtten(const hsVector3& s, float secs=0) { fState.fMinAtten.Set(s, secs); }
// Skipping the shore parameters, because they are never used.
// Water colors, adjust slowly, effect is immediate.
void SetWaterTint(const hsColorRGBA& s, hsScalar secs=0) { fState.fWaterTint.Set(s, secs); }
void SetWaterRGB(const hsVector3& col, hsScalar secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetWaterOpacity()); SetWaterTint(rgb, secs); }
void SetWaterOpacity(hsScalar s, hsScalar secs=0) { hsColorRGBA col = GetWaterTint(); col.a = s; SetWaterTint(col, secs); }
void SetSpecularTint(const hsColorRGBA& s, hsScalar secs=0) { fState.fSpecularTint.Set(s, secs); }
void SetSpecularRGB(const hsVector3& col, hsScalar secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetSpecularMute()); SetSpecularTint(rgb, secs); }
void SetSpecularMute(hsScalar s, hsScalar secs=0) { hsColorRGBA col = GetSpecularTint(); col.a = s; SetSpecularTint(col, secs); }
void SetWaterTint(const hsColorRGBA& s, float secs=0) { fState.fWaterTint.Set(s, secs); }
void SetWaterRGB(const hsVector3& col, float secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetWaterOpacity()); SetWaterTint(rgb, secs); }
void SetWaterOpacity(float s, float secs=0) { hsColorRGBA col = GetWaterTint(); col.a = s; SetWaterTint(col, secs); }
void SetSpecularTint(const hsColorRGBA& s, float secs=0) { fState.fSpecularTint.Set(s, secs); }
void SetSpecularRGB(const hsVector3& col, float secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetSpecularMute()); SetSpecularTint(rgb, secs); }
void SetSpecularMute(float s, float secs=0) { hsColorRGBA col = GetSpecularTint(); col.a = s; SetSpecularTint(col, secs); }
// The environment map is essentially projected onto a sphere. Moving the center of
// the sphere north will move the reflections north, changing the radius of the
// sphere effects parallax in the obvious way.
void SetEnvCenter(const hsPoint3& s, hsScalar secs=0) { fState.fEnvCenter.Set(s, secs); }
void SetEnvRadius(hsScalar s, hsScalar secs=0) { fState.fEnvRadius.Set(s, secs); }
void SetEnvCenter(const hsPoint3& s, float secs=0) { fState.fEnvCenter.Set(s, secs); }
void SetEnvRadius(float s, float secs=0) { fState.fEnvRadius.Set(s, secs); }
// Now a way to get current values. See the accompanying Setter for notes on
// what the parameter means.
//
hsScalar GetGeoMaxLength() const { return fState.fGeoState.fMaxLength; }
hsScalar GetGeoMinLength() const { return fState.fGeoState.fMinLength; }
hsScalar GetGeoAmpOverLen() const { return fState.fGeoState.fAmpOverLen; }
hsScalar GetGeoChop() const { return fState.fGeoState.fChop; }
hsScalar GetGeoAngleDev() const { return fState.fGeoState.fAngleDev; }
float GetGeoMaxLength() const { return fState.fGeoState.fMaxLength; }
float GetGeoMinLength() const { return fState.fGeoState.fMinLength; }
float GetGeoAmpOverLen() const { return fState.fGeoState.fAmpOverLen; }
float GetGeoChop() const { return fState.fGeoState.fChop; }
float GetGeoAngleDev() const { return fState.fGeoState.fAngleDev; }
hsScalar GetTexMaxLength() const { return fState.fTexState.fMaxLength; }
hsScalar GetTexMinLength() const { return fState.fTexState.fMinLength; }
hsScalar GetTexAmpOverLen() const { return fState.fTexState.fAmpOverLen; }
hsScalar GetTexChop() const { return fState.fTexState.fChop; }
hsScalar GetTexAngleDev() const { return fState.fTexState.fAngleDev; }
float GetTexMaxLength() const { return fState.fTexState.fMaxLength; }
float GetTexMinLength() const { return fState.fTexState.fMinLength; }
float GetTexAmpOverLen() const { return fState.fTexState.fAmpOverLen; }
float GetTexChop() const { return fState.fTexState.fChop; }
float GetTexAngleDev() const { return fState.fTexState.fAngleDev; }
hsScalar GetRippleScale() const { return fState.fRippleScale; }
float GetRippleScale() const { return fState.fRippleScale; }
hsVector3 GetWindDir() const { return fState.fWindDir; }
hsScalar GetSpecularNoise() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kNoise]; }
hsScalar GetSpecularStart() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecStart]; }
hsScalar GetSpecularEnd() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecEnd]; }
float GetSpecularNoise() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kNoise]; }
float GetSpecularStart() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecStart]; }
float GetSpecularEnd() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecEnd]; }
hsScalar GetWaterHeight() const { return fState.fWaterHeight; }
float GetWaterHeight() const { return fState.fWaterHeight; }
hsVector3 GetWaterOffset() const { return fState.fWaterOffset; }
hsScalar GetOpacOffset() const { hsVector3 off = fState.fWaterOffset; return off.fX; }
hsScalar GetReflOffset() const { hsVector3 off = fState.fWaterOffset; return off.fY; }
hsScalar GetWaveOffset() const { hsVector3 off = fState.fWaterOffset; return off.fZ; }
float GetOpacOffset() const { hsVector3 off = fState.fWaterOffset; return off.fX; }
float GetReflOffset() const { hsVector3 off = fState.fWaterOffset; return off.fY; }
float GetWaveOffset() const { hsVector3 off = fState.fWaterOffset; return off.fZ; }
hsVector3 GetDepthFalloff() const { return fState.fDepthFalloff; }
hsScalar GetOpacFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fX; }
hsScalar GetReflFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fY; }
hsScalar GetWaveFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fZ; }
float GetOpacFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fX; }
float GetReflFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fY; }
float GetWaveFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fZ; }
hsVector3 GetMaxAtten() const { return fState.fMaxAtten; }
hsVector3 GetMinAtten() const { return fState.fMinAtten; }
hsColorRGBA GetWaterTint() const { return fState.fWaterTint; }
hsVector3 GetWaterRGB() const { hsColorRGBA col = GetWaterTint(); return hsVector3(col.r, col.g, col.b); }
hsScalar GetWaterOpacity() const { return GetWaterTint().a; }
float GetWaterOpacity() const { return GetWaterTint().a; }
hsColorRGBA GetSpecularTint() const { return fState.fSpecularTint; }
hsVector3 GetSpecularRGB() const { hsColorRGBA col = GetSpecularTint(); return hsVector3(col.r, col.g, col.b); }
hsScalar GetSpecularMute() const { return GetSpecularTint().a; }
float GetSpecularMute() const { return GetSpecularTint().a; }
hsPoint3 GetEnvCenter() const { return fState.fEnvCenter; }
hsScalar GetEnvRadius() const { return fState.fEnvRadius; }
float GetEnvRadius() const { return fState.fEnvRadius; }
// Export/debugging functions. For runtime, use message interface (plGenRefMsg, plWaveMsg).
void AddTarget(const plKey& key);
@ -637,12 +637,12 @@ public:
virtual hsBool SetupRippleMat(hsGMaterial* mat, const plRipVSConsts& ripConsts);
virtual hsScalar GetHeight() const { return State().fWaterHeight; }
virtual float GetHeight() const { return State().fWaterHeight; }
const plFixedWaterState7::WaveState& GeoState() const { return State().fGeoState; }
const plFixedWaterState7::WaveState& TexState() const { return State().fTexState; }
const plFixedWaterState7& State() const { return fState; }
void SetState(const plFixedWaterState7& state, hsScalar dur);
void SetState(const plFixedWaterState7& state, float dur);
void SetEnvSize(uint32_t s) { fEnvSize = s; }
uint32_t GetEnvSize() const { return fEnvSize; }

View File

@ -61,12 +61,12 @@ public:
CLASSNAME_REGISTER( plWaveSetBase );
GETINTERFACE_ANY( plWaveSetBase, plMultiModifier );
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; }
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; }
int32_t GetNumProperties() const { return 0; }
virtual hsBool SetupRippleMat(hsGMaterial* mat, const plRipVSConsts& ripConsts) = 0;
virtual hsScalar GetHeight() const = 0;
virtual float GetHeight() const = 0;
virtual hsVector3 GetWindDir() const = 0;