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

@ -43,11 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define hsTimer_Defined
#include "hsWide.h"
#include "hsScalar.h"
#if !HS_CAN_USE_FLOAT
#error "Unsupported without double's"
#endif // !HS_CAN_USE_FLOAT
class plTimerShare
{
@ -62,14 +57,14 @@ protected:
double fSmoothBuff[kSmoothBuffLen];
int fCurrSlot;
hsScalar fSysTimeScale;
float fSysTimeScale;
double fRealSeconds;
double fSysSeconds;
hsScalar fDelSysSeconds;
hsScalar fFrameTimeInc;
float fDelSysSeconds;
float fFrameTimeInc;
hsBool fRunningFrameTime;
hsScalar fTimeClampSecs;
hsScalar fSmoothingClampSecs;
float fTimeClampSecs;
float fSmoothingClampSecs;
hsBool fClamping;
hsWide* FactorInTimeZero(hsWide* ticks) const;
@ -82,21 +77,21 @@ protected:
double RawTicksToDSeconds(const hsWide& ticks);
hsWide DSecondsToRawTicks(double secs);
hsScalar GetDelSysSeconds() const { return fDelSysSeconds; }
float GetDelSysSeconds() const { return fDelSysSeconds; }
double GetSysSeconds() const { return fSysSeconds; }
double IncSysSeconds();
void SetRealTime(hsBool realTime);
hsBool IsRealTime() const { return !fRunningFrameTime; }
void SetFrameTimeInc(hsScalar inc) { fFrameTimeInc = inc; }
void SetFrameTimeInc(float inc) { fFrameTimeInc = inc; }
void SetTimeScale(hsScalar s) { fSysTimeScale = s; }
hsScalar GetTimeScale() const { return fSysTimeScale; }
void SetTimeScale(float s) { fSysTimeScale = s; }
float GetTimeScale() const { return fSysTimeScale; }
void SetTimeClamp(hsScalar secs) { fTimeClampSecs = secs; }
void SetSmoothingCap(hsScalar secs) { fSmoothingClampSecs = secs; }
hsScalar GetTimeClamp() const { return fTimeClampSecs; }
void SetTimeClamp(float secs) { fTimeClampSecs = secs; }
void SetSmoothingCap(float secs) { fSmoothingClampSecs = secs; }
float GetTimeClamp() const { return fTimeClampSecs; }
hsBool IsClamping() const { return fClamping; }
friend class hsTimer;
@ -127,7 +122,7 @@ public:
static double RawTicksToDSeconds(const hsWide& ticks) { return fTimer->RawTicksToDSeconds(ticks); }
static hsWide DSecondsToRawTicks(double secs) { return fTimer->DSecondsToRawTicks(secs); }
static hsScalar GetDelSysSeconds() { return fTimer->GetDelSysSeconds(); }
static float GetDelSysSeconds() { return fTimer->GetDelSysSeconds(); }
static double GetSysSeconds() { return fTimer->GetSysSeconds(); }
static double IncSysSeconds() { return fTimer->IncSysSeconds(); }
@ -135,14 +130,14 @@ public:
static void SetRealTime(hsBool realTime) { fTimer->SetRealTime(realTime); }
static hsBool IsRealTime() { return fTimer->IsRealTime(); }
static void SetFrameTimeInc(hsScalar inc) { fTimer->SetFrameTimeInc(inc); }
static void SetFrameTimeInc(float inc) { fTimer->SetFrameTimeInc(inc); }
static void SetTimeScale(hsScalar s) { fTimer->SetTimeScale(s); }
static hsScalar GetTimeScale() { return fTimer->GetTimeScale(); }
static void SetTimeScale(float s) { fTimer->SetTimeScale(s); }
static float GetTimeScale() { return fTimer->GetTimeScale(); }
static void SetTimeClamp(hsScalar secs) { fTimer->SetTimeClamp(secs); }
static void SetTimeSmoothingClamp(hsScalar secs) { fTimer->SetSmoothingCap(secs); }
static hsScalar GetTimeClamp() { return fTimer->GetTimeClamp(); }
static void SetTimeClamp(float secs) { fTimer->SetTimeClamp(secs); }
static void SetTimeSmoothingClamp(float secs) { fTimer->SetSmoothingCap(secs); }
static float GetTimeClamp() { return fTimer->GetTimeClamp(); }
static hsBool IsClamping() { return fTimer->IsClamping(); }
///////////////////////////
@ -150,7 +145,7 @@ public:
///////////////////////////
static uint32_t GetPrecTickCount();
static double GetPrecTicksPerSec();
static uint32_t PrecSecsToTicks(hsScalar secs);
static uint32_t PrecSecsToTicks(float secs);
static double PrecTicksToSecs(uint32_t ticks);
static double PrecTicksToHz(uint32_t ticks);

View File

@ -83,10 +83,10 @@ public:
virtual void Stop(int index = -1) = 0;
virtual void FastForwardPlay(int index = -1) = 0;
virtual void FastForwardToggle( int index = -1) = 0;
virtual void SetMin(const hsScalar m,int index = -1) = 0; // sets minimum falloff distance
virtual void SetMax(const hsScalar m,int index = -1) = 0; // sets maximum falloff distance
virtual hsScalar GetMin(int index = -1) const = 0;
virtual hsScalar GetMax(int index = -1) const = 0;
virtual void SetMin(const float m,int index = -1) = 0; // sets minimum falloff distance
virtual void SetMax(const float m,int index = -1) = 0; // sets maximum falloff distance
virtual float GetMin(int index = -1) const = 0;
virtual float GetMax(int index = -1) const = 0;
virtual void SetVelocity(const hsVector3 vel,int index = -1) = 0;
virtual hsVector3 GetVelocity(int index = -1) const = 0;
virtual hsPoint3 GetPosition(int index = -1) = 0;

View File

@ -177,7 +177,7 @@ public:
// 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 = 0;
virtual hsBool GetSubVisDists(int index, hsScalar& minDist, hsScalar& maxDist) const = 0; // return true if span invisible before minDist and/or after maxDist
virtual hsBool GetSubVisDists(int index, float& minDist, float& maxDist) const = 0; // return true if span invisible before minDist and/or after maxDist
// Should implement hsKeyedObject Read/Write/Save/Load as well

View File

@ -121,7 +121,7 @@ public:
virtual void GetSyncState(hsPoint3& pos, hsQuat& rot, hsVector3& linV, hsVector3& angV) = 0;
virtual void SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsVector3* angV) = 0;
virtual hsScalar GetMass() = 0;
virtual float GetMass() = 0;
// I wish I could think of a better way to do this, but this is how it's
// going to be for now.
virtual void ExcludeRegionHack(hsBool cleared) = 0;

