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

Merge remote-tracking branch 'origin/master' into plString

Conflicts:
	Sources/Plasma/CoreLib/hsStream.h
	Sources/Plasma/FeatureLib/pfAudio/plListener.cpp
	Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp
	Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp
	Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp
	Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
	Sources/Plasma/FeatureLib/pfPython/cyMisc.h
	Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp
	Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp
	Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h
	Sources/Plasma/FeatureLib/pfPython/pyImage.cpp
	Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp
	Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h
	Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp
	Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp
	Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp
	Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h
	Sources/Plasma/NucleusLib/pnMessage/plMessage.h
	Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h
	Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.cpp
	Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp
	Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp
	Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp
	Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h
	Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h
	Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h
	Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp
	Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.h
	Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.h
	Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp
	Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp
	Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp
	Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp
	Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.h
	Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp
	Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h
	Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp
	Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.h
	Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp
This commit is contained in:
2012-01-28 17:20:01 -08:00
1722 changed files with 24149 additions and 27599 deletions

View File

@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "hsTypes.h"
#include "HeadSpin.h"
#include "plDirectShadowMaster.h"
#include "plShadowSlave.h"
@ -73,9 +73,9 @@ plDirectShadowMaster::~plDirectShadowMaster()
plShadowSlave* plDirectShadowMaster::INewSlave(const plShadowCaster* caster)
{
if( caster->GetPerspective() )
return TRACKED_NEW plPerspDirSlave;
return new plPerspDirSlave;
return TRACKED_NEW plDirectShadowSlave;
return new plDirectShadowSlave;
}
plShadowSlave* plDirectShadowMaster::INextSlave(const plShadowCaster* caster)
@ -172,7 +172,7 @@ void plDirectShadowMaster::IComputeISect(const hsBounds3Ext& casterBnd, plShadow
fIsectPool.ExpandAndZero(iIsect+1);
if( !fIsectPool[iIsect] )
{
fIsectPool[iIsect] = TRACKED_NEW plBoundsIsect;
fIsectPool[iIsect] = new plBoundsIsect;
}
plBoundsIsect* isect = fIsectPool[iIsect];

View File

@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "hsTypes.h"
#include "HeadSpin.h"
#include "plLightInfo.h"
#include "plLightKonstants.h"
#include "hsBounds.h"
@ -74,8 +74,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// heinous
#include "plNetClient/plNetClientMgr.h"
#include "pnMessage/plEnableMsg.h"
static hsScalar kMaxYon = 1000.f;
static hsScalar kMinHither = 1.f;
static float kMaxYon = 1000.f;
static float kMinHither = 1.f;
#include "plLightProxy.h"
@ -102,7 +102,7 @@ plLightInfo::plLightInfo()
fNextDevPtr = nil;
fPrevDevPtr = nil;
fProxyGen = TRACKED_NEW plLightProxy;
fProxyGen = new plLightProxy;
fProxyGen->Init(this);
fRegisteredForRenderMsg = false;
@ -141,9 +141,9 @@ void plLightInfo::IRefresh()
void plLightInfo::ICheckMaxStrength()
{
hsScalar r = GetDiffuse().r >= 0 ? GetDiffuse().r : -GetDiffuse().r;
hsScalar g = GetDiffuse().g >= 0 ? GetDiffuse().g : -GetDiffuse().g;
hsScalar b = GetDiffuse().b >= 0 ? GetDiffuse().b : -GetDiffuse().b;
float r = GetDiffuse().r >= 0 ? GetDiffuse().r : -GetDiffuse().r;
float g = GetDiffuse().g >= 0 ? GetDiffuse().g : -GetDiffuse().g;
float b = GetDiffuse().b >= 0 ? GetDiffuse().b : -GetDiffuse().b;
fMaxStrength =
r > g
? (
@ -157,11 +157,11 @@ void plLightInfo::ICheckMaxStrength()
: b
);
const hsScalar kMinMaxStrength = 1.e-2f;
const float kMinMaxStrength = 1.e-2f;
SetZero(fMaxStrength < kMinMaxStrength);
}
void plLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const
void plLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const
{
if( IsIdle() )
{
@ -215,7 +215,7 @@ void plLightInfo::GetAffected(const plSpaceTree* space, hsBitVector& list, hsBoo
}
}
const hsTArray<Int16>& plLightInfo::GetAffected(plSpaceTree* space, const hsTArray<Int16>& visList, hsTArray<Int16>& litList, hsBool charac)
const hsTArray<int16_t>& plLightInfo::GetAffected(plSpaceTree* space, const hsTArray<int16_t>& visList, hsTArray<int16_t>& litList, hsBool charac)
{
Refresh();
@ -469,9 +469,9 @@ void plLightInfo::Read(hsStream* s, hsResMgr* mgr)
fLocalToWorld = fLightToWorld * fLocalToLight;
fWorldToLocal = fLightToLocal * fWorldToLight;
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kProjection), plRefFlags::kActiveRef);
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kProjection), plRefFlags::kActiveRef);
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kSoftVolume), plRefFlags::kActiveRef);
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kSoftVolume), plRefFlags::kActiveRef);
// Let our sceneNode know we're here.
plKey nodeKey = mgr->ReadKey(s);
@ -481,7 +481,7 @@ void plLightInfo::Read(hsStream* s, hsResMgr* mgr)
fVisRegions.SetCountAndZero(n);
int i;
for( i = 0; i < n; i++ )
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kVisRegion), plRefFlags::kActiveRef);
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kVisRegion), plRefFlags::kActiveRef);
SetDirty(true);
}
@ -519,7 +519,7 @@ void plLightInfo::ISetSceneNode(plKey node)
{
if( node )
{
plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(node, plRefMsg::kOnCreate, -1, plNodeRefMsg::kLight);
plNodeRefMsg* refMsg = new plNodeRefMsg(node, plRefMsg::kOnCreate, -1, plNodeRefMsg::kLight);
hsgResMgr::ResMgr()->AddViaNotify(GetKey(), refMsg, plRefFlags::kPassiveRef);
}
if( fSceneNode )
@ -592,7 +592,7 @@ plDirectionalLightInfo::~plDirectionalLightInfo()
{
}
void plDirectionalLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const
void plDirectionalLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const
{
plLightInfo::GetStrengthAndScale(bnd, strength, scale);
}
@ -637,8 +637,8 @@ void plLimitedDirLightInfo::IRefresh()
hsMatrix44 l2ndc;
l2ndc.Reset();
hsScalar width = fWidth;
hsScalar height = fHeight;
float width = fWidth;
float height = fHeight;
l2ndc.fMap[0][0] = 1.f / width;
l2ndc.fMap[0][3] = 0.5f;
@ -658,7 +658,7 @@ void plLimitedDirLightInfo::IRefresh()
}
}
void plLimitedDirLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const
void plLimitedDirLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const
{
// If we haven't culled the object, return that we're full strength.
plLightInfo::GetStrengthAndScale(bnd, strength, scale);
@ -685,14 +685,14 @@ void plLimitedDirLightInfo::Write(hsStream* s, hsResMgr* mgr)
void plLimitedDirLightInfo::IMakeIsect()
{
if( !fParPlanes )
fParPlanes = TRACKED_NEW plParallelIsect;
fParPlanes = new plParallelIsect;
fParPlanes->SetNumPlanes(3);
hsPoint3 p0, p1;
hsScalar width = fWidth;
hsScalar height = fHeight;
float width = fWidth;
float height = fHeight;
p0.Set(-width*0.5f, 0, 0);
p1.Set(width*0.5f, 0, 0);
fParPlanes->SetPlane(0, p0, p1);
@ -712,7 +712,7 @@ void plLimitedDirLightInfo::IMakeIsect()
// Creates a new box drawable for showing the light's
// influence.
plDrawableSpans* plLimitedDirLightInfo::CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo)
plDrawableSpans* plLimitedDirLightInfo::CreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo)
{
hsPoint3 corner;
corner.Set(-fWidth*0.5f, -fHeight*0.5f, -fDepth);
@ -752,11 +752,11 @@ plOmniLightInfo::~plOmniLightInfo()
void plOmniLightInfo::IMakeIsect()
{
fSphere = TRACKED_NEW plSphereIsect;
fSphere = new plSphereIsect;
fSphere->SetTransform(fLightToWorld, fWorldToLight);
}
void plOmniLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const
void plOmniLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const
{
plLightInfo::GetStrengthAndScale(bnd, strength, scale);
@ -764,7 +764,7 @@ void plOmniLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& str
const hsPoint3& pos = bnd.GetCenter();
hsPoint3 wpos = GetWorldPosition();
hsScalar dist = hsVector3(&pos, &wpos).MagnitudeSquared();
float dist = hsVector3(&pos, &wpos).MagnitudeSquared();
dist = 1.f / hsFastMath::InvSqrtAppr(dist);
if( fAttenQuadratic > 0 )
{
@ -785,16 +785,16 @@ void plOmniLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& str
}
}
hsScalar plOmniLightInfo::GetRadius() const
float plOmniLightInfo::GetRadius() const
{
hsScalar radius = 0;
float radius = 0;
if( fAttenQuadratic > 0 )
{
hsScalar mult = fDiffuse.a >= 0 ? fDiffuse.a : -fDiffuse.a;
hsScalar det = fAttenLinear*fAttenLinear - 4.f * fAttenQuadratic * fAttenConst * (1.f - mult * plSillyLightKonstants::GetFarPowerKonst());
float mult = fDiffuse.a >= 0 ? fDiffuse.a : -fDiffuse.a;
float det = fAttenLinear*fAttenLinear - 4.f * fAttenQuadratic * fAttenConst * (1.f - mult * plSillyLightKonstants::GetFarPowerKonst());
if( det > 0 )
{
det = hsSquareRoot(det);
det = sqrt(det);
radius = -fAttenLinear + det;
radius /= fAttenQuadratic * 2.f;
@ -804,7 +804,7 @@ hsScalar plOmniLightInfo::GetRadius() const
}
else if( fAttenLinear > 0 )
{
hsScalar mult = fDiffuse.a >= 0 ? fDiffuse.a : -fDiffuse.a;
float mult = fDiffuse.a >= 0 ? fDiffuse.a : -fDiffuse.a;
radius = (mult * plSillyLightKonstants::GetFarPowerKonst() - 1.f ) * fAttenConst / fAttenLinear;
}
else if( fAttenCutoff > 0 )
@ -864,7 +864,7 @@ void plOmniLightInfo::Write(hsStream* s, hsResMgr* mgr)
// Creates a new sphere drawable for showing the omnilight's
// sphere (haha) of influence.
plDrawableSpans* plOmniLightInfo::CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo)
plDrawableSpans* plOmniLightInfo::CreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo)
{
float rad = GetRadius();
if( rad == 0 )
@ -887,8 +887,8 @@ plDrawableSpans* plOmniLightInfo::CreateProxy(hsGMaterial* mat, hsTArray<UInt32>
// Spot
plSpotLightInfo::plSpotLightInfo()
: fFalloff(1.f),
fSpotInner(hsScalarPI * 0.125f),
fSpotOuter(hsScalarPI * 0.25f),
fSpotInner(M_PI * 0.125f),
fSpotOuter(M_PI * 0.25f),
fCone(nil)
{
}
@ -898,7 +898,7 @@ plSpotLightInfo::~plSpotLightInfo()
delete fCone;
}
void plSpotLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const
void plSpotLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const
{
plOmniLightInfo::GetStrengthAndScale(bnd, strength, scale);
@ -908,13 +908,13 @@ void plSpotLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& str
hsVector3 del;
hsPoint3 wpos = GetWorldPosition();
del.Set(&pos, &wpos);
hsScalar invDist = del.MagnitudeSquared();
float invDist = del.MagnitudeSquared();
invDist = hsFastMath::InvSqrtAppr(invDist);
hsScalar dot = del.InnerProduct(GetWorldDirection());
float dot = del.InnerProduct(GetWorldDirection());
dot *= invDist;
hsScalar cosInner, cosOuter, t;
float cosInner, cosOuter, t;
hsFastMath::SinCosInRangeAppr(fSpotInner, t, cosInner);
hsFastMath::SinCosInRangeAppr(fSpotOuter, t, cosOuter);
if( dot < cosOuter )
@ -925,7 +925,7 @@ void plSpotLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& str
void plSpotLightInfo::IMakeIsect()
{
fCone = TRACKED_NEW plConeIsect;
fCone = new plConeIsect;
fCone->SetTransform(fLightToWorld, fWorldToLight);
}
@ -936,7 +936,7 @@ void plSpotLightInfo::IRefresh()
if( !fCone )
IMakeIsect();
hsScalar effFOV = fSpotOuter;
float effFOV = fSpotOuter;
fCone->SetAngle(effFOV);
@ -948,12 +948,12 @@ void plSpotLightInfo::IRefresh()
if( GetProjection() )
{
hsScalar yon = GetRadius();
float yon = GetRadius();
if( yon < kMinHither )
yon = kMaxYon;
hsScalar hither = hsMinimum(kMinHither, yon * 0.5f);
float hither = hsMinimum(kMinHither, yon * 0.5f);
hsScalar sinFOV, cosFOV;
float sinFOV, cosFOV;
hsFastMath::SinCos(effFOV, sinFOV, cosFOV);
hsMatrix44 l2ndc;
@ -1000,7 +1000,7 @@ hsVector3 plSpotLightInfo::GetWorldDirection() const
// Generates a new drawable for showing the spotlight's
// sphere of influence.
plDrawableSpans* plSpotLightInfo::CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo)
plDrawableSpans* plSpotLightInfo::CreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo)
{
float rad = GetRadius();
float x, y;

View File

@ -104,7 +104,7 @@ protected:
kVolEmpty = 0x2,
kVolZero = 0x4
};
UInt8 fVolFlags;
uint8_t fVolFlags;
hsBitVector fVisSet;
hsBitVector fVisNot;
@ -136,7 +136,7 @@ protected:
plSoftVolume* fSoftVolume;
hsScalar fMaxStrength;
float fMaxStrength;
hsBool fRegisteredForRenderMsg;
@ -183,12 +183,12 @@ public:
void SetShadowCaster(hsBool on) { SetProperty(kLPCastShadows, on); }
void Refresh() { if( IsDirty() ) { IRefresh(); SetDirty(false); } }
virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const;
virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const;
hsBool AffectsBound(const hsBounds3Ext& bnd) { return IGetIsect() ? IGetIsect()->Test(bnd) != kVolumeCulled : true; }
void GetAffectedForced(const plSpaceTree* space, hsBitVector& list, hsBool charac);
void GetAffected(const plSpaceTree* space, hsBitVector& list, hsBool charac);
const hsTArray<Int16>& GetAffected(plSpaceTree* space, const hsTArray<Int16>& visList, hsTArray<Int16>& litList, hsBool charac);
const hsTArray<int16_t>& GetAffected(plSpaceTree* space, const hsTArray<int16_t>& visList, hsTArray<int16_t>& litList, hsBool charac);
hsBool InVisSet(const hsBitVector& visSet) const { return fVisSet.Overlap(visSet); }
hsBool InVisNot(const hsBitVector& visNot) const { return fVisNot.Overlap(visNot); }
@ -210,7 +210,7 @@ public:
virtual const hsMatrix44& GetLightToWorld() const;
virtual const hsMatrix44& GetWorldToLight() const;
virtual Int32 GetNumProperties() const { return kNumProps; }
virtual int32_t GetNumProperties() const { return kNumProps; }
const plSoftVolume* GetSoftVolume() const { return fSoftVolume; }
@ -238,7 +238,7 @@ public:
void SetLocalToLight(const hsMatrix44& l2lt, const hsMatrix44& lt2l);
// Visualization
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo) { return addTo; }
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo) { return addTo; }
};
@ -256,7 +256,7 @@ public:
CLASSNAME_REGISTER( plDirectionalLightInfo );
GETINTERFACE_ANY( plDirectionalLightInfo, plLightInfo );
virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const;
virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const;
hsVector3 GetWorldDirection() const;
virtual hsVector3 GetNegativeWorldDirection(const hsPoint3& pos) const { return -GetWorldDirection(); }
@ -270,9 +270,9 @@ class plLimitedDirLightInfo : public plDirectionalLightInfo
{
protected:
hsScalar fWidth;
hsScalar fHeight;
hsScalar fDepth;
float fWidth;
float fHeight;
float fDepth;
plParallelIsect* fParPlanes;
@ -288,31 +288,31 @@ public:
CLASSNAME_REGISTER( plLimitedDirLightInfo );
GETINTERFACE_ANY( plLimitedDirLightInfo, plDirectionalLightInfo );
virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const;
virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const;
hsScalar GetWidth() const { return fWidth; }
hsScalar GetHeight() const { return fHeight; }
hsScalar GetDepth() const { return fDepth; }
float GetWidth() const { return fWidth; }
float GetHeight() const { return fHeight; }
float GetDepth() const { return fDepth; }
void SetWidth(hsScalar w) { fWidth = w; }
void SetHeight(hsScalar h) { fHeight = h; }
void SetDepth(hsScalar d) { fDepth = d; }
void SetWidth(float w) { fWidth = w; }
void SetHeight(float h) { fHeight = h; }
void SetDepth(float d) { fDepth = d; }
virtual void Read(hsStream* stream, hsResMgr* mgr);
virtual void Write(hsStream* stream, hsResMgr* mgr);
// Visualization
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo);
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo);
};
class plOmniLightInfo : public plLightInfo
{
protected:
// Omni and spot
hsScalar fAttenConst;
hsScalar fAttenLinear;
hsScalar fAttenQuadratic;
hsScalar fAttenCutoff; // Only for attenuate-but-not-really mode, 0 otherwise
float fAttenConst;
float fAttenLinear;
float fAttenQuadratic;
float fAttenCutoff; // Only for attenuate-but-not-really mode, 0 otherwise
plSphereIsect* fSphere;
@ -329,29 +329,29 @@ public:
CLASSNAME_REGISTER( plOmniLightInfo );
GETINTERFACE_ANY( plOmniLightInfo, plLightInfo );
virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const;
virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const;
virtual hsVector3 GetNegativeWorldDirection(const hsPoint3& pos) const;
hsBool IsAttenuated() const { return (fAttenLinear != 0)||(fAttenQuadratic != 0) || ( fAttenCutoff != 0 ); }
hsScalar GetRadius() const;
float GetRadius() const;
hsScalar GetConstantAttenuation() const { return fAttenConst; }
hsScalar GetLinearAttenuation() const { return fAttenLinear; }
hsScalar GetQuadraticAttenuation() const { return fAttenQuadratic; }
hsScalar GetCutoffAttenuation() const { return fAttenCutoff; }
float GetConstantAttenuation() const { return fAttenConst; }
float GetLinearAttenuation() const { return fAttenLinear; }
float GetQuadraticAttenuation() const { return fAttenQuadratic; }
float GetCutoffAttenuation() const { return fAttenCutoff; }
hsPoint3 GetWorldPosition() const { return fLightToWorld.GetTranslate(); }
void SetConstantAttenuation(hsScalar a) { fAttenConst = a; SetDirty(true); }
void SetLinearAttenuation(hsScalar a) { fAttenLinear = a; SetDirty(true); }
void SetQuadraticAttenuation(hsScalar a) { fAttenQuadratic = a; SetDirty(true); }
void SetCutoffAttenuation( hsScalar a ) { fAttenCutoff = a; SetDirty( true ); }
void SetConstantAttenuation(float a) { fAttenConst = a; SetDirty(true); }
void SetLinearAttenuation(float a) { fAttenLinear = a; SetDirty(true); }
void SetQuadraticAttenuation(float a) { fAttenQuadratic = a; SetDirty(true); }
void SetCutoffAttenuation( float a ) { fAttenCutoff = a; SetDirty( true ); }
virtual void Read(hsStream* stream, hsResMgr* mgr);
virtual void Write(hsStream* stream, hsResMgr* mgr);
// Visualization
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo);
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo);
};
@ -359,13 +359,13 @@ class plSpotLightInfo : public plOmniLightInfo
{
protected:
// Valid only for spot
hsScalar fFalloff;
float fFalloff;
// Note - these are half angles, D3D wants whole angles, so fSpotInner*2 etc.
hsScalar fSpotInner;
hsScalar fSpotOuter;
float fSpotInner;
float fSpotOuter;
hsScalar fEffectiveFOV;
float fEffectiveFOV;
plConeIsect* fCone;
@ -381,24 +381,24 @@ public:
CLASSNAME_REGISTER( plSpotLightInfo );
GETINTERFACE_ANY( plSpotLightInfo, plOmniLightInfo );
virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const;
virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const;
hsVector3 GetWorldDirection() const;
virtual hsVector3 GetNegativeWorldDirection(const hsPoint3& pos) const { return -GetWorldDirection(); }
void SetFalloff(hsScalar f) { fFalloff = f; SetDirty(true); }
void SetSpotInner(hsScalar rads) { fSpotInner = rads; SetDirty(true); }
void SetSpotOuter(hsScalar rads) { fSpotOuter = rads; SetDirty(true); }
void SetFalloff(float f) { fFalloff = f; SetDirty(true); }
void SetSpotInner(float rads) { fSpotInner = rads; SetDirty(true); }
void SetSpotOuter(float rads) { fSpotOuter = rads; SetDirty(true); }
hsScalar GetFalloff() const { return fFalloff; }
hsScalar GetSpotInner() const { return fSpotInner; }
hsScalar GetSpotOuter() const { return fSpotOuter; }
float GetFalloff() const { return fFalloff; }
float GetSpotInner() const { return fSpotInner; }
float GetSpotOuter() const { return fSpotOuter; }
virtual void Read(hsStream* stream, hsResMgr* mgr);
virtual void Write(hsStream* stream, hsResMgr* mgr);
// Visualization
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo);
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo);
};

