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:
@ -62,14 +62,14 @@ protected:
|
||||
hsDynamicArray<plKey> fFogNodes;
|
||||
// hsGEnvironment::FogState fAvgFog;
|
||||
|
||||
virtual hsScalar IGetStrength(hsSceneNode* node) = 0;
|
||||
virtual float IGetStrength(hsSceneNode* node) = 0;
|
||||
|
||||
void IPopNodes();
|
||||
void IPushNodes();
|
||||
|
||||
void IZeroAvgFog();
|
||||
void IAverageNodes();
|
||||
// void IAccumFog(hsGEnvironment* env, hsScalar wgt);
|
||||
// void IAccumFog(hsGEnvironment* env, float wgt);
|
||||
|
||||
public:
|
||||
hsFogControl() {}
|
||||
@ -120,17 +120,17 @@ protected:
|
||||
};
|
||||
|
||||
hsDynamicArray<plKey> fPortals;
|
||||
hsScalar fDefRadius;
|
||||
float fDefRadius;
|
||||
|
||||
uint32_t fStatus;
|
||||
|
||||
void IFindFogNodes();
|
||||
virtual hsScalar IGetStrength(hsSceneNode* node);
|
||||
virtual float IGetStrength(hsSceneNode* node);
|
||||
public:
|
||||
hsPortalFogControl();
|
||||
|
||||
void SetDefaultRadius(hsScalar r) { fDefRadius = r; }
|
||||
hsScalar GetDefaultRadius() { return fDefRadius; }
|
||||
void SetDefaultRadius(float r) { fDefRadius = r; }
|
||||
float GetDefaultRadius() { return fDefRadius; }
|
||||
|
||||
hsPortal* GetPortal(int i);
|
||||
|
||||
|
@ -1230,7 +1230,7 @@ namespace
|
||||
/// The table consists of entries for each of our supported chipsets in the table,
|
||||
/// plus, flags to be forced set and flags to be forced cleared. Also included
|
||||
/// is a Z-buffer suckiness rating, which represents how badly we need to bias
|
||||
/// the z and w values to avoid z-buffer artifacts, stored as an hsScalar (i.e
|
||||
/// the z and w values to avoid z-buffer artifacts, stored as an float (i.e
|
||||
/// a float). A rating of 0 means very good/default (read: Nvidia), while, say,
|
||||
/// a 9.0 (i.e. shift the scale 9 times above normal) means s****y, like, say,
|
||||
/// a Savage4. Also also included is a forced value for max # of layers (0 means
|
||||
@ -1281,13 +1281,13 @@ namespace
|
||||
|
||||
typedef struct
|
||||
{
|
||||
hsScalar fFogExpApproxStart;
|
||||
hsScalar fFogExp2ApproxStart;
|
||||
hsScalar fFogEndBias;
|
||||
hsScalar fFogExpKnee; // Fog knees
|
||||
hsScalar fFogExpKneeVal;
|
||||
hsScalar fFogExp2Knee;
|
||||
hsScalar fFogExp2KneeVal;
|
||||
float fFogExpApproxStart;
|
||||
float fFogExp2ApproxStart;
|
||||
float fFogEndBias;
|
||||
float fFogExpKnee; // Fog knees
|
||||
float fFogExpKneeVal;
|
||||
float fFogExp2Knee;
|
||||
float fFogExp2KneeVal;
|
||||
} FogTweakTable;
|
||||
|
||||
FogTweakTable dsDefaultFogVals = { 0, 0, 254.0 / 255.0, 0.5f, 0.15f, 0.5f, 0.15f };
|
||||
@ -1301,9 +1301,9 @@ namespace
|
||||
uint8_t fType; // Our chipset ID
|
||||
uint32_t *fFlagsToSet;
|
||||
uint32_t *fFlagsToClear;
|
||||
hsScalar fZSuckiness; // See above
|
||||
float fZSuckiness; // See above
|
||||
uint32_t fForceMaxLayers; // The max # of layers we REALLY want (0 to not force)
|
||||
hsScalar fLODRating;
|
||||
float fLODRating;
|
||||
FogTweakTable *fFogTweaks;
|
||||
} CFTable;
|
||||
|
||||
|
@ -146,7 +146,7 @@ hsBool plCaptureRender::Capture(const plKey& ack, uint16_t width, uint16_t heigh
|
||||
// Create a render request and render request message
|
||||
plCaptureRenderRequest* req = TRACKED_NEW plCaptureRenderRequest;
|
||||
|
||||
const hsScalar pri(-100.f);
|
||||
const float pri(-100.f);
|
||||
req->SetPriority(pri);
|
||||
|
||||
req->SetRenderTarget(rt);
|
||||
|
@ -124,7 +124,7 @@ void plCubicRenderTargetModifier::ICreateRenderRequest( int face )
|
||||
|
||||
//// IEval ////////////////////////////////////////////////////////////////////
|
||||
|
||||
hsBool plCubicRenderTargetModifier::IEval( double secs, hsScalar del, uint32_t dirty )
|
||||
hsBool plCubicRenderTargetModifier::IEval( double secs, float del, uint32_t dirty )
|
||||
{
|
||||
hsPoint3 center;
|
||||
hsMatrix44 mtx, invMtx;
|
||||
@ -178,7 +178,7 @@ hsBool plCubicRenderTargetModifier::MsgReceive( plMessage* msg )
|
||||
if( eval )
|
||||
{
|
||||
const double secs = eval->DSeconds();
|
||||
const hsScalar del = eval->DelSeconds();
|
||||
const float del = eval->DelSeconds();
|
||||
IEval( secs, del, 0 );
|
||||
return true;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ protected:
|
||||
|
||||
plRenderRequest *fRequests[ 6 ];
|
||||
|
||||
virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // required by plModifier
|
||||
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // required by plModifier
|
||||
|
||||
void ICreateRenderRequest( int face );
|
||||
|
||||
|
@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#define MF_DEBUG_NORM
|
||||
#ifdef MF_DEBUG_NORM
|
||||
|
||||
#define IDEBUG_NORMALIZE( a, b ) { hsScalar len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared()); a *= len; b *= len; }
|
||||
#define IDEBUG_NORMALIZE( a, b ) { float len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared()); a *= len; b *= len; }
|
||||
|
||||
#else // MF_DEBUG_NORM
|
||||
#define IDEBUG_NORMALIZE( a, b )
|
||||
@ -60,10 +60,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
//#define CULL_SMALL_TOLERANCE
|
||||
#ifdef CULL_SMALL_TOLERANCE
|
||||
//static const hsScalar kTolerance = 1.e-5f;
|
||||
static const hsScalar kTolerance = 1.e-3f;
|
||||
//static const float kTolerance = 1.e-5f;
|
||||
static const float kTolerance = 1.e-3f;
|
||||
#else //CULL_SMALL_TOLERANCE
|
||||
static const hsScalar kTolerance = 1.e-1f;
|
||||
static const float kTolerance = 1.e-1f;
|
||||
#endif // CULL_SMALL_TOLERANCE
|
||||
|
||||
plProfile_CreateCounter("Harvest Nodes", "Draw", HarvestNodes);
|
||||
@ -128,8 +128,8 @@ plCullNode::plCullStatus plCullNode::TestBounds(const hsBounds3Ext& bnd) const
|
||||
// side timings to be sure. Still looking for some reasonably constructed real data sets. mf
|
||||
#define MF_TEST_SPHERE_FIRST
|
||||
#ifdef MF_TEST_SPHERE_FIRST
|
||||
hsScalar dist = fNorm.InnerProduct(bnd.GetCenter()) + fDist;
|
||||
hsScalar rad = bnd.GetRadius();
|
||||
float dist = fNorm.InnerProduct(bnd.GetCenter()) + fDist;
|
||||
float rad = bnd.GetRadius();
|
||||
if( dist < -rad )
|
||||
return kCulled;
|
||||
if( dist > rad )
|
||||
@ -139,7 +139,7 @@ plCullNode::plCullStatus plCullNode::TestBounds(const hsBounds3Ext& bnd) const
|
||||
hsPoint2 depth;
|
||||
bnd.TestPlane(fNorm, depth);
|
||||
|
||||
const hsScalar kSafetyDist = -0.1f;
|
||||
const float kSafetyDist = -0.1f;
|
||||
if( depth.fY + fDist < kSafetyDist )
|
||||
return kCulled;
|
||||
|
||||
@ -149,7 +149,7 @@ plCullNode::plCullStatus plCullNode::TestBounds(const hsBounds3Ext& bnd) const
|
||||
return kSplit;
|
||||
}
|
||||
|
||||
plCullNode::plCullStatus plCullNode::ITestSphereRecur(const hsPoint3& center, hsScalar rad) const
|
||||
plCullNode::plCullStatus plCullNode::ITestSphereRecur(const hsPoint3& center, float rad) const
|
||||
{
|
||||
plCullNode::plCullStatus retVal = TestSphere(center, rad);
|
||||
|
||||
@ -198,9 +198,9 @@ plCullNode::plCullStatus plCullNode::ITestSphereRecur(const hsPoint3& center, hs
|
||||
return kCulled;
|
||||
}
|
||||
|
||||
plCullNode::plCullStatus plCullNode::TestSphere(const hsPoint3& center, hsScalar rad) const
|
||||
plCullNode::plCullStatus plCullNode::TestSphere(const hsPoint3& center, float rad) const
|
||||
{
|
||||
hsScalar dist = fNorm.InnerProduct(center) + fDist;
|
||||
float dist = fNorm.InnerProduct(center) + fDist;
|
||||
if( dist < -rad )
|
||||
return kCulled;
|
||||
if( dist > rad )
|
||||
@ -384,7 +384,7 @@ void plCullNode::IHarvest(const plSpaceTree* space, hsTArray<int16_t>& outList)
|
||||
// This section builds the tree from the input cullpoly's
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray<hsScalar>& depths,
|
||||
void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray<float>& depths,
|
||||
hsBitVector& inVerts,
|
||||
hsBitVector& outVerts,
|
||||
hsBitVector& onVerts,
|
||||
@ -415,7 +415,7 @@ void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray<hsScalar>& de
|
||||
if( outVerts.IsBitSet(outPoly.fVerts.GetCount()-1) )
|
||||
{
|
||||
hsPoint3 interp;
|
||||
hsScalar t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp);
|
||||
float t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp);
|
||||
// add interp
|
||||
onVerts.SetBit(outPoly.fVerts.GetCount());
|
||||
if( poly.fClipped.IsBitSet(i-1) )
|
||||
@ -429,7 +429,7 @@ void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray<hsScalar>& de
|
||||
if( inVerts.IsBitSet(outPoly.fVerts.GetCount()-1) )
|
||||
{
|
||||
hsPoint3 interp;
|
||||
hsScalar t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp);
|
||||
float t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp);
|
||||
// add interp
|
||||
onVerts.SetBit(outPoly.fVerts.GetCount());
|
||||
if( poly.fClipped.IsBitSet(i-1) )
|
||||
@ -451,7 +451,7 @@ void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray<hsScalar>& de
|
||||
||(outVerts.IsBitSet(outPoly.fVerts.GetCount()-1) && inVerts.IsBitSet(0)) )
|
||||
{
|
||||
hsPoint3 interp;
|
||||
hsScalar t = IInterpVert(poly.fVerts[poly.fVerts.GetCount()-1], poly.fVerts[0], interp);
|
||||
float t = IInterpVert(poly.fVerts[poly.fVerts.GetCount()-1], poly.fVerts[0], interp);
|
||||
onVerts.SetBit(outPoly.fVerts.GetCount());
|
||||
if( poly.fClipped.IsBitSet(poly.fVerts.GetCount()-1) )
|
||||
outPoly.fClipped.SetBit(outPoly.fVerts.GetCount());
|
||||
@ -477,7 +477,7 @@ void plCullNode::ITakeHalfPoly(const plCullPoly& srcPoly,
|
||||
if( onVerts.IsBitSet(vtxIdx[i]) && onVerts.IsBitSet(vtxIdx[last]) && onVerts.IsBitSet(vtxIdx[next]) )
|
||||
{
|
||||
#if 0 // FISH
|
||||
hsScalar dot = hsVector3(&srcPoly.fVerts[vtxIdx[last]], &srcPoly.fVerts[vtxIdx[i]]).InnerProduct(hsVector3(&srcPoly.fVerts[vtxIdx[next]], &srcPoly.fVerts[vtxIdx[i]]));
|
||||
float dot = hsVector3(&srcPoly.fVerts[vtxIdx[last]], &srcPoly.fVerts[vtxIdx[i]]).InnerProduct(hsVector3(&srcPoly.fVerts[vtxIdx[next]], &srcPoly.fVerts[vtxIdx[i]]));
|
||||
if( dot <= 0 )
|
||||
#endif // FISH
|
||||
continue;
|
||||
@ -512,7 +512,7 @@ plCullNode::plCullStatus plCullNode::ISplitPoly(const plCullPoly& poly,
|
||||
plCullPoly*& innerPoly,
|
||||
plCullPoly*& outerPoly) const
|
||||
{
|
||||
static hsTArray<hsScalar> depths;
|
||||
static hsTArray<float> depths;
|
||||
depths.SetCount(poly.fVerts.GetCount());
|
||||
|
||||
static hsBitVector onVerts;
|
||||
@ -597,12 +597,12 @@ plCullNode::plCullStatus plCullNode::ISplitPoly(const plCullPoly& poly,
|
||||
return kSplit;
|
||||
}
|
||||
|
||||
hsScalar plCullNode::IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const
|
||||
float plCullNode::IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const
|
||||
{
|
||||
hsVector3 oneToOh;
|
||||
oneToOh.Set(&p0, &p1);
|
||||
|
||||
hsScalar t = -(fNorm.InnerProduct(p1) + fDist) / fNorm.InnerProduct(oneToOh);
|
||||
float t = -(fNorm.InnerProduct(p1) + fDist) / fNorm.InnerProduct(oneToOh);
|
||||
if( t >= 1.f )
|
||||
{
|
||||
out = p0;
|
||||
@ -658,8 +658,8 @@ void plCullTree::AddPoly(const plCullPoly& poly)
|
||||
|
||||
hsVector3 cenToEye(&fViewPos, &poly.fCenter);
|
||||
hsFastMath::NormalizeAppr(cenToEye);
|
||||
hsScalar camDist = cenToEye.InnerProduct(poly.fNorm);
|
||||
plConst(hsScalar) kTol(0.1f);
|
||||
float camDist = cenToEye.InnerProduct(poly.fNorm);
|
||||
plConst(float) kTol(0.1f);
|
||||
hsBool backFace = camDist < -kTol;
|
||||
if( !backFace && (camDist < kTol) )
|
||||
return;
|
||||
@ -768,7 +768,7 @@ int16_t plCullTree::IMakePolyNode(const plCullPoly& poly, int i0, int i1) const
|
||||
a.Set(&poly.fVerts[i0], &fViewPos);
|
||||
b.Set(&poly.fVerts[i1], &fViewPos);
|
||||
hsVector3 n = a % b;
|
||||
hsScalar d = -n.InnerProduct(fViewPos);
|
||||
float d = -n.InnerProduct(fViewPos);
|
||||
|
||||
IDEBUG_NORMALIZE(n, d);
|
||||
|
||||
@ -1000,7 +1000,7 @@ void plCullTree::InitFrustum(const hsMatrix44& world2NDC)
|
||||
|
||||
plCullNode* node;
|
||||
hsVector3 norm;
|
||||
hsScalar dist;
|
||||
float dist;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < 2; i++ )
|
||||
@ -1080,7 +1080,7 @@ hsBool plCullTree::BoundsVisible(const hsBounds3Ext& bnd) const
|
||||
return plCullNode::kCulled != IGetRoot()->ITestBoundsRecur(bnd);
|
||||
}
|
||||
|
||||
hsBool plCullTree::SphereVisible(const hsPoint3& center, hsScalar rad) const
|
||||
hsBool plCullTree::SphereVisible(const hsPoint3& center, float rad) const
|
||||
{
|
||||
return plCullNode::kCulled != IGetRoot()->ITestSphereRecur(center, rad);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ protected:
|
||||
mutable hsTArray<hsVector3> fVisNorms;
|
||||
mutable hsTArray<hsColorRGBA> fVisColors;
|
||||
mutable hsTArray<uint16_t> fVisTris;
|
||||
mutable hsScalar fVisYon;
|
||||
mutable float fVisYon;
|
||||
|
||||
mutable hsTArray<plCullPoly> fScratchPolys;
|
||||
mutable hsLargeArray<int16_t> fScratchClear;
|
||||
@ -125,10 +125,10 @@ public:
|
||||
|
||||
virtual void Harvest(const plSpaceTree* space, hsTArray<int16_t>& outList) const;
|
||||
virtual hsBool BoundsVisible(const hsBounds3Ext& bnd) const;
|
||||
virtual hsBool SphereVisible(const hsPoint3& center, hsScalar rad) const;
|
||||
virtual hsBool SphereVisible(const hsPoint3& center, float rad) const;
|
||||
|
||||
// Visualization stuff. Only to be called by the pipeline (or some other vis manager).
|
||||
void SetVisualizationYon(hsScalar y) const { fVisYon = y; }
|
||||
void SetVisualizationYon(float y) const { fVisYon = y; }
|
||||
void BeginCapturePolys() const { fCapturePolys = true; }
|
||||
void EndCapturePolys() const { fCapturePolys = false; }
|
||||
hsTArray<hsPoint3>& GetCaptureVerts() const { return fVisVerts; }
|
||||
@ -150,7 +150,7 @@ enum plCullStatus
|
||||
};
|
||||
protected:
|
||||
hsVector3 fNorm;
|
||||
hsScalar fDist;
|
||||
float fDist;
|
||||
|
||||
hsBool fIsFace;
|
||||
|
||||
@ -172,7 +172,7 @@ protected:
|
||||
|
||||
// Bounds only version
|
||||
plCullNode::plCullStatus ITestBoundsRecur(const hsBounds3Ext& bnd) const;
|
||||
plCullNode::plCullStatus ITestSphereRecur(const hsPoint3& center, hsScalar rad) const;
|
||||
plCullNode::plCullStatus ITestSphereRecur(const hsPoint3& center, float rad) const;
|
||||
|
||||
// Using the nodes
|
||||
plCullNode::plCullStatus ITestNode(const plSpaceTree* space, int16_t who, hsLargeArray<int16_t>& clear, hsLargeArray<int16_t>& split, hsLargeArray<int16_t>& culled) const;
|
||||
@ -180,14 +180,14 @@ protected:
|
||||
void IHarvest(const plSpaceTree* space, hsTArray<int16_t>& outList) const;
|
||||
|
||||
// Constructing the tree
|
||||
hsScalar IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const;
|
||||
float IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const;
|
||||
plCullNode::plCullStatus ISplitPoly(const plCullPoly& poly, plCullPoly*& innerPoly, plCullPoly*& outerPoly) const;
|
||||
void IMarkClipped(const plCullPoly& poly, const hsBitVector& onVerts) const;
|
||||
void ITakeHalfPoly(const plCullPoly& scrPoly,
|
||||
const hsTArray<int>& vtxIdx,
|
||||
const hsBitVector& onVerts,
|
||||
plCullPoly& outPoly) const;
|
||||
void IBreakPoly(const plCullPoly& poly, const hsTArray<hsScalar>& depths,
|
||||
void IBreakPoly(const plCullPoly& poly, const hsTArray<float>& depths,
|
||||
hsBitVector& inVerts,
|
||||
hsBitVector& outVerts,
|
||||
hsBitVector& onVerts,
|
||||
@ -203,16 +203,16 @@ protected:
|
||||
friend class plCullTree;
|
||||
public:
|
||||
|
||||
void Init(const plCullTree* t, const hsVector3& n, hsScalar d) { fIsFace = false; fTree = t; fInnerChild = fOuterChild = -1; SetPlane(n, d); }
|
||||
void Init(const plCullTree* t, const hsVector3& n, float d) { fIsFace = false; fTree = t; fInnerChild = fOuterChild = -1; SetPlane(n, d); }
|
||||
void Init(const plCullTree* t, const plCullPoly& poly) { Init(t, poly.fNorm, poly.fDist); }
|
||||
|
||||
void SetPlane(const hsVector3& n, hsScalar d) { fNorm = n; fDist = d; }
|
||||
void SetPlane(const hsVector3& n, float d) { fNorm = n; fDist = d; }
|
||||
|
||||
const hsVector3& GetNormal() const { return fNorm; }
|
||||
const hsScalar GetDist() const { return fDist; }
|
||||
const float GetDist() const { return fDist; }
|
||||
|
||||
plCullStatus TestBounds(const hsBounds3Ext& bnd) const;
|
||||
plCullStatus TestSphere(const hsPoint3& center, hsScalar rad) const;
|
||||
plCullStatus TestSphere(const hsPoint3& center, float rad) const;
|
||||
};
|
||||
|
||||
inline plCullNode* plCullNode::IGetNode(int16_t i) const
|
||||
|
@ -198,7 +198,7 @@ void plDTProgressMgr::IDrawTheStupidThing( plPipeline *p, plOperationProgress
|
||||
uint16_t rightX = drawX + drawWidth;
|
||||
|
||||
if (prog->GetProgress() <= prog->GetMax())
|
||||
drawWidth = (uint16_t)( (hsScalar)width * prog->GetProgress() / prog->GetMax() );
|
||||
drawWidth = (uint16_t)( (float)width * prog->GetProgress() / prog->GetMax() );
|
||||
|
||||
rightX = drawX + drawWidth;
|
||||
|
||||
|
@ -303,7 +303,7 @@ void plDXLightRef::UpdateD3DInfo( IDirect3DDevice9 *dev, plDXLightSettings *s
|
||||
|
||||
fD3DInfo.Falloff = spotOwner->GetFalloff();
|
||||
fD3DInfo.Theta = spotOwner->GetSpotInner() * 2;
|
||||
// fD3DInfo.Phi = spotOwner->GetProjection() ? hsScalarPI : spotOwner->GetSpotOuter() * 2;
|
||||
// fD3DInfo.Phi = spotOwner->GetProjection() ? M_PI : spotOwner->GetSpotOuter() * 2;
|
||||
// D3D doesn't seem to like a Phi of PI, even though that's supposed to be the
|
||||
// largest legal value. Symptom is an erratic, intermitant, unpredictable failure
|
||||
// of the light to light, with bizarreness like lighting one object but not the object
|
||||
|
@ -70,7 +70,7 @@ class plDXLightRef : public plDXDeviceRef
|
||||
|
||||
D3DLIGHT9 fD3DInfo;
|
||||
uint32_t fD3DIndex;
|
||||
hsScalar fScale;
|
||||
float fScale;
|
||||
|
||||
plDXLightSettings *fParentSettings;
|
||||
IDirect3DDevice9 *fD3DDevice;
|
||||
|
@ -260,7 +260,7 @@ static const enum _D3DTRANSFORMSTATETYPE sTextureStages[ 8 ] =
|
||||
static const float kPerspLayerScale = 0.00001f;
|
||||
static const float kPerspLayerScaleW = 0.001f;
|
||||
static const float kPerspLayerTrans = 0.00002f;
|
||||
static const hsScalar kAvTexPoolShrinkThresh = 30.f; // seconds
|
||||
static const float kAvTexPoolShrinkThresh = 30.f; // seconds
|
||||
|
||||
// This caps the number of D3D lights we use. We'll use up to the max allowed
|
||||
// or this number, whichever is smaller. (This is to prevent us going haywire
|
||||
@ -1255,12 +1255,12 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec )
|
||||
//// Get/SetZBiasScale ////////////////////////////////////////////////////////
|
||||
// If the board really doesn't support Z-biasing, we adjust the perspective matrix in IGetCameraToNDC
|
||||
// The layer scale and translation are tailored to the current hardware.
|
||||
hsScalar plDXPipeline::GetZBiasScale() const
|
||||
float plDXPipeline::GetZBiasScale() const
|
||||
{
|
||||
return ( fTweaks.fPerspLayerScale / fTweaks.fDefaultPerspLayerScale ) - 1.0f;
|
||||
}
|
||||
|
||||
void plDXPipeline::SetZBiasScale( hsScalar scale )
|
||||
void plDXPipeline::SetZBiasScale( float scale )
|
||||
{
|
||||
scale += 1.0f;
|
||||
fTweaks.fPerspLayerScale = fTweaks.fDefaultPerspLayerScale * scale;
|
||||
@ -2655,7 +2655,7 @@ hsBool plDXPipeline::PreRender( plDrawable* drawable, hsTArray<int16_t>& visLis
|
||||
struct plSortFace
|
||||
{
|
||||
uint16_t fIdx[3];
|
||||
hsScalar fDist;
|
||||
float fDist;
|
||||
};
|
||||
|
||||
struct plCompSortFace : public std::binary_function<plSortFace, plSortFace, bool>
|
||||
@ -2743,8 +2743,8 @@ hsBool plDXPipeline::IAvatarSort(plDrawableSpans* d, const hsTArray<int16_t>& vi
|
||||
uint16_t idx = *indices++;
|
||||
sortScratch[j].fIdx[0] = idx;
|
||||
hsPoint3 pos = *(hsPoint3*)(vdata + idx * stride);
|
||||
hsScalar dist = hsVector3(&pos, &viewPos).MagnitudeSquared();
|
||||
hsScalar minDist = dist;
|
||||
float dist = hsVector3(&pos, &viewPos).MagnitudeSquared();
|
||||
float minDist = dist;
|
||||
|
||||
idx = *indices++;
|
||||
sortScratch[j].fIdx[1] = idx;
|
||||
@ -2765,8 +2765,8 @@ hsBool plDXPipeline::IAvatarSort(plDrawableSpans* d, const hsTArray<int16_t>& vi
|
||||
uint16_t idx = *indices++;
|
||||
sortScratch[j].fIdx[0] = idx;
|
||||
hsPoint3 pos = *(hsPoint3*)(vdata + idx * stride);
|
||||
hsScalar dist = hsVector3(&pos, &viewPos).MagnitudeSquared();
|
||||
hsScalar maxDist = dist;
|
||||
float dist = hsVector3(&pos, &viewPos).MagnitudeSquared();
|
||||
float maxDist = dist;
|
||||
|
||||
idx = *indices++;
|
||||
sortScratch[j].fIdx[1] = idx;
|
||||
@ -3178,7 +3178,7 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray<int16_t>&
|
||||
if( !(currProj && (span->fProps & plSpan::kPropSkipProjection)) )
|
||||
{
|
||||
plDXLightRef *ref = (plDXLightRef *)light->GetDeviceRef();
|
||||
hsScalar strength, scale;
|
||||
float strength, scale;
|
||||
|
||||
light->GetStrengthAndScale(span->fWorldBounds, strength, scale);
|
||||
|
||||
@ -3226,7 +3226,7 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray<int16_t>&
|
||||
if( !(currProj && (span->fProps & plSpan::kPropSkipProjection)) )
|
||||
{
|
||||
plDXLightRef *ref = (plDXLightRef *)light->GetDeviceRef();
|
||||
hsScalar strength, scale;
|
||||
float strength, scale;
|
||||
|
||||
light->GetStrengthAndScale(span->fWorldBounds, strength, scale);
|
||||
|
||||
@ -3273,7 +3273,7 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray<int16_t>&
|
||||
if( !(currProj && (span->fProps & plSpan::kPropSkipProjection)) )
|
||||
{
|
||||
plDXLightRef *ref = (plDXLightRef *)light->GetDeviceRef();
|
||||
hsScalar strength, scale;
|
||||
float strength, scale;
|
||||
|
||||
light->GetStrengthAndScale(span->fWorldBounds, strength, scale);
|
||||
|
||||
@ -3343,7 +3343,7 @@ void plDXPipeline::IGetVisibleSpans( plDrawableSpans* drawable, hsTArray<int16_t
|
||||
if( fView.fCullTreeDirty )
|
||||
IRefreshCullTree();
|
||||
|
||||
const hsScalar viewDist = GetViewDirWorld().InnerProduct(GetViewPositionWorld());
|
||||
const float viewDist = GetViewDirWorld().InnerProduct(GetViewPositionWorld());
|
||||
|
||||
const hsTArray<plSpan *> &spans = drawable->GetSpanArray();
|
||||
|
||||
@ -3389,7 +3389,7 @@ void plDXPipeline::IGetVisibleSpans( plDrawableSpans* drawable, hsTArray<int16_t
|
||||
// We'll check here for spans we can discard because they've completely distance faded out.
|
||||
// Note this is based on view direction distance (because the fade is), rather than the
|
||||
// preferrable distance to camera we sort by.
|
||||
hsScalar minDist, maxDist;
|
||||
float minDist, maxDist;
|
||||
if( drawable->GetSubVisDists(tmpVis[i], minDist, maxDist) )
|
||||
{
|
||||
const hsBounds3Ext& bnd = drawable->GetSpaceTree()->GetNode(tmpVis[i]).fWorldBounds;
|
||||
@ -4066,7 +4066,7 @@ hsBool plDXPipeline::EndRender()
|
||||
// SetGamma ////////////////////////////////////////////////////////////
|
||||
// Create and set a gamma table based on the input exponent values for
|
||||
// R, G, and B. Can also set explicit table using the other SetGamma().
|
||||
hsBool plDXPipeline::SetGamma(hsScalar eR, hsScalar eG, hsScalar eB)
|
||||
hsBool plDXPipeline::SetGamma(float eR, float eG, float eB)
|
||||
{
|
||||
if( fSettings.fNoGammaCorrect )
|
||||
return false;
|
||||
@ -4075,7 +4075,7 @@ hsBool plDXPipeline::SetGamma(hsScalar eR, hsScalar eG, hsScalar eB)
|
||||
|
||||
ramp.red[0] = ramp.green[0] = ramp.blue[0] = 0L;
|
||||
|
||||
plConst(hsScalar) kMinE(0.1f);
|
||||
plConst(float) kMinE(0.1f);
|
||||
if( eR > kMinE )
|
||||
eR = 1.f / eR;
|
||||
else
|
||||
@ -4092,19 +4092,19 @@ hsBool plDXPipeline::SetGamma(hsScalar eR, hsScalar eG, hsScalar eB)
|
||||
int i;
|
||||
for( i = 1; i < 256; i++ )
|
||||
{
|
||||
hsScalar orig = hsScalar(i) / 255.f;
|
||||
float orig = float(i) / 255.f;
|
||||
|
||||
hsScalar gamm;
|
||||
float gamm;
|
||||
gamm = pow(orig, eR);
|
||||
gamm *= hsScalar(uint16_t(-1));
|
||||
gamm *= float(uint16_t(-1));
|
||||
ramp.red[i] = uint16_t(gamm);
|
||||
|
||||
gamm = pow(orig, eG);
|
||||
gamm *= hsScalar(uint16_t(-1));
|
||||
gamm *= float(uint16_t(-1));
|
||||
ramp.green[i] = uint16_t(gamm);
|
||||
|
||||
gamm = pow(orig, eB);
|
||||
gamm *= hsScalar(uint16_t(-1));
|
||||
gamm *= float(uint16_t(-1));
|
||||
ramp.blue[i] = uint16_t(gamm);
|
||||
}
|
||||
|
||||
@ -5166,7 +5166,7 @@ void plDXPipeline::ISetRenderTarget( plRenderTarget *target )
|
||||
|
||||
// SetClear /////////////////////////////////////////////////////////////////////
|
||||
// Set the color and depth clear values.
|
||||
void plDXPipeline::SetClear(const hsColorRGBA* col, const hsScalar* depth)
|
||||
void plDXPipeline::SetClear(const hsColorRGBA* col, const float* depth)
|
||||
{
|
||||
if( col )
|
||||
fView.fClearColor = inlGetD3DColor(*col);
|
||||
@ -5183,7 +5183,7 @@ hsColorRGBA plDXPipeline::GetClearColor() const
|
||||
|
||||
// GetClearDepth ////////////////////////////////////////////////////////////////
|
||||
// Return the current clear depth.
|
||||
hsScalar plDXPipeline::GetClearDepth() const
|
||||
float plDXPipeline::GetClearDepth() const
|
||||
{
|
||||
return fView.fClearDepth;
|
||||
}
|
||||
@ -5263,12 +5263,12 @@ hsBool plDXPipeline::IGetClearViewPort(D3DRECT& r)
|
||||
|
||||
// ClearRenderTarget //////////////////////////////////////////////////////////////////////////////
|
||||
// Flat fill the current render target with the specified color and depth values.
|
||||
void plDXPipeline::ClearRenderTarget( const hsColorRGBA *col, const hsScalar* depth )
|
||||
void plDXPipeline::ClearRenderTarget( const hsColorRGBA *col, const float* depth )
|
||||
{
|
||||
if( fView.fRenderState & (kRenderClearColor | kRenderClearDepth) )
|
||||
{
|
||||
DWORD clearColor = inlGetD3DColor(col ? *col : GetClearColor());
|
||||
hsScalar clearDepth = depth ? *depth : fView.fClearDepth;
|
||||
float clearDepth = depth ? *depth : fView.fClearDepth;
|
||||
|
||||
DWORD dwFlags = 0;//fStencil.fDepth > 0 ? D3DCLEAR_STENCIL : 0;
|
||||
if( fView.fRenderState & kRenderClearColor )
|
||||
@ -5309,8 +5309,8 @@ void plDXPipeline::IGetVSFogSet(float* const set) const
|
||||
if( fCurrFog.fEnvPtr )
|
||||
{
|
||||
hsColorRGBA colorTrash;
|
||||
hsScalar start;
|
||||
hsScalar end;
|
||||
float start;
|
||||
float end;
|
||||
fCurrFog.fEnvPtr->GetPipelineParams(&start, &end, &colorTrash);
|
||||
if( end > start )
|
||||
{
|
||||
@ -5405,7 +5405,7 @@ void plDXPipeline::ISetFogParameters(const plSpan* span, const plLayerInterface*
|
||||
fCurrFog.fIsShader = isShader;
|
||||
fCurrFog.fIsVertex = isVertex;
|
||||
|
||||
hsScalar startOrDensity, end;
|
||||
float startOrDensity, end;
|
||||
hsColorRGBA color;
|
||||
|
||||
/// Get params
|
||||
@ -5922,7 +5922,7 @@ void plDXPipeline::IRestoreSpanLights()
|
||||
//// IScaleD3DLight ///////////////////////////////////////////////////////////
|
||||
// Scale the D3D light by the given scale factor, used for fading lights
|
||||
// in and out by importance.
|
||||
void plDXPipeline::IScaleD3DLight( plDXLightRef *ref, hsScalar scale )
|
||||
void plDXPipeline::IScaleD3DLight( plDXLightRef *ref, float scale )
|
||||
{
|
||||
scale = int(scale * 1.e1f) * 1.e-1f;
|
||||
if( ref->fScale != scale )
|
||||
@ -6011,8 +6011,8 @@ static inline D3DCOLORVALUE ColorMul(const D3DCOLORVALUE& c0, const hsColorRGBA&
|
||||
void plDXPipeline::ICalcLighting( const plLayerInterface *currLayer, const plSpan *currSpan )
|
||||
{
|
||||
D3DMATERIAL9 mat;
|
||||
static hsScalar diffScale = 1.f;
|
||||
static hsScalar ambScale = 1.f;
|
||||
static float diffScale = 1.f;
|
||||
static float ambScale = 1.f;
|
||||
uint32_t props;
|
||||
|
||||
|
||||
@ -7630,15 +7630,15 @@ void plDXPipeline::ISetBumpMatrices(const plLayerInterface* layer, const plSpan*
|
||||
hsVector3 liDir(0,0,0);
|
||||
int i;
|
||||
const hsTArray<plLightInfo*>& spanLights = span->GetLightList(false);
|
||||
hsScalar maxStrength = 0;
|
||||
float maxStrength = 0;
|
||||
for( i = 0; i < spanLights.GetCount(); i++ )
|
||||
{
|
||||
hsScalar liWgt = span->GetLightStrength(i, false);
|
||||
float liWgt = span->GetLightStrength(i, false);
|
||||
// A light strength of 2.f means it's from a light group, and we haven't actually calculated
|
||||
// the strength. So calculate it now.
|
||||
if( liWgt == 2.f )
|
||||
{
|
||||
hsScalar scale;
|
||||
float scale;
|
||||
spanLights[i]->GetStrengthAndScale(span->fWorldBounds, liWgt, scale);
|
||||
}
|
||||
if( liWgt > maxStrength )
|
||||
@ -7647,16 +7647,16 @@ void plDXPipeline::ISetBumpMatrices(const plLayerInterface* layer, const plSpan*
|
||||
}
|
||||
hsFastMath::NormalizeAppr(liDir);
|
||||
|
||||
static hsScalar kUVWScale = 1.f;
|
||||
hsScalar uvwScale = kUVWScale;
|
||||
static float kUVWScale = 1.f;
|
||||
float uvwScale = kUVWScale;
|
||||
if( fLayerState[0].fBlendFlags & hsGMatState::kBlendAdd )
|
||||
{
|
||||
hsVector3 cam2span(&GetViewPositionWorld(), &spanPos);
|
||||
hsFastMath::NormalizeAppr(cam2span);
|
||||
liDir += cam2span;
|
||||
hsFastMath::NormalizeAppr(liDir);
|
||||
static hsScalar kSpecularMax = 0.1f;
|
||||
static hsScalar kSpecularMaxUV = 0.5f;
|
||||
static float kSpecularMax = 0.1f;
|
||||
static float kSpecularMaxUV = 0.5f;
|
||||
if (IsDebugFlagSet(plPipeDbg::kFlagBumpUV))
|
||||
uvwScale *= kSpecularMaxUV;
|
||||
else
|
||||
@ -7680,11 +7680,11 @@ void plDXPipeline::ISetBumpMatrices(const plLayerInterface* layer, const plSpan*
|
||||
maxStrength = 1.f;
|
||||
liDir *= uvwScale * maxStrength;
|
||||
|
||||
const hsScalar kUVWOffset = 0.5f;
|
||||
const float kUVWOffset = 0.5f;
|
||||
|
||||
hsScalar kOffsetToRed;
|
||||
hsScalar kOffsetToGreen;
|
||||
hsScalar kOffsetToBlue;
|
||||
float kOffsetToRed;
|
||||
float kOffsetToGreen;
|
||||
float kOffsetToBlue;
|
||||
|
||||
if (IsDebugFlagSet(plPipeDbg::kFlagBumpUV) || IsDebugFlagSet(plPipeDbg::kFlagBumpW))
|
||||
{
|
||||
@ -7807,7 +7807,7 @@ void plDXPipeline::IHandleStageTransform( int stage, plLayerInterface *layer
|
||||
|
||||
// This is just a rotation about X of Pi/2 (y = z, z = -y),
|
||||
// followed by flipping Z to reflect back towards us (z = -z).
|
||||
hsScalar t = c2env.fMap[1][0];
|
||||
float t = c2env.fMap[1][0];
|
||||
c2env.fMap[1][0] = c2env.fMap[2][0];
|
||||
c2env.fMap[2][0] = t;
|
||||
|
||||
@ -7831,7 +7831,7 @@ void plDXPipeline::IHandleStageTransform( int stage, plLayerInterface *layer
|
||||
// This is just a rotation about X of Pi/2 (y = z, z = -y),
|
||||
// followed by NOT flipping Z to reflect back towards us (z = -z).
|
||||
// In other words, same as reflection, but then c2env = c2env * scaleMatNegateZ.
|
||||
hsScalar t = c2env.fMap[1][0];
|
||||
float t = c2env.fMap[1][0];
|
||||
c2env.fMap[1][0] = c2env.fMap[2][0];
|
||||
c2env.fMap[2][0] = t;
|
||||
|
||||
@ -7848,7 +7848,7 @@ void plDXPipeline::IHandleStageTransform( int stage, plLayerInterface *layer
|
||||
c2env.fMap[2][2] = -c2env.fMap[2][2];
|
||||
|
||||
#if 0
|
||||
const hsScalar kFishEyeScale = 0.5f;
|
||||
const float kFishEyeScale = 0.5f;
|
||||
// You can adjust the fish-eye-ness of this by scaling
|
||||
// X and Y as well. Eventually, you wind up with the same
|
||||
// as c2env * scaleMatXYAndNegateZ, but this is shorter.
|
||||
@ -7883,7 +7883,7 @@ void plDXPipeline::IHandleStageTransform( int stage, plLayerInterface *layer
|
||||
// The scale and trans move us from NDC to Screen space. We need to swap
|
||||
// the Z and W coordinates so that the texture projection will divide by W
|
||||
// and give us projected 2D coordinates.
|
||||
hsScalar temp = p2s.fMap[2][2];
|
||||
float temp = p2s.fMap[2][2];
|
||||
p2s.fMap[2][2] = p2s.fMap[3][2];
|
||||
p2s.fMap[3][2] = temp;
|
||||
|
||||
@ -8251,7 +8251,7 @@ hsBool plDXPipeline::ICanEatLayer( plLayerInterface* lay )
|
||||
return false;
|
||||
|
||||
if( (lay->GetBlendFlags() & hsGMatState::kBlendAlpha )
|
||||
&&(lay->GetAmbientColor().a < hsScalar1) )
|
||||
&&(lay->GetAmbientColor().a < 1.f) )
|
||||
return false;
|
||||
|
||||
if( !(lay->GetZFlags() & hsGMatState::kZNoZWrite) )
|
||||
@ -9091,7 +9091,7 @@ void plDXPipeline::GetViewAxesWorld(hsVector3 axes[3] /* ac,up,at */ ) const
|
||||
|
||||
//// GetFOV ///////////////////////////////////////////////////////////////////
|
||||
// Get the current FOV in degrees.
|
||||
void plDXPipeline::GetFOV(hsScalar& fovX, hsScalar& fovY) const
|
||||
void plDXPipeline::GetFOV(float& fovX, float& fovY) const
|
||||
{
|
||||
fovX = GetViewTransform().GetFovXDeg();
|
||||
fovY = GetViewTransform().GetFovYDeg();
|
||||
@ -9099,14 +9099,14 @@ void plDXPipeline::GetFOV(hsScalar& fovX, hsScalar& fovY) const
|
||||
|
||||
//// SetFOV ///////////////////////////////////////////////////////////////////
|
||||
// Set the current FOV in degrees. Forces perspective rendering to be true.
|
||||
void plDXPipeline::SetFOV( hsScalar fovX, hsScalar fovY )
|
||||
void plDXPipeline::SetFOV( float fovX, float fovY )
|
||||
{
|
||||
IGetViewTransform().SetFovDeg(fovX, fovY);
|
||||
IGetViewTransform().SetPerspective(true);
|
||||
}
|
||||
|
||||
// Get the orthogonal projection view size in world units (e.g. feet).
|
||||
void plDXPipeline::GetSize( hsScalar& width, hsScalar& height ) const
|
||||
void plDXPipeline::GetSize( float& width, float& height ) const
|
||||
{
|
||||
width = GetViewTransform().GetScreenWidth();
|
||||
height = GetViewTransform().GetScreenHeight();
|
||||
@ -9114,7 +9114,7 @@ void plDXPipeline::GetSize( hsScalar& width, hsScalar& height ) const
|
||||
|
||||
// Set the orthogonal projection view size in world units (e.g. feet).
|
||||
// Forces projection to orthogonal if it wasn't.
|
||||
void plDXPipeline::SetSize( hsScalar width, hsScalar height )
|
||||
void plDXPipeline::SetSize( float width, float height )
|
||||
{
|
||||
IGetViewTransform().SetWidth(width);
|
||||
IGetViewTransform().SetHeight(height);
|
||||
@ -9123,14 +9123,14 @@ void plDXPipeline::SetSize( hsScalar width, hsScalar height )
|
||||
|
||||
//// GetDepth /////////////////////////////////////////////////////////////////
|
||||
// Get the current hither and yon.
|
||||
void plDXPipeline::GetDepth(hsScalar& hither, hsScalar& yon) const
|
||||
void plDXPipeline::GetDepth(float& hither, float& yon) const
|
||||
{
|
||||
GetViewTransform().GetDepth(hither, yon);
|
||||
}
|
||||
|
||||
//// SetDepth /////////////////////////////////////////////////////////////////
|
||||
// Set the current hither and yon.
|
||||
void plDXPipeline::SetDepth(hsScalar hither, hsScalar yon)
|
||||
void plDXPipeline::SetDepth(float hither, float yon)
|
||||
{
|
||||
IGetViewTransform().SetDepth(hither, yon);
|
||||
}
|
||||
@ -9141,7 +9141,7 @@ void plDXPipeline::SetDepth(hsScalar hither, hsScalar yon)
|
||||
// Obsolete since we don't support the Savage4 chipset any more.
|
||||
void plDXPipeline::ISavageYonHack()
|
||||
{
|
||||
hsScalar yon = GetViewTransform().GetYon();
|
||||
float yon = GetViewTransform().GetYon();
|
||||
|
||||
|
||||
if( ( yon > 128.f - 5.0f ) && ( yon < 128.f + 1.01f ) )
|
||||
@ -9284,7 +9284,7 @@ hsBool plDXPipeline::IIsViewLeftHanded()
|
||||
// Given a screen space pixel position, and a world space distance from the camera, return a
|
||||
// full world space position. I.e. cast a ray through a screen pixel dist feet, and where
|
||||
// is it.
|
||||
void plDXPipeline::ScreenToWorldPoint( int n, uint32_t stride, int32_t *scrX, int32_t *scrY, hsScalar dist, uint32_t strideOut, hsPoint3 *worldOut )
|
||||
void plDXPipeline::ScreenToWorldPoint( int n, uint32_t stride, int32_t *scrX, int32_t *scrY, float dist, uint32_t strideOut, hsPoint3 *worldOut )
|
||||
{
|
||||
while( n-- )
|
||||
{
|
||||
@ -9978,7 +9978,7 @@ hsBool plDXPipeline::OpenAccess(plAccessSpan& dst, plDrawableSpans* drawable, co
|
||||
{
|
||||
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);
|
||||
@ -10556,8 +10556,8 @@ void plDXPipeline::LoadResources()
|
||||
// inlTESTPOINT /////////////////////////////////////////
|
||||
// Update mins and maxs if destP is outside.
|
||||
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;
|
||||
@ -10607,13 +10607,13 @@ void plDXPipeline::IBlendVertsIntoBuffer( plSpan* span,
|
||||
|
||||
//#define MF_RECALC_BOUNDS
|
||||
#ifdef MF_RECALC_BOUNDS
|
||||
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;
|
||||
#endif // MF_RECALC_BOUNDS
|
||||
|
||||
// localUVWChans is bump mapping tangent space vectors, which need to
|
||||
@ -12240,7 +12240,7 @@ void plDXPipeline::SubmitShadowSlave(plShadowSlave* slave)
|
||||
fShadows.Insert(i, slave);
|
||||
}
|
||||
|
||||
hsScalar blurScale = -1.f;
|
||||
float blurScale = -1.f;
|
||||
static const int kL2NumSamples = 3; // Log2(4)
|
||||
|
||||
// IBlurShadowMap //////////////////////////////////////////////////////////////////
|
||||
@ -12275,7 +12275,7 @@ static const int kL2NumSamples = 3; // Log2(4)
|
||||
void plDXPipeline::IBlurShadowMap(plShadowSlave* slave)
|
||||
{
|
||||
plRenderTarget* smap = (plRenderTarget*)slave->fPipeData;
|
||||
hsScalar scale = slave->fBlurScale;
|
||||
float scale = slave->fBlurScale;
|
||||
|
||||
// Find a scratch rendertarget which matches the input.
|
||||
int which = IGetScratchRenderTarget(smap);
|
||||
@ -12406,7 +12406,7 @@ void plDXPipeline::IBlurSetRenderTarget(plRenderTarget* rt)
|
||||
// Render a shadow map into a scratch render target multiple times offset slightly to create a blur
|
||||
// in the color, preserving alpha exactly. It's just rendering a single quad with slight offsets
|
||||
// in the UVW transform.
|
||||
void plDXPipeline::IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, hsScalar scale)
|
||||
void plDXPipeline::IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, float scale)
|
||||
{
|
||||
// Quad is set up in camera space.
|
||||
fD3DDevice->SetTransform(D3DTS_VIEW, &d3dIdentityMatrix);
|
||||
@ -12416,7 +12416,7 @@ void plDXPipeline::IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderT
|
||||
// Figure out how many passes we'll need.
|
||||
// const int kNumSamples = 1 << kL2NumSamples; // HACKSAMPLE
|
||||
const int kNumSamples = mfCurrentTest > 101 ? 8 : 4;
|
||||
int nPasses = (int)hsCeil(float(kNumSamples) / fSettings.fMaxLayersAtOnce);
|
||||
int nPasses = (int)ceil(float(kNumSamples) / fSettings.fMaxLayersAtOnce);
|
||||
int nSamplesPerPass = kNumSamples / nPasses;
|
||||
|
||||
// Attenuate by number of passes, to average as we sum.
|
||||
@ -13121,7 +13121,7 @@ hsBool plDXPipeline::IPushShadowCastState(plShadowSlave* slave)
|
||||
if( slave->fBlurScale > 0 )
|
||||
{
|
||||
const int kNumSamples = mfCurrentTest > 101 ? 8 : 4;
|
||||
int nPasses = (int)hsCeil(float(kNumSamples) / fSettings.fMaxLayersAtOnce);
|
||||
int nPasses = (int)ceil(float(kNumSamples) / fSettings.fMaxLayersAtOnce);
|
||||
int nSamplesPerPass = kNumSamples / nPasses;
|
||||
DWORD k = int(128.f / float(nSamplesPerPass));
|
||||
intens = (0xff << 24)
|
||||
@ -13324,7 +13324,7 @@ void plDXPipeline::IMakeRenderTargetPools()
|
||||
// These numbers were set with multi-player in mind, so should be reconsidered.
|
||||
// But do keep in mind that there are many things in production assets that cast
|
||||
// shadows besides the avatar.
|
||||
plConst(hsScalar) kCount[kMaxRenderTargetNext] = {
|
||||
plConst(float) kCount[kMaxRenderTargetNext] = {
|
||||
0, // 1x1
|
||||
0, // 2x2
|
||||
0, // 4x4
|
||||
@ -13645,8 +13645,8 @@ void plDXPipeline::IRenderShadowsOntoSpan(const plRenderPrimFunc& render, const
|
||||
// the surface casting the shadow (because they are the same object).
|
||||
if( selfShadowNow )
|
||||
{
|
||||
plConst(hsScalar) kMaxSelfPower = 0.3f;
|
||||
hsScalar power = fShadows[i]->fPower > kMaxSelfPower ? kMaxSelfPower : fShadows[i]->fPower;
|
||||
plConst(float) kMaxSelfPower = 0.3f;
|
||||
float power = fShadows[i]->fPower > kMaxSelfPower ? kMaxSelfPower : fShadows[i]->fPower;
|
||||
lRef->fD3DInfo.Diffuse.r
|
||||
= lRef->fD3DInfo.Diffuse.g
|
||||
= lRef->fD3DInfo.Diffuse.b
|
||||
@ -14278,8 +14278,8 @@ void plDXPipeline::IPreprocessAvatarTextures()
|
||||
D3DVIEWPORT9 vp = {0, 0, rt->GetWidth(), rt->GetHeight(), 0.f, 1.f};
|
||||
WEAK_ERROR_CHECK(fD3DDevice->SetViewport(&vp));
|
||||
|
||||
hsScalar uOff = 0.5f / rt->GetWidth();
|
||||
hsScalar vOff = 0.5f / rt->GetHeight();
|
||||
float uOff = 0.5f / rt->GetWidth();
|
||||
float vOff = 0.5f / rt->GetHeight();
|
||||
|
||||
// Copy over the base
|
||||
fD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
@ -14322,10 +14322,10 @@ void plDXPipeline::IPreprocessAvatarTextures()
|
||||
}
|
||||
fD3DDevice->SetRenderState(D3DRS_TEXTUREFACTOR, tint.ToARGB32());
|
||||
fLayerState[0].fBlendFlags = uint32_t(-1);
|
||||
hsScalar screenW = (hsScalar)item->fElements[j]->fWidth / layout->fOrigWidth * 2.f;
|
||||
hsScalar screenH = (hsScalar)item->fElements[j]->fHeight / layout->fOrigWidth * 2.f;
|
||||
hsScalar screenX = (hsScalar)item->fElements[j]->fXPos / layout->fOrigWidth * 2.f - 1.f;
|
||||
hsScalar screenY = (1.f - (hsScalar)item->fElements[j]->fYPos / layout->fOrigWidth) * 2.f - 1.f - screenH;
|
||||
float screenW = (float)item->fElements[j]->fWidth / layout->fOrigWidth * 2.f;
|
||||
float screenH = (float)item->fElements[j]->fHeight / layout->fOrigWidth * 2.f;
|
||||
float screenX = (float)item->fElements[j]->fXPos / layout->fOrigWidth * 2.f - 1.f;
|
||||
float screenY = (1.f - (float)item->fElements[j]->fYPos / layout->fOrigWidth) * 2.f - 1.f - screenH;
|
||||
IDrawClothingQuad(screenX, screenY, screenW, screenH, uOff, vOff, itemBufferTex);
|
||||
}
|
||||
}
|
||||
@ -14340,8 +14340,8 @@ void plDXPipeline::IPreprocessAvatarTextures()
|
||||
fClothingOutfits.Swap(fPrevClothingOutfits);
|
||||
}
|
||||
|
||||
void plDXPipeline::IDrawClothingQuad(hsScalar x, hsScalar y, hsScalar w, hsScalar h,
|
||||
hsScalar uOff, hsScalar vOff, plMipmap *tex)
|
||||
void plDXPipeline::IDrawClothingQuad(float x, float y, float w, float h,
|
||||
float uOff, float vOff, plMipmap *tex)
|
||||
{
|
||||
const uint32_t kVSize = sizeof(plAVTexVert);
|
||||
plDXTextureRef* ref = (plDXTextureRef*)tex->GetDeviceRef();
|
||||
|
@ -382,7 +382,7 @@ protected:
|
||||
|
||||
// Lighting
|
||||
hsGDeviceRef *IMakeLightRef( plLightInfo *owner );
|
||||
void IScaleD3DLight( plDXLightRef *ref, hsScalar scale);
|
||||
void IScaleD3DLight( plDXLightRef *ref, float scale);
|
||||
void ICalcLighting( const plLayerInterface *currLayer, const plSpan *currSpan );
|
||||
void IDisableSpanLights();
|
||||
void IRestoreSpanLights();
|
||||
@ -593,7 +593,7 @@ protected:
|
||||
// Postprocess (blurring)
|
||||
hsBool ISetBlurQuadToRender(plRenderTarget* smap);
|
||||
void IRenderBlurBackToShadowMap(plRenderTarget* smap, plRenderTarget* scratch, plRenderTarget* dst);
|
||||
void IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, hsScalar scale);
|
||||
void IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, float scale);
|
||||
void IBlurSetRenderTarget(plRenderTarget* rt);
|
||||
int IGetScratchRenderTarget(plRenderTarget* smap);
|
||||
void IBlurShadowMap(plShadowSlave* slave);
|
||||
@ -609,7 +609,7 @@ protected:
|
||||
plRenderTarget* IGetNextAvRT();
|
||||
void IFreeAvRT(plRenderTarget* tex);
|
||||
void IPreprocessAvatarTextures();
|
||||
void IDrawClothingQuad(hsScalar x, hsScalar y, hsScalar w, hsScalar h, hsScalar uOff, hsScalar vOff, plMipmap *tex);
|
||||
void IDrawClothingQuad(float x, float y, float w, float h, float uOff, float vOff, plMipmap *tex);
|
||||
void IClearClothingOutfits(hsTArray<plClothingOutfit*>* outfits);
|
||||
|
||||
void IPrintDeviceInitError();
|
||||
@ -637,10 +637,10 @@ public:
|
||||
void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false );
|
||||
|
||||
virtual void ClearRenderTarget( plDrawable* d );
|
||||
virtual void ClearRenderTarget( const hsColorRGBA* col = nil, const hsScalar* depth = nil );
|
||||
virtual void SetClear(const hsColorRGBA* col=nil, const hsScalar* depth=nil);
|
||||
virtual void ClearRenderTarget( const hsColorRGBA* col = nil, const float* depth = nil );
|
||||
virtual void SetClear(const hsColorRGBA* col=nil, const float* depth=nil);
|
||||
virtual hsColorRGBA GetClearColor() const;
|
||||
virtual hsScalar GetClearDepth() const;
|
||||
virtual float GetClearDepth() const;
|
||||
virtual hsGDeviceRef* MakeRenderTargetRef( plRenderTarget *owner );
|
||||
virtual hsGDeviceRef* SharedRenderTargetRef(plRenderTarget* sharer, plRenderTarget *owner);
|
||||
virtual void PushRenderTarget( plRenderTarget *target );
|
||||
@ -725,17 +725,17 @@ public:
|
||||
virtual hsVector3 GetViewDirWorld() const { return GetViewTransform().GetDirection(); }
|
||||
virtual void GetViewAxesWorld(hsVector3 axes[3] /* ac,up,at */ ) const;
|
||||
|
||||
virtual void GetFOV(hsScalar& fovX, hsScalar& fovY) const;
|
||||
virtual void SetFOV(hsScalar fovX, hsScalar fovY);
|
||||
virtual void GetFOV(float& fovX, float& fovY) const;
|
||||
virtual void SetFOV(float fovX, float fovY);
|
||||
|
||||
virtual void GetSize(hsScalar& width, hsScalar& height) const;
|
||||
virtual void SetSize(hsScalar width, hsScalar height);
|
||||
virtual void GetSize(float& width, float& height) const;
|
||||
virtual void SetSize(float width, float height);
|
||||
|
||||
virtual void GetDepth(hsScalar& hither, hsScalar& yon) const;
|
||||
virtual void SetDepth(hsScalar hither, hsScalar yon);
|
||||
virtual void GetDepth(float& hither, float& yon) const;
|
||||
virtual void SetDepth(float hither, float yon);
|
||||
|
||||
virtual hsScalar GetZBiasScale() const;
|
||||
virtual void SetZBiasScale(hsScalar scale);
|
||||
virtual float GetZBiasScale() const;
|
||||
virtual void SetZBiasScale(float scale);
|
||||
|
||||
virtual const hsMatrix44& GetWorldToCamera() const;
|
||||
virtual const hsMatrix44& GetCameraToWorld() const;
|
||||
@ -748,7 +748,7 @@ public:
|
||||
virtual const hsMatrix44& GetLocalToWorld() const;
|
||||
|
||||
virtual void ScreenToWorldPoint( int n, uint32_t stride, int32_t *scrX, int32_t *scrY,
|
||||
hsScalar dist, uint32_t strideOut, hsPoint3 *worldOut );
|
||||
float dist, uint32_t strideOut, hsPoint3 *worldOut );
|
||||
|
||||
virtual void RefreshMatrices();
|
||||
virtual void RefreshScreenMatrices();
|
||||
@ -782,7 +782,7 @@ public:
|
||||
virtual void SubmitShadowSlave(plShadowSlave* slave);
|
||||
virtual void SubmitClothingOutfit(plClothingOutfit* co);
|
||||
|
||||
virtual hsBool SetGamma(hsScalar eR, hsScalar eG, hsScalar eB);
|
||||
virtual hsBool SetGamma(float eR, float eG, float eB);
|
||||
virtual hsBool SetGamma(const uint16_t* const tabR, const uint16_t* const tabG, const uint16_t* const tabB);
|
||||
|
||||
virtual hsBool CaptureScreen( plMipmap *dest, bool flipVertical = false, uint16_t desiredWidth = 0, uint16_t desiredHeight = 0 );
|
||||
|
@ -155,17 +155,17 @@ void plDynamicEnvMap::IUpdatePosition()
|
||||
SetCameraMatrix(fPos);
|
||||
}
|
||||
|
||||
void plDynamicEnvMap::SetHither(hsScalar f)
|
||||
void plDynamicEnvMap::SetHither(float f)
|
||||
{
|
||||
fHither = f;
|
||||
}
|
||||
|
||||
void plDynamicEnvMap::SetYon(hsScalar f)
|
||||
void plDynamicEnvMap::SetYon(float f)
|
||||
{
|
||||
fYon = f;
|
||||
}
|
||||
|
||||
void plDynamicEnvMap::SetFogStart(hsScalar f)
|
||||
void plDynamicEnvMap::SetFogStart(float f)
|
||||
{
|
||||
fFogStart = f;
|
||||
}
|
||||
@ -175,7 +175,7 @@ void plDynamicEnvMap::SetColor(const hsColorRGBA& col)
|
||||
fColor = col;
|
||||
}
|
||||
|
||||
void plDynamicEnvMap::SetRefreshRate(hsScalar secs)
|
||||
void plDynamicEnvMap::SetRefreshRate(float secs)
|
||||
{
|
||||
fRefreshRate = secs / 6.f;
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey());
|
||||
@ -539,7 +539,7 @@ void plDynamicCamMap::Init()
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey());
|
||||
}
|
||||
|
||||
void plDynamicCamMap::SetRefreshRate(hsScalar secs)
|
||||
void plDynamicCamMap::SetRefreshRate(float secs)
|
||||
{
|
||||
fRefreshRate = secs;
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey());
|
||||
|
@ -72,12 +72,12 @@ protected:
|
||||
|
||||
plSceneObject* fRootNode;
|
||||
hsPoint3 fPos;
|
||||
hsScalar fHither;
|
||||
hsScalar fYon;
|
||||
hsScalar fFogStart;
|
||||
float fHither;
|
||||
float fYon;
|
||||
float fFogStart;
|
||||
hsColorRGBA fColor;
|
||||
|
||||
hsScalar fRefreshRate;
|
||||
float fRefreshRate;
|
||||
double fLastRefresh;
|
||||
int fLastRender;
|
||||
int fOutStanding;
|
||||
@ -116,18 +116,18 @@ public:
|
||||
void Init();
|
||||
|
||||
void SetPosition(const hsPoint3& pos);
|
||||
void SetHither(hsScalar f);
|
||||
void SetYon(hsScalar f);
|
||||
void SetFogStart(hsScalar f);
|
||||
void SetHither(float f);
|
||||
void SetYon(float f);
|
||||
void SetFogStart(float f);
|
||||
void SetColor(const hsColorRGBA& col);
|
||||
void SetRefreshRate(hsScalar secs);
|
||||
void SetRefreshRate(float secs);
|
||||
|
||||
hsPoint3 GetPosition() const;
|
||||
hsScalar GetHither() const { return fHither; }
|
||||
hsScalar GetYon() const { return fYon; }
|
||||
hsScalar GetFogStart() const { return fFogStart; }
|
||||
float GetHither() const { return fHither; }
|
||||
float GetYon() const { return fYon; }
|
||||
float GetFogStart() const { return fFogStart; }
|
||||
hsColorRGBA GetColor() const { return fColor; }
|
||||
hsScalar GetRefreshRate() const { return 6.f * fRefreshRate; }
|
||||
float GetRefreshRate() const { return 6.f * fRefreshRate; }
|
||||
|
||||
void AddVisRegion(plVisRegion* reg); // Will just send a ref
|
||||
|
||||
@ -153,16 +153,16 @@ public:
|
||||
kRefMatLayer,
|
||||
};
|
||||
|
||||
hsScalar fHither;
|
||||
hsScalar fYon;
|
||||
hsScalar fFogStart;
|
||||
float fHither;
|
||||
float fYon;
|
||||
float fFogStart;
|
||||
hsColorRGBA fColor;
|
||||
|
||||
protected:
|
||||
plRenderRequest fReq;
|
||||
plRenderRequestMsg* fReqMsg;
|
||||
|
||||
hsScalar fRefreshRate;
|
||||
float fRefreshRate;
|
||||
double fLastRefresh;
|
||||
int fOutStanding;
|
||||
|
||||
@ -212,7 +212,7 @@ public:
|
||||
void Init();
|
||||
|
||||
void SetIncludeCharacters(hsBool b);
|
||||
void SetRefreshRate(hsScalar secs);
|
||||
void SetRefreshRate(float secs);
|
||||
void AddVisRegion(plVisRegion* reg);
|
||||
void SetVisRegionName(char *name){ fVisRegionNames.Push(name); }
|
||||
|
||||
|
@ -47,6 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "plFogEnvironment.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "plTweak.h"
|
||||
|
||||
//// Constructors & Destructor ///////////////////////////////////////////////
|
||||
@ -56,12 +57,12 @@ plFogEnvironment::plFogEnvironment()
|
||||
fType = kNoFog;
|
||||
}
|
||||
|
||||
plFogEnvironment::plFogEnvironment( hsScalar start, hsScalar end, hsScalar density, hsColorRGBA &color )
|
||||
plFogEnvironment::plFogEnvironment( float start, float end, float density, hsColorRGBA &color )
|
||||
{
|
||||
Set( start, end, density, &color );
|
||||
}
|
||||
|
||||
plFogEnvironment::plFogEnvironment( FogType type, hsScalar end, hsScalar density, hsColorRGBA &color )
|
||||
plFogEnvironment::plFogEnvironment( FogType type, float end, float density, hsColorRGBA &color )
|
||||
{
|
||||
SetExp( type, end, density, &color );
|
||||
}
|
||||
@ -72,7 +73,7 @@ plFogEnvironment::~plFogEnvironment()
|
||||
|
||||
//// Set /////////////////////////////////////////////////////////////////////
|
||||
|
||||
void plFogEnvironment::Set( hsScalar start, hsScalar end, hsScalar density, const hsColorRGBA *color )
|
||||
void plFogEnvironment::Set( float start, float end, float density, const hsColorRGBA *color )
|
||||
{
|
||||
if( density <= 0.f )
|
||||
{
|
||||
@ -92,7 +93,7 @@ void plFogEnvironment::Set( hsScalar start, hsScalar end, hsScalar density, c
|
||||
fColor = *color;
|
||||
}
|
||||
|
||||
void plFogEnvironment::SetExp( FogType type, hsScalar end, hsScalar density, const hsColorRGBA *color )
|
||||
void plFogEnvironment::SetExp( FogType type, float end, float density, const hsColorRGBA *color )
|
||||
{
|
||||
hsAssert( type == kExpFog || type == kExp2Fog, "Invalid fog type passed to plFogEnvironment" );
|
||||
if( density <= 0.f )
|
||||
@ -117,7 +118,7 @@ void plFogEnvironment::SetExp( FogType type, hsScalar end, hsScalar density,
|
||||
// Gets the parameters. Sets start to 0 if the type is not linear (can be
|
||||
// nil).
|
||||
|
||||
void plFogEnvironment::GetParameters( hsScalar *start, hsScalar *end, hsScalar *density, hsColorRGBA *color )
|
||||
void plFogEnvironment::GetParameters( float *start, float *end, float *density, hsColorRGBA *color )
|
||||
{
|
||||
hsAssert( fType != kLinearFog || start != nil, "Trying to get non-linear paramters on linear fog!" );
|
||||
hsAssert( end != nil && density != nil && color != nil, "Bad pointer to plFogEnvironment::GetParameters()" );
|
||||
@ -138,7 +139,7 @@ void plFogEnvironment::GetParameters( hsScalar *start, hsScalar *end, hsScala
|
||||
// scale our end value out by the density. The whole formula is:
|
||||
// pipelineEnd = ( end - start ) / density + start
|
||||
|
||||
void plFogEnvironment::GetPipelineParams( hsScalar *start, hsScalar *end, hsColorRGBA *color )
|
||||
void plFogEnvironment::GetPipelineParams( float *start, float *end, hsColorRGBA *color )
|
||||
{
|
||||
// hsAssert( fType == kLinearFog, "Getting linear pipeline params on non-linear fog!" );
|
||||
|
||||
@ -173,7 +174,7 @@ void plFogEnvironment::GetPipelineParams( hsScalar *start, hsScalar *end, hsC
|
||||
// to modulate the density by the end value so that it actually ends at the
|
||||
// right spot.
|
||||
|
||||
void plFogEnvironment::GetPipelineParams( hsScalar *density, hsColorRGBA *color )
|
||||
void plFogEnvironment::GetPipelineParams( float *density, hsColorRGBA *color )
|
||||
{
|
||||
const float ln256 = logf( 256.f );
|
||||
const float sqrtLn256 = sqrtf( ln256 );
|
||||
|
@ -63,8 +63,8 @@ class plFogEnvironment : public hsKeyedObject
|
||||
protected:
|
||||
|
||||
uint8_t fType;
|
||||
hsScalar fStart; // Used for linear fog only
|
||||
hsScalar fEnd, fDensity; // Always used!
|
||||
float fStart; // Used for linear fog only
|
||||
float fEnd, fDensity; // Always used!
|
||||
hsColorRGBA fColor;
|
||||
|
||||
public:
|
||||
@ -81,15 +81,15 @@ class plFogEnvironment : public hsKeyedObject
|
||||
};
|
||||
|
||||
plFogEnvironment();
|
||||
plFogEnvironment( hsScalar start, hsScalar end, hsScalar density, hsColorRGBA &color );
|
||||
plFogEnvironment( FogType type, hsScalar end, hsScalar density, hsColorRGBA &color );
|
||||
plFogEnvironment( float start, float end, float density, hsColorRGBA &color );
|
||||
plFogEnvironment( FogType type, float end, float density, hsColorRGBA &color );
|
||||
~plFogEnvironment();
|
||||
|
||||
// Sets the parameters for linear fog
|
||||
void Set( hsScalar start, hsScalar end, hsScalar density, const hsColorRGBA *color = nil );
|
||||
void Set( float start, float end, float density, const hsColorRGBA *color = nil );
|
||||
|
||||
// Sets the parameters for exp or exp^2 fog
|
||||
void SetExp( FogType type, hsScalar end, hsScalar density, const hsColorRGBA *color = nil );
|
||||
void SetExp( FogType type, float end, float density, const hsColorRGBA *color = nil );
|
||||
|
||||
// Sets the color
|
||||
void SetColor( hsColorRGBA &color ) { fColor = color; }
|
||||
@ -104,13 +104,13 @@ class plFogEnvironment : public hsKeyedObject
|
||||
hsColorRGBA &GetColor( void ) { return fColor; }
|
||||
|
||||
// Gets the parameters. Sets start to 0 if the type is not linear (can be nil)
|
||||
void GetParameters( hsScalar *start, hsScalar *end, hsScalar *density, hsColorRGBA *color );
|
||||
void GetParameters( float *start, float *end, float *density, hsColorRGBA *color );
|
||||
|
||||
// Gets linear pipeline (DX) specific parameters.
|
||||
void GetPipelineParams( hsScalar *start, hsScalar *end, hsColorRGBA *color );
|
||||
void GetPipelineParams( float *start, float *end, hsColorRGBA *color );
|
||||
|
||||
// Gets exp or exp^2 pipeline (DX) specific parameters.
|
||||
void GetPipelineParams( hsScalar *density, hsColorRGBA *color );
|
||||
void GetPipelineParams( float *density, hsColorRGBA *color );
|
||||
|
||||
virtual void Read(hsStream *s, hsResMgr *mgr);
|
||||
virtual void Write(hsStream *s, hsResMgr *mgr);
|
||||
|
@ -107,7 +107,7 @@ plPlate::~plPlate()
|
||||
|
||||
//// SetPosition /////////////////////////////////////////////////////////////
|
||||
|
||||
void plPlate::SetPosition( hsScalar x, hsScalar y, hsScalar z )
|
||||
void plPlate::SetPosition( float x, float y, float z )
|
||||
{
|
||||
hsVector3 triple;
|
||||
|
||||
@ -130,14 +130,14 @@ void plPlate::SetPosition( hsScalar x, hsScalar y, hsScalar z )
|
||||
|
||||
//// SetSize /////////////////////////////////////////////////////////////////
|
||||
|
||||
void plPlate::SetSize( hsScalar width, hsScalar height, bool adjustByAspectRation )
|
||||
void plPlate::SetSize( float width, float height, bool adjustByAspectRation )
|
||||
{
|
||||
hsVector3 size;
|
||||
|
||||
width *= fDepth / 1.0f;
|
||||
height *= fDepth / 1.0f;
|
||||
|
||||
size.fX = adjustByAspectRation ? (width * ((hsScalar)plPlateManager::Instance().GetPipeHeight() / (hsScalar)plPlateManager::Instance().GetPipeWidth())) : width;
|
||||
size.fX = adjustByAspectRation ? (width * ((float)plPlateManager::Instance().GetPipeHeight() / (float)plPlateManager::Instance().GetPipeWidth())) : width;
|
||||
size.fY = height;
|
||||
size.fZ = 1.0f;
|
||||
|
||||
@ -183,7 +183,7 @@ void plPlate::SetTexture(plBitmap *texture)
|
||||
|
||||
//// SetOpacity //////////////////////////////////////////////////////////////
|
||||
|
||||
void plPlate::SetOpacity( hsScalar opacity )
|
||||
void plPlate::SetOpacity( float opacity )
|
||||
{
|
||||
if( fMaterial != nil && fMaterial->GetLayer( 0 ) != nil )
|
||||
{
|
||||
@ -706,13 +706,13 @@ void plPlateManager::CreatePlate( plPlate **handle )
|
||||
*handle = plate;
|
||||
}
|
||||
|
||||
void plPlateManager::CreatePlate( plPlate **handle, hsScalar width, hsScalar height )
|
||||
void plPlateManager::CreatePlate( plPlate **handle, float width, float height )
|
||||
{
|
||||
CreatePlate( handle );
|
||||
(*handle)->SetSize( width, height );
|
||||
}
|
||||
|
||||
void plPlateManager::CreatePlate( plPlate **handle, hsScalar x, hsScalar y, hsScalar width, hsScalar height )
|
||||
void plPlateManager::CreatePlate( plPlate **handle, float x, float y, float width, float height )
|
||||
{
|
||||
CreatePlate( handle );
|
||||
(*handle)->SetPosition( x, y );
|
||||
|
@ -77,7 +77,7 @@ class plPlate
|
||||
hsMatrix44 fXformMatrix;
|
||||
hsGMaterial *fMaterial;
|
||||
plMipmap *fMipmap;
|
||||
hsScalar fDepth, fOpacity;
|
||||
float fDepth, fOpacity;
|
||||
uint32_t fFlags;
|
||||
char fTitle[ 64 ];
|
||||
|
||||
@ -131,16 +131,16 @@ class plPlate
|
||||
void SetVisible( hsBool vis ) { if( vis ) fFlags |= kFlagVisible; else fFlags &= ~kFlagVisible; }
|
||||
hsBool IsVisible( void );
|
||||
|
||||
void SetOpacity( hsScalar opacity = 1.f );
|
||||
void SetOpacity( float opacity = 1.f );
|
||||
|
||||
plPlate *GetNext( void ) { return fNext; }
|
||||
|
||||
|
||||
/// Helper functions
|
||||
|
||||
void SetDepth( hsScalar depth) { fDepth = depth; }
|
||||
void SetPosition( hsScalar x, hsScalar y, hsScalar z = -1.0f );
|
||||
void SetSize( hsScalar width, hsScalar height, bool adjustByAspectRatio = false );
|
||||
void SetDepth( float depth) { fDepth = depth; }
|
||||
void SetPosition( float x, float y, float z = -1.0f );
|
||||
void SetSize( float width, float height, bool adjustByAspectRatio = false );
|
||||
|
||||
plMipmap *CreateMaterial( uint32_t width, uint32_t height, hsBool withAlpha, plMipmap* texture = NULL );
|
||||
void CreateFromResource( const char *resName );
|
||||
@ -227,8 +227,8 @@ class plPlateManager
|
||||
static bool InstanceValid( void ) { return fInstance != nil; }
|
||||
|
||||
void CreatePlate( plPlate **handle );
|
||||
void CreatePlate( plPlate **handle, hsScalar width, hsScalar height );
|
||||
void CreatePlate( plPlate **handle, hsScalar x, hsScalar y, hsScalar width, hsScalar height );
|
||||
void CreatePlate( plPlate **handle, float width, float height );
|
||||
void CreatePlate( plPlate **handle, float x, float y, float width, float height );
|
||||
|
||||
void CreateGraphPlate( plGraphPlate **handle );
|
||||
|
||||
|
@ -116,7 +116,7 @@ uint32_t plRenderTarget::Read( hsStream *s )
|
||||
fZDepth = s->ReadByte();
|
||||
fStencilDepth = s->ReadByte();
|
||||
|
||||
return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( hsScalar ) : sizeof( uint16_t ) ) + sizeof( hsBool );
|
||||
return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( float ) : sizeof( uint16_t ) ) + sizeof( hsBool );
|
||||
}
|
||||
|
||||
uint32_t plRenderTarget::Write( hsStream *s )
|
||||
@ -145,7 +145,7 @@ uint32_t plRenderTarget::Write( hsStream *s )
|
||||
s->WriteByte( fZDepth );
|
||||
s->WriteByte( fStencilDepth );
|
||||
|
||||
return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( hsScalar ) : sizeof( uint16_t ) ) + sizeof( hsBool );
|
||||
return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( float ) : sizeof( uint16_t ) ) + sizeof( hsBool );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -81,7 +81,7 @@ class plRenderTarget : public plBitmap
|
||||
} fAbsolute;
|
||||
struct
|
||||
{
|
||||
hsScalar fLeft, fTop, fRight, fBottom;
|
||||
float fLeft, fTop, fRight, fBottom;
|
||||
} fProportional;
|
||||
} fViewport;
|
||||
|
||||
@ -136,7 +136,7 @@ class plRenderTarget : public plBitmap
|
||||
}
|
||||
|
||||
// Render-to-Screen constructor
|
||||
plRenderTarget( uint16_t flags, hsScalar left, hsScalar top, hsScalar right, hsScalar bottom, uint8_t bitDepth, uint8_t zDepth = 0xff, uint8_t stencilDepth = 0xff )
|
||||
plRenderTarget( uint16_t flags, float left, float top, float right, float bottom, uint8_t bitDepth, uint8_t zDepth = 0xff, uint8_t stencilDepth = 0xff )
|
||||
{
|
||||
fWidth = 0; // Can't really set these, at least not yet
|
||||
fHeight = 0;
|
||||
@ -166,7 +166,7 @@ class plRenderTarget : public plBitmap
|
||||
fViewport.fAbsolute.fBottom = bottom;
|
||||
}
|
||||
|
||||
virtual void SetViewport( hsScalar left, hsScalar top, hsScalar right, hsScalar bottom )
|
||||
virtual void SetViewport( float left, float top, float right, float bottom )
|
||||
{
|
||||
ASSERT_PROPORTIONAL;
|
||||
fViewport.fProportional.fLeft = left;
|
||||
@ -185,10 +185,10 @@ class plRenderTarget : public plBitmap
|
||||
uint16_t GetVPRight( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fRight; }
|
||||
uint16_t GetVPBottom( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fBottom; }
|
||||
|
||||
hsScalar GetVPLeftProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fLeft; }
|
||||
hsScalar GetVPTopProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fTop; }
|
||||
hsScalar GetVPRightProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fRight; }
|
||||
hsScalar GetVPBottomProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fBottom; }
|
||||
float GetVPLeftProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fLeft; }
|
||||
float GetVPTopProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fTop; }
|
||||
float GetVPRightProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fRight; }
|
||||
float GetVPBottomProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fBottom; }
|
||||
|
||||
hsBool ViewIsProportional( void ) const { return fProportionalViewport; }
|
||||
|
||||
|
@ -139,7 +139,7 @@ void plTransitionMgr::ICreatePlate( void )
|
||||
|
||||
//// IStartFadeOut ///////////////////////////////////////////////////////////
|
||||
|
||||
void plTransitionMgr::IStartFadeOut( hsScalar lengthInSecs, uint8_t effect )
|
||||
void plTransitionMgr::IStartFadeOut( float lengthInSecs, uint8_t effect )
|
||||
{
|
||||
fCurrentEffect = effect; // default - kFadeOut;
|
||||
fEffectLength = lengthInSecs;
|
||||
@ -177,7 +177,7 @@ void plTransitionMgr::IStartFadeOut( hsScalar lengthInSecs, uint8_t effect )
|
||||
|
||||
//// IStartFadeIn ////////////////////////////////////////////////////////////
|
||||
|
||||
void plTransitionMgr::IStartFadeIn( hsScalar lengthInSecs, uint8_t effect )
|
||||
void plTransitionMgr::IStartFadeIn( float lengthInSecs, uint8_t effect )
|
||||
{
|
||||
fCurrentEffect = effect; // default - kFadeIn;
|
||||
fEffectLength = lengthInSecs;
|
||||
@ -265,17 +265,17 @@ hsBool plTransitionMgr::MsgReceive( plMessage* msg )
|
||||
// So instead we don't start the clock until we get our first plTimeMsg.
|
||||
|
||||
|
||||
fLastTime = (hsScalar)(time->DSeconds());
|
||||
fLastTime = (float)(time->DSeconds());
|
||||
return false;
|
||||
}
|
||||
|
||||
fEffectLength -= (hsScalar)( time->DSeconds() - fLastTime );//*/time->DelSeconds();
|
||||
fEffectLength -= (float)( time->DSeconds() - fLastTime );//*/time->DelSeconds();
|
||||
if( fEffectLength < 0 )
|
||||
IStop();
|
||||
else
|
||||
{
|
||||
// Grab the layer so we can set the opacity
|
||||
fCurrOpacity += (hsScalar)(fOpacDelta * ( time->DSeconds() - fLastTime ));//*/time->DelSeconds();
|
||||
fCurrOpacity += (float)(fOpacDelta * ( time->DSeconds() - fLastTime ));//*/time->DelSeconds();
|
||||
if( fEffectPlate == nil )
|
||||
ICreatePlate();
|
||||
|
||||
@ -290,7 +290,7 @@ hsBool plTransitionMgr::MsgReceive( plMessage* msg )
|
||||
plgAudioSys::SetGlobalFadeVolume( 1.f - fCurrOpacity );
|
||||
|
||||
|
||||
fLastTime = (hsScalar)(time->DSeconds());
|
||||
fLastTime = (float)(time->DSeconds());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -76,11 +76,11 @@ class plTransitionMgr : public hsKeyedObject
|
||||
|
||||
uint8_t fCurrentEffect;
|
||||
hsBool fRegisteredForTime, fHoldAtEnd, fPlaying, fNoSoundFade;
|
||||
hsScalar fEffectLength, fCurrOpacity, fOpacDelta;
|
||||
hsScalar fLastTime;
|
||||
float fEffectLength, fCurrOpacity, fOpacDelta;
|
||||
float fLastTime;
|
||||
|
||||
void IStartFadeIn( hsScalar lengthInSecs, uint8_t effect = kFadeIn );
|
||||
void IStartFadeOut( hsScalar lengthInSecs, uint8_t effect = kFadeOut );
|
||||
void IStartFadeIn( float lengthInSecs, uint8_t effect = kFadeIn );
|
||||
void IStartFadeOut( float lengthInSecs, uint8_t effect = kFadeOut );
|
||||
|
||||
void ICreatePlate( void );
|
||||
|
||||
|
@ -44,19 +44,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plVertCoder.h"
|
||||
|
||||
#include "hsStream.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "plGBufferGroup.h"
|
||||
|
||||
const hsScalar kPosQuantum = 1.f / hsScalar(1 << 10);
|
||||
const hsScalar kWeightQuantum = 1.f / hsScalar(1 << 15);
|
||||
const hsScalar kUVWQuantum = 1.f / hsScalar(1 << 16);
|
||||
const float kPosQuantum = 1.f / float(1 << 10);
|
||||
const float kWeightQuantum = 1.f / float(1 << 15);
|
||||
const float kUVWQuantum = 1.f / float(1 << 16);
|
||||
|
||||
uint32_t plVertCoder::fCodedVerts = 0;
|
||||
uint32_t plVertCoder::fCodedBytes = 0;
|
||||
uint32_t plVertCoder::fRawBytes = 0;
|
||||
uint32_t plVertCoder::fSkippedBytes = 0;
|
||||
|
||||
static const hsScalar kQuanta[plVertCoder::kNumFloatFields] =
|
||||
static const float kQuanta[plVertCoder::kNumFloatFields] =
|
||||
{
|
||||
kPosQuantum,
|
||||
kWeightQuantum,
|
||||
@ -73,24 +73,24 @@ static const hsScalar kQuanta[plVertCoder::kNumFloatFields] =
|
||||
};
|
||||
|
||||
|
||||
inline void plVertCoder::ICountFloats(const uint8_t* src, uint16_t maxCnt, const hsScalar quant, const uint32_t stride,
|
||||
hsScalar& lo, hsBool &allSame, uint16_t& count)
|
||||
inline void plVertCoder::ICountFloats(const uint8_t* src, uint16_t maxCnt, const float quant, const uint32_t stride,
|
||||
float& lo, hsBool &allSame, uint16_t& count)
|
||||
{
|
||||
lo = *(hsScalar*)src;
|
||||
lo = *(float*)src;
|
||||
lo = floor(lo / quant + 0.5f) * quant;
|
||||
allSame = false;
|
||||
hsScalar hi = lo;
|
||||
float hi = lo;
|
||||
|
||||
count = 1;
|
||||
|
||||
const hsScalar maxRange = hsScalar(uint16_t(0xffff)) * quant;
|
||||
const float maxRange = float(uint16_t(0xffff)) * quant;
|
||||
|
||||
src += stride;
|
||||
maxCnt--;
|
||||
|
||||
while( maxCnt-- )
|
||||
{
|
||||
hsScalar val = *(hsScalar*)src;
|
||||
float val = *(float*)src;
|
||||
val = floor(val / quant + 0.5f) * quant;
|
||||
if( val < lo )
|
||||
{
|
||||
@ -110,12 +110,12 @@ inline void plVertCoder::ICountFloats(const uint8_t* src, uint16_t maxCnt, const
|
||||
allSame = (lo == hi);
|
||||
}
|
||||
|
||||
static inline void IWriteFloat(hsStream* s, const uint8_t*& src, const hsScalar offset, const hsScalar quantum)
|
||||
static inline void IWriteFloat(hsStream* s, const uint8_t*& src, const float offset, const float quantum)
|
||||
{
|
||||
float fval = *(float*)src;
|
||||
fval -= offset;
|
||||
fval /= quantum;
|
||||
// hsAssert(fval < hsScalar(uint16_t(0xffff)), "Bad offset?");
|
||||
// hsAssert(fval < float(uint16_t(0xffff)), "Bad offset?");
|
||||
|
||||
const uint16_t ival = uint16_t(floor(fval + 0.5f));
|
||||
s->WriteLE16(ival);
|
||||
@ -123,13 +123,13 @@ static inline void IWriteFloat(hsStream* s, const uint8_t*& src, const hsScalar
|
||||
src += 4;
|
||||
}
|
||||
|
||||
static inline void IReadFloat(hsStream* s, uint8_t*& dst, const hsScalar offset, const hsScalar quantum)
|
||||
static inline void IReadFloat(hsStream* s, uint8_t*& dst, const float offset, const float quantum)
|
||||
{
|
||||
const uint16_t ival = s->ReadLE16();
|
||||
float fval = float(ival) * quantum;
|
||||
fval += offset;
|
||||
|
||||
hsScalar* val = (hsScalar*)dst;
|
||||
float* val = (float*)dst;
|
||||
*val = fval;
|
||||
|
||||
dst += 4;
|
||||
@ -167,7 +167,7 @@ inline void plVertCoder::IDecodeFloat(hsStream* s, const int field, const int ch
|
||||
IReadFloat(s, dst, fFloats[field][chan].fOffset, kQuanta[field]);
|
||||
else
|
||||
{
|
||||
*((hsScalar*)dst) = fFloats[field][chan].fOffset;
|
||||
*((float*)dst) = fFloats[field][chan].fOffset;
|
||||
dst += 4;
|
||||
}
|
||||
|
||||
@ -179,21 +179,21 @@ static inline int INumWeights(const uint8_t format)
|
||||
return (format & plGBufferGroup::kSkinWeightMask) >> 4;
|
||||
}
|
||||
|
||||
static const hsScalar kNormalScale(int16_t(0x7fff));
|
||||
static const hsScalar kInvNormalScale(1.f / kNormalScale);
|
||||
static const float kNormalScale(int16_t(0x7fff));
|
||||
static const float kInvNormalScale(1.f / kNormalScale);
|
||||
|
||||
inline void plVertCoder::IEncodeNormal(hsStream* s, const uint8_t*& src, const uint32_t stride)
|
||||
{
|
||||
|
||||
hsScalar x = *(hsScalar*)src;
|
||||
float x = *(float*)src;
|
||||
s->WriteByte((uint8_t)((x / 2.f + .5f) * 255.9f));
|
||||
src += 4;
|
||||
|
||||
x = *(hsScalar*)src;
|
||||
x = *(float*)src;
|
||||
s->WriteByte((uint8_t)((x / 2.f + .5f) * 255.9f));
|
||||
src += 4;
|
||||
|
||||
x = *(hsScalar*)src;
|
||||
x = *(float*)src;
|
||||
s->WriteByte((uint8_t)((x / 2.f + .5f) * 255.9f));
|
||||
src += 4;
|
||||
}
|
||||
@ -202,17 +202,17 @@ inline void plVertCoder::IDecodeNormal(hsStream* s, uint8_t*& dst, const uint32_
|
||||
{
|
||||
|
||||
uint8_t ix = s->ReadByte();
|
||||
hsScalar* x = (hsScalar*)dst;
|
||||
float* x = (float*)dst;
|
||||
*x = (ix / 255.9f - .5f) * 2.f;
|
||||
dst += 4;
|
||||
|
||||
ix = s->ReadByte();
|
||||
x = (hsScalar*)dst;
|
||||
x = (float*)dst;
|
||||
*x = (ix / 255.9f - .5f) * 2.f;
|
||||
dst += 4;
|
||||
|
||||
ix = s->ReadByte();
|
||||
x = (hsScalar*)dst;
|
||||
x = (float*)dst;
|
||||
*x = (ix / 255.9f - .5f) * 2.f;
|
||||
dst += 4;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ protected:
|
||||
class FloatCode
|
||||
{
|
||||
public:
|
||||
hsScalar fOffset;
|
||||
float fOffset;
|
||||
hsBool fAllSame;
|
||||
uint16_t fCount;
|
||||
};
|
||||
@ -82,7 +82,7 @@ protected:
|
||||
static uint32_t fRawBytes;
|
||||
static uint32_t fSkippedBytes;
|
||||
|
||||
inline void ICountFloats(const uint8_t* src, uint16_t maxCnt, const hsScalar quant, const uint32_t stride, hsScalar& lo, hsBool& allSame, uint16_t& count);
|
||||
inline void ICountFloats(const uint8_t* src, uint16_t maxCnt, const float quant, const uint32_t stride, float& lo, hsBool& allSame, uint16_t& count);
|
||||
inline void IEncodeFloat(hsStream* s, const uint32_t vertsLeft, const int field, const int chan, const uint8_t*& src, const uint32_t stride);
|
||||
inline void IDecodeFloat(hsStream* s, const int field, const int chan, uint8_t*& dst, const uint32_t stride);
|
||||
|
||||
|
Reference in New Issue
Block a user