View File

@ -217,10 +217,10 @@ public:
virtual void PopRenderRequest(plRenderRequest* req) = 0;
virtual void ClearRenderTarget( plDrawable* d ) = 0; // nil d reverts to ClearRenderTarget(nil, nil).
virtual void ClearRenderTarget(const hsColorRGBA* col = nil, const hsScalar* depth = nil) = 0; // col/depth are overrides for current default.
virtual void SetClear(const hsColorRGBA* col=nil, const hsScalar* depth=nil) = 0; // sets the default clear for current render target.
virtual void ClearRenderTarget(const hsColorRGBA* col = nil, const float* depth = nil) = 0; // col/depth are overrides for current default.
virtual void SetClear(const hsColorRGBA* col=nil, const float* depth=nil) = 0; // sets the default clear for current render target.
virtual hsColorRGBA GetClearColor() const = 0;
virtual hsScalar GetClearDepth() const = 0;
virtual float GetClearDepth() const = 0;
virtual hsGDeviceRef *MakeRenderTargetRef( plRenderTarget *owner ) = 0;
virtual void PushRenderTarget( plRenderTarget *target ) = 0;
virtual plRenderTarget *PopRenderTarget( void ) = 0;
@ -279,17 +279,17 @@ public:
virtual hsVector3 GetViewDirWorld() const = 0;
virtual void GetViewAxesWorld(hsVector3 axes[3] /* ac,up,at */ ) const = 0;
virtual void GetFOV(hsScalar& fovX, hsScalar& fovY) const = 0;
virtual void SetFOV(hsScalar fovX, hsScalar fovY) = 0;
virtual void GetFOV(float& fovX, float& fovY) const = 0;
virtual void SetFOV(float fovX, float fovY) = 0;
virtual void GetSize(hsScalar& width, hsScalar& height) const = 0;
virtual void SetSize(hsScalar width, hsScalar height) = 0;
virtual void GetSize(float& width, float& height) const = 0;
virtual void SetSize(float width, float height) = 0;
virtual void GetDepth(hsScalar& hither, hsScalar& yon) const = 0;
virtual void SetDepth(hsScalar hither, hsScalar yon) = 0;
virtual void GetDepth(float& hither, float& yon) const = 0;
virtual void SetDepth(float hither, float yon) = 0;
virtual void SetZBiasScale( hsScalar scale ) = 0;
virtual hsScalar GetZBiasScale( void ) const = 0;
virtual void SetZBiasScale( float scale ) = 0;
virtual float GetZBiasScale( void ) const = 0;
virtual const hsMatrix44& GetWorldToCamera() const = 0;
virtual const hsMatrix44& GetCameraToWorld() const = 0;
@ -301,7 +301,7 @@ public:
virtual const plViewTransform& GetViewTransform() const = 0;
virtual void ScreenToWorldPoint( int n, uint32_t stride, int32_t *scrX, int32_t *scrY,
hsScalar dist, uint32_t strideOut, hsPoint3 *worldOut ) = 0;
float dist, uint32_t strideOut, hsPoint3 *worldOut ) = 0;
virtual void RefreshMatrices( void ) = 0;
virtual void RefreshScreenMatrices( void ) = 0;
@ -330,9 +330,9 @@ public:
virtual void SubmitClothingOutfit(plClothingOutfit* co) = 0;
// These all return true if the gamma was successfully set.
virtual hsBool SetGamma(hsScalar eR, hsScalar eG, hsScalar eB) = 0;
virtual hsBool SetGamma(float eR, float eG, float eB) = 0;
virtual hsBool SetGamma(const uint16_t* const tabR, const uint16_t* const tabG, const uint16_t* const tabB) = 0; // len table = 256.
virtual hsBool SetGamma(hsScalar e) { return SetGamma(e, e, e); }
virtual hsBool SetGamma(float e) { return SetGamma(e, e, e); }
virtual hsBool SetGamma(const uint16_t* const table) { return SetGamma(table, table, table); }
// flipVertical is for the AVI writer, which wants it's frames upside down