mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 03:09:13 +00:00
Eliminate hsScalar and hsFixed
Modern CPUs support floats just fine... hsFixed was crazy.
This commit is contained in:
@ -66,20 +66,20 @@ plCullPoly& plCullPoly::InitFromVerts(uint32_t f)
|
||||
{
|
||||
fCenter += fVerts[i];
|
||||
}
|
||||
fCenter *= 1.f / hsScalar(fVerts.GetCount());
|
||||
fCenter *= 1.f / float(fVerts.GetCount());
|
||||
|
||||
fRadius = ICalcRadius();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
hsScalar plCullPoly::ICalcRadius() const
|
||||
float plCullPoly::ICalcRadius() const
|
||||
{
|
||||
hsScalar radSq = 0;
|
||||
float radSq = 0;
|
||||
int i;
|
||||
for( i = 0; i < fVerts.GetCount(); i++ )
|
||||
{
|
||||
hsScalar tmpSq = hsVector3(&fVerts[i], &fCenter).MagnitudeSquared();
|
||||
float tmpSq = hsVector3(&fVerts[i], &fCenter).MagnitudeSquared();
|
||||
if( tmpSq > radSq )
|
||||
radSq = tmpSq;
|
||||
}
|
||||
@ -169,8 +169,8 @@ void plCullPoly::Write(hsStream* s, hsResMgr* mgr)
|
||||
#ifdef MF_VALIDATE_POLYS
|
||||
hsBool plCullPoly::Validate() const
|
||||
{
|
||||
const hsScalar kMinMag = 1.e-8f;
|
||||
hsScalar magSq = fNorm.MagnitudeSquared();
|
||||
const float kMinMag = 1.e-8f;
|
||||
float magSq = fNorm.MagnitudeSquared();
|
||||
if( magSq < kMinMag )
|
||||
return false;
|
||||
if( fVerts.GetCount() < 3 )
|
||||
|
@ -51,7 +51,7 @@ class hsStream;
|
||||
class hsResMgr;
|
||||
struct hsMatrix44;
|
||||
|
||||
const hsScalar kCullPolyDegen = 1.e-4f;
|
||||
const float kCullPolyDegen = 1.e-4f;
|
||||
|
||||
class plCullPoly
|
||||
{
|
||||
@ -67,12 +67,12 @@ public:
|
||||
|
||||
hsTArray<hsPoint3> fVerts;
|
||||
hsVector3 fNorm;
|
||||
hsScalar fDist;
|
||||
float fDist;
|
||||
hsPoint3 fCenter;
|
||||
hsScalar fRadius;
|
||||
float fRadius;
|
||||
|
||||
const hsPoint3& GetCenter() const { return fCenter; }
|
||||
hsScalar GetRadius() const { return fRadius; }
|
||||
float GetRadius() const { return fRadius; }
|
||||
|
||||
void SetHole(hsBool on) { if( on )fFlags |= kHole; else fFlags &= ~kHole; }
|
||||
void SetTwoSided(hsBool on) { if( on )fFlags |= kTwoSided; else fFlags &= ~kTwoSided; }
|
||||
@ -83,7 +83,7 @@ public:
|
||||
plCullPoly& Init(const plCullPoly& p) { fClipped.Clear(); fVerts.SetCount(0); fFlags = p.fFlags; fNorm = p.fNorm; fDist = p.fDist; fCenter = p.fCenter; return *this; }
|
||||
plCullPoly& Flip(const plCullPoly& p);
|
||||
plCullPoly& InitFromVerts(uint32_t f=kNone);
|
||||
hsScalar ICalcRadius() const;
|
||||
float ICalcRadius() const;
|
||||
|
||||
plCullPoly& Transform(const hsMatrix44& l2w, const hsMatrix44& w2l, plCullPoly& dst) const;
|
||||
|
||||
|
@ -238,9 +238,9 @@ void plOccluder::IComputeBounds()
|
||||
}
|
||||
}
|
||||
|
||||
hsScalar plOccluder::IComputeSurfaceArea()
|
||||
float plOccluder::IComputeSurfaceArea()
|
||||
{
|
||||
hsScalar area = 0;
|
||||
float area = 0;
|
||||
const hsTArray<plCullPoly>& polys = GetLocalPolyList();
|
||||
int i;
|
||||
for( i =0 ; i < polys.GetCount(); i++ )
|
||||
|
@ -75,12 +75,12 @@ protected:
|
||||
hsTArray<plVisRegion*> fVisRegions;
|
||||
hsBitVector fVisNot;
|
||||
|
||||
hsScalar fPriority;
|
||||
float fPriority;
|
||||
hsBounds3Ext fWorldBounds;
|
||||
|
||||
plKey fSceneNode;
|
||||
|
||||
virtual hsScalar IComputeSurfaceArea();
|
||||
virtual float IComputeSurfaceArea();
|
||||
virtual void IComputeBounds();
|
||||
|
||||
virtual hsTArray<plCullPoly>& IGetLocalPolyList() { return fPolys; }
|
||||
@ -99,7 +99,7 @@ public:
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
virtual hsScalar GetPriority() const { return fPriority; }
|
||||
virtual float GetPriority() const { return fPriority; }
|
||||
|
||||
hsBool InVisSet(const hsBitVector& visSet) const { return fVisSet.Overlap(visSet); }
|
||||
hsBool InVisNot(const hsBitVector& visNot) const { return fVisNot.Overlap(visNot); }
|
||||
|
@ -360,8 +360,8 @@ hsBool plPageTreeMgr::IRenderSortingSpans(plPipeline* pipe, hsTArray<plDrawVisLi
|
||||
if( drawable->GetNativeProperty(plDrawable::kPropSortAsOne) )
|
||||
{
|
||||
const hsBounds3Ext& bnd = drawable->GetSpaceTree()->GetNode(drawable->GetSpaceTree()->GetRoot()).fWorldBounds;
|
||||
plConst(hsScalar) kDistFudge(1.e-1f);
|
||||
listTrav->fKey.fFloat = -(bnd.GetCenter() - viewPos).MagnitudeSquared() + hsScalar(pairs[i].fSpan) * kDistFudge;
|
||||
plConst(float) kDistFudge(1.e-1f);
|
||||
listTrav->fKey.fFloat = -(bnd.GetCenter() - viewPos).MagnitudeSquared() + float(pairs[i].fSpan) * kDistFudge;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -632,7 +632,7 @@ hsBool plPageTreeMgr::IGetCullPolys(plPipeline* pipe)
|
||||
{
|
||||
if( pipe->TestVisibleWorld(fOccluders[i]->GetWorldBounds()) )
|
||||
{
|
||||
hsScalar invDist = -hsFastMath::InvSqrtAppr((viewPos - fOccluders[i]->GetWorldBounds().GetCenter()).MagnitudeSquared());
|
||||
float invDist = -hsFastMath::InvSqrtAppr((viewPos - fOccluders[i]->GetWorldBounds().GetCenter()).MagnitudeSquared());
|
||||
listTrav = &scratchList[numSubmit++];
|
||||
listTrav->fBody = (void*)fOccluders[i];
|
||||
listTrav->fNext = listTrav+1;
|
||||
|
@ -64,8 +64,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
plPostEffectMod::plPostEffectMod()
|
||||
: fHither(1.f),
|
||||
fYon(100.f),
|
||||
fFovX(hsScalarPI * 0.25f),
|
||||
fFovY(hsScalarPI * 0.25f * 0.75f),
|
||||
fFovX(M_PI * 0.25f),
|
||||
fFovY(M_PI * 0.25f * 0.75f),
|
||||
fPageMgr(nil),
|
||||
fRenderTarget(nil),
|
||||
fRenderRequest(nil)
|
||||
@ -157,7 +157,7 @@ hsBool plPostEffectMod::IIsEnabled() const
|
||||
return /*GetTarget() &&*/ !fPageMgr->Empty() && fState.IsBitSet(kEnabled);
|
||||
}
|
||||
|
||||
hsBool plPostEffectMod::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
hsBool plPostEffectMod::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -69,11 +69,11 @@ protected:
|
||||
|
||||
hsBitVector fState;
|
||||
|
||||
hsScalar fHither;
|
||||
hsScalar fYon;
|
||||
float fHither;
|
||||
float fYon;
|
||||
|
||||
hsScalar fFovX;
|
||||
hsScalar fFovY;
|
||||
float fFovX;
|
||||
float fFovY;
|
||||
|
||||
plKey fNodeKey;
|
||||
plPageTreeMgr* fPageMgr;
|
||||
@ -84,7 +84,7 @@ protected:
|
||||
hsMatrix44 fDefaultW2C, fDefaultC2W;
|
||||
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); // called only by owner object's Eval()
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty); // called only by owner object's Eval()
|
||||
|
||||
void ISetupRenderRequest();
|
||||
void IDestroyRenderRequest();
|
||||
@ -118,15 +118,15 @@ public:
|
||||
void SetNodeKey(plKey key) { fNodeKey = key; }
|
||||
plKey GetNodeKey() const { return fNodeKey; }
|
||||
|
||||
void SetHither(hsScalar h) { fHither = h; }
|
||||
void SetYon(hsScalar y) { fYon = y; }
|
||||
void SetFovX(hsScalar f) { fFovX = f; }
|
||||
void SetFovY(hsScalar f) { fFovY = f; }
|
||||
void SetHither(float h) { fHither = h; }
|
||||
void SetYon(float y) { fYon = y; }
|
||||
void SetFovX(float f) { fFovX = f; }
|
||||
void SetFovY(float f) { fFovY = f; }
|
||||
|
||||
hsScalar GetHither() const { return fHither; }
|
||||
hsScalar GetYon() const { return fYon; }
|
||||
hsScalar GetFovX() const { return fFovX; }
|
||||
hsScalar GetFovY() const { return fFovY; }
|
||||
float GetHither() const { return fHither; }
|
||||
float GetYon() const { return fYon; }
|
||||
float GetFovX() const { return fFovX; }
|
||||
float GetFovY() const { return fFovY; }
|
||||
|
||||
plPageTreeMgr* GetPageMgr() const { return fPageMgr; }
|
||||
|
||||
|
@ -75,15 +75,15 @@ protected:
|
||||
|
||||
plKey fAck;
|
||||
|
||||
hsScalar fPriority;
|
||||
float fPriority;
|
||||
|
||||
uint32_t fDrawableMask;
|
||||
uint32_t fSubDrawableMask;
|
||||
|
||||
hsColorRGBA fClearColor;
|
||||
hsScalar fClearDepth;
|
||||
float fClearDepth;
|
||||
|
||||
hsScalar fFogStart;
|
||||
float fFogStart;
|
||||
|
||||
hsMatrix44 fLocalToWorld;
|
||||
hsMatrix44 fWorldToLocal;
|
||||
@ -139,28 +139,28 @@ public:
|
||||
|
||||
const plViewTransform& GetViewTransform() const { return fViewTransform; }
|
||||
|
||||
hsScalar GetHither() const { return fViewTransform.GetHither(); }
|
||||
hsScalar GetYon() const { return fViewTransform.GetYon(); }
|
||||
float GetHither() const { return fViewTransform.GetHither(); }
|
||||
float GetYon() const { return fViewTransform.GetYon(); }
|
||||
|
||||
hsScalar GetFovX() const { return fViewTransform.GetFovXDeg(); }
|
||||
hsScalar GetFovY() const { return fViewTransform.GetFovYDeg(); }
|
||||
float GetFovX() const { return fViewTransform.GetFovXDeg(); }
|
||||
float GetFovY() const { return fViewTransform.GetFovYDeg(); }
|
||||
|
||||
hsScalar GetSizeX() const { return fViewTransform.GetOrthoWidth(); }
|
||||
hsScalar GetSizeY() const { return fViewTransform.GetOrthoHeight(); }
|
||||
float GetSizeX() const { return fViewTransform.GetOrthoWidth(); }
|
||||
float GetSizeY() const { return fViewTransform.GetOrthoHeight(); }
|
||||
|
||||
uint16_t GetScreenWidth() const { return fViewTransform.GetScreenWidth(); }
|
||||
uint16_t GetScreenHeight() const { return fViewTransform.GetScreenHeight(); }
|
||||
|
||||
const hsColorRGBA& GetClearColor() const { return fClearColor; }
|
||||
hsScalar GetClearDepth() const { return fClearDepth; }
|
||||
float GetClearDepth() const { return fClearDepth; }
|
||||
// FogStart
|
||||
// negative => use current settings (default)
|
||||
// 0 => no fog == fog starts at yon
|
||||
// 1 => fog starts at camera.
|
||||
// Fog start greater than 1 is legal. Fog always linear.
|
||||
hsScalar GetFogStart() const { return fFogStart; }
|
||||
float GetFogStart() const { return fFogStart; }
|
||||
|
||||
hsScalar GetPriority() const { return fPriority; }
|
||||
float GetPriority() const { return fPriority; }
|
||||
|
||||
void SetLocalTransform(const hsMatrix44& l2w, const hsMatrix44& w2l);
|
||||
|
||||
@ -171,25 +171,25 @@ public:
|
||||
void SetPerspective(hsBool on=true) { fViewTransform.SetPerspective(on); }
|
||||
void SetOrthogonal(hsBool on=true) { fViewTransform.SetOrthogonal(on); }
|
||||
|
||||
void SetHither(hsScalar f) { fViewTransform.SetHither(f); }
|
||||
void SetYon(hsScalar f) { fViewTransform.SetYon(f); }
|
||||
void SetHither(float f) { fViewTransform.SetHither(f); }
|
||||
void SetYon(float f) { fViewTransform.SetYon(f); }
|
||||
|
||||
void SetFovX(hsScalar f) { fViewTransform.SetFovXDeg(f); }
|
||||
void SetFovY(hsScalar f) { fViewTransform.SetFovYDeg(f); }
|
||||
void SetFovX(float f) { fViewTransform.SetFovXDeg(f); }
|
||||
void SetFovY(float f) { fViewTransform.SetFovYDeg(f); }
|
||||
|
||||
void SetSizeX(hsScalar f) { fViewTransform.SetWidth(f); }
|
||||
void SetSizeY(hsScalar f) { fViewTransform.SetHeight(f); }
|
||||
void SetSizeX(float f) { fViewTransform.SetWidth(f); }
|
||||
void SetSizeY(float f) { fViewTransform.SetHeight(f); }
|
||||
|
||||
void SetClearColor(const hsColorRGBA& c) { fClearColor = c; }
|
||||
void SetClearDepth(hsScalar d) { fClearDepth = d; }
|
||||
void SetClearDepth(float d) { fClearDepth = d; }
|
||||
// FogStart
|
||||
// negative => use current settings (default)
|
||||
// 0 => no fog == fog starts at yon
|
||||
// 1 => fog starts at camera.
|
||||
// Fog start greater than 1 is legal. Fog always linear.
|
||||
void SetFogStart(hsScalar d) { fFogStart = d; }
|
||||
void SetFogStart(float d) { fFogStart = d; }
|
||||
|
||||
void SetPriority(hsScalar p) { fPriority = p; }
|
||||
void SetPriority(float p) { fPriority = p; }
|
||||
|
||||
virtual void Read(hsStream* s, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr);
|
||||
|
Reference in New Issue
Block a user