View File

@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "hsTypes.h"
#include "HeadSpin.h"
#include "plLightProxy.h"
#include "plLightInfo.h"
#include "plDrawable/plDrawableSpans.h"
@ -72,7 +72,7 @@ plKey plLightProxy::IGetNode() const
return fOwner ? fOwner->GetSceneNode() : nil;
}
plDrawableSpans* plLightProxy::ICreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo)
plDrawableSpans* plLightProxy::ICreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo)
{
if( fOwner )
{

View File

@ -53,7 +53,7 @@ protected:
plLightInfo* fOwner;
virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo=nil);
virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo=nil);
virtual plKey IGetNode() const;
public:
plLightProxy();

View File

@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "hsTypes.h"
#include "HeadSpin.h"
#include "plLightSpace.h"
#include "hsStream.h"
#include "hsResMgr.h"
@ -58,8 +58,8 @@ hsBool plLightSpace::MsgReceive(plMessage* msg)
// which is entering and leaving, and whether it is entering or leaving.
plKey otherKey = nil;
hsBool enter = true;
UInt8 ctx = enter ? plRefMsg::kOnRequest : plRefMsg::kOnRemove;
plLightRefMsg* liMsg = TRACKED_NEW plLightRefMsg(GetKey(), otherKey, IGetLightInfo(), ctx);
uint8_t ctx = enter ? plRefMsg::kOnRequest : plRefMsg::kOnRemove;
plLightRefMsg* liMsg = new plLightRefMsg(GetKey(), otherKey, IGetLightInfo(), ctx);
plgDispatch::MsgSend(liMsg);
return true;
}
@ -80,7 +80,7 @@ void plLightSpace::Read(hsStream* s, hsResMgr* mgr)
{
plMultiModifier::Read(s, mgr);
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plLightRefMsg(nil, GetKey(), nil, plRefMsg::kOnCreate), plRefFlags::kPassiveRef);
mgr->ReadKeyNotifyMe(s, new plLightRefMsg(nil, GetKey(), nil, plRefMsg::kOnCreate), plRefFlags::kPassiveRef);
}
void plLightSpace::Write(hsStream* s, hsResMgr* mgr)

View File

@ -62,7 +62,7 @@ public:
CLASSNAME_REGISTER( plLightSpace );
GETINTERFACE_ANY( plLightSpace, plMultiModifier );
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; }
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; }
virtual void Read(hsStream* s, hsResMgr* mgr);
virtual void Write(hsStream* s, hsResMgr* mgr);

View File

@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "hsTypes.h"
#include "HeadSpin.h"
#include "plPipeline.h"
#include "plTweak.h"
#include "hsFastMath.h"
@ -60,7 +60,7 @@ void plPerspDirSlave::Init()
fFlags |= kCastInCameraSpace;
}
hsPoint3 plPerspDirSlave::IProject(const hsMatrix44& world2NDC, const hsPoint3& pos, hsScalar w) const
hsPoint3 plPerspDirSlave::IProject(const hsMatrix44& world2NDC, const hsPoint3& pos, float w) const
{
hsPoint3 retVal;
retVal.fX = world2NDC.fMap[0][0] * pos.fX
@ -78,7 +78,7 @@ hsPoint3 plPerspDirSlave::IProject(const hsMatrix44& world2NDC, const hsPoint3&
+ world2NDC.fMap[2][2] * pos.fZ
+ world2NDC.fMap[2][3] * w;
hsScalar invW = 1.f / (
float invW = 1.f / (
world2NDC.fMap[3][0] * pos.fX
+ world2NDC.fMap[3][1] * pos.fY
+ world2NDC.fMap[3][2] * pos.fZ
@ -125,8 +125,8 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe)
{
plViewTransform pipeView = pipe->GetViewTransform();
plConst(hsScalar) kYon(100.f);
plConst(hsScalar) kHither(30.f);
plConst(float) kYon(100.f);
plConst(float) kHither(30.f);
pipeView.SetHither(kHither);
pipeView.SetYon(kYon);
@ -153,7 +153,7 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe)
}
else if( kUseFrustCenter )
{
plConst(hsScalar) kDist(50.f);
plConst(float) kDist(50.f);
hsPoint3 camFrustCenter(0.f, 0.f, kDist);
lookAt = IProject(cam2NDC, camFrustCenter);
}
@ -167,8 +167,8 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe)
hsMatrix44 li2CamNDC;
IComputeCamNDCToLight(perspLiPos, lookAt, camNDC2Li, li2CamNDC);
hsScalar minZ, maxZ;
hsScalar cotX, cotY;
float minZ, maxZ;
float cotX, cotY;
plConst(hsBool) kFixedPersp(true);
if( !kFixedPersp )
@ -197,13 +197,13 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe)
plConst(hsBool) kFakeDepth(false);
if( kFakeDepth )
{
plConst(hsScalar) kMin(1.f);
plConst(hsScalar) kMax(30.f);
plConst(float) kMin(1.f);
plConst(float) kMax(30.f);
minZ = kMin;
maxZ = kMax;
}
plConst(hsScalar) kMinMinZ(1.f);
plConst(float) kMinMinZ(1.f);
if( minZ < kMinMinZ )
minZ = kMinMinZ;
@ -231,7 +231,7 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe)
}
else
{
plConst(hsScalar) kHi(1.f);
plConst(float) kHi(1.f);
hsBounds3Ext bnd;
const hsPoint3 lo(-1.f, -1.f, 0.f);
const hsPoint3 hi(1.f, 1.f, kHi);
@ -254,7 +254,7 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe)
if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY))
return false;
plConst(hsScalar) kMinMinZ(1.f);
plConst(float) kMinMinZ(1.f);
if( minZ < kMinMinZ )
minZ = kMinMinZ;
@ -320,9 +320,9 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe)
cotX -= cotX / (fWidth * 0.5f);
cotY -= cotY / (fHeight * 0.5f);
hsScalar tanX = 1.f / cotX;
hsScalar tanY = 1.f / cotY;
fView.SetScreenSize((UInt16)fWidth, (UInt16)fHeight);
float tanX = 1.f / cotX;
float tanY = 1.f / cotY;
fView.SetScreenSize((uint16_t)fWidth, (uint16_t)fHeight);
fView.SetCameraTransform(pipe->GetViewTransform().GetWorldToCamera(), pipe->GetViewTransform().GetCameraToWorld());
fView.SetPerspective(true);
fView.SetViewPort(0, 0, (float)fWidth, (float)fHeight, false);
@ -368,10 +368,10 @@ void plPerspDirSlave::IComputeCamNDCToLight(const hsPoint3& from, const hsPoint3
{
hsVector3 atToFrom(&from, &at);
hsScalar distSq = atToFrom.MagnitudeSquared();
float distSq = atToFrom.MagnitudeSquared();
atToFrom *= hsFastMath::InvSqrtAppr(distSq);
const hsScalar kMinMag = 0.5f;
const float kMinMag = 0.5f;
hsVector3 up(0,0,1.f);
if( CrossProd(up, (at - from)).MagnitudeSquared() < kMinMag )
{

View File

@ -49,7 +49,7 @@ class plPerspDirSlave : public plShadowSlave
{
protected:
hsBounds3Ext IGetPerspCasterBound(const hsMatrix44& world2NDC) const;
hsPoint3 IProject(const hsMatrix44& world2NDC, const hsPoint3& pos, hsScalar w=1.f) const;
hsPoint3 IProject(const hsMatrix44& world2NDC, const hsPoint3& pos, float w=1.f) const;
void IComputeCamNDCToLight(const hsPoint3& from, const hsPoint3& at, hsMatrix44& camNDC2Li, hsMatrix44& li2CamNDC);
public:

View File

@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "hsTypes.h"
#include "HeadSpin.h"
#include "plPointShadowMaster.h"
#include "plShadowSlave.h"
@ -53,11 +53,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsBounds.h"
#include "hsFastMath.h"
static const hsScalar kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0).
static const float kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0).
static inline void QuickNorm( hsVector3& a, hsScalar& b )
static inline void QuickNorm( hsVector3& a, float& b )
{
hsScalar len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared());
float len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared());
a *= len;
b *= len;
}
@ -107,7 +107,7 @@ plPointShadowMaster::~plPointShadowMaster()
plShadowSlave* plPointShadowMaster::INewSlave(const plShadowCaster* caster)
{
return TRACKED_NEW plPointShadowSlave;
return new plPointShadowSlave;
}
void plPointShadowMaster::IBeginRender()
@ -119,22 +119,22 @@ void plPointShadowMaster::IBeginRender()
void plPointShadowMaster::IComputeWorldToLight(const hsBounds3Ext& bnd, plShadowSlave* slave) const
{
const hsScalar kMinMag = 0.5f;
const float kMinMag = 0.5f;
hsPoint3 from = fLightInfo->GetLightToWorld().GetTranslate();
hsPoint3 at = bnd.GetCenter();
hsVector3 atToFrom(&from, &at);
hsScalar distSq = atToFrom.MagnitudeSquared();
float distSq = atToFrom.MagnitudeSquared();
atToFrom *= hsFastMath::InvSqrtAppr(distSq);
hsPoint2 depth;
bnd.TestPlane(atToFrom, depth);
hsScalar fromDepth = atToFrom.InnerProduct(from);
float fromDepth = atToFrom.InnerProduct(from);
hsScalar dist = fromDepth - depth.fY;
float dist = fromDepth - depth.fY;
static hsScalar kMinDist = 3.f;
static float kMinDist = 3.f;
if( dist < kMinDist )
{
atToFrom *= kMinDist - dist;
@ -175,7 +175,7 @@ void plPointShadowMaster::IComputeISect(const hsBounds3Ext& bnd, plShadowSlave*
fIsectPool.ExpandAndZero(iIsect+1);
if( !fIsectPool[iIsect] )
{
fIsectPool[iIsect] = TRACKED_NEW plBoundsIsect;
fIsectPool[iIsect] = new plBoundsIsect;
}
plBoundsIsect* isect = fIsectPool[iIsect];
@ -199,10 +199,10 @@ void plPointShadowMaster::IComputeBounds(const hsBounds3Ext& wBnd, plShadowSlave
hsBounds3Ext bnd = sBnd;
hsScalar dist = sBnd.GetCenter().fZ;
float dist = sBnd.GetCenter().fZ;
dist += slave->fAttenDist;
hsScalar minZ = sBnd.GetMaxs().fZ;
float minZ = sBnd.GetMaxs().fZ;
hsPoint3 p(sBnd.GetMins().fX * dist / minZ, sBnd.GetMins().fY * dist / minZ, dist);
bnd.Union(&p);

View File

@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "hsTypes.h"
#include "HeadSpin.h"
#include "plShadowCaster.h"
#include "plMessage/plShadowCastMsg.h"
@ -162,7 +162,7 @@ hsBool plShadowCaster::IOnRenderMsg(plRenderMsg* msg)
if( ShadowCastDisabled() )
return true;
const UInt8 shadowQuality = UInt8(plShadowMaster::GetGlobalShadowQuality() * 3.9f);
const uint8_t shadowQuality = uint8_t(plShadowMaster::GetGlobalShadowQuality() * 3.9f);
if( !GetKey()->GetUoid().GetLoadMask().MatchesQuality(shadowQuality) )
return true;
@ -198,7 +198,7 @@ hsBool plShadowCaster::IOnRenderMsg(plRenderMsg* msg)
if( fMaxOpacity > 0 )
{
plShadowCastMsg* cast = TRACKED_NEW plShadowCastMsg(GetKey(), this, msg->Pipeline());
plShadowCastMsg* cast = new plShadowCastMsg(GetKey(), this, msg->Pipeline());
cast->Send();
}

View File

@ -67,11 +67,11 @@ public:
class DrawSpan
{
public:
DrawSpan& Set(plDrawableSpans* dr, const plSpan* sp, UInt32 idx) { fDraw = (dr); fSpan = (sp); fIndex = (idx); return *this; }
DrawSpan& Set(plDrawableSpans* dr, const plSpan* sp, uint32_t idx) { fDraw = (dr); fSpan = (sp); fIndex = (idx); return *this; }
plDrawableSpans* fDraw;
const plSpan* fSpan;
UInt32 fIndex;
uint32_t fIndex;
};
protected:
@ -85,14 +85,14 @@ protected:
// never expected to change. Anything that might be
// triggered should go into plMultiModifier::fProps,
// to be network synced.
UInt8 fCastFlags;
uint8_t fCastFlags;
hsScalar fBoost;
hsScalar fAttenScale;
hsScalar fBlurScale;
float fBoost;
float fAttenScale;
float fBlurScale;
// Casting attributes calculated each frame.
hsScalar fMaxOpacity;
float fMaxOpacity;
hsTArray<DrawSpan> fSpans;
friend class plShadowMaster;
@ -110,14 +110,14 @@ public:
CLASSNAME_REGISTER( plShadowCaster );
GETINTERFACE_ANY( plShadowCaster, plMultiModifier );
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return true; }
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; }
virtual hsBool MsgReceive(plMessage* msg);
virtual void Read(hsStream* stream, hsResMgr* mgr);
virtual void Write(hsStream* stream, hsResMgr* mgr);
hsScalar MaxOpacity() const { return fMaxOpacity; }
float MaxOpacity() const { return fMaxOpacity; }
const hsTArray<DrawSpan>& Spans() const { return fSpans; }
hsBool GetSelfShadow() const { return 0 != (fCastFlags & kSelfShadow); }
@ -129,14 +129,14 @@ public:
hsBool GetLimitRes() const { return 0 != (fCastFlags & kLimitRes); }
void SetLimitRes(hsBool on) { if(on) fCastFlags |= kLimitRes; else fCastFlags &= ~kLimitRes; }
hsScalar GetAttenScale() const { return fAttenScale; }
void SetAttenScale(hsScalar s) { fAttenScale = s; }
float GetAttenScale() const { return fAttenScale; }
void SetAttenScale(float s) { fAttenScale = s; }
hsScalar GetBlurScale() const { return fBlurScale; }
void SetBlurScale(hsScalar s) { fBlurScale = s; }
float GetBlurScale() const { return fBlurScale; }
void SetBlurScale(float s) { fBlurScale = s; }
hsScalar GetBoost() const { return fBoost; }
void SetBoost(hsScalar s) { fBoost = s; }
float GetBoost() const { return fBoost; }
void SetBoost(float s) { fBoost = s; }
// These are usually handled internally, activating on read and deactivating
// on destruct. Made public in case they need to be manually handled, like

View File

@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "hsTypes.h"
#include "HeadSpin.h"
#include "plShadowMaster.h"
#include "plShadowSlave.h"
@ -62,12 +62,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plTweak.h"
UInt32 plShadowMaster::fGlobalMaxSize = 512;
hsScalar plShadowMaster::fGlobalMaxDist = 160.f; // PERSPTEST
// hsScalar plShadowMaster::fGlobalMaxDist = 100000.f; // PERSPTEST
hsScalar plShadowMaster::fGlobalVisParm = 1.f;
uint32_t plShadowMaster::fGlobalMaxSize = 512;
float plShadowMaster::fGlobalMaxDist = 160.f; // PERSPTEST
// float plShadowMaster::fGlobalMaxDist = 100000.f; // PERSPTEST
float plShadowMaster::fGlobalVisParm = 1.f;
void plShadowMaster::SetGlobalShadowQuality(hsScalar s)
void plShadowMaster::SetGlobalShadowQuality(float s)
{
if( s < 0 )
s = 0;
@ -76,10 +76,10 @@ void plShadowMaster::SetGlobalShadowQuality(hsScalar s)
fGlobalVisParm = s;
}
void plShadowMaster::SetGlobalMaxSize(UInt32 s)
void plShadowMaster::SetGlobalMaxSize(uint32_t s)
{
const UInt32 kMaxMaxGlobalSize = 512;
const UInt32 kMinMaxGlobalSize = 32;
const uint32_t kMaxMaxGlobalSize = 512;
const uint32_t kMinMaxGlobalSize = 32;
// Make sure it's a power of two.
if( ((s-1) & ~s) != (s-1) )
@ -166,7 +166,7 @@ void plShadowMaster::Deactivate() const
plgDispatch::Dispatch()->UnRegisterForExactType(plRenderMsg::Index(), GetKey());
}
void plShadowMaster::SetMaxDist(hsScalar f)
void plShadowMaster::SetMaxDist(float f)
{
fMaxDist = f;
fMinDist = f * 0.75f;
@ -215,7 +215,7 @@ hsBool plShadowMaster::IOnCastMsg(plShadowCastMsg* castMsg)
|| fLightInfo->InVisNot(plGlobalVisMgr::Instance()->GetVisNot()) )
return false;
const UInt8 shadowQuality = UInt8(plShadowMaster::GetGlobalShadowQuality() * 3.9f);
const uint8_t shadowQuality = uint8_t(plShadowMaster::GetGlobalShadowQuality() * 3.9f);
if( !GetKey()->GetUoid().GetLoadMask().MatchesQuality(shadowQuality) )
return false;
@ -227,11 +227,11 @@ hsBool plShadowMaster::IOnCastMsg(plShadowCastMsg* castMsg)
hsBounds3Ext casterBnd;
IComputeCasterBounds(caster, casterBnd);
hsScalar power = IComputePower(caster, casterBnd);
float power = IComputePower(caster, casterBnd);
static hsScalar kVisShadowPower = 1.e-1f;
static hsScalar kMinShadowPower = 2.e-1f;
static hsScalar kKneeShadowPower = 3.e-1f;
static float kVisShadowPower = 1.e-1f;
static float kMinShadowPower = 2.e-1f;
static float kKneeShadowPower = 3.e-1f;
if( power < kMinShadowPower )
return false;
if( power < kKneeShadowPower )
@ -258,10 +258,10 @@ hsBool plShadowMaster::IOnCastMsg(plShadowCastMsg* castMsg)
// That's the distance used for culling ShadowReceivers
// The ShadowSlaveYon is used directly in the
slave->fIndex = UInt32(-1);
slave->fIndex = uint32_t(-1);
castMsg->Pipeline()->SubmitShadowSlave(slave);
if( slave->fIndex == UInt32(-1) )
if( slave->fIndex == uint32_t(-1) )
{
IRecycleSlave(slave);
return false;
@ -294,7 +294,7 @@ void plShadowMaster::IComputeCasterBounds(const plShadowCaster* caster, hsBounds
for( i = 0; i < castSpans.GetCount(); i++ )
{
plDrawableSpans* dr = castSpans[i].fDraw;
UInt32 index = castSpans[i].fIndex;
uint32_t index = castSpans[i].fIndex;
// Right now, the generic world bounds seems close enough, even when skinned.
// It gets a little off on the lower LODs, but, hey, they're the lower LODs.
@ -318,7 +318,7 @@ plShadowSlave* plShadowMaster::INextSlave(const plShadowCaster* caster)
return slave;
}
plShadowSlave* plShadowMaster::ICreateShadowSlave(plShadowCastMsg* castMsg, const hsBounds3Ext& casterBnd, hsScalar power)
plShadowSlave* plShadowMaster::ICreateShadowSlave(plShadowCastMsg* castMsg, const hsBounds3Ext& casterBnd, float power)
{
const plShadowCaster* caster = castMsg->Caster();
@ -371,13 +371,13 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha
if( !castMsg->Pipeline()->TestVisibleWorld(wBnd) )
return IRecycleSlave(slave);
hsScalar maxDist = fMaxDist > 0
float maxDist = fMaxDist > 0
? (fGlobalMaxDist > 0
? hsMinimum(fMaxDist, fGlobalMaxDist)
: fMaxDist)
: fGlobalMaxDist;
plConst(hsScalar) kMinFrac(0.6f);
plConst(float) kMinFrac(0.6f);
maxDist *= kMinFrac + GetGlobalShadowQuality() * (1.f - kMinFrac);
// If we haven't got a max distance at which the shadow stays visible
@ -385,10 +385,10 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha
if( maxDist <= 0 )
return slave;
plConst(hsScalar) kMinFadeFrac(0.90f);
plConst(hsScalar) kMaxFadeFrac(0.75f);
const hsScalar fadeFrac = kMinFadeFrac + GetGlobalShadowQuality() * (kMaxFadeFrac - kMinFadeFrac);
hsScalar minDist = maxDist * fadeFrac;
plConst(float) kMinFadeFrac(0.90f);
plConst(float) kMaxFadeFrac(0.75f);
const float fadeFrac = kMinFadeFrac + GetGlobalShadowQuality() * (kMaxFadeFrac - kMinFadeFrac);
float minDist = maxDist * fadeFrac;
// So we want to fade out the shadow as it gets farther away, hopefully
// pitching it in the distance when we couldn't see it anyway.
@ -400,16 +400,16 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha
// but at least nothing will change when you swing the camera around.
#if 0
wBnd.TestPlane(castMsg->Pipeline()->GetViewDirWorld(), depth);
hsScalar eyeDist = castMsg->Pipeline()->GetViewDirWorld().InnerProduct(castMsg->Pipeline()->GetViewPositionWorld());
float eyeDist = castMsg->Pipeline()->GetViewDirWorld().InnerProduct(castMsg->Pipeline()->GetViewPositionWorld());
#else
hsPoint3 centre = wBnd.GetCenter();
hsPoint3 vpos = castMsg->Pipeline()->GetViewPositionWorld();
hsVector3 dir(&centre, &vpos);
hsFastMath::NormalizeAppr(dir);
wBnd.TestPlane(dir, depth);
hsScalar eyeDist = dir.InnerProduct(vpos);
float eyeDist = dir.InnerProduct(vpos);
#endif
hsScalar dist = depth.fX - eyeDist;
float dist = depth.fX - eyeDist;
// If it's not far enough to be fading, just go with it as is.
dist -= minDist;
@ -429,13 +429,13 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha
}
// compute ShadowSlave power influenced by SoftRegion, current light intensity, and ShadowCaster.fMaxOpacity;
hsScalar plShadowMaster::IComputePower(const plShadowCaster* caster, const hsBounds3Ext& casterBnd) const
float plShadowMaster::IComputePower(const plShadowCaster* caster, const hsBounds3Ext& casterBnd) const
{
hsScalar power = 0;
float power = 0;
if( fLightInfo && !fLightInfo->IsIdle() )
{
power = caster->fMaxOpacity;
hsScalar strength, scale;
float strength, scale;
fLightInfo->GetStrengthAndScale(casterBnd, strength, scale);
power *= strength;
}
@ -465,15 +465,15 @@ void plShadowMaster::IComputeWidthAndHeight(plShadowCastMsg* castMsg, plShadowSl
hsPoint2 depth;
wBnd.TestPlane(castMsg->Pipeline()->GetViewDirWorld(), depth);
hsScalar eyeDist = castMsg->Pipeline()->GetViewDirWorld().InnerProduct(castMsg->Pipeline()->GetViewPositionWorld());
hsScalar dist = depth.fX - eyeDist;
float eyeDist = castMsg->Pipeline()->GetViewDirWorld().InnerProduct(castMsg->Pipeline()->GetViewPositionWorld());
float dist = depth.fX - eyeDist;
if( dist < 0 )
dist = 0;
slave->fPriority = dist; // Might want to boost the local players priority.
plConst(hsScalar) kShiftDist = 50.f; // PERSPTEST
// plConst(hsScalar) kShiftDist = 5000.f; // PERSPTEST
plConst(float) kShiftDist = 50.f; // PERSPTEST
// plConst(float) kShiftDist = 5000.f; // PERSPTEST
int iShift = int(dist / kShiftDist);
slave->fWidth >>= iShift;
slave->fHeight >>= iShift;
@ -507,8 +507,8 @@ void plShadowMaster::IComputeLUT(plShadowCastMsg* castMsg, plShadowSlave* slave)
hsBounds3Ext bnd = slave->fCasterWorldBounds;
bnd.Transform(&slave->fWorldToLight);
hsScalar farthest = bnd.GetCenter().fZ + slave->fAttenDist;
hsScalar closest = bnd.GetMins().fZ;
float farthest = bnd.GetCenter().fZ + slave->fAttenDist;
float closest = bnd.GetMins().fZ;
// Shouldn't this always be negated?
static hsMatrix44 lightToLut; // Static ensures initialized to all zeros.
@ -524,8 +524,8 @@ void plShadowMaster::IComputeLUT(plShadowCastMsg* castMsg, plShadowSlave* slave)
// bias to ShadowSlave.LUTXfm.fMap[0][3]. Bias magnitude would probably be at
// least 0.5f/256.f to compensate for quantization.
plConst(hsScalar) kSelfBias = 2.f / 256.f;
plConst(hsScalar) kOtherBias = -0.5 / 256.f;
plConst(float) kSelfBias = 2.f / 256.f;
plConst(float) kOtherBias = -0.5 / 256.f;
#if 0 // MF_NOSELF
lightToLut.fMap[0][3] += slave->HasFlag(plShadowSlave::kSelfShadow) ? kSelfBias : kOtherBias;
#else // MF_NOSELF
@ -716,13 +716,13 @@ protected:
public:
plDrawableSpans* fDraw;
plSpan* fSpan;
UInt32 fIndex;
uint32_t fIndex;
};
hsTArray<plDrawSpan> fSpans;
hsBounds3Ext fTotalWorldBounds;
hsScalar fMaxOpacity;
float fMaxOpacity;
On RenderMsg
@ -741,7 +741,7 @@ protected:
//find max opacity of all spans
//clear shadowBits of all spans
hsScalar fMaxOpacity = 0.f;
float fMaxOpacity = 0.f;
int i;
for( i = 0; i < fSpans.GetCount(); i++ )
{
@ -803,7 +803,7 @@ public:
CLASSNAME_REGISTER( plShadowCaster );
GETINTERFACE_ANY( plShadowCaster, plMultiModifier );
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) {}
virtual hsBool IEval(double secs, float del, uint32_t dirty) {}
virtual hsBool MsgReceive(plMessage* msg);
@ -818,7 +818,7 @@ protected:
plVolumeIsect* fIsect;
hsScalar fAttenDist;
float fAttenDist;
plSoftVolume* fSoftVolume;
@ -831,7 +831,7 @@ protected:
// Override if you want to attenuate (e.g. dist for omni, cone angle for spot).
// But make sure you factor in base class power.
virtual hsScalar IComputePower(const plShadowCaster* caster);
virtual float IComputePower(const plShadowCaster* caster);
public:
plVolumeIsect* GetIsect() const { return fIsect; }
@ -853,14 +853,14 @@ public:
}
}
virtual void CreateShadowSlave(const hsBounds3Ext& bnd, hsScalar power)
virtual void CreateShadowSlave(const hsBounds3Ext& bnd, float power)
{
int iSlave = fSlavePool.GetCount();
fSlavePool.ExpandAndZero(iSlave+1);
plShadowSlave* slave = fSlavePool[iSlave];
if( !slave )
{
fSlavePool[iSlave] = slave = TRACKED_NEW plShadowSlave;
fSlavePool[iSlave] = slave = new plShadowSlave;
fISectPool[iSlave] = INewISect();
}
@ -883,9 +883,9 @@ public:
};
// compute ShadowSlave power influenced by SoftRegion and ShadowCaster.fMaxOpacity;
hsScalar plShadowMaster::ComputePower(const plShadowCaster* caster)
float plShadowMaster::ComputePower(const plShadowCaster* caster)
{
hsScalar power = caster->fMaxOpacity;
float power = caster->fMaxOpacity;
if( fSoftVolume )
{
power *= fSoftVolume->GetStrength(caster->fTotalWorldBounds.GetCenter());
@ -928,13 +928,13 @@ void plOmniShadowMaster::IComputeProjections(const hsBounds3Ext& wBnd, plShadowS
hsBounds3Ext bnd = wBnd;
bnd.Transform(slave->fWorldToLight);
hsScalar minZ = bnd.GetMins().fZ;
hsScalar maxZ = bnd.GetCenter().fZ + fAttenDist;
float minZ = bnd.GetMins().fZ;
float maxZ = bnd.GetCenter().fZ + fAttenDist;
if( minZ < kMinMinZ )
minZ = kMinMinZ;
hsScalar cotX, cotY;
float cotX, cotY;
if( -bnd.GetMins().fX > bnd.GetMaxs().fX )
{
hsAssert(bnd.GetMins().fX < 0, "Empty shadow caster bounds?");
@ -1011,12 +1011,12 @@ public:
hsMatrix44 fCastLUT;
hsMatrix44 fRcvLUT;
hsScalar fPower;
float fPower;
plVolumeIsect* fISect;
UInt32 fWidth;
UInt32 fHeight;
uint32_t fWidth;
uint32_t fHeight;
};
BeginScene (on EvalMsg?)
@ -1038,7 +1038,7 @@ Harvest
if( !ShadowMaster.CanSee(ShadowCaster.fTotalWorldBounds) )
forget it;
hsScalar power = ComputePower(ShadowCaster);
float power = ComputePower(ShadowCaster);
if( power == 0 )
forget it;

View File

@ -71,19 +71,19 @@ public:
protected:
// Global clamp on shadow map size and stuff
static UInt32 fGlobalMaxSize;
static hsScalar fGlobalMaxDist;
static hsScalar fGlobalVisParm;
static uint32_t fGlobalMaxSize;
static float fGlobalMaxDist;
static float fGlobalVisParm;
// Constant parameter(s) for this master.
hsScalar fAttenDist;
hsScalar fMaxDist;
hsScalar fMinDist;
float fAttenDist;
float fMaxDist;
float fMinDist;
UInt32 fMaxSize;
UInt32 fMinSize;
uint32_t fMaxSize;
uint32_t fMinSize;
hsScalar fPower;
float fPower;
// Temp data used for one frame and recycled.
hsTArray<plShadowSlave*> fSlavePool;
@ -102,11 +102,11 @@ protected:
virtual void IComputeCasterBounds(const plShadowCaster* caster, hsBounds3Ext& casterBnd);
virtual void IComputeWidthAndHeight(plShadowCastMsg* castMsg, plShadowSlave* slave) const;
virtual void IComputeLUT(plShadowCastMsg* castMsg, plShadowSlave* slave) const;
virtual hsScalar IComputePower(const plShadowCaster* caster, const hsBounds3Ext& casterBnd) const;
virtual float IComputePower(const plShadowCaster* caster, const hsBounds3Ext& casterBnd) const;
virtual plShadowSlave* ILastChanceToBail(plShadowCastMsg* castMsg, plShadowSlave* slave);
virtual plShadowSlave* ICreateShadowSlave(plShadowCastMsg* castMsg, const hsBounds3Ext& casterBnd, hsScalar power);
virtual plShadowSlave* ICreateShadowSlave(plShadowCastMsg* castMsg, const hsBounds3Ext& casterBnd, float power);
virtual plShadowSlave* INewSlave(const plShadowCaster* caster) = 0;
virtual plShadowSlave* INextSlave(const plShadowCaster* caster);
@ -128,7 +128,7 @@ public:
virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) {}
Int32 GetNumProperties() const { return kNumProps; }
int32_t GetNumProperties() const { return kNumProps; }
virtual void Read(hsStream* stream, hsResMgr* mgr);
virtual void Write(hsStream* stream, hsResMgr* mgr);
@ -140,29 +140,29 @@ public:
void Activate() const;
// These should only be useful on scene conversion.
hsScalar GetAttenDist() const { return fAttenDist; }
void SetAttenDist(hsScalar d) { fAttenDist = d; }
float GetAttenDist() const { return fAttenDist; }
void SetAttenDist(float d) { fAttenDist = d; }
hsScalar GetMaxDist() const { return fMaxDist; }
hsScalar GetMinDist() const { return fMinDist; }
void SetMaxDist(hsScalar m);
float GetMaxDist() const { return fMaxDist; }
float GetMinDist() const { return fMinDist; }
void SetMaxDist(float m);
UInt32 GetMaxSize() const { return fMaxSize; }
UInt32 GetMinSize() const { return fMinSize; }
void SetMaxSize(UInt32 s) { fMaxSize = s; }
void SetMinSize(UInt32 s) { fMinSize = s; }
uint32_t GetMaxSize() const { return fMaxSize; }
uint32_t GetMinSize() const { return fMinSize; }
void SetMaxSize(uint32_t s) { fMaxSize = s; }
void SetMinSize(uint32_t s) { fMinSize = s; }
hsScalar GetPower() const { return fPower; }
void SetPower(hsScalar f) { fPower = f; }
float GetPower() const { return fPower; }
void SetPower(float f) { fPower = f; }
static void SetGlobalMaxSize(UInt32 s) ;
static UInt32 GetGlobalMaxSize() { return fGlobalMaxSize; }
static void SetGlobalMaxSize(uint32_t s) ;
static uint32_t GetGlobalMaxSize() { return fGlobalMaxSize; }
static void SetGlobalMaxDist(hsScalar s) { fGlobalMaxDist = s; }
static hsScalar GetGlobalMaxDist() { return fGlobalMaxDist; }
static void SetGlobalMaxDist(float s) { fGlobalMaxDist = s; }
static float GetGlobalMaxDist() { return fGlobalMaxDist; }
static void SetGlobalShadowQuality(hsScalar s);
static hsScalar GetGlobalShadowQuality() { return fGlobalVisParm; }
static void SetGlobalShadowQuality(float s);
static float GetGlobalShadowQuality() { return fGlobalVisParm; }
};

View File

@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "hsTypes.h"
#include "HeadSpin.h"
#include "plShadowSlave.h"
#include "plTweak.h"
@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define isnan _isnan
#endif
static const hsScalar kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0).
static const float kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0).
bool plShadowSlave::ISetupOrthoViewTransform()
{
@ -60,14 +60,14 @@ bool plShadowSlave::ISetupOrthoViewTransform()
bnd.Transform(&fWorldToLight);
hsScalar minZ = bnd.GetMins().fZ;
hsScalar maxZ = bnd.GetCenter().fZ + fAttenDist;
float minZ = bnd.GetMins().fZ;
float maxZ = bnd.GetCenter().fZ + fAttenDist;
hsScalar minX = bnd.GetMins().fX;
hsScalar maxX = bnd.GetMaxs().fX;
float minX = bnd.GetMins().fX;
float maxX = bnd.GetMaxs().fX;
hsScalar minY = bnd.GetMins().fY;
hsScalar maxY = bnd.GetMaxs().fY;
float minY = bnd.GetMins().fY;
float maxY = bnd.GetMaxs().fY;
hsMatrix44 proj;
@ -82,7 +82,7 @@ bool plShadowSlave::ISetupOrthoViewTransform()
// and an offset of zero works great. This could be a driver bug, or
// hardware "dependency" (read IHV bug), but whatever, zero is working
// now. Might need to adjust for new drivers or other hardware.
const hsScalar kAdjustBias = 0.0f;
const float kAdjustBias = 0.0f;
proj.fMap[0][0] = 1.f / (maxX - minX);
proj.fMap[0][3] = -minX / (maxX - minX) + kAdjustBias / fWidth;
proj.fMap[1][1] = -1.f / (maxY - minY);
@ -98,20 +98,20 @@ bool plShadowSlave::ISetupOrthoViewTransform()
// Like the adjust bias above, this part is correct in theory, but only
// screws things up (increases Z-acne).
#if 0
hsScalar delX = maxX - minX;
float delX = maxX - minX;
minX += delX / (fWidth * 0.5f);
maxX -= delX / (fWidth * 0.5f);
hsScalar delY = maxY - minY;
float delY = maxY - minY;
minY += delY / (fHeight * 0.5f);
maxY -= delY / (fHeight * 0.5f);
#endif
fView.SetView(hsPoint3(minX, minY, minZ), hsPoint3(maxX, maxY, maxZ));
fView.SetScreenSize((UInt16)fWidth, (UInt16)fHeight);
fView.SetScreenSize((uint16_t)fWidth, (uint16_t)fHeight);
fView.SetCameraTransform(fWorldToLight, fLightToWorld);
fView.SetPerspective(false);
fView.SetViewPort(0, 0, hsScalar(fWidth), hsScalar(fHeight), false);
fView.SetViewPort(0, 0, float(fWidth), float(fHeight), false);
fLightDir = fLightToWorld.GetAxis(hsMatrix44::kUp);
SetFlag(kPositional, false);
@ -126,8 +126,8 @@ bool plShadowSlave::ISetupPerspViewTransform()
bnd.Transform(&fWorldToLight);
hsScalar minZ = bnd.GetMins().fZ;
hsScalar maxZ = bnd.GetCenter().fZ + fAttenDist;
float minZ = bnd.GetMins().fZ;
float maxZ = bnd.GetCenter().fZ + fAttenDist;
if( minZ < kMinMinZ )
minZ = kMinMinZ;
@ -142,7 +142,7 @@ bool plShadowSlave::ISetupPerspViewTransform()
if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY))
return false;
hsScalar cotX, cotY;
float cotX, cotY;
if( -bnd.GetMins().fX > bnd.GetMaxs().fX )
{
hsAssert(bnd.GetMins().fX < 0, "Empty shadow caster bounds?");
@ -180,11 +180,11 @@ bool plShadowSlave::ISetupPerspViewTransform()
proj.fMap[1][1] = cotY * 0.5f;
proj.fMap[1][2] = -0.5f * (1.f + 0.5f/fHeight);
#else
plConst(hsScalar) kBiasScale(1.f);
plConst(hsScalar) kBiasTrans(1.f);
proj.fMap[0][0] = cotX * 0.5f * ( hsScalar(fWidth-2.f) / hsScalar(fWidth) ) * kBiasScale;
plConst(float) kBiasScale(1.f);
plConst(float) kBiasTrans(1.f);
proj.fMap[0][0] = cotX * 0.5f * ( float(fWidth-2.f) / float(fWidth) ) * kBiasScale;
proj.fMap[0][2] = 0.5f * (1.f - kBiasTrans * 0.5f/fWidth);
proj.fMap[1][1] = -cotY * 0.5f * ( hsScalar(fHeight-2.f) / hsScalar(fHeight) ) * kBiasScale;
proj.fMap[1][1] = -cotY * 0.5f * ( float(fHeight-2.f) / float(fHeight) ) * kBiasScale;
proj.fMap[1][2] = 0.5f * (1.f - kBiasTrans * 0.5f/fHeight);
#endif
@ -206,13 +206,13 @@ bool plShadowSlave::ISetupPerspViewTransform()
cotX -= cotX / (fWidth * 0.5f);
cotY -= cotY / (fHeight * 0.5f);
hsScalar tanX = 1.f / cotX;
hsScalar tanY = 1.f / cotY;
float tanX = 1.f / cotX;
float tanY = 1.f / cotY;
fView.SetView(hsPoint3(-tanX, -tanY, minZ), hsPoint3(tanX, tanY, maxZ));
fView.SetScreenSize((UInt16)fWidth, (UInt16)fHeight);
fView.SetScreenSize((uint16_t)fWidth, (uint16_t)fHeight);
fView.SetCameraTransform(fWorldToLight, fLightToWorld);
fView.SetPerspective(true);
fView.SetViewPort(0, 0, hsScalar(fWidth), hsScalar(fHeight), false);
fView.SetViewPort(0, 0, float(fWidth), float(fHeight), false);
fLightPos = fLightToWorld.GetTranslate();
SetFlag(kPositional, true);

View File

@ -56,7 +56,7 @@ class plShadowSlave
{
public:
UInt32 fIndex;
uint32_t fIndex;
hsMatrix44 fWorldToLight;
hsMatrix44 fLightToWorld;
@ -70,22 +70,22 @@ public:
plViewTransform fView;
hsScalar fPower;
hsScalar fBlurScale;
float fPower;
float fBlurScale;
hsBounds3Ext fCasterWorldBounds;
hsBounds3Ext fWorldBounds;
plVolumeIsect* fIsect;
UInt32 fWidth;
UInt32 fHeight;
uint32_t fWidth;
uint32_t fHeight;
hsScalar fAttenDist;
float fAttenDist;
hsScalar fPriority;
float fPriority;
UInt32 fFlags;
uint32_t fFlags;
enum SlaveFlag
{