mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +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:
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plAccMeshSmooth.h"
|
||||
|
||||
#include "plGeometrySpan.h"
|
||||
@ -52,15 +52,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
class EdgeBin
|
||||
{
|
||||
public:
|
||||
UInt16 fVtx;
|
||||
UInt16 fCount;
|
||||
uint16_t fVtx;
|
||||
uint16_t fCount;
|
||||
|
||||
EdgeBin() : fVtx(0), fCount(0) {}
|
||||
};
|
||||
|
||||
void plAccMeshSmooth::FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, hsTArray<UInt16>& edgeVerts)
|
||||
void plAccMeshSmooth::FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray<uint16_t>& edgeVerts)
|
||||
{
|
||||
hsTArray<EdgeBin>* bins = TRACKED_NEW hsTArray<EdgeBin>[maxVtxIdx+1];
|
||||
hsTArray<EdgeBin>* bins = new hsTArray<EdgeBin>[maxVtxIdx+1];
|
||||
|
||||
hsBitVector edgeVertBits;
|
||||
// For each vert pair (edge) in idxList
|
||||
@ -138,7 +138,7 @@ void plAccMeshSmooth::FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList,
|
||||
delete [] bins;
|
||||
}
|
||||
|
||||
void plAccMeshSmooth::FindEdges(hsTArray<plGeometrySpan*>& spans, hsTArray<UInt16>* edgeVerts)
|
||||
void plAccMeshSmooth::FindEdges(hsTArray<plGeometrySpan*>& spans, hsTArray<uint16_t>* edgeVerts)
|
||||
{
|
||||
fSpans.SetCount(spans.GetCount());
|
||||
|
||||
@ -151,9 +151,9 @@ void plAccMeshSmooth::FindEdges(hsTArray<plGeometrySpan*>& spans, hsTArray<UInt1
|
||||
|
||||
plAccessTriSpan& triSpan = fSpans[i].AccessTri();
|
||||
|
||||
UInt32 nTris = triSpan.TriCount();
|
||||
UInt16* idxList = triSpan.fTris;
|
||||
UInt32 maxVertIdx = triSpan.VertCount()-1;
|
||||
uint32_t nTris = triSpan.TriCount();
|
||||
uint16_t* idxList = triSpan.fTris;
|
||||
uint32_t maxVertIdx = triSpan.VertCount()-1;
|
||||
|
||||
FindEdges(maxVertIdx, nTris, idxList, edgeVerts[i]);
|
||||
}
|
||||
@ -161,8 +161,8 @@ void plAccMeshSmooth::FindEdges(hsTArray<plGeometrySpan*>& spans, hsTArray<UInt1
|
||||
|
||||
void plAccMeshSmooth::Smooth(hsTArray<plGeometrySpan*>& spans)
|
||||
{
|
||||
hsTArray<UInt16>* shareVtx = TRACKED_NEW hsTArray<UInt16>[spans.GetCount()];
|
||||
hsTArray<UInt16>* edgeVerts = TRACKED_NEW hsTArray<UInt16>[spans.GetCount()];
|
||||
hsTArray<uint16_t>* shareVtx = new hsTArray<uint16_t>[spans.GetCount()];
|
||||
hsTArray<uint16_t>* edgeVerts = new hsTArray<uint16_t>[spans.GetCount()];
|
||||
FindEdges(spans, edgeVerts);
|
||||
|
||||
int i;
|
||||
@ -278,7 +278,7 @@ hsVector3 plAccMeshSmooth::INormalToLocal(plAccessSpan& span, const hsVector3& w
|
||||
return ret;
|
||||
}
|
||||
|
||||
void plAccMeshSmooth::FindSharedVerts(plAccessSpan& span, int numEdgeVerts, hsTArray<UInt16>& edgeVerts, hsTArray<UInt16>& shareVtx, VtxAccum& accum)
|
||||
void plAccMeshSmooth::FindSharedVerts(plAccessSpan& span, int numEdgeVerts, hsTArray<uint16_t>& edgeVerts, hsTArray<uint16_t>& shareVtx, VtxAccum& accum)
|
||||
{
|
||||
plAccessTriSpan& triSpan = span.AccessTri();
|
||||
int i;
|
||||
@ -311,7 +311,7 @@ void plAccMeshSmooth::FindSharedVerts(plAccessSpan& span, int numEdgeVerts, hsTA
|
||||
}
|
||||
}
|
||||
|
||||
void plAccMeshSmooth::SetPositions(plAccessSpan& span, hsTArray<UInt16>& shareVtx, const hsPoint3& pos) const
|
||||
void plAccMeshSmooth::SetPositions(plAccessSpan& span, hsTArray<uint16_t>& shareVtx, const hsPoint3& pos) const
|
||||
{
|
||||
plAccessTriSpan& triSpan = span.AccessTri();
|
||||
int i;
|
||||
@ -319,7 +319,7 @@ void plAccMeshSmooth::SetPositions(plAccessSpan& span, hsTArray<UInt16>& shareVt
|
||||
triSpan.Position(shareVtx[i]) = IPositionToLocal(span, pos);
|
||||
}
|
||||
|
||||
void plAccMeshSmooth::SetNormals(plAccessSpan& span, hsTArray<UInt16>& shareVtx, const hsVector3& norm) const
|
||||
void plAccMeshSmooth::SetNormals(plAccessSpan& span, hsTArray<uint16_t>& shareVtx, const hsVector3& norm) const
|
||||
{
|
||||
plAccessTriSpan& triSpan = span.AccessTri();
|
||||
int i;
|
||||
@ -327,7 +327,7 @@ void plAccMeshSmooth::SetNormals(plAccessSpan& span, hsTArray<UInt16>& shareVtx,
|
||||
triSpan.Normal(shareVtx[i]) = INormalToLocal(span, norm);
|
||||
}
|
||||
|
||||
void plAccMeshSmooth::SetDiffuse(plAccessSpan& span, hsTArray<UInt16>& shareVtx, const hsColorRGBA& diff) const
|
||||
void plAccMeshSmooth::SetDiffuse(plAccessSpan& span, hsTArray<uint16_t>& shareVtx, const hsColorRGBA& diff) const
|
||||
{
|
||||
plAccessTriSpan& triSpan = span.AccessTri();
|
||||
hsAssert(triSpan.HasDiffuse(), "Calling SetColors on data with no color");
|
||||
@ -336,22 +336,22 @@ void plAccMeshSmooth::SetDiffuse(plAccessSpan& span, hsTArray<UInt16>& shareVtx,
|
||||
triSpan.Diffuse32(shareVtx[i]) = diff.ToARGB32();
|
||||
}
|
||||
|
||||
void plAccMeshSmooth::SetAngle(hsScalar degs)
|
||||
void plAccMeshSmooth::SetAngle(float degs)
|
||||
{
|
||||
fMinNormDot = hsCosine(hsScalarDegToRad(degs));
|
||||
fMinNormDot = cos(hsDegreesToRadians(degs));
|
||||
}
|
||||
|
||||
hsScalar plAccMeshSmooth::GetAngle() const
|
||||
float plAccMeshSmooth::GetAngle() const
|
||||
{
|
||||
return hsScalarRadToDeg(hsACosine(fMinNormDot));
|
||||
return hsRadiansToDegrees(acos(fMinNormDot));
|
||||
}
|
||||
|
||||
void plAccMeshSmooth::SetDistTol(hsScalar dist)
|
||||
void plAccMeshSmooth::SetDistTol(float dist)
|
||||
{
|
||||
fDistTolSq = dist * dist;
|
||||
}
|
||||
|
||||
hsScalar plAccMeshSmooth::GetDistTol() const
|
||||
float plAccMeshSmooth::GetDistTol() const
|
||||
{
|
||||
return hsSquareRoot(fDistTolSq);
|
||||
}
|
||||
return sqrt(fDistTolSq);
|
||||
}
|
||||
|
@ -69,10 +69,10 @@ protected:
|
||||
hsColorRGBA fDiffuse;
|
||||
};
|
||||
|
||||
UInt32 fFlags;
|
||||
uint32_t fFlags;
|
||||
|
||||
hsScalar fMinNormDot;
|
||||
hsScalar fDistTolSq;
|
||||
float fMinNormDot;
|
||||
float fDistTolSq;
|
||||
|
||||
plAccessGeometry fAccGeom;
|
||||
hsTArray<plAccessSpan> fSpans;
|
||||
@ -82,26 +82,26 @@ protected:
|
||||
hsPoint3 IPositionToLocal(plAccessSpan& span, const hsPoint3& wPos) const;
|
||||
hsVector3 INormalToLocal(plAccessSpan& span, const hsVector3& wNorm) const;
|
||||
|
||||
void FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, hsTArray<UInt16>& edgeVerts);
|
||||
void FindEdges(hsTArray<plGeometrySpan*>& sets, hsTArray<UInt16>* edgeVerts);
|
||||
void FindSharedVerts(plAccessSpan& span, int numEdgeVerts, hsTArray<UInt16>& edgeVerts, hsTArray<UInt16>& shareVtx, VtxAccum& accum);
|
||||
void SetNormals(plAccessSpan& span, hsTArray<UInt16>& shareVtx, const hsVector3& norm) const;
|
||||
void SetPositions(plAccessSpan& span, hsTArray<UInt16>& shareVtx, const hsPoint3& pos) const;
|
||||
void SetDiffuse(plAccessSpan& span, hsTArray<UInt16>& shareVtx, const hsColorRGBA& diff) const;
|
||||
void FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray<uint16_t>& edgeVerts);
|
||||
void FindEdges(hsTArray<plGeometrySpan*>& sets, hsTArray<uint16_t>* edgeVerts);
|
||||
void FindSharedVerts(plAccessSpan& span, int numEdgeVerts, hsTArray<uint16_t>& edgeVerts, hsTArray<uint16_t>& shareVtx, VtxAccum& accum);
|
||||
void SetNormals(plAccessSpan& span, hsTArray<uint16_t>& shareVtx, const hsVector3& norm) const;
|
||||
void SetPositions(plAccessSpan& span, hsTArray<uint16_t>& shareVtx, const hsPoint3& pos) const;
|
||||
void SetDiffuse(plAccessSpan& span, hsTArray<uint16_t>& shareVtx, const hsColorRGBA& diff) const;
|
||||
|
||||
public:
|
||||
plAccMeshSmooth() : fFlags(kSmoothNorm), fMinNormDot(0.25f), fDistTolSq(1.e-4f), fAccGeom() {}
|
||||
|
||||
void SetAngle(hsScalar degs);
|
||||
hsScalar GetAngle() const; // returns degrees
|
||||
void SetAngle(float degs);
|
||||
float GetAngle() const; // returns degrees
|
||||
|
||||
void SetDistTol(hsScalar dist);
|
||||
hsScalar GetDistTol() const;
|
||||
void SetDistTol(float dist);
|
||||
float GetDistTol() const;
|
||||
|
||||
void Smooth(hsTArray<plGeometrySpan*>& sets);
|
||||
|
||||
void SetFlags(UInt32 f) { fFlags = f; }
|
||||
UInt32 GetFlags() const { return fFlags; }
|
||||
void SetFlags(uint32_t f) { fFlags = f; }
|
||||
uint32_t GetFlags() const { return fFlags; }
|
||||
};
|
||||
|
||||
#endif // plAccMeshSmooth_inc
|
||||
|
@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
*==LICENSE==*/
|
||||
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include "plAccessGeometry.h"
|
||||
|
||||
@ -104,7 +104,7 @@ void plAccessGeometry::Init(plPipeline* pipe)
|
||||
{
|
||||
plAccessGeometry* oldAcc = fInstance;
|
||||
|
||||
fInstance = NEW(plAccessGeometry)(pipe);
|
||||
fInstance = new plAccessGeometry(pipe);
|
||||
|
||||
hsRefCnt_SafeUnRef(oldAcc);
|
||||
}
|
||||
@ -194,7 +194,7 @@ void plAccessGeometry::Close(hsTArray<plAccessSpan>& accs) const
|
||||
Close(accs[i]);
|
||||
}
|
||||
|
||||
void plAccessGeometry::TakeSnapShot(const plDrawInterface* di, UInt32 channels) const
|
||||
void plAccessGeometry::TakeSnapShot(const plDrawInterface* di, uint32_t channels) const
|
||||
{
|
||||
int j;
|
||||
for( j = 0; j < di->GetNumDrawables(); j++ )
|
||||
@ -216,7 +216,7 @@ void plAccessGeometry::TakeSnapShot(const plDrawInterface* di, UInt32 channels)
|
||||
}
|
||||
}
|
||||
|
||||
void plAccessGeometry::RestoreSnapShot(const plDrawInterface* di, UInt32 channels) const
|
||||
void plAccessGeometry::RestoreSnapShot(const plDrawInterface* di, uint32_t channels) const
|
||||
{
|
||||
int j;
|
||||
for( j = 0; j < di->GetNumDrawables(); j++ )
|
||||
@ -271,7 +271,7 @@ void plAccessGeometry::Close(plAccessSpan& acc) const
|
||||
fPipe->CloseAccess(acc);
|
||||
}
|
||||
|
||||
void plAccessGeometry::IOpen(plDrawable* d, UInt32 spanIdx, plAccessSpan& acc, hsBool useSnap, hsBool readOnly, hsBool idxToo) const
|
||||
void plAccessGeometry::IOpen(plDrawable* d, uint32_t spanIdx, plAccessSpan& acc, hsBool useSnap, hsBool readOnly, hsBool idxToo) const
|
||||
{
|
||||
acc.SetType(plAccessSpan::kUndefined);
|
||||
|
||||
@ -304,12 +304,12 @@ void plAccessGeometry::IOpen(plDrawable* d, UInt32 spanIdx, plAccessSpan& acc, h
|
||||
}
|
||||
}
|
||||
|
||||
void plAccessGeometry::OpenRO(plDrawable* d, UInt32 spanIdx, plAccessSpan& acc, hsBool useSnap) const
|
||||
void plAccessGeometry::OpenRO(plDrawable* d, uint32_t spanIdx, plAccessSpan& acc, hsBool useSnap) const
|
||||
{
|
||||
IOpen(d, spanIdx, acc, useSnap, true);
|
||||
}
|
||||
|
||||
void plAccessGeometry::OpenRW(plDrawable* drawable, UInt32 spanIdx, plAccessSpan& acc, hsBool idxToo) const
|
||||
void plAccessGeometry::OpenRW(plDrawable* drawable, uint32_t spanIdx, plAccessSpan& acc, hsBool idxToo) const
|
||||
{
|
||||
IOpen(drawable, spanIdx, acc, false, false, idxToo);
|
||||
|
||||
@ -318,7 +318,7 @@ void plAccessGeometry::OpenRW(plDrawable* drawable, UInt32 spanIdx, plAccessSpan
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void plAccessGeometry::TakeSnapShot(plDrawable* drawable, UInt32 spanIdx, UInt32 channels) const
|
||||
void plAccessGeometry::TakeSnapShot(plDrawable* drawable, uint32_t spanIdx, uint32_t channels) const
|
||||
{
|
||||
plDrawableSpans* ds = plDrawableSpans::ConvertNoRef(drawable);
|
||||
if( !ds )
|
||||
@ -326,7 +326,7 @@ void plAccessGeometry::TakeSnapShot(plDrawable* drawable, UInt32 spanIdx, UInt32
|
||||
const plSpan* span = ds->GetSpan(spanIdx);
|
||||
|
||||
if( !span->fSnapShot )
|
||||
span->fSnapShot = NEW(plAccessSnapShot);
|
||||
span->fSnapShot = new plAccessSnapShot;
|
||||
|
||||
plAccessSpan tmp;
|
||||
OpenRO(drawable, spanIdx, tmp, false);
|
||||
@ -338,7 +338,7 @@ void plAccessGeometry::TakeSnapShot(plDrawable* drawable, UInt32 spanIdx, UInt32
|
||||
}
|
||||
}
|
||||
|
||||
void plAccessGeometry::RestoreSnapShot(plDrawable* drawable, UInt32 spanIdx, UInt32 channels) const
|
||||
void plAccessGeometry::RestoreSnapShot(plDrawable* drawable, uint32_t spanIdx, uint32_t channels) const
|
||||
{
|
||||
plDrawableSpans* ds = plDrawableSpans::ConvertNoRef(drawable);
|
||||
if( !ds )
|
||||
@ -355,7 +355,7 @@ void plAccessGeometry::RestoreSnapShot(plDrawable* drawable, UInt32 spanIdx, UIn
|
||||
span->fSnapShot->CopyTo(tmp.AccessVtx(), channels);
|
||||
}
|
||||
|
||||
void plAccessGeometry::ReleaseSnapShot(plDrawable* drawable, UInt32 spanIdx) const
|
||||
void plAccessGeometry::ReleaseSnapShot(plDrawable* drawable, uint32_t spanIdx) const
|
||||
{
|
||||
plDrawableSpans* ds = plDrawableSpans::ConvertNoRef(drawable);
|
||||
if( !ds )
|
||||
@ -384,16 +384,16 @@ void plAccessGeometry::IAccessSpanFromSourceSpan(plAccessSpan& dst, const plGeom
|
||||
dst.SetMaterial(src->fMaterial);
|
||||
|
||||
plAccessVtxSpan& acc = dst.AccessVtx();
|
||||
acc.fNumVerts = (UInt16)(src->fNumVerts);
|
||||
UInt32 sz = src->GetVertexSize(src->fFormat);
|
||||
UInt8* ptr = src->fVertexData;
|
||||
acc.PositionStream(ptr, (UInt16)sz, 0);
|
||||
acc.fNumVerts = (uint16_t)(src->fNumVerts);
|
||||
uint32_t sz = src->GetVertexSize(src->fFormat);
|
||||
uint8_t* ptr = src->fVertexData;
|
||||
acc.PositionStream(ptr, (uint16_t)sz, 0);
|
||||
ptr += sizeof(hsPoint3);
|
||||
acc.NormalStream(ptr, (UInt16)sz, 0);
|
||||
acc.NormalStream(ptr, (uint16_t)sz, 0);
|
||||
ptr += sizeof(hsVector3);
|
||||
acc.DiffuseStream(src->fDiffuseRGBA, sizeof(UInt32), 0);
|
||||
acc.SpecularStream(src->fSpecularRGBA, sizeof(UInt32), 0);
|
||||
acc.UVWStream(ptr, (UInt16)sz, 0);
|
||||
acc.DiffuseStream(src->fDiffuseRGBA, sizeof(uint32_t), 0);
|
||||
acc.SpecularStream(src->fSpecularRGBA, sizeof(uint32_t), 0);
|
||||
acc.UVWStream(ptr, (uint16_t)sz, 0);
|
||||
acc.SetNumUVWs(src->CalcNumUVs(src->fFormat));
|
||||
|
||||
acc.fVtxDeviceRef = nil;
|
||||
@ -446,33 +446,33 @@ void plAccessGeometry::IAccessSpanFromVertexSpan(plAccessSpan& dst, plDrawableSp
|
||||
return;
|
||||
}
|
||||
|
||||
acc.fNumVerts = (UInt16)(span->fVLength);
|
||||
acc.fNumVerts = (uint16_t)(span->fVLength);
|
||||
|
||||
plGBufferCell* cell = grp->GetCell(span->fVBufferIdx, span->fCellIdx);
|
||||
|
||||
UInt8* ptr = grp->GetVertBufferData(span->fVBufferIdx);
|
||||
uint8_t* ptr = grp->GetVertBufferData(span->fVBufferIdx);
|
||||
|
||||
// Interleaved
|
||||
if( cell->fColorStart == UInt32(-1) )
|
||||
if( cell->fColorStart == uint32_t(-1) )
|
||||
{
|
||||
UInt32 stride = grp->GetVertexSize();
|
||||
uint32_t stride = grp->GetVertexSize();
|
||||
|
||||
ptr += cell->fVtxStart + span->fCellOffset * stride;
|
||||
Int32 offset = (-(Int32)(span->fVStartIdx)) * (Int32)stride;
|
||||
int32_t offset = (-(int32_t)(span->fVStartIdx)) * (int32_t)stride;
|
||||
|
||||
acc.PositionStream(ptr, (UInt16)stride, offset);
|
||||
acc.PositionStream(ptr, (uint16_t)stride, offset);
|
||||
ptr += sizeof(hsPoint3);
|
||||
|
||||
int numWgts = grp->GetNumWeights();
|
||||
if( numWgts )
|
||||
{
|
||||
acc.SetNumWeights(numWgts);
|
||||
acc.WeightStream(ptr, (UInt16)stride, offset);
|
||||
ptr += numWgts * sizeof(hsScalar);
|
||||
acc.WeightStream(ptr, (uint16_t)stride, offset);
|
||||
ptr += numWgts * sizeof(float);
|
||||
if( grp->GetVertexFormat() & plGBufferGroup::kSkinIndices )
|
||||
{
|
||||
acc.WgtIndexStream(ptr, (UInt16)stride, offset);
|
||||
ptr += sizeof(UInt32);
|
||||
acc.WgtIndexStream(ptr, (uint16_t)stride, offset);
|
||||
ptr += sizeof(uint32_t);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -484,40 +484,40 @@ void plAccessGeometry::IAccessSpanFromVertexSpan(plAccessSpan& dst, plDrawableSp
|
||||
acc.SetNumWeights(0);
|
||||
}
|
||||
|
||||
acc.NormalStream(ptr, (UInt16)stride, offset);
|
||||
acc.NormalStream(ptr, (uint16_t)stride, offset);
|
||||
ptr += sizeof(hsVector3);
|
||||
|
||||
acc.DiffuseStream(ptr, (UInt16)stride, offset);
|
||||
ptr += sizeof(UInt32);
|
||||
acc.DiffuseStream(ptr, (uint16_t)stride, offset);
|
||||
ptr += sizeof(uint32_t);
|
||||
|
||||
acc.SpecularStream(ptr, (UInt16)stride, offset);
|
||||
ptr += sizeof(UInt32);
|
||||
acc.SpecularStream(ptr, (uint16_t)stride, offset);
|
||||
ptr += sizeof(uint32_t);
|
||||
|
||||
acc.UVWStream(ptr, (UInt16)stride, offset);
|
||||
acc.UVWStream(ptr, (uint16_t)stride, offset);
|
||||
|
||||
acc.SetNumUVWs(grp->GetNumUVs());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32 stride = grp->GetVertexLiteStride();
|
||||
uint32_t stride = grp->GetVertexLiteStride();
|
||||
|
||||
ptr += cell->fVtxStart + span->fCellOffset * stride;
|
||||
Int32 posOffset = (-(Int32)(span->fVStartIdx)) * (Int32)stride;
|
||||
int32_t posOffset = (-(int32_t)(span->fVStartIdx)) * (int32_t)stride;
|
||||
|
||||
acc.PositionStream(ptr, (UInt16)stride, posOffset);
|
||||
acc.PositionStream(ptr, (uint16_t)stride, posOffset);
|
||||
ptr += sizeof(hsPoint3);
|
||||
|
||||
int numWgts = grp->GetNumWeights();
|
||||
if( numWgts )
|
||||
{
|
||||
acc.SetNumWeights(numWgts);
|
||||
acc.WeightStream(ptr, (UInt16)stride, posOffset);
|
||||
ptr += numWgts * sizeof(hsScalar);
|
||||
acc.WeightStream(ptr, (uint16_t)stride, posOffset);
|
||||
ptr += numWgts * sizeof(float);
|
||||
if( grp->GetVertexFormat() & plGBufferGroup::kSkinIndices )
|
||||
{
|
||||
acc.WgtIndexStream(ptr, (UInt16)stride, posOffset);
|
||||
ptr += sizeof(UInt32);
|
||||
acc.WgtIndexStream(ptr, (uint16_t)stride, posOffset);
|
||||
ptr += sizeof(uint32_t);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -529,19 +529,19 @@ void plAccessGeometry::IAccessSpanFromVertexSpan(plAccessSpan& dst, plDrawableSp
|
||||
acc.SetNumWeights(0);
|
||||
}
|
||||
|
||||
acc.NormalStream(ptr, (UInt16)stride, posOffset);
|
||||
acc.NormalStream(ptr, (uint16_t)stride, posOffset);
|
||||
ptr += sizeof(hsVector3);
|
||||
|
||||
plGBufferColor* col = grp->GetColorBufferData(span->fVBufferIdx) + cell->fColorStart;
|
||||
|
||||
Int16 colOffset = (Int16)((-(Int32)(span->fVStartIdx)) * (Int32)stride);
|
||||
colOffset = (Int16)((-(Int32)(span->fVStartIdx)) * sizeof(*col));
|
||||
int16_t colOffset = (int16_t)((-(int32_t)(span->fVStartIdx)) * (int32_t)stride);
|
||||
colOffset = (int16_t)((-(int32_t)(span->fVStartIdx)) * sizeof(*col));
|
||||
|
||||
acc.DiffuseStream(&col->fDiffuse, sizeof(*col), colOffset);
|
||||
|
||||
acc.SpecularStream(&col->fSpecular, sizeof(*col), colOffset);
|
||||
|
||||
acc.UVWStream(ptr, (UInt16)stride, posOffset);
|
||||
acc.UVWStream(ptr, (uint16_t)stride, posOffset);
|
||||
|
||||
acc.SetNumUVWs(grp->GetNumUVs());
|
||||
}
|
||||
|
@ -108,8 +108,8 @@ public:
|
||||
// then take the snapshot if you are going to be performing more modifications.
|
||||
// In ALL MODIFICATION CASES, if the modified data is paged out, and the original paged back in, you will
|
||||
// need to perform your operation again - your modifications aren't saved anywhere.
|
||||
void OpenRO(plDrawable* drawable, UInt32 spanIdx, plAccessSpan& acc, hsBool useSnapShot=true) const;
|
||||
void OpenRW(plDrawable* drawable, UInt32 spanIdx, plAccessSpan& acc, hsBool idxToo=false) const;
|
||||
void OpenRO(plDrawable* drawable, uint32_t spanIdx, plAccessSpan& acc, hsBool useSnapShot=true) const;
|
||||
void OpenRW(plDrawable* drawable, uint32_t spanIdx, plAccessSpan& acc, hsBool idxToo=false) const;
|
||||
|
||||
// What do we need to close up here?
|
||||
void Close(plAccessSpan& acc) const;
|
||||
@ -147,12 +147,12 @@ public:
|
||||
// the state when the snapshot was taken. Note that channels not SnapShotted might have been modified
|
||||
// via OpenRW.
|
||||
//
|
||||
void TakeSnapShot(plDrawable* drawable, UInt32 spanIdx, UInt32 channels) const;
|
||||
void RestoreSnapShot(plDrawable* drawable, UInt32 spanIdx, UInt32 channels) const;
|
||||
void ReleaseSnapShot(plDrawable* drawable, UInt32 spanIdx) const;
|
||||
void TakeSnapShot(plDrawable* drawable, uint32_t spanIdx, uint32_t channels) const;
|
||||
void RestoreSnapShot(plDrawable* drawable, uint32_t spanIdx, uint32_t channels) const;
|
||||
void ReleaseSnapShot(plDrawable* drawable, uint32_t spanIdx) const;
|
||||
|
||||
void TakeSnapShot(const plDrawInterface* di, UInt32 channels) const;
|
||||
void RestoreSnapShot(const plDrawInterface* di, UInt32 channels) const;
|
||||
void TakeSnapShot(const plDrawInterface* di, uint32_t channels) const;
|
||||
void RestoreSnapShot(const plDrawInterface* di, uint32_t channels) const;
|
||||
void ReleaseSnapShot(const plDrawInterface* di) const;
|
||||
|
||||
// We often have geometry spans just sitting around devoid of any DI's, drawables or sceneobjects.
|
||||
@ -169,7 +169,7 @@ protected:
|
||||
void IAccessSpanFromParticle(plAccessSpan& dst, plDrawableSpans* drawable, const plParticleSpan* span, hsBool readOnly) const;
|
||||
void IAccessSpanFromSnap(plAccessSpan& dst, plDrawableSpans* drawable, const plSpan* src) const;
|
||||
|
||||
void IOpen(plDrawable* d, UInt32 spanIdx, plAccessSpan& acc, hsBool useSnap, hsBool readOnly, hsBool idxToo=true) const;
|
||||
void IOpen(plDrawable* d, uint32_t spanIdx, plAccessSpan& acc, hsBool useSnap, hsBool readOnly, hsBool idxToo=true) const;
|
||||
};
|
||||
|
||||
#endif // plAccessGeometry_inc
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plAccessSnapShot.h"
|
||||
|
||||
#include "hsGeometry3.h"
|
||||
@ -74,7 +74,7 @@ void plAccessSnapShot::Release()
|
||||
}
|
||||
}
|
||||
|
||||
UInt32 plAccessSnapShot::ICheckAlloc(const plAccessVtxSpan& src, UInt32 chanMask, UInt32 chan, UInt16 chanSize)
|
||||
uint32_t plAccessSnapShot::ICheckAlloc(const plAccessVtxSpan& src, uint32_t chanMask, uint32_t chan, uint16_t chanSize)
|
||||
{
|
||||
if( ((1 << chan) & chanMask) && src.fStrides[chan] )
|
||||
{
|
||||
@ -98,16 +98,16 @@ UInt32 plAccessSnapShot::ICheckAlloc(const plAccessVtxSpan& src, UInt32 chanMask
|
||||
return chanMask;
|
||||
}
|
||||
|
||||
void plAccessSnapShot::IRecordSizes(UInt16 sizes[]) const
|
||||
void plAccessSnapShot::IRecordSizes(uint16_t sizes[]) const
|
||||
{
|
||||
int chan;
|
||||
for( chan = 0; chan < kNumValidChans; chan++ )
|
||||
sizes[chan] = fChanSize[chan];
|
||||
}
|
||||
|
||||
UInt16 plAccessSnapShot::IComputeStride() const
|
||||
uint16_t plAccessSnapShot::IComputeStride() const
|
||||
{
|
||||
UInt16 stride = 0;
|
||||
uint16_t stride = 0;
|
||||
int chan;
|
||||
for( chan = 0; chan < kNumValidChans; chan++ )
|
||||
stride += fChanSize[chan];
|
||||
@ -115,12 +115,12 @@ UInt16 plAccessSnapShot::IComputeStride() const
|
||||
return stride;
|
||||
}
|
||||
|
||||
void plAccessSnapShot::ICopyOldData(UInt8* data, const UInt16* const oldSizes, UInt16 oldStride, UInt16 newStride)
|
||||
void plAccessSnapShot::ICopyOldData(uint8_t* data, const uint16_t* const oldSizes, uint16_t oldStride, uint16_t newStride)
|
||||
{
|
||||
UInt32 oldOffset = 0;
|
||||
UInt32 newOffset = 0;
|
||||
UInt8* srcChannels[kNumValidChans];
|
||||
UInt8* dstChannels[kNumValidChans];
|
||||
uint32_t oldOffset = 0;
|
||||
uint32_t newOffset = 0;
|
||||
uint8_t* srcChannels[kNumValidChans];
|
||||
uint8_t* dstChannels[kNumValidChans];
|
||||
int chan;
|
||||
for( chan = 0; chan < kNumValidChans; chan++ )
|
||||
{
|
||||
@ -152,9 +152,9 @@ void plAccessSnapShot::ICopyOldData(UInt8* data, const UInt16* const oldSizes, U
|
||||
}
|
||||
}
|
||||
|
||||
void plAccessSnapShot::ISetupPointers(UInt16 newStride)
|
||||
void plAccessSnapShot::ISetupPointers(uint16_t newStride)
|
||||
{
|
||||
fData = TRACKED_NEW UInt8[fNumVerts * newStride];
|
||||
fData = new uint8_t[fNumVerts * newStride];
|
||||
|
||||
int size = 0;
|
||||
int chan;
|
||||
@ -169,33 +169,33 @@ void plAccessSnapShot::ISetupPointers(UInt16 newStride)
|
||||
}
|
||||
}
|
||||
|
||||
UInt32 plAccessSnapShot::CopyFrom(const plAccessVtxSpan& src, UInt32 chanMask)
|
||||
uint32_t plAccessSnapShot::CopyFrom(const plAccessVtxSpan& src, uint32_t chanMask)
|
||||
{
|
||||
hsAssert(!fNumVerts || (fNumVerts == src.fNumVerts), "Copying from a different sized span");
|
||||
|
||||
fNumVerts = src.fNumVerts;
|
||||
|
||||
UInt16 oldSize[kNumValidChans];
|
||||
UInt8* oldData = fData;
|
||||
uint16_t oldSize[kNumValidChans];
|
||||
uint8_t* oldData = fData;
|
||||
IRecordSizes(oldSize);
|
||||
|
||||
UInt16 oldStride = IComputeStride();
|
||||
uint16_t oldStride = IComputeStride();
|
||||
|
||||
// First, allocate any storage we need. Kill any requested channels out of the
|
||||
// mask that we already have.
|
||||
chanMask = ICheckAlloc(src, chanMask, kPosition, sizeof(hsPoint3));
|
||||
|
||||
chanMask = ICheckAlloc(src, chanMask, kWeight, sizeof(hsScalar) * src.fNumWeights);
|
||||
chanMask = ICheckAlloc(src, chanMask, kWeight, sizeof(float) * src.fNumWeights);
|
||||
if( fChanSize[kWeight] )
|
||||
fNumWeights = src.fNumWeights;
|
||||
|
||||
chanMask = ICheckAlloc(src, chanMask, kWgtIndex, sizeof(UInt32));
|
||||
chanMask = ICheckAlloc(src, chanMask, kWgtIndex, sizeof(uint32_t));
|
||||
|
||||
chanMask = ICheckAlloc(src, chanMask, kNormal, sizeof(hsVector3));
|
||||
|
||||
chanMask = ICheckAlloc(src, chanMask, kDiffuse, sizeof(UInt32));
|
||||
chanMask = ICheckAlloc(src, chanMask, kDiffuse, sizeof(uint32_t));
|
||||
|
||||
chanMask = ICheckAlloc(src, chanMask, kSpecular, sizeof(UInt32));
|
||||
chanMask = ICheckAlloc(src, chanMask, kSpecular, sizeof(uint32_t));
|
||||
|
||||
chanMask = ICheckAlloc(src, chanMask, kUVW, sizeof(hsPoint3) * src.fNumUVWsPerVert);
|
||||
if( fChanSize[kUVW] )
|
||||
@ -206,14 +206,14 @@ UInt32 plAccessSnapShot::CopyFrom(const plAccessVtxSpan& src, UInt32 chanMask)
|
||||
if( !chanMask )
|
||||
return 0;
|
||||
|
||||
UInt16 newStride = IComputeStride();
|
||||
uint16_t newStride = IComputeStride();
|
||||
|
||||
ISetupPointers(newStride);
|
||||
|
||||
ICopyOldData(oldData, oldSize, oldStride, newStride);
|
||||
|
||||
UInt8* srcChannels[kNumValidChans];
|
||||
UInt8* dstChannels[kNumValidChans];
|
||||
uint8_t* srcChannels[kNumValidChans];
|
||||
uint8_t* dstChannels[kNumValidChans];
|
||||
int chan;
|
||||
for( chan = 0; chan < kNumValidChans; chan++ )
|
||||
{
|
||||
@ -238,7 +238,7 @@ UInt32 plAccessSnapShot::CopyFrom(const plAccessVtxSpan& src, UInt32 chanMask)
|
||||
return chanMask;
|
||||
}
|
||||
|
||||
UInt32 plAccessSnapShot::CopyTo(const plAccessVtxSpan& dst, UInt32 chanMask)
|
||||
uint32_t plAccessSnapShot::CopyTo(const plAccessVtxSpan& dst, uint32_t chanMask)
|
||||
{
|
||||
hsAssert(fNumVerts == dst.fNumVerts, "Vertex count mismatch, is this our real source?");
|
||||
|
||||
|
@ -55,23 +55,23 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
UInt16 fRefCnt;
|
||||
uint16_t fRefCnt;
|
||||
|
||||
UInt8* fData;
|
||||
uint8_t* fData;
|
||||
|
||||
UInt16 fChanSize[kNumValidChans];
|
||||
uint16_t fChanSize[kNumValidChans];
|
||||
|
||||
void ICopyOldData(UInt8* data, const UInt16* const oldSizes, UInt16 oldStride, UInt16 newStride);
|
||||
UInt16 IComputeStride() const;
|
||||
void IRecordSizes(UInt16 sizes[]) const;
|
||||
UInt32 ICheckAlloc(const plAccessVtxSpan& src, UInt32 chanMask, UInt32 chan, UInt16 chanSize);
|
||||
void ICopyOldData(uint8_t* data, const uint16_t* const oldSizes, uint16_t oldStride, uint16_t newStride);
|
||||
uint16_t IComputeStride() const;
|
||||
void IRecordSizes(uint16_t sizes[]) const;
|
||||
uint32_t ICheckAlloc(const plAccessVtxSpan& src, uint32_t chanMask, uint32_t chan, uint16_t chanSize);
|
||||
|
||||
void ISetupPointers(UInt16 newStride);
|
||||
void ISetupPointers(uint16_t newStride);
|
||||
|
||||
void SetupChannels(plAccessVtxSpan& dst) const;
|
||||
|
||||
UInt32 CopyTo(const plAccessVtxSpan& dst, UInt32 chanMask);
|
||||
UInt32 CopyFrom(const plAccessVtxSpan& src, UInt32 chanMask);
|
||||
uint32_t CopyTo(const plAccessVtxSpan& dst, uint32_t chanMask);
|
||||
uint32_t CopyFrom(const plAccessVtxSpan& src, uint32_t chanMask);
|
||||
void Release(); // Decrements refcnt, calls Destroy on zero
|
||||
void Clear(); // Initialize to zeros
|
||||
|
||||
|
@ -80,7 +80,7 @@ private:
|
||||
hsBounds3Ext* fLocalBounds;
|
||||
hsBounds3Ext* fWorldBounds;
|
||||
|
||||
hsScalar* fWaterHeight;
|
||||
float* fWaterHeight;
|
||||
|
||||
hsGMaterial* fMaterial;
|
||||
|
||||
@ -119,7 +119,7 @@ public:
|
||||
void SetWorldBounds(const hsBounds3Ext& wBnd) { *fWorldBounds = wBnd; }
|
||||
|
||||
hsBool HasWaterHeight() const { return nil != fWaterHeight; }
|
||||
hsScalar GetWaterHeight() const { hsAssert(HasWaterHeight(), "Check before asking"); return *fWaterHeight; }
|
||||
float GetWaterHeight() const { hsAssert(HasWaterHeight(), "Check before asking"); return *fWaterHeight; }
|
||||
};
|
||||
|
||||
inline plAccessVtxSpan& plAccessSpan::AccessVtx()
|
||||
|
@ -50,13 +50,13 @@ class plAccessTriSpan : public plAccessVtxSpan
|
||||
public:
|
||||
hsGDeviceRef* fIdxDeviceRef;
|
||||
|
||||
UInt16* fTris; // array length fNumTris*3
|
||||
uint16_t* fTris; // array length fNumTris*3
|
||||
|
||||
UInt32 fNumTris;
|
||||
uint32_t fNumTris;
|
||||
|
||||
void ClearTris() { fTris = nil; fNumTris = 0; }
|
||||
|
||||
UInt32 TriCount() const { return fNumTris; }
|
||||
uint32_t TriCount() const { return fNumTris; }
|
||||
|
||||
void SetIdxDeviceRef(hsGDeviceRef* ref) { fIdxDeviceRef = ref; }
|
||||
hsGDeviceRef* GetIdxDeviceRef() const { return fIdxDeviceRef; }
|
||||
@ -66,8 +66,8 @@ class plAccTriIterator
|
||||
{
|
||||
protected:
|
||||
|
||||
UInt16* fCurrIdx;
|
||||
UInt16* fEndIdx;
|
||||
uint16_t* fCurrIdx;
|
||||
uint16_t* fEndIdx;
|
||||
|
||||
plAccessTriSpan* fAccess;
|
||||
public:
|
||||
@ -81,14 +81,14 @@ public:
|
||||
void SetTri(int i);
|
||||
hsBool More() const;
|
||||
|
||||
UInt32 NumTris() const { return fAccess->fNumTris; }
|
||||
uint32_t NumTris() const { return fAccess->fNumTris; }
|
||||
|
||||
UInt16& RawIndex(int iVtx) const { return fCurrIdx[iVtx]; }
|
||||
uint16_t& RawIndex(int iVtx) const { return fCurrIdx[iVtx]; }
|
||||
|
||||
hsPoint3& Position(int iVtx) const { return fAccess->PositionOff(fCurrIdx[iVtx]); }
|
||||
hsVector3& Normal(int iVtx) const { return fAccess->NormalOff(fCurrIdx[iVtx]); }
|
||||
UInt32 Diffuse32(int iVtx) const { return fAccess->Diffuse32Off(fCurrIdx[iVtx]); }
|
||||
UInt32 Specular32(int iVtx) const { return fAccess->Specular32Off(fCurrIdx[iVtx]); }
|
||||
uint32_t Diffuse32(int iVtx) const { return fAccess->Diffuse32Off(fCurrIdx[iVtx]); }
|
||||
uint32_t Specular32(int iVtx) const { return fAccess->Specular32Off(fCurrIdx[iVtx]); }
|
||||
hsColorRGBA DiffuseRGBA(int iVtx) const { return fAccess->DiffuseRGBAOff(fCurrIdx[iVtx]); }
|
||||
hsColorRGBA SpecularRGBA(int iVtx) const { return fAccess->SpecularRGBAOff(fCurrIdx[iVtx]); }
|
||||
hsPoint3* UVWs(int iVtx) const { return fAccess->UVWsOff(fCurrIdx[iVtx]); }
|
||||
@ -96,8 +96,8 @@ public:
|
||||
|
||||
hsPoint3 InterpPosition(const hsPoint3& bary) const;
|
||||
hsVector3 InterpNormal(const hsPoint3& bary) const;
|
||||
UInt32 InterpDiffuse32(const hsPoint3& bary) const;
|
||||
UInt32 InterpSpecular32(const hsPoint3& bary) const;
|
||||
uint32_t InterpDiffuse32(const hsPoint3& bary) const;
|
||||
uint32_t InterpSpecular32(const hsPoint3& bary) const;
|
||||
hsColorRGBA InterpDiffuseRGBA(const hsPoint3& bary) const;
|
||||
hsColorRGBA InterpSpecularRGBA(const hsPoint3& bary) const;
|
||||
hsPoint3 InterpUVW(const hsPoint3& bary, int i) const;
|
||||
@ -154,12 +154,12 @@ inline hsColorRGBA plAccTriIterator::InterpSpecularRGBA(const hsPoint3& bary) co
|
||||
+ SpecularRGBA(2) * bary[2];
|
||||
}
|
||||
|
||||
inline UInt32 plAccTriIterator::InterpDiffuse32(const hsPoint3& bary) const
|
||||
inline uint32_t plAccTriIterator::InterpDiffuse32(const hsPoint3& bary) const
|
||||
{
|
||||
return InterpDiffuseRGBA(bary).ToARGB32();
|
||||
}
|
||||
|
||||
inline UInt32 plAccTriIterator::InterpSpecular32(const hsPoint3& bary) const
|
||||
inline uint32_t plAccTriIterator::InterpSpecular32(const hsPoint3& bary) const
|
||||
{
|
||||
return InterpSpecularRGBA(bary).ToARGB32();
|
||||
}
|
||||
|
@ -102,18 +102,18 @@ public:
|
||||
|
||||
hsGDeviceRef* fVtxDeviceRef;
|
||||
|
||||
UInt8* fChannels[kNumValidChans];
|
||||
UInt16 fStrides[kNumValidChans];
|
||||
Int32 fOffsets[kNumValidChans];
|
||||
uint8_t* fChannels[kNumValidChans];
|
||||
uint16_t fStrides[kNumValidChans];
|
||||
int32_t fOffsets[kNumValidChans];
|
||||
|
||||
UInt16 fNumWeights;
|
||||
UInt16 fNumUVWsPerVert;
|
||||
UInt16 fNumVerts;
|
||||
uint16_t fNumWeights;
|
||||
uint16_t fNumUVWsPerVert;
|
||||
uint16_t fNumVerts;
|
||||
|
||||
//////////////////////////////////
|
||||
// QUERY SECTION
|
||||
// Queries on how much of what we got.
|
||||
UInt32 VertCount() const { return fNumVerts; }
|
||||
uint32_t VertCount() const { return fNumVerts; }
|
||||
hsBool HasChannel(Channel chan) const { return fStrides[chan] > 0; }
|
||||
hsBool HasPositions() const { return HasChannel(kPosition); }
|
||||
hsBool HasWeights() const { return HasChannel(kWeight); }
|
||||
@ -131,13 +131,13 @@ public:
|
||||
hsPoint3& Position(int i) const { return *(hsPoint3*)(fChannels[kPosition] + i*fStrides[kPosition]); }
|
||||
hsVector3& Normal(int i) const { return *(hsVector3*)(fChannels[kNormal] + i*fStrides[kNormal]); }
|
||||
|
||||
hsScalar& Weight(int iVtx, int iWgt) const { return *(hsScalar*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + iWgt*sizeof(hsScalar)); }
|
||||
hsScalar* Weights(int i) const { return (hsScalar*)(fChannels[kWeight] + i*fStrides[kWeight]); }
|
||||
UInt32& WgtIndices(int i) const { return *(UInt32*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex]); }
|
||||
UInt8& WgtIndex(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + iWgt); }
|
||||
float& Weight(int iVtx, int iWgt) const { return *(float*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + iWgt*sizeof(float)); }
|
||||
float* Weights(int i) const { return (float*)(fChannels[kWeight] + i*fStrides[kWeight]); }
|
||||
uint32_t& WgtIndices(int i) const { return *(uint32_t*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex]); }
|
||||
uint8_t& WgtIndex(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + iWgt); }
|
||||
|
||||
UInt32& Diffuse32(int i) const { return *(UInt32*)(fChannels[kDiffuse] + i*fStrides[kDiffuse]); }
|
||||
UInt32& Specular32(int i) const { return *(UInt32*)(fChannels[kSpecular] + i*fStrides[kSpecular]); }
|
||||
uint32_t& Diffuse32(int i) const { return *(uint32_t*)(fChannels[kDiffuse] + i*fStrides[kDiffuse]); }
|
||||
uint32_t& Specular32(int i) const { return *(uint32_t*)(fChannels[kSpecular] + i*fStrides[kSpecular]); }
|
||||
|
||||
hsColorRGBA DiffuseRGBA(int i) const { return hsColorRGBA().FromARGB32(Diffuse32(i)); }
|
||||
hsColorRGBA SpecularRGBA(int i) const { return hsColorRGBA().FromARGB32(Specular32(i)); }
|
||||
@ -153,13 +153,13 @@ public:
|
||||
hsPoint3& PositionOff(int i) const { return *(hsPoint3*)(fChannels[kPosition] + i*fStrides[kPosition] + fOffsets[kPosition]); }
|
||||
hsVector3& NormalOff(int i) const { return *(hsVector3*)(fChannels[kNormal] + i*fStrides[kNormal] + fOffsets[kNormal]); }
|
||||
|
||||
hsScalar& WeightOff(int iVtx, int iWgt) const { return *(hsScalar*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + fOffsets[kWeight] + iWgt*sizeof(hsScalar)); }
|
||||
hsScalar* WeightsOff(int i) const { return (hsScalar*)(fChannels[kWeight] + i*fStrides[kWeight] + fOffsets[kWeight]); }
|
||||
UInt32& WgtIndicesOff(int i) const { return *(UInt32*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex] + fOffsets[kWgtIndex]); }
|
||||
UInt8& WgtIndexOff(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + fOffsets[kWgtIndex] + iWgt); }
|
||||
float& WeightOff(int iVtx, int iWgt) const { return *(float*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + fOffsets[kWeight] + iWgt*sizeof(float)); }
|
||||
float* WeightsOff(int i) const { return (float*)(fChannels[kWeight] + i*fStrides[kWeight] + fOffsets[kWeight]); }
|
||||
uint32_t& WgtIndicesOff(int i) const { return *(uint32_t*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex] + fOffsets[kWgtIndex]); }
|
||||
uint8_t& WgtIndexOff(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + fOffsets[kWgtIndex] + iWgt); }
|
||||
|
||||
UInt32& Diffuse32Off(int i) const { return *(UInt32*)(fChannels[kDiffuse] + i*fStrides[kDiffuse] + fOffsets[kDiffuse]); }
|
||||
UInt32& Specular32Off(int i) const { return *(UInt32*)(fChannels[kSpecular] + i*fStrides[kSpecular] + fOffsets[kSpecular]); }
|
||||
uint32_t& Diffuse32Off(int i) const { return *(uint32_t*)(fChannels[kDiffuse] + i*fStrides[kDiffuse] + fOffsets[kDiffuse]); }
|
||||
uint32_t& Specular32Off(int i) const { return *(uint32_t*)(fChannels[kSpecular] + i*fStrides[kSpecular] + fOffsets[kSpecular]); }
|
||||
|
||||
hsColorRGBA DiffuseRGBAOff(int i) const { return hsColorRGBA().FromARGB32(Diffuse32Off(i)); }
|
||||
hsColorRGBA SpecularRGBAOff(int i) const { return hsColorRGBA().FromARGB32(Specular32Off(i)); }
|
||||
@ -178,24 +178,24 @@ public:
|
||||
void ClearVerts();
|
||||
|
||||
// Must at least set a count and the valid channels. Note below on setting up for UVW access.
|
||||
plAccessVtxSpan& SetVertCount(UInt16 c) { fNumVerts = c; return *this; }
|
||||
plAccessVtxSpan& SetStream(void* p, UInt16 stride, Int32 offset, Channel chan) { fChannels[chan] = (UInt8*)p; fStrides[chan] = stride; fOffsets[chan] = offset; return *this; }
|
||||
plAccessVtxSpan& SetVertCount(uint16_t c) { fNumVerts = c; return *this; }
|
||||
plAccessVtxSpan& SetStream(void* p, uint16_t stride, int32_t offset, Channel chan) { fChannels[chan] = (uint8_t*)p; fStrides[chan] = stride; fOffsets[chan] = offset; return *this; }
|
||||
|
||||
//////////////////////////////////
|
||||
// Convenience versions. You get the idea.
|
||||
plAccessVtxSpan& PositionStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kPosition); }
|
||||
plAccessVtxSpan& NormalStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kNormal); }
|
||||
plAccessVtxSpan& DiffuseStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kDiffuse); }
|
||||
plAccessVtxSpan& SpecularStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kSpecular); }
|
||||
plAccessVtxSpan& WeightStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kWeight); }
|
||||
plAccessVtxSpan& WgtIndexStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kWgtIndex); }
|
||||
plAccessVtxSpan& PositionStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kPosition); }
|
||||
plAccessVtxSpan& NormalStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kNormal); }
|
||||
plAccessVtxSpan& DiffuseStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kDiffuse); }
|
||||
plAccessVtxSpan& SpecularStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kSpecular); }
|
||||
plAccessVtxSpan& WeightStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kWeight); }
|
||||
plAccessVtxSpan& WgtIndexStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kWgtIndex); }
|
||||
plAccessVtxSpan& SetNumWeights(int n) { if( !(fNumWeights = n) ) SetStream(nil, 0, 0, kWeight).SetStream(nil, 0, 0, kWgtIndex); return *this; }
|
||||
// Note on UVW access setup, you don't actually "have" to set the number of uvws per vertex,
|
||||
// but one way or another you'll need to know to access the uvws. If you're going to be setting
|
||||
// up the AccessSpan and passing it off for processing, you definitely better set it. But the
|
||||
// accessor and iterators don't ever use it.
|
||||
// Note that this means the UVWStream stride is from uvw[0][0] to uvw[1][0] in bytes.
|
||||
plAccessVtxSpan& UVWStream(void* p, UInt16 stride, Int32 offset) { return SetStream(p, stride, offset, kUVW); }
|
||||
plAccessVtxSpan& UVWStream(void* p, uint16_t stride, int32_t offset) { return SetStream(p, stride, offset, kUVW); }
|
||||
plAccessVtxSpan& SetNumUVWs(int n) { if( !(fNumUVWsPerVert = n) )SetStream(nil, 0, 0, kUVW); return *this; }
|
||||
//////////////////////////////////
|
||||
|
||||
@ -224,9 +224,9 @@ private:
|
||||
union
|
||||
{
|
||||
T* fValue;
|
||||
UInt8* fValueByte;
|
||||
uint8_t* fValueByte;
|
||||
};
|
||||
UInt8* fValueEnd;
|
||||
uint8_t* fValueEnd;
|
||||
plAccessVtxSpan* fAccess;
|
||||
plAccessVtxSpan::Channel fChan;
|
||||
|
||||
@ -355,7 +355,7 @@ public:
|
||||
|
||||
class plAccDiffuseIterator
|
||||
{
|
||||
plAccIterator<UInt32> fDiffuse;
|
||||
plAccIterator<uint32_t> fDiffuse;
|
||||
public:
|
||||
plAccDiffuseIterator(plAccessVtxSpan* acc)
|
||||
: fDiffuse(acc, plAccessVtxSpan::kDiffuse) {}
|
||||
@ -367,7 +367,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
UInt32* Diffuse32() const { return fDiffuse.Value(); }
|
||||
uint32_t* Diffuse32() const { return fDiffuse.Value(); }
|
||||
|
||||
hsColorRGBA DiffuseRGBA() const { return hsColorRGBA().FromARGB32(*Diffuse32()); }
|
||||
|
||||
@ -379,8 +379,8 @@ public:
|
||||
class plAccDiffSpecIterator
|
||||
{
|
||||
protected:
|
||||
plAccIterator<UInt32> fDiffuse;
|
||||
plAccIterator<UInt32> fSpecular;
|
||||
plAccIterator<uint32_t> fDiffuse;
|
||||
plAccIterator<uint32_t> fSpecular;
|
||||
public:
|
||||
plAccDiffSpecIterator(plAccessVtxSpan* acc)
|
||||
: fDiffuse(acc, plAccessVtxSpan::kDiffuse),
|
||||
@ -394,8 +394,8 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
UInt32* Diffuse32() const { return fDiffuse.Value(); }
|
||||
UInt32* Specular32() const { return fSpecular.Value(); }
|
||||
uint32_t* Diffuse32() const { return fDiffuse.Value(); }
|
||||
uint32_t* Specular32() const { return fSpecular.Value(); }
|
||||
|
||||
hsColorRGBA DiffuseRGBA() const { return hsColorRGBA().FromARGB32(*Diffuse32()); }
|
||||
hsColorRGBA SpecularRGBA() const { return hsColorRGBA().FromARGB32(*Specular32()); }
|
||||
@ -410,11 +410,11 @@ class plAccVertexIterator
|
||||
{
|
||||
protected:
|
||||
plAccIterator<hsPoint3> fPosition;
|
||||
plAccIterator<hsScalar> fWeight;
|
||||
plAccIterator<UInt8> fWgtIndex;
|
||||
plAccIterator<float> fWeight;
|
||||
plAccIterator<uint8_t> fWgtIndex;
|
||||
plAccIterator<hsVector3> fNormal;
|
||||
plAccIterator<UInt32> fDiffuse;
|
||||
plAccIterator<UInt32> fSpecular;
|
||||
plAccIterator<uint32_t> fDiffuse;
|
||||
plAccIterator<uint32_t> fSpecular;
|
||||
plAccIterator<hsPoint3> fUVW;
|
||||
public:
|
||||
plAccVertexIterator(plAccessVtxSpan* acc)
|
||||
@ -440,16 +440,16 @@ public:
|
||||
}
|
||||
|
||||
hsPoint3* Position() const { return fPosition.Value(); }
|
||||
hsScalar* Weights() const { return fWeight.Value(); }
|
||||
hsScalar* Weight(int i) const { return fWeight.Value() + i; }
|
||||
UInt32* WgtIndices() const { return (UInt32*)(fWgtIndex.Value()); }
|
||||
UInt8* WgtIndex(int i) const { return fWgtIndex.Value() + i; }
|
||||
float* Weights() const { return fWeight.Value(); }
|
||||
float* Weight(int i) const { return fWeight.Value() + i; }
|
||||
uint32_t* WgtIndices() const { return (uint32_t*)(fWgtIndex.Value()); }
|
||||
uint8_t* WgtIndex(int i) const { return fWgtIndex.Value() + i; }
|
||||
hsVector3* Normal() const { return fNormal.Value(); }
|
||||
hsPoint3* UVWs() const { return fUVW.Value(); }
|
||||
hsPoint3* UVW(int i) const { return fUVW.Value() + i; }
|
||||
|
||||
UInt32* Diffuse32() const { return fDiffuse.Value(); }
|
||||
UInt32* Specular32() const { return fSpecular.Value(); }
|
||||
uint32_t* Diffuse32() const { return fDiffuse.Value(); }
|
||||
uint32_t* Specular32() const { return fSpecular.Value(); }
|
||||
|
||||
hsColorRGBA DiffuseRGBA() const { return hsColorRGBA().FromARGB32(*Diffuse32()); }
|
||||
hsColorRGBA SpecularRGBA() const { return hsColorRGBA().FromARGB32(*Specular32()); }
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plActivePrintShape.h"
|
||||
|
||||
#include "plMessage/plRippleShapeMsg.h"
|
||||
@ -65,7 +65,7 @@ void plActivePrintShape::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plPrintShape::Read(stream, mgr);
|
||||
|
||||
UInt32 n = stream->ReadLE32();
|
||||
uint32_t n = stream->ReadLE32();
|
||||
fDecalMgrs.SetCount(n);
|
||||
int i;
|
||||
for( i = 0; i < n; i++ )
|
||||
@ -125,6 +125,6 @@ hsBool plActivePrintShape::INotify()
|
||||
|
||||
plRippleShapeMsg* plActivePrintShape::ISetupShapeMsg()
|
||||
{
|
||||
fShapeMsg = TRACKED_NEW plRippleShapeMsg(nil, this);
|
||||
fShapeMsg = new plRippleShapeMsg(nil, this);
|
||||
return fShapeMsg;
|
||||
}
|
@ -68,43 +68,43 @@ public:
|
||||
void* fOwner;
|
||||
|
||||
plDrawableSpans* fDrawable;
|
||||
UInt32 fBaseSpanIdx;
|
||||
uint32_t fBaseSpanIdx;
|
||||
hsGMaterial* fMaterial;
|
||||
UInt32 fFlags;
|
||||
uint32_t fFlags;
|
||||
|
||||
hsTArray<hsPoint3> fOrigPos;
|
||||
hsTArray<hsPoint3> fOrigUVW;
|
||||
|
||||
plGBufferGroup* fGroup; // Which buffer group, i.e. which vertex format
|
||||
|
||||
UInt32 fVBufferIdx; // Which vertex buffer in group
|
||||
UInt32 fCellIdx; // Cell index inside the vertex buffer
|
||||
UInt32 fCellOffset; // Offset inside the cell
|
||||
UInt32 fVStartIdx; // Start vertex # in the actual interlaced buffer
|
||||
UInt32 fVLength; // Length of this span in the buffer
|
||||
uint32_t fVBufferIdx; // Which vertex buffer in group
|
||||
uint32_t fCellIdx; // Cell index inside the vertex buffer
|
||||
uint32_t fCellOffset; // Offset inside the cell
|
||||
uint32_t fVStartIdx; // Start vertex # in the actual interlaced buffer
|
||||
uint32_t fVLength; // Length of this span in the buffer
|
||||
|
||||
UInt32 fVBufferInit;
|
||||
UInt32 fVBufferLimit;
|
||||
uint32_t fVBufferInit;
|
||||
uint32_t fVBufferLimit;
|
||||
|
||||
UInt32 fIBufferIdx; // Which index buffer in group
|
||||
UInt32 fIStartIdx; // Redundant, since all spans are contiguous. Here for debugging
|
||||
UInt32 fILength; // Length of this span in the buffer
|
||||
uint32_t fIBufferIdx; // Which index buffer in group
|
||||
uint32_t fIStartIdx; // Redundant, since all spans are contiguous. Here for debugging
|
||||
uint32_t fILength; // Length of this span in the buffer
|
||||
|
||||
UInt32 fIBufferInit;
|
||||
UInt32 fIBufferLimit;
|
||||
uint32_t fIBufferInit;
|
||||
uint32_t fIBufferLimit;
|
||||
|
||||
plDecalVtxFormat* GetBaseVtxPtr() const
|
||||
{
|
||||
plGBufferGroup* grp = fGroup;
|
||||
plGBufferCell* cell = grp->GetCell(fVBufferIdx, fCellIdx);
|
||||
|
||||
UInt8* ptr = grp->GetVertBufferData(fVBufferIdx);
|
||||
uint8_t* ptr = grp->GetVertBufferData(fVBufferIdx);
|
||||
|
||||
ptr += cell->fVtxStart + fCellOffset;
|
||||
|
||||
return (plDecalVtxFormat*)ptr;
|
||||
}
|
||||
UInt16* GetBaseIdxPtr() const
|
||||
uint16_t* GetBaseIdxPtr() const
|
||||
{
|
||||
plGBufferGroup* grp = fGroup;
|
||||
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plAvMeshSmooth.h"
|
||||
|
||||
#include "plGeometrySpan.h"
|
||||
@ -52,15 +52,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
class EdgeBin
|
||||
{
|
||||
public:
|
||||
UInt16 fVtx;
|
||||
UInt16 fCount;
|
||||
uint16_t fVtx;
|
||||
uint16_t fCount;
|
||||
|
||||
EdgeBin() : fVtx(0), fCount(0) {}
|
||||
};
|
||||
|
||||
void plAvMeshSmooth::FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, hsTArray<UInt16>& edgeVerts)
|
||||
void plAvMeshSmooth::FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray<uint16_t>& edgeVerts)
|
||||
{
|
||||
hsTArray<EdgeBin>* bins = TRACKED_NEW hsTArray<EdgeBin>[maxVtxIdx+1];
|
||||
hsTArray<EdgeBin>* bins = new hsTArray<EdgeBin>[maxVtxIdx+1];
|
||||
|
||||
hsBitVector edgeVertBits;
|
||||
// For each vert pair (edge) in idxList
|
||||
@ -138,7 +138,7 @@ void plAvMeshSmooth::FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList,
|
||||
delete [] bins;
|
||||
}
|
||||
|
||||
void plAvMeshSmooth::FindEdges(hsTArray<XfmSpan>& spans, hsTArray<UInt16>* edgeVerts)
|
||||
void plAvMeshSmooth::FindEdges(hsTArray<XfmSpan>& spans, hsTArray<uint16_t>* edgeVerts)
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < spans.GetCount(); i++ )
|
||||
@ -149,9 +149,9 @@ void plAvMeshSmooth::FindEdges(hsTArray<XfmSpan>& spans, hsTArray<UInt16>* edgeV
|
||||
|
||||
plAccessTriSpan& triSpan = spans[i].fAccSpan.AccessTri();
|
||||
|
||||
UInt32 nTris = triSpan.TriCount();
|
||||
UInt16* idxList = triSpan.fTris;
|
||||
UInt32 maxVertIdx = triSpan.VertCount()-1;
|
||||
uint32_t nTris = triSpan.TriCount();
|
||||
uint16_t* idxList = triSpan.fTris;
|
||||
uint32_t maxVertIdx = triSpan.VertCount()-1;
|
||||
|
||||
FindEdges(maxVertIdx, nTris, idxList, edgeVerts[i]);
|
||||
}
|
||||
@ -171,10 +171,10 @@ void plAvMeshSmooth::FindEdges(hsTArray<XfmSpan>& spans, hsTArray<UInt16>* edgeV
|
||||
// morph target mesh's local space. Whatever.
|
||||
void plAvMeshSmooth::Smooth(hsTArray<XfmSpan>& srcSpans, hsTArray<XfmSpan>& dstSpans)
|
||||
{
|
||||
hsTArray<UInt16>* dstEdgeVerts = TRACKED_NEW hsTArray<UInt16>[dstSpans.GetCount()];
|
||||
hsTArray<uint16_t>* dstEdgeVerts = new hsTArray<uint16_t>[dstSpans.GetCount()];
|
||||
FindEdges(dstSpans, dstEdgeVerts);
|
||||
|
||||
hsTArray<UInt16>* srcEdgeVerts = TRACKED_NEW hsTArray<UInt16>[srcSpans.GetCount()];
|
||||
hsTArray<uint16_t>* srcEdgeVerts = new hsTArray<uint16_t>[srcSpans.GetCount()];
|
||||
FindEdges(srcSpans, srcEdgeVerts);
|
||||
|
||||
int i;
|
||||
@ -194,7 +194,7 @@ void plAvMeshSmooth::Smooth(hsTArray<XfmSpan>& srcSpans, hsTArray<XfmSpan>& dstS
|
||||
else
|
||||
dstDiff.Set(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
hsScalar maxDot = fMinNormDot;
|
||||
float maxDot = fMinNormDot;
|
||||
|
||||
hsPoint3 smoothPos = dstPos;
|
||||
hsVector3 smoothNorm = dstNorm;
|
||||
@ -209,12 +209,12 @@ void plAvMeshSmooth::Smooth(hsTArray<XfmSpan>& srcSpans, hsTArray<XfmSpan>& dstS
|
||||
hsPoint3 srcPos = IPositionToNeutral(srcSpans[k], srcEdgeVerts[k][m]);
|
||||
hsVector3 srcNorm = INormalToNeutral(srcSpans[k], srcEdgeVerts[k][m]);
|
||||
|
||||
hsScalar dist = hsVector3(&dstPos, &srcPos).MagnitudeSquared();
|
||||
float dist = hsVector3(&dstPos, &srcPos).MagnitudeSquared();
|
||||
if( dist <= fDistTolSq )
|
||||
{
|
||||
smoothPos = srcPos;
|
||||
|
||||
hsScalar currDot = srcNorm.InnerProduct(dstNorm);
|
||||
float currDot = srcNorm.InnerProduct(dstNorm);
|
||||
if( currDot > maxDot )
|
||||
{
|
||||
maxDot = currDot;
|
||||
@ -265,22 +265,22 @@ hsVector3 plAvMeshSmooth::INormalToSpan(XfmSpan& span, const hsVector3& wNorm) c
|
||||
return ret;
|
||||
}
|
||||
|
||||
void plAvMeshSmooth::SetAngle(hsScalar degs)
|
||||
void plAvMeshSmooth::SetAngle(float degs)
|
||||
{
|
||||
fMinNormDot = hsCosine(hsScalarDegToRad(degs));
|
||||
fMinNormDot = cos(hsDegreesToRadians(degs));
|
||||
}
|
||||
|
||||
hsScalar plAvMeshSmooth::GetAngle() const
|
||||
float plAvMeshSmooth::GetAngle() const
|
||||
{
|
||||
return hsScalarRadToDeg(hsACosine(fMinNormDot));
|
||||
return hsRadiansToDegrees(acos(fMinNormDot));
|
||||
}
|
||||
|
||||
void plAvMeshSmooth::SetDistTol(hsScalar dist)
|
||||
void plAvMeshSmooth::SetDistTol(float dist)
|
||||
{
|
||||
fDistTolSq = dist * dist;
|
||||
}
|
||||
|
||||
hsScalar plAvMeshSmooth::GetDistTol() const
|
||||
float plAvMeshSmooth::GetDistTol() const
|
||||
{
|
||||
return hsSquareRoot(fDistTolSq);
|
||||
}
|
||||
return sqrt(fDistTolSq);
|
||||
}
|
||||
|
@ -75,10 +75,10 @@ public:
|
||||
};
|
||||
|
||||
protected:
|
||||
UInt32 fFlags;
|
||||
uint32_t fFlags;
|
||||
|
||||
hsScalar fMinNormDot;
|
||||
hsScalar fDistTolSq;
|
||||
float fMinNormDot;
|
||||
float fDistTolSq;
|
||||
|
||||
plAccessGeometry fAccGeom;
|
||||
|
||||
@ -87,22 +87,22 @@ protected:
|
||||
hsPoint3 IPositionToSpan(XfmSpan& span, const hsPoint3& wPos) const;
|
||||
hsVector3 INormalToSpan(XfmSpan& span, const hsVector3& wNorm) const;
|
||||
|
||||
void FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, hsTArray<UInt16>& edgeVerts);
|
||||
void FindEdges(hsTArray<XfmSpan>& spans, hsTArray<UInt16>* edgeVerts);
|
||||
void FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray<uint16_t>& edgeVerts);
|
||||
void FindEdges(hsTArray<XfmSpan>& spans, hsTArray<uint16_t>* edgeVerts);
|
||||
|
||||
public:
|
||||
plAvMeshSmooth() : fFlags(kSmoothNorm), fMinNormDot(0.25f), fDistTolSq(1.e-4f), fAccGeom() {}
|
||||
|
||||
void SetAngle(hsScalar degs);
|
||||
hsScalar GetAngle() const; // returns degrees
|
||||
void SetAngle(float degs);
|
||||
float GetAngle() const; // returns degrees
|
||||
|
||||
void SetDistTol(hsScalar dist);
|
||||
hsScalar GetDistTol() const;
|
||||
void SetDistTol(float dist);
|
||||
float GetDistTol() const;
|
||||
|
||||
void Smooth(hsTArray<XfmSpan>& srcSpans, hsTArray<XfmSpan>& dstSpans);
|
||||
|
||||
void SetFlags(UInt32 f) { fFlags = f; }
|
||||
UInt32 GetFlags() const { return fFlags; }
|
||||
void SetFlags(uint32_t f) { fFlags = f; }
|
||||
uint32_t GetFlags() const { return fFlags; }
|
||||
};
|
||||
|
||||
#endif // plAvMeshSmooth_inc
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "hsStream.h"
|
||||
#include "plCluster.h"
|
||||
|
||||
@ -74,7 +74,7 @@ void plCluster::Read(hsStream* s, plClusterGroup* grp)
|
||||
int i;
|
||||
for( i = 0; i < numInst; i++ )
|
||||
{
|
||||
fInsts[i] = TRACKED_NEW plSpanInstance;
|
||||
fInsts[i] = new plSpanInstance;
|
||||
fInsts[i]->Read(s, fEncoding, numVerts);
|
||||
}
|
||||
|
||||
@ -94,8 +94,8 @@ void plCluster::Write(hsStream* s) const
|
||||
}
|
||||
|
||||
inline void inlTESTPOINT(const hsPoint3& destP,
|
||||
hsScalar& minX, hsScalar& minY, hsScalar& minZ,
|
||||
hsScalar& maxX, hsScalar& maxY, hsScalar& maxZ)
|
||||
float& minX, float& minY, float& minZ,
|
||||
float& maxX, float& maxY, float& maxZ)
|
||||
{
|
||||
if( destP.fX < minX )
|
||||
minX = destP.fX;
|
||||
@ -113,15 +113,15 @@ inline void inlTESTPOINT(const hsPoint3& destP,
|
||||
maxZ = destP.fZ;
|
||||
}
|
||||
|
||||
void plCluster::UnPack(UInt8* vDst, UInt16* iDst, int idxOffset, hsBounds3Ext& wBnd) const
|
||||
void plCluster::UnPack(uint8_t* vDst, uint16_t* iDst, int idxOffset, hsBounds3Ext& wBnd) const
|
||||
{
|
||||
hsScalar minX = 1.e33f;
|
||||
hsScalar minY = 1.e33f;
|
||||
hsScalar minZ = 1.e33f;
|
||||
float minX = 1.e33f;
|
||||
float minY = 1.e33f;
|
||||
float minZ = 1.e33f;
|
||||
|
||||
hsScalar maxX = -1.e33f;
|
||||
hsScalar maxY = -1.e33f;
|
||||
hsScalar maxZ = -1.e33f;
|
||||
float maxX = -1.e33f;
|
||||
float maxY = -1.e33f;
|
||||
float maxZ = -1.e33f;
|
||||
|
||||
hsAssert(fGroup->GetTemplate(), "Can't unpack without a template");
|
||||
const plSpanTemplate& templ = *fGroup->GetTemplate();
|
||||
@ -129,7 +129,7 @@ void plCluster::UnPack(UInt8* vDst, UInt16* iDst, int idxOffset, hsBounds3Ext& w
|
||||
for( i = 0; i < fInsts.GetCount(); i++ )
|
||||
{
|
||||
// First, just copy our template, offsetting by prescribed amount.
|
||||
const UInt16* iSrc = templ.IndexData();
|
||||
const uint16_t* iSrc = templ.IndexData();
|
||||
int n = templ.NumIndices();
|
||||
while( n-- )
|
||||
{
|
||||
@ -173,7 +173,7 @@ void plCluster::UnPack(UInt8* vDst, UInt16* iDst, int idxOffset, hsBounds3Ext& w
|
||||
*norm = w2l * *norm;
|
||||
hsFastMath::NormalizeAppr(*norm);
|
||||
|
||||
UInt32* color = (UInt32*)(vDst + colOff);
|
||||
uint32_t* color = (uint32_t*)(vDst + colOff);
|
||||
*color = iter.Color(*color);
|
||||
|
||||
vDst += stride;
|
||||
|
@ -63,7 +63,7 @@ class plCluster
|
||||
public:
|
||||
enum
|
||||
{
|
||||
kNoIdx = UInt8(-1)
|
||||
kNoIdx = uint8_t(-1)
|
||||
};
|
||||
protected:
|
||||
plClusterGroup* fGroup;
|
||||
@ -83,10 +83,10 @@ public:
|
||||
void Read(hsStream* s, plClusterGroup* grp);
|
||||
void Write(hsStream* s) const;
|
||||
|
||||
UInt32 NumInsts() const { return fInsts.GetCount(); }
|
||||
uint32_t NumInsts() const { return fInsts.GetCount(); }
|
||||
const plSpanInstance& GetInst(int i) const { return *fInsts[i]; }
|
||||
|
||||
void UnPack(UInt8* vDst, UInt16* iDst, int idxOffset, hsBounds3Ext& wBnd) const;
|
||||
void UnPack(uint8_t* vDst, uint16_t* iDst, int idxOffset, hsBounds3Ext& wBnd) const;
|
||||
|
||||
// Getters and setters, mostly for export construction.
|
||||
const plSpanTemplate* GetTemplate() const { return fGroup->GetTemplate(); }
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plClusterGroup.h"
|
||||
|
||||
#include "plSpanTemplate.h"
|
||||
@ -86,7 +86,7 @@ plClusterGroup::~plClusterGroup()
|
||||
|
||||
plCluster* plClusterGroup::IAddCluster()
|
||||
{
|
||||
plCluster* cluster = TRACKED_NEW plCluster;
|
||||
plCluster* cluster = new plCluster;
|
||||
// Set the cluster's group.
|
||||
cluster->SetGroup(this);
|
||||
fClusters.Append(cluster);
|
||||
@ -109,26 +109,26 @@ void plClusterGroup::Read(hsStream* stream, hsResMgr* mgr)
|
||||
|
||||
int i;
|
||||
|
||||
fTemplate = TRACKED_NEW plSpanTemplate;
|
||||
fTemplate = new plSpanTemplate;
|
||||
fTemplate->Read(stream);
|
||||
|
||||
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefMaterial), plRefFlags::kActiveRef);
|
||||
mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefMaterial), plRefFlags::kActiveRef);
|
||||
|
||||
const int numClust = stream->ReadLE32();
|
||||
fClusters.SetCount(numClust);
|
||||
for( i = 0; i < numClust; i++ )
|
||||
{
|
||||
fClusters[i] = TRACKED_NEW plCluster;
|
||||
fClusters[i] = new plCluster;
|
||||
fClusters[i]->Read(stream, this);
|
||||
}
|
||||
|
||||
const int numRegions = stream->ReadLE32();
|
||||
for( i = 0; i < numRegions; i++ )
|
||||
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefRegion), plRefFlags::kActiveRef);
|
||||
mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefRegion), plRefFlags::kActiveRef);
|
||||
|
||||
const int numLights = stream->ReadLE32();
|
||||
for( i = 0; i < numLights; i++ )
|
||||
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefLight), plRefFlags::kActiveRef);
|
||||
mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefLight), plRefFlags::kActiveRef);
|
||||
|
||||
fLOD.Read(stream);
|
||||
|
||||
@ -172,7 +172,7 @@ void plClusterGroup::Write(hsStream* stream, hsResMgr* mgr)
|
||||
void plClusterGroup::ISendToSelf(RefType t, hsKeyedObject* ref)
|
||||
{
|
||||
hsAssert(ref, "Sending self a nil object");
|
||||
plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, t);
|
||||
plGenRefMsg* refMsg = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, t);
|
||||
hsgResMgr::ResMgr()->SendRef(ref->GetKey(), refMsg, plRefFlags::kActiveRef);
|
||||
}
|
||||
|
||||
@ -299,7 +299,7 @@ hsBool plClusterGroup::MsgReceive(plMessage* msg)
|
||||
|
||||
void plClusterGroup::UnPack()
|
||||
{
|
||||
plDrawableSpans* drawable = TRACKED_NEW plDrawableSpans;
|
||||
plDrawableSpans* drawable = new plDrawableSpans;
|
||||
fDrawable = hsgResMgr::ResMgr()->NewKey(GetKey()->GetName(), drawable, GetKey()->GetUoid().GetLocation());
|
||||
drawable->UnPackCluster(this);
|
||||
|
||||
@ -316,9 +316,9 @@ void plClusterGroup::SetVisible(bool visible)
|
||||
}
|
||||
}
|
||||
|
||||
UInt32 plClusterGroup::NumInst() const
|
||||
uint32_t plClusterGroup::NumInst() const
|
||||
{
|
||||
UInt32 numInst = 0;
|
||||
uint32_t numInst = 0;
|
||||
int i;
|
||||
for( i = 0; i < fClusters.GetCount(); i++ )
|
||||
numInst += fClusters[i]->NumInsts();
|
||||
|
@ -62,15 +62,15 @@ class plDrawableSpans;
|
||||
class plLODDist
|
||||
{
|
||||
public:
|
||||
hsScalar fMinDist;
|
||||
hsScalar fMaxDist;
|
||||
float fMinDist;
|
||||
float fMaxDist;
|
||||
|
||||
plLODDist(hsScalar minDist, hsScalar maxDist) : fMinDist(minDist), fMaxDist(maxDist) {}
|
||||
plLODDist(float minDist, float maxDist) : fMinDist(minDist), fMaxDist(maxDist) {}
|
||||
plLODDist() : fMinDist(0), fMaxDist(0) {}
|
||||
|
||||
plLODDist& Set(float minDist, float maxDist) { fMinDist = minDist; fMaxDist = maxDist; return *this; }
|
||||
|
||||
plLODDist& operator=(int d) { fMinDist = hsScalar(d); fMaxDist = hsScalar(d); return *this; }
|
||||
plLODDist& operator=(int d) { fMinDist = float(d); fMaxDist = float(d); return *this; }
|
||||
|
||||
int operator==(const plLODDist& d) const { return (fMinDist == d.fMinDist)&&(fMaxDist == d.fMaxDist); }
|
||||
|
||||
@ -101,7 +101,7 @@ protected:
|
||||
plLODDist fLOD;
|
||||
|
||||
hsTArray<plCluster*> fClusters;
|
||||
UInt32 fUnPacked;
|
||||
uint32_t fUnPacked;
|
||||
|
||||
plKey fSceneNode;
|
||||
plKey fDrawable;
|
||||
@ -144,7 +144,7 @@ public:
|
||||
|
||||
const plCluster* GetCluster(int i) const;
|
||||
int GetNumClusters() const { return fClusters.GetCount(); }
|
||||
UInt32 NumInst() const;
|
||||
uint32_t NumInst() const;
|
||||
|
||||
// The drawable needs us to be able to convert our data
|
||||
// into, well, drawable stuff.
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plCutter.h"
|
||||
#include "plAccessSpan.h"
|
||||
#include "hsFastMath.h"
|
||||
@ -134,7 +134,7 @@ void plCutter::Set(const hsPoint3& pos, const hsVector3& dir, const hsVector3& o
|
||||
}
|
||||
|
||||
|
||||
inline void plCutter::ISetPosNorm(hsScalar parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
|
||||
inline void plCutter::ISetPosNorm(float parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
|
||||
{
|
||||
dst.fPos = outVtx.fPos;
|
||||
dst.fPos += parm * (inVtx.fPos - outVtx.fPos);
|
||||
@ -161,7 +161,7 @@ inline void plCutter::ISetPosNorm(hsScalar parm, const plCutoutVtx& inVtx, const
|
||||
|
||||
inline void plCutter::ICutoutVtxLoU(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
|
||||
{
|
||||
hsScalar parm = outVtx.fUVW.fX / (outVtx.fUVW.fX - inVtx.fUVW.fX);
|
||||
float parm = outVtx.fUVW.fX / (outVtx.fUVW.fX - inVtx.fUVW.fX);
|
||||
|
||||
ISetPosNorm(parm, inVtx, outVtx, dst);
|
||||
|
||||
@ -172,7 +172,7 @@ inline void plCutter::ICutoutVtxLoU(const plCutoutVtx& inVtx, const plCutoutVtx&
|
||||
|
||||
inline void plCutter::ICutoutVtxLoV(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
|
||||
{
|
||||
hsScalar parm = outVtx.fUVW.fY / (outVtx.fUVW.fY - inVtx.fUVW.fY);
|
||||
float parm = outVtx.fUVW.fY / (outVtx.fUVW.fY - inVtx.fUVW.fY);
|
||||
|
||||
ISetPosNorm(parm, inVtx, outVtx, dst);
|
||||
|
||||
@ -183,7 +183,7 @@ inline void plCutter::ICutoutVtxLoV(const plCutoutVtx& inVtx, const plCutoutVtx&
|
||||
|
||||
inline void plCutter::ICutoutVtxLoW(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
|
||||
{
|
||||
hsScalar parm = outVtx.fUVW.fZ / (outVtx.fUVW.fZ - inVtx.fUVW.fZ);
|
||||
float parm = outVtx.fUVW.fZ / (outVtx.fUVW.fZ - inVtx.fUVW.fZ);
|
||||
|
||||
ISetPosNorm(parm, inVtx, outVtx, dst);
|
||||
|
||||
@ -198,7 +198,7 @@ inline void plCutter::ICutoutVtxLoW(const plCutoutVtx& inVtx, const plCutoutVtx&
|
||||
// parm = (outVtx.fUVW - 1.f) / (outVtx.fUVW - inVtx.fUVW)
|
||||
inline void plCutter::ICutoutVtxHiU(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
|
||||
{
|
||||
hsScalar parm = (outVtx.fUVW.fX - 1.f) / (outVtx.fUVW.fX - inVtx.fUVW.fX);
|
||||
float parm = (outVtx.fUVW.fX - 1.f) / (outVtx.fUVW.fX - inVtx.fUVW.fX);
|
||||
|
||||
ISetPosNorm(parm, inVtx, outVtx, dst);
|
||||
|
||||
@ -209,7 +209,7 @@ inline void plCutter::ICutoutVtxHiU(const plCutoutVtx& inVtx, const plCutoutVtx&
|
||||
|
||||
inline void plCutter::ICutoutVtxHiV(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
|
||||
{
|
||||
hsScalar parm = (outVtx.fUVW.fY - 1.f) / (outVtx.fUVW.fY - inVtx.fUVW.fY);
|
||||
float parm = (outVtx.fUVW.fY - 1.f) / (outVtx.fUVW.fY - inVtx.fUVW.fY);
|
||||
|
||||
ISetPosNorm(parm, inVtx, outVtx, dst);
|
||||
|
||||
@ -220,7 +220,7 @@ inline void plCutter::ICutoutVtxHiV(const plCutoutVtx& inVtx, const plCutoutVtx&
|
||||
|
||||
inline void plCutter::ICutoutVtxHiW(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
|
||||
{
|
||||
hsScalar parm = (outVtx.fUVW.fZ - 1.f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ);
|
||||
float parm = (outVtx.fUVW.fZ - 1.f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ);
|
||||
|
||||
ISetPosNorm(parm, inVtx, outVtx, dst);
|
||||
|
||||
@ -236,7 +236,7 @@ inline void plCutter::ICutoutVtxHiW(const plCutoutVtx& inVtx, const plCutoutVtx&
|
||||
// parm = (outVtx.fUVW - 0.5f) / (outVtx.fUVW - inVtx.fUVW)
|
||||
inline void plCutter::ICutoutVtxMidU(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
|
||||
{
|
||||
hsScalar parm = (outVtx.fUVW.fX - 0.5f) / (outVtx.fUVW.fX - inVtx.fUVW.fX);
|
||||
float parm = (outVtx.fUVW.fX - 0.5f) / (outVtx.fUVW.fX - inVtx.fUVW.fX);
|
||||
|
||||
ISetPosNorm(parm, inVtx, outVtx, dst);
|
||||
|
||||
@ -249,7 +249,7 @@ inline void plCutter::ICutoutVtxMidU(const plCutoutVtx& inVtx, const plCutoutVtx
|
||||
|
||||
inline void plCutter::ICutoutVtxMidV(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
|
||||
{
|
||||
hsScalar parm = (outVtx.fUVW.fY - 0.5f) / (outVtx.fUVW.fY - inVtx.fUVW.fY);
|
||||
float parm = (outVtx.fUVW.fY - 0.5f) / (outVtx.fUVW.fY - inVtx.fUVW.fY);
|
||||
|
||||
ISetPosNorm(parm, inVtx, outVtx, dst);
|
||||
|
||||
@ -262,7 +262,7 @@ inline void plCutter::ICutoutVtxMidV(const plCutoutVtx& inVtx, const plCutoutVtx
|
||||
|
||||
inline void plCutter::ICutoutVtxMidW(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const
|
||||
{
|
||||
hsScalar parm = (outVtx.fUVW.fZ - 0.5f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ);
|
||||
float parm = (outVtx.fUVW.fZ - 0.5f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ);
|
||||
|
||||
ISetPosNorm(parm, inVtx, outVtx, dst);
|
||||
|
||||
@ -721,7 +721,7 @@ hsBool plCutter::FindHitPoints(const hsTArray<plCutoutPoly>& src, hsTArray<plCut
|
||||
return hits.GetCount() > 0;
|
||||
}
|
||||
|
||||
hsBool plCutter::FindHitPointsConstHeight(const hsTArray<plCutoutPoly>& src, hsTArray<plCutoutHit>& hits, hsScalar height) const
|
||||
hsBool plCutter::FindHitPointsConstHeight(const hsTArray<plCutoutPoly>& src, hsTArray<plCutoutHit>& hits, float height) const
|
||||
{
|
||||
if( FindHitPoints(src, hits) )
|
||||
{
|
||||
@ -933,14 +933,14 @@ hsBool plCutter::MakeGrid(int nWid, int nLen, const hsPoint3& center, const hsVe
|
||||
corner += -dux;
|
||||
corner += -dvx;
|
||||
|
||||
hsScalar sWid = 1.f / hsScalar(nWid-1);
|
||||
hsScalar sLen = 1.f / hsScalar(nLen-1);
|
||||
float sWid = 1.f / float(nWid-1);
|
||||
float sLen = 1.f / float(nLen-1);
|
||||
|
||||
dux *= 2.f * sWid;
|
||||
dvx *= 2.f * sLen;
|
||||
|
||||
hsScalar du = sWid;
|
||||
hsScalar dv = sLen;
|
||||
float du = sWid;
|
||||
float dv = sLen;
|
||||
int j;
|
||||
for( j = 0; j < nLen; j++ )
|
||||
{
|
||||
@ -950,8 +950,8 @@ hsBool plCutter::MakeGrid(int nWid, int nLen, const hsPoint3& center, const hsVe
|
||||
plCutoutMiniVtx& vtx = grid.fVerts[j * nWid + i];
|
||||
|
||||
vtx.fPos = corner;
|
||||
vtx.fPos += dux * (hsScalar)i;
|
||||
vtx.fPos += dvx * (hsScalar)j;
|
||||
vtx.fPos += dux * (float)i;
|
||||
vtx.fPos += dvx * (float)j;
|
||||
|
||||
vtx.fUVW.fX = du * i;
|
||||
vtx.fUVW.fY = dv * j;
|
||||
@ -1043,7 +1043,7 @@ void TestCutter(const plKey& key, const hsVector3& size, const hsPoint3& pos)
|
||||
hsBool newDrawable = !drawable;
|
||||
hsBool haveNormal = true;
|
||||
|
||||
hsTArray<UInt32> retIndex;
|
||||
hsTArray<uint32_t> retIndex;
|
||||
|
||||
hsTArray<plAccessSpan> src;
|
||||
plAccessGeometry::Instance()->OpenRO(di, src);
|
||||
@ -1168,7 +1168,7 @@ void TestCutter(const plKey& key, const hsVector3& size, const hsPoint3& pos)
|
||||
uvw[iv] = dst[iPoly].fVerts[iVert].fUVW;
|
||||
col[iv] = dst[iPoly].fVerts[iVert].fColor;
|
||||
|
||||
hsScalar opac = uvw[iv].fZ < 0.25f
|
||||
float opac = uvw[iv].fZ < 0.25f
|
||||
? uvw[iv].fZ * 4.f
|
||||
: uvw[iv].fZ > 0.75f
|
||||
? (1.f - uvw[iv].fZ) * 4.f
|
||||
@ -1190,12 +1190,12 @@ void TestCutter(const plKey& key, const hsVector3& size, const hsPoint3& pos)
|
||||
}
|
||||
}
|
||||
|
||||
hsTArray<UInt16> idx;
|
||||
hsTArray<uint16_t> idx;
|
||||
|
||||
UInt16 base = 0;
|
||||
uint16_t base = 0;
|
||||
for( j = 0; j < dst.GetCount(); j++ )
|
||||
{
|
||||
UInt16 next = base+1;
|
||||
uint16_t next = base+1;
|
||||
int k;
|
||||
for( k = 2; k < dst[j].fVerts.GetCount(); k++ )
|
||||
{
|
||||
@ -1249,7 +1249,7 @@ void TestCutter2(const plKey& key, const hsVector3& size, const hsPoint3& pos, h
|
||||
hsBool newDrawable = !drawable;
|
||||
hsBool haveNormal = true;
|
||||
|
||||
hsTArray<UInt32> retIndex;
|
||||
hsTArray<uint32_t> retIndex;
|
||||
|
||||
hsTArray<plDrawVisList> drawVis;
|
||||
node->Harvest(&cutter.GetIsect(), drawVis);
|
||||
@ -1322,7 +1322,7 @@ void TestCutter2(const plKey& key, const hsVector3& size, const hsPoint3& pos, h
|
||||
uvw[iv] = dst[iPoly].fVerts[iVert].fUVW;
|
||||
col[iv] = dst[iPoly].fVerts[iVert].fColor;
|
||||
|
||||
hsScalar opac = uvw[iv].fZ < 0.25f
|
||||
float opac = uvw[iv].fZ < 0.25f
|
||||
? uvw[iv].fZ * 4.f
|
||||
: uvw[iv].fZ > 0.75f
|
||||
? (1.f - uvw[iv].fZ) * 4.f
|
||||
@ -1345,12 +1345,12 @@ void TestCutter2(const plKey& key, const hsVector3& size, const hsPoint3& pos, h
|
||||
}
|
||||
}
|
||||
|
||||
hsTArray<UInt16> idx;
|
||||
hsTArray<uint16_t> idx;
|
||||
|
||||
UInt16 base = 0;
|
||||
uint16_t base = 0;
|
||||
for( j = 0; j < dst.GetCount(); j++ )
|
||||
{
|
||||
UInt16 next = base+1;
|
||||
uint16_t next = base+1;
|
||||
int k;
|
||||
for( k = 2; k < dst[j].fVerts.GetCount(); k++ )
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ class plFlatGridMesh
|
||||
{
|
||||
public:
|
||||
hsTArray<plCutoutMiniVtx> fVerts;
|
||||
hsTArray<UInt16> fIdx;
|
||||
hsTArray<uint16_t> fIdx;
|
||||
|
||||
void Reset() { fVerts.SetCount(0); fIdx.SetCount(0); }
|
||||
};
|
||||
@ -105,14 +105,14 @@ class plCutter : public plCreatable
|
||||
protected:
|
||||
|
||||
// Permanent attributes
|
||||
hsScalar fLengthU;
|
||||
hsScalar fLengthV;
|
||||
hsScalar fLengthW;
|
||||
float fLengthU;
|
||||
float fLengthV;
|
||||
float fLengthW;
|
||||
|
||||
// Internal cached stuff
|
||||
hsScalar fDistU;
|
||||
hsScalar fDistV;
|
||||
hsScalar fDistW;
|
||||
float fDistU;
|
||||
float fDistV;
|
||||
float fDistW;
|
||||
hsVector3 fDirU;
|
||||
hsVector3 fDirV;
|
||||
hsVector3 fDirW;
|
||||
@ -136,7 +136,7 @@ protected:
|
||||
|
||||
hsBool IFindHitPoint(const hsTArray<plCutoutVtx>& inPoly, plCutoutHit& hit) const;
|
||||
|
||||
inline void ISetPosNorm(hsScalar parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const;
|
||||
inline void ISetPosNorm(float parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const;
|
||||
|
||||
void ICutoutTransformed(plAccessSpan& src, hsTArray<plCutoutPoly>& dst) const;
|
||||
void ICutoutConstHeight(plAccessSpan& src, hsTArray<plCutoutPoly>& dst) const;
|
||||
@ -155,7 +155,7 @@ public:
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
hsBool FindHitPoints(const hsTArray<plCutoutPoly>& src, hsTArray<plCutoutHit>& hits) const;
|
||||
hsBool FindHitPointsConstHeight(const hsTArray<plCutoutPoly>& src, hsTArray<plCutoutHit>& hits, hsScalar height) const;
|
||||
hsBool FindHitPointsConstHeight(const hsTArray<plCutoutPoly>& src, hsTArray<plCutoutHit>& hits, float height) const;
|
||||
|
||||
void Set(const hsPoint3& pos, const hsVector3& dir, const hsVector3& out, hsBool flip=false);
|
||||
|
||||
@ -163,9 +163,9 @@ public:
|
||||
hsBool CutoutGrid(int nWid, int nLen, plFlatGridMesh& dst) const;
|
||||
|
||||
void SetLength(const hsVector3& s) { fLengthU = s.fX; fLengthV = s.fY; fLengthW = s.fZ; }
|
||||
hsScalar GetLengthU() const { return fLengthU; }
|
||||
hsScalar GetLengthV() const { return fLengthV; }
|
||||
hsScalar GetLengthW() const { return fLengthW; }
|
||||
float GetLengthU() const { return fLengthU; }
|
||||
float GetLengthV() const { return fLengthV; }
|
||||
float GetLengthW() const { return fLengthW; }
|
||||
|
||||
const hsBounds3Ext& GetWorldBounds() const { return fWorldBounds; }
|
||||
plBoundsIsect& GetIsect() { return fIsect; }
|
||||
|
@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDrawableGenerator.h"
|
||||
#include "plDrawableSpans.h"
|
||||
#include "plGeometrySpan.h"
|
||||
@ -80,7 +80,7 @@ void plDrawableGenerator::SetFauxLightColors( hsColorRGBA &lite, hsColorRGBA
|
||||
// Quickly shades vertices based on a fake directional light. Good for doing
|
||||
// faux shadings on proxy objects.
|
||||
|
||||
void plDrawableGenerator::IQuickShadeVerts( UInt32 count, hsVector3 *normals, hsColorRGBA *colors, hsColorRGBA* origColors, const hsColorRGBA* multColor )
|
||||
void plDrawableGenerator::IQuickShadeVerts( uint32_t count, hsVector3 *normals, hsColorRGBA *colors, hsColorRGBA* origColors, const hsColorRGBA* multColor )
|
||||
{
|
||||
hsVector3 lightDir;
|
||||
float scale;
|
||||
@ -94,7 +94,7 @@ void plDrawableGenerator::IQuickShadeVerts( UInt32 count, hsVector3 *normals,
|
||||
scale = ( normals[ count ] * lightDir );
|
||||
// pretend there are two opposing directional lights, but the
|
||||
// one pointing downish is a little stronger.
|
||||
const hsScalar kReverseLight = -0.8f;
|
||||
const float kReverseLight = -0.8f;
|
||||
if( scale < 0 )
|
||||
scale = kReverseLight * scale;
|
||||
colors[ count ] = fLiteColor * scale + fDarkColor * ( 1.f - scale );
|
||||
@ -105,10 +105,10 @@ void plDrawableGenerator::IQuickShadeVerts( UInt32 count, hsVector3 *normals,
|
||||
}
|
||||
}
|
||||
|
||||
void plDrawableGenerator::IFillSpan( UInt32 vertCount, hsPoint3 *positions, hsVector3 *normals,
|
||||
hsPoint3 *uvws, UInt32 uvwsPerVtx,
|
||||
void plDrawableGenerator::IFillSpan( uint32_t vertCount, hsPoint3 *positions, hsVector3 *normals,
|
||||
hsPoint3 *uvws, uint32_t uvwsPerVtx,
|
||||
hsColorRGBA *origColors, hsBool fauxShade, const hsColorRGBA* multColor,
|
||||
UInt32 numIndices, UInt16 *indices,
|
||||
uint32_t numIndices, uint16_t *indices,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended,
|
||||
plGeometrySpan* span )
|
||||
{
|
||||
@ -144,7 +144,7 @@ void plDrawableGenerator::IFillSpan( UInt32 vertCount, hsPoint3 *positions, hsVe
|
||||
|
||||
if( uvws == nil )
|
||||
uvwsPerVtx = 0;
|
||||
span->BeginCreate( material, localToWorld, plGeometrySpan::UVCountToFormat( (UInt8)uvwsPerVtx ) );
|
||||
span->BeginCreate( material, localToWorld, plGeometrySpan::UVCountToFormat( (uint8_t)uvwsPerVtx ) );
|
||||
|
||||
if( !origColors && !fauxShade )
|
||||
span->AddVertexArray( vertCount, positions, normals, nil, uvws, uvwsPerVtx );
|
||||
@ -165,19 +165,19 @@ void plDrawableGenerator::IFillSpan( UInt32 vertCount, hsPoint3 *positions, hsVe
|
||||
}
|
||||
|
||||
|
||||
hsTArray<UInt32> tempColors;
|
||||
hsTArray<uint32_t> tempColors;
|
||||
int i;
|
||||
UInt8 a, r, g, b;
|
||||
uint8_t a, r, g, b;
|
||||
|
||||
|
||||
tempColors.SetCount( vertCount );
|
||||
for( i = 0; i < vertCount; i++ )
|
||||
{
|
||||
hsColorRGBA *color = &colors[ i ];
|
||||
a = (UInt8)( color->a >= 1 ? 255 : color->a <= 0 ? 0 : color->a * 255.0 );
|
||||
r = (UInt8)( color->r >= 1 ? 255 : color->r <= 0 ? 0 : color->r * 255.0 );
|
||||
g = (UInt8)( color->g >= 1 ? 255 : color->g <= 0 ? 0 : color->g * 255.0 );
|
||||
b = (UInt8)( color->b >= 1 ? 255 : color->b <= 0 ? 0 : color->b * 255.0 );
|
||||
a = (uint8_t)( color->a >= 1 ? 255 : color->a <= 0 ? 0 : color->a * 255.0 );
|
||||
r = (uint8_t)( color->r >= 1 ? 255 : color->r <= 0 ? 0 : color->r * 255.0 );
|
||||
g = (uint8_t)( color->g >= 1 ? 255 : color->g <= 0 ? 0 : color->g * 255.0 );
|
||||
b = (uint8_t)( color->b >= 1 ? 255 : color->b <= 0 ? 0 : color->b * 255.0 );
|
||||
|
||||
tempColors[ i ] = ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b );
|
||||
}
|
||||
@ -196,12 +196,12 @@ void plDrawableGenerator::IFillSpan( UInt32 vertCount, hsPoint3 *positions, hsVe
|
||||
// data given. That data had better match the data the drawable was first filled
|
||||
// with (i.e. vertex/index count
|
||||
|
||||
hsBool plDrawableGenerator::RegenerateDrawable( UInt32 vertCount, hsPoint3 *positions, hsVector3 *normals,
|
||||
hsPoint3 *uvws, UInt32 uvwsPerVtx,
|
||||
hsBool plDrawableGenerator::RegenerateDrawable( uint32_t vertCount, hsPoint3 *positions, hsVector3 *normals,
|
||||
hsPoint3 *uvws, uint32_t uvwsPerVtx,
|
||||
hsColorRGBA *origColors, hsBool fauxShade, const hsColorRGBA* multColor,
|
||||
UInt32 numIndices, UInt16 *indices,
|
||||
uint32_t numIndices, uint16_t *indices,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended,
|
||||
UInt32 diIndex, plDrawableSpans *destDraw )
|
||||
uint32_t diIndex, plDrawableSpans *destDraw )
|
||||
{
|
||||
plDISpanIndex spanList = destDraw->GetDISpans( diIndex );
|
||||
if( spanList.GetCount() != 1 )
|
||||
@ -234,12 +234,12 @@ hsBool plDrawableGenerator::RegenerateDrawable( UInt32 vertCount, hsPoint3 *posi
|
||||
// Static function that creates a new drawable based on the vertex/index
|
||||
// data given.
|
||||
|
||||
plDrawableSpans *plDrawableGenerator::GenerateDrawable( UInt32 vertCount, hsPoint3 *positions, hsVector3 *normals,
|
||||
hsPoint3 *uvws, UInt32 uvwsPerVtx,
|
||||
plDrawableSpans *plDrawableGenerator::GenerateDrawable( uint32_t vertCount, hsPoint3 *positions, hsVector3 *normals,
|
||||
hsPoint3 *uvws, uint32_t uvwsPerVtx,
|
||||
hsColorRGBA *origColors, hsBool fauxShade, const hsColorRGBA* multColor,
|
||||
UInt32 numIndices, UInt16 *indices,
|
||||
uint32_t numIndices, uint16_t *indices,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended,
|
||||
hsTArray<UInt32> *retIndex, plDrawableSpans *toAddTo )
|
||||
hsTArray<uint32_t> *retIndex, plDrawableSpans *toAddTo )
|
||||
{
|
||||
plDrawableSpans *newDraw;
|
||||
hsTArray<plGeometrySpan *> spanArray;
|
||||
@ -250,7 +250,7 @@ plDrawableSpans *plDrawableGenerator::GenerateDrawable( UInt32 vertCount, hsPoin
|
||||
newDraw = toAddTo;
|
||||
else
|
||||
{
|
||||
newDraw = TRACKED_NEW plDrawableSpans;
|
||||
newDraw = new plDrawableSpans;
|
||||
// newDraw->SetNativeProperty( plDrawable::kPropVolatile, true );
|
||||
if( blended )
|
||||
{
|
||||
@ -265,7 +265,7 @@ plDrawableSpans *plDrawableGenerator::GenerateDrawable( UInt32 vertCount, hsPoin
|
||||
|
||||
// Create a temp plGeometrySpan
|
||||
spanArray.SetCount( 1 );
|
||||
span = spanArray[ 0 ] = TRACKED_NEW plGeometrySpan;
|
||||
span = spanArray[ 0 ] = new plGeometrySpan;
|
||||
|
||||
IFillSpan( vertCount, positions, normals,
|
||||
uvws, uvwsPerVtx,
|
||||
@ -275,8 +275,8 @@ plDrawableSpans *plDrawableGenerator::GenerateDrawable( UInt32 vertCount, hsPoin
|
||||
span );
|
||||
|
||||
/// Now add the span to the new drawable, clear up the span's buffers and return!
|
||||
UInt32 trash = UInt32(-1);
|
||||
UInt32 idx = newDraw->AppendDISpans( spanArray, trash, false );
|
||||
uint32_t trash = uint32_t(-1);
|
||||
uint32_t idx = newDraw->AppendDISpans( spanArray, trash, false );
|
||||
if( retIndex != nil )
|
||||
retIndex->Append(idx);
|
||||
|
||||
@ -285,15 +285,15 @@ plDrawableSpans *plDrawableGenerator::GenerateDrawable( UInt32 vertCount, hsPoin
|
||||
|
||||
//// GenerateSphericalDrawable ///////////////////////////////////////////////
|
||||
|
||||
plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoint3& pos, hsScalar radius, hsGMaterial *material,
|
||||
plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoint3& pos, float radius, hsGMaterial *material,
|
||||
const hsMatrix44 &localToWorld, hsBool blended,
|
||||
const hsColorRGBA* multColor,
|
||||
hsTArray<UInt32> *retIndex, plDrawableSpans *toAddTo,
|
||||
hsScalar qualityScalar )
|
||||
hsTArray<uint32_t> *retIndex, plDrawableSpans *toAddTo,
|
||||
float qualityScalar )
|
||||
{
|
||||
hsTArray<hsPoint3> points;
|
||||
hsTArray<hsVector3> normals;
|
||||
hsTArray<UInt16> indices;
|
||||
hsTArray<uint16_t> indices;
|
||||
hsTArray<hsColorRGBA> colors;
|
||||
hsPoint3 point;
|
||||
hsVector3 normal;
|
||||
@ -313,13 +313,13 @@ plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoi
|
||||
/// Generate points
|
||||
for( i = 0; i <= numDivisions; i++ )
|
||||
{
|
||||
angle = (float)i * ( hsScalarPI ) / (float)numDivisions;
|
||||
angle = (float)i * ( M_PI ) / (float)numDivisions;
|
||||
hsFastMath::SinCosInRange( angle, internRad, z );
|
||||
internRad *= radius;
|
||||
|
||||
for( j = 0; j < numDivisions; j++ )
|
||||
{
|
||||
angle = (float)j * ( 2 * hsScalarPI ) / (float)numDivisions;
|
||||
angle = (float)j * ( 2 * M_PI ) / (float)numDivisions;
|
||||
hsFastMath::SinCosInRange( angle, x, y );
|
||||
|
||||
point.Set( pos.fX + x * internRad, pos.fY + y * internRad, pos.fZ + z * radius );
|
||||
@ -366,10 +366,10 @@ plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoi
|
||||
|
||||
//// GenerateBoxDrawable /////////////////////////////////////////////////////
|
||||
|
||||
plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( hsScalar width, hsScalar height, hsScalar depth,
|
||||
plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( float width, float height, float depth,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended,
|
||||
const hsColorRGBA* multColor,
|
||||
hsTArray<UInt32> *retIndex, plDrawableSpans *toAddTo )
|
||||
hsTArray<uint32_t> *retIndex, plDrawableSpans *toAddTo )
|
||||
{
|
||||
hsVector3 xVec, yVec, zVec;
|
||||
hsPoint3 pt;
|
||||
@ -392,11 +392,11 @@ plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( hsScalar width, h
|
||||
plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( const hsPoint3 &corner, const hsVector3 &xVec, const hsVector3 &yVec, const hsVector3 &zVec,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended,
|
||||
const hsColorRGBA* multColor,
|
||||
hsTArray<UInt32> *retIndex, plDrawableSpans *toAddTo )
|
||||
hsTArray<uint32_t> *retIndex, plDrawableSpans *toAddTo )
|
||||
{
|
||||
hsTArray<hsPoint3> points;
|
||||
hsTArray<hsVector3> normals;
|
||||
hsTArray<UInt16> indices;
|
||||
hsTArray<uint16_t> indices;
|
||||
hsTArray<hsColorRGBA> colors;
|
||||
hsTArray<hsPoint3> uvws;
|
||||
hsPoint3 point;
|
||||
@ -475,11 +475,11 @@ plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( const hsPoint3 &c
|
||||
plDrawableSpans *plDrawableGenerator::GenerateBoundsDrawable( hsBounds3Ext *bounds,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended,
|
||||
const hsColorRGBA* multColor,
|
||||
hsTArray<UInt32> *retIndex, plDrawableSpans *toAddTo )
|
||||
hsTArray<uint32_t> *retIndex, plDrawableSpans *toAddTo )
|
||||
{
|
||||
hsTArray<hsPoint3> points;
|
||||
hsTArray<hsVector3> normals;
|
||||
hsTArray<UInt16> indices;
|
||||
hsTArray<uint16_t> indices;
|
||||
hsTArray<hsColorRGBA> colors;
|
||||
hsPoint3 point;
|
||||
hsVector3 normal;
|
||||
@ -536,10 +536,10 @@ plDrawableSpans *plDrawableGenerator::GenerateBoundsDrawable( hsBounds3Ext *
|
||||
|
||||
//// GenerateConicalDrawable /////////////////////////////////////////////////
|
||||
|
||||
plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsScalar radius, hsScalar height, hsGMaterial *material,
|
||||
plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( float radius, float height, hsGMaterial *material,
|
||||
const hsMatrix44 &localToWorld, hsBool blended,
|
||||
const hsColorRGBA* multColor,
|
||||
hsTArray<UInt32> *retIndex, plDrawableSpans *toAddTo )
|
||||
hsTArray<uint32_t> *retIndex, plDrawableSpans *toAddTo )
|
||||
{
|
||||
hsVector3 direction;
|
||||
|
||||
@ -554,14 +554,14 @@ plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsScalar radi
|
||||
|
||||
//// GenerateConicalDrawable /////////////////////////////////////////////////
|
||||
|
||||
plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, hsScalar radius, hsGMaterial *material,
|
||||
plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, float radius, hsGMaterial *material,
|
||||
const hsMatrix44 &localToWorld, hsBool blended,
|
||||
const hsColorRGBA* multColor,
|
||||
hsTArray<UInt32> *retIndex, plDrawableSpans *toAddTo )
|
||||
hsTArray<uint32_t> *retIndex, plDrawableSpans *toAddTo )
|
||||
{
|
||||
hsTArray<hsPoint3> points;
|
||||
hsTArray<hsVector3> normals;
|
||||
hsTArray<UInt16> indices;
|
||||
hsTArray<uint16_t> indices;
|
||||
hsTArray<hsColorRGBA> colors;
|
||||
hsPoint3 point;
|
||||
hsVector3 normal;
|
||||
@ -603,7 +603,7 @@ plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &ape
|
||||
normals.Append( -direction );
|
||||
for( i = 0; i < numDivisions; i++ )
|
||||
{
|
||||
angle = (float)i * ( hsScalarPI * 2.f ) / (float)numDivisions;
|
||||
angle = (float)i * ( M_PI * 2.f ) / (float)numDivisions;
|
||||
hsFastMath::SinCosInRange( angle, x, y );
|
||||
|
||||
points.Append( baseCenter + ( xVec * x * radius ) + ( yVec * y * radius ) );
|
||||
@ -644,12 +644,12 @@ plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &ape
|
||||
plDrawableSpans *plDrawableGenerator::GenerateAxesDrawable( hsGMaterial *material,
|
||||
const hsMatrix44 &localToWorld, hsBool blended,
|
||||
const hsColorRGBA* multColor,
|
||||
hsTArray<UInt32> *retIndex, plDrawableSpans *toAddTo )
|
||||
hsTArray<uint32_t> *retIndex, plDrawableSpans *toAddTo )
|
||||
{
|
||||
hsTArray<hsPoint3> points;
|
||||
hsTArray<hsVector3> normals;
|
||||
hsTArray<hsColorRGBA> colors;
|
||||
hsTArray<UInt16> indices;
|
||||
hsTArray<uint16_t> indices;
|
||||
|
||||
int i;
|
||||
float size = 15;
|
||||
@ -715,11 +715,11 @@ plDrawableSpans *plDrawableGenerator::GenerateAxesDrawable( hsGMaterial *mat
|
||||
plDrawableSpans *plDrawableGenerator::GeneratePlanarDrawable( const hsPoint3 &corner, const hsVector3 &xVec, const hsVector3 &yVec,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended,
|
||||
const hsColorRGBA* multColor,
|
||||
hsTArray<UInt32> *retIndex, plDrawableSpans *toAddTo )
|
||||
hsTArray<uint32_t> *retIndex, plDrawableSpans *toAddTo )
|
||||
{
|
||||
hsTArray<hsPoint3> points;
|
||||
hsTArray<hsVector3> normals;
|
||||
hsTArray<UInt16> indices;
|
||||
hsTArray<uint16_t> indices;
|
||||
hsTArray<hsColorRGBA> colors;
|
||||
hsTArray<hsPoint3> uvws;
|
||||
hsPoint3 point;
|
||||
|
@ -76,76 +76,76 @@ class plDrawableGenerator
|
||||
|
||||
// Refills a drawable previously created with GenerateDrawable with the new data. New data
|
||||
// must match previous data in counts.
|
||||
hsBool RegenerateDrawable( UInt32 vertCount, hsPoint3 *positions, hsVector3 *normals,
|
||||
hsPoint3 *uvws, UInt32 uvwsPerVtx,
|
||||
hsBool RegenerateDrawable( uint32_t vertCount, hsPoint3 *positions, hsVector3 *normals,
|
||||
hsPoint3 *uvws, uint32_t uvwsPerVtx,
|
||||
hsColorRGBA *origColors, hsBool fauxShade, const hsColorRGBA* multColor,
|
||||
UInt32 numIndices, UInt16 *indices,
|
||||
uint32_t numIndices, uint16_t *indices,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended,
|
||||
UInt32 diIndex, plDrawableSpans *destDraw );
|
||||
uint32_t diIndex, plDrawableSpans *destDraw );
|
||||
|
||||
// Generates a drawable based on the vertex/index data given
|
||||
// uvws is an array vertCount*uvwsPerVtx long in order [uvw(s) for vtx0, uvw(s) for vtx1, ...], or is nil
|
||||
static plDrawableSpans *GenerateDrawable( UInt32 vertCount, hsPoint3 *positions, hsVector3 *normals,
|
||||
hsPoint3 *uvws, UInt32 uvwsPerVtx,
|
||||
static plDrawableSpans *GenerateDrawable( uint32_t vertCount, hsPoint3 *positions, hsVector3 *normals,
|
||||
hsPoint3 *uvws, uint32_t uvwsPerVtx,
|
||||
hsColorRGBA *origColors, hsBool fauxShade, const hsColorRGBA* multColor,
|
||||
UInt32 numIndices, UInt16 *indices,
|
||||
uint32_t numIndices, uint16_t *indices,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false,
|
||||
hsTArray<UInt32> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
|
||||
// Generates a spherical drawable
|
||||
static plDrawableSpans *GenerateSphericalDrawable( const hsPoint3& localPos, hsScalar radius, hsGMaterial *material,
|
||||
static plDrawableSpans *GenerateSphericalDrawable( const hsPoint3& localPos, float radius, hsGMaterial *material,
|
||||
const hsMatrix44 &localToWorld, hsBool blended = false,
|
||||
const hsColorRGBA* multColor = nil,
|
||||
hsTArray<UInt32> *retIndex = nil, plDrawableSpans *toAddTo = nil,
|
||||
hsScalar qualityScalar = 1.f );
|
||||
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil,
|
||||
float qualityScalar = 1.f );
|
||||
|
||||
// Generates a rectangular drawable
|
||||
static plDrawableSpans *GenerateBoxDrawable( hsScalar width, hsScalar height, hsScalar depth,
|
||||
static plDrawableSpans *GenerateBoxDrawable( float width, float height, float depth,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false,
|
||||
const hsColorRGBA* multColor = nil,
|
||||
hsTArray<UInt32> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
|
||||
// Generate a rectangular drawable based on a corner and three vectors
|
||||
static plDrawableSpans *GenerateBoxDrawable( const hsPoint3 &corner, const hsVector3 &xVec, const hsVector3 &yVec, const hsVector3 &zVec,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false,
|
||||
const hsColorRGBA* multColor = nil,
|
||||
hsTArray<UInt32> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
// Generates a bounds-based drawable
|
||||
static plDrawableSpans *GenerateBoundsDrawable( hsBounds3Ext *bounds,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false,
|
||||
const hsColorRGBA* multColor = nil,
|
||||
hsTArray<UInt32> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
|
||||
// Generates a conical drawable
|
||||
static plDrawableSpans *GenerateConicalDrawable( hsScalar radius, hsScalar height, hsGMaterial *material,
|
||||
static plDrawableSpans *GenerateConicalDrawable( float radius, float height, hsGMaterial *material,
|
||||
const hsMatrix44 &localToWorld, hsBool blended = false,
|
||||
const hsColorRGBA* multColor = nil,
|
||||
hsTArray<UInt32> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
|
||||
// Generates a general conical drawable based on a center and direction
|
||||
static plDrawableSpans *GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, hsScalar radius, hsGMaterial *material,
|
||||
static plDrawableSpans *GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, float radius, hsGMaterial *material,
|
||||
const hsMatrix44 &localToWorld, hsBool blended = false,
|
||||
const hsColorRGBA* multColor = nil,
|
||||
hsTArray<UInt32> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
|
||||
// Generates a drawable representing 3 axes
|
||||
static plDrawableSpans *GenerateAxesDrawable( hsGMaterial *material,
|
||||
const hsMatrix44 &localToWorld, hsBool blended = false,
|
||||
const hsColorRGBA* multColor = nil,
|
||||
hsTArray<UInt32> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
|
||||
// Generate a planar drawable based on a corner and two vectors
|
||||
static plDrawableSpans *GeneratePlanarDrawable( const hsPoint3 &corner, const hsVector3 &xVec, const hsVector3 &yVec,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false,
|
||||
const hsColorRGBA* multColor = nil,
|
||||
hsTArray<UInt32> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
hsTArray<uint32_t> *retIndex = nil, plDrawableSpans *toAddTo = nil );
|
||||
|
||||
protected:
|
||||
|
||||
// Shade the vertices given based on a quick fake directional light.
|
||||
// If origColors is non-nil, it must be an array of length count. Each outColor[i] *= origColor[i].
|
||||
// If multColor is non-nil, modulate the output by multColor.
|
||||
static void IQuickShadeVerts( UInt32 count, hsVector3 *normals,
|
||||
static void IQuickShadeVerts( uint32_t count, hsVector3 *normals,
|
||||
hsColorRGBA *colors,
|
||||
hsColorRGBA* origColors = nil,
|
||||
const hsColorRGBA* multColor = nil );
|
||||
@ -153,10 +153,10 @@ class plDrawableGenerator
|
||||
// Take the vertex and connectivity info supplied and fill out a geometry span with it.
|
||||
// Output span is ready to be added to a Drawable, or refreshed in a Drawable if it's
|
||||
// already in the SourceSpans.
|
||||
static void IFillSpan( UInt32 vertCount, hsPoint3 *positions, hsVector3 *normals,
|
||||
hsPoint3 *uvws, UInt32 uvwsPerVtx,
|
||||
static void IFillSpan( uint32_t vertCount, hsPoint3 *positions, hsVector3 *normals,
|
||||
hsPoint3 *uvws, uint32_t uvwsPerVtx,
|
||||
hsColorRGBA *origColors, hsBool fauxShade, const hsColorRGBA* multColor,
|
||||
UInt32 numIndices, UInt16 *indices,
|
||||
uint32_t numIndices, uint16_t *indices,
|
||||
hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended,
|
||||
plGeometrySpan* span );
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -97,16 +97,16 @@ public:
|
||||
kMatrixOnly = 0x1,
|
||||
kDontTransformSpans = 0x2 // Only used for particle systems right now
|
||||
};
|
||||
UInt8 fFlags;
|
||||
hsTArray<UInt32> fIndices;
|
||||
uint8_t fFlags;
|
||||
hsTArray<uint32_t> fIndices;
|
||||
|
||||
hsBool IsMatrixOnly() const { return 0 != (fFlags & kMatrixOnly); }
|
||||
hsBool DontTransform() const { return 0 != ( fFlags & kDontTransformSpans ); }
|
||||
void Append(UInt32 i) { fIndices.Append(i); }
|
||||
void Append(uint32_t i) { fIndices.Append(i); }
|
||||
void Reset() { fFlags = kNone; fIndices.Reset(); }
|
||||
void SetCountAndZero(int c) { fIndices.SetCountAndZero(c); }
|
||||
UInt32 GetCount() const { return fIndices.GetCount(); }
|
||||
UInt32& operator[](int i) const { return fIndices[i]; }
|
||||
uint32_t GetCount() const { return fIndices.GetCount(); }
|
||||
uint32_t& operator[](int i) const { return fIndices[i]; }
|
||||
};
|
||||
|
||||
struct hsColorRGBA;
|
||||
@ -115,12 +115,12 @@ class plDrawableSpans : public plDrawable
|
||||
{
|
||||
protected:
|
||||
|
||||
static const UInt32 kSpanTypeMask;
|
||||
static const UInt32 kSpanIDMask;
|
||||
static const UInt32 kSpanTypeIcicle;
|
||||
static const UInt32 kSpanTypeParticleSpan;
|
||||
static const uint32_t kSpanTypeMask;
|
||||
static const uint32_t kSpanIDMask;
|
||||
static const uint32_t kSpanTypeIcicle;
|
||||
static const uint32_t kSpanTypeParticleSpan;
|
||||
|
||||
UInt32 fType;
|
||||
uint32_t fType;
|
||||
|
||||
hsBool fReadyToRender;
|
||||
|
||||
@ -151,12 +151,12 @@ class plDrawableSpans : public plDrawable
|
||||
hsTArray<plParticleSpan> fParticleSpans;
|
||||
|
||||
hsTArray<plSpan *> fSpans; // Pointers into the above two arrays
|
||||
hsTArray<UInt32> fSpanSourceIndices; // For volatile drawables only
|
||||
hsTArray<uint32_t> fSpanSourceIndices; // For volatile drawables only
|
||||
hsTArray<plGBufferGroup *> fGroups;
|
||||
hsTArray<plDISpanIndex*> fDIIndices;
|
||||
|
||||
UInt32 fProps;
|
||||
UInt32 fCriteria;
|
||||
uint32_t fProps;
|
||||
uint32_t fCriteria;
|
||||
plRenderLevel fRenderLevel;
|
||||
plLoadMask fLoadMask;
|
||||
|
||||
@ -171,7 +171,7 @@ class plDrawableSpans : public plDrawable
|
||||
|
||||
hsBool fSettingMatIdxLock;
|
||||
|
||||
UInt32 fSkinTime;
|
||||
uint32_t fSkinTime;
|
||||
|
||||
/// Export-only members
|
||||
hsTArray<plGeometrySpan *> fSourceSpans;
|
||||
@ -184,7 +184,7 @@ class plDrawableSpans : public plDrawable
|
||||
|
||||
void ICleanupMatrices();
|
||||
void IRemoveGarbage( void );
|
||||
void IAdjustSortData( plGBufferTriangle *triList, UInt32 count, UInt32 threshhold, Int32 delta );
|
||||
void IAdjustSortData( plGBufferTriangle *triList, uint32_t count, uint32_t threshhold, int32_t delta );
|
||||
|
||||
// The following two functions return true if they create a new span, false if it's just an instance
|
||||
hsBool IConvertGeoSpanToVertexSpan( plGeometrySpan *geoSpan, plVertexSpan *span, int lod, plVertexSpan *instancedParent );
|
||||
@ -193,11 +193,11 @@ class plDrawableSpans : public plDrawable
|
||||
void IUpdateIcicleFromGeoSpan( plGeometrySpan *geoSpan, plIcicle *icicle );
|
||||
void IUpdateVertexSpanFromGeoSpan( plGeometrySpan *geoSpan, plVertexSpan *span );
|
||||
|
||||
UInt32 IXlateSpanProps( UInt32 props, hsBool xlateToSpan );
|
||||
uint32_t IXlateSpanProps( uint32_t props, hsBool xlateToSpan );
|
||||
|
||||
UInt32 IAddAMaterial( hsGMaterial *material );
|
||||
UInt32 IRefMaterial( UInt32 index );
|
||||
void ICheckToRemoveMaterial( UInt32 materialIdx );
|
||||
uint32_t IAddAMaterial( hsGMaterial *material );
|
||||
uint32_t IRefMaterial( uint32_t index );
|
||||
void ICheckToRemoveMaterial( uint32_t materialIdx );
|
||||
|
||||
// Annoying to need this, but necessary until materials can test for properties on any of their layers (might add in the future)
|
||||
hsBool ITestMatForSpecularity( hsGMaterial *mat );
|
||||
@ -205,8 +205,8 @@ class plDrawableSpans : public plDrawable
|
||||
void IAssignMatIdxToSpan( plSpan *span, hsGMaterial *mtl );
|
||||
|
||||
// Create the sorting data for a given span and flag it as sortable
|
||||
void ICheckSpanForSortable( UInt32 idx ) { if( !(fSpans[idx]->fProps & plSpan::kPropFacesSortable) )IMakeSpanSortable(idx); }
|
||||
void IMakeSpanSortable( UInt32 index );
|
||||
void ICheckSpanForSortable( uint32_t idx ) { if( !(fSpans[idx]->fProps & plSpan::kPropFacesSortable) )IMakeSpanSortable(idx); }
|
||||
void IMakeSpanSortable( uint32_t index );
|
||||
|
||||
/// Bit vector build thingies
|
||||
virtual void IBuildVectors( void );
|
||||
@ -221,13 +221,13 @@ class plDrawableSpans : public plDrawable
|
||||
// Compare two spans for sorting
|
||||
short ICompareSpans( plGeometrySpan *span1, plGeometrySpan *span2 );
|
||||
// Find a buffer group of the given format (returns its index into fGroups)
|
||||
UInt8 IFindBufferGroup( UInt8 vtxFormat, UInt32 numVertsNeeded, int lod, hsBool vertVolatile, hsBool idxVolatile);
|
||||
uint8_t IFindBufferGroup( uint8_t vtxFormat, uint32_t numVertsNeeded, int lod, hsBool vertVolatile, hsBool idxVolatile);
|
||||
// Write a span to a stream
|
||||
void IWriteSpan( hsStream *s, plSpan *span );
|
||||
/// EXPORT-ONLY FUNCTIONS
|
||||
|
||||
/// DYNAMIC FUNCTIONS
|
||||
plDISpanIndex *IFindDIIndices( UInt32 &index );
|
||||
plDISpanIndex *IFindDIIndices( uint32_t &index );
|
||||
void IRebuildSpanArray( void );
|
||||
plParticleSpan *ICreateParticleIcicle( hsGMaterial *material, plParticleSet *set );
|
||||
|
||||
@ -240,13 +240,13 @@ class plDrawableSpans : public plDrawable
|
||||
CLASSNAME_REGISTER( plDrawableSpans );
|
||||
GETINTERFACE_ANY( plDrawableSpans, plDrawable );
|
||||
|
||||
virtual void SetNativeTransform(UInt32 idx, const hsMatrix44& l2w, const hsMatrix44& w2l);
|
||||
virtual plDrawable& SetTransform( UInt32 index, const hsMatrix44& l2w, const hsMatrix44& w2l);
|
||||
virtual const hsMatrix44& GetLocalToWorld( UInt32 index = (UInt32)-1 ) const;
|
||||
virtual const hsMatrix44& GetWorldToLocal( UInt32 index = (UInt32)-1 ) const;
|
||||
virtual void SetNativeTransform(uint32_t idx, const hsMatrix44& l2w, const hsMatrix44& w2l);
|
||||
virtual plDrawable& SetTransform( uint32_t index, const hsMatrix44& l2w, const hsMatrix44& w2l);
|
||||
virtual const hsMatrix44& GetLocalToWorld( uint32_t index = (uint32_t)-1 ) const;
|
||||
virtual const hsMatrix44& GetWorldToLocal( uint32_t index = (uint32_t)-1 ) const;
|
||||
|
||||
virtual plDrawable& SetProperty( UInt32 index, int prop, hsBool on );
|
||||
virtual hsBool GetProperty( UInt32 index, int prop ) const;
|
||||
virtual plDrawable& SetProperty( uint32_t index, int prop, hsBool on );
|
||||
virtual hsBool GetProperty( uint32_t index, int prop ) const;
|
||||
|
||||
virtual plDrawable& SetProperty( int prop, hsBool on );
|
||||
virtual hsBool GetProperty( int prop ) const;
|
||||
@ -254,21 +254,21 @@ class plDrawableSpans : public plDrawable
|
||||
virtual plDrawable& SetNativeProperty( int prop, hsBool on ) { if( on ) fProps |= prop; else fProps &= ~prop; return *this; }
|
||||
virtual hsBool GetNativeProperty( int prop ) const { return ( fProps & prop ) ? true : false; }
|
||||
|
||||
virtual plDrawable& SetNativeProperty( UInt32 index, int prop, hsBool on );
|
||||
virtual hsBool GetNativeProperty( UInt32 index, int prop ) const;
|
||||
virtual plDrawable& SetNativeProperty( uint32_t index, int prop, hsBool on );
|
||||
virtual hsBool GetNativeProperty( uint32_t index, int prop ) const;
|
||||
|
||||
virtual plDrawable& SetSubType( UInt32 index, plSubDrawableType t, hsBool on );
|
||||
virtual UInt32 GetSubType( UInt32 index ) const; // returns or of all spans with this index (index==-1 is all spans).
|
||||
virtual plDrawable& SetSubType( uint32_t index, plSubDrawableType t, hsBool on );
|
||||
virtual uint32_t GetSubType( uint32_t index ) const; // returns or of all spans with this index (index==-1 is all spans).
|
||||
|
||||
virtual UInt32 GetType( void ) const { return fType; }
|
||||
virtual void SetType( UInt32 type ) { fType = type; }
|
||||
virtual uint32_t GetType( void ) const { return fType; }
|
||||
virtual void SetType( uint32_t type ) { fType = type; }
|
||||
|
||||
virtual void SetRenderLevel(const plRenderLevel& l);
|
||||
virtual const plRenderLevel& GetRenderLevel() const;
|
||||
|
||||
const hsBounds3Ext& GetLocalBounds( UInt32 index = (UInt32)-1 ) const;
|
||||
const hsBounds3Ext& GetWorldBounds( UInt32 index = (UInt32)-1 ) const;
|
||||
const hsBounds3Ext& GetMaxWorldBounds( UInt32 index = (UInt32)-1 ) const;
|
||||
const hsBounds3Ext& GetLocalBounds( uint32_t index = (uint32_t)-1 ) const;
|
||||
const hsBounds3Ext& GetWorldBounds( uint32_t index = (uint32_t)-1 ) const;
|
||||
const hsBounds3Ext& GetMaxWorldBounds( uint32_t index = (uint32_t)-1 ) const;
|
||||
|
||||
virtual void Read(hsStream* s, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr);
|
||||
@ -276,11 +276,11 @@ class plDrawableSpans : public plDrawable
|
||||
virtual plSpaceTree* GetSpaceTree() const { if(!fSpaceTree)IQuickSpaceTree(); return fSpaceTree; }
|
||||
virtual void SetSpaceTree(plSpaceTree* st) const;
|
||||
virtual void SetVisSet(plVisMgr* visMgr);
|
||||
virtual void SetDISpanVisSet(UInt32 diIndex, hsKeyedObject* reg, hsBool on);
|
||||
virtual void SetDISpanVisSet(uint32_t diIndex, hsKeyedObject* reg, hsBool on);
|
||||
|
||||
virtual const plSpan *GetSpan( UInt32 index ) const { return fSpans[ index ]; }
|
||||
virtual const plSpan *GetSpan( UInt32 diIndex, UInt32 index ) const { return fSpans[ (*fDIIndices[ diIndex ])[ index ] ]; }
|
||||
virtual const UInt32 GetNumSpans( void ) const { return fSpans.GetCount(); }
|
||||
virtual const plSpan *GetSpan( uint32_t index ) const { return fSpans[ index ]; }
|
||||
virtual const plSpan *GetSpan( uint32_t diIndex, uint32_t index ) const { return fSpans[ (*fDIIndices[ diIndex ])[ index ] ]; }
|
||||
virtual const uint32_t GetNumSpans( void ) const { return fSpans.GetCount(); }
|
||||
virtual const hsTArray<plSpan *> &GetSpanArray( void ) const { return fSpans; }
|
||||
|
||||
hsMatrix44* GetMatrixPalette(int baseMatrix) const { return &fLocalToWorlds[baseMatrix]; }
|
||||
@ -288,17 +288,17 @@ class plDrawableSpans : public plDrawable
|
||||
void SetInitialBone(int i, const hsMatrix44& l2b, const hsMatrix44& b2l);
|
||||
|
||||
// Get the vertex buffer ref of a given group
|
||||
hsGDeviceRef *GetVertexRef( UInt32 group, UInt32 idx );
|
||||
hsGDeviceRef *GetVertexRef( uint32_t group, uint32_t idx );
|
||||
// Get the index buffer ref of a given group
|
||||
hsGDeviceRef *GetIndexRef( UInt32 group, UInt32 idx );
|
||||
hsGDeviceRef *GetIndexRef( uint32_t group, uint32_t idx );
|
||||
|
||||
// BufferGroups accessed only by Pipeline and it's close personal acquaintances.
|
||||
plGBufferGroup* GetBufferGroup(UInt32 i) const { return fGroups[i]; }
|
||||
UInt32 GetNumBufferGroups() const { return fGroups.GetCount(); }
|
||||
plGBufferGroup* GetBufferGroup(uint32_t i) const { return fGroups[i]; }
|
||||
uint32_t GetNumBufferGroups() const { return fGroups.GetCount(); }
|
||||
const hsTArray<plGeometrySpan*>& GetSourceSpans() const { return fSourceSpans; }
|
||||
|
||||
void DirtyVertexBuffer(UInt32 group, UInt32 idx);
|
||||
void DirtyIndexBuffer(UInt32 group, UInt32 idx);
|
||||
void DirtyVertexBuffer(uint32_t group, uint32_t idx);
|
||||
void DirtyIndexBuffer(uint32_t group, uint32_t idx);
|
||||
|
||||
// Prepare all internal data structures for rendering
|
||||
virtual void PrepForRender( plPipeline *p );
|
||||
@ -311,8 +311,8 @@ class plDrawableSpans : public plDrawable
|
||||
virtual void SetSceneNode(plKey newNode);
|
||||
|
||||
// Lookup a material in the material array
|
||||
hsGMaterial *GetMaterial( UInt32 index ) const { return ( ( index == (UInt32)-1 ) ? nil : fMaterials[ index ] ); }
|
||||
UInt32 GetNumMaterials( void ) const { return fMaterials.GetCount(); }
|
||||
hsGMaterial *GetMaterial( uint32_t index ) const { return ( ( index == (uint32_t)-1 ) ? nil : fMaterials[ index ] ); }
|
||||
uint32_t GetNumMaterials( void ) const { return fMaterials.GetCount(); }
|
||||
|
||||
// Convert intermediate data into export/run-time-ready data
|
||||
virtual void Optimize( void );
|
||||
@ -328,62 +328,62 @@ class plDrawableSpans : public plDrawable
|
||||
virtual hsBitVector const &GetBlendingSpanVector( void ) const;
|
||||
|
||||
// Set a single bit in the bitVector of spans that are blending
|
||||
virtual void SetBlendingSpanVectorBit( UInt32 bitNumber, hsBool on );
|
||||
virtual void SetBlendingSpanVectorBit( uint32_t bitNumber, hsBool on );
|
||||
|
||||
// Taking span index. DI Index doesn't make sense here, because one object's DI can dereference into many materials etc.
|
||||
virtual hsGMaterial* GetSubMaterial(int index) const;
|
||||
virtual hsBool GetSubVisDists(int index, hsScalar& minDist, hsScalar& maxDist) const; // return true if span invisible before minDist and/or after maxDist
|
||||
virtual hsBool GetSubVisDists(int index, float& minDist, float& maxDist) const; // return true if span invisible before minDist and/or after maxDist
|
||||
|
||||
// Used by the pipeline to keep from reskinning on multiple renders per frame.
|
||||
UInt32 GetSkinTime() const { return fSkinTime; }
|
||||
void SetSkinTime(UInt32 t) { fSkinTime = t; }
|
||||
uint32_t GetSkinTime() const { return fSkinTime; }
|
||||
void SetSkinTime(uint32_t t) { fSkinTime = t; }
|
||||
|
||||
void UnPackCluster(plClusterGroup* cluster);
|
||||
|
||||
/// EXPORT-ONLY FUNCTIONS
|
||||
virtual UInt32 AddDISpans( hsTArray<plGeometrySpan *> &spans, UInt32 index = (UInt32)-1);
|
||||
virtual plDISpanIndex& GetDISpans( UInt32 index ) const;
|
||||
virtual uint32_t AddDISpans( hsTArray<plGeometrySpan *> &spans, uint32_t index = (uint32_t)-1);
|
||||
virtual plDISpanIndex& GetDISpans( uint32_t index ) const;
|
||||
|
||||
// Data Access functions
|
||||
// Runtime
|
||||
hsPoint3& GetPosition(int spanIdx, int vtxIdx);
|
||||
hsVector3& GetNormal(int spanIdx, int vtxIdx);
|
||||
|
||||
UInt32 GetNumTris(int spanIdx);
|
||||
UInt16* GetIndexList(int spanIdx);
|
||||
uint32_t GetNumTris(int spanIdx);
|
||||
uint16_t* GetIndexList(int spanIdx);
|
||||
|
||||
// Conversion (before geometryspans get tossed (at write)).
|
||||
UInt32 CvtGetNumVerts(int spanIdx) const;
|
||||
uint32_t CvtGetNumVerts(int spanIdx) const;
|
||||
hsPoint3& CvtGetPosition(int spanIdx, int vtxIdx);
|
||||
hsVector3& CvtGetNormal(int spanIdx, int vtxIdx);
|
||||
|
||||
UInt32 CvtGetNumTris(int spanIdx);
|
||||
UInt16* CvtGetIndexList(int spanIdx);
|
||||
uint32_t CvtGetNumTris(int spanIdx);
|
||||
uint16_t* CvtGetIndexList(int spanIdx);
|
||||
|
||||
plGeometrySpan* GetGeometrySpan(int spanIdx);
|
||||
|
||||
/// DYNAMIC FUNCTIONS
|
||||
virtual void RemoveDISpans( UInt32 index );
|
||||
virtual UInt32 AppendDISpans( hsTArray<plGeometrySpan *> &spans, UInt32 index = (UInt32)-1, hsBool clearSpansAfterAdd = true, hsBool doNotAddToSource = false, hsBool addToFront = false, int lod = 0 );
|
||||
virtual UInt32 RefreshDISpans( UInt32 diIndex );
|
||||
virtual UInt32 RefreshSpan( UInt32 srcSpanIndex );
|
||||
virtual void RemoveDIMatrixSpans(UInt32 index);
|
||||
virtual UInt32 AppendDIMatrixSpans(int n);
|
||||
virtual UInt32 FindBoneBaseMatrix(const hsTArray<hsMatrix44>& initL2B, hsBool searchAll) const;
|
||||
virtual UInt32 NewDIMatrixIndex();
|
||||
void SortSpan( UInt32 index, plPipeline *pipe );
|
||||
void SortVisibleSpans(const hsTArray<Int16>& visList, plPipeline* pipe);
|
||||
void SortVisibleSpansPartial(const hsTArray<Int16>& visList, plPipeline* pipe);
|
||||
virtual void RemoveDISpans( uint32_t index );
|
||||
virtual uint32_t AppendDISpans( hsTArray<plGeometrySpan *> &spans, uint32_t index = (uint32_t)-1, hsBool clearSpansAfterAdd = true, hsBool doNotAddToSource = false, hsBool addToFront = false, int lod = 0 );
|
||||
virtual uint32_t RefreshDISpans( uint32_t diIndex );
|
||||
virtual uint32_t RefreshSpan( uint32_t srcSpanIndex );
|
||||
virtual void RemoveDIMatrixSpans(uint32_t index);
|
||||
virtual uint32_t AppendDIMatrixSpans(int n);
|
||||
virtual uint32_t FindBoneBaseMatrix(const hsTArray<hsMatrix44>& initL2B, hsBool searchAll) const;
|
||||
virtual uint32_t NewDIMatrixIndex();
|
||||
void SortSpan( uint32_t index, plPipeline *pipe );
|
||||
void SortVisibleSpans(const hsTArray<int16_t>& visList, plPipeline* pipe);
|
||||
void SortVisibleSpansPartial(const hsTArray<int16_t>& visList, plPipeline* pipe);
|
||||
void CleanUpGarbage( void ) { IRemoveGarbage(); }
|
||||
|
||||
/// Funky particle system functions
|
||||
virtual UInt32 CreateParticleSystem( UInt32 maxNumEmitters, UInt32 maxNumParticles, hsGMaterial *material );
|
||||
virtual void ResetParticleSystem( UInt32 index );
|
||||
virtual void AssignEmitterToParticleSystem( UInt32 index, plParticleEmitter *emitter );
|
||||
virtual uint32_t CreateParticleSystem( uint32_t maxNumEmitters, uint32_t maxNumParticles, hsGMaterial *material );
|
||||
virtual void ResetParticleSystem( uint32_t index );
|
||||
virtual void AssignEmitterToParticleSystem( uint32_t index, plParticleEmitter *emitter );
|
||||
|
||||
/// SceneViewer only!
|
||||
void GetOrigGeometrySpans( UInt32 diIndex, hsTArray<plGeometrySpan *> &arrayToFill );
|
||||
void ClearAndSetMaterialCount(UInt32 count);
|
||||
void GetOrigGeometrySpans( uint32_t diIndex, hsTArray<plGeometrySpan *> &arrayToFill );
|
||||
void ClearAndSetMaterialCount(uint32_t count);
|
||||
};
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDrawableSpans.h"
|
||||
#include "hsStream.h"
|
||||
#include "hsResMgr.h"
|
||||
@ -79,7 +79,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
void plDrawableSpans::Write( hsStream* s, hsResMgr* mgr )
|
||||
{
|
||||
UInt32 i, j, count;
|
||||
uint32_t i, j, count;
|
||||
|
||||
// Make sure we're optimized before we write (should be tho)
|
||||
// Optimize();
|
||||
@ -115,8 +115,8 @@ void plDrawableSpans::Write( hsStream* s, hsResMgr* mgr )
|
||||
s->WriteLE32( count );
|
||||
for( i = 0; i < count; i++ )
|
||||
{
|
||||
UInt8 *icicle = (UInt8 *)fSpans[ i ], *base = (UInt8 *)fIcicles.AcquireArray();
|
||||
j = (UInt32)( icicle - base ) / sizeof( plIcicle );
|
||||
uint8_t *icicle = (uint8_t *)fSpans[ i ], *base = (uint8_t *)fIcicles.AcquireArray();
|
||||
j = (uint32_t)( icicle - base ) / sizeof( plIcicle );
|
||||
s->WriteLE32( j );
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ void plDrawableSpans::Write( hsStream* s, hsResMgr* mgr )
|
||||
{
|
||||
if( fSpans[i]->fProps & plSpan::kPropHasPermaLights )
|
||||
{
|
||||
UInt32 lcnt = fSpans[i]->fPermaLights.GetCount();
|
||||
uint32_t lcnt = fSpans[i]->fPermaLights.GetCount();
|
||||
s->WriteLE32(lcnt);
|
||||
int j;
|
||||
for( j = 0; j < lcnt; j++ )
|
||||
@ -147,7 +147,7 @@ void plDrawableSpans::Write( hsStream* s, hsResMgr* mgr )
|
||||
}
|
||||
if( fSpans[i]->fProps & plSpan::kPropHasPermaProjs )
|
||||
{
|
||||
UInt32 lcnt = fSpans[i]->fPermaProjs.GetCount();
|
||||
uint32_t lcnt = fSpans[i]->fPermaProjs.GetCount();
|
||||
s->WriteLE32(lcnt);
|
||||
int j;
|
||||
for( j = 0; j < lcnt; j++ )
|
||||
@ -216,10 +216,10 @@ void plDrawableSpans::Write( hsStream* s, hsResMgr* mgr )
|
||||
// Adds a drawInterface's geometry spans to the list to be collapsed into
|
||||
// buffers.
|
||||
|
||||
UInt32 plDrawableSpans::AddDISpans( hsTArray<plGeometrySpan *> &spans, UInt32 index )
|
||||
uint32_t plDrawableSpans::AddDISpans( hsTArray<plGeometrySpan *> &spans, uint32_t index )
|
||||
{
|
||||
int i;
|
||||
UInt32 spanIdx;
|
||||
uint32_t spanIdx;
|
||||
plSpan *span;
|
||||
hsBounds3Ext bounds;
|
||||
|
||||
@ -228,11 +228,11 @@ UInt32 plDrawableSpans::AddDISpans( hsTArray<plGeometrySpan *> &spans, UInt32 i
|
||||
if( fNeedCleanup )
|
||||
IRemoveGarbage();
|
||||
|
||||
if (index == (UInt32)-1) // need a new one
|
||||
if (index == (uint32_t)-1) // need a new one
|
||||
{
|
||||
/// Create a lookup entry
|
||||
index = fDIIndices.GetCount();
|
||||
fDIIndices.Append( TRACKED_NEW plDISpanIndex );
|
||||
fDIIndices.Append( new plDISpanIndex );
|
||||
fDIIndices[ index ]->fFlags = plDISpanIndex::kNone;
|
||||
}
|
||||
plDISpanIndex *spanLookup = fDIIndices[ index ];
|
||||
@ -276,7 +276,7 @@ UInt32 plDrawableSpans::AddDISpans( hsTArray<plGeometrySpan *> &spans, UInt32 i
|
||||
span->fBaseMatrix = spans[ i ]->fBaseMatrix;
|
||||
span->fLocalUVWChans = spans[i]->fLocalUVWChans;
|
||||
span->fMaxBoneIdx = spans[i]->fMaxBoneIdx;
|
||||
span->fPenBoneIdx = (UInt16)(spans[i]->fPenBoneIdx);
|
||||
span->fPenBoneIdx = (uint16_t)(spans[i]->fPenBoneIdx);
|
||||
|
||||
bounds = spans[ i ]->fLocalBounds;
|
||||
span->fLocalBounds = bounds;
|
||||
@ -382,13 +382,13 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
|
||||
if( geo->fProps & plGeometrySpan::kFirstInstance )
|
||||
{
|
||||
plGBufferCell* cell = group->GetCell(span->fVBufferIdx, span->fCellIdx);
|
||||
UInt32 stride = group->GetVertexSize();
|
||||
UInt32 ptr = cell->fVtxStart + span->fCellOffset * stride;
|
||||
uint32_t stride = group->GetVertexSize();
|
||||
uint32_t ptr = cell->fVtxStart + span->fCellOffset * stride;
|
||||
|
||||
statusLog->AddLineF("From obj <%s> mat <%s> size %d bytes grp=%d (%d offset)",
|
||||
geo->fMaxOwner ? geo->fMaxOwner : "<unknown>",
|
||||
geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
|
||||
geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(UInt16) * geo->fNumIndices,
|
||||
geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices,
|
||||
span->fGroupIdx,
|
||||
ptr
|
||||
);
|
||||
@ -425,7 +425,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
|
||||
statusLog->AddLineF("From obj <%s> mat <%s> size %d bytes grp=%d (%d/%d/%d/%d/%d)",
|
||||
geo->fMaxOwner ? geo->fMaxOwner : "<unknown>",
|
||||
geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
|
||||
geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(UInt16) * geo->fNumIndices,
|
||||
geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices,
|
||||
span->fGroupIdx,
|
||||
span->fVBufferIdx,
|
||||
span->fCellIdx,
|
||||
@ -611,10 +611,10 @@ void plDrawableSpans::IPackSourceSpans( void )
|
||||
|
||||
void plDrawableSpans::ISortSourceSpans( void )
|
||||
{
|
||||
hsTArray<UInt32> spanReorderTable, spanInverseTable;
|
||||
hsTArray<uint32_t> spanReorderTable, spanInverseTable;
|
||||
int i, j, idx;
|
||||
plGeometrySpan *tmpSpan;
|
||||
UInt32 tmpIdx;
|
||||
uint32_t tmpIdx;
|
||||
plSpan *tmpSpanPtr;
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDynaBulletMgr.h"
|
||||
#include "plDynaDecal.h"
|
||||
|
||||
@ -65,7 +65,7 @@ static plRandom sRand;
|
||||
int plDynaBulletMgr::INewDecal()
|
||||
{
|
||||
int idx = fDecals.GetCount();
|
||||
fDecals.Append(TRACKED_NEW plDynaSplot());
|
||||
fDecals.Append(new plDynaSplot());
|
||||
|
||||
return idx;
|
||||
}
|
||||
@ -103,7 +103,7 @@ hsBool plDynaBulletMgr::IHandleShot(plBulletMsg* bull)
|
||||
fCutter->SetLength(hsVector3(bull->Radius() * fScale.fX, bull->Radius() * fScale.fY, bull->Range()));
|
||||
fCutter->Set(pos, up, -bull->Dir());
|
||||
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(this), GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(this), GetKey());
|
||||
|
||||
if( bull->PartyTime() > 0 )
|
||||
fPartyTime = bull->PartyTime();
|
||||
|
@ -40,14 +40,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include "plDynaDecal.h"
|
||||
#include "plAuxSpan.h"
|
||||
|
||||
hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
hsBool plDynaSplot::Age(double t, float ramp, float decay, float life)
|
||||
{
|
||||
hsScalar age = hsScalar(t - fBirth);
|
||||
float age = float(t - fBirth);
|
||||
if( age >= life )
|
||||
return true;
|
||||
|
||||
@ -55,7 +55,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
if( !n )
|
||||
return true;
|
||||
|
||||
hsScalar atten = fInitAtten;
|
||||
float atten = fInitAtten;
|
||||
if( age < ramp )
|
||||
{
|
||||
atten *= age / ramp;
|
||||
@ -83,7 +83,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
|
||||
while( n-- )
|
||||
{
|
||||
UInt32 diff = UInt32(origUVW->fZ * atten * 255.99f);
|
||||
uint32_t diff = uint32_t(origUVW->fZ * atten * 255.99f);
|
||||
vtx->fDiffuse = 0xff000000
|
||||
| (diff << 16)
|
||||
| (diff << 8)
|
||||
@ -98,13 +98,13 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
{
|
||||
const int stride = sizeof(plDecalVtxFormat);
|
||||
|
||||
hsScalar* sPtr = &origUVW->fZ;
|
||||
float* sPtr = &origUVW->fZ;
|
||||
|
||||
unsigned char* alpha = (unsigned char*)&fVtxBase->fDiffuse;
|
||||
alpha += 3;
|
||||
while( n-- )
|
||||
{
|
||||
hsScalar initOpac = *sPtr;
|
||||
float initOpac = *sPtr;
|
||||
*alpha = (unsigned char)(initOpac * atten * 255.99f);
|
||||
|
||||
alpha += stride;
|
||||
@ -113,7 +113,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
}
|
||||
else
|
||||
{
|
||||
hsScalar* sPtr = &origUVW->fZ;
|
||||
float* sPtr = &origUVW->fZ;
|
||||
|
||||
char* oPtr = (char*)&fVtxBase->fUVW[1].fX;
|
||||
|
||||
@ -121,7 +121,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
|
||||
while( n-- )
|
||||
{
|
||||
(*(hsScalar*)oPtr) = *sPtr * atten;
|
||||
(*(float*)oPtr) = *sPtr * atten;
|
||||
|
||||
oPtr += stride;
|
||||
sPtr += 3;
|
||||
@ -130,9 +130,9 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
hsBool plDynaRipple::Age(double t, float ramp, float decay, float life)
|
||||
{
|
||||
hsScalar age = hsScalar(t - fBirth);
|
||||
float age = float(t - fBirth);
|
||||
if( age >= life )
|
||||
return true;
|
||||
|
||||
@ -140,7 +140,7 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
if( !n )
|
||||
return true;
|
||||
|
||||
hsScalar atten = fInitAtten;
|
||||
float atten = fInitAtten;
|
||||
if( age < ramp )
|
||||
{
|
||||
atten *= age / ramp;
|
||||
@ -150,8 +150,8 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
atten *= (life - age) / (life - decay);
|
||||
}
|
||||
|
||||
hsScalar scaleU = fC1U / (age*fC2U + 1.f);
|
||||
hsScalar scaleV = fC1V / (age*fC2V + 1.f);
|
||||
float scaleU = fC1U / (age*fC2U + 1.f);
|
||||
float scaleV = fC1V / (age*fC2V + 1.f);
|
||||
|
||||
hsPoint3* origUVW = &fAuxSpan->fOrigUVW[fStartVtx];
|
||||
|
||||
@ -161,7 +161,7 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
|
||||
while( n-- )
|
||||
{
|
||||
UInt32 diff = UInt32(origUVW->fZ * atten * 255.99f);
|
||||
uint32_t diff = uint32_t(origUVW->fZ * atten * 255.99f);
|
||||
vtx->fDiffuse = 0xff000000
|
||||
| (diff << 16)
|
||||
| (diff << 8)
|
||||
@ -210,9 +210,9 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
hsBool plDynaWake::Age(double t, float ramp, float decay, float life)
|
||||
{
|
||||
hsScalar age = hsScalar(t - fBirth);
|
||||
float age = float(t - fBirth);
|
||||
if( age >= life )
|
||||
return true;
|
||||
|
||||
@ -220,7 +220,7 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
if( !n )
|
||||
return true;
|
||||
|
||||
hsScalar atten = fInitAtten;
|
||||
float atten = fInitAtten;
|
||||
if( age < ramp )
|
||||
{
|
||||
atten *= age / ramp;
|
||||
@ -230,8 +230,8 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
atten *= (life - age) / (life - decay);
|
||||
}
|
||||
|
||||
hsScalar scaleU = fC1U / (age*fC2U + 1.f);
|
||||
hsScalar scaleV = fC1V / (age*fC2V + 1.f);
|
||||
float scaleU = fC1U / (age*fC2U + 1.f);
|
||||
float scaleV = fC1V / (age*fC2V + 1.f);
|
||||
|
||||
hsPoint3* origUVW = &fAuxSpan->fOrigUVW[fStartVtx];
|
||||
|
||||
@ -241,7 +241,7 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
|
||||
while( n-- )
|
||||
{
|
||||
UInt32 diff = UInt32(origUVW->fZ * atten * 255.99f);
|
||||
uint32_t diff = uint32_t(origUVW->fZ * atten * 255.99f);
|
||||
vtx->fDiffuse = 0xff000000
|
||||
| (diff << 16)
|
||||
| (diff << 8)
|
||||
@ -290,9 +290,9 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
hsBool plDynaWave::Age(double t, float ramp, float decay, float life)
|
||||
{
|
||||
hsScalar age = hsScalar(t - fBirth);
|
||||
float age = float(t - fBirth);
|
||||
if( age >= life )
|
||||
return true;
|
||||
|
||||
@ -300,7 +300,7 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
if( !n )
|
||||
return true;
|
||||
|
||||
hsScalar atten = fInitAtten;
|
||||
float atten = fInitAtten;
|
||||
if( age < ramp )
|
||||
{
|
||||
atten *= age / ramp;
|
||||
@ -310,8 +310,8 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
atten *= (life - age) / (life - decay);
|
||||
}
|
||||
|
||||
hsScalar scale = 1.f + life * fScrollRate;
|
||||
hsScalar scroll = -fScrollRate * age;
|
||||
float scale = 1.f + life * fScrollRate;
|
||||
float scroll = -fScrollRate * age;
|
||||
|
||||
hsPoint3* origUVW = &fAuxSpan->fOrigUVW[fStartVtx];
|
||||
|
||||
@ -321,7 +321,7 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
|
||||
while( n-- )
|
||||
{
|
||||
UInt32 diff = UInt32(origUVW->fZ * atten * 255.99f);
|
||||
uint32_t diff = uint32_t(origUVW->fZ * atten * 255.99f);
|
||||
vtx->fDiffuse = 0xff000000
|
||||
| (diff << 16)
|
||||
| (diff << 8)
|
||||
@ -370,9 +370,9 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool plDynaRippleVS::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life)
|
||||
hsBool plDynaRippleVS::Age(double t, float ramp, float decay, float life)
|
||||
{
|
||||
hsScalar age = hsScalar(t - fBirth);
|
||||
float age = float(t - fBirth);
|
||||
if( age >= life )
|
||||
return true;
|
||||
|
||||
|
@ -54,14 +54,14 @@ class plDecalVtxFormat
|
||||
public:
|
||||
hsPoint3 fPos;
|
||||
hsVector3 fNorm;
|
||||
UInt32 fDiffuse;
|
||||
UInt32 fSpecular; // Not used anywhere, carried around everywhere.
|
||||
uint32_t fDiffuse;
|
||||
uint32_t fSpecular; // Not used anywhere, carried around everywhere.
|
||||
hsPoint3 fUVW[2];
|
||||
};
|
||||
|
||||
// UVW[0] is the currently used UVW.
|
||||
// UVW[1] is for the alpha hack (when necessary).
|
||||
const UInt8 kDecalVtxFormat = 0x2; // Two UVW's, otherwise vanilla.
|
||||
const uint8_t kDecalVtxFormat = 0x2; // Two UVW's, otherwise vanilla.
|
||||
|
||||
|
||||
class plDynaDecal
|
||||
@ -78,14 +78,14 @@ protected:
|
||||
// StartVtx and StartIdx are relative to the start of the data
|
||||
// owned by this decal's span, not relative to the start of the
|
||||
// underlying buffers.
|
||||
UInt16 fStartVtx;
|
||||
UInt16 fNumVerts;
|
||||
uint16_t fStartVtx;
|
||||
uint16_t fNumVerts;
|
||||
|
||||
UInt16 fStartIdx;
|
||||
UInt16 fNumIdx;
|
||||
uint16_t fStartIdx;
|
||||
uint16_t fNumIdx;
|
||||
|
||||
double fBirth;
|
||||
hsScalar fInitAtten;
|
||||
float fInitAtten;
|
||||
hsBool fFlags;
|
||||
|
||||
plDecalVtxFormat* fVtxBase; // Safe pointer, the buffer data will outlive this decal
|
||||
@ -95,7 +95,7 @@ protected:
|
||||
friend class plDynaDecalMgr;
|
||||
public:
|
||||
|
||||
virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) = 0;
|
||||
virtual hsBool Age(double t, float ramp, float decay, float life) = 0;
|
||||
};
|
||||
|
||||
// No expansion
|
||||
@ -105,7 +105,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life);
|
||||
virtual hsBool Age(double t, float ramp, float decay, float life);
|
||||
};
|
||||
|
||||
// Expands radially from center
|
||||
@ -113,13 +113,13 @@ class plDynaRipple : public plDynaDecal
|
||||
{
|
||||
public:
|
||||
|
||||
virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life);
|
||||
virtual hsBool Age(double t, float ramp, float decay, float life);
|
||||
|
||||
hsScalar fC1U;
|
||||
hsScalar fC2U;
|
||||
float fC1U;
|
||||
float fC2U;
|
||||
|
||||
hsScalar fC1V;
|
||||
hsScalar fC2V;
|
||||
float fC1V;
|
||||
float fC2V;
|
||||
|
||||
};
|
||||
|
||||
@ -128,13 +128,13 @@ class plDynaWake : public plDynaDecal
|
||||
{
|
||||
public:
|
||||
|
||||
virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life);
|
||||
virtual hsBool Age(double t, float ramp, float decay, float life);
|
||||
|
||||
hsScalar fC1U;
|
||||
hsScalar fC2U;
|
||||
float fC1U;
|
||||
float fC2U;
|
||||
|
||||
hsScalar fC1V;
|
||||
hsScalar fC2V;
|
||||
float fC1V;
|
||||
float fC2V;
|
||||
|
||||
};
|
||||
|
||||
@ -143,9 +143,9 @@ class plDynaWave : public plDynaDecal
|
||||
{
|
||||
public:
|
||||
|
||||
virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life);
|
||||
virtual hsBool Age(double t, float ramp, float decay, float life);
|
||||
|
||||
hsScalar fScrollRate;
|
||||
float fScrollRate;
|
||||
};
|
||||
|
||||
// About the same as a DynaRipple, but implemented with vertex/pixel shaders.
|
||||
@ -154,7 +154,7 @@ class plDynaRippleVS : public plDynaRipple
|
||||
{
|
||||
public:
|
||||
|
||||
virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life);
|
||||
virtual hsBool Age(double t, float ramp, float decay, float life);
|
||||
};
|
||||
|
||||
#endif // plDynaDecal_inc
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDynaDecalMgr.h"
|
||||
#include "plDynaDecal.h"
|
||||
|
||||
@ -107,14 +107,14 @@ plProfile_CreateTimerNoReset("Callback", "DynaDecal", Callback);
|
||||
|
||||
static plRandom sRand;
|
||||
static const int kBinBlockSize = 20;
|
||||
static const UInt16 kDefMaxNumVerts = 1000;
|
||||
static const UInt16 kDefMaxNumIdx = kDefMaxNumVerts;
|
||||
static const uint16_t kDefMaxNumVerts = 1000;
|
||||
static const uint16_t kDefMaxNumIdx = kDefMaxNumVerts;
|
||||
|
||||
static const hsScalar kDefLifeSpan = 30.f;
|
||||
static const hsScalar kDefDecayStart = kDefLifeSpan * 0.5f;
|
||||
static const hsScalar kDefRampEnd = kDefLifeSpan * 0.1f;
|
||||
static const float kDefLifeSpan = 30.f;
|
||||
static const float kDefDecayStart = kDefLifeSpan * 0.5f;
|
||||
static const float kDefRampEnd = kDefLifeSpan * 0.1f;
|
||||
|
||||
static const hsScalar kInitAuxSpans = 5;
|
||||
static const float kInitAuxSpans = 5;
|
||||
|
||||
#define MF_NO_INIT_ALLOC
|
||||
#define MF_NEVER_RUN_OUT
|
||||
@ -153,7 +153,7 @@ plDynaDecalMgr::plDynaDecalMgr()
|
||||
fScale(1.f, 1.f, 1.f),
|
||||
fPartyTime(1.f)
|
||||
{
|
||||
fCutter = TRACKED_NEW plCutter;
|
||||
fCutter = new plCutter;
|
||||
}
|
||||
|
||||
plDynaDecalMgr::~plDynaDecalMgr()
|
||||
@ -194,25 +194,25 @@ void plDynaDecalMgr::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plSynchedObject::Read(stream, mgr);
|
||||
|
||||
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatPreShade), plRefFlags::kActiveRef);
|
||||
mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatPreShade), plRefFlags::kActiveRef);
|
||||
|
||||
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatRTShade), plRefFlags::kActiveRef);
|
||||
mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatRTShade), plRefFlags::kActiveRef);
|
||||
|
||||
int n = stream->ReadLE32();
|
||||
int i;
|
||||
for( i = 0; i < n; i++ )
|
||||
{
|
||||
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefTarget), plRefFlags::kPassiveRef);
|
||||
mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefTarget), plRefFlags::kPassiveRef);
|
||||
}
|
||||
// Associated slave particle systems. We read in the scene objects now, and find the associated systems on loaded message.
|
||||
n = stream->ReadLE32();
|
||||
for( i = 0; i < n; i++ )
|
||||
{
|
||||
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefPartyObject), plRefFlags::kPassiveRef);
|
||||
mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefPartyObject), plRefFlags::kPassiveRef);
|
||||
}
|
||||
|
||||
fMaxNumVerts = (UInt16)(stream->ReadLE32());
|
||||
fMaxNumIdx = (UInt16)(stream->ReadLE32());
|
||||
fMaxNumVerts = (uint16_t)(stream->ReadLE32());
|
||||
fMaxNumIdx = (uint16_t)(stream->ReadLE32());
|
||||
|
||||
fWaitOnEnable = stream->ReadLE32();
|
||||
|
||||
@ -321,7 +321,7 @@ const plPrintShape* plDynaDecalMgr::IGetPrintShape(const plKey& objKey) const
|
||||
return shape;
|
||||
}
|
||||
|
||||
const plPrintShape* plDynaDecalMgr::IGetPrintShape(plArmatureMod* avMod, UInt32 id) const
|
||||
const plPrintShape* plDynaDecalMgr::IGetPrintShape(plArmatureMod* avMod, uint32_t id) const
|
||||
{
|
||||
const plPrintShape* shape = nil;
|
||||
const plSceneObject* part = avMod->FindBone(id);
|
||||
@ -348,12 +348,12 @@ hsBool plDynaDecalMgr::IWetParts(const plDynaDecalEnableMsg* enaMsg)
|
||||
const plPrintShape* shape = IGetPrintShape(enaMsg->GetShapeKey());
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey());
|
||||
IWetInfo(info, enaMsg);
|
||||
}
|
||||
}
|
||||
else
|
||||
if( enaMsg->GetID() == UInt32(-1) )
|
||||
if( enaMsg->GetID() == uint32_t(-1) )
|
||||
{
|
||||
plArmatureMod* avMod = plArmatureMod::ConvertNoRef(enaMsg->GetArmKey()->ObjectIsLoaded());
|
||||
int i;
|
||||
@ -362,7 +362,7 @@ hsBool plDynaDecalMgr::IWetParts(const plDynaDecalEnableMsg* enaMsg)
|
||||
const plPrintShape* shape = IGetPrintShape(avMod, fPartIDs[i]);
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey());
|
||||
IWetInfo(info, enaMsg);
|
||||
}
|
||||
}
|
||||
@ -374,14 +374,14 @@ hsBool plDynaDecalMgr::IWetParts(const plDynaDecalEnableMsg* enaMsg)
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool plDynaDecalMgr::IWetPart(UInt32 id, const plDynaDecalEnableMsg* enaMsg)
|
||||
hsBool plDynaDecalMgr::IWetPart(uint32_t id, const plDynaDecalEnableMsg* enaMsg)
|
||||
{
|
||||
plArmatureMod* avMod = plArmatureMod::ConvertNoRef(enaMsg->GetArmKey()->ObjectIsLoaded());
|
||||
|
||||
const plPrintShape* shape = IGetPrintShape(avMod, id);
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey());
|
||||
IWetInfo(info, enaMsg);
|
||||
}
|
||||
return true;
|
||||
@ -484,7 +484,7 @@ hsBool plDynaDecalMgr::MsgReceive(plMessage* msg)
|
||||
return true;
|
||||
case kRefAvatar:
|
||||
if( refMsg->GetContext() & (plRefMsg::kOnRemove|plRefMsg::kOnDestroy) )
|
||||
IRemoveDecalInfo(unsigned_ptr(refMsg->GetRef()));
|
||||
IRemoveDecalInfo(uintptr_t(refMsg->GetRef()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -494,7 +494,7 @@ hsBool plDynaDecalMgr::MsgReceive(plMessage* msg)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void plDynaDecalMgr::INotifyActive(plDynaDecalInfo& info, const plKey& armKey, UInt32 id) const
|
||||
void plDynaDecalMgr::INotifyActive(plDynaDecalInfo& info, const plKey& armKey, uint32_t id) const
|
||||
{
|
||||
if( !(info.fFlags & plDynaDecalInfo::kActive) )
|
||||
{
|
||||
@ -502,14 +502,14 @@ void plDynaDecalMgr::INotifyActive(plDynaDecalInfo& info, const plKey& armKey, U
|
||||
int i;
|
||||
for( i = 0; i < fNotifies.GetCount(); i++ )
|
||||
{
|
||||
plDynaDecalEnableMsg* enaMsg = TRACKED_NEW plDynaDecalEnableMsg(fNotifies[i], armKey, secs, fWetLength, false, id);
|
||||
plDynaDecalEnableMsg* enaMsg = new plDynaDecalEnableMsg(fNotifies[i], armKey, secs, fWetLength, false, id);
|
||||
enaMsg->Send();
|
||||
}
|
||||
info.fFlags |= plDynaDecalInfo::kActive;
|
||||
}
|
||||
}
|
||||
|
||||
void plDynaDecalMgr::INotifyInactive(plDynaDecalInfo& info, const plKey& armKey, UInt32 id) const
|
||||
void plDynaDecalMgr::INotifyInactive(plDynaDecalInfo& info, const plKey& armKey, uint32_t id) const
|
||||
{
|
||||
if( info.fFlags & plDynaDecalInfo::kActive )
|
||||
{
|
||||
@ -517,7 +517,7 @@ void plDynaDecalMgr::INotifyInactive(plDynaDecalInfo& info, const plKey& armKey,
|
||||
int i;
|
||||
for( i = 0; i < fNotifies.GetCount(); i++ )
|
||||
{
|
||||
plDynaDecalEnableMsg* enaMsg = TRACKED_NEW plDynaDecalEnableMsg(fNotifies[i], armKey, secs, fWetLength, true, id);
|
||||
plDynaDecalEnableMsg* enaMsg = new plDynaDecalEnableMsg(fNotifies[i], armKey, secs, fWetLength, true, id);
|
||||
enaMsg->Send();
|
||||
}
|
||||
info.fFlags &= ~plDynaDecalInfo::kActive;
|
||||
@ -537,14 +537,14 @@ plDynaDecalInfo& plDynaDecalInfo::Init(const plKey& key)
|
||||
return *this;
|
||||
}
|
||||
|
||||
plDynaDecalInfo& plDynaDecalMgr::IGetDecalInfo(unsigned_ptr id, const plKey& key)
|
||||
plDynaDecalInfo& plDynaDecalMgr::IGetDecalInfo(uintptr_t id, const plKey& key)
|
||||
{
|
||||
plDynaDecalMap::iterator iter = fDecalMap.find(id);
|
||||
if( iter == fDecalMap.end() )
|
||||
{
|
||||
plDynaDecalInfo decalInfo;
|
||||
decalInfo.Init(key);
|
||||
plGenRefMsg* refMsg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefAvatar);
|
||||
plGenRefMsg* refMsg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefAvatar);
|
||||
hsgResMgr::ResMgr()->AddViaNotify(plKey(key), refMsg, plRefFlags::kPassiveRef);
|
||||
|
||||
pair<plDynaDecalMap::iterator, bool> iterPair;
|
||||
@ -555,7 +555,7 @@ plDynaDecalInfo& plDynaDecalMgr::IGetDecalInfo(unsigned_ptr id, const plKey& key
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
void plDynaDecalMgr::IRemoveDecalInfo(UInt32 id)
|
||||
void plDynaDecalMgr::IRemoveDecalInfo(uint32_t id)
|
||||
{
|
||||
plDynaDecalMap::iterator iter = fDecalMap.find(id);
|
||||
if( iter != fDecalMap.end() )
|
||||
@ -582,7 +582,7 @@ void plDynaDecalMgr::IRemoveDecalInfos(const plKey& key)
|
||||
}
|
||||
}
|
||||
|
||||
hsScalar plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const
|
||||
float plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const
|
||||
{
|
||||
// We aren't playing this wet/dry/enable/disable thing.
|
||||
if( !fWaitOnEnable )
|
||||
@ -601,7 +601,7 @@ hsScalar plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const
|
||||
return 0;
|
||||
|
||||
// We're wet, let's see how wet.
|
||||
hsScalar wet = (hsScalar)(1.f - (t - info.fWetTime) / info.fWetLength);
|
||||
float wet = (float)(1.f - (t - info.fWetTime) / info.fWetLength);
|
||||
if( wet > 1.f ) // This should never happen. It means t < info.fWetTime (we get wet in the future).
|
||||
return fIntensity;
|
||||
if( wet < 0 )
|
||||
@ -613,7 +613,7 @@ hsScalar plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
plAuxSpan* plDynaDecalMgr::IGetAuxSpan(plDrawableSpans* targ, int iSpan, hsGMaterial* mat, UInt16 numVerts, UInt16 numIdx)
|
||||
plAuxSpan* plDynaDecalMgr::IGetAuxSpan(plDrawableSpans* targ, int iSpan, hsGMaterial* mat, uint16_t numVerts, uint16_t numIdx)
|
||||
{
|
||||
// Some of this code just assumes you get the number of verts you ask for.
|
||||
// Which was causing errors when you asked for more than the max and didn't
|
||||
@ -688,7 +688,7 @@ plAuxSpan* plDynaDecalMgr::IGetAuxSpan(plDrawableSpans* targ, int iSpan, hsGMate
|
||||
|
||||
#ifdef MF_NEVER_RUN_OUT
|
||||
// Okay, nothing there. Let's get a new one.
|
||||
plAuxSpan* aux = TRACKED_NEW plAuxSpan;
|
||||
plAuxSpan* aux = new plAuxSpan;
|
||||
fAuxSpans.Append(aux);
|
||||
|
||||
IAllocAuxSpan(aux, numVerts, numIdx);
|
||||
@ -712,16 +712,16 @@ void plDynaDecalMgr::InitAuxSpans()
|
||||
int i;
|
||||
for( i = 0; i < kInitAuxSpans; i++ )
|
||||
{
|
||||
plAuxSpan* aux = TRACKED_NEW plAuxSpan;
|
||||
plAuxSpan* aux = new plAuxSpan;
|
||||
fAuxSpans.Append(aux);
|
||||
IAllocAuxSpan(aux, fMaxNumVerts, fMaxNumIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void plDynaDecalMgr::IAllocAuxSpan(plAuxSpan* aux, UInt32 maxNumVerts, UInt32 maxNumIdx)
|
||||
void plDynaDecalMgr::IAllocAuxSpan(plAuxSpan* aux, uint32_t maxNumVerts, uint32_t maxNumIdx)
|
||||
{
|
||||
int iGrp = fGroups.GetCount();
|
||||
plGBufferGroup* grp = TRACKED_NEW plGBufferGroup(kDecalVtxFormat, true, false);
|
||||
plGBufferGroup* grp = new plGBufferGroup(kDecalVtxFormat, true, false);
|
||||
fGroups.Append(grp);
|
||||
|
||||
grp->ReserveVertStorage(maxNumVerts,
|
||||
@ -735,7 +735,7 @@ void plDynaDecalMgr::IAllocAuxSpan(plAuxSpan* aux, UInt32 maxNumVerts, UInt32 ma
|
||||
aux->fVStartIdx = grp->GetVertStartFromCell(aux->fVBufferIdx, aux->fCellIdx, aux->fCellOffset);
|
||||
aux->fVLength = 0;
|
||||
|
||||
UInt16* dataPtr = nil;
|
||||
uint16_t* dataPtr = nil;
|
||||
grp->ReserveIndexStorage(maxNumIdx, &aux->fIBufferIdx, &aux->fIStartIdx, &dataPtr);
|
||||
aux->fIStartIdx;
|
||||
|
||||
@ -816,13 +816,13 @@ hsGMaterial* plDynaDecalMgr::ISetAuxMaterial(plAuxSpan* aux, hsGMaterial* mat, h
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
plDynaDecal* plDynaDecalMgr::IInitDecal(plAuxSpan* aux, double t, UInt16 numVerts, UInt16 numIdx)
|
||||
plDynaDecal* plDynaDecalMgr::IInitDecal(plAuxSpan* aux, double t, uint16_t numVerts, uint16_t numIdx)
|
||||
{
|
||||
int idx = INewDecal();
|
||||
|
||||
fDecals[idx]->fStartVtx = (UInt16)(aux->fVStartIdx + aux->fVLength);
|
||||
fDecals[idx]->fStartVtx = (uint16_t)(aux->fVStartIdx + aux->fVLength);
|
||||
fDecals[idx]->fNumVerts = numVerts;
|
||||
fDecals[idx]->fStartIdx = (UInt16)(aux->fIStartIdx + aux->fILength);
|
||||
fDecals[idx]->fStartIdx = (uint16_t)(aux->fIStartIdx + aux->fILength);
|
||||
fDecals[idx]->fNumIdx = numIdx;
|
||||
|
||||
fDecals[idx]->fBirth = t;
|
||||
@ -931,7 +931,7 @@ void plDynaDecalMgr::IUpdateDecals(double t)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void plDynaDecalMgr::ICountIncoming(hsTArray<plCutoutPoly>& src, UInt16& numVerts, UInt16& numIdx) const
|
||||
void plDynaDecalMgr::ICountIncoming(hsTArray<plCutoutPoly>& src, uint16_t& numVerts, uint16_t& numIdx) const
|
||||
{
|
||||
numVerts = 0;
|
||||
numIdx = 0;
|
||||
@ -952,7 +952,7 @@ plDecalVtxFormat* plDynaDecalMgr::IGetBaseVtxPtr(const plAuxSpan* auxSpan) const
|
||||
plGBufferGroup* grp = auxSpan->fGroup;
|
||||
plGBufferCell* cell = grp->GetCell(auxSpan->fVBufferIdx, auxSpan->fCellIdx);
|
||||
|
||||
UInt8* ptr = grp->GetVertBufferData(auxSpan->fVBufferIdx);
|
||||
uint8_t* ptr = grp->GetVertBufferData(auxSpan->fVBufferIdx);
|
||||
|
||||
ptr += cell->fVtxStart + auxSpan->fCellOffset;
|
||||
|
||||
@ -960,7 +960,7 @@ plDecalVtxFormat* plDynaDecalMgr::IGetBaseVtxPtr(const plAuxSpan* auxSpan) const
|
||||
|
||||
}
|
||||
|
||||
UInt16* plDynaDecalMgr::IGetBaseIdxPtr(const plAuxSpan* auxSpan) const
|
||||
uint16_t* plDynaDecalMgr::IGetBaseIdxPtr(const plAuxSpan* auxSpan) const
|
||||
{
|
||||
plGBufferGroup* grp = auxSpan->fGroup;
|
||||
|
||||
@ -978,7 +978,7 @@ hsBool plDynaDecalMgr::IConvertFlatGrid(plAuxSpan* auxSpan,
|
||||
hsPoint3* origPos = &auxSpan->fOrigPos[decal->fStartVtx];
|
||||
hsPoint3* origUVW = &auxSpan->fOrigUVW[decal->fStartVtx];
|
||||
|
||||
UInt32 initColor = decal->fFlags & plDynaDecal::kAttenColor
|
||||
uint32_t initColor = decal->fFlags & plDynaDecal::kAttenColor
|
||||
? 0xff000000
|
||||
: 0x00ffffff;
|
||||
int iv;
|
||||
@ -1001,12 +1001,12 @@ hsBool plDynaDecalMgr::IConvertFlatGrid(plAuxSpan* auxSpan,
|
||||
origUVW++;
|
||||
}
|
||||
|
||||
UInt16* idx = IGetBaseIdxPtr(auxSpan);
|
||||
uint16_t* idx = IGetBaseIdxPtr(auxSpan);
|
||||
idx += decal->fStartIdx;
|
||||
|
||||
hsAssert(grid.fIdx.GetCount() == decal->fNumIdx, "Mismatch on dynamic indices");
|
||||
|
||||
UInt16 base = decal->fStartVtx;
|
||||
uint16_t base = decal->fStartVtx;
|
||||
int ii;
|
||||
for( ii = 0; ii < grid.fIdx.GetCount(); ii++ )
|
||||
{
|
||||
@ -1024,14 +1024,14 @@ hsBool plDynaDecalMgr::IConvertFlatGrid(plAuxSpan* auxSpan,
|
||||
|
||||
void plDynaDecalMgr::ISetDepthFalloff()
|
||||
{
|
||||
const hsScalar totalDepth = fCutter->GetLengthW();
|
||||
const float totalDepth = fCutter->GetLengthW();
|
||||
|
||||
// Currently all constants, but these could be set per DecalMgr.
|
||||
plConst(hsScalar) kMinFeet(3.f);
|
||||
plConst(hsScalar) kMaxFeet(10.f);
|
||||
plConst(float) kMinFeet(3.f);
|
||||
plConst(float) kMaxFeet(10.f);
|
||||
|
||||
plConst(hsScalar) kMinDepth(0.25f);
|
||||
plConst(hsScalar) kMaxDepth(0.75f);
|
||||
plConst(float) kMinDepth(0.25f);
|
||||
plConst(float) kMaxDepth(0.75f);
|
||||
|
||||
fMinDepth = kMinFeet / totalDepth;
|
||||
if( fMinDepth > kMinDepth )
|
||||
@ -1099,15 +1099,15 @@ hsBool plDynaDecalMgr::IConvertPolysAlpha(plAuxSpan* auxSpan,
|
||||
|
||||
hsColorRGBA col = src[iPoly].fVerts[iVert].fColor;
|
||||
|
||||
hsScalar depth = vtx->fUVW[0].fZ;
|
||||
float depth = vtx->fUVW[0].fZ;
|
||||
|
||||
hsScalar opac = depth < fMinDepth
|
||||
float opac = depth < fMinDepth
|
||||
? depth * fMinDepthRange
|
||||
: depth > fMaxDepth
|
||||
? (1.f - depth) * fMaxDepthRange
|
||||
: 1.f;
|
||||
|
||||
hsScalar normOpac = 1.f - vtx->fNorm.InnerProduct(backDir);
|
||||
float normOpac = 1.f - vtx->fNorm.InnerProduct(backDir);
|
||||
opac *= 1.f - normOpac * normOpac;
|
||||
if( opac < 0 )
|
||||
opac = 0;
|
||||
@ -1137,14 +1137,14 @@ hsBool plDynaDecalMgr::IConvertPolysAlpha(plAuxSpan* auxSpan,
|
||||
}
|
||||
hsAssert(vtx <= IGetBaseVtxPtr(auxSpan) + auxSpan->fVBufferLimit, "Vtx pointer gone wild");
|
||||
|
||||
UInt16* idx = IGetBaseIdxPtr(auxSpan);
|
||||
uint16_t* idx = IGetBaseIdxPtr(auxSpan);
|
||||
idx += decal->fStartIdx;
|
||||
|
||||
UInt16 base = decal->fStartVtx;
|
||||
uint16_t base = decal->fStartVtx;
|
||||
int j;
|
||||
for( j = 0; j < src.GetCount(); j++ )
|
||||
{
|
||||
UInt16 next = base+1;
|
||||
uint16_t next = base+1;
|
||||
int k;
|
||||
for( k = 2; k < src[j].fVerts.GetCount(); k++ )
|
||||
{
|
||||
@ -1197,14 +1197,14 @@ hsBool plDynaDecalMgr::IConvertPolysColor(plAuxSpan* auxSpan,
|
||||
else
|
||||
hiV = true;
|
||||
|
||||
hsScalar depth = vtx->fUVW[0].fZ;
|
||||
hsScalar opac = depth < fMinDepth
|
||||
float depth = vtx->fUVW[0].fZ;
|
||||
float opac = depth < fMinDepth
|
||||
? depth * fMinDepthRange
|
||||
: depth > fMaxDepth
|
||||
? (1.f - depth) * fMaxDepthRange
|
||||
: 1.f;
|
||||
|
||||
hsScalar normOpac = 1.f - vtx->fNorm.InnerProduct(backDir);
|
||||
float normOpac = 1.f - vtx->fNorm.InnerProduct(backDir);
|
||||
opac *= 1.f - normOpac * normOpac;
|
||||
if( opac < 0 )
|
||||
opac = 0;
|
||||
@ -1230,14 +1230,14 @@ hsBool plDynaDecalMgr::IConvertPolysColor(plAuxSpan* auxSpan,
|
||||
}
|
||||
hsAssert(vtx <= IGetBaseVtxPtr(auxSpan) + auxSpan->fVBufferLimit, "Vtx pointer gone wild");
|
||||
|
||||
UInt16* idx = IGetBaseIdxPtr(auxSpan);
|
||||
uint16_t* idx = IGetBaseIdxPtr(auxSpan);
|
||||
idx += decal->fStartIdx;
|
||||
|
||||
UInt16 base = decal->fStartVtx;
|
||||
uint16_t base = decal->fStartVtx;
|
||||
int j;
|
||||
for( j = 0; j < src.GetCount(); j++ )
|
||||
{
|
||||
UInt16 next = base+1;
|
||||
uint16_t next = base+1;
|
||||
int k;
|
||||
for( k = 2; k < src[j].fVerts.GetCount(); k++ )
|
||||
{
|
||||
@ -1292,7 +1292,7 @@ hsBool plDynaDecalMgr::IConvertPolysVS(plAuxSpan* auxSpan,
|
||||
origUVW->fX = vtx->fUVW[0].fX;
|
||||
origUVW->fY = vtx->fUVW[0].fY;
|
||||
|
||||
origUVW->fZ = vtx->fUVW[0].fZ = (hsScalar)decal->fBirth;
|
||||
origUVW->fZ = vtx->fUVW[0].fZ = (float)decal->fBirth;
|
||||
|
||||
vtx->fUVW[1].Set(0, 0, 0);
|
||||
|
||||
@ -1312,14 +1312,14 @@ hsBool plDynaDecalMgr::IConvertPolysVS(plAuxSpan* auxSpan,
|
||||
}
|
||||
hsAssert(vtx <= IGetBaseVtxPtr(auxSpan) + auxSpan->fVBufferLimit, "Vtx pointer gone wild");
|
||||
|
||||
UInt16* idx = IGetBaseIdxPtr(auxSpan);
|
||||
uint16_t* idx = IGetBaseIdxPtr(auxSpan);
|
||||
idx += decal->fStartIdx;
|
||||
|
||||
UInt16 base = decal->fStartVtx;
|
||||
uint16_t base = decal->fStartVtx;
|
||||
int j;
|
||||
for( j = 0; j < src.GetCount(); j++ )
|
||||
{
|
||||
UInt16 next = base+1;
|
||||
uint16_t next = base+1;
|
||||
int k;
|
||||
for( k = 2; k < src[j].fVerts.GetCount(); k++ )
|
||||
{
|
||||
@ -1371,7 +1371,7 @@ hsBool plDynaDecalMgr::IHitTestPolys(hsTArray<plCutoutPoly>& src) const
|
||||
hsBool plDynaDecalMgr::IProcessPolys(plDrawableSpans* targ, int iSpan, double t, hsTArray<plCutoutPoly>& src)
|
||||
{
|
||||
// Figure out how many verts and idxs are coming in.
|
||||
UInt16 numVerts, numIdx;
|
||||
uint16_t numVerts, numIdx;
|
||||
ICountIncoming(src, numVerts, numIdx);
|
||||
if( !numVerts )
|
||||
return false;
|
||||
@ -1577,11 +1577,11 @@ hsGMaterial* plDynaDecalMgr::IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap
|
||||
return mat;
|
||||
oldMip->SetCurrLevel(0);
|
||||
|
||||
hsGMaterial* newMat = TRACKED_NEW hsGMaterial;
|
||||
hsGMaterial* newMat = new hsGMaterial;
|
||||
plString buff = plString::Format("%s_EnvMat", GetKey()->GetName().c_str());
|
||||
hsgResMgr::ResMgr()->NewKey(buff, newMat, GetKey()->GetUoid().GetLocation());
|
||||
|
||||
static plTweak<hsScalar> kSmooth(1.f);
|
||||
static plTweak<float> kSmooth(1.f);
|
||||
plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, plBumpMapGen::kBubbleTest, kSmooth);
|
||||
// plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, plBumpMapGen::kNormalize, kSmooth);
|
||||
// plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, 0, 0);
|
||||
@ -1590,7 +1590,7 @@ hsGMaterial* plDynaDecalMgr::IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap
|
||||
|
||||
bumpMap->SetFlags(bumpMap->GetFlags() | plMipmap::kBumpEnvMap | plMipmap::kForceNonCompressed);
|
||||
|
||||
plLayer* bumpLay = TRACKED_NEW plLayer;
|
||||
plLayer* bumpLay = new plLayer;
|
||||
buff = plString::Format("%s_BumpMap_0", GetKey()->GetName().c_str());
|
||||
hsgResMgr::ResMgr()->NewKey(buff, bumpLay, GetKey()->GetUoid().GetLocation());
|
||||
|
||||
@ -1607,12 +1607,12 @@ hsGMaterial* plDynaDecalMgr::IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap
|
||||
bumpLay->SetRuntimeColor(oldLay->GetRuntimeColor());
|
||||
bumpLay->SetOpacity(1.f);
|
||||
|
||||
plLayRefMsg* refMsg = TRACKED_NEW plLayRefMsg(bumpLay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture);
|
||||
plLayRefMsg* refMsg = new plLayRefMsg(bumpLay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture);
|
||||
hsgResMgr::ResMgr()->SendRef(bumpMap->GetKey(), refMsg, plRefFlags::kActiveRef);
|
||||
|
||||
newMat->AddLayerViaNotify(bumpLay);
|
||||
|
||||
plLayer* envLay = TRACKED_NEW plLayer;
|
||||
plLayer* envLay = new plLayer;
|
||||
buff = plString::Format("%s_EnvMap_0", GetKey()->GetName().c_str());
|
||||
hsgResMgr::ResMgr()->NewKey(buff, envLay, GetKey()->GetUoid().GetLocation());
|
||||
|
||||
@ -1627,7 +1627,7 @@ hsGMaterial* plDynaDecalMgr::IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap
|
||||
envLay->SetRuntimeColor(oldLay->GetRuntimeColor());
|
||||
envLay->SetOpacity(1.f);
|
||||
|
||||
refMsg = TRACKED_NEW plLayRefMsg(envLay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture);
|
||||
refMsg = new plLayRefMsg(envLay->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture);
|
||||
hsgResMgr::ResMgr()->SendRef(envMap->GetKey(), refMsg, plRefFlags::kActiveRef);
|
||||
|
||||
newMat->AddLayerViaNotify(envLay);
|
||||
@ -1639,11 +1639,11 @@ void plDynaDecalMgr::ConvertToEnvMap(plBitmap* envMap)
|
||||
{
|
||||
hsGMaterial* newPreShade = IConvertToEnvMap(fMatPreShade, envMap);
|
||||
if( newPreShade && (newPreShade != fMatPreShade) )
|
||||
hsgResMgr::ResMgr()->SendRef(newPreShade->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatPreShade), plRefFlags::kActiveRef);
|
||||
hsgResMgr::ResMgr()->SendRef(newPreShade->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatPreShade), plRefFlags::kActiveRef);
|
||||
|
||||
hsGMaterial* newRTShade = IConvertToEnvMap(fMatRTShade, envMap);
|
||||
if( newRTShade && (newRTShade != fMatRTShade) )
|
||||
hsgResMgr::ResMgr()->SendRef(newRTShade->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatRTShade), plRefFlags::kActiveRef);
|
||||
hsgResMgr::ResMgr()->SendRef(newRTShade->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatRTShade), plRefFlags::kActiveRef);
|
||||
}
|
||||
|
||||
const plMipmap* plDynaDecalMgr::GetMipmap() const
|
||||
@ -1675,11 +1675,11 @@ hsVector3 plDynaDecalMgr::IRandomUp(hsVector3 dir) const
|
||||
// Only problem here is that our random scalings might wind us up with
|
||||
// a zero vector. Unlikely, which means almost certain to happen. So
|
||||
// we keep trying till we get a non-zero vector.
|
||||
hsScalar lenSq(-1.f);
|
||||
float lenSq(-1.f);
|
||||
do {
|
||||
hsScalar ranXx = sRand.RandMinusOneToOne();
|
||||
hsScalar ranXy = sRand.RandMinusOneToOne();
|
||||
hsScalar ranXz = sRand.RandMinusOneToOne();
|
||||
float ranXx = sRand.RandMinusOneToOne();
|
||||
float ranXy = sRand.RandMinusOneToOne();
|
||||
float ranXz = sRand.RandMinusOneToOne();
|
||||
retVal.fX = -dir.fZ * ranXy + dir.fY * ranXz;
|
||||
retVal.fY = dir.fZ * ranXx + -dir.fX * ranXz;
|
||||
retVal.fZ = -dir.fY * ranXx + dir.fX * ranXy;
|
||||
@ -1705,11 +1705,11 @@ hsVector3 plDynaDecalMgr::IReflectDir(hsVector3 dir) const
|
||||
// Simplifying gives (2*K*(N dot B) + (1-K)) * N + K*B
|
||||
// Or something.
|
||||
|
||||
plConst(hsScalar) parm(0.5f);
|
||||
plConst(float) parm(0.5f);
|
||||
|
||||
hsVector3 b = -fCutter->GetBackDir();
|
||||
|
||||
hsScalar t = dir.InnerProduct(b);
|
||||
float t = dir.InnerProduct(b);
|
||||
t *= -2.f * parm;
|
||||
t += (1.f - parm);
|
||||
|
||||
@ -1754,7 +1754,7 @@ hsMatrix44 plDynaDecalMgr::IL2WFromHit(hsPoint3 pos, hsVector3 dir) const
|
||||
return l2w;
|
||||
}
|
||||
|
||||
void plDynaDecalMgr::ICutoutCallback(const hsTArray<plCutoutPoly>& cutouts, hsBool hasWaterHeight, hsScalar waterHeight)
|
||||
void plDynaDecalMgr::ICutoutCallback(const hsTArray<plCutoutPoly>& cutouts, hsBool hasWaterHeight, float waterHeight)
|
||||
{
|
||||
hsTArray<plCutoutHit> hits;
|
||||
|
||||
@ -1795,7 +1795,7 @@ void plDynaDecalMgr::IGetParticles()
|
||||
// const_cast here is just to see if it's in our list, make Find happy.
|
||||
if( sys && (fParticles.kMissingIndex == fParticles.Find(const_cast<plParticleSystem*>(sys))) )
|
||||
{
|
||||
hsgResMgr::ResMgr()->AddViaNotify(sys->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefParticles), plRefFlags::kPassiveRef);
|
||||
hsgResMgr::ResMgr()->AddViaNotify(sys->GetKey(), new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefParticles), plRefFlags::kPassiveRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,13 +98,13 @@ public:
|
||||
double fLastTime;
|
||||
hsPoint3 fLastPos;
|
||||
double fWetTime;
|
||||
hsScalar fWetLength;
|
||||
UInt32 fFlags;
|
||||
float fWetLength;
|
||||
uint32_t fFlags;
|
||||
|
||||
plDynaDecalInfo& Init(const plKey& key);
|
||||
};
|
||||
|
||||
typedef std::map< unsigned_ptr, plDynaDecalInfo, std::less<unsigned_ptr> > plDynaDecalMap;
|
||||
typedef std::map< uintptr_t, plDynaDecalInfo, std::less<uintptr_t> > plDynaDecalMap;
|
||||
|
||||
// plDynaDecalMgr
|
||||
// Primary responsibilities:
|
||||
@ -150,63 +150,63 @@ protected:
|
||||
hsTArray<plSceneObject*> fPartyObjects;
|
||||
hsTArray<plParticleSystem*> fParticles;
|
||||
|
||||
hsScalar fPartyTime;
|
||||
float fPartyTime;
|
||||
|
||||
UInt16 fMaxNumVerts;
|
||||
UInt16 fMaxNumIdx;
|
||||
uint16_t fMaxNumVerts;
|
||||
uint16_t fMaxNumIdx;
|
||||
|
||||
UInt32 fWaitOnEnable;
|
||||
uint32_t fWaitOnEnable;
|
||||
|
||||
hsScalar fWetLength;
|
||||
hsScalar fRampEnd;
|
||||
hsScalar fDecayStart;
|
||||
hsScalar fLifeSpan;
|
||||
hsScalar fIntensity;
|
||||
float fWetLength;
|
||||
float fRampEnd;
|
||||
float fDecayStart;
|
||||
float fLifeSpan;
|
||||
float fIntensity;
|
||||
|
||||
hsScalar fGridSizeU;
|
||||
hsScalar fGridSizeV;
|
||||
float fGridSizeU;
|
||||
float fGridSizeV;
|
||||
|
||||
hsVector3 fScale;
|
||||
|
||||
// some temp calculated stuff
|
||||
hsScalar fInitAtten;
|
||||
float fInitAtten;
|
||||
// These 4 are in normalized units [0..1], not feet.
|
||||
hsScalar fMinDepth;
|
||||
hsScalar fMinDepthRange;
|
||||
hsScalar fMaxDepth;
|
||||
hsScalar fMaxDepthRange;
|
||||
float fMinDepth;
|
||||
float fMinDepthRange;
|
||||
float fMaxDepth;
|
||||
float fMaxDepthRange;
|
||||
|
||||
hsTArray<UInt32> fPartIDs;
|
||||
hsTArray<uint32_t> fPartIDs;
|
||||
hsTArray<plKey> fNotifies;
|
||||
|
||||
const plPrintShape* IGetPrintShape(const plKey& objKey) const;
|
||||
const plPrintShape* IGetPrintShape(plArmatureMod* avMod, UInt32 id) const;
|
||||
const plPrintShape* IGetPrintShape(plArmatureMod* avMod, uint32_t id) const;
|
||||
|
||||
virtual hsBool IHandleEnableMsg(const plDynaDecalEnableMsg* enaMsg);
|
||||
void INotifyActive(plDynaDecalInfo& info, const plKey& armKey, UInt32 id) const;
|
||||
void INotifyInactive(plDynaDecalInfo& info, const plKey& armKey, UInt32 id) const;
|
||||
void INotifyActive(plDynaDecalInfo& info, const plKey& armKey, uint32_t id) const;
|
||||
void INotifyInactive(plDynaDecalInfo& info, const plKey& armKey, uint32_t id) const;
|
||||
hsBool IWetParts(const plDynaDecalEnableMsg* enaMsg);
|
||||
hsBool IWetPart(UInt32 id, const plDynaDecalEnableMsg* enaMsg);
|
||||
hsBool IWetPart(uint32_t id, const plDynaDecalEnableMsg* enaMsg);
|
||||
void IWetInfo(plDynaDecalInfo& info, const plDynaDecalEnableMsg* enaMsg) const;
|
||||
hsScalar IHowWet(plDynaDecalInfo& info, double t) const;
|
||||
plDynaDecalInfo& IGetDecalInfo(unsigned_ptr id, const plKey& key);
|
||||
void IRemoveDecalInfo(UInt32 id);
|
||||
float IHowWet(plDynaDecalInfo& info, double t) const;
|
||||
plDynaDecalInfo& IGetDecalInfo(uintptr_t id, const plKey& key);
|
||||
void IRemoveDecalInfo(uint32_t id);
|
||||
void IRemoveDecalInfos(const plKey& key);
|
||||
|
||||
hsGMaterial* ISetAuxMaterial(plAuxSpan* aux, hsGMaterial* mat, hsBool rtLit);
|
||||
void IAllocAuxSpan(plAuxSpan* aux, UInt32 maxNumVerts, UInt32 maxNumIdx);
|
||||
plAuxSpan* IGetAuxSpan(plDrawableSpans* targ, int iSpan, hsGMaterial* mat, UInt16 numVerts, UInt16 numIdx);
|
||||
void IAllocAuxSpan(plAuxSpan* aux, uint32_t maxNumVerts, uint32_t maxNumIdx);
|
||||
plAuxSpan* IGetAuxSpan(plDrawableSpans* targ, int iSpan, hsGMaterial* mat, uint16_t numVerts, uint16_t numIdx);
|
||||
hsBool IMakeAuxRefs(plPipeline* pipe);
|
||||
|
||||
UInt16* IGetBaseIdxPtr(const plAuxSpan* auxSpan) const;
|
||||
uint16_t* IGetBaseIdxPtr(const plAuxSpan* auxSpan) const;
|
||||
plDecalVtxFormat* IGetBaseVtxPtr(const plAuxSpan* auxSpan) const;
|
||||
|
||||
virtual int INewDecal() = 0;
|
||||
plDynaDecal* IInitDecal(plAuxSpan* aux, double t, UInt16 numVerts, UInt16 numIdx);
|
||||
plDynaDecal* IInitDecal(plAuxSpan* aux, double t, uint16_t numVerts, uint16_t numIdx);
|
||||
void IKillDecal(int i);
|
||||
void IUpdateDecals(double t);
|
||||
|
||||
void ICountIncoming(hsTArray<plCutoutPoly>& src, UInt16& numVerts, UInt16& numIdx) const;
|
||||
void ICountIncoming(hsTArray<plCutoutPoly>& src, uint16_t& numVerts, uint16_t& numIdx) const;
|
||||
hsBool IConvertPolysColor(plAuxSpan* auxSpan, plDynaDecal* decal, hsTArray<plCutoutPoly>& src);
|
||||
hsBool IConvertPolysAlpha(plAuxSpan* auxSpan, plDynaDecal* decal, hsTArray<plCutoutPoly>& src);
|
||||
hsBool IConvertPolysVS(plAuxSpan* auxSpan, plDynaDecal* decal, hsTArray<plCutoutPoly>& src);
|
||||
@ -225,7 +225,7 @@ protected:
|
||||
|
||||
void ISetDepthFalloff(); // Sets from current cutter settings.
|
||||
|
||||
virtual void ICutoutCallback(const hsTArray<plCutoutPoly>& cutouts, hsBool hasWaterHeight=false, hsScalar waterHeight=0.f);
|
||||
virtual void ICutoutCallback(const hsTArray<plCutoutPoly>& cutouts, hsBool hasWaterHeight=false, float waterHeight=0.f);
|
||||
|
||||
hsGMaterial* IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap);
|
||||
|
||||
@ -259,25 +259,25 @@ public:
|
||||
void SetWaitOnEnable(hsBool on) { fWaitOnEnable = on; }
|
||||
hsBool GetWaitOnEnable() const { return fWaitOnEnable; }
|
||||
|
||||
void SetWetLength(hsScalar f) { fWetLength = f; }
|
||||
void SetRampEnd(hsScalar f) { fRampEnd = f; }
|
||||
void SetDecayStart(hsScalar f) { fDecayStart = f; }
|
||||
void SetLifeSpan(hsScalar f) { fLifeSpan = f; }
|
||||
void SetIntensity(hsScalar f) { fIntensity = f; }
|
||||
hsScalar GetWetLength() const { return fWetLength; }
|
||||
hsScalar GetRampEnd() const { return fRampEnd; }
|
||||
hsScalar GetDecayStart() const { return fDecayStart; }
|
||||
hsScalar GetLifeSpan() const { return fLifeSpan; }
|
||||
hsScalar GetIntensity() const { return fIntensity; }
|
||||
void SetWetLength(float f) { fWetLength = f; }
|
||||
void SetRampEnd(float f) { fRampEnd = f; }
|
||||
void SetDecayStart(float f) { fDecayStart = f; }
|
||||
void SetLifeSpan(float f) { fLifeSpan = f; }
|
||||
void SetIntensity(float f) { fIntensity = f; }
|
||||
float GetWetLength() const { return fWetLength; }
|
||||
float GetRampEnd() const { return fRampEnd; }
|
||||
float GetDecayStart() const { return fDecayStart; }
|
||||
float GetLifeSpan() const { return fLifeSpan; }
|
||||
float GetIntensity() const { return fIntensity; }
|
||||
|
||||
void SetPartyTime(hsScalar secs) { fPartyTime = secs; } // Duration of particle spewage
|
||||
hsScalar GetPartyTime() const { return fPartyTime; }
|
||||
void SetPartyTime(float secs) { fPartyTime = secs; } // Duration of particle spewage
|
||||
float GetPartyTime() const { return fPartyTime; }
|
||||
|
||||
void ConvertToEnvMap(plBitmap* envMap);
|
||||
const plMipmap* GetMipmap() const;
|
||||
|
||||
void AddNotify(const plKey& k) { fNotifies.Append(k); }
|
||||
UInt32 GetNumNotifies() const { return fNotifies.GetCount(); }
|
||||
uint32_t GetNumNotifies() const { return fNotifies.GetCount(); }
|
||||
const plKey& GetNotify(int i) const { return fNotifies[i]; }
|
||||
|
||||
static void SetDisableAccumulate(hsBool on) { fDisableAccumulate = on; }
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDynaFootMgr.h"
|
||||
#include "plDynaDecal.h"
|
||||
|
||||
@ -63,8 +63,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plMath/plRandom.h"
|
||||
static plRandom sRand;
|
||||
|
||||
static const UInt32 kNumPrintIDs = 2;
|
||||
static const UInt32 kPrintIDs[kNumPrintIDs] =
|
||||
static const uint32_t kNumPrintIDs = 2;
|
||||
static const uint32_t kPrintIDs[kNumPrintIDs] =
|
||||
{
|
||||
plAvBrainHuman::RFootPrint,
|
||||
plAvBrainHuman::LFootPrint
|
||||
@ -74,7 +74,7 @@ static const UInt32 kPrintIDs[kNumPrintIDs] =
|
||||
int plDynaFootMgr::INewDecal()
|
||||
{
|
||||
int idx = fDecals.GetCount();
|
||||
fDecals.Append(TRACKED_NEW plDynaSplot());
|
||||
fDecals.Append(new plDynaSplot());
|
||||
|
||||
return idx;
|
||||
}
|
||||
@ -109,13 +109,13 @@ hsBool plDynaFootMgr::MsgReceive(plMessage* msg)
|
||||
plAvatarFootMsg* footMsg = plAvatarFootMsg::ConvertNoRef(msg);
|
||||
if( footMsg )
|
||||
{
|
||||
UInt32 id = footMsg->IsLeft() ? plAvBrainHuman::LFootPrint : plAvBrainHuman::RFootPrint;
|
||||
uint32_t id = footMsg->IsLeft() ? plAvBrainHuman::LFootPrint : plAvBrainHuman::RFootPrint;
|
||||
|
||||
plArmatureMod* armMod = footMsg->GetArmature();
|
||||
const plPrintShape* shape = IGetPrintShape(armMod, id);
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey());
|
||||
if( IPrintFromShape(shape, footMsg->IsLeft()) )
|
||||
{
|
||||
INotifyActive(info, armMod->GetKey(), id);
|
||||
@ -138,10 +138,10 @@ hsBool plDynaFootMgr::IPrintFromShape(const plPrintShape* shape, hsBool flip)
|
||||
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey());
|
||||
|
||||
double secs = hsTimer::GetSysSeconds();
|
||||
hsScalar wetness = IHowWet(info, secs);
|
||||
float wetness = IHowWet(info, secs);
|
||||
fInitAtten = wetness;
|
||||
|
||||
if( wetness <= 0 )
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDynaPuddleMgr.h"
|
||||
|
||||
#include "plPrintShape.h"
|
||||
@ -55,8 +55,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plAvatar/plAvBrainHuman.h"
|
||||
#include "plAvatar/plArmatureMod.h"
|
||||
|
||||
static const UInt32 kNumPrintIDs = 2;
|
||||
static const UInt32 kPrintIDs[kNumPrintIDs] =
|
||||
static const uint32_t kNumPrintIDs = 2;
|
||||
static const uint32_t kPrintIDs[kNumPrintIDs] =
|
||||
{
|
||||
plAvBrainHuman::RFootPrint,
|
||||
plAvBrainHuman::LFootPrint
|
||||
@ -94,7 +94,7 @@ hsBool plDynaPuddleMgr::MsgReceive(plMessage* msg)
|
||||
const plPrintShape* shape = IGetPrintShape(armMod, fPartIDs[i]);
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey());
|
||||
if( IRippleFromShape(shape, true) )
|
||||
{
|
||||
INotifyActive(info, armMod->GetKey(), fPartIDs[i]);
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDynaRippleMgr.h"
|
||||
#include "plDynaDecal.h"
|
||||
|
||||
@ -66,8 +66,8 @@ static plRandom sRand;
|
||||
|
||||
#include "plTweak.h"
|
||||
|
||||
static const UInt32 kNumPrintIDs = 5;
|
||||
static const UInt32 kPrintIDs[kNumPrintIDs] =
|
||||
static const uint32_t kNumPrintIDs = 5;
|
||||
static const uint32_t kPrintIDs[kNumPrintIDs] =
|
||||
{
|
||||
plAvBrainHuman::TrunkPrint,
|
||||
plAvBrainHuman::LHandPrint,
|
||||
@ -82,7 +82,7 @@ int plDynaRippleMgr::INewDecal()
|
||||
int idx = fDecals.GetCount();
|
||||
|
||||
#if 1
|
||||
plDynaRipple* rip = TRACKED_NEW plDynaRipple();
|
||||
plDynaRipple* rip = new plDynaRipple();
|
||||
rip->fC1U = fInitUVW.fX;
|
||||
rip->fC2U = (fInitUVW.fX - fFinalUVW.fX) / (fLifeSpan * fFinalUVW.fX);
|
||||
|
||||
@ -91,8 +91,8 @@ int plDynaRippleMgr::INewDecal()
|
||||
|
||||
fDecals.Append(rip);
|
||||
#else
|
||||
plDynaWave* wave = TRACKED_NEW plDynaWave();
|
||||
static hsScalar kDefScrollRate = 0.1f;
|
||||
plDynaWave* wave = new plDynaWave();
|
||||
static float kDefScrollRate = 0.1f;
|
||||
wave->fScrollRate = kDefScrollRate;
|
||||
fDecals.Append(wave);
|
||||
#endif
|
||||
@ -146,7 +146,7 @@ hsBool plDynaRippleMgr::MsgReceive(plMessage* msg)
|
||||
const plPrintShape* shape = IGetPrintShape(armMsg->fArmature, fPartIDs[i]);
|
||||
if( shape )
|
||||
{
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey());
|
||||
if( IRippleFromShape(shape, false) )
|
||||
{
|
||||
INotifyActive(info, armMsg->fArmature->GetKey(), fPartIDs[i]);
|
||||
@ -182,14 +182,14 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force
|
||||
|
||||
hsBool retVal = false;
|
||||
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey());
|
||||
|
||||
const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld();
|
||||
|
||||
plConst(hsScalar) kMinDist(2.0f);
|
||||
plConst(hsScalar) kMinTime(1.5f);
|
||||
plConst(float) kMinDist(2.0f);
|
||||
plConst(float) kMinTime(1.5f);
|
||||
double t = hsTimer::GetSysSeconds();
|
||||
hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne();
|
||||
float dt = float(t - info.fLastTime) * sRand.RandZeroToOne();
|
||||
hsBool longEnough = (dt >= kMinTime);
|
||||
hsPoint3 xlate = shapeL2W.GetTranslate();
|
||||
hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist);
|
||||
@ -203,12 +203,12 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force
|
||||
randPert.Normalize();
|
||||
if( !farEnough )
|
||||
{
|
||||
plConst(hsScalar) kRandPert = 0.5f;
|
||||
plConst(float) kRandPert = 0.5f;
|
||||
randPert *= kRandPert;
|
||||
}
|
||||
else
|
||||
{
|
||||
plConst(hsScalar) kRandPert = 0.15f;
|
||||
plConst(float) kRandPert = 0.15f;
|
||||
randPert *= kRandPert;
|
||||
}
|
||||
pos += randPert;
|
||||
@ -216,10 +216,10 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force
|
||||
hsVector3 dir(0.f, 1.f, 0.f);
|
||||
hsVector3 up(0.f, 0.f, 1.f);
|
||||
|
||||
plConst(hsScalar) kHeightScale = 1.f;
|
||||
plConst(float) kHeightScale = 1.f;
|
||||
pos.fZ += (shape->GetHeight() * fScale.fZ * kHeightScale) * 0.25f;
|
||||
|
||||
hsScalar wid = hsMaximum(shape->GetWidth(), shape->GetLength());
|
||||
float wid = hsMaximum(shape->GetWidth(), shape->GetLength());
|
||||
hsVector3 size(wid * fScale.fX, wid * fScale.fY, shape->GetHeight() * fScale.fZ * kHeightScale);
|
||||
fCutter->SetLength(size);
|
||||
fCutter->Set(pos, dir, up);
|
||||
|
@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
*==LICENSE==*/
|
||||
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDynaRippleVSMgr.h"
|
||||
#include "plDynaDecal.h"
|
||||
|
||||
@ -77,7 +77,7 @@ int plDynaRippleVSMgr::INewDecal()
|
||||
{
|
||||
int idx = fDecals.GetCount();
|
||||
|
||||
plDynaRippleVS* rip = TRACKED_NEW plDynaRippleVS();
|
||||
plDynaRippleVS* rip = new plDynaRippleVS();
|
||||
rip->fC1U = fInitUVW.fX;
|
||||
rip->fC2U = (fInitUVW.fX - fFinalUVW.fX) / (fLifeSpan * fFinalUVW.fX);
|
||||
|
||||
@ -103,7 +103,7 @@ void plDynaRippleVSMgr::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plDynaRippleMgr::Read(stream, mgr);
|
||||
|
||||
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefWaveSetBase), plRefFlags::kPassiveRef);
|
||||
mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefWaveSetBase), plRefFlags::kPassiveRef);
|
||||
}
|
||||
|
||||
void plDynaRippleVSMgr::Write(hsStream* stream, hsResMgr* mgr)
|
||||
@ -172,14 +172,14 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for
|
||||
|
||||
hsBool retVal = false;
|
||||
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey());
|
||||
|
||||
const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld();
|
||||
|
||||
plConst(hsScalar) kMinDist(2.0f);
|
||||
plConst(hsScalar) kMinTime(1.5f);
|
||||
plConst(float) kMinDist(2.0f);
|
||||
plConst(float) kMinTime(1.5f);
|
||||
double t = hsTimer::GetSysSeconds();
|
||||
hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne();
|
||||
float dt = float(t - info.fLastTime) * sRand.RandZeroToOne();
|
||||
hsBool longEnough = (dt >= kMinTime);
|
||||
hsPoint3 xlate = shapeL2W.GetTranslate();
|
||||
hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist);
|
||||
@ -193,18 +193,18 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for
|
||||
randPert.Normalize();
|
||||
if( !farEnough )
|
||||
{
|
||||
plConst(hsScalar) kRandPert = 0.5f;
|
||||
plConst(float) kRandPert = 0.5f;
|
||||
randPert *= kRandPert;
|
||||
}
|
||||
else
|
||||
{
|
||||
plConst(hsScalar) kRandPert = 0.15f;
|
||||
plConst(float) kRandPert = 0.15f;
|
||||
randPert *= kRandPert;
|
||||
}
|
||||
pos += randPert;
|
||||
|
||||
// Are we potentially touching the water?
|
||||
hsScalar waterHeight = fWaveSetBase->GetHeight();
|
||||
float waterHeight = fWaveSetBase->GetHeight();
|
||||
if( (pos.fZ - fScale.fZ * shape->GetHeight() < waterHeight)
|
||||
&&(pos.fZ + fScale.fZ * shape->GetHeight() > waterHeight) )
|
||||
{
|
||||
@ -212,9 +212,9 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for
|
||||
hsVector3 dir(fWaveSetBase->GetWindDir());
|
||||
hsVector3 up(0.f, 0.f, 1.f);
|
||||
|
||||
hsScalar wid = hsMaximum(shape->GetWidth(), shape->GetLength());
|
||||
float wid = hsMaximum(shape->GetWidth(), shape->GetLength());
|
||||
|
||||
plConst(hsScalar) kMaxWaterDepth(1000.f);
|
||||
plConst(float) kMaxWaterDepth(1000.f);
|
||||
|
||||
hsVector3 size(wid * fScale.fX, wid * fScale.fY, kMaxWaterDepth);
|
||||
fCutter->SetLength(size);
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDynaTorpedoMgr.h"
|
||||
|
||||
#include "plMessage/plBulletMsg.h"
|
||||
@ -56,7 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "plMath/plRandom.h"
|
||||
|
||||
static const UInt32 kNumPrintIDs = 0;
|
||||
static const uint32_t kNumPrintIDs = 0;
|
||||
|
||||
static plRandom sRand;
|
||||
|
||||
@ -78,7 +78,7 @@ void plDynaTorpedoMgr::Read(hsStream* stream, hsResMgr* mgr)
|
||||
|
||||
hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull)
|
||||
{
|
||||
hsScalar partyTime = fPartyTime;
|
||||
float partyTime = fPartyTime;
|
||||
|
||||
plConst(int) kNumShots(3);
|
||||
int i;
|
||||
@ -87,8 +87,8 @@ hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull)
|
||||
hsVector3 up = IRandomUp(bull->Dir());
|
||||
hsVector3 pert = bull->Dir() % up;
|
||||
|
||||
plConst(hsScalar) kMaxPert(1.f);
|
||||
hsScalar maxPert = i ? kMaxPert * bull->Radius() : 0;
|
||||
plConst(float) kMaxPert(1.f);
|
||||
float maxPert = i ? kMaxPert * bull->Radius() : 0;
|
||||
pert *= sRand.RandMinusOneToOne() * maxPert * fScale.fX;
|
||||
|
||||
pert += up * (sRand.RandMinusOneToOne() * maxPert * fScale.fY);
|
||||
@ -96,26 +96,26 @@ hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull)
|
||||
hsPoint3 pos = bull->From() + bull->Dir() * (bull->Range() * 0.5f);
|
||||
pos += pert;
|
||||
|
||||
hsScalar scaleX = bull->Radius() * fScale.fX * fInitUVW.fX;
|
||||
hsScalar scaleY = bull->Radius() * fScale.fY * fInitUVW.fY;
|
||||
float scaleX = bull->Radius() * fScale.fX * fInitUVW.fX;
|
||||
float scaleY = bull->Radius() * fScale.fY * fInitUVW.fY;
|
||||
|
||||
#if 0
|
||||
plConst(hsScalar) kMinScale(0.5f);
|
||||
plConst(float) kMinScale(0.5f);
|
||||
if( i )
|
||||
{
|
||||
scaleX *= sRand.RandRangeF(kMinScale, 1.f);
|
||||
scaleY *= sRand.RandRangeF(kMinScale, 1.f);
|
||||
}
|
||||
#elif 0
|
||||
hsScalar div = 1.f / (1.f + hsScalar(i));
|
||||
float div = 1.f / (1.f + float(i));
|
||||
scaleX *= div;
|
||||
scaleY *= div;
|
||||
#else
|
||||
plConst(hsScalar) kMinScale(0.25f);
|
||||
plConst(hsScalar) kMaxScale(0.75f);
|
||||
plConst(float) kMinScale(0.25f);
|
||||
plConst(float) kMaxScale(0.75f);
|
||||
if( i )
|
||||
{
|
||||
hsScalar scale = sRand.RandRangeF(kMinScale, kMaxScale);
|
||||
float scale = sRand.RandRangeF(kMinScale, kMaxScale);
|
||||
scaleX *= scale;
|
||||
scaleY *= scale;
|
||||
}
|
||||
@ -124,7 +124,7 @@ hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull)
|
||||
fCutter->SetLength(hsVector3(scaleX, scaleY, bull->Range()));
|
||||
fCutter->Set(pos, up, -bull->Dir());
|
||||
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(this), GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(this), GetKey());
|
||||
|
||||
if( bull->PartyTime() > 0 )
|
||||
fPartyTime = bull->PartyTime();
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDynaTorpedoVSMgr.h"
|
||||
#include "plDynaDecal.h"
|
||||
|
||||
@ -68,7 +68,7 @@ int plDynaTorpedoVSMgr::INewDecal()
|
||||
{
|
||||
int idx = fDecals.GetCount();
|
||||
|
||||
plDynaRippleVS* rip = TRACKED_NEW plDynaRippleVS();
|
||||
plDynaRippleVS* rip = new plDynaRippleVS();
|
||||
rip->fC1U = fInitUVW.fX;
|
||||
rip->fC2U = (fInitUVW.fX - fFinalUVW.fX) / (fLifeSpan * fFinalUVW.fX);
|
||||
|
||||
@ -148,7 +148,7 @@ void plDynaTorpedoVSMgr::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plDynaTorpedoMgr::Read(stream, mgr);
|
||||
|
||||
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefWaveSetBase), plRefFlags::kPassiveRef);
|
||||
mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefWaveSetBase), plRefFlags::kPassiveRef);
|
||||
}
|
||||
|
||||
void plDynaTorpedoVSMgr::Write(hsStream* stream, hsResMgr* mgr)
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDynaWakeMgr.h"
|
||||
#include "plDynaDecal.h"
|
||||
|
||||
@ -72,7 +72,7 @@ int plDynaWakeMgr::INewDecal()
|
||||
{
|
||||
int idx = fDecals.GetCount();
|
||||
|
||||
plDynaWake* wake = TRACKED_NEW plDynaWake();
|
||||
plDynaWake* wake = new plDynaWake();
|
||||
wake->fC1U = fInitUVW.fX;
|
||||
wake->fC2U = (fInitUVW.fX - fFinalUVW.fX) / (fLifeSpan * fFinalUVW.fX);
|
||||
|
||||
@ -140,7 +140,7 @@ hsVector3 plDynaWakeMgr::IGetDirection(const plDynaDecalInfo& info, const hsPoin
|
||||
{
|
||||
hsVector3 animDir;
|
||||
hsPoint3 p = pos;
|
||||
hsScalar t = fAnimPath->GetExtremePoint(p);
|
||||
float t = fAnimPath->GetExtremePoint(p);
|
||||
fAnimPath->SetCurTime(t, plAnimPath::kNone);
|
||||
|
||||
fAnimPath->GetVelocity(&animDir);
|
||||
@ -151,8 +151,8 @@ hsVector3 plDynaWakeMgr::IGetDirection(const plDynaDecalInfo& info, const hsPoin
|
||||
}
|
||||
|
||||
// Now if we want to factor in velocity, we can use (pos - info.fLastPos) / (hsTimer::GetSysSeconds() - info.fLastTime)
|
||||
hsScalar dt = hsScalar(hsTimer::GetSysSeconds() - info.fLastTime);
|
||||
const hsScalar kMinDt = 1.e-3f;
|
||||
float dt = float(hsTimer::GetSysSeconds() - info.fLastTime);
|
||||
const float kMinDt = 1.e-3f;
|
||||
if( (info.fFlags & plDynaDecalInfo::kImmersed) && (dt > kMinDt) )
|
||||
{
|
||||
hsVector3 velDir(&pos, &info.fLastPos);
|
||||
@ -173,14 +173,14 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force)
|
||||
|
||||
hsBool retVal = false;
|
||||
|
||||
plDynaDecalInfo& info = IGetDecalInfo(unsigned_ptr(shape), shape->GetKey());
|
||||
plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey());
|
||||
|
||||
const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld();
|
||||
|
||||
static hsScalar kMinDist = 1.0f;
|
||||
static hsScalar kMinTime = 0.25f;
|
||||
static float kMinDist = 1.0f;
|
||||
static float kMinTime = 0.25f;
|
||||
double t = hsTimer::GetSysSeconds();
|
||||
hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne();
|
||||
float dt = float(t - info.fLastTime) * sRand.RandZeroToOne();
|
||||
hsBool longEnough = (dt >= kMinTime);
|
||||
hsPoint3 xlate = shapeL2W.GetTranslate();
|
||||
hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist);
|
||||
@ -197,19 +197,19 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force)
|
||||
randPert.Normalize();
|
||||
if( !farEnough )
|
||||
{
|
||||
static hsScalar kRandPert = 0.05f;
|
||||
static float kRandPert = 0.05f;
|
||||
randPert *= kRandPert * shape->GetWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
static hsScalar kRandPert = 0.05f;
|
||||
static float kRandPert = 0.05f;
|
||||
randPert *= kRandPert * shape->GetWidth();
|
||||
}
|
||||
pos += randPert;
|
||||
|
||||
hsVector3 up(0.f, 0.f, 1.f);
|
||||
|
||||
static hsScalar kHeightScale = 1.f;
|
||||
static float kHeightScale = 1.f;
|
||||
pos.fZ += (shape->GetHeight() * fScale.fZ * kHeightScale) * 0.25f;
|
||||
|
||||
pos += dir * shape->GetLength() * 0.5f * (1.f - fScale.fY);
|
||||
|
@ -54,8 +54,8 @@ protected:
|
||||
hsVector3 fDefaultDir;
|
||||
plAnimPath* fAnimPath;
|
||||
|
||||
hsScalar fAnimWgt;
|
||||
hsScalar fVelWgt;
|
||||
float fAnimWgt;
|
||||
float fVelWgt;
|
||||
|
||||
virtual hsVector3 IGetDirection(const plDynaDecalInfo& info, const hsPoint3& pos) const;
|
||||
|
||||
@ -78,11 +78,11 @@ public:
|
||||
void SetDefaultDir(const hsVector3& v);
|
||||
const hsVector3& GetDefaultDir() const { return fDefaultDir; }
|
||||
|
||||
void SetAnimWeight(hsScalar f) { fAnimWgt = f; }
|
||||
hsScalar GetAnimWeight() const { return fAnimWgt; }
|
||||
void SetAnimWeight(float f) { fAnimWgt = f; }
|
||||
float GetAnimWeight() const { return fAnimWgt; }
|
||||
|
||||
void SetVelocityWeight(hsScalar f) { fVelWgt = f; }
|
||||
hsScalar GetVelocityWeight() const { return fVelWgt; }
|
||||
void SetVelocityWeight(float f) { fVelWgt = f; }
|
||||
float GetVelocityWeight() const { return fVelWgt; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -40,12 +40,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plFixedWaterState7.h"
|
||||
|
||||
#include "hsStream.h"
|
||||
|
||||
void plFixedWaterState7::WaveState::Set(const plFixedWaterState7::WaveState& w, hsScalar secs)
|
||||
void plFixedWaterState7::WaveState::Set(const plFixedWaterState7::WaveState& w, float secs)
|
||||
{
|
||||
fMaxLength.Set(w.fMaxLength, secs);
|
||||
fMinLength.Set(w.fMinLength, secs);
|
||||
@ -54,7 +54,7 @@ void plFixedWaterState7::WaveState::Set(const plFixedWaterState7::WaveState& w,
|
||||
fAngleDev.Set(w.fAngleDev, secs);
|
||||
}
|
||||
|
||||
void plFixedWaterState7::Set(const plFixedWaterState7& t, hsScalar secs)
|
||||
void plFixedWaterState7::Set(const plFixedWaterState7& t, float secs)
|
||||
{
|
||||
fWindDir.Set(t.fWindDir, secs);
|
||||
|
||||
|
@ -55,13 +55,13 @@ public:
|
||||
class WaveState
|
||||
{
|
||||
public:
|
||||
plTimedSimple<hsScalar> fMaxLength;
|
||||
plTimedSimple<hsScalar> fMinLength;
|
||||
plTimedSimple<hsScalar> fAmpOverLen;
|
||||
plTimedSimple<hsScalar> fChop;
|
||||
plTimedSimple<hsScalar> fAngleDev;
|
||||
plTimedSimple<float> fMaxLength;
|
||||
plTimedSimple<float> fMinLength;
|
||||
plTimedSimple<float> fAmpOverLen;
|
||||
plTimedSimple<float> fChop;
|
||||
plTimedSimple<float> fAngleDev;
|
||||
|
||||
void Set(const WaveState& w, hsScalar secs);
|
||||
void Set(const WaveState& w, float secs);
|
||||
|
||||
void Read(hsStream* s);
|
||||
void Write(hsStream* s) const;
|
||||
@ -73,7 +73,7 @@ public:
|
||||
|
||||
// Texture waves
|
||||
WaveState fTexState;
|
||||
plTimedSimple<hsScalar> fRippleScale;
|
||||
plTimedSimple<float> fRippleScale;
|
||||
|
||||
// Geometric and Texture share wind direction
|
||||
plTimedCompound<hsVector3> fWindDir;
|
||||
@ -89,7 +89,7 @@ public:
|
||||
// Depth parameters. Affect how the depth of
|
||||
// the water vertex is interpreted into water
|
||||
// surface properties.
|
||||
plTimedSimple<hsScalar> fWaterHeight;
|
||||
plTimedSimple<float> fWaterHeight;
|
||||
plTimedCompound<hsVector3> fWaterOffset;
|
||||
plTimedCompound<hsVector3> fMaxAtten;
|
||||
plTimedCompound<hsVector3> fMinAtten;
|
||||
@ -98,17 +98,17 @@ public:
|
||||
// Shore parameters
|
||||
|
||||
// Appearance
|
||||
plTimedSimple<hsScalar> fWispiness;
|
||||
plTimedSimple<float> fWispiness;
|
||||
plTimedCompound<hsColorRGBA> fShoreTint;
|
||||
// Next two only used in generation of bubble layer
|
||||
plTimedCompound<hsColorRGBA> fMaxColor;
|
||||
plTimedCompound<hsColorRGBA> fMinColor;
|
||||
plTimedSimple<hsScalar> fEdgeOpac;
|
||||
plTimedSimple<hsScalar> fEdgeRadius;
|
||||
plTimedSimple<float> fEdgeOpac;
|
||||
plTimedSimple<float> fEdgeRadius;
|
||||
|
||||
// Simulation
|
||||
plTimedSimple<hsScalar> fPeriod;
|
||||
plTimedSimple<hsScalar> fFingerLength;
|
||||
plTimedSimple<float> fPeriod;
|
||||
plTimedSimple<float> fFingerLength;
|
||||
|
||||
// The rest aren't really part of the state, that is they are normally controlled
|
||||
// by something exterior to the state. They are included here to allow a convenient
|
||||
@ -119,10 +119,10 @@ public:
|
||||
plTimedCompound<hsColorRGBA> fSpecularTint;
|
||||
|
||||
plTimedCompound<hsPoint3> fEnvCenter;
|
||||
plTimedSimple<hsScalar> fEnvRefresh;
|
||||
plTimedSimple<hsScalar> fEnvRadius;
|
||||
plTimedSimple<float> fEnvRefresh;
|
||||
plTimedSimple<float> fEnvRadius;
|
||||
|
||||
void Set(const plFixedWaterState7& s, hsScalar secs);
|
||||
void Set(const plFixedWaterState7& s, float secs);
|
||||
|
||||
void Read(hsStream* s);
|
||||
void Write(hsStream* s) const;
|
||||
|
@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include <memory.h>
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plGeoSpanDice.h"
|
||||
#include "plGeometrySpan.h"
|
||||
|
||||
@ -121,12 +121,12 @@ hsBool plGeoSpanDice::IHalf(plGeometrySpan* src, hsTArray<plGeometrySpan*>& out,
|
||||
if( iAxis < 0 )
|
||||
return false;
|
||||
|
||||
hsScalar midPoint = src->fLocalBounds.GetCenter()[iAxis];
|
||||
float midPoint = src->fLocalBounds.GetCenter()[iAxis];
|
||||
|
||||
hsTArray<UInt32> loTris;
|
||||
hsTArray<UInt32> hiTris;
|
||||
hsTArray<uint32_t> loTris;
|
||||
hsTArray<uint32_t> hiTris;
|
||||
|
||||
UInt16* indexData = src->fIndexData;
|
||||
uint16_t* indexData = src->fIndexData;
|
||||
|
||||
int numTris = src->fNumIndices / 3;
|
||||
|
||||
@ -170,7 +170,7 @@ hsBool plGeoSpanDice::IHalf(plGeometrySpan* src, hsTArray<plGeometrySpan*>& out,
|
||||
int plGeoSpanDice::ISelectAxis(int exclAxis, plGeometrySpan* src) const
|
||||
{
|
||||
int iAxis = -1;
|
||||
hsScalar maxDim = 0;
|
||||
float maxDim = 0;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < 3; i++ )
|
||||
@ -179,7 +179,7 @@ int plGeoSpanDice::ISelectAxis(int exclAxis, plGeometrySpan* src) const
|
||||
if( exclAxis & (1 << i) )
|
||||
continue;
|
||||
|
||||
hsScalar dim = src->fLocalBounds.GetMaxs()[i] - src->fLocalBounds.GetMins()[i];
|
||||
float dim = src->fLocalBounds.GetMaxs()[i] - src->fLocalBounds.GetMins()[i];
|
||||
if( dim > maxDim )
|
||||
{
|
||||
maxDim = dim;
|
||||
@ -189,21 +189,21 @@ int plGeoSpanDice::ISelectAxis(int exclAxis, plGeometrySpan* src) const
|
||||
return iAxis;
|
||||
}
|
||||
|
||||
plGeometrySpan* plGeoSpanDice::IExtractTris(plGeometrySpan* src, hsTArray<UInt32>& tris) const
|
||||
plGeometrySpan* plGeoSpanDice::IExtractTris(plGeometrySpan* src, hsTArray<uint32_t>& tris) const
|
||||
{
|
||||
// First off, find out how many and which vers we're talking here.
|
||||
// Easiest way is while we're building the LUTs we'll want later anyway.
|
||||
hsTArray<Int16> fwdLUT;
|
||||
hsTArray<int16_t> fwdLUT;
|
||||
fwdLUT.SetCount(src->fNumVerts);
|
||||
memset(fwdLUT.AcquireArray(), -1, src->fNumVerts * sizeof(*fwdLUT.AcquireArray()));
|
||||
|
||||
hsTArray<UInt16> bckLUT;
|
||||
hsTArray<uint16_t> bckLUT;
|
||||
bckLUT.SetCount(0);
|
||||
|
||||
int i;
|
||||
for( i = 0; i < tris.GetCount(); i++ )
|
||||
{
|
||||
UInt16* idx = src->fIndexData + tris[i] * 3;
|
||||
uint16_t* idx = src->fIndexData + tris[i] * 3;
|
||||
|
||||
if( fwdLUT[*idx] < 0 )
|
||||
{
|
||||
@ -234,7 +234,7 @@ plGeometrySpan* plGeoSpanDice::IExtractTris(plGeometrySpan* src, hsTArray<UInt32
|
||||
plGeometrySpan* dst = IAllocSpace(src, numVerts, numTris);
|
||||
|
||||
// Okay, set the index data.
|
||||
UInt16* idxTrav = dst->fIndexData;
|
||||
uint16_t* idxTrav = dst->fIndexData;
|
||||
for( i = 0; i < tris.GetCount(); i++ )
|
||||
{
|
||||
*idxTrav++ = fwdLUT[src->fIndexData[ tris[i] * 3 + 0] ];
|
||||
@ -248,7 +248,7 @@ plGeometrySpan* plGeoSpanDice::IExtractTris(plGeometrySpan* src, hsTArray<UInt32
|
||||
|
||||
hsBounds3Ext localBnd;
|
||||
localBnd.MakeEmpty();
|
||||
UInt8* vtxTrav = dst->fVertexData;
|
||||
uint8_t* vtxTrav = dst->fVertexData;
|
||||
for( i = 0; i < numVerts; i++ )
|
||||
{
|
||||
memcpy(vtxTrav, src->fVertexData + bckLUT[i] * stride, stride);
|
||||
@ -299,7 +299,7 @@ plGeometrySpan* plGeoSpanDice::IExtractTris(plGeometrySpan* src, hsTArray<UInt32
|
||||
|
||||
plGeometrySpan* plGeoSpanDice::IAllocSpace(plGeometrySpan* src, int numVerts, int numTris) const
|
||||
{
|
||||
plGeometrySpan* dst = TRACKED_NEW plGeometrySpan;
|
||||
plGeometrySpan* dst = new plGeometrySpan;
|
||||
// Do a structure copy here. That's okay, because we're going to immediately
|
||||
// fix up the pointers and counters that shouldn't have been copied. If
|
||||
// plGeometrySpan ever gets a copy constructor, this'll blow wide open.
|
||||
@ -308,27 +308,27 @@ plGeometrySpan* plGeoSpanDice::IAllocSpace(plGeometrySpan* src, int numVerts, in
|
||||
int stride = src->GetVertexSize(src->fFormat);
|
||||
|
||||
dst->fNumIndices = numTris * 3;
|
||||
dst->fIndexData = TRACKED_NEW UInt16[dst->fNumIndices];
|
||||
dst->fIndexData = new uint16_t[dst->fNumIndices];
|
||||
|
||||
dst->fNumVerts = numVerts;
|
||||
dst->fVertexData = TRACKED_NEW UInt8[numVerts * stride];
|
||||
dst->fVertexData = new uint8_t[numVerts * stride];
|
||||
|
||||
if( src->fMultColor )
|
||||
{
|
||||
dst->fMultColor = TRACKED_NEW hsColorRGBA[numVerts];
|
||||
dst->fMultColor = new hsColorRGBA[numVerts];
|
||||
}
|
||||
if( src->fAddColor )
|
||||
{
|
||||
dst->fAddColor = TRACKED_NEW hsColorRGBA[numVerts];
|
||||
dst->fAddColor = new hsColorRGBA[numVerts];
|
||||
}
|
||||
if( src->fDiffuseRGBA )
|
||||
{
|
||||
dst->fDiffuseRGBA = TRACKED_NEW UInt32[numVerts];
|
||||
dst->fDiffuseRGBA = new uint32_t[numVerts];
|
||||
}
|
||||
if( src->fSpecularRGBA )
|
||||
{
|
||||
dst->fSpecularRGBA = TRACKED_NEW UInt32[numVerts];
|
||||
dst->fSpecularRGBA = new uint32_t[numVerts];
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
}
|
||||
|
@ -51,13 +51,13 @@ class plGeometrySpan;
|
||||
class plGeoSpanDice
|
||||
{
|
||||
protected:
|
||||
UInt32 fMinFaces;
|
||||
UInt32 fMaxFaces;
|
||||
uint32_t fMinFaces;
|
||||
uint32_t fMaxFaces;
|
||||
hsPoint3 fMaxSize;
|
||||
|
||||
hsBool INeedSplitting(plGeometrySpan* src) const;
|
||||
plGeometrySpan* IAllocSpace(plGeometrySpan* src, int numVerts, int numTris) const;
|
||||
plGeometrySpan* IExtractTris(plGeometrySpan* src, hsTArray<UInt32>& tris) const;
|
||||
plGeometrySpan* IExtractTris(plGeometrySpan* src, hsTArray<uint32_t>& tris) const;
|
||||
int ISelectAxis(int exclAxis, plGeometrySpan* src) const;
|
||||
hsBool IHalf(plGeometrySpan* src, hsTArray<plGeometrySpan*>& out, int exclAxis=0) const;
|
||||
|
||||
|
@ -49,8 +49,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsWindows.h"
|
||||
#include "hsTypes.h"
|
||||
|
||||
#include "HeadSpin.h"
|
||||
#include "plGeometrySpan.h"
|
||||
#include "plSurface/hsGMaterial.h"
|
||||
#include "plSurface/plLayerInterface.h"
|
||||
@ -60,7 +60,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
//// Static Data /////////////////////////////////////////////////////////////
|
||||
|
||||
hsBitVector plGeometrySpan::fInstanceGroupIDFlags;
|
||||
UInt32 plGeometrySpan::fHighestReadInstanceGroup = 0;
|
||||
uint32_t plGeometrySpan::fHighestReadInstanceGroup = 0;
|
||||
|
||||
hsTArray<hsTArray<plGeometrySpan *> *> plGeometrySpan::fInstanceGroups;
|
||||
|
||||
@ -108,7 +108,7 @@ void plGeometrySpan::IClearMembers( void )
|
||||
fSpecularRGBA = nil;
|
||||
fInstanceRefs = nil;
|
||||
fInstanceGroupID = kNoGroupID;
|
||||
fSpanRefIndex = (UInt32)-1;
|
||||
fSpanRefIndex = (uint32_t)-1;
|
||||
|
||||
fLocalToOBB.Reset();
|
||||
fOBBToLocal.Reset();
|
||||
@ -193,7 +193,7 @@ void plGeometrySpan::MakeInstanceOf( const plGeometrySpan *instance )
|
||||
// Go find a new groupID
|
||||
instance->fInstanceGroupID = IAllocateNewGroupID();
|
||||
|
||||
instance->fInstanceRefs = array = TRACKED_NEW hsTArray<plGeometrySpan *>;
|
||||
instance->fInstanceRefs = array = new hsTArray<plGeometrySpan *>;
|
||||
// Go figure, it won't append the const version to the array...this is a cheat,
|
||||
// but then, so is making fInstanceRefs mutable :)
|
||||
array->Append( (plGeometrySpan *)instance );
|
||||
@ -216,11 +216,11 @@ void plGeometrySpan::IUnShareData()
|
||||
{
|
||||
if( fVertexData )
|
||||
{
|
||||
UInt8* oldVtxData = fVertexData;
|
||||
uint8_t* oldVtxData = fVertexData;
|
||||
|
||||
UInt32 size = GetVertexSize( fFormat );
|
||||
uint32_t size = GetVertexSize( fFormat );
|
||||
|
||||
fVertexData = TRACKED_NEW UInt8[ size * fNumVerts ];
|
||||
fVertexData = new uint8_t[ size * fNumVerts ];
|
||||
memcpy( fVertexData, oldVtxData, size * fNumVerts );
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ void plGeometrySpan::IUnShareData()
|
||||
{
|
||||
hsColorRGBA* oldMult = fMultColor;
|
||||
|
||||
fMultColor = TRACKED_NEW hsColorRGBA[ fNumVerts ];
|
||||
fMultColor = new hsColorRGBA[ fNumVerts ];
|
||||
memcpy( fMultColor, oldMult, sizeof(hsColorRGBA) * fNumVerts );
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ void plGeometrySpan::IUnShareData()
|
||||
{
|
||||
hsColorRGBA* oldAdd = fAddColor;
|
||||
|
||||
fAddColor = TRACKED_NEW hsColorRGBA[ fNumVerts ];
|
||||
fAddColor = new hsColorRGBA[ fNumVerts ];
|
||||
memcpy( fAddColor, oldAdd, sizeof(hsColorRGBA) * fNumVerts );
|
||||
}
|
||||
}
|
||||
@ -250,7 +250,7 @@ void plGeometrySpan::BreakInstance()
|
||||
hsAssert(fInstanceRefs->GetCount(), "Don't BreakInstance if I'm the last one, use UnInstance instead");
|
||||
|
||||
fInstanceGroupID = IAllocateNewGroupID();
|
||||
fInstanceRefs = TRACKED_NEW hsTArray<plGeometrySpan*>;
|
||||
fInstanceRefs = new hsTArray<plGeometrySpan*>;
|
||||
fInstanceRefs->Append(this);
|
||||
|
||||
IUnShareData();
|
||||
@ -303,9 +303,9 @@ void plGeometrySpan::UnInstance()
|
||||
// Static function that allocates a new groupID by finding an empty slot in
|
||||
// the bitVector, then marking it as used and returning that bit #
|
||||
|
||||
UInt32 plGeometrySpan::IAllocateNewGroupID( void )
|
||||
uint32_t plGeometrySpan::IAllocateNewGroupID( void )
|
||||
{
|
||||
UInt32 id;
|
||||
uint32_t id;
|
||||
|
||||
|
||||
for( id = 0; id < fInstanceGroupIDFlags.GetSize(); id++ )
|
||||
@ -321,7 +321,7 @@ UInt32 plGeometrySpan::IAllocateNewGroupID( void )
|
||||
//// IClearGroupID ///////////////////////////////////////////////////////////
|
||||
// Done with this groupID, so clear the entry in the bit table.
|
||||
|
||||
void plGeometrySpan::IClearGroupID( UInt32 groupID )
|
||||
void plGeometrySpan::IClearGroupID( uint32_t groupID )
|
||||
{
|
||||
fInstanceGroupIDFlags.ClearBit( groupID - 1 );
|
||||
}
|
||||
@ -340,7 +340,7 @@ void plGeometrySpan::IClearGroupID( UInt32 groupID )
|
||||
// we remove an entry, we decrement this ID until we hit a used pointer again;
|
||||
// if we don't find one, we reset the array.
|
||||
|
||||
hsTArray<plGeometrySpan *> *plGeometrySpan::IGetInstanceGroup( UInt32 groupID, UInt32 expectedCount )
|
||||
hsTArray<plGeometrySpan *> *plGeometrySpan::IGetInstanceGroup( uint32_t groupID, uint32_t expectedCount )
|
||||
{
|
||||
hsTArray<plGeometrySpan *> *array;
|
||||
|
||||
@ -350,7 +350,7 @@ hsTArray<plGeometrySpan *> *plGeometrySpan::IGetInstanceGroup( UInt32 groupID,
|
||||
if( fInstanceGroups.GetCount() <= groupID || fInstanceGroups[ groupID ] == nil )
|
||||
{
|
||||
// Not yet in the list--make a new hsTArray
|
||||
array = TRACKED_NEW hsTArray<plGeometrySpan *>;
|
||||
array = new hsTArray<plGeometrySpan *>;
|
||||
fInstanceGroupIDFlags.SetBit( groupID, true );
|
||||
|
||||
if( expectedCount > 1 )
|
||||
@ -416,24 +416,24 @@ void plGeometrySpan::IDuplicateUniqueData( const plGeometrySpan *source )
|
||||
|
||||
if( source->fIndexData != nil )
|
||||
{
|
||||
fIndexData = TRACKED_NEW UInt16[ fNumIndices ];
|
||||
memcpy( fIndexData, source->fIndexData, sizeof( UInt16 ) * fNumIndices );
|
||||
fIndexData = new uint16_t[ fNumIndices ];
|
||||
memcpy( fIndexData, source->fIndexData, sizeof( uint16_t ) * fNumIndices );
|
||||
}
|
||||
else
|
||||
fIndexData = nil;
|
||||
|
||||
if( source->fDiffuseRGBA )
|
||||
{
|
||||
fDiffuseRGBA = TRACKED_NEW UInt32[ fNumVerts ];
|
||||
memcpy( fDiffuseRGBA, source->fDiffuseRGBA, sizeof( UInt32 ) * fNumVerts );
|
||||
fDiffuseRGBA = new uint32_t[ fNumVerts ];
|
||||
memcpy( fDiffuseRGBA, source->fDiffuseRGBA, sizeof( uint32_t ) * fNumVerts );
|
||||
}
|
||||
else
|
||||
fDiffuseRGBA = nil;
|
||||
|
||||
if( source->fSpecularRGBA )
|
||||
{
|
||||
fSpecularRGBA = TRACKED_NEW UInt32[ fNumVerts ];
|
||||
memcpy( fSpecularRGBA, source->fSpecularRGBA, sizeof( UInt32 ) * fNumVerts );
|
||||
fSpecularRGBA = new uint32_t[ fNumVerts ];
|
||||
memcpy( fSpecularRGBA, source->fSpecularRGBA, sizeof( uint32_t ) * fNumVerts );
|
||||
}
|
||||
else
|
||||
fSpecularRGBA = nil;
|
||||
@ -447,7 +447,7 @@ void plGeometrySpan::IDuplicateUniqueData( const plGeometrySpan *source )
|
||||
|
||||
void plGeometrySpan::CopyFrom( const plGeometrySpan *source )
|
||||
{
|
||||
UInt32 size;
|
||||
uint32_t size;
|
||||
|
||||
|
||||
// Just to make sure
|
||||
@ -462,7 +462,7 @@ void plGeometrySpan::CopyFrom( const plGeometrySpan *source )
|
||||
{
|
||||
size = GetVertexSize( fFormat );
|
||||
|
||||
fVertexData = TRACKED_NEW UInt8[ size * fNumVerts ];
|
||||
fVertexData = new uint8_t[ size * fNumVerts ];
|
||||
memcpy( fVertexData, source->fVertexData, size * fNumVerts );
|
||||
}
|
||||
else
|
||||
@ -470,7 +470,7 @@ void plGeometrySpan::CopyFrom( const plGeometrySpan *source )
|
||||
|
||||
if( source->fMultColor )
|
||||
{
|
||||
fMultColor = TRACKED_NEW hsColorRGBA[ fNumVerts ];
|
||||
fMultColor = new hsColorRGBA[ fNumVerts ];
|
||||
memcpy( fMultColor, source->fMultColor, sizeof(hsColorRGBA) * fNumVerts );
|
||||
}
|
||||
else
|
||||
@ -480,7 +480,7 @@ void plGeometrySpan::CopyFrom( const plGeometrySpan *source )
|
||||
|
||||
if( source->fAddColor )
|
||||
{
|
||||
fAddColor = TRACKED_NEW hsColorRGBA[ fNumVerts ];
|
||||
fAddColor = new hsColorRGBA[ fNumVerts ];
|
||||
memcpy( fAddColor, source->fAddColor, sizeof(hsColorRGBA) * fNumVerts );
|
||||
}
|
||||
else
|
||||
@ -493,7 +493,7 @@ void plGeometrySpan::CopyFrom( const plGeometrySpan *source )
|
||||
|
||||
void plGeometrySpan::Read( hsStream *stream )
|
||||
{
|
||||
UInt32 size, i;
|
||||
uint32_t size, i;
|
||||
|
||||
|
||||
hsAssert( !fCreating, "Cannot read geometry span while creating" );
|
||||
@ -543,19 +543,19 @@ void plGeometrySpan::Read( hsStream *stream )
|
||||
{
|
||||
size = GetVertexSize( fFormat );
|
||||
|
||||
fVertexData = TRACKED_NEW UInt8[ size * fNumVerts ];
|
||||
fVertexData = new uint8_t[ size * fNumVerts ];
|
||||
stream->Read( size * fNumVerts, fVertexData );
|
||||
|
||||
fMultColor = TRACKED_NEW hsColorRGBA[ fNumVerts ];
|
||||
fAddColor = TRACKED_NEW hsColorRGBA[ fNumVerts ];
|
||||
fMultColor = new hsColorRGBA[ fNumVerts ];
|
||||
fAddColor = new hsColorRGBA[ fNumVerts ];
|
||||
for( i = 0; i < fNumVerts; i++ )
|
||||
{
|
||||
fMultColor[ i ].Read( stream );
|
||||
fAddColor[ i ].Read( stream );
|
||||
}
|
||||
|
||||
fDiffuseRGBA = TRACKED_NEW UInt32[ fNumVerts ];
|
||||
fSpecularRGBA = TRACKED_NEW UInt32[ fNumVerts ];
|
||||
fDiffuseRGBA = new uint32_t[ fNumVerts ];
|
||||
fSpecularRGBA = new uint32_t[ fNumVerts ];
|
||||
stream->ReadLE32( fNumVerts, fDiffuseRGBA );
|
||||
stream->ReadLE32( fNumVerts, fSpecularRGBA );
|
||||
}
|
||||
@ -570,7 +570,7 @@ void plGeometrySpan::Read( hsStream *stream )
|
||||
|
||||
if( fNumIndices > 0 )
|
||||
{
|
||||
fIndexData = TRACKED_NEW UInt16[ fNumIndices ];
|
||||
fIndexData = new uint16_t[ fNumIndices ];
|
||||
stream->ReadLE16( fNumIndices, fIndexData );
|
||||
}
|
||||
else
|
||||
@ -580,7 +580,7 @@ void plGeometrySpan::Read( hsStream *stream )
|
||||
fInstanceGroupID = stream->ReadLE32();
|
||||
if( fInstanceGroupID != kNoGroupID )
|
||||
{
|
||||
UInt32 count = stream->ReadLE32();
|
||||
uint32_t count = stream->ReadLE32();
|
||||
|
||||
fInstanceRefs = IGetInstanceGroup( fInstanceGroupID, count );
|
||||
fInstanceRefs->Append( this );
|
||||
@ -592,7 +592,7 @@ void plGeometrySpan::Read( hsStream *stream )
|
||||
|
||||
void plGeometrySpan::Write( hsStream *stream )
|
||||
{
|
||||
UInt32 size, i;
|
||||
uint32_t size, i;
|
||||
|
||||
|
||||
hsAssert( !fCreating, "Cannot write geometry span while creating" );
|
||||
@ -611,7 +611,7 @@ void plGeometrySpan::Write( hsStream *stream )
|
||||
stream->WriteByte( fNumMatrices );
|
||||
stream->WriteLE16(fLocalUVWChans);
|
||||
stream->WriteLE16(fMaxBoneIdx);
|
||||
stream->WriteLE16((UInt16)fPenBoneIdx);
|
||||
stream->WriteLE16((uint16_t)fPenBoneIdx);
|
||||
|
||||
stream->WriteLEScalar(fMinDist);
|
||||
stream->WriteLEScalar(fMaxDist);
|
||||
@ -663,9 +663,9 @@ void plGeometrySpan::Write( hsStream *stream )
|
||||
|
||||
//// GetVertexSize ///////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 plGeometrySpan::GetVertexSize( UInt8 format )
|
||||
uint32_t plGeometrySpan::GetVertexSize( uint8_t format )
|
||||
{
|
||||
UInt32 size;
|
||||
uint32_t size;
|
||||
|
||||
|
||||
size = sizeof( float ) * ( 3 + 3 ); // pos + normal
|
||||
@ -683,14 +683,14 @@ UInt32 plGeometrySpan::GetVertexSize( UInt8 format )
|
||||
default: hsAssert( false, "Bad weight count in GetVertexSize()" );
|
||||
}
|
||||
if( format & kSkinIndices )
|
||||
size += sizeof(UInt32);
|
||||
size += sizeof(uint32_t);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
//// BeginCreate //////////////////////////////////////////////////////////////
|
||||
|
||||
void plGeometrySpan::BeginCreate( hsGMaterial *material, const hsMatrix44 &l2wMatrix, UInt8 format )
|
||||
void plGeometrySpan::BeginCreate( hsGMaterial *material, const hsMatrix44 &l2wMatrix, uint8_t format )
|
||||
{
|
||||
fCreating = true;
|
||||
|
||||
@ -705,8 +705,8 @@ void plGeometrySpan::BeginCreate( hsGMaterial *material, const hsMatrix44 &l2
|
||||
// that UV channel (and all above them) are not used. The array of pointers
|
||||
// MUST be of size kMaxNumUVChannels.
|
||||
|
||||
UInt16 plGeometrySpan::AddVertex( hsPoint3 *position, hsPoint3 *normal, hsColorRGBA& multColor, hsColorRGBA& addColor,
|
||||
hsPoint3 **uvPtrArray, float weight1, float weight2, float weight3, UInt32 indices )
|
||||
uint16_t plGeometrySpan::AddVertex( hsPoint3 *position, hsPoint3 *normal, hsColorRGBA& multColor, hsColorRGBA& addColor,
|
||||
hsPoint3 **uvPtrArray, float weight1, float weight2, float weight3, uint32_t indices )
|
||||
{
|
||||
AddVertex( position, normal, 0, 0, uvPtrArray, weight1, weight2, weight3, indices );
|
||||
|
||||
@ -720,8 +720,8 @@ UInt16 plGeometrySpan::AddVertex( hsPoint3 *position, hsPoint3 *normal, hsColor
|
||||
return idx;
|
||||
}
|
||||
|
||||
UInt16 plGeometrySpan::AddVertex( hsPoint3 *position, hsPoint3 *normal, UInt32 hexColor, UInt32 specularColor,
|
||||
hsPoint3 **uvPtrArray, float weight1, float weight2, float weight3, UInt32 indices )
|
||||
uint16_t plGeometrySpan::AddVertex( hsPoint3 *position, hsPoint3 *normal, uint32_t hexColor, uint32_t specularColor,
|
||||
hsPoint3 **uvPtrArray, float weight1, float weight2, float weight3, uint32_t indices )
|
||||
{
|
||||
TempVertex vert;
|
||||
int i, numWeights;
|
||||
@ -782,14 +782,14 @@ UInt16 plGeometrySpan::AddVertex( hsPoint3 *position, hsPoint3 *normal, UInt32
|
||||
|
||||
//// AddIndex Variations //////////////////////////////////////////////////////
|
||||
|
||||
void plGeometrySpan::AddIndex( UInt16 index )
|
||||
void plGeometrySpan::AddIndex( uint16_t index )
|
||||
{
|
||||
hsAssert( fCreating, "Calling AddIndex() on a non-creating plGeometrySpan!" );
|
||||
|
||||
fIndexAccum.Append( index );
|
||||
}
|
||||
|
||||
void plGeometrySpan::AddTriIndices( UInt16 index1, UInt16 index2, UInt16 index3 )
|
||||
void plGeometrySpan::AddTriIndices( uint16_t index1, uint16_t index2, uint16_t index3 )
|
||||
{
|
||||
hsAssert( fCreating, "Calling AddTriIndices() on a non-creating plGeometrySpan!" );
|
||||
|
||||
@ -800,7 +800,7 @@ void plGeometrySpan::AddTriIndices( UInt16 index1, UInt16 index2, UInt16 inde
|
||||
|
||||
//// AddTriangle //////////////////////////////////////////////////////////////
|
||||
|
||||
void plGeometrySpan::AddTriangle( hsPoint3 *vert1, hsPoint3 *vert2, hsPoint3 *vert3, UInt32 color )
|
||||
void plGeometrySpan::AddTriangle( hsPoint3 *vert1, hsPoint3 *vert2, hsPoint3 *vert3, uint32_t color )
|
||||
{
|
||||
hsVector3 twoTo1, twoTo3, normal;
|
||||
hsPoint3 normalPt;
|
||||
@ -823,12 +823,12 @@ void plGeometrySpan::AddTriangle( hsPoint3 *vert1, hsPoint3 *vert2, hsPoint3
|
||||
|
||||
//// AddVertexArray ///////////////////////////////////////////////////////////
|
||||
|
||||
void plGeometrySpan::AddVertexArray( UInt32 count, hsPoint3 *positions, hsVector3 *normals, UInt32 *colors, hsPoint3* uvws, int uvwsPerVtx )
|
||||
void plGeometrySpan::AddVertexArray( uint32_t count, hsPoint3 *positions, hsVector3 *normals, uint32_t *colors, hsPoint3* uvws, int uvwsPerVtx )
|
||||
{
|
||||
hsAssert( fCreating, "Calling AddTriIndices() on a non-creating plGeometrySpan!" );
|
||||
|
||||
|
||||
UInt32 i, dest;
|
||||
uint32_t i, dest;
|
||||
|
||||
// This test actually does work, even if it's bad form...
|
||||
hsAssert( GetNumUVs() == uvwsPerVtx, "Calling wrong AddVertex() for plGeometrySpan format" );
|
||||
@ -866,12 +866,12 @@ void plGeometrySpan::AddVertexArray( UInt32 count, hsPoint3 *positions, hsVec
|
||||
|
||||
//// AddIndexArray ////////////////////////////////////////////////////////////
|
||||
|
||||
void plGeometrySpan::AddIndexArray( UInt32 count, UInt16 *indices )
|
||||
void plGeometrySpan::AddIndexArray( uint32_t count, uint16_t *indices )
|
||||
{
|
||||
hsAssert( fCreating, "Calling AddTriIndices() on a non-creating plGeometrySpan!" );
|
||||
|
||||
|
||||
UInt32 i, dest;
|
||||
uint32_t i, dest;
|
||||
|
||||
|
||||
dest = fIndexAccum.GetCount();
|
||||
@ -885,8 +885,8 @@ void plGeometrySpan::AddIndexArray( UInt32 count, UInt16 *indices )
|
||||
void plGeometrySpan::EndCreate( void )
|
||||
{
|
||||
hsBounds3Ext bounds;
|
||||
UInt32 i, size;
|
||||
UInt8 *tempPtr;
|
||||
uint32_t i, size;
|
||||
uint8_t *tempPtr;
|
||||
|
||||
|
||||
hsAssert( fCreating, "Calling EndCreate() on a non-creating plGeometrySpan!" );
|
||||
@ -918,18 +918,18 @@ void plGeometrySpan::EndCreate( void )
|
||||
delete [] fVertexData;
|
||||
|
||||
fNumVerts = fVertAccum.GetCount();
|
||||
fVertexData = TRACKED_NEW UInt8[ size * fNumVerts ];
|
||||
fVertexData = new uint8_t[ size * fNumVerts ];
|
||||
|
||||
delete [] fMultColor;
|
||||
fMultColor = TRACKED_NEW hsColorRGBA[ fNumVerts ];
|
||||
fMultColor = new hsColorRGBA[ fNumVerts ];
|
||||
|
||||
delete [] fAddColor;
|
||||
fAddColor = TRACKED_NEW hsColorRGBA[ fNumVerts ];
|
||||
fAddColor = new hsColorRGBA[ fNumVerts ];
|
||||
|
||||
delete [] fDiffuseRGBA;
|
||||
delete [] fSpecularRGBA;
|
||||
fDiffuseRGBA = TRACKED_NEW UInt32[ fNumVerts ];
|
||||
fSpecularRGBA = TRACKED_NEW UInt32[ fNumVerts ];
|
||||
fDiffuseRGBA = new uint32_t[ fNumVerts ];
|
||||
fSpecularRGBA = new uint32_t[ fNumVerts ];
|
||||
}
|
||||
else
|
||||
fNumVerts = fVertAccum.GetCount();
|
||||
@ -963,8 +963,8 @@ void plGeometrySpan::EndCreate( void )
|
||||
tempPtr += numWeights * sizeof(float);
|
||||
if( fFormat & kSkinIndices )
|
||||
{
|
||||
memcpy( tempPtr, &fVertAccum[ i ].fIndices, sizeof(UInt32) );
|
||||
tempPtr += sizeof(UInt32);
|
||||
memcpy( tempPtr, &fVertAccum[ i ].fIndices, sizeof(uint32_t) );
|
||||
tempPtr += sizeof(uint32_t);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1000,7 +1000,7 @@ void plGeometrySpan::EndCreate( void )
|
||||
delete [] fIndexData;
|
||||
|
||||
fNumIndices = fIndexAccum.GetCount();
|
||||
fIndexData = TRACKED_NEW UInt16[ fNumIndices ];
|
||||
fIndexData = new uint16_t[ fNumIndices ];
|
||||
}
|
||||
else
|
||||
fNumIndices = fIndexAccum.GetCount();
|
||||
@ -1019,7 +1019,7 @@ void plGeometrySpan::AdjustBounds(hsBounds3Ext& bnd) const
|
||||
hsBounds3Ext wBnd = bnd;
|
||||
wBnd.Transform(&fLocalToWorld);
|
||||
|
||||
const hsScalar kMaxWaveHeight(5.f);
|
||||
const float kMaxWaveHeight(5.f);
|
||||
hsBounds3Ext rebound;
|
||||
rebound.MakeEmpty();
|
||||
hsPoint3 pos = wBnd.GetMins();
|
||||
@ -1033,7 +1033,7 @@ void plGeometrySpan::AdjustBounds(hsBounds3Ext& bnd) const
|
||||
}
|
||||
|
||||
//// ExtractVertex ////////////////////////////////////////////////////////////
|
||||
void plGeometrySpan::ExtractInitColor( UInt32 index, hsColorRGBA *multColor, hsColorRGBA *addColor) const
|
||||
void plGeometrySpan::ExtractInitColor( uint32_t index, hsColorRGBA *multColor, hsColorRGBA *addColor) const
|
||||
{
|
||||
if( multColor )
|
||||
*multColor = fMultColor[index];
|
||||
@ -1044,9 +1044,9 @@ void plGeometrySpan::ExtractInitColor( UInt32 index, hsColorRGBA *multColor,
|
||||
// Extracts the given vertex out of the vertex buffer and into the pointers
|
||||
// given.
|
||||
|
||||
void plGeometrySpan::ExtractVertex( UInt32 index, hsPoint3 *pos, hsVector3 *normal, hsColorRGBA *color, hsColorRGBA *specColor )
|
||||
void plGeometrySpan::ExtractVertex( uint32_t index, hsPoint3 *pos, hsVector3 *normal, hsColorRGBA *color, hsColorRGBA *specColor )
|
||||
{
|
||||
UInt32 hex, spec;
|
||||
uint32_t hex, spec;
|
||||
|
||||
|
||||
ExtractVertex( index, pos, normal, &hex, &spec );
|
||||
@ -1067,9 +1067,9 @@ void plGeometrySpan::ExtractVertex( UInt32 index, hsPoint3 *pos, hsVector3 *n
|
||||
//// ExtractVertex ////////////////////////////////////////////////////////////
|
||||
// Hex-color version of ExtractVertex.
|
||||
|
||||
void plGeometrySpan::ExtractVertex( UInt32 index, hsPoint3 *pos, hsVector3 *normal, UInt32 *color, UInt32 *specColor )
|
||||
void plGeometrySpan::ExtractVertex( uint32_t index, hsPoint3 *pos, hsVector3 *normal, uint32_t *color, uint32_t *specColor )
|
||||
{
|
||||
UInt8 *basePtr;
|
||||
uint8_t *basePtr;
|
||||
float *fPtr;
|
||||
|
||||
|
||||
@ -1095,9 +1095,9 @@ void plGeometrySpan::ExtractVertex( UInt32 index, hsPoint3 *pos, hsVector3 *n
|
||||
|
||||
//// ExtractUv ////////////////////////////////////////////////////////////////
|
||||
|
||||
void plGeometrySpan::ExtractUv( UInt32 vIdx, UInt8 uvIdx, hsPoint3 *uv )
|
||||
void plGeometrySpan::ExtractUv( uint32_t vIdx, uint8_t uvIdx, hsPoint3 *uv )
|
||||
{
|
||||
UInt8 *basePtr;
|
||||
uint8_t *basePtr;
|
||||
float *fPtr;
|
||||
|
||||
|
||||
@ -1119,11 +1119,11 @@ void plGeometrySpan::ExtractUv( UInt32 vIdx, UInt8 uvIdx, hsPoint3 *uv )
|
||||
//// ExtractWeights ///////////////////////////////////////////////////////////
|
||||
// Gets the weights out of the vertex data.
|
||||
|
||||
void plGeometrySpan::ExtractWeights( UInt32 vIdx, float *weightArray, UInt32 *indices )
|
||||
void plGeometrySpan::ExtractWeights( uint32_t vIdx, float *weightArray, uint32_t *indices )
|
||||
{
|
||||
UInt8 *basePtr;
|
||||
uint8_t *basePtr;
|
||||
float *fPtr;
|
||||
UInt32 *dPtr;
|
||||
uint32_t *dPtr;
|
||||
int numWeights;
|
||||
|
||||
|
||||
@ -1149,7 +1149,7 @@ void plGeometrySpan::ExtractWeights( UInt32 vIdx, float *weightArray, UInt32
|
||||
{
|
||||
fPtr += numWeights;
|
||||
|
||||
dPtr = (UInt32 *)fPtr;
|
||||
dPtr = (uint32_t *)fPtr;
|
||||
*indices = *dPtr;
|
||||
}
|
||||
}
|
||||
@ -1158,9 +1158,9 @@ void plGeometrySpan::ExtractWeights( UInt32 vIdx, float *weightArray, UInt32
|
||||
// Stuffs the given vertex data into the vertex buffer. Vertex must already
|
||||
// exist!
|
||||
|
||||
void plGeometrySpan::StuffVertex( UInt32 index, hsPoint3 *pos, hsPoint3 *normal, hsColorRGBA *color, hsColorRGBA *specColor )
|
||||
void plGeometrySpan::StuffVertex( uint32_t index, hsPoint3 *pos, hsPoint3 *normal, hsColorRGBA *color, hsColorRGBA *specColor )
|
||||
{
|
||||
UInt8 *basePtr;
|
||||
uint8_t *basePtr;
|
||||
float *fPtr;
|
||||
|
||||
|
||||
@ -1183,27 +1183,27 @@ void plGeometrySpan::StuffVertex( UInt32 index, hsPoint3 *pos, hsPoint3 *norm
|
||||
StuffVertex( index, color, specColor );
|
||||
}
|
||||
|
||||
void plGeometrySpan::StuffVertex( UInt32 index, hsColorRGBA *color, hsColorRGBA *specColor )
|
||||
void plGeometrySpan::StuffVertex( uint32_t index, hsColorRGBA *color, hsColorRGBA *specColor )
|
||||
{
|
||||
UInt8 r, g, b, a;
|
||||
uint8_t r, g, b, a;
|
||||
|
||||
|
||||
/// Where?
|
||||
hsAssert( index < fNumVerts, "Invalid index passed to StuffVertex()" );
|
||||
|
||||
a = (UInt8)( color->a >= 1 ? 255 : color->a <= 0 ? 0 : color->a * 255.0 );
|
||||
r = (UInt8)( color->r >= 1 ? 255 : color->r <= 0 ? 0 : color->r * 255.0 );
|
||||
g = (UInt8)( color->g >= 1 ? 255 : color->g <= 0 ? 0 : color->g * 255.0 );
|
||||
b = (UInt8)( color->b >= 1 ? 255 : color->b <= 0 ? 0 : color->b * 255.0 );
|
||||
a = (uint8_t)( color->a >= 1 ? 255 : color->a <= 0 ? 0 : color->a * 255.0 );
|
||||
r = (uint8_t)( color->r >= 1 ? 255 : color->r <= 0 ? 0 : color->r * 255.0 );
|
||||
g = (uint8_t)( color->g >= 1 ? 255 : color->g <= 0 ? 0 : color->g * 255.0 );
|
||||
b = (uint8_t)( color->b >= 1 ? 255 : color->b <= 0 ? 0 : color->b * 255.0 );
|
||||
|
||||
fDiffuseRGBA[ index ] = ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b );
|
||||
|
||||
if( specColor != nil )
|
||||
{
|
||||
a = (UInt8)( specColor->a >= 1 ? 255 : specColor->a <= 0 ? 0 : specColor->a * 255.0 );
|
||||
r = (UInt8)( specColor->r >= 1 ? 255 : specColor->r <= 0 ? 0 : specColor->r * 255.0 );
|
||||
g = (UInt8)( specColor->g >= 1 ? 255 : specColor->g <= 0 ? 0 : specColor->g * 255.0 );
|
||||
b = (UInt8)( specColor->b >= 1 ? 255 : specColor->b <= 0 ? 0 : specColor->b * 255.0 );
|
||||
a = (uint8_t)( specColor->a >= 1 ? 255 : specColor->a <= 0 ? 0 : specColor->a * 255.0 );
|
||||
r = (uint8_t)( specColor->r >= 1 ? 255 : specColor->r <= 0 ? 0 : specColor->r * 255.0 );
|
||||
g = (uint8_t)( specColor->g >= 1 ? 255 : specColor->g <= 0 ? 0 : specColor->g * 255.0 );
|
||||
b = (uint8_t)( specColor->b >= 1 ? 255 : specColor->b <= 0 ? 0 : specColor->b * 255.0 );
|
||||
|
||||
fSpecularRGBA[ index ] = ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b );
|
||||
}
|
||||
|
@ -136,40 +136,40 @@ class plGeometrySpan
|
||||
hsBounds3Ext fWorldBounds;
|
||||
plFogEnvironment *fFogEnviron;
|
||||
|
||||
UInt32 fBaseMatrix;
|
||||
UInt8 fNumMatrices;
|
||||
UInt16 fLocalUVWChans;
|
||||
UInt16 fMaxBoneIdx;
|
||||
UInt32 fPenBoneIdx;
|
||||
uint32_t fBaseMatrix;
|
||||
uint8_t fNumMatrices;
|
||||
uint16_t fLocalUVWChans;
|
||||
uint16_t fMaxBoneIdx;
|
||||
uint32_t fPenBoneIdx;
|
||||
|
||||
hsScalar fMinDist;
|
||||
hsScalar fMaxDist;
|
||||
float fMinDist;
|
||||
float fMaxDist;
|
||||
|
||||
hsScalar fWaterHeight;
|
||||
float fWaterHeight;
|
||||
|
||||
UInt8 fFormat;
|
||||
UInt32 fProps;
|
||||
UInt32 fNumVerts, fNumIndices;
|
||||
uint8_t fFormat;
|
||||
uint32_t fProps;
|
||||
uint32_t fNumVerts, fNumIndices;
|
||||
|
||||
/// Current vertex format:
|
||||
/// float position[ 3 ];
|
||||
/// float normal[ 3 ];
|
||||
/// float uvCoords[ ][ 3 ];
|
||||
/// float weights[]; // 0-3 blending weights
|
||||
/// UInt32 weightIndices; // Only if there are >= 1 blending weights
|
||||
/// uint32_t weightIndices; // Only if there are >= 1 blending weights
|
||||
|
||||
UInt8* fVertexData;
|
||||
UInt16* fIndexData;
|
||||
UInt32 fDecalLevel;
|
||||
uint8_t* fVertexData;
|
||||
uint16_t* fIndexData;
|
||||
uint32_t fDecalLevel;
|
||||
|
||||
hsColorRGBA* fMultColor;
|
||||
hsColorRGBA* fAddColor;
|
||||
|
||||
UInt32* fDiffuseRGBA;
|
||||
UInt32* fSpecularRGBA;
|
||||
uint32_t* fDiffuseRGBA;
|
||||
uint32_t* fSpecularRGBA;
|
||||
|
||||
mutable hsTArray<plGeometrySpan *>* fInstanceRefs;
|
||||
mutable UInt32 fInstanceGroupID; // For writing out/reading in instance refs
|
||||
mutable uint32_t fInstanceGroupID; // For writing out/reading in instance refs
|
||||
|
||||
// The following is only used for logging during export. It is never set
|
||||
// at runtime. Don't even think about using it for anything.
|
||||
@ -177,7 +177,7 @@ class plGeometrySpan
|
||||
|
||||
// The following is ONLY used during pack; it's so we can do a reverse lookup
|
||||
// from the instanceRefs list to the correct span in the drawable
|
||||
UInt32 fSpanRefIndex;
|
||||
uint32_t fSpanRefIndex;
|
||||
|
||||
// These two matrices are inverses of each other (duh). They are only used on computing the local
|
||||
// bounds. fLocalBounds is always the bounds in the space defined by fWorldToLocal, but the bounds
|
||||
@ -191,34 +191,34 @@ class plGeometrySpan
|
||||
~plGeometrySpan();
|
||||
|
||||
/// UV stuff
|
||||
UInt8 GetNumUVs( void ) const { return ( fFormat & kUVCountMask ); }
|
||||
void SetNumUVs( UInt8 numUVs )
|
||||
uint8_t GetNumUVs( void ) const { return ( fFormat & kUVCountMask ); }
|
||||
void SetNumUVs( uint8_t numUVs )
|
||||
{
|
||||
hsAssert( numUVs < kMaxNumUVChannels, "Invalid UV count to plGeometrySpan" );
|
||||
fFormat = ( fFormat & ~kUVCountMask ) | numUVs;
|
||||
}
|
||||
|
||||
static UInt8 CalcNumUVs( UInt8 format ) { return ( format & kUVCountMask ); }
|
||||
static UInt8 UVCountToFormat( UInt8 numUVs ) { return numUVs & kUVCountMask; }
|
||||
static uint8_t CalcNumUVs( uint8_t format ) { return ( format & kUVCountMask ); }
|
||||
static uint8_t UVCountToFormat( uint8_t numUVs ) { return numUVs & kUVCountMask; }
|
||||
|
||||
/// Creation functions
|
||||
void BeginCreate( hsGMaterial *material, const hsMatrix44 &l2wMatrix, UInt8 format );
|
||||
void BeginCreate( hsGMaterial *material, const hsMatrix44 &l2wMatrix, uint8_t format );
|
||||
|
||||
// Phasing these in...
|
||||
// Note: uvArray should be a fixed array with enough pointers for the max # of uv channels.
|
||||
// Any unused UVs should be nil
|
||||
UInt16 AddVertex( hsPoint3 *position, hsPoint3 *normal, hsColorRGBA& multColor, hsColorRGBA& addColor,
|
||||
hsPoint3 **uvPtrArray, float weight1 = -1.0f, float weight2 = -1.0f, float weight3 = -1.0f, UInt32 weightIndices = 0 );
|
||||
UInt16 AddVertex( hsPoint3 *position, hsPoint3 *normal, UInt32 hexColor, UInt32 specularColor = 0,
|
||||
hsPoint3 **uvPtrArray = nil, float weight1 = -1.0f, float weight2 = -1.0f, float weight3 = -1.0f, UInt32 weightIndices = 0 );
|
||||
uint16_t AddVertex( hsPoint3 *position, hsPoint3 *normal, hsColorRGBA& multColor, hsColorRGBA& addColor,
|
||||
hsPoint3 **uvPtrArray, float weight1 = -1.0f, float weight2 = -1.0f, float weight3 = -1.0f, uint32_t weightIndices = 0 );
|
||||
uint16_t AddVertex( hsPoint3 *position, hsPoint3 *normal, uint32_t hexColor, uint32_t specularColor = 0,
|
||||
hsPoint3 **uvPtrArray = nil, float weight1 = -1.0f, float weight2 = -1.0f, float weight3 = -1.0f, uint32_t weightIndices = 0 );
|
||||
|
||||
void AddIndex( UInt16 index );
|
||||
void AddTriIndices( UInt16 index1, UInt16 index2, UInt16 index3 );
|
||||
void AddTriangle( hsPoint3 *vert1, hsPoint3 *vert2, hsPoint3 *vert3, UInt32 color );
|
||||
void AddIndex( uint16_t index );
|
||||
void AddTriIndices( uint16_t index1, uint16_t index2, uint16_t index3 );
|
||||
void AddTriangle( hsPoint3 *vert1, hsPoint3 *vert2, hsPoint3 *vert3, uint32_t color );
|
||||
|
||||
// uvws is an array count*uvwsPerVtx long in order [uvw(s) for vtx0, uvw(s) for vtx1, ...], or is nil
|
||||
void AddVertexArray( UInt32 count, hsPoint3 *positions, hsVector3 *normals, UInt32 *colors, hsPoint3 *uvws=nil, int uvwsPerVtx=0 );
|
||||
void AddIndexArray( UInt32 count, UInt16 *indices );
|
||||
void AddVertexArray( uint32_t count, hsPoint3 *positions, hsVector3 *normals, uint32_t *colors, hsPoint3 *uvws=nil, int uvwsPerVtx=0 );
|
||||
void AddIndexArray( uint32_t count, uint16_t *indices );
|
||||
|
||||
void EndCreate( void );
|
||||
|
||||
@ -226,13 +226,13 @@ class plGeometrySpan
|
||||
/// Manipulation--currently only used for applying static lighting, which of course needs individual vertices
|
||||
// Wrong. Also used for the interleaving of the multiple vertex data streams here into single vertex
|
||||
// stream within the plGBufferGroups. mf.
|
||||
void ExtractInitColor( UInt32 index, hsColorRGBA *multColor, hsColorRGBA *addColor) const;
|
||||
void ExtractVertex( UInt32 index, hsPoint3 *pos, hsVector3 *normal, hsColorRGBA *color, hsColorRGBA *specColor = nil );
|
||||
void ExtractVertex( UInt32 index, hsPoint3 *pos, hsVector3 *normal, UInt32 *color, UInt32 *specColor = nil );
|
||||
void ExtractUv( UInt32 vIdx, UInt8 uvIdx, hsPoint3* uv );
|
||||
void ExtractWeights( UInt32 vIdx, float *weightArray, UInt32 *indices );
|
||||
void StuffVertex( UInt32 index, hsPoint3 *pos, hsPoint3 *normal, hsColorRGBA *color, hsColorRGBA *specColor = nil );
|
||||
void StuffVertex( UInt32 index, hsColorRGBA *color, hsColorRGBA *specColor = nil );
|
||||
void ExtractInitColor( uint32_t index, hsColorRGBA *multColor, hsColorRGBA *addColor) const;
|
||||
void ExtractVertex( uint32_t index, hsPoint3 *pos, hsVector3 *normal, hsColorRGBA *color, hsColorRGBA *specColor = nil );
|
||||
void ExtractVertex( uint32_t index, hsPoint3 *pos, hsVector3 *normal, uint32_t *color, uint32_t *specColor = nil );
|
||||
void ExtractUv( uint32_t vIdx, uint8_t uvIdx, hsPoint3* uv );
|
||||
void ExtractWeights( uint32_t vIdx, float *weightArray, uint32_t *indices );
|
||||
void StuffVertex( uint32_t index, hsPoint3 *pos, hsPoint3 *normal, hsColorRGBA *color, hsColorRGBA *specColor = nil );
|
||||
void StuffVertex( uint32_t index, hsColorRGBA *color, hsColorRGBA *specColor = nil );
|
||||
|
||||
// Clear out the buffers
|
||||
void ClearBuffers( void );
|
||||
@ -244,12 +244,12 @@ class plGeometrySpan
|
||||
void MakeInstanceOf( const plGeometrySpan *instance );
|
||||
|
||||
// Get the size of one vertex in a span, based on a format
|
||||
static UInt32 GetVertexSize( UInt8 format );
|
||||
static uint32_t GetVertexSize( uint8_t format );
|
||||
|
||||
void Read( hsStream *stream );
|
||||
void Write( hsStream *stream );
|
||||
|
||||
static UInt32 AllocateNewGroupID() { return IAllocateNewGroupID(); }
|
||||
static uint32_t AllocateNewGroupID() { return IAllocateNewGroupID(); }
|
||||
|
||||
void BreakInstance();
|
||||
void ChangeInstance(plGeometrySpan* newInstance);
|
||||
@ -263,16 +263,16 @@ class plGeometrySpan
|
||||
{
|
||||
hsPoint3 fPosition;
|
||||
hsPoint3 fNormal;
|
||||
UInt32 fColor, fSpecularColor;
|
||||
uint32_t fColor, fSpecularColor;
|
||||
hsColorRGBA fMultColor, fAddColor;
|
||||
hsPoint3 fUVs[ kMaxNumUVChannels ];
|
||||
float fWeights[ 3 ];
|
||||
UInt32 fIndices;
|
||||
uint32_t fIndices;
|
||||
};
|
||||
|
||||
hsBool fCreating;
|
||||
hsTArray<TempVertex> fVertAccum;
|
||||
hsTArray<UInt16> fIndexAccum;
|
||||
hsTArray<uint16_t> fIndexAccum;
|
||||
|
||||
void IUnShareData();
|
||||
void IDuplicateUniqueData( const plGeometrySpan *source );
|
||||
@ -300,12 +300,12 @@ class plGeometrySpan
|
||||
|
||||
// THIS is so we can clear fInstanceGroups as early and as efficiently as possible; see
|
||||
// the notes on IGetInstanceGroup().
|
||||
static UInt32 fHighestReadInstanceGroup;
|
||||
static uint32_t fHighestReadInstanceGroup;
|
||||
|
||||
static UInt32 IAllocateNewGroupID( void );
|
||||
static void IClearGroupID( UInt32 groupID );
|
||||
static uint32_t IAllocateNewGroupID( void );
|
||||
static void IClearGroupID( uint32_t groupID );
|
||||
|
||||
static hsTArray<plGeometrySpan *> *IGetInstanceGroup( UInt32 groupID, UInt32 expectedCount );
|
||||
static hsTArray<plGeometrySpan *> *IGetInstanceGroup( uint32_t groupID, uint32_t expectedCount );
|
||||
};
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ void plInstanceDrawInterface::Read(hsStream* stream, hsResMgr* mgr)
|
||||
plDrawInterface::Read(stream, mgr);
|
||||
|
||||
fTargetID = stream->ReadLE32();
|
||||
plSwapSpansRefMsg *sMsg = TRACKED_NEW plSwapSpansRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1);
|
||||
plSwapSpansRefMsg *sMsg = new plSwapSpansRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1);
|
||||
mgr->ReadKeyNotifyMe(stream, sMsg, plRefFlags::kActiveRef);
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ void plInstanceDrawInterface::AddSharedMesh(plSharedMesh *mesh, hsGMaterial *mat
|
||||
|
||||
#ifdef MF_NOSHADOW_ACC
|
||||
// TESTHACKERY FOLLOWS - GlassesNoShadow
|
||||
UInt32 noShadHack = 0;
|
||||
uint32_t noShadHack = 0;
|
||||
if( mesh->GetKey() && (strstr(mesh->GetKey()->GetName(), "lasses") || strstr(mesh->GetKey()->GetName(), "oggles")) )
|
||||
noShadHack = plGeometrySpan::kPropNoShadowCast;
|
||||
#endif // MF_NOSHADOW_ACC
|
||||
@ -136,11 +136,11 @@ void plInstanceDrawInterface::AddSharedMesh(plSharedMesh *mesh, hsGMaterial *mat
|
||||
}
|
||||
|
||||
// Add the spans to the drawable
|
||||
UInt32 index = (UInt32)-1;
|
||||
uint32_t index = (uint32_t)-1;
|
||||
index = fDrawable->AppendDISpans(mesh->fSpans, index, false, true, addToFront, lod);
|
||||
|
||||
// Tell the drawInterface what drawable and index it wants.
|
||||
UInt8 iDraw = (UInt8)GetNumDrawables();
|
||||
uint8_t iDraw = (uint8_t)GetNumDrawables();
|
||||
ISetDrawable(iDraw, fDrawable);
|
||||
SetDrawableMeshIndex(iDraw, index);
|
||||
SetSharedMesh(iDraw, mesh);
|
||||
@ -148,12 +148,12 @@ void plInstanceDrawInterface::AddSharedMesh(plSharedMesh *mesh, hsGMaterial *mat
|
||||
fDrawables[iDraw]->SetProperty(fDrawableIndices[iDraw], kDisable, true);
|
||||
|
||||
#ifdef HS_DEBUGGING
|
||||
plDISpansMsg* diMsg = TRACKED_NEW plDISpansMsg(fDrawable->GetKey(), plDISpansMsg::kAddingSpan, index, plDISpansMsg::kLeaveEmptyDrawable);
|
||||
plDISpansMsg* diMsg = new plDISpansMsg(fDrawable->GetKey(), plDISpansMsg::kAddingSpan, index, plDISpansMsg::kLeaveEmptyDrawable);
|
||||
diMsg->SetSender(GetKey());
|
||||
diMsg->Send();
|
||||
#endif
|
||||
|
||||
plSharedMeshBCMsg *smMsg = TRACKED_NEW plSharedMeshBCMsg;
|
||||
plSharedMeshBCMsg *smMsg = new plSharedMeshBCMsg;
|
||||
smMsg->SetSender(GetKey());
|
||||
smMsg->fDraw = fDrawable;
|
||||
smMsg->fMesh = mesh;
|
||||
@ -165,7 +165,7 @@ void plInstanceDrawInterface::AddSharedMesh(plSharedMesh *mesh, hsGMaterial *mat
|
||||
plMorphSequence *morph = const_cast<plMorphSequence*>(plMorphSequence::ConvertNoRef(fOwner->GetModifierByType(plMorphSequence::Index())));
|
||||
if (morph)
|
||||
{
|
||||
//hsgResMgr::ResMgr()->AddViaNotify(mesh->GetKey(), TRACKED_NEW plGenRefMsg(morph->GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kPassiveRef);
|
||||
//hsgResMgr::ResMgr()->AddViaNotify(mesh->GetKey(), new plGenRefMsg(morph->GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kPassiveRef);
|
||||
morph->AddSharedMesh(mesh);
|
||||
}
|
||||
}
|
||||
@ -173,12 +173,12 @@ void plInstanceDrawInterface::AddSharedMesh(plSharedMesh *mesh, hsGMaterial *mat
|
||||
|
||||
void plInstanceDrawInterface::RemoveSharedMesh(plSharedMesh *mesh)
|
||||
{
|
||||
UInt32 geoIndex = fMeshes.Find(mesh);
|
||||
uint32_t geoIndex = fMeshes.Find(mesh);
|
||||
if (geoIndex != fMeshes.kMissingIndex)
|
||||
{
|
||||
IClearIndex((UInt8)geoIndex);
|
||||
IClearIndex((uint8_t)geoIndex);
|
||||
|
||||
plSharedMeshBCMsg *smMsg = TRACKED_NEW plSharedMeshBCMsg;
|
||||
plSharedMeshBCMsg *smMsg = new plSharedMeshBCMsg;
|
||||
smMsg->SetSender(GetKey());
|
||||
smMsg->fDraw = fDrawable;
|
||||
smMsg->fMesh = mesh;
|
||||
@ -197,7 +197,7 @@ void plInstanceDrawInterface::RemoveSharedMesh(plSharedMesh *mesh)
|
||||
}
|
||||
}
|
||||
|
||||
void plInstanceDrawInterface::ICheckDrawableIndex(UInt8 which)
|
||||
void plInstanceDrawInterface::ICheckDrawableIndex(uint8_t which)
|
||||
{
|
||||
if( which >= fMeshes.GetCount() )
|
||||
{
|
||||
@ -214,18 +214,18 @@ void plInstanceDrawInterface::ReleaseData()
|
||||
plDrawInterface::ReleaseData();
|
||||
}
|
||||
|
||||
void plInstanceDrawInterface::SetSharedMesh(UInt8 which, plSharedMesh *mesh)
|
||||
void plInstanceDrawInterface::SetSharedMesh(uint8_t which, plSharedMesh *mesh)
|
||||
{
|
||||
ICheckDrawableIndex(which);
|
||||
fMeshes[which] = mesh;
|
||||
}
|
||||
|
||||
void plInstanceDrawInterface::IClearIndex(UInt8 which)
|
||||
void plInstanceDrawInterface::IClearIndex(uint8_t which)
|
||||
{
|
||||
plDrawableSpans *drawable = plDrawableSpans::ConvertNoRef(fDrawables[which]);
|
||||
if (drawable != nil)
|
||||
{
|
||||
plDISpansMsg* diMsg = TRACKED_NEW plDISpansMsg(fDrawable->GetKey(), plDISpansMsg::kRemovingSpan, fDrawableIndices[which], plDISpansMsg::kLeaveEmptyDrawable);
|
||||
plDISpansMsg* diMsg = new plDISpansMsg(fDrawable->GetKey(), plDISpansMsg::kRemovingSpan, fDrawableIndices[which], plDISpansMsg::kLeaveEmptyDrawable);
|
||||
diMsg->SetSender(GetKey());
|
||||
diMsg->Send();
|
||||
}
|
||||
@ -236,7 +236,7 @@ void plInstanceDrawInterface::IClearIndex(UInt8 which)
|
||||
}
|
||||
|
||||
// Temp testing - not really ideal. Check with Bob for real soln.
|
||||
Int32 plInstanceDrawInterface::GetSharedMeshIndex(const plSharedMesh *mesh) const
|
||||
int32_t plInstanceDrawInterface::GetSharedMeshIndex(const plSharedMesh *mesh) const
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < fMeshes.GetCount(); i++ )
|
||||
|
@ -53,10 +53,10 @@ protected:
|
||||
plDrawableSpans *fDrawable;
|
||||
hsTArray<plSharedMesh*> fMeshes;
|
||||
|
||||
virtual void ICheckDrawableIndex(UInt8 which);
|
||||
virtual void ICheckDrawableIndex(uint8_t which);
|
||||
|
||||
public:
|
||||
UInt32 fTargetID;
|
||||
uint32_t fTargetID;
|
||||
|
||||
plInstanceDrawInterface();
|
||||
virtual ~plInstanceDrawInterface();
|
||||
@ -73,11 +73,11 @@ public:
|
||||
void RemoveSharedMesh(plSharedMesh *mesh);
|
||||
|
||||
virtual void ReleaseData();
|
||||
virtual void SetSharedMesh(UInt8 which, plSharedMesh *mesh);
|
||||
virtual void IClearIndex(UInt8 which);
|
||||
virtual void SetSharedMesh(uint8_t which, plSharedMesh *mesh);
|
||||
virtual void IClearIndex(uint8_t which);
|
||||
plDrawableSpans *GetInstanceDrawable() const { return fDrawable; }
|
||||
|
||||
Int32 GetSharedMeshIndex(const plSharedMesh *mesh) const;
|
||||
int32_t GetSharedMeshIndex(const plSharedMesh *mesh) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plInterMeshSmooth.h"
|
||||
|
||||
#include "plDrawableSpans.h"
|
||||
@ -48,15 +48,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
class EdgeBin
|
||||
{
|
||||
public:
|
||||
UInt16 fVtx;
|
||||
UInt16 fCount;
|
||||
uint16_t fVtx;
|
||||
uint16_t fCount;
|
||||
|
||||
EdgeBin() : fVtx(0), fCount(0) {}
|
||||
};
|
||||
|
||||
void plInterMeshSmooth::FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, hsTArray<UInt16>& edgeVerts)
|
||||
void plInterMeshSmooth::FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray<uint16_t>& edgeVerts)
|
||||
{
|
||||
hsTArray<EdgeBin>* bins = TRACKED_NEW hsTArray<EdgeBin>[maxVtxIdx+1];
|
||||
hsTArray<EdgeBin>* bins = new hsTArray<EdgeBin>[maxVtxIdx+1];
|
||||
|
||||
hsBitVector edgeVertBits;
|
||||
// For each vert pair (edge) in idxList
|
||||
@ -134,7 +134,7 @@ void plInterMeshSmooth::FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxLis
|
||||
delete [] bins;
|
||||
}
|
||||
|
||||
void plInterMeshSmooth::FindEdges(hsTArray<plSpanHandle>& sets, hsTArray<UInt16>* edgeVerts)
|
||||
void plInterMeshSmooth::FindEdges(hsTArray<plSpanHandle>& sets, hsTArray<uint16_t>* edgeVerts)
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < sets.GetCount(); i++ )
|
||||
@ -143,9 +143,9 @@ void plInterMeshSmooth::FindEdges(hsTArray<plSpanHandle>& sets, hsTArray<UInt16>
|
||||
if( !(span->fTypeMask & plSpan::kIcicleSpan) )
|
||||
continue;
|
||||
|
||||
UInt32 nTris = sets[i].fDrawable->CvtGetNumTris(sets[i].fSpanIdx);
|
||||
UInt16* idxList = sets[i].fDrawable->CvtGetIndexList(sets[i].fSpanIdx);
|
||||
UInt32 maxVertIdx = sets[i].fDrawable->CvtGetNumVerts(sets[i].fSpanIdx)-1;
|
||||
uint32_t nTris = sets[i].fDrawable->CvtGetNumTris(sets[i].fSpanIdx);
|
||||
uint16_t* idxList = sets[i].fDrawable->CvtGetIndexList(sets[i].fSpanIdx);
|
||||
uint32_t maxVertIdx = sets[i].fDrawable->CvtGetNumVerts(sets[i].fSpanIdx)-1;
|
||||
|
||||
FindEdges(maxVertIdx, nTris, idxList, edgeVerts[i]);
|
||||
}
|
||||
@ -153,8 +153,8 @@ void plInterMeshSmooth::FindEdges(hsTArray<plSpanHandle>& sets, hsTArray<UInt16>
|
||||
|
||||
void plInterMeshSmooth::SmoothNormals(hsTArray<plSpanHandle>& sets)
|
||||
{
|
||||
hsTArray<UInt16>* shareVtx = TRACKED_NEW hsTArray<UInt16>[sets.GetCount()];
|
||||
hsTArray<UInt16>* edgeVerts = TRACKED_NEW hsTArray<UInt16>[sets.GetCount()];
|
||||
hsTArray<uint16_t>* shareVtx = new hsTArray<uint16_t>[sets.GetCount()];
|
||||
hsTArray<uint16_t>* edgeVerts = new hsTArray<uint16_t>[sets.GetCount()];
|
||||
FindEdges(sets, edgeVerts);
|
||||
|
||||
int i;
|
||||
@ -202,7 +202,7 @@ void plInterMeshSmooth::SmoothNormals(hsTArray<plSpanHandle>& sets)
|
||||
delete [] edgeVerts;
|
||||
}
|
||||
|
||||
void plInterMeshSmooth::FindSharedVerts(hsPoint3& searchPos, plSpanHandle& set, hsTArray<UInt16>& edgeVerts, hsTArray<UInt16>& shareVtx, hsVector3& normAccum)
|
||||
void plInterMeshSmooth::FindSharedVerts(hsPoint3& searchPos, plSpanHandle& set, hsTArray<uint16_t>& edgeVerts, hsTArray<uint16_t>& shareVtx, hsVector3& normAccum)
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < edgeVerts.GetCount(); i++ )
|
||||
@ -220,29 +220,29 @@ void plInterMeshSmooth::FindSharedVerts(hsPoint3& searchPos, plSpanHandle& set,
|
||||
}
|
||||
}
|
||||
|
||||
void plInterMeshSmooth::SetNormals(plSpanHandle& set, hsTArray<UInt16>& shareVtx, hsVector3& norm)
|
||||
void plInterMeshSmooth::SetNormals(plSpanHandle& set, hsTArray<uint16_t>& shareVtx, hsVector3& norm)
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < shareVtx.GetCount(); i++ )
|
||||
GetNormal(set, shareVtx[i]) = norm;
|
||||
}
|
||||
|
||||
hsPoint3& plInterMeshSmooth::GetPosition(plSpanHandle& set, UInt16 idx)
|
||||
hsPoint3& plInterMeshSmooth::GetPosition(plSpanHandle& set, uint16_t idx)
|
||||
{
|
||||
return set.fDrawable->CvtGetPosition(set.fSpanIdx, idx);
|
||||
}
|
||||
|
||||
hsVector3& plInterMeshSmooth::GetNormal(plSpanHandle& set, UInt16 idx)
|
||||
hsVector3& plInterMeshSmooth::GetNormal(plSpanHandle& set, uint16_t idx)
|
||||
{
|
||||
return set.fDrawable->CvtGetNormal(set.fSpanIdx, idx);
|
||||
}
|
||||
|
||||
void plInterMeshSmooth::SetAngle(hsScalar degs)
|
||||
void plInterMeshSmooth::SetAngle(float degs)
|
||||
{
|
||||
fMinNormDot = hsCosine(hsScalarDegToRad(degs));
|
||||
fMinNormDot = cos(hsDegreesToRadians(degs));
|
||||
}
|
||||
|
||||
hsScalar plInterMeshSmooth::GetAngle() const
|
||||
float plInterMeshSmooth::GetAngle() const
|
||||
{
|
||||
return hsScalarRadToDeg(hsACosine(fMinNormDot));
|
||||
}
|
||||
return hsRadiansToDegrees(acos(fMinNormDot));
|
||||
}
|
||||
|
@ -53,26 +53,26 @@ class plSpanHandle
|
||||
{
|
||||
public:
|
||||
plDrawableSpans* fDrawable;
|
||||
UInt32 fSpanIdx;
|
||||
uint32_t fSpanIdx;
|
||||
};
|
||||
|
||||
class plInterMeshSmooth
|
||||
{
|
||||
protected:
|
||||
hsScalar fMinNormDot;
|
||||
float fMinNormDot;
|
||||
|
||||
void FindEdges(UInt32 maxVtxIdx, UInt32 nTris, UInt16* idxList, hsTArray<UInt16>& edgeVerts);
|
||||
void FindEdges(hsTArray<plSpanHandle>& sets, hsTArray<UInt16>* edgeVerts);
|
||||
void FindSharedVerts(hsPoint3& searchPos, plSpanHandle& set, hsTArray<UInt16>& edgeVerts, hsTArray<UInt16>& shareVtx, hsVector3& normAccum);
|
||||
void SetNormals(plSpanHandle& set, hsTArray<UInt16>& shareVtx, hsVector3& norm);
|
||||
hsPoint3& GetPosition(plSpanHandle& set, UInt16 idx);
|
||||
hsVector3& GetNormal(plSpanHandle& set, UInt16 idx);
|
||||
void FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray<uint16_t>& edgeVerts);
|
||||
void FindEdges(hsTArray<plSpanHandle>& sets, hsTArray<uint16_t>* edgeVerts);
|
||||
void FindSharedVerts(hsPoint3& searchPos, plSpanHandle& set, hsTArray<uint16_t>& edgeVerts, hsTArray<uint16_t>& shareVtx, hsVector3& normAccum);
|
||||
void SetNormals(plSpanHandle& set, hsTArray<uint16_t>& shareVtx, hsVector3& norm);
|
||||
hsPoint3& GetPosition(plSpanHandle& set, uint16_t idx);
|
||||
hsVector3& GetNormal(plSpanHandle& set, uint16_t idx);
|
||||
|
||||
public:
|
||||
plInterMeshSmooth() : fMinNormDot(0.25f) {}
|
||||
|
||||
void SetAngle(hsScalar degs);
|
||||
hsScalar GetAngle() const; // returns degrees
|
||||
void SetAngle(float degs);
|
||||
float GetAngle() const; // returns degrees
|
||||
|
||||
void SmoothNormals(hsTArray<plSpanHandle>& sets);
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plMorphArray.h"
|
||||
|
||||
plMorphArray::plMorphArray()
|
||||
@ -53,7 +53,7 @@ plMorphArray::~plMorphArray()
|
||||
|
||||
|
||||
// MorphArray - Apply
|
||||
void plMorphArray::Apply(hsTArray<plAccessSpan>& dst, hsTArray<hsScalar>* weights /* = nil */) const
|
||||
void plMorphArray::Apply(hsTArray<plAccessSpan>& dst, hsTArray<float>* weights /* = nil */) const
|
||||
{
|
||||
// Have our choice of cache thrashing here
|
||||
// We can for each delta/for each vert
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
plMorphArray();
|
||||
virtual ~plMorphArray();
|
||||
|
||||
void Apply(hsTArray<plAccessSpan>& dst, hsTArray<hsScalar>* weights = nil) const;
|
||||
void Apply(hsTArray<plAccessSpan>& dst, hsTArray<float>* weights = nil) const;
|
||||
|
||||
void Read(hsStream* s, hsResMgr* mgr);
|
||||
void Write(hsStream* s, hsResMgr* mgr);
|
||||
@ -62,8 +62,8 @@ public:
|
||||
void AddDelta(const plMorphDelta& delta);
|
||||
|
||||
int GetNumDeltas() const { return fDeltas.GetCount(); }
|
||||
hsScalar GetWeight(int iDel) { return fDeltas[iDel].GetWeight(); }
|
||||
void SetWeight(int iDel, hsScalar w) { if( iDel < fDeltas.GetCount() )fDeltas[iDel].SetWeight(w); }
|
||||
float GetWeight(int iDel) { return fDeltas[iDel].GetWeight(); }
|
||||
void SetWeight(int iDel, float w) { if( iDel < fDeltas.GetCount() )fDeltas[iDel].SetWeight(w); }
|
||||
};
|
||||
|
||||
#endif // plMorphArray_inc
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plMorphDelta.h"
|
||||
|
||||
#include "hsStream.h"
|
||||
@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "plTweak.h"
|
||||
|
||||
static const hsScalar kMinWeight = 1.e-2f;
|
||||
static const float kMinWeight = 1.e-2f;
|
||||
|
||||
plMorphSpan::plMorphSpan()
|
||||
: fUVWs(nil),
|
||||
@ -91,7 +91,7 @@ plMorphDelta& plMorphDelta::operator=(const plMorphDelta& src)
|
||||
return *this;
|
||||
}
|
||||
|
||||
void plMorphDelta::Apply(hsTArray<plAccessSpan>& dst, hsScalar weight /* = -1.f */) const
|
||||
void plMorphDelta::Apply(hsTArray<plAccessSpan>& dst, float weight /* = -1.f */) const
|
||||
{
|
||||
if( weight == -1.f)
|
||||
weight = fWeight; // None passed in, use our stored value
|
||||
@ -189,7 +189,7 @@ void plMorphDelta::ComputeDeltas(const hsTArray<plGeometrySpan*>& base, const hs
|
||||
|
||||
plMorphSpan& dst = fSpans[iSpan];
|
||||
|
||||
const UInt16 numUVWs = baseAcc.AccessVtx().NumUVWs();
|
||||
const uint16_t numUVWs = baseAcc.AccessVtx().NumUVWs();
|
||||
|
||||
hsTArray<plVertDelta> deltas;
|
||||
hsTArray<hsPoint3> uvws;
|
||||
@ -213,12 +213,12 @@ void plMorphDelta::ComputeDeltas(const hsTArray<plGeometrySpan*>& base, const hs
|
||||
hsBool nonZero = false;
|
||||
|
||||
// These are actually min del SQUARED.
|
||||
plConst(hsScalar) kMinDelPos(1.e-4f); // From Budtpueller's Handbook of Constants
|
||||
plConst(hsScalar) kMinDelNorm(3.e-2f); // About 10 degrees
|
||||
plConst(hsScalar) kMinDelUVW(1.e-4f); // From BHC
|
||||
plConst(float) kMinDelPos(1.e-4f); // From Budtpueller's Handbook of Constants
|
||||
plConst(float) kMinDelNorm(3.e-2f); // About 10 degrees
|
||||
plConst(float) kMinDelUVW(1.e-4f); // From BHC
|
||||
hsPoint3 mPos = d2b * *movedIter.Position();
|
||||
hsVector3 delPos( &mPos, baseIter.Position());
|
||||
hsScalar delPosSq = delPos.MagnitudeSquared();
|
||||
float delPosSq = delPos.MagnitudeSquared();
|
||||
if( delPosSq > kMinDelPos )
|
||||
nonZero = true;
|
||||
else
|
||||
@ -226,7 +226,7 @@ void plMorphDelta::ComputeDeltas(const hsTArray<plGeometrySpan*>& base, const hs
|
||||
|
||||
|
||||
hsVector3 delNorm = (d2bTInv * *movedIter.Normal()) - *baseIter.Normal();
|
||||
hsScalar delNormSq = delNorm.MagnitudeSquared();
|
||||
float delNormSq = delNorm.MagnitudeSquared();
|
||||
if( delNormSq > kMinDelNorm )
|
||||
nonZero = true;
|
||||
else
|
||||
@ -236,7 +236,7 @@ void plMorphDelta::ComputeDeltas(const hsTArray<plGeometrySpan*>& base, const hs
|
||||
for( i = 0; i < numUVWs; i++ )
|
||||
{
|
||||
delUVWs[i] = *movedIter.UVW(i) - *baseIter.UVW(i);
|
||||
hsScalar delUVWSq = delUVWs[i].MagnitudeSquared();
|
||||
float delUVWSq = delUVWs[i].MagnitudeSquared();
|
||||
if( delUVWSq > kMinDelUVW )
|
||||
nonZero = true;
|
||||
else
|
||||
@ -282,7 +282,7 @@ void plMorphDelta::AllocDeltas(int iSpan, int nDel, int nUVW)
|
||||
|
||||
int uvwCnt = nDel * nUVW;
|
||||
if( uvwCnt )
|
||||
fSpans[iSpan].fUVWs = TRACKED_NEW hsPoint3[uvwCnt];
|
||||
fSpans[iSpan].fUVWs = new hsPoint3[uvwCnt];
|
||||
else
|
||||
fSpans[iSpan].fUVWs = nil;
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
class plVertDelta
|
||||
{
|
||||
public:
|
||||
UInt16 fIdx;
|
||||
UInt16 fPadding;
|
||||
uint16_t fIdx;
|
||||
uint16_t fPadding;
|
||||
hsVector3 fPos;
|
||||
hsVector3 fNorm;
|
||||
};
|
||||
@ -66,7 +66,7 @@ public:
|
||||
|
||||
hsTArray<plVertDelta> fDeltas;
|
||||
|
||||
UInt16 fNumUVWChans;
|
||||
uint16_t fNumUVWChans;
|
||||
hsPoint3* fUVWs; // Length is fUVWChans*fDeltas.GetCount() (*sizeof(hsPoint3) in bytes).
|
||||
};
|
||||
|
||||
@ -75,7 +75,7 @@ class plMorphDelta : public plCreatable
|
||||
protected:
|
||||
hsTArray<plMorphSpan> fSpans;
|
||||
|
||||
hsScalar fWeight;
|
||||
float fWeight;
|
||||
public:
|
||||
plMorphDelta();
|
||||
virtual ~plMorphDelta();
|
||||
@ -86,15 +86,15 @@ public:
|
||||
CLASSNAME_REGISTER( plMorphDelta );
|
||||
GETINTERFACE_ANY( plMorphDelta, plCreatable );
|
||||
|
||||
void SetWeight(hsScalar w) { fWeight = w; }
|
||||
hsScalar GetWeight() const { return fWeight; }
|
||||
void SetWeight(float w) { fWeight = w; }
|
||||
float GetWeight() const { return fWeight; }
|
||||
|
||||
void Apply(hsTArray<plAccessSpan>& dst, hsScalar weight = -1.f) const;
|
||||
void Apply(hsTArray<plAccessSpan>& dst, float weight = -1.f) const;
|
||||
|
||||
void ComputeDeltas(const hsTArray<plAccessSpan>& base, const hsTArray<plAccessSpan>& moved);
|
||||
void ComputeDeltas(const hsTArray<plGeometrySpan*>& base, const hsTArray<plGeometrySpan*>& moved, const hsMatrix44& d2b, const hsMatrix44& d2bTInv);
|
||||
|
||||
UInt32 GetNumSpans() const { return fSpans.GetCount(); }
|
||||
uint32_t GetNumSpans() const { return fSpans.GetCount(); }
|
||||
void SetNumSpans(int n);
|
||||
void SetDeltas(int iSpan, const hsTArray<plVertDelta>& deltas, int numUVWChans, const hsPoint3* uvws); // len uvws is deltas.GetCount() * numUVWChans
|
||||
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plMorphSequence.h"
|
||||
#include "plMorphSequenceSDLMod.h"
|
||||
|
||||
@ -89,7 +89,7 @@ void plMorphDataSet::Write(hsStream* s, hsResMgr* mgr)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const UInt32 kChanMask = plAccessVtxSpan::kPositionMask
|
||||
const uint32_t kChanMask = plAccessVtxSpan::kPositionMask
|
||||
| plAccessVtxSpan::kNormalMask
|
||||
| plAccessVtxSpan::kUVWMask;
|
||||
|
||||
@ -98,14 +98,14 @@ const UInt32 kChanMask = plAccessVtxSpan::kPositionMask
|
||||
// that's what got loaded from disk.
|
||||
// Use Access RW. That might already be handled in the customization stuff.
|
||||
|
||||
plConst(hsScalar) kMorphTime(0.5);
|
||||
plConst(float) kMorphTime(0.5);
|
||||
|
||||
class plMorphTarget
|
||||
{
|
||||
public:
|
||||
UInt16 fLayer;
|
||||
UInt16 fDelta;
|
||||
hsScalar fWeight;
|
||||
uint16_t fLayer;
|
||||
uint16_t fDelta;
|
||||
float fWeight;
|
||||
};
|
||||
|
||||
hsTArray<plMorphTarget> fTgtWgts;
|
||||
@ -131,11 +131,11 @@ hsBool plMorphSequence::MsgReceive(plMessage* msg)
|
||||
// Can always add it in later if desired.
|
||||
if( fTgtWgts.GetCount() )
|
||||
{
|
||||
hsScalar delWgt = hsTimer::GetDelSysSeconds() / (kMorphTime > 0 ? kMorphTime : 1.e-3f);
|
||||
float delWgt = hsTimer::GetDelSysSeconds() / (kMorphTime > 0 ? kMorphTime : 1.e-3f);
|
||||
int i;
|
||||
for( i = 0; i < fTgtWgts.GetCount(); i++ )
|
||||
{
|
||||
hsScalar currWgt = GetWeight(fTgtWgts[i].fLayer, fTgtWgts[i].fDelta);
|
||||
float currWgt = GetWeight(fTgtWgts[i].fLayer, fTgtWgts[i].fDelta);
|
||||
if( fTgtWgts[i].fWeight < currWgt )
|
||||
{
|
||||
if( fTgtWgts[i].fWeight >= (currWgt -= delWgt) )
|
||||
@ -233,7 +233,7 @@ int plMorphSequence::GetNumDeltas(int iLay, plKey meshKey /* = nil */) const
|
||||
return fSharedMeshes[index].fMesh->fMorphSet->fMorphs[iLay].GetNumDeltas();
|
||||
}
|
||||
|
||||
hsScalar plMorphSequence::GetWeight(int iLay, int iDel, plKey meshKey /* = nil */) const
|
||||
float plMorphSequence::GetWeight(int iLay, int iDel, plKey meshKey /* = nil */) const
|
||||
{
|
||||
int index = IFindSharedMeshIndex(meshKey);
|
||||
if (index == -1)
|
||||
@ -242,7 +242,7 @@ hsScalar plMorphSequence::GetWeight(int iLay, int iDel, plKey meshKey /* = nil *
|
||||
return fSharedMeshes[index].fArrayWeights[iLay].fDeltaWeights[iDel];
|
||||
}
|
||||
|
||||
void plMorphSequence::SetWeight(int iLay, int iDel, hsScalar w, plKey meshKey /* = nil */)
|
||||
void plMorphSequence::SetWeight(int iLay, int iDel, float w, plKey meshKey /* = nil */)
|
||||
{
|
||||
int index = IFindSharedMeshIndex(meshKey);
|
||||
|
||||
@ -462,7 +462,7 @@ void plMorphSequence::AddTarget(plSceneObject* so)
|
||||
|
||||
if (!fMorphSDLMod)
|
||||
{
|
||||
fMorphSDLMod = TRACKED_NEW plMorphSequenceSDLMod;
|
||||
fMorphSDLMod = new plMorphSequenceSDLMod;
|
||||
so->AddModifier(fMorphSDLMod);
|
||||
}
|
||||
}
|
||||
@ -493,7 +493,7 @@ void plMorphSequence::Read(hsStream* s, hsResMgr* mgr)
|
||||
|
||||
n = s->ReadLE32();
|
||||
for( i = 0; i < n; i++)
|
||||
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef);
|
||||
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef);
|
||||
}
|
||||
|
||||
void plMorphSequence::Write(hsStream* s, hsResMgr* mgr)
|
||||
@ -642,17 +642,17 @@ hsBool plMorphSequence::IFindIndices(int iShare)
|
||||
if( !di )
|
||||
return false;
|
||||
|
||||
Int32 meshIdx = di->GetSharedMeshIndex(mInfo.fMesh);
|
||||
int32_t meshIdx = di->GetSharedMeshIndex(mInfo.fMesh);
|
||||
if( meshIdx < 0 )
|
||||
return false;
|
||||
|
||||
plDrawableSpans* dr = plDrawableSpans::ConvertNoRef(di->GetDrawable((UInt8)meshIdx));
|
||||
plDrawableSpans* dr = plDrawableSpans::ConvertNoRef(di->GetDrawable((uint8_t)meshIdx));
|
||||
if( !dr )
|
||||
return false;
|
||||
|
||||
mInfo.fCurrDraw = dr;
|
||||
|
||||
plDISpanIndex& diIndex = dr->GetDISpans(di->GetDrawableMeshIndex((UInt8)meshIdx));
|
||||
plDISpanIndex& diIndex = dr->GetDISpans(di->GetDrawableMeshIndex((uint8_t)meshIdx));
|
||||
|
||||
hsAssert(mInfo.fMesh->fSpans.GetCount() == diIndex.GetCount(), "Mismatch between geometry and indices");
|
||||
|
||||
@ -671,7 +671,7 @@ void plMorphSequence::IReleaseIndices(int iShare)
|
||||
mInfo.fCurrDraw = nil;
|
||||
}
|
||||
|
||||
Int32 plMorphSequence::IFindSharedMeshIndex(plKey meshKey) const
|
||||
int32_t plMorphSequence::IFindSharedMeshIndex(plKey meshKey) const
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < fSharedMeshes.GetCount(); i++ )
|
||||
@ -683,7 +683,7 @@ Int32 plMorphSequence::IFindSharedMeshIndex(plKey meshKey) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
Int32 plMorphSequence::IFindPendingStateIndex(plKey meshKey) const
|
||||
int32_t plMorphSequence::IFindPendingStateIndex(plKey meshKey) const
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < fPendingStates.GetCount(); i++ )
|
||||
|
@ -54,7 +54,7 @@ class plMorphSequenceSDLMod;
|
||||
class plMorphArrayWeights
|
||||
{
|
||||
public:
|
||||
hsTArray<hsScalar> fDeltaWeights;
|
||||
hsTArray<float> fDeltaWeights;
|
||||
};
|
||||
|
||||
class plSharedMeshInfo
|
||||
@ -66,10 +66,10 @@ public:
|
||||
};
|
||||
|
||||
plSharedMesh* fMesh;
|
||||
hsTArray<Int32> fCurrIdx;
|
||||
hsTArray<int32_t> fCurrIdx;
|
||||
plDrawable* fCurrDraw;
|
||||
hsTArray<plMorphArrayWeights> fArrayWeights;
|
||||
UInt8 fFlags;
|
||||
uint8_t fFlags;
|
||||
|
||||
plSharedMeshInfo() : fMesh(nil), fCurrDraw(nil), fFlags(0) {}
|
||||
};
|
||||
@ -109,19 +109,19 @@ protected:
|
||||
kHaveShared = 0x4,
|
||||
kDirtyIndices = 0x8
|
||||
};
|
||||
UInt32 fMorphFlags;
|
||||
uint32_t fMorphFlags;
|
||||
|
||||
hsTArray<plMorphArray> fMorphs;
|
||||
|
||||
//Int32 fActiveMesh; // Doesn't appear to be used.
|
||||
//int32_t fActiveMesh; // Doesn't appear to be used.
|
||||
hsTArray<plSharedMeshInfo> fSharedMeshes;
|
||||
hsTArray<plMorphState> fPendingStates;
|
||||
plMorphSequenceSDLMod* fMorphSDLMod;
|
||||
Int8 fGlobalLayerRef;
|
||||
int8_t fGlobalLayerRef;
|
||||
|
||||
const plDrawInterface* IGetDrawInterface() const;
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; }
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; }
|
||||
|
||||
void ISetHaveSnap(hsBool on) { if(on)fMorphFlags |= kHaveSnap; else fMorphFlags &= ~kHaveSnap; }
|
||||
void ISetDirty(hsBool on);
|
||||
@ -138,8 +138,8 @@ protected:
|
||||
void IFindIndices(); // Refresh Indicies
|
||||
void IApplyShared(); // Apply whatever morphs are active
|
||||
|
||||
Int32 IFindPendingStateIndex(plKey meshKey) const; // Do we have pending state for this mesh?
|
||||
Int32 IFindSharedMeshIndex(plKey meshKey) const; // What's this mesh's index in our array?
|
||||
int32_t IFindPendingStateIndex(plKey meshKey) const; // Do we have pending state for this mesh?
|
||||
int32_t IFindSharedMeshIndex(plKey meshKey) const; // What's this mesh's index in our array?
|
||||
hsBool IIsUsingDrawable(plDrawable *draw); // Are we actively looking at spans in this drawable?
|
||||
|
||||
// Internal functions for maintaining that all meshes share the same global weight(s) (fGlobalLayerRef)
|
||||
@ -173,8 +173,8 @@ public:
|
||||
void AddLayer(const plMorphArray& ma) { fMorphs.Append(ma); }
|
||||
|
||||
int GetNumDeltas(int iLay, plKey meshKey = nil) const;
|
||||
hsScalar GetWeight(int iLay, int iDel, plKey meshKey = nil) const;
|
||||
void SetWeight(int iLay, int iDel, hsScalar w, plKey meshKey = nil);
|
||||
float GetWeight(int iLay, int iDel, plKey meshKey = nil) const;
|
||||
void SetWeight(int iLay, int iDel, float w, plKey meshKey = nil);
|
||||
|
||||
hsBool GetHaveSnap() const { return 0 != (fMorphFlags & kHaveSnap); }
|
||||
hsBool GetDirty() const { return 0 != (fMorphFlags & kDirty); }
|
||||
|
@ -117,7 +117,7 @@ void plMorphSequenceSDLMod::IPutCurrentStateIn(plStateDataRecord* dstState)
|
||||
// store both in a single byte
|
||||
|
||||
// Translate the range [-1.0, 1.0] into a 0-255 byte
|
||||
UInt8 weight = (UInt8)((1.f + morphMod->GetWeight(j, 0, meshKey) - morphMod->GetWeight(j, 1, meshKey)) * 255 / 2);
|
||||
uint8_t weight = (uint8_t)((1.f + morphMod->GetWeight(j, 0, meshKey) - morphMod->GetWeight(j, 1, meshKey)) * 255 / 2);
|
||||
|
||||
weights->Set(&weight, j);
|
||||
}
|
||||
@ -159,7 +159,7 @@ void plMorphSequenceSDLMod::ISetCurrentStateFrom(const plStateDataRecord* srcSta
|
||||
|
||||
// meshKey will be nil when dealing with non-sharedMesh data
|
||||
if (meshKey)
|
||||
hsgResMgr::ResMgr()->AddViaNotify(meshKey, TRACKED_NEW plGenRefMsg(morphMod->GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kPassiveRef);
|
||||
hsgResMgr::ResMgr()->AddViaNotify(meshKey, new plGenRefMsg(morphMod->GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kPassiveRef);
|
||||
|
||||
plSimpleStateVariable *weights = morphSD->GetStateDataRecord(i)->FindVar(kStrWeights);
|
||||
|
||||
@ -167,10 +167,10 @@ void plMorphSequenceSDLMod::ISetCurrentStateFrom(const plStateDataRecord* srcSta
|
||||
// of plMorphSequence only has to resize the array once.
|
||||
for (j = weights->GetCount() - 1; j >= 0; j--)
|
||||
{
|
||||
UInt8 weight;
|
||||
uint8_t weight;
|
||||
weights->Get(&weight, j);
|
||||
hsScalar posWeight = weight * 2.f / 255.f - 1.f;
|
||||
hsScalar negWeight = 0;
|
||||
float posWeight = weight * 2.f / 255.f - 1.f;
|
||||
float negWeight = 0;
|
||||
|
||||
if (posWeight < 0)
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "plModifier/plSDLModifier.h"
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
//
|
||||
// This modifier is responsible for sending and recving
|
||||
@ -57,7 +57,7 @@ protected:
|
||||
void IPutCurrentStateIn(plStateDataRecord* dstState);
|
||||
void ISetCurrentStateFrom(const plStateDataRecord* srcState);
|
||||
|
||||
UInt32 IApplyModFlags(UInt32 sendFlags)
|
||||
uint32_t IApplyModFlags(uint32_t sendFlags)
|
||||
{
|
||||
if (fIsAvatar)
|
||||
return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState);
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include "plParticleFiller.h"
|
||||
|
||||
@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plParticleSystem/plParticleEmitter.h"
|
||||
#include "plParticleSystem/plParticle.h"
|
||||
|
||||
static hsScalar sInvDelSecs;
|
||||
static float sInvDelSecs;
|
||||
|
||||
//// Local Static Stuff ///////////////////////////////////////////////////////
|
||||
|
||||
@ -71,8 +71,8 @@ static hsScalar sInvDelSecs;
|
||||
fPtr[ 0 ] = point.fX; fPtr[ 1 ] = point.fY; fPtr[ 2 ] = point.fZ; \
|
||||
ptr += sizeof( float ) * 3; }
|
||||
|
||||
#define STUFF_UINT32( ptr, uint ) { UInt32 *dPtr = (UInt32 *)ptr; \
|
||||
dPtr[ 0 ] = uint; ptr += sizeof( UInt32 ); }
|
||||
#define STUFF_UINT32( ptr, uint ) { uint32_t *dPtr = (uint32_t *)ptr; \
|
||||
dPtr[ 0 ] = uint; ptr += sizeof( uint32_t ); }
|
||||
|
||||
#define EXTRACT_POINT( ptr, pt ) { float *fPtr = (float *)ptr; \
|
||||
pt.fX = fPtr[ 0 ]; pt.fY = fPtr[ 1 ]; pt.fZ = fPtr[ 2 ]; \
|
||||
@ -81,11 +81,11 @@ static hsScalar sInvDelSecs;
|
||||
f = fPtr[ 0 ]; \
|
||||
ptr += sizeof( float ); }
|
||||
|
||||
#define EXTRACT_UINT32( ptr, uint ) { UInt32 *dPtr = (UInt32 *)ptr; \
|
||||
uint = dPtr[ 0 ]; ptr += sizeof( UInt32 ); }
|
||||
#define EXTRACT_UINT32( ptr, uint ) { uint32_t *dPtr = (uint32_t *)ptr; \
|
||||
uint = dPtr[ 0 ]; ptr += sizeof( uint32_t ); }
|
||||
|
||||
|
||||
static hsScalar sCurrMinWidth = 0;
|
||||
static float sCurrMinWidth = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//// Particles ////////////////////////////////////////////////////////////////
|
||||
@ -155,7 +155,7 @@ void inline IInlSetParticlePathStretch( const plParticleCore &particle, const hs
|
||||
|
||||
hsPoint3 xlate = viewToWorld.GetTranslate();
|
||||
hsVector3 viewDir(&particle.fPos, &xlate);
|
||||
hsScalar invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared());
|
||||
float invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared());
|
||||
viewDir *= invD;
|
||||
|
||||
zVec = viewDir;
|
||||
@ -172,12 +172,12 @@ void inline IInlSetParticlePathStretch( const plParticleCore &particle, const hs
|
||||
|
||||
xVec = yVec % viewDir; // cross product of two orthonormal vectors, no need to normalize.
|
||||
|
||||
hsScalar xLen = particle.fHSize;
|
||||
float xLen = particle.fHSize;
|
||||
if( xLen * invD < sCurrMinWidth )
|
||||
xLen = sCurrMinWidth / invD;
|
||||
xVec *= xLen;
|
||||
|
||||
hsScalar len = yVec.InnerProduct(orientation);
|
||||
float len = yVec.InnerProduct(orientation);
|
||||
// Might want to give it a little boost to overlap itself (and compensate for the massive
|
||||
// transparent border the artists love). But they can do that themselves with the VSize.
|
||||
// len *= 1.5f;
|
||||
@ -195,7 +195,7 @@ void inline IInlSetParticlePathFlow( const plParticleCore &particle, const hsMat
|
||||
|
||||
hsPoint3 xlate = viewToWorld.GetTranslate();
|
||||
hsVector3 viewDir(&particle.fPos, &xlate);
|
||||
hsScalar invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared());
|
||||
float invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared());
|
||||
viewDir *= invD;
|
||||
|
||||
zVec = viewDir;
|
||||
@ -212,9 +212,9 @@ void inline IInlSetParticlePathFlow( const plParticleCore &particle, const hsMat
|
||||
|
||||
xVec = yVec % viewDir; // cross product of two orthonormal vectors, no need to normalize.
|
||||
|
||||
hsScalar len = yVec.InnerProduct(orientation);
|
||||
float len = yVec.InnerProduct(orientation);
|
||||
|
||||
hsScalar xLen = particle.fHSize * hsFastMath::InvSqrtAppr(1.f + len * sInvDelSecs);
|
||||
float xLen = particle.fHSize * hsFastMath::InvSqrtAppr(1.f + len * sInvDelSecs);
|
||||
if( xLen * invD < sCurrMinWidth )
|
||||
xLen = sCurrMinWidth / invD;
|
||||
xVec *= xLen;
|
||||
@ -259,7 +259,7 @@ void inline IInlSetParticleExplicit( const hsMatrix44 &viewToWorld, const plPart
|
||||
}
|
||||
|
||||
void inline IInlSetParticlePoints( const hsVector3 &xVec, const hsVector3 &yVec, const plParticleCore &particle,
|
||||
hsPoint3 *partPts, UInt32 &partColor )
|
||||
hsPoint3 *partPts, uint32_t &partColor )
|
||||
{
|
||||
/// Do the 4 verts for this particle
|
||||
partPts[ 0 ] = partPts[ 1 ] = partPts[ 2 ] = partPts[ 3 ] = particle.fPos;
|
||||
@ -272,7 +272,7 @@ void inline IInlSetParticlePoints( const hsVector3 &xVec, const hsVector3 &yVec,
|
||||
}
|
||||
|
||||
void inline IInlSetParticlePointsStretch( const hsVector3 &xVec, const hsVector3 &yVec, const plParticleCore &particle,
|
||||
hsPoint3 *partPts, UInt32 &partColor )
|
||||
hsPoint3 *partPts, uint32_t &partColor )
|
||||
{
|
||||
/// Do the 4 verts for this particle
|
||||
partPts[ 0 ] = partPts[ 1 ] = partPts[ 2 ] = partPts[ 3 ] = particle.fPos;
|
||||
@ -284,10 +284,10 @@ void inline IInlSetParticlePointsStretch( const hsVector3 &xVec, const hsVector3
|
||||
partColor = particle.fColor;
|
||||
}
|
||||
|
||||
void inline IInlStuffParticle1UV( UInt8 *&destPtr, const hsPoint3 *partPts, const hsVector3 &partNorm,
|
||||
const UInt32 &partColor, const plParticleCore &particle )
|
||||
void inline IInlStuffParticle1UV( uint8_t *&destPtr, const hsPoint3 *partPts, const hsVector3 &partNorm,
|
||||
const uint32_t &partColor, const plParticleCore &particle )
|
||||
{
|
||||
UInt8 j;
|
||||
uint8_t j;
|
||||
|
||||
|
||||
for( j = 0; j < 4; j++ )
|
||||
@ -300,10 +300,10 @@ void inline IInlStuffParticle1UV( UInt8 *&destPtr, const hsPoint3 *partPts, cons
|
||||
}
|
||||
}
|
||||
|
||||
void inline IInlStuffParticleNoUVs( UInt8 *&destPtr, const hsPoint3 *partPts, const hsVector3 &partNorm,
|
||||
const UInt32 &partColor )
|
||||
void inline IInlStuffParticleNoUVs( uint8_t *&destPtr, const hsPoint3 *partPts, const hsVector3 &partNorm,
|
||||
const uint32_t &partColor )
|
||||
{
|
||||
UInt8 j;
|
||||
uint8_t j;
|
||||
|
||||
|
||||
for( j = 0; j < 4; j++ )
|
||||
@ -352,12 +352,12 @@ void inline IInlSetNormalExplicit( hsVector3 &partNorm, const plParticleCore &pa
|
||||
// or NExp (for explicit)
|
||||
|
||||
#define IIPL_PROLOG \
|
||||
UInt32 i, partColor; \
|
||||
uint32_t i, partColor; \
|
||||
hsVector3 xVec, yVec, zVec, partNorm; \
|
||||
hsPoint3 partPts[ 4 ]; \
|
||||
for( i = 0; i < numParticles; i++ )
|
||||
|
||||
void inline IIPL_1UV_OVel_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_1UV_OVel_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -368,7 +368,7 @@ void inline IIPL_1UV_OVel_NViewFace( const UInt32 &numParticles, const plParticl
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_1UV_OVel_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr,
|
||||
void inline IIPL_1UV_OVel_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr,
|
||||
const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
@ -380,7 +380,7 @@ void inline IIPL_1UV_OVel_NLite( const UInt32 &numParticles, const plParticleCor
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_1UV_OVel_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_1UV_OVel_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -391,7 +391,7 @@ void inline IIPL_1UV_OVel_NExp( const UInt32 &numParticles, const plParticleCore
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_1UV_OStr_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_1UV_OStr_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -402,7 +402,7 @@ void inline IIPL_1UV_OStr_NViewFace( const UInt32 &numParticles, const plParticl
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_1UV_OStr_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr,
|
||||
void inline IIPL_1UV_OStr_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr,
|
||||
const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
@ -414,7 +414,7 @@ void inline IIPL_1UV_OStr_NLite( const UInt32 &numParticles, const plParticleCor
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_1UV_OStr_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_1UV_OStr_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -425,7 +425,7 @@ void inline IIPL_1UV_OStr_NExp( const UInt32 &numParticles, const plParticleCore
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_1UV_OFlo_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_1UV_OFlo_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -436,7 +436,7 @@ void inline IIPL_1UV_OFlo_NViewFace( const UInt32 &numParticles, const plParticl
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_1UV_OFlo_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr,
|
||||
void inline IIPL_1UV_OFlo_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr,
|
||||
const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
@ -448,7 +448,7 @@ void inline IIPL_1UV_OFlo_NLite( const UInt32 &numParticles, const plParticleCor
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_1UV_OFlo_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_1UV_OFlo_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -459,7 +459,7 @@ void inline IIPL_1UV_OFlo_NExp( const UInt32 &numParticles, const plParticleCore
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_1UV_OExp_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_1UV_OExp_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -470,7 +470,7 @@ void inline IIPL_1UV_OExp_NViewFace( const UInt32 &numParticles, const plParticl
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_1UV_OExp_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr,
|
||||
void inline IIPL_1UV_OExp_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr,
|
||||
const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
@ -482,7 +482,7 @@ void inline IIPL_1UV_OExp_NLite( const UInt32 &numParticles, const plParticleCor
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_1UV_OExp_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_1UV_OExp_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -493,7 +493,7 @@ void inline IIPL_1UV_OExp_NExp( const UInt32 &numParticles, const plParticleCore
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_0UV_OVel_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_0UV_OVel_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -504,7 +504,7 @@ void inline IIPL_0UV_OVel_NViewFace( const UInt32 &numParticles, const plParticl
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_0UV_OVel_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr,
|
||||
void inline IIPL_0UV_OVel_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr,
|
||||
const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
@ -516,7 +516,7 @@ void inline IIPL_0UV_OVel_NLite( const UInt32 &numParticles, const plParticleCor
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_0UV_OVel_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_0UV_OVel_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -527,7 +527,7 @@ void inline IIPL_0UV_OVel_NExp( const UInt32 &numParticles, const plParticleCore
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_0UV_OStr_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_0UV_OStr_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -538,7 +538,7 @@ void inline IIPL_0UV_OStr_NViewFace( const UInt32 &numParticles, const plParticl
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_0UV_OStr_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr,
|
||||
void inline IIPL_0UV_OStr_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr,
|
||||
const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
@ -550,7 +550,7 @@ void inline IIPL_0UV_OStr_NLite( const UInt32 &numParticles, const plParticleCor
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_0UV_OStr_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_0UV_OStr_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -561,7 +561,7 @@ void inline IIPL_0UV_OStr_NExp( const UInt32 &numParticles, const plParticleCore
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_0UV_OFlo_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_0UV_OFlo_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -572,7 +572,7 @@ void inline IIPL_0UV_OFlo_NViewFace( const UInt32 &numParticles, const plParticl
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_0UV_OFlo_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr,
|
||||
void inline IIPL_0UV_OFlo_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr,
|
||||
const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
@ -584,7 +584,7 @@ void inline IIPL_0UV_OFlo_NLite( const UInt32 &numParticles, const plParticleCor
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_0UV_OFlo_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_0UV_OFlo_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -595,7 +595,7 @@ void inline IIPL_0UV_OFlo_NExp( const UInt32 &numParticles, const plParticleCore
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_0UV_OExp_NViewFace( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_0UV_OExp_NViewFace( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -606,7 +606,7 @@ void inline IIPL_0UV_OExp_NViewFace( const UInt32 &numParticles, const plParticl
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_0UV_OExp_NLite( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr,
|
||||
void inline IIPL_0UV_OExp_NLite( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr,
|
||||
const plOmniLightInfo *omniLight, const plDirectionalLightInfo *directionLight )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
@ -618,7 +618,7 @@ void inline IIPL_0UV_OExp_NLite( const UInt32 &numParticles, const plParticleCor
|
||||
}
|
||||
}
|
||||
|
||||
void inline IIPL_0UV_OExp_NExp( const UInt32 &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, UInt8 *&destPtr )
|
||||
void inline IIPL_0UV_OExp_NExp( const uint32_t &numParticles, const plParticleCore *particles, const hsMatrix44& viewToWorld, uint8_t *&destPtr )
|
||||
{
|
||||
IIPL_PROLOG
|
||||
{
|
||||
@ -647,11 +647,11 @@ void plParticleFiller::FillParticles(plPipeline* pipe, plDrawableSpans* drawable
|
||||
sInvDelSecs = 1.f / sInvDelSecs;
|
||||
|
||||
const plParticleCore* particles = span->fSource->GetParticleArray();
|
||||
const UInt32 numParticles = span->fNumParticles;
|
||||
const uint32_t numParticles = span->fNumParticles;
|
||||
|
||||
plGBufferGroup* group = drawable->GetBufferGroup(span->fGroupIdx);
|
||||
|
||||
UInt8* destPtr = group->GetVertBufferData(span->fVBufferIdx);
|
||||
uint8_t* destPtr = group->GetVertBufferData(span->fVBufferIdx);
|
||||
|
||||
destPtr += span->fVStartIdx * group->GetVertexSize();
|
||||
|
||||
@ -798,14 +798,14 @@ void plParticleFiller::FillParticlePolys(plPipeline* pipe, plDrawInterface* di)
|
||||
|
||||
// Currently, the di always points to exactly 1 drawable with 1 span index. If
|
||||
// that changes, this would just become a loop.
|
||||
UInt32 diIndex = di->GetDrawableMeshIndex(0);
|
||||
uint32_t diIndex = di->GetDrawableMeshIndex(0);
|
||||
hsAssert(diIndex >= 0, "Bogus input to fill particles");
|
||||
|
||||
const plDISpanIndex& diSpans = drawable->GetDISpans(diIndex);
|
||||
int i;
|
||||
for( i = 0; i < diSpans.GetCount(); i++ )
|
||||
{
|
||||
UInt32 spanIdx = diSpans[i];
|
||||
uint32_t spanIdx = diSpans[i];
|
||||
hsAssert(drawable->GetSpan(spanIdx), "Bogus input to fill particles");
|
||||
hsAssert(drawable->GetSpan(spanIdx)->fTypeMask & plSpan::kParticleSpan, "Bogus input to fill particles");
|
||||
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plPrintShape.h"
|
||||
|
||||
#include "hsStream.h"
|
||||
|
@ -48,9 +48,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
class plPrintShape : public plObjInterface
|
||||
{
|
||||
protected:
|
||||
hsScalar fWidth;
|
||||
hsScalar fLength;
|
||||
hsScalar fHeight;
|
||||
float fWidth;
|
||||
float fLength;
|
||||
float fHeight;
|
||||
public:
|
||||
plPrintShape();
|
||||
virtual ~plPrintShape();
|
||||
@ -59,19 +59,19 @@ public:
|
||||
GETINTERFACE_ANY( plPrintShape, plObjInterface );
|
||||
|
||||
|
||||
virtual Int32 GetNumProperties() const { return 1; }
|
||||
virtual int32_t GetNumProperties() const { return 1; }
|
||||
virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) {}
|
||||
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
hsScalar GetWidth() const { return fWidth; }
|
||||
hsScalar GetLength() const { return fLength; }
|
||||
hsScalar GetHeight() const { return fHeight; }
|
||||
float GetWidth() const { return fWidth; }
|
||||
float GetLength() const { return fLength; }
|
||||
float GetHeight() const { return fHeight; }
|
||||
|
||||
void SetWidth(hsScalar f) { fWidth = f; }
|
||||
void SetLength(hsScalar f) { fLength = f; }
|
||||
void SetHeight(hsScalar f) { fHeight = f; }
|
||||
void SetWidth(float f) { fWidth = f; }
|
||||
void SetLength(float f) { fLength = f; }
|
||||
void SetHeight(float f) { fHeight = f; }
|
||||
};
|
||||
|
||||
#endif // plPrintShape_inc
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plProxyGen.h"
|
||||
|
||||
#include "plSurface/hsGMaterial.h"
|
||||
@ -56,9 +56,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
static hsTArray<plDrawableSpans*> fProxyDrawables;
|
||||
static hsTArray<hsGMaterial*> fProxyMaterials;
|
||||
static UInt32 fProxyKeyCounter = 0;
|
||||
static uint32_t fProxyKeyCounter = 0;
|
||||
|
||||
plProxyGen::plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, hsScalar opac)
|
||||
plProxyGen::plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, float opac)
|
||||
: fProxyMsgType(0),
|
||||
fProxyDraw(nil),
|
||||
fProxyMat(nil)
|
||||
@ -100,7 +100,7 @@ void plProxyGen::Init(const hsKeyedObject* owner)
|
||||
|
||||
}
|
||||
|
||||
UInt32 plProxyGen::IGetDrawableType() const
|
||||
uint32_t plProxyGen::IGetDrawableType() const
|
||||
{
|
||||
switch( fProxyMsgType & plProxyDrawMsg::kAllTypes )
|
||||
{
|
||||
@ -121,10 +121,10 @@ UInt32 plProxyGen::IGetDrawableType() const
|
||||
return plDrawable::kGenericProxy;
|
||||
}
|
||||
|
||||
UInt32 plProxyGen::IGetProxyIndex() const
|
||||
uint32_t plProxyGen::IGetProxyIndex() const
|
||||
{
|
||||
plKey sceneNode = IGetNode();
|
||||
UInt32 drawType = IGetDrawableType();
|
||||
uint32_t drawType = IGetDrawableType();
|
||||
|
||||
int firstNil = -1;
|
||||
int firstMatch = -1;
|
||||
@ -153,9 +153,9 @@ hsGMaterial* plProxyGen::IMakeProxyMaterial() const
|
||||
{
|
||||
const hsColorRGBA& amb = fAmbient;
|
||||
const hsColorRGBA& dif = fColor;
|
||||
hsScalar opac = fAmbient.a;
|
||||
float opac = fAmbient.a;
|
||||
|
||||
hsGMaterial* retVal = TRACKED_NEW hsGMaterial();
|
||||
hsGMaterial* retVal = new hsGMaterial();
|
||||
|
||||
plString buff;
|
||||
if( !GetKey()->GetName().IsNull() )
|
||||
@ -220,7 +220,7 @@ void plProxyGen::IGenerateProxy()
|
||||
if( !IGetNode() )
|
||||
return;
|
||||
|
||||
UInt32 idx = IGetProxyIndex();
|
||||
uint32_t idx = IGetProxyIndex();
|
||||
|
||||
hsGMaterial* mat = IGetProxyMaterial();
|
||||
hsAssert(mat, "Failed to create proxy material");
|
||||
@ -247,11 +247,11 @@ void plProxyGen::IGenerateProxy()
|
||||
|
||||
IApplyProxy(idx);
|
||||
|
||||
plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, idx, 0);
|
||||
plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, idx, 0);
|
||||
hsgResMgr::ResMgr()->AddViaNotify(mat->GetKey(), msg, plRefFlags::kActiveRef);
|
||||
fProxyMat = mat;
|
||||
|
||||
plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg( GetKey(), plNodeRefMsg::kOnRequest, (Int8)idx, plNodeRefMsg::kDrawable );
|
||||
plNodeRefMsg* refMsg = new plNodeRefMsg( GetKey(), plNodeRefMsg::kOnRequest, (int8_t)idx, plNodeRefMsg::kDrawable );
|
||||
hsgResMgr::ResMgr()->AddViaNotify(fProxyDrawables[idx]->GetKey(), refMsg, plRefFlags::kActiveRef);
|
||||
fProxyDraw = fProxyDrawables[idx];
|
||||
}
|
||||
@ -259,7 +259,7 @@ void plProxyGen::IGenerateProxy()
|
||||
|
||||
//// IApplyProxy
|
||||
// Add our proxy to our scenenode for rendering.
|
||||
void plProxyGen::IApplyProxy(UInt32 idx) const
|
||||
void plProxyGen::IApplyProxy(uint32_t idx) const
|
||||
{
|
||||
if( fProxyDrawables[idx] && IGetNode() && (fProxyDrawables[idx]->GetSceneNode() != IGetNode()) )
|
||||
{
|
||||
@ -269,7 +269,7 @@ void plProxyGen::IApplyProxy(UInt32 idx) const
|
||||
|
||||
//// IRemoveProxy
|
||||
// Remove our proxy from our scenenode.
|
||||
void plProxyGen::IRemoveProxy(UInt32 idx) const
|
||||
void plProxyGen::IRemoveProxy(uint32_t idx) const
|
||||
{
|
||||
if( fProxyDrawables[idx] )
|
||||
{
|
||||
@ -347,7 +347,7 @@ hsBool plProxyGen::MsgReceive(plMessage* msg)
|
||||
|
||||
void plProxyGen::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l)
|
||||
{
|
||||
UInt32 idx = IGetProxyIndex();
|
||||
uint32_t idx = IGetProxyIndex();
|
||||
if( fProxyDrawables[idx] )
|
||||
{
|
||||
int i;
|
||||
@ -358,7 +358,7 @@ void plProxyGen::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l)
|
||||
|
||||
void plProxyGen::SetDisable(hsBool on)
|
||||
{
|
||||
UInt32 idx = IGetProxyIndex();
|
||||
uint32_t idx = IGetProxyIndex();
|
||||
if( fProxyDrawables[idx] )
|
||||
{
|
||||
int i;
|
||||
|
@ -92,31 +92,31 @@ protected:
|
||||
plDrawableSpans* fProxyDraw;
|
||||
hsGMaterial* fProxyMat;
|
||||
|
||||
UInt32 fProxyMsgType;
|
||||
uint32_t fProxyMsgType;
|
||||
|
||||
hsTArray<UInt32> fProxyIndex;
|
||||
hsTArray<uint32_t> fProxyIndex;
|
||||
|
||||
// These must be implemented by the specific type, so we know what to draw.
|
||||
virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo=nil) = 0; // called by IGenerate
|
||||
virtual plDrawableSpans* ICreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo=nil) = 0; // called by IGenerate
|
||||
virtual plKey IGetNode() const = 0;
|
||||
|
||||
// Derived type should set fProxyMsgType as one of plProxyDrawMsg::types
|
||||
UInt32 IGetProxyMsgType() const { return fProxyMsgType; }
|
||||
uint32_t IGetProxyMsgType() const { return fProxyMsgType; }
|
||||
|
||||
// These are all fine by default.
|
||||
UInt32 IGetProxyIndex() const;
|
||||
UInt32 IGetDrawableType() const;
|
||||
uint32_t IGetProxyIndex() const;
|
||||
uint32_t IGetDrawableType() const;
|
||||
|
||||
virtual hsGMaterial* IMakeProxyMaterial() const;
|
||||
virtual hsGMaterial* IGetProxyMaterial() const; // will make material if needed.
|
||||
hsGMaterial* IFindProxyMaterial() const;
|
||||
|
||||
virtual void IGenerateProxy();
|
||||
virtual void IApplyProxy(UInt32 drawIdx) const; // called by IGenerate
|
||||
virtual void IRemoveProxy(UInt32 drawIdx) const;
|
||||
virtual void IApplyProxy(uint32_t drawIdx) const; // called by IGenerate
|
||||
virtual void IRemoveProxy(uint32_t drawIdx) const;
|
||||
virtual void IDestroyProxy();
|
||||
public:
|
||||
plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, hsScalar opac);
|
||||
plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, float opac);
|
||||
virtual ~plProxyGen();
|
||||
|
||||
virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l);
|
||||
|
@ -46,16 +46,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
class plRipVSConsts
|
||||
{
|
||||
public:
|
||||
hsScalar fC1U;
|
||||
hsScalar fC2U;
|
||||
hsScalar fC1V;
|
||||
hsScalar fC2V;
|
||||
float fC1U;
|
||||
float fC2U;
|
||||
float fC1V;
|
||||
float fC2V;
|
||||
|
||||
hsScalar fInitAtten;
|
||||
hsScalar fLife;
|
||||
hsScalar fDecay;
|
||||
float fInitAtten;
|
||||
float fLife;
|
||||
float fDecay;
|
||||
|
||||
hsScalar fRamp;
|
||||
float fRamp;
|
||||
};
|
||||
|
||||
|
||||
|
@ -59,7 +59,7 @@ plSharedMesh::~plSharedMesh()
|
||||
delete fSpans.Pop();
|
||||
}
|
||||
/*
|
||||
void plSharedMesh::CreateInstance(plSceneObject *so, UInt8 boneIndex)
|
||||
void plSharedMesh::CreateInstance(plSceneObject *so, uint8_t boneIndex)
|
||||
{
|
||||
plDrawInterface *di = so->GetVolatileDrawInterface();
|
||||
|
||||
@ -111,11 +111,11 @@ void plSharedMesh::Read(hsStream* s, hsResMgr* mgr)
|
||||
fSpans.SetCount(s->ReadLE32());
|
||||
for (i = 0; i < fSpans.GetCount(); i++)
|
||||
{
|
||||
fSpans[i] = TRACKED_NEW plGeometrySpan;
|
||||
fSpans[i] = new plGeometrySpan;
|
||||
fSpans[i]->Read(s);
|
||||
}
|
||||
|
||||
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef);
|
||||
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef);
|
||||
fFlags = s->ReadByte();
|
||||
}
|
||||
|
||||
|
@ -65,12 +65,12 @@ public:
|
||||
hsTArray<plGeometrySpan *>fSpans;
|
||||
hsTArray<const plSceneObject *> fActiveInstances;
|
||||
plMorphDataSet *fMorphSet;
|
||||
UInt8 fFlags;
|
||||
uint8_t fFlags;
|
||||
|
||||
plSharedMesh();
|
||||
~plSharedMesh();
|
||||
|
||||
void CreateInstance(plSceneObject *so, UInt8 boneIndex);
|
||||
void CreateInstance(plSceneObject *so, uint8_t boneIndex);
|
||||
void RemoveInstance(plSceneObject *so);
|
||||
|
||||
CLASSNAME_REGISTER( plSharedMesh );
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plSpaceTree.h"
|
||||
#include "hsStream.h"
|
||||
#include "hsBitVector.h"
|
||||
@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
static hsBitVector scratchTotVec;
|
||||
static hsBitVector scratchBitVec;
|
||||
static hsTArray<Int16> scratchList;
|
||||
static hsTArray<int16_t> scratchList;
|
||||
static hsTArray<hsRadixSort::Elem> scratchSort;
|
||||
|
||||
plProfile_CreateCounter("Harvest Leaves", "Draw", HarvestLeaves);
|
||||
@ -92,7 +92,7 @@ plSpaceTree::~plSpaceTree()
|
||||
{
|
||||
}
|
||||
|
||||
void plSpaceTree::IRefreshRecur(Int16 which)
|
||||
void plSpaceTree::IRefreshRecur(int16_t which)
|
||||
{
|
||||
plSpaceTreeNode& sub = fTree[which];
|
||||
|
||||
@ -123,7 +123,7 @@ void plSpaceTree::Refresh()
|
||||
IRefreshRecur(fRoot);
|
||||
}
|
||||
|
||||
void plSpaceTree::SetTreeFlag(UInt16 f, hsBool on)
|
||||
void plSpaceTree::SetTreeFlag(uint16_t f, hsBool on)
|
||||
{
|
||||
if( IsEmpty() )
|
||||
return;
|
||||
@ -139,7 +139,7 @@ void plSpaceTree::SetTreeFlag(UInt16 f, hsBool on)
|
||||
fTree[i].fFlags |= f;
|
||||
}
|
||||
|
||||
void plSpaceTree::ClearTreeFlag(UInt16 f)
|
||||
void plSpaceTree::ClearTreeFlag(uint16_t f)
|
||||
{
|
||||
if( IsEmpty() )
|
||||
return;
|
||||
@ -149,7 +149,7 @@ void plSpaceTree::ClearTreeFlag(UInt16 f)
|
||||
fTree[i].fFlags &= ~f;
|
||||
}
|
||||
|
||||
void plSpaceTree::SetLeafFlag(Int16 idx, UInt16 f, hsBool on)
|
||||
void plSpaceTree::SetLeafFlag(int16_t idx, uint16_t f, hsBool on)
|
||||
{
|
||||
if( IsEmpty() )
|
||||
return;
|
||||
@ -181,7 +181,7 @@ void plSpaceTree::SetLeafFlag(Int16 idx, UInt16 f, hsBool on)
|
||||
}
|
||||
}
|
||||
|
||||
void plSpaceTree::ClearLeafFlag(Int16 idx, UInt16 f)
|
||||
void plSpaceTree::ClearLeafFlag(int16_t idx, uint16_t f)
|
||||
{
|
||||
hsAssert(idx == fTree[idx].fLeafIndex, "Some scrambling of indices");
|
||||
|
||||
@ -200,7 +200,7 @@ void plSpaceTree::ClearLeafFlag(Int16 idx, UInt16 f)
|
||||
|
||||
}
|
||||
|
||||
inline void plSpaceTree::IEnableLeaf(Int16 idx, hsBitVector& cache) const
|
||||
inline void plSpaceTree::IEnableLeaf(int16_t idx, hsBitVector& cache) const
|
||||
{
|
||||
|
||||
cache.SetBit(idx);
|
||||
@ -221,12 +221,12 @@ inline void plSpaceTree::IEnableLeaf(Int16 idx, hsBitVector& cache) const
|
||||
}
|
||||
}
|
||||
|
||||
void plSpaceTree::EnableLeaf(Int16 idx, hsBitVector& cache) const
|
||||
void plSpaceTree::EnableLeaf(int16_t idx, hsBitVector& cache) const
|
||||
{
|
||||
IEnableLeaf(idx, cache);
|
||||
}
|
||||
|
||||
void plSpaceTree::EnableLeaves(const hsTArray<Int16>& list, hsBitVector& cache) const
|
||||
void plSpaceTree::EnableLeaves(const hsTArray<int16_t>& list, hsBitVector& cache) const
|
||||
{
|
||||
if( IsEmpty() )
|
||||
return;
|
||||
@ -237,7 +237,7 @@ void plSpaceTree::EnableLeaves(const hsTArray<Int16>& list, hsBitVector& cache)
|
||||
}
|
||||
}
|
||||
|
||||
void plSpaceTree::IHarvestAndCullEnabledLeaves(Int16 subIdx, const hsBitVector& cache, hsTArray<Int16>& list) const
|
||||
void plSpaceTree::IHarvestAndCullEnabledLeaves(int16_t subIdx, const hsBitVector& cache, hsTArray<int16_t>& list) const
|
||||
{
|
||||
if( !cache.IsBitSet(subIdx) )
|
||||
return;
|
||||
@ -267,7 +267,7 @@ void plSpaceTree::IHarvestAndCullEnabledLeaves(Int16 subIdx, const hsBitVector&
|
||||
}
|
||||
}
|
||||
|
||||
void plSpaceTree::IHarvestEnabledLeaves(Int16 subIdx, const hsBitVector& cache, hsTArray<Int16>& list) const
|
||||
void plSpaceTree::IHarvestEnabledLeaves(int16_t subIdx, const hsBitVector& cache, hsTArray<int16_t>& list) const
|
||||
{
|
||||
if( !cache.IsBitSet(subIdx) )
|
||||
return;
|
||||
@ -286,7 +286,7 @@ void plSpaceTree::IHarvestEnabledLeaves(Int16 subIdx, const hsBitVector& cache,
|
||||
}
|
||||
}
|
||||
|
||||
void plSpaceTree::HarvestEnabledLeaves(plVolumeIsect* cull, const hsBitVector& cache, hsTArray<Int16>& list) const
|
||||
void plSpaceTree::HarvestEnabledLeaves(plVolumeIsect* cull, const hsBitVector& cache, hsTArray<int16_t>& list) const
|
||||
{
|
||||
if( IsEmpty() )
|
||||
return;
|
||||
@ -297,7 +297,7 @@ void plSpaceTree::HarvestEnabledLeaves(plVolumeIsect* cull, const hsBitVector& c
|
||||
IHarvestEnabledLeaves(fRoot, cache, list);
|
||||
}
|
||||
|
||||
void plSpaceTree::IHarvestEnabledLeaves(Int16 subIdx, const hsBitVector& cache, hsBitVector& totList, hsBitVector& list) const
|
||||
void plSpaceTree::IHarvestEnabledLeaves(int16_t subIdx, const hsBitVector& cache, hsBitVector& totList, hsBitVector& list) const
|
||||
{
|
||||
if( IsDisabled(subIdx) )
|
||||
return;
|
||||
@ -320,7 +320,7 @@ void plSpaceTree::IHarvestEnabledLeaves(Int16 subIdx, const hsBitVector& cache,
|
||||
}
|
||||
}
|
||||
|
||||
void plSpaceTree::MoveLeaf(Int16 idx, const hsBounds3Ext& bnd)
|
||||
void plSpaceTree::MoveLeaf(int16_t idx, const hsBounds3Ext& bnd)
|
||||
{
|
||||
hsAssert(idx == fTree[idx].fLeafIndex, "Some scrambling of indices");
|
||||
|
||||
@ -340,7 +340,7 @@ void plSpaceTree::MoveLeaf(Int16 idx, const hsBounds3Ext& bnd)
|
||||
}
|
||||
}
|
||||
|
||||
void plSpaceTree::HarvestLeaves(Int16 subRoot, hsBitVector& totList, hsBitVector& list) const
|
||||
void plSpaceTree::HarvestLeaves(int16_t subRoot, hsBitVector& totList, hsBitVector& list) const
|
||||
{
|
||||
if( !IsEmpty() )
|
||||
{
|
||||
@ -380,13 +380,13 @@ void plSpaceTree::HarvestLeaves(plVolumeIsect* cull, hsBitVector& list) const
|
||||
scratchTotVec.Clear();
|
||||
}
|
||||
|
||||
void plSpaceTree::HarvestLeaves(Int16 subRoot, hsBitVector& list) const
|
||||
void plSpaceTree::HarvestLeaves(int16_t subRoot, hsBitVector& list) const
|
||||
{
|
||||
IHarvestLeaves(GetNode(subRoot), scratchTotVec, list);
|
||||
scratchTotVec.Clear();
|
||||
}
|
||||
|
||||
void plSpaceTree::HarvestLeaves(plVolumeIsect* cull, hsTArray<Int16>& list) const
|
||||
void plSpaceTree::HarvestLeaves(plVolumeIsect* cull, hsTArray<int16_t>& list) const
|
||||
{
|
||||
if( !IsEmpty() )
|
||||
{
|
||||
@ -397,7 +397,7 @@ void plSpaceTree::HarvestLeaves(plVolumeIsect* cull, hsTArray<Int16>& list) cons
|
||||
}
|
||||
}
|
||||
|
||||
void plSpaceTree::HarvestLeaves(hsTArray<Int16>& list) const
|
||||
void plSpaceTree::HarvestLeaves(hsTArray<int16_t>& list) const
|
||||
{
|
||||
if( !IsEmpty() )
|
||||
{
|
||||
@ -408,7 +408,7 @@ void plSpaceTree::HarvestLeaves(hsTArray<Int16>& list) const
|
||||
}
|
||||
}
|
||||
|
||||
void plSpaceTree::HarvestLeaves(Int16 subRoot, hsTArray<Int16>& list) const
|
||||
void plSpaceTree::HarvestLeaves(int16_t subRoot, hsTArray<int16_t>& list) const
|
||||
{
|
||||
if( !IsEmpty() )
|
||||
{
|
||||
@ -420,7 +420,7 @@ void plSpaceTree::HarvestLeaves(Int16 subRoot, hsTArray<Int16>& list) const
|
||||
}
|
||||
}
|
||||
|
||||
void plSpaceTree::BitVectorToList(hsTArray<Int16>& list, const hsBitVector& bitVec) const
|
||||
void plSpaceTree::BitVectorToList(hsTArray<int16_t>& list, const hsBitVector& bitVec) const
|
||||
{
|
||||
#if 0 // added func to bitvector
|
||||
int i;
|
||||
@ -472,7 +472,7 @@ void plSpaceTree::IHarvestAndCullLeaves(const plSpaceTreeNode& subRoot, hsBitVec
|
||||
}
|
||||
}
|
||||
|
||||
void plSpaceTree::IHarvestAndCullLeaves(const plSpaceTreeNode& subRoot, hsTArray<Int16>& list) const
|
||||
void plSpaceTree::IHarvestAndCullLeaves(const plSpaceTreeNode& subRoot, hsTArray<int16_t>& list) const
|
||||
{
|
||||
if( subRoot.fFlags & plSpaceTreeNode::kDisabled )
|
||||
return;
|
||||
@ -525,7 +525,7 @@ void plSpaceTree::IHarvestLeaves(const plSpaceTreeNode& subRoot, hsBitVector& to
|
||||
}
|
||||
}
|
||||
|
||||
void plSpaceTree::IHarvestLeaves(const plSpaceTreeNode& subRoot, hsTArray<Int16>& list) const
|
||||
void plSpaceTree::IHarvestLeaves(const plSpaceTreeNode& subRoot, hsTArray<int16_t>& list) const
|
||||
{
|
||||
if( subRoot.fFlags & plSpaceTreeNode::kDisabled )
|
||||
return;
|
||||
@ -547,9 +547,9 @@ void plSpaceTree::Read(hsStream* s, hsResMgr* mgr)
|
||||
|
||||
fRoot = s->ReadLE16();
|
||||
|
||||
fNumLeaves = UInt16(s->ReadLE32());
|
||||
fNumLeaves = uint16_t(s->ReadLE32());
|
||||
|
||||
UInt32 n = s->ReadLE32();
|
||||
uint32_t n = s->ReadLE32();
|
||||
fTree.SetCount(n);
|
||||
int i;
|
||||
for( i = 0; i < n; i++ )
|
||||
@ -574,7 +574,7 @@ void plSpaceTree::Write(hsStream* s, hsResMgr* mgr)
|
||||
|
||||
// Some debug only stuff
|
||||
|
||||
void plSpaceTree::HarvestLevel(int level, hsTArray<Int16>& list) const
|
||||
void plSpaceTree::HarvestLevel(int level, hsTArray<int16_t>& list) const
|
||||
{
|
||||
if( !IsEmpty() )
|
||||
{
|
||||
@ -582,7 +582,7 @@ void plSpaceTree::HarvestLevel(int level, hsTArray<Int16>& list) const
|
||||
}
|
||||
}
|
||||
|
||||
void plSpaceTree::IHarvestLevel(Int16 subRoot, int level, int currLevel, hsTArray<Int16>& list) const
|
||||
void plSpaceTree::IHarvestLevel(int16_t subRoot, int level, int currLevel, hsTArray<int16_t>& list) const
|
||||
{
|
||||
if( level == currLevel )
|
||||
{
|
||||
|
@ -66,16 +66,16 @@ public:
|
||||
|
||||
hsBounds3Ext fWorldBounds;
|
||||
|
||||
UInt16 fFlags; // mostly for alignment;
|
||||
Int16 fParent;
|
||||
uint16_t fFlags; // mostly for alignment;
|
||||
int16_t fParent;
|
||||
union {
|
||||
Int16 fChildren[2]; // Children are actually in same array as parent
|
||||
Int16 fLeafIndex;
|
||||
int16_t fChildren[2]; // Children are actually in same array as parent
|
||||
int16_t fLeafIndex;
|
||||
};
|
||||
|
||||
Int16 GetChild(int w) const { hsAssert(!(fFlags & kIsLeaf), "Getting Child of leaf node"); return fChildren[w]; }
|
||||
Int16 GetParent() const { return fParent; }
|
||||
Int16 GetLeaf() const { hsAssert(fFlags & kIsLeaf, "Getting leaf idx off interior node"); return fLeafIndex; }
|
||||
int16_t GetChild(int w) const { hsAssert(!(fFlags & kIsLeaf), "Getting Child of leaf node"); return fChildren[w]; }
|
||||
int16_t GetParent() const { return fParent; }
|
||||
int16_t GetLeaf() const { hsAssert(fFlags & kIsLeaf, "Getting leaf idx off interior node"); return fLeafIndex; }
|
||||
hsBool IsLeaf() const { return 0 != (fFlags & kIsLeaf); }
|
||||
const hsBounds3Ext& GetWorldBounds() const { return fWorldBounds; }
|
||||
|
||||
@ -101,30 +101,30 @@ private:
|
||||
hsTArray<plSpaceTreeNode> fTree;
|
||||
const hsBitVector* fCache;
|
||||
|
||||
Int16 fRoot;
|
||||
Int16 fNumLeaves;
|
||||
int16_t fRoot;
|
||||
int16_t fNumLeaves;
|
||||
|
||||
UInt16 fHarvestFlags;
|
||||
uint16_t fHarvestFlags;
|
||||
|
||||
mutable plVolumeIsect* fCullFunc;
|
||||
|
||||
hsPoint3 fViewPos;
|
||||
|
||||
void IRefreshRecur(Int16 which);
|
||||
void IRefreshRecur(int16_t which);
|
||||
|
||||
void IHarvestAndCullLeaves(const plSpaceTreeNode& subRoot, hsTArray<Int16>& list) const;
|
||||
void IHarvestLeaves(const plSpaceTreeNode& subRoot, hsTArray<Int16>& list) const;
|
||||
void IHarvestAndCullLeaves(const plSpaceTreeNode& subRoot, hsTArray<int16_t>& list) const;
|
||||
void IHarvestLeaves(const plSpaceTreeNode& subRoot, hsTArray<int16_t>& list) const;
|
||||
|
||||
void IHarvestAndCullLeaves(const plSpaceTreeNode& subRoot, hsBitVector& totList, hsBitVector& list) const;
|
||||
void IHarvestLeaves(const plSpaceTreeNode& subRoot, hsBitVector& totList, hsBitVector& list) const;
|
||||
|
||||
void IHarvestLevel(Int16 subRoot, int level, int currLevel, hsTArray<Int16>& list) const;
|
||||
void IHarvestLevel(int16_t subRoot, int level, int currLevel, hsTArray<int16_t>& list) const;
|
||||
|
||||
void IHarvestAndCullEnabledLeaves(Int16 subRoot, const hsBitVector& cache, hsTArray<Int16>& list) const;
|
||||
void IHarvestEnabledLeaves(Int16 subRoot, const hsBitVector& cache, hsTArray<Int16>& list) const;
|
||||
void IHarvestEnabledLeaves(Int16 subIdx, const hsBitVector& cache, hsBitVector& totList, hsBitVector& list) const;
|
||||
void IHarvestAndCullEnabledLeaves(int16_t subRoot, const hsBitVector& cache, hsTArray<int16_t>& list) const;
|
||||
void IHarvestEnabledLeaves(int16_t subRoot, const hsBitVector& cache, hsTArray<int16_t>& list) const;
|
||||
void IHarvestEnabledLeaves(int16_t subIdx, const hsBitVector& cache, hsBitVector& totList, hsBitVector& list) const;
|
||||
|
||||
void IEnableLeaf(Int16 idx, hsBitVector& cache) const;
|
||||
void IEnableLeaf(int16_t idx, hsBitVector& cache) const;
|
||||
|
||||
public:
|
||||
plSpaceTree();
|
||||
@ -136,54 +136,54 @@ public:
|
||||
void SetViewPos(const hsPoint3& p) { fViewPos = p; }
|
||||
const hsPoint3& GetViewPos() const { return fViewPos; }
|
||||
|
||||
const plSpaceTreeNode& GetNode(Int16 w) const { return fTree[w]; }
|
||||
Int16 GetRoot() const { return fRoot; }
|
||||
hsBool IsRoot(Int16 w) const { return fRoot == w; }
|
||||
hsBool IsLeaf(Int16 w) const { return GetNode(w).IsLeaf(); }
|
||||
const plSpaceTreeNode& GetNode(int16_t w) const { return fTree[w]; }
|
||||
int16_t GetRoot() const { return fRoot; }
|
||||
hsBool IsRoot(int16_t w) const { return fRoot == w; }
|
||||
hsBool IsLeaf(int16_t w) const { return GetNode(w).IsLeaf(); }
|
||||
|
||||
void HarvestLeaves(hsBitVector& totList, hsBitVector& list) const;
|
||||
void HarvestLeaves(hsBitVector& list) const;
|
||||
void HarvestLeaves(plVolumeIsect* cullFunc, hsBitVector& list) const;
|
||||
void HarvestLeaves(Int16 subRoot, hsBitVector& list) const;
|
||||
void HarvestLeaves(Int16 subRoot, hsBitVector& totList, hsBitVector& list) const;
|
||||
void HarvestLeaves(int16_t subRoot, hsBitVector& list) const;
|
||||
void HarvestLeaves(int16_t subRoot, hsBitVector& totList, hsBitVector& list) const;
|
||||
|
||||
void HarvestLeaves(hsTArray<Int16>& list) const;
|
||||
void HarvestLeaves(plVolumeIsect* cullFunc, hsTArray<Int16>& list) const;
|
||||
void HarvestLeaves(Int16 subRoot, hsTArray<Int16>& list) const;
|
||||
void HarvestLeaves(hsTArray<int16_t>& list) const;
|
||||
void HarvestLeaves(plVolumeIsect* cullFunc, hsTArray<int16_t>& list) const;
|
||||
void HarvestLeaves(int16_t subRoot, hsTArray<int16_t>& list) const;
|
||||
|
||||
void EnableLeaf(Int16 idx, hsBitVector& cache) const;
|
||||
void EnableLeaves(const hsTArray<Int16>& list, hsBitVector& cache) const;
|
||||
void HarvestEnabledLeaves(plVolumeIsect* cullFunc, const hsBitVector& cache, hsTArray<Int16>& list) const;
|
||||
void EnableLeaf(int16_t idx, hsBitVector& cache) const;
|
||||
void EnableLeaves(const hsTArray<int16_t>& list, hsBitVector& cache) const;
|
||||
void HarvestEnabledLeaves(plVolumeIsect* cullFunc, const hsBitVector& cache, hsTArray<int16_t>& list) const;
|
||||
void SetCache(const hsBitVector* cache) { fCache = cache; }
|
||||
|
||||
void BitVectorToList(hsTArray<Int16>& list, const hsBitVector& bitVec) const;
|
||||
void BitVectorToList(hsTArray<int16_t>& list, const hsBitVector& bitVec) const;
|
||||
|
||||
void SetHarvestFlags(plHarvestFlags f) { fHarvestFlags = f; }
|
||||
UInt16 GetHarvestFlags() const { return fHarvestFlags; }
|
||||
uint16_t GetHarvestFlags() const { return fHarvestFlags; }
|
||||
|
||||
UInt16 HasLeafFlag(Int16 w, UInt16 f) const { return GetNode(w).fFlags & f; }
|
||||
void SetLeafFlag(Int16 w, UInt16 f, hsBool on=true);
|
||||
void ClearLeafFlag(Int16 w, UInt16 f);
|
||||
void ClearTreeFlag(UInt16 f);
|
||||
void SetTreeFlag(UInt16 f, hsBool on=true);
|
||||
uint16_t HasLeafFlag(int16_t w, uint16_t f) const { return GetNode(w).fFlags & f; }
|
||||
void SetLeafFlag(int16_t w, uint16_t f, hsBool on=true);
|
||||
void ClearLeafFlag(int16_t w, uint16_t f);
|
||||
void ClearTreeFlag(uint16_t f);
|
||||
void SetTreeFlag(uint16_t f, hsBool on=true);
|
||||
|
||||
hsBool IsDisabled(UInt16 w) const { return (GetNode(w).fFlags & plSpaceTreeNode::kDisabled) || (fCache && !fCache->IsBitSet(w)); }
|
||||
hsBool IsDisabled(uint16_t w) const { return (GetNode(w).fFlags & plSpaceTreeNode::kDisabled) || (fCache && !fCache->IsBitSet(w)); }
|
||||
|
||||
// Should GetWorldBounds check and refresh if needed?
|
||||
const hsBounds3Ext& GetWorldBounds() const { return GetNode(GetRoot()).fWorldBounds; }
|
||||
|
||||
void MoveLeaf(Int16 idx, const hsBounds3Ext& newWorldBnd);
|
||||
void MoveLeaf(int16_t idx, const hsBounds3Ext& newWorldBnd);
|
||||
void Refresh();
|
||||
hsBool IsEmpty() const { return 0 != (GetNode(GetRoot()).fFlags & plSpaceTreeNode::kEmpty); }
|
||||
hsBool IsDirty() const { return 0 != (GetNode(GetRoot()).fFlags & plSpaceTreeNode::kDirty); }
|
||||
void MakeDirty() { fTree[GetRoot()].fFlags |= plSpaceTreeNode::kDirty; }
|
||||
|
||||
Int16 GetNumLeaves() const { return fNumLeaves; }
|
||||
int16_t GetNumLeaves() const { return fNumLeaves; }
|
||||
|
||||
virtual void Read(hsStream* s, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
void HarvestLevel(int level, hsTArray<Int16>& list) const;
|
||||
void HarvestLevel(int level, hsTArray<int16_t>& list) const;
|
||||
|
||||
friend class plSpaceTreeMaker;
|
||||
};
|
||||
|
@ -40,12 +40,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plSpaceTreeMaker.h"
|
||||
#include "plMath/hsRadixSort.h"
|
||||
#include "plDrawable/plSpaceTree.h"
|
||||
|
||||
#include "hsUtils.h" // for testing, get hsRand()
|
||||
// for testing, get hsRand()
|
||||
#include "hsTimer.h"
|
||||
#include "plIntersect/plVolumeIsect.h"
|
||||
|
||||
@ -129,7 +129,7 @@ void plSpaceTreeMaker::ISortList(hsTArray<plSpacePrepNode*>& nodes, const hsVect
|
||||
|
||||
hsRadixSort::Elem* list = fSortScratch;
|
||||
hsRadixSort::Elem* listTrav = list;
|
||||
Int32 n = nodes.GetCount();
|
||||
int32_t n = nodes.GetCount();
|
||||
while( n-- )
|
||||
{
|
||||
listTrav->fKey.fFloat = axis.InnerProduct(nodes[n]->fWorldBounds.GetCenter());
|
||||
@ -138,7 +138,7 @@ void plSpaceTreeMaker::ISortList(hsTArray<plSpacePrepNode*>& nodes, const hsVect
|
||||
listTrav++;
|
||||
}
|
||||
list[nodes.GetCount()-1].fNext = nil;
|
||||
UInt32 sortFlags = 0;
|
||||
uint32_t sortFlags = 0;
|
||||
hsRadixSort rad;
|
||||
hsRadixSort::Elem* sortedList = rad.Sort(list, sortFlags);
|
||||
listTrav = sortedList;
|
||||
@ -172,7 +172,7 @@ void plSpaceTreeMaker::ISplitList(hsTArray<plSpacePrepNode*>& nodes, const hsVec
|
||||
upper[i] = nodes[i + lowerCount];
|
||||
}
|
||||
|
||||
hsBounds3Ext plSpaceTreeMaker::IFindDistToCenterAxis(hsTArray<plSpacePrepNode*>& nodes, hsScalar& length, hsVector3& axis)
|
||||
hsBounds3Ext plSpaceTreeMaker::IFindDistToCenterAxis(hsTArray<plSpacePrepNode*>& nodes, float& length, hsVector3& axis)
|
||||
{
|
||||
hsBounds3Ext bnd;
|
||||
bnd.MakeEmpty();
|
||||
@ -189,14 +189,14 @@ hsBounds3Ext plSpaceTreeMaker::IFindDistToCenterAxis(hsTArray<plSpacePrepNode*>&
|
||||
{
|
||||
hsVector3 sep;
|
||||
sep.Set(&bnd.GetCenter(), &nodes[i]->fWorldBounds.GetCenter());
|
||||
hsScalar len = sep.MagnitudeSquared();
|
||||
float len = sep.MagnitudeSquared();
|
||||
if( len > length )
|
||||
{
|
||||
axis = sep;
|
||||
length = len;
|
||||
}
|
||||
}
|
||||
length = hsSquareRoot(length);
|
||||
length = sqrt(length);
|
||||
if( length > 1.e-3f )
|
||||
axis /= length;
|
||||
else
|
||||
@ -212,7 +212,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeFatTreeRecur(hsTArray<plSpacePrepNode*>&
|
||||
|
||||
StartTimer(kMakeFatTree);
|
||||
|
||||
plSpacePrepNode* subRoot = TRACKED_NEW plSpacePrepNode;
|
||||
plSpacePrepNode* subRoot = new plSpacePrepNode;
|
||||
fTreeSize++;
|
||||
|
||||
if( nodes.GetCount() == 1 )
|
||||
@ -231,7 +231,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeFatTreeRecur(hsTArray<plSpacePrepNode*>&
|
||||
|
||||
// Find the maximum length vector from nodes[i] center to list center.
|
||||
// If that length is zero, just use the maximum dimension of overall bounds.
|
||||
hsScalar length;
|
||||
float length;
|
||||
hsVector3 axis;
|
||||
hsBounds3Ext bnd = IFindDistToCenterAxis(nodes, length, axis);
|
||||
|
||||
@ -249,7 +249,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeFatTreeRecur(hsTArray<plSpacePrepNode*>&
|
||||
return subRoot;
|
||||
}
|
||||
|
||||
hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray<plSpacePrepNode*>& nodes, hsScalar& length, hsVector3& axis)
|
||||
hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray<plSpacePrepNode*>& nodes, float& length, hsVector3& axis)
|
||||
{
|
||||
hsBounds3Ext bnd;
|
||||
bnd.MakeEmpty();
|
||||
@ -258,7 +258,7 @@ hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray<plSpacePrepNode*>& nodes,
|
||||
{
|
||||
bnd.Union(&nodes[i]->fWorldBounds);
|
||||
}
|
||||
hsScalar maxLen = bnd.GetMaxs()[0] - bnd.GetMins()[0];
|
||||
float maxLen = bnd.GetMaxs()[0] - bnd.GetMins()[0];
|
||||
int maxAxis = 0;
|
||||
|
||||
if( bnd.GetMaxs()[1] - bnd.GetMins()[1] > maxLen )
|
||||
@ -290,9 +290,9 @@ hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray<plSpacePrepNode*>& nodes,
|
||||
return bnd;
|
||||
}
|
||||
|
||||
void plSpaceTreeMaker::IFindBigList(hsTArray<plSpacePrepNode*>& nodes, hsScalar length, const hsVector3& axis, hsTArray<plSpacePrepNode*>& giants, hsTArray<plSpacePrepNode*>& strimps)
|
||||
void plSpaceTreeMaker::IFindBigList(hsTArray<plSpacePrepNode*>& nodes, float length, const hsVector3& axis, hsTArray<plSpacePrepNode*>& giants, hsTArray<plSpacePrepNode*>& strimps)
|
||||
{
|
||||
const hsScalar kCutoffFrac = 0.5f;
|
||||
const float kCutoffFrac = 0.5f;
|
||||
|
||||
giants.SetCount(0);
|
||||
strimps.SetCount(0);
|
||||
@ -310,8 +310,8 @@ void plSpaceTreeMaker::IFindBigList(hsTArray<plSpacePrepNode*>& nodes, hsScalar
|
||||
|
||||
plSpacePrepNode* plSpaceTreeMaker::INewSubRoot(const hsBounds3Ext& bnd)
|
||||
{
|
||||
plSpacePrepNode* subRoot = TRACKED_NEW plSpacePrepNode;
|
||||
subRoot->fDataIndex = Int16(-1);
|
||||
plSpacePrepNode* subRoot = new plSpacePrepNode;
|
||||
subRoot->fDataIndex = int16_t(-1);
|
||||
fTreeSize++;
|
||||
|
||||
subRoot->fWorldBounds = bnd;
|
||||
@ -332,7 +332,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeTreeRecur(hsTArray<plSpacePrepNode*>& no
|
||||
StartTimer(kMakeTree);
|
||||
|
||||
// Find the maximum bounds dimension
|
||||
hsScalar length;
|
||||
float length;
|
||||
hsVector3 axis;
|
||||
hsBounds3Ext bnd = IFindSplitAxis(nodes, length, axis);
|
||||
|
||||
@ -372,7 +372,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeTreeRecur(hsTArray<plSpacePrepNode*>& no
|
||||
|
||||
void plSpaceTreeMaker::IMakeTree()
|
||||
{
|
||||
fSortScratch = TRACKED_NEW hsRadixSort::Elem[fLeaves.GetCount()];
|
||||
fSortScratch = new hsRadixSort::Elem[fLeaves.GetCount()];
|
||||
|
||||
fPrepTree = IMakeTreeRecur(fLeaves);
|
||||
|
||||
@ -411,9 +411,9 @@ void plSpaceTreeMaker::Cleanup()
|
||||
fDisabled.Reset();
|
||||
}
|
||||
|
||||
Int32 plSpaceTreeMaker::AddLeaf(const hsBounds3Ext& worldBnd, hsBool disable)
|
||||
int32_t plSpaceTreeMaker::AddLeaf(const hsBounds3Ext& worldBnd, hsBool disable)
|
||||
{
|
||||
plSpacePrepNode* leaf = TRACKED_NEW plSpacePrepNode;
|
||||
plSpacePrepNode* leaf = new plSpacePrepNode;
|
||||
fLeaves.Append(leaf);
|
||||
leaf->fDataIndex = fLeaves.GetCount()-1;
|
||||
leaf->fChildren[0] = nil;
|
||||
@ -487,7 +487,7 @@ void plSpaceTreeMaker::TestTree()
|
||||
tree->SetViewPos(*hsPoint3().Set(0,0,0));
|
||||
|
||||
plConeIsect cone;
|
||||
cone.SetAngle(hsScalarPI*0.25f);
|
||||
cone.SetAngle(M_PI*0.25f);
|
||||
cone.SetTransform(liX, invLiX);
|
||||
|
||||
StartTimer(kHarvestCone);
|
||||
@ -498,7 +498,7 @@ void plSpaceTreeMaker::TestTree()
|
||||
StopTimer(kHarvestCone);
|
||||
|
||||
plConeIsect capped;
|
||||
capped.SetAngle(hsScalarPI*0.25f);
|
||||
capped.SetAngle(M_PI*0.25f);
|
||||
capped.SetLength(0.5f);
|
||||
capped.SetTransform(liX, invLiX);
|
||||
|
||||
@ -548,7 +548,7 @@ plSpaceTree* plSpaceTreeMaker::MakeTree()
|
||||
|
||||
plSpaceTree* plSpaceTreeMaker::IMakeEmptyTree()
|
||||
{
|
||||
plSpaceTree* tree = TRACKED_NEW plSpaceTree;
|
||||
plSpaceTree* tree = new plSpaceTree;
|
||||
|
||||
tree->fTree.SetCount(1);
|
||||
hsPoint3 zero(0, 0, 0);
|
||||
@ -564,7 +564,7 @@ plSpaceTree* plSpaceTreeMaker::IMakeEmptyTree()
|
||||
|
||||
plSpaceTree* plSpaceTreeMaker::IMakeDegenerateTree()
|
||||
{
|
||||
plSpaceTree* tree = TRACKED_NEW plSpaceTree;
|
||||
plSpaceTree* tree = new plSpaceTree;
|
||||
|
||||
tree->fTree.Push();
|
||||
|
||||
@ -600,7 +600,7 @@ plSpaceTree* plSpaceTreeMaker::IMakeSpaceTree()
|
||||
{
|
||||
StartTimer(kMakeSpaceTree);
|
||||
|
||||
plSpaceTree* tree = TRACKED_NEW plSpaceTree;
|
||||
plSpaceTree* tree = new plSpaceTree;
|
||||
|
||||
plSpacePrepNode* head = fPrepTree;
|
||||
|
||||
@ -631,11 +631,11 @@ plSpaceTree* plSpaceTreeMaker::IMakeSpaceTree()
|
||||
// The following goofy cache-friendly tree set up slows down the tree build by 10%, but speeds up the runtime by 9%.
|
||||
// Sounds fair.
|
||||
#if 0 // Leaves first
|
||||
Int16 plSpaceTreeMaker::IMakeSpaceTreeRecur(plSpacePrepNode* sub, plSpaceTree* tree, const int targetLevel, int currLevel)
|
||||
int16_t plSpaceTreeMaker::IMakeSpaceTreeRecur(plSpacePrepNode* sub, plSpaceTree* tree, const int targetLevel, int currLevel)
|
||||
{
|
||||
if( currLevel == targetLevel )
|
||||
{
|
||||
Int16 nodeIdx = tree->fTree.GetCount();
|
||||
int16_t nodeIdx = tree->fTree.GetCount();
|
||||
tree->fTree.Push();
|
||||
|
||||
tree->fTree[nodeIdx].fWorldBounds = sub->fWorldBounds;
|
||||
@ -659,7 +659,7 @@ Int16 plSpaceTreeMaker::IMakeSpaceTreeRecur(plSpacePrepNode* sub, plSpaceTree* t
|
||||
return nodeIdx;
|
||||
}
|
||||
|
||||
Int16 nodeIdx = sub->fIndex;
|
||||
int16_t nodeIdx = sub->fIndex;
|
||||
|
||||
if( !sub->fChildren[0] )
|
||||
{
|
||||
@ -686,7 +686,7 @@ void plSpaceTreeMaker::IGatherLeavesRecur(plSpacePrepNode* sub, plSpaceTree* tre
|
||||
hsAssert(!sub->fChildren[1], "Unsupported unbalance of tree");
|
||||
|
||||
plSpaceTreeNode& leaf = tree->fTree[sub->fDataIndex];
|
||||
Int16 nodeIdx = sub->fDataIndex;
|
||||
int16_t nodeIdx = sub->fDataIndex;
|
||||
leaf.fWorldBounds = sub->fWorldBounds;
|
||||
sub->fIndex = nodeIdx;
|
||||
leaf.fFlags = plSpaceTreeNode::kIsLeaf;
|
||||
@ -713,7 +713,7 @@ void plSpaceTreeMaker::IMakeSpaceTreeRecur(plSpacePrepNode* sub, plSpaceTree* tr
|
||||
|
||||
if( currLevel == targetLevel )
|
||||
{
|
||||
Int16 nodeIdx = tree->fTree.GetCount();
|
||||
int16_t nodeIdx = tree->fTree.GetCount();
|
||||
tree->fTree.Push();
|
||||
|
||||
tree->fTree[nodeIdx].fWorldBounds = sub->fWorldBounds;
|
||||
|
@ -55,8 +55,8 @@ class plSpacePrepNode
|
||||
public:
|
||||
hsBounds3Ext fWorldBounds;
|
||||
|
||||
Int16 fIndex;
|
||||
Int16 fDataIndex;
|
||||
int16_t fIndex;
|
||||
int16_t fDataIndex;
|
||||
|
||||
plSpacePrepNode* fChildren[2];
|
||||
};
|
||||
@ -71,15 +71,15 @@ protected:
|
||||
hsBitVector fDisabled;
|
||||
|
||||
plSpacePrepNode* fPrepTree;
|
||||
Int16 fTreeSize;
|
||||
int16_t fTreeSize;
|
||||
|
||||
plSpacePrepNode* INewSubRoot(const hsBounds3Ext& bnd);
|
||||
void IFindBigList(hsTArray<plSpacePrepNode*>& nodes, hsScalar length, const hsVector3& axis, hsTArray<plSpacePrepNode*>& giants, hsTArray<plSpacePrepNode*>& strimp);
|
||||
void IFindBigList(hsTArray<plSpacePrepNode*>& nodes, float length, const hsVector3& axis, hsTArray<plSpacePrepNode*>& giants, hsTArray<plSpacePrepNode*>& strimp);
|
||||
void ISortList(hsTArray<plSpacePrepNode*>& nodes, const hsVector3& axis);
|
||||
void ISplitList(hsTArray<plSpacePrepNode*>& nodes, const hsVector3& axis, hsTArray<plSpacePrepNode*>& lower, hsTArray<plSpacePrepNode*>& upper);
|
||||
hsBounds3Ext IFindDistToCenterAxis(hsTArray<plSpacePrepNode*>& nodes, hsScalar& length, hsVector3& axis);
|
||||
hsBounds3Ext IFindDistToCenterAxis(hsTArray<plSpacePrepNode*>& nodes, float& length, hsVector3& axis);
|
||||
plSpacePrepNode* IMakeFatTreeRecur(hsTArray<plSpacePrepNode*>& nodes);
|
||||
hsBounds3Ext IFindSplitAxis(hsTArray<plSpacePrepNode*>& nodes, hsScalar& length, hsVector3& axis);
|
||||
hsBounds3Ext IFindSplitAxis(hsTArray<plSpacePrepNode*>& nodes, float& length, hsVector3& axis);
|
||||
plSpacePrepNode* IMakeTreeRecur(hsTArray<plSpacePrepNode*>& nodes);
|
||||
|
||||
void IMakeTree();
|
||||
@ -98,7 +98,7 @@ public:
|
||||
void Cleanup();
|
||||
|
||||
void Reset();
|
||||
Int32 AddLeaf(const hsBounds3Ext& worldBnd, hsBool disable=false);
|
||||
int32_t AddLeaf(const hsBounds3Ext& worldBnd, hsBool disable=false);
|
||||
plSpaceTree* MakeTree();
|
||||
|
||||
void TestTree(); // development only - NUKE ME mf horse
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plSpanInstance.h"
|
||||
|
||||
#include "hsGeometry3.h"
|
||||
@ -54,7 +54,7 @@ void plSpanEncoding::Read(hsStream* s)
|
||||
|
||||
void plSpanEncoding::Write(hsStream* s) const
|
||||
{
|
||||
s->WriteByte((UInt8)fCode);
|
||||
s->WriteByte((uint8_t)fCode);
|
||||
s->WriteLEScalar(fPosScale);
|
||||
}
|
||||
|
||||
@ -82,23 +82,23 @@ void plSpanInstance::DeAlloc()
|
||||
fCol = nil;
|
||||
}
|
||||
|
||||
void plSpanInstance::Alloc(const plSpanEncoding& encoding, UInt32 numVerts)
|
||||
void plSpanInstance::Alloc(const plSpanEncoding& encoding, uint32_t numVerts)
|
||||
{
|
||||
DeAlloc();
|
||||
UInt32 posStride = PosStrideFromEncoding(encoding);
|
||||
uint32_t posStride = PosStrideFromEncoding(encoding);
|
||||
if( posStride )
|
||||
fPosDelta = TRACKED_NEW UInt8[numVerts * posStride];
|
||||
fPosDelta = new uint8_t[numVerts * posStride];
|
||||
|
||||
UInt32 colStride = ColStrideFromEncoding(encoding);
|
||||
uint32_t colStride = ColStrideFromEncoding(encoding);
|
||||
if( colStride )
|
||||
fCol = TRACKED_NEW UInt8[numVerts * colStride];
|
||||
fCol = new uint8_t[numVerts * colStride];
|
||||
}
|
||||
|
||||
void plSpanInstance::Read(hsStream* stream, const plSpanEncoding& encoding, UInt32 numVerts)
|
||||
void plSpanInstance::Read(hsStream* stream, const plSpanEncoding& encoding, uint32_t numVerts)
|
||||
{
|
||||
Alloc(encoding, numVerts);
|
||||
|
||||
stream->Read(12 * sizeof(hsScalar), fL2W[0]);
|
||||
stream->Read(12 * sizeof(float), fL2W[0]);
|
||||
if( fPosDelta )
|
||||
{
|
||||
stream->Read(numVerts * PosStrideFromEncoding(encoding), fPosDelta);
|
||||
@ -110,9 +110,9 @@ void plSpanInstance::Read(hsStream* stream, const plSpanEncoding& encoding, UInt
|
||||
}
|
||||
}
|
||||
|
||||
void plSpanInstance::Write(hsStream* stream, const plSpanEncoding& encoding, UInt32 numVerts) const
|
||||
void plSpanInstance::Write(hsStream* stream, const plSpanEncoding& encoding, uint32_t numVerts) const
|
||||
{
|
||||
stream->Write(12 * sizeof(hsScalar), fL2W[0]);
|
||||
stream->Write(12 * sizeof(float), fL2W[0]);
|
||||
if( fPosDelta )
|
||||
{
|
||||
stream->Write(numVerts * PosStrideFromEncoding(encoding), fPosDelta);
|
||||
@ -165,7 +165,7 @@ void plSpanInstance::SetLocalToWorld(const hsMatrix44& l2w)
|
||||
}
|
||||
}
|
||||
|
||||
void plSpanInstance::Encode(const plSpanEncoding& encoding, UInt32 numVerts, const hsVector3* delPos, const UInt32* color)
|
||||
void plSpanInstance::Encode(const plSpanEncoding& encoding, uint32_t numVerts, const hsVector3* delPos, const uint32_t* color)
|
||||
{
|
||||
Alloc(encoding, numVerts);
|
||||
|
||||
@ -176,42 +176,42 @@ void plSpanInstance::Encode(const plSpanEncoding& encoding, UInt32 numVerts, con
|
||||
if( !(fPosDelta || fCol) )
|
||||
return;
|
||||
|
||||
Int8* pos888 = (Int8*)fPosDelta;
|
||||
Int16* pos161616 = (Int16*)fPosDelta;
|
||||
UInt32* pos101010 = (UInt32*)fPosDelta;
|
||||
int8_t* pos888 = (int8_t*)fPosDelta;
|
||||
int16_t* pos161616 = (int16_t*)fPosDelta;
|
||||
uint32_t* pos101010 = (uint32_t*)fPosDelta;
|
||||
|
||||
UInt8* col8 = (UInt8*)fCol;
|
||||
UInt16* col16 = (UInt16*)fCol;
|
||||
UInt32* col32 = (UInt32*)fCol;
|
||||
uint8_t* col8 = (uint8_t*)fCol;
|
||||
uint16_t* col16 = (uint16_t*)fCol;
|
||||
uint32_t* col32 = (uint32_t*)fCol;
|
||||
int i;
|
||||
for( i = 0; i < numVerts; i++ )
|
||||
{
|
||||
switch(encoding.fCode & plSpanEncoding::kPosMask)
|
||||
{
|
||||
case plSpanEncoding::kPos888:
|
||||
pos888[0] = Int8(delPos->fX / encoding.fPosScale);
|
||||
pos888[1] = Int8(delPos->fY / encoding.fPosScale);
|
||||
pos888[2] = Int8(delPos->fZ / encoding.fPosScale);
|
||||
pos888[0] = int8_t(delPos->fX / encoding.fPosScale);
|
||||
pos888[1] = int8_t(delPos->fY / encoding.fPosScale);
|
||||
pos888[2] = int8_t(delPos->fZ / encoding.fPosScale);
|
||||
pos888 += 3;
|
||||
delPos++;
|
||||
break;
|
||||
case plSpanEncoding::kPos161616:
|
||||
pos161616[0] = Int16(delPos->fX / encoding.fPosScale);
|
||||
pos161616[1] = Int16(delPos->fY / encoding.fPosScale);
|
||||
pos161616[2] = Int16(delPos->fZ / encoding.fPosScale);
|
||||
pos161616[0] = int16_t(delPos->fX / encoding.fPosScale);
|
||||
pos161616[1] = int16_t(delPos->fY / encoding.fPosScale);
|
||||
pos161616[2] = int16_t(delPos->fZ / encoding.fPosScale);
|
||||
pos161616 += 3;
|
||||
delPos++;
|
||||
break;
|
||||
case plSpanEncoding::kPos101010:
|
||||
*pos101010 =
|
||||
((UInt32(delPos->fX / encoding.fPosScale) & 0x3f) << 0)
|
||||
| ((UInt32(delPos->fY / encoding.fPosScale) & 0x3f) << 10)
|
||||
| ((UInt32(delPos->fZ / encoding.fPosScale) & 0x3f) << 20);
|
||||
((uint32_t(delPos->fX / encoding.fPosScale) & 0x3f) << 0)
|
||||
| ((uint32_t(delPos->fY / encoding.fPosScale) & 0x3f) << 10)
|
||||
| ((uint32_t(delPos->fZ / encoding.fPosScale) & 0x3f) << 20);
|
||||
pos101010++;
|
||||
delPos++;
|
||||
break;
|
||||
case plSpanEncoding::kPos008:
|
||||
*pos888 = Int8(delPos->fZ / encoding.fPosScale);
|
||||
*pos888 = int8_t(delPos->fZ / encoding.fPosScale);
|
||||
pos888++;
|
||||
delPos++;
|
||||
break;
|
||||
@ -222,24 +222,24 @@ void plSpanInstance::Encode(const plSpanEncoding& encoding, UInt32 numVerts, con
|
||||
switch(encoding.fCode & plSpanEncoding::kColMask)
|
||||
{
|
||||
case plSpanEncoding::kColA8:
|
||||
*col8 = (UInt8)((*color) >> 24);
|
||||
*col8 = (uint8_t)((*color) >> 24);
|
||||
col8++;
|
||||
color++;
|
||||
break;
|
||||
case plSpanEncoding::kColI8:
|
||||
*col8 = (UInt8)((*color) & 0xff);
|
||||
*col8 = (uint8_t)((*color) & 0xff);
|
||||
col8++;
|
||||
color++;
|
||||
break;
|
||||
case plSpanEncoding::kColAI88:
|
||||
*col16 = (UInt16)(((*color) >> 16) & 0xffff);
|
||||
*col16 = (uint16_t)(((*color) >> 16) & 0xffff);
|
||||
col16++;
|
||||
color++;
|
||||
break;
|
||||
case plSpanEncoding::kColRGB888:
|
||||
*col8++ = (UInt8)((*color >> 16) & 0xff);
|
||||
*col8++ = (UInt8)((*color >> 8) & 0xff);
|
||||
*col8++ = (UInt8)((*color >> 0) & 0xff);
|
||||
*col8++ = (uint8_t)((*color >> 16) & 0xff);
|
||||
*col8++ = (uint8_t)((*color >> 8) & 0xff);
|
||||
*col8++ = (uint8_t)((*color >> 0) & 0xff);
|
||||
color++;
|
||||
break;
|
||||
case plSpanEncoding::kColARGB8888:
|
||||
|
@ -112,14 +112,14 @@ public:
|
||||
| kColARGB8888,
|
||||
};
|
||||
|
||||
UInt32 fCode;
|
||||
hsScalar fPosScale;
|
||||
uint32_t fCode;
|
||||
float fPosScale;
|
||||
|
||||
plSpanEncoding() : fCode(kPosNone|kColNone), fPosScale(0) {}
|
||||
plSpanEncoding(UInt32 c, hsScalar s) : fCode(c), fPosScale(s) {}
|
||||
plSpanEncoding(uint32_t c, float s) : fCode(c), fPosScale(s) {}
|
||||
|
||||
UInt32 Code() const { return fCode; }
|
||||
hsScalar Scale() const { return fPosScale; }
|
||||
uint32_t Code() const { return fCode; }
|
||||
float Scale() const { return fPosScale; }
|
||||
|
||||
void Read(hsStream* s);
|
||||
void Write(hsStream* s) const;
|
||||
@ -128,22 +128,22 @@ public:
|
||||
class plSpanInstance
|
||||
{
|
||||
protected:
|
||||
UInt8* fPosDelta;
|
||||
UInt8* fCol;
|
||||
uint8_t* fPosDelta;
|
||||
uint8_t* fCol;
|
||||
|
||||
hsScalar fL2W[3][4];
|
||||
float fL2W[3][4];
|
||||
|
||||
friend class plSpanInstanceIter;
|
||||
public:
|
||||
plSpanInstance();
|
||||
~plSpanInstance();
|
||||
|
||||
void Read(hsStream* s, const plSpanEncoding& encoding, UInt32 numVerts);
|
||||
void Write(hsStream* s, const plSpanEncoding& encoding, UInt32 numVerts) const;
|
||||
void Read(hsStream* s, const plSpanEncoding& encoding, uint32_t numVerts);
|
||||
void Write(hsStream* s, const plSpanEncoding& encoding, uint32_t numVerts) const;
|
||||
|
||||
void Encode(const plSpanEncoding& encoding, UInt32 numVerts, const hsVector3* delPos, const UInt32* color);
|
||||
void Encode(const plSpanEncoding& encoding, uint32_t numVerts, const hsVector3* delPos, const uint32_t* color);
|
||||
|
||||
void Alloc(const plSpanEncoding& encoding, UInt32 numVerts);
|
||||
void Alloc(const plSpanEncoding& encoding, uint32_t numVerts);
|
||||
void DeAlloc();
|
||||
|
||||
hsMatrix44 LocalToWorld() const;
|
||||
@ -154,7 +154,7 @@ public:
|
||||
hsBool HasPosDelta() const { return fPosDelta != nil; }
|
||||
hsBool HasColor() const { return fCol != nil; }
|
||||
|
||||
static UInt16 PosStrideFromEncoding(const plSpanEncoding& encoding)
|
||||
static uint16_t PosStrideFromEncoding(const plSpanEncoding& encoding)
|
||||
{
|
||||
switch(encoding.fCode & plSpanEncoding::kPosMask)
|
||||
{
|
||||
@ -169,7 +169,7 @@ public:
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static UInt16 ColStrideFromEncoding(const plSpanEncoding& encoding)
|
||||
static uint16_t ColStrideFromEncoding(const plSpanEncoding& encoding)
|
||||
{
|
||||
switch(encoding.fCode & plSpanEncoding::kPosMask)
|
||||
{
|
||||
@ -195,29 +195,29 @@ class plSpanInstanceIter
|
||||
protected:
|
||||
plSpanInstance* fInst;
|
||||
plSpanEncoding fEncoding;
|
||||
UInt32 fNumVerts;
|
||||
Int32 fNumVertsLeft;
|
||||
UInt16 fPosStride;
|
||||
UInt16 fColStride;
|
||||
uint32_t fNumVerts;
|
||||
int32_t fNumVertsLeft;
|
||||
uint16_t fPosStride;
|
||||
uint16_t fColStride;
|
||||
|
||||
union {
|
||||
Int8* fPos888;
|
||||
Int16* fPos161616;
|
||||
UInt32* fPos101010;
|
||||
int8_t* fPos888;
|
||||
int16_t* fPos161616;
|
||||
uint32_t* fPos101010;
|
||||
};
|
||||
union {
|
||||
UInt8* fA8;
|
||||
UInt8* fI8;
|
||||
UInt16* fAI88;
|
||||
UInt8* fRGB888;
|
||||
UInt32* fARGB8888;
|
||||
uint8_t* fA8;
|
||||
uint8_t* fI8;
|
||||
uint16_t* fAI88;
|
||||
uint8_t* fRGB888;
|
||||
uint32_t* fARGB8888;
|
||||
};
|
||||
|
||||
public:
|
||||
plSpanInstanceIter();
|
||||
plSpanInstanceIter(plSpanInstance* inst, const plSpanEncoding& encoding, UInt32 numVerts) { Init(inst, encoding, numVerts); }
|
||||
plSpanInstanceIter(plSpanInstance* inst, const plSpanEncoding& encoding, uint32_t numVerts) { Init(inst, encoding, numVerts); }
|
||||
|
||||
void Init(plSpanInstance* inst, const plSpanEncoding& encoding, UInt32 numVerts)
|
||||
void Init(plSpanInstance* inst, const plSpanEncoding& encoding, uint32_t numVerts)
|
||||
{
|
||||
fInst = inst;
|
||||
fEncoding = encoding;
|
||||
@ -229,7 +229,7 @@ public:
|
||||
|
||||
void Begin()
|
||||
{
|
||||
fPos888 = (Int8*)fInst->fPosDelta;
|
||||
fPos888 = (int8_t*)fInst->fPosDelta;
|
||||
fA8 = fInst->fCol;
|
||||
|
||||
fNumVertsLeft = fNumVerts;
|
||||
@ -270,7 +270,7 @@ public:
|
||||
pos += DelPos();
|
||||
return pos;
|
||||
};
|
||||
UInt32 Color(UInt32 c) const
|
||||
uint32_t Color(uint32_t c) const
|
||||
{
|
||||
switch(fEncoding.fCode & plSpanEncoding::kColMask)
|
||||
{
|
||||
@ -283,7 +283,7 @@ public:
|
||||
| (*fI8 << 0);
|
||||
case plSpanEncoding::kColAI88:
|
||||
{
|
||||
const UInt32 col = *fAI88 & 0xff;
|
||||
const uint32_t col = *fAI88 & 0xff;
|
||||
return ((*fAI88 & 0xff00) << 24)
|
||||
| (col << 16)
|
||||
| (col << 8)
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plSpanTemplate.h"
|
||||
#include "plSpanInstance.h"
|
||||
|
||||
@ -58,7 +58,7 @@ plSpanTemplate::plSpanTemplate()
|
||||
{
|
||||
}
|
||||
|
||||
UInt32 plSpanTemplate::CalcStride()
|
||||
uint32_t plSpanTemplate::CalcStride()
|
||||
{
|
||||
fStride = 0;
|
||||
if( NumPos() )
|
||||
@ -66,31 +66,31 @@ UInt32 plSpanTemplate::CalcStride()
|
||||
if( NumNorm() )
|
||||
fStride += sizeof(hsVector3);
|
||||
if( NumColor() )
|
||||
fStride += sizeof(UInt32);
|
||||
fStride += sizeof(uint32_t);
|
||||
if( NumColor2() )
|
||||
fStride += sizeof(UInt32);
|
||||
fStride += sizeof(uint32_t);
|
||||
if( NumWgtIdx() )
|
||||
fStride += sizeof(UInt32);
|
||||
fStride += sizeof(uint32_t);
|
||||
if( NumUVWs() )
|
||||
fStride += (UInt8)(sizeof(hsPoint3) * NumUVWs());
|
||||
fStride += (uint8_t)(sizeof(hsPoint3) * NumUVWs());
|
||||
if( NumWeights() )
|
||||
fStride += (UInt8)(sizeof(hsScalar) * NumWeights());
|
||||
fStride += (uint8_t)(sizeof(float) * NumWeights());
|
||||
|
||||
return UInt32(fStride);
|
||||
return uint32_t(fStride);
|
||||
}
|
||||
|
||||
void plSpanTemplate::Alloc(UInt16 format, UInt32 numVerts, UInt32 numTris)
|
||||
void plSpanTemplate::Alloc(uint16_t format, uint32_t numVerts, uint32_t numTris)
|
||||
{
|
||||
DeAlloc();
|
||||
fNumVerts = (UInt16)numVerts;
|
||||
fNumVerts = (uint16_t)numVerts;
|
||||
fFormat = format;
|
||||
CalcStride();
|
||||
|
||||
fNumTris = (UInt16)numTris;
|
||||
fNumTris = (uint16_t)numTris;
|
||||
|
||||
fData = TRACKED_NEW UInt8[VertSize()];
|
||||
fData = new uint8_t[VertSize()];
|
||||
|
||||
fIndices = TRACKED_NEW UInt16[NumIndices()];
|
||||
fIndices = new uint16_t[NumIndices()];
|
||||
}
|
||||
|
||||
void plSpanTemplate::DeAlloc()
|
||||
@ -139,8 +139,8 @@ void plSpanTemplateB::ComputeBounds()
|
||||
|
||||
void plSpanTemplateB::AllocColors()
|
||||
{
|
||||
fMultColors = TRACKED_NEW hsColorRGBA[NumVerts()];
|
||||
fAddColors = TRACKED_NEW hsColorRGBA[NumVerts()];
|
||||
fMultColors = new hsColorRGBA[NumVerts()];
|
||||
fAddColors = new hsColorRGBA[NumVerts()];
|
||||
}
|
||||
|
||||
void plSpanTemplateB::DeAllocColors()
|
||||
|
@ -58,7 +58,7 @@ class plSpanTemplate
|
||||
public:
|
||||
// 99% of the time, the defaults are fine. Just tell me
|
||||
// how many UVWs, and whether you've got color.
|
||||
static UInt16 MakeFormat(hsBool hasColor, int numUVWs,
|
||||
static uint16_t MakeFormat(hsBool hasColor, int numUVWs,
|
||||
hsBool hasWgtIdx = false,
|
||||
int numWgts = 0,
|
||||
hsBool hasNorm = true,
|
||||
@ -101,10 +101,10 @@ public:
|
||||
};
|
||||
protected:
|
||||
|
||||
UInt16 fNumVerts;
|
||||
UInt16 fFormat;
|
||||
UInt8 fStride;
|
||||
UInt16 fNumTris;
|
||||
uint16_t fNumVerts;
|
||||
uint16_t fFormat;
|
||||
uint8_t fStride;
|
||||
uint16_t fNumTris;
|
||||
|
||||
// Data stored interleaved. Any channels may be omitted, but
|
||||
// existing channels are in exactly the following order:
|
||||
@ -115,57 +115,57 @@ protected:
|
||||
// Color
|
||||
// Color2
|
||||
// UVWs
|
||||
UInt8* fData;
|
||||
uint8_t* fData;
|
||||
|
||||
UInt16* fIndices;
|
||||
uint16_t* fIndices;
|
||||
|
||||
friend class plClusterUtil;
|
||||
public:
|
||||
plSpanTemplate();
|
||||
virtual ~plSpanTemplate() { DeAlloc(); }
|
||||
|
||||
const UInt8* VertData() const { return fData; }
|
||||
const uint8_t* VertData() const { return fData; }
|
||||
|
||||
const UInt16* IndexData() const { return fIndices; }
|
||||
const uint16_t* IndexData() const { return fIndices; }
|
||||
|
||||
UInt32 NumVerts() const { return fNumVerts; }
|
||||
UInt32 Stride() const { return UInt32(fStride); }
|
||||
UInt32 CalcStride();
|
||||
UInt32 VertSize() const { return NumVerts() * Stride(); }
|
||||
uint32_t NumVerts() const { return fNumVerts; }
|
||||
uint32_t Stride() const { return uint32_t(fStride); }
|
||||
uint32_t CalcStride();
|
||||
uint32_t VertSize() const { return NumVerts() * Stride(); }
|
||||
|
||||
UInt32 NumTris() const { return fNumTris; }
|
||||
UInt32 NumIndices() const { return NumTris() * 3; }
|
||||
UInt32 IndexSize() const { return NumIndices() * sizeof(UInt16); }
|
||||
uint32_t NumTris() const { return fNumTris; }
|
||||
uint32_t NumIndices() const { return NumTris() * 3; }
|
||||
uint32_t IndexSize() const { return NumIndices() * sizeof(uint16_t); }
|
||||
|
||||
UInt8 PositionOffset() const { return UInt8(0); }
|
||||
UInt8 WgtIdxOffset() const { return UInt8(PositionOffset() + NumPos() * sizeof(hsPoint3)); }
|
||||
UInt8 WeightOffset() const { return UInt8(WgtIdxOffset() + NumWgtIdx() * sizeof(UInt32)); }
|
||||
UInt8 NormalOffset() const { return UInt8(WeightOffset() + NumWeights() * sizeof(hsScalar)); }
|
||||
UInt8 ColorOffset() const { return UInt8(NormalOffset() + NumNorm() * sizeof(hsVector3)); }
|
||||
UInt8 Color2Offset() const { return UInt8(ColorOffset() + NumColor() * sizeof(UInt32)); }
|
||||
UInt8 UVWOffset() const { return UInt8(Color2Offset() + NumColor2() * sizeof(UInt32)); }
|
||||
uint8_t PositionOffset() const { return uint8_t(0); }
|
||||
uint8_t WgtIdxOffset() const { return uint8_t(PositionOffset() + NumPos() * sizeof(hsPoint3)); }
|
||||
uint8_t WeightOffset() const { return uint8_t(WgtIdxOffset() + NumWgtIdx() * sizeof(uint32_t)); }
|
||||
uint8_t NormalOffset() const { return uint8_t(WeightOffset() + NumWeights() * sizeof(float)); }
|
||||
uint8_t ColorOffset() const { return uint8_t(NormalOffset() + NumNorm() * sizeof(hsVector3)); }
|
||||
uint8_t Color2Offset() const { return uint8_t(ColorOffset() + NumColor() * sizeof(uint32_t)); }
|
||||
uint8_t UVWOffset() const { return uint8_t(Color2Offset() + NumColor2() * sizeof(uint32_t)); }
|
||||
|
||||
UInt32 NumUVWs() const { return (fFormat & kUVWMask) >> 4; }
|
||||
UInt32 NumWeights() const { return (fFormat & kWeightMask) >> 8; }
|
||||
uint32_t NumUVWs() const { return (fFormat & kUVWMask) >> 4; }
|
||||
uint32_t NumWeights() const { return (fFormat & kWeightMask) >> 8; }
|
||||
|
||||
UInt32 NumPos() const { return (fFormat & kPosMask) >> 0; }
|
||||
UInt32 NumNorm() const { return (fFormat & kNormMask) >> 1; }
|
||||
UInt32 NumColor() const { return (fFormat & kColorMask) >> 2; }
|
||||
UInt32 NumColor2() const { return (fFormat & kColor2Mask) >> 10; }
|
||||
UInt32 NumWgtIdx() const { return (fFormat & kWgtIdxMask) >> 3; }
|
||||
uint32_t NumPos() const { return (fFormat & kPosMask) >> 0; }
|
||||
uint32_t NumNorm() const { return (fFormat & kNormMask) >> 1; }
|
||||
uint32_t NumColor() const { return (fFormat & kColorMask) >> 2; }
|
||||
uint32_t NumColor2() const { return (fFormat & kColor2Mask) >> 10; }
|
||||
uint32_t NumWgtIdx() const { return (fFormat & kWgtIdxMask) >> 3; }
|
||||
|
||||
hsPoint3* Position(int i) const { return (hsPoint3*)GetData(kPosition, i); }
|
||||
hsVector3* Normal(int i) const { return (hsVector3*)GetData(kNormal, i); }
|
||||
UInt32* Color(int i) const { return (UInt32*)GetData(kColor, i); }
|
||||
UInt32* Color2(int i) const { return (UInt32*)GetData(kColor2, i); }
|
||||
UInt32* WgtIdx(int i) const { return (UInt32*)GetData(kWgtIdx, i); }
|
||||
uint32_t* Color(int i) const { return (uint32_t*)GetData(kColor, i); }
|
||||
uint32_t* Color2(int i) const { return (uint32_t*)GetData(kColor2, i); }
|
||||
uint32_t* WgtIdx(int i) const { return (uint32_t*)GetData(kWgtIdx, i); }
|
||||
hsPoint3* UVWs(int iv, int iuv) const { return (hsPoint3*)GetData(kUVW, iv, iuv); }
|
||||
hsScalar* Weight(int iv, int iw) const { return (hsScalar*)GetData(kWeight, iv, iw); }
|
||||
float* Weight(int iv, int iw) const { return (float*)GetData(kWeight, iv, iw); }
|
||||
|
||||
UInt8* GetData(Channel chan, int i, int j=0) const
|
||||
uint8_t* GetData(Channel chan, int i, int j=0) const
|
||||
{
|
||||
ValidateInput(chan, i, j);
|
||||
UInt8* base = fData + i * fStride;
|
||||
uint8_t* base = fData + i * fStride;
|
||||
switch(chan)
|
||||
{
|
||||
case kPosition:
|
||||
@ -173,37 +173,37 @@ public:
|
||||
case kWeight:
|
||||
return base
|
||||
+ NumPos() * sizeof(hsPoint3)
|
||||
+ j * sizeof(hsScalar);
|
||||
+ j * sizeof(float);
|
||||
case kWgtIdx:
|
||||
return base
|
||||
+ NumPos() * sizeof(hsPoint3)
|
||||
+ NumWeights() * sizeof(hsScalar);
|
||||
+ NumWeights() * sizeof(float);
|
||||
case kNormal:
|
||||
return base
|
||||
+ NumPos() * sizeof(hsPoint3)
|
||||
+ NumWeights() * sizeof(hsScalar)
|
||||
+ NumWgtIdx() * sizeof(UInt32);
|
||||
+ NumWeights() * sizeof(float)
|
||||
+ NumWgtIdx() * sizeof(uint32_t);
|
||||
case kColor:
|
||||
return base
|
||||
+ NumPos() * sizeof(hsPoint3)
|
||||
+ NumWeights() * sizeof(hsScalar)
|
||||
+ NumWgtIdx() * sizeof(UInt32)
|
||||
+ NumWeights() * sizeof(float)
|
||||
+ NumWgtIdx() * sizeof(uint32_t)
|
||||
+ NumNorm() * sizeof(hsVector3);
|
||||
case kColor2:
|
||||
return base
|
||||
+ NumPos() * sizeof(hsPoint3)
|
||||
+ NumWeights() * sizeof(hsScalar)
|
||||
+ NumWgtIdx() * sizeof(UInt32)
|
||||
+ NumWeights() * sizeof(float)
|
||||
+ NumWgtIdx() * sizeof(uint32_t)
|
||||
+ NumNorm() * sizeof(hsVector3)
|
||||
+ NumColor() * sizeof(UInt32);
|
||||
+ NumColor() * sizeof(uint32_t);
|
||||
case kUVW:
|
||||
return base
|
||||
+ NumPos() * sizeof(hsPoint3)
|
||||
+ NumWeights() * sizeof(hsScalar)
|
||||
+ NumWgtIdx() * sizeof(UInt32)
|
||||
+ NumWeights() * sizeof(float)
|
||||
+ NumWgtIdx() * sizeof(uint32_t)
|
||||
+ NumNorm() * sizeof(hsVector3)
|
||||
+ NumColor() * sizeof(UInt32)
|
||||
+ NumColor2() * sizeof(UInt32)
|
||||
+ NumColor() * sizeof(uint32_t)
|
||||
+ NumColor2() * sizeof(uint32_t)
|
||||
+ j * sizeof(hsPoint3);
|
||||
}
|
||||
hsAssert(false, "Unrecognized vertex channel");
|
||||
@ -240,7 +240,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
void Alloc(UInt16 format, UInt32 numVerts, UInt32 numTris);
|
||||
void Alloc(uint16_t format, uint32_t numVerts, uint32_t numTris);
|
||||
void DeAlloc();
|
||||
|
||||
void Read(hsStream* s);
|
||||
|
@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plSpanTypes.h"
|
||||
#include "hsStream.h"
|
||||
#include "pnKeyedObject/plKey.h"
|
||||
@ -68,7 +68,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
void plSpan::Read( hsStream *stream )
|
||||
{
|
||||
fSubType = (UInt16)(stream->ReadLE32());
|
||||
fSubType = (uint16_t)(stream->ReadLE32());
|
||||
fFogEnvironment = nil;
|
||||
|
||||
fMaterialIdx = stream->ReadLE32();
|
||||
@ -78,7 +78,7 @@ void plSpan::Read( hsStream *stream )
|
||||
fLocalBounds.Read( stream );
|
||||
fWorldBounds.Read( stream );
|
||||
|
||||
fNumMatrices = (UInt8)(stream->ReadLE32());
|
||||
fNumMatrices = (uint8_t)(stream->ReadLE32());
|
||||
fBaseMatrix = stream->ReadLE32();
|
||||
|
||||
fLocalUVWChans = stream->ReadLE16();
|
||||
@ -172,11 +172,11 @@ void plSpan::RemovePermaLight(plLightInfo* li, hsBool proj)
|
||||
//// AddLight ////////////////////////////////////////////////////////////////
|
||||
// Smart function for maintaining the sorted list of lights for a plSpan.
|
||||
|
||||
void plSpan::AddLight( plLightInfo *li, hsScalar strength, hsScalar scale, hsBool proj ) const
|
||||
void plSpan::AddLight( plLightInfo *li, float strength, float scale, hsBool proj ) const
|
||||
{
|
||||
hsTArray<plLightInfo*>& lights = proj ? fProjectors : fLights;
|
||||
hsTArray<hsScalar>& strengths = proj ? fProjStrengths : fLightStrengths;
|
||||
hsTArray<hsScalar>& scales = proj ? fProjScales : fLightScales;
|
||||
hsTArray<float>& strengths = proj ? fProjStrengths : fLightStrengths;
|
||||
hsTArray<float>& scales = proj ? fProjScales : fLightScales;
|
||||
|
||||
int i;
|
||||
|
||||
@ -187,7 +187,7 @@ void plSpan::AddLight( plLightInfo *li, hsScalar strength, hsScalar scale, hs
|
||||
}
|
||||
lights.Insert(i, li);
|
||||
strengths.Insert(i, strength);
|
||||
scales.Insert(i, hsScalar(UInt32(scale * 127.9f)) / 127.f);
|
||||
scales.Insert(i, float(uint32_t(scale * 127.9f)) / 127.f);
|
||||
}
|
||||
|
||||
void plSpan::ClearLights() const
|
||||
@ -266,14 +266,14 @@ hsBool plSpan::CanMergeInto( plSpan *other )
|
||||
{
|
||||
if( !HSMemory::EqualBlocks(fLights.AcquireArray(), other->fLights.AcquireArray(), fLights.GetCount() * sizeof(plLightInfo*)) )
|
||||
return false;
|
||||
if( !HSMemory::EqualBlocks(fLightScales.AcquireArray(), other->fLightScales.AcquireArray(), fLights.GetCount() * sizeof(hsScalar)) )
|
||||
if( !HSMemory::EqualBlocks(fLightScales.AcquireArray(), other->fLightScales.AcquireArray(), fLights.GetCount() * sizeof(float)) )
|
||||
return false;
|
||||
}
|
||||
if( fProjectors.GetCount() )
|
||||
{
|
||||
if( !HSMemory::EqualBlocks(fProjectors.AcquireArray(), other->fProjectors.AcquireArray(), fProjectors.GetCount() * sizeof(plLightInfo*)) )
|
||||
return false;
|
||||
if( !HSMemory::EqualBlocks(fProjScales.AcquireArray(), other->fProjScales.AcquireArray(), fProjectors.GetCount() * sizeof(hsScalar)) )
|
||||
if( !HSMemory::EqualBlocks(fProjScales.AcquireArray(), other->fProjScales.AcquireArray(), fProjectors.GetCount() * sizeof(float)) )
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -301,7 +301,7 @@ plSpan::plSpan()
|
||||
{
|
||||
fTypeMask = kSpan;
|
||||
fSubType = plDrawable::kSubNormal;
|
||||
fMaterialIdx = (UInt32)-1;
|
||||
fMaterialIdx = (uint32_t)-1;
|
||||
fFogEnvironment = nil;
|
||||
fProps = 0;
|
||||
|
||||
@ -345,10 +345,10 @@ void plSpan::Destroy()
|
||||
plVertexSpan::plVertexSpan()
|
||||
{
|
||||
fTypeMask |= kVertexSpan;
|
||||
fGroupIdx = (UInt32)-1;
|
||||
fVBufferIdx = (UInt32)-1;
|
||||
fCellIdx = (UInt32)-1;
|
||||
fCellOffset = (UInt32)-1;
|
||||
fGroupIdx = (uint32_t)-1;
|
||||
fVBufferIdx = (uint32_t)-1;
|
||||
fCellIdx = (uint32_t)-1;
|
||||
fCellOffset = (uint32_t)-1;
|
||||
}
|
||||
|
||||
void plVertexSpan::Read( hsStream* stream )
|
||||
@ -432,7 +432,7 @@ void plIcicle::Read( hsStream *stream )
|
||||
int i;
|
||||
|
||||
|
||||
fSortData = TRACKED_NEW plGBufferTriangle[ fILength / 3 ];
|
||||
fSortData = new plGBufferTriangle[ fILength / 3 ];
|
||||
for( i = 0; i < fILength / 3; i++ )
|
||||
fSortData[ i ].Read( stream );
|
||||
}
|
||||
|
@ -121,26 +121,26 @@ class plSpan
|
||||
kParticleSet = 0x10
|
||||
};
|
||||
|
||||
UInt16 fTypeMask; // For safe casting. Or it with the type you want to cast to, don't check equality
|
||||
UInt16 fSubType; // Or'ed from plDrawable::plDrawableSubType
|
||||
UInt32 fMaterialIdx; // Index into drawable's material array
|
||||
uint16_t fTypeMask; // For safe casting. Or it with the type you want to cast to, don't check equality
|
||||
uint16_t fSubType; // Or'ed from plDrawable::plDrawableSubType
|
||||
uint32_t fMaterialIdx; // Index into drawable's material array
|
||||
hsMatrix44 fLocalToWorld;
|
||||
hsMatrix44 fWorldToLocal;
|
||||
UInt32 fBaseMatrix;
|
||||
UInt8 fNumMatrices;
|
||||
UInt16 fLocalUVWChans;
|
||||
UInt16 fMaxBoneIdx;
|
||||
UInt16 fPenBoneIdx;
|
||||
UInt32 fProps;
|
||||
uint32_t fBaseMatrix;
|
||||
uint8_t fNumMatrices;
|
||||
uint16_t fLocalUVWChans;
|
||||
uint16_t fMaxBoneIdx;
|
||||
uint16_t fPenBoneIdx;
|
||||
uint32_t fProps;
|
||||
hsBounds3Ext fLocalBounds;
|
||||
hsBounds3Ext fWorldBounds;
|
||||
plFogEnvironment *fFogEnvironment;
|
||||
|
||||
// Use setter/getters below.
|
||||
hsScalar fMinDist;
|
||||
hsScalar fMaxDist;
|
||||
float fMinDist;
|
||||
float fMaxDist;
|
||||
|
||||
hsScalar fWaterHeight;
|
||||
float fWaterHeight;
|
||||
|
||||
hsBitVector fVisSet;
|
||||
hsBitVector fVisNot;
|
||||
@ -149,11 +149,11 @@ class plSpan
|
||||
|
||||
// mutable hsBitVector fLightBits;
|
||||
mutable hsTArray<plLightInfo*> fLights;
|
||||
mutable hsTArray<hsScalar> fLightStrengths;
|
||||
mutable hsTArray<hsScalar> fLightScales;
|
||||
mutable hsTArray<float> fLightStrengths;
|
||||
mutable hsTArray<float> fLightScales;
|
||||
mutable hsTArray<plLightInfo*> fProjectors;
|
||||
mutable hsTArray<hsScalar> fProjStrengths;
|
||||
mutable hsTArray<hsScalar> fProjScales;
|
||||
mutable hsTArray<float> fProjStrengths;
|
||||
mutable hsTArray<float> fProjScales;
|
||||
|
||||
mutable hsBitVector fShadowBits;
|
||||
mutable hsBitVector fShadowSlaveBits;
|
||||
@ -172,27 +172,27 @@ class plSpan
|
||||
const hsBitVector& GetShadowSlaves() const { return fShadowSlaveBits; }
|
||||
void AddShadowSlave(int iSlave) const { fShadowSlaveBits.SetBit(iSlave); }
|
||||
|
||||
void SetShadowBit(UInt32 idx) const { fShadowBits.SetBit(idx); }
|
||||
void SetShadowBit(uint32_t idx) const { fShadowBits.SetBit(idx); }
|
||||
void ClearShadowBits() const { fShadowBits.Clear(); }
|
||||
hsBool IsShadowBitSet(UInt32 idx) const { return fShadowBits.IsBitSet(idx); }
|
||||
hsBool IsShadowBitSet(uint32_t idx) const { return fShadowBits.IsBitSet(idx); }
|
||||
void ClearLights() const;
|
||||
|
||||
void AddLight( plLightInfo* li, hsScalar strength, hsScalar scale, hsBool proj ) const;
|
||||
void AddLight( plLightInfo* li, float strength, float scale, hsBool proj ) const;
|
||||
|
||||
hsTArray<plLightInfo*>& GetLightList(hsBool proj) const { return proj ? fProjectors : fLights; }
|
||||
|
||||
UInt32 GetNumLights(hsBool proj) const { return proj ? fProjectors.GetCount() : fLights.GetCount(); }
|
||||
uint32_t GetNumLights(hsBool proj) const { return proj ? fProjectors.GetCount() : fLights.GetCount(); }
|
||||
plLightInfo* GetLight(int i, hsBool proj) const { return proj ? fProjectors[i] : fLights[i]; }
|
||||
hsScalar GetLightStrength(int i, hsBool proj) const { return proj ? fProjStrengths[i] : fLightStrengths[i]; }
|
||||
hsScalar GetLightScale(int i, hsBool proj) const { return proj ? fProjScales[i] : fLightScales[i]; }
|
||||
float GetLightStrength(int i, hsBool proj) const { return proj ? fProjStrengths[i] : fLightStrengths[i]; }
|
||||
float GetLightScale(int i, hsBool proj) const { return proj ? fProjScales[i] : fLightScales[i]; }
|
||||
|
||||
void AddPermaLight(plLightInfo* li, hsBool proj);
|
||||
void RemovePermaLight(plLightInfo* li, hsBool proj);
|
||||
|
||||
const hsBitVector& GetVisSet() const { return fVisSet; }
|
||||
const hsBitVector& GetVisNot() const { return fVisNot; }
|
||||
void SetVisBit(UInt32 w, hsBool on) { fVisSet.SetBit(w, on); }
|
||||
void SetVisNot(UInt32 w, hsBool on) { fVisNot.SetBit(w, on); }
|
||||
void SetVisBit(uint32_t w, hsBool on) { fVisSet.SetBit(w, on); }
|
||||
void SetVisNot(uint32_t w, hsBool on) { fVisNot.SetBit(w, on); }
|
||||
|
||||
void RemoveAuxSpan(plAuxSpan* aux);
|
||||
void AddAuxSpan(plAuxSpan* aux);
|
||||
@ -206,10 +206,10 @@ class plSpan
|
||||
virtual void MergeInto( plSpan* other );
|
||||
virtual void Destroy( void );
|
||||
|
||||
void SetMinDist(hsScalar minDist) { fMinDist = minDist; }
|
||||
void SetMaxDist(hsScalar maxDist) { fMaxDist = maxDist; }
|
||||
hsScalar GetMinDist() const { return fMinDist; }
|
||||
hsScalar GetMaxDist() const { return fMaxDist; }
|
||||
void SetMinDist(float minDist) { fMinDist = minDist; }
|
||||
void SetMaxDist(float maxDist) { fMaxDist = maxDist; }
|
||||
float GetMinDist() const { return fMinDist; }
|
||||
float GetMaxDist() const { return fMaxDist; }
|
||||
};
|
||||
|
||||
//// plVertexSpan Definition
|
||||
@ -220,13 +220,13 @@ class plVertexSpan : public plSpan
|
||||
public:
|
||||
|
||||
// Stuff internal
|
||||
UInt32 fGroupIdx; // Which buffer group, i.e. which vertex format
|
||||
uint32_t fGroupIdx; // Which buffer group, i.e. which vertex format
|
||||
|
||||
UInt32 fVBufferIdx; // Which vertex buffer in group
|
||||
UInt32 fCellIdx; // Cell index inside the vertex buffer
|
||||
UInt32 fCellOffset; // Offset inside the cell
|
||||
UInt32 fVStartIdx; // Start vertex # in the actual interlaced buffer
|
||||
UInt32 fVLength; // Length of this span in the buffer
|
||||
uint32_t fVBufferIdx; // Which vertex buffer in group
|
||||
uint32_t fCellIdx; // Cell index inside the vertex buffer
|
||||
uint32_t fCellOffset; // Offset inside the cell
|
||||
uint32_t fVStartIdx; // Start vertex # in the actual interlaced buffer
|
||||
uint32_t fVLength; // Length of this span in the buffer
|
||||
|
||||
plVertexSpan();
|
||||
|
||||
@ -244,13 +244,13 @@ class plIcicle : public plVertexSpan
|
||||
{
|
||||
public:
|
||||
|
||||
UInt32 fIBufferIdx; // Which index buffer in group
|
||||
UInt32 fIStartIdx; // Redundant, since all spans are contiguous. Here for debugging
|
||||
UInt32 fILength; // Length of this span in the buffer
|
||||
uint32_t fIBufferIdx; // Which index buffer in group
|
||||
uint32_t fIStartIdx; // Redundant, since all spans are contiguous. Here for debugging
|
||||
uint32_t fILength; // Length of this span in the buffer
|
||||
// The index into the indexbuffer ref. This can be different from fIStartIdx if spans get
|
||||
// culled, then we pack the non-culled index spans into the beginning of the index buffer ref,
|
||||
// so we can still put them all out with a single DIP call.
|
||||
mutable UInt32 fIPackedIdx;
|
||||
mutable uint32_t fIPackedIdx;
|
||||
|
||||
// Run-time-only stuff
|
||||
plGBufferTriangle *fSortData; // Indices & center points for sorting tris in this span (optional)
|
||||
@ -277,9 +277,9 @@ class plParticleSpan : public plIcicle
|
||||
public:
|
||||
|
||||
plParticleEmitter* fSource; // Source emitter, used to get array of plParticleCores
|
||||
UInt32 fNumParticles;
|
||||
UInt32 fSortCount;
|
||||
UInt32 fSrcSpanIdx;
|
||||
uint32_t fNumParticles;
|
||||
uint32_t fSortCount;
|
||||
uint32_t fSrcSpanIdx;
|
||||
|
||||
plParticleSet* fParentSet;
|
||||
|
||||
@ -301,27 +301,27 @@ class plParticleSet
|
||||
{
|
||||
public:
|
||||
|
||||
UInt32 fRefCount; // Delete if this gets to 0
|
||||
UInt32 fDIEntry; // Our false DIIndices entry index
|
||||
uint32_t fRefCount; // Delete if this gets to 0
|
||||
uint32_t fDIEntry; // Our false DIIndices entry index
|
||||
|
||||
UInt32 fGroupIdx; // Which buffer group, i.e. which vertex format
|
||||
UInt8 fFormat;
|
||||
uint32_t fGroupIdx; // Which buffer group, i.e. which vertex format
|
||||
uint8_t fFormat;
|
||||
|
||||
UInt32 fVBufferIdx;
|
||||
UInt32 fCellIdx;
|
||||
UInt32 fCellOffset;
|
||||
UInt32 fVStartIdx;
|
||||
UInt32 fVLength; // Total v.b. length that all the icicles can take up UInt32 fIBufferIdx;
|
||||
UInt32 fIBufferIdx;
|
||||
UInt32 fIStartIdx; // Start index buffer position
|
||||
UInt32 fILength; // Total i.b. length that all the icicles can take up
|
||||
uint32_t fVBufferIdx;
|
||||
uint32_t fCellIdx;
|
||||
uint32_t fCellOffset;
|
||||
uint32_t fVStartIdx;
|
||||
uint32_t fVLength; // Total v.b. length that all the icicles can take up uint32_t fIBufferIdx;
|
||||
uint32_t fIBufferIdx;
|
||||
uint32_t fIStartIdx; // Start index buffer position
|
||||
uint32_t fILength; // Total i.b. length that all the icicles can take up
|
||||
|
||||
UInt32 fNumSpans;
|
||||
uint32_t fNumSpans;
|
||||
hsGMaterial* fMaterial;
|
||||
|
||||
UInt32 fNextVStartIdx;
|
||||
UInt32 fNextCellOffset;
|
||||
UInt32 fNextIStartIdx;
|
||||
uint32_t fNextVStartIdx;
|
||||
uint32_t fNextCellOffset;
|
||||
uint32_t fNextIStartIdx;
|
||||
|
||||
plParticleSet();
|
||||
~plParticleSet();
|
||||
|
@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// Requires class T to have the following members
|
||||
// T& operator+=(const class T& t);
|
||||
// T& operator-=(const class T& t);
|
||||
// T& operator*=(hsScalar scale);
|
||||
// T& operator*=(float scale);
|
||||
// T& operator=(const class T&); // unless builtin = is adequate.
|
||||
//
|
||||
template <class T> class plTimedInterp
|
||||
@ -72,7 +72,7 @@ protected:
|
||||
|
||||
const T& IEnd();
|
||||
const T& IBegin();
|
||||
const T& IEval(hsScalar parm);
|
||||
const T& IEval(float parm);
|
||||
public:
|
||||
plTimedInterp();
|
||||
plTimedInterp(const T& t);
|
||||
@ -110,7 +110,7 @@ plTimedInterp<T>::Update(double t)
|
||||
if( fDuration <= 0 )
|
||||
return IEnd();
|
||||
|
||||
hsScalar parm = hsScalar((fEnd - t) / fDuration);
|
||||
float parm = float((fEnd - t) / fDuration);
|
||||
if( parm <= 0 )
|
||||
return IEnd();
|
||||
else if( parm >= 1.f )
|
||||
@ -150,7 +150,7 @@ plTimedInterp<T>::IBegin()
|
||||
|
||||
template <class T>
|
||||
const T&
|
||||
plTimedInterp<T>::IEval(hsScalar parm)
|
||||
plTimedInterp<T>::IEval(float parm)
|
||||
{
|
||||
fCurr = fInit;
|
||||
fCurr -= fTarg;
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "hsBounds.h"
|
||||
#include "hsFastMath.h"
|
||||
|
||||
@ -84,7 +84,7 @@ hsBool plVisLOSMgr::ICheckSpaceTreeRecur(plSpaceTree* space, int which, hsTArray
|
||||
if( node.fFlags & plSpaceTreeNode::kDisabled )
|
||||
return false;
|
||||
|
||||
hsScalar closest;
|
||||
float closest;
|
||||
// If it's a hit
|
||||
if( ICheckBound(node.fWorldBounds, closest) )
|
||||
{
|
||||
@ -149,7 +149,7 @@ hsBool plVisLOSMgr::ISetup(const hsPoint3& pStart, const hsPoint3& pEnd)
|
||||
|
||||
fMaxDist = hsVector3(&fCurrTarg, &fCurrFrom).Magnitude();
|
||||
|
||||
const hsScalar kMinMaxDist(0);
|
||||
const float kMinMaxDist(0);
|
||||
return fMaxDist > kMinMaxDist;
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ hsBool plVisLOSMgr::ICheckDrawable(plDrawable* d, plVisHit& hit)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hit)
|
||||
hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit& hit)
|
||||
{
|
||||
if( !(dr->GetSpan(spanIdx)->fTypeMask & plSpan::kIcicleSpan) )
|
||||
return false;
|
||||
@ -263,7 +263,7 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hi
|
||||
hsPoint3 currTarg = src.GetWorldToLocal() * fCurrTarg;
|
||||
|
||||
hsVector3 currDir(&currTarg, &currFrom);
|
||||
hsScalar maxDist = currDir.Magnitude();
|
||||
float maxDist = currDir.Magnitude();
|
||||
|
||||
currDir /= maxDist;
|
||||
|
||||
@ -272,9 +272,9 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hi
|
||||
{
|
||||
// Project the current ray onto the tri plane
|
||||
hsVector3 norm = hsVector3(&tri.Position(1), &tri.Position(0)) % hsVector3(&tri.Position(2), &tri.Position(0));
|
||||
hsScalar dotNorm = norm.InnerProduct(currDir);
|
||||
float dotNorm = norm.InnerProduct(currDir);
|
||||
|
||||
const hsScalar kMinDotNorm = 1.e-3f;
|
||||
const float kMinDotNorm = 1.e-3f;
|
||||
if( dotNorm >= -kMinDotNorm )
|
||||
{
|
||||
if( !twoSided )
|
||||
@ -282,7 +282,7 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hi
|
||||
if( dotNorm <= kMinDotNorm )
|
||||
continue;
|
||||
}
|
||||
hsScalar dist = hsVector3(&tri.Position(0), &currFrom).InnerProduct(norm);
|
||||
float dist = hsVector3(&tri.Position(0), &currFrom).InnerProduct(norm);
|
||||
if( dist > 0 )
|
||||
continue;
|
||||
dist /= dotNorm;
|
||||
@ -295,13 +295,13 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hi
|
||||
|
||||
// Find the 3 cross products (v[i+1]-v[i]) X (proj - v[i]) dotted with current ray
|
||||
hsVector3 cross0 = hsVector3(&tri.Position(1), &tri.Position(0)) % hsVector3(&projPt, &tri.Position(0));
|
||||
hsScalar dot0 = cross0.InnerProduct(currDir);
|
||||
float dot0 = cross0.InnerProduct(currDir);
|
||||
|
||||
hsVector3 cross1 = hsVector3(&tri.Position(2), &tri.Position(1)) % hsVector3(&projPt, &tri.Position(1));
|
||||
hsScalar dot1 = cross1.InnerProduct(currDir);
|
||||
float dot1 = cross1.InnerProduct(currDir);
|
||||
|
||||
hsVector3 cross2 = hsVector3(&tri.Position(0), &tri.Position(2)) % hsVector3(&projPt, &tri.Position(2));
|
||||
hsScalar dot2 = cross2.InnerProduct(currDir);
|
||||
float dot2 = cross2.InnerProduct(currDir);
|
||||
|
||||
// If all 3 are negative, projPt is a hit
|
||||
// If all 3 are positive and we're two sided, projPt is a hit
|
||||
@ -330,7 +330,7 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hi
|
||||
return retVal;
|
||||
}
|
||||
|
||||
hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest)
|
||||
hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, float& closest)
|
||||
{
|
||||
if( bnd.GetType() != kBoundsNormal )
|
||||
return false;
|
||||
@ -360,7 +360,7 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest)
|
||||
const hsPoint3& currTarg = fCurrTarg;
|
||||
|
||||
hsVector3 currDir(&currTarg, &currFrom);
|
||||
const hsScalar maxDistSq = currDir.MagnitudeSquared();
|
||||
const float maxDistSq = currDir.MagnitudeSquared();
|
||||
|
||||
currDir *= hsFastMath::InvSqrt(maxDistSq);
|
||||
|
||||
@ -374,14 +374,14 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest)
|
||||
|
||||
// Project the current ray onto the tri plane
|
||||
hsVector3 norm = hsVector3(&p1, &p0) % hsVector3(&p2, &p0);
|
||||
hsScalar dotNorm = norm.InnerProduct(currDir);
|
||||
float dotNorm = norm.InnerProduct(currDir);
|
||||
|
||||
const hsScalar kMinDotNorm = 1.e-3f;
|
||||
const float kMinDotNorm = 1.e-3f;
|
||||
if( dotNorm >= -kMinDotNorm )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
hsScalar dist = hsVector3(&p0, &currFrom).InnerProduct(norm);
|
||||
float dist = hsVector3(&p0, &currFrom).InnerProduct(norm);
|
||||
if( dist >= 0 )
|
||||
continue;
|
||||
dist /= dotNorm;
|
||||
@ -395,16 +395,16 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest)
|
||||
|
||||
// Find the 3 cross products (v[i+1]-v[i]) X (proj - v[i]) dotted with current ray
|
||||
hsVector3 cross0 = hsVector3(&p1, &p0) % hsVector3(&projPt, &p0);
|
||||
hsScalar dot0 = cross0.InnerProduct(currDir);
|
||||
float dot0 = cross0.InnerProduct(currDir);
|
||||
|
||||
hsVector3 cross1 = hsVector3(&p2, &p1) % hsVector3(&projPt, &p1);
|
||||
hsScalar dot1 = cross1.InnerProduct(currDir);
|
||||
float dot1 = cross1.InnerProduct(currDir);
|
||||
|
||||
hsVector3 cross2 = hsVector3(&p3, &p2) % hsVector3(&projPt, &p2);
|
||||
hsScalar dot2 = cross2.InnerProduct(currDir);
|
||||
float dot2 = cross2.InnerProduct(currDir);
|
||||
|
||||
hsVector3 cross3 = hsVector3(&p0, &p3) % hsVector3(&projPt, &p3);
|
||||
hsScalar dot3 = cross3.InnerProduct(currDir);
|
||||
float dot3 = cross3.InnerProduct(currDir);
|
||||
|
||||
// If all 4 are negative, projPt is a hit
|
||||
if( (dot0 <= 0) && (dot1 <= 0) && (dot2 <= 0) && (dot3 <= 0) )
|
||||
@ -418,11 +418,11 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest)
|
||||
|
||||
hsBool plVisLOSMgr::CursorCheck(plVisHit& hit)
|
||||
{
|
||||
Int32 sx= Int32(plMouseDevice::Instance()->GetCursorX() * fPipe->Width());
|
||||
Int32 sy= Int32(plMouseDevice::Instance()->GetCursorY() * fPipe->Height());
|
||||
int32_t sx= int32_t(plMouseDevice::Instance()->GetCursorX() * fPipe->Width());
|
||||
int32_t sy= int32_t(plMouseDevice::Instance()->GetCursorY() * fPipe->Height());
|
||||
|
||||
hsPoint3 from = fPipe->GetViewPositionWorld();
|
||||
plConst(hsScalar) dist(1.e5f);
|
||||
plConst(float) dist(1.e5f);
|
||||
|
||||
hsPoint3 targ;
|
||||
fPipe->ScreenToWorldPoint(1, 0, &sx, &sy, dist, 0, &targ);
|
||||
|
@ -65,7 +65,7 @@ class plSpaceHit
|
||||
{
|
||||
public:
|
||||
int fIdx;
|
||||
hsScalar fClosest;
|
||||
float fClosest;
|
||||
};
|
||||
|
||||
class plVisLOSMgr
|
||||
@ -74,18 +74,18 @@ protected:
|
||||
plPageTreeMgr* fPageMgr;
|
||||
plPipeline* fPipe;
|
||||
|
||||
hsScalar fMaxDist;
|
||||
float fMaxDist;
|
||||
|
||||
hsPoint3 fCurrFrom;
|
||||
hsPoint3 fCurrTarg;
|
||||
|
||||
hsBool ISetup(const hsPoint3& pStart, const hsPoint3& pEnd);
|
||||
hsBool ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest);
|
||||
hsBool ICheckBound(const hsBounds3Ext& bnd, float& closest);
|
||||
hsBool ICheckSpaceTreeRecur(plSpaceTree* space, int which, hsTArray<plSpaceHit>& hits);
|
||||
hsBool ICheckSpaceTree(plSpaceTree* space, hsTArray<plSpaceHit>& hits);
|
||||
hsBool ICheckSceneNode(plSceneNode* node, plVisHit& hit);
|
||||
hsBool ICheckDrawable(plDrawable* d, plVisHit& hit);
|
||||
hsBool ICheckSpan(plDrawableSpans* dr, UInt32 spanIdx, plVisHit& hit);
|
||||
hsBool ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit& hit);
|
||||
|
||||
public:
|
||||
hsBool Check(const hsPoint3& pStart, const hsPoint3& pEnd, plVisHit& hit);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -81,11 +81,11 @@ class plWorldWaveData7
|
||||
{
|
||||
public:
|
||||
hsPoint3 fDir;
|
||||
hsScalar fLength;
|
||||
float fLength;
|
||||
|
||||
hsScalar fFreq;
|
||||
hsScalar fPhase;
|
||||
hsScalar fAmplitude;
|
||||
float fFreq;
|
||||
float fPhase;
|
||||
float fAmplitude;
|
||||
};
|
||||
|
||||
class plWorldWave7 : public plWorldWaveData7
|
||||
@ -180,30 +180,30 @@ protected:
|
||||
plStatusLog* fStatusLog;
|
||||
plGraphPlate* fStatusGraph;
|
||||
|
||||
UInt32 fTrialUpdate;
|
||||
uint32_t fTrialUpdate;
|
||||
|
||||
plFixedWaterState7 fState;
|
||||
|
||||
hsScalar fScrunchLen;
|
||||
hsScalar fScrunchScale;
|
||||
float fScrunchLen;
|
||||
float fScrunchScale;
|
||||
|
||||
hsVector3 fWindDir;
|
||||
|
||||
hsScalar fMinLen;
|
||||
hsScalar fMaxLen;
|
||||
hsScalar fFreqScale;
|
||||
float fMinLen;
|
||||
float fMaxLen;
|
||||
float fFreqScale;
|
||||
|
||||
hsScalar fTransCountDown;
|
||||
float fTransCountDown;
|
||||
int fTransistor;
|
||||
hsScalar fTransDel;
|
||||
float fTransDel;
|
||||
|
||||
hsScalar fTexTransCountDown;
|
||||
float fTexTransCountDown;
|
||||
int fTexTrans;
|
||||
hsScalar fTexTransDel;
|
||||
hsScalar fTexWaveFade[kNumTexWaves];
|
||||
float fTexTransDel;
|
||||
float fTexWaveFade[kNumTexWaves];
|
||||
|
||||
plWorldWave7 fWorldWaves[kNumWaves];
|
||||
hsScalar fFreqMod[kNumWaves];
|
||||
float fFreqMod[kNumWaves];
|
||||
|
||||
plRandom fRand;
|
||||
|
||||
@ -233,8 +233,8 @@ protected:
|
||||
plShader* fBiasPShader;
|
||||
|
||||
plBitmap* fEnvMap;
|
||||
UInt32 fEnvSize;
|
||||
hsScalar fEnvRefresh;
|
||||
uint32_t fEnvSize;
|
||||
float fEnvRefresh;
|
||||
|
||||
plLayer* fFixedLayers[4];
|
||||
|
||||
@ -321,24 +321,24 @@ protected:
|
||||
class TexWaveDesc
|
||||
{
|
||||
public:
|
||||
hsScalar fPhase;
|
||||
hsScalar fAmp;
|
||||
hsScalar fLen;
|
||||
hsScalar fFreq;
|
||||
hsScalar fDirX;
|
||||
hsScalar fDirY;
|
||||
hsScalar fRotScale00;
|
||||
hsScalar fRotScale01;
|
||||
float fPhase;
|
||||
float fAmp;
|
||||
float fLen;
|
||||
float fFreq;
|
||||
float fDirX;
|
||||
float fDirY;
|
||||
float fRotScale00;
|
||||
float fRotScale01;
|
||||
};
|
||||
TexWaveDesc fTexWaves[kNumTexWaves];
|
||||
|
||||
class TexWaveWindDep
|
||||
{
|
||||
public:
|
||||
hsScalar fWindSpeed;
|
||||
float fWindSpeed;
|
||||
|
||||
hsScalar fHeight;
|
||||
hsScalar fSpecular;
|
||||
float fHeight;
|
||||
float fSpecular;
|
||||
};
|
||||
|
||||
TexWaveWindDep fWindDeps[kNumWindDep];
|
||||
@ -348,47 +348,47 @@ protected:
|
||||
|
||||
inline void IScrunch(hsPoint3& pos, hsVector3& norm) const;
|
||||
|
||||
void ICalcWindow(hsScalar dt);
|
||||
void ICalcWindow(float dt);
|
||||
void ICalcScale();
|
||||
void IUpdateWaves(hsScalar dt);
|
||||
void IUpdateWave(hsScalar dt, int i);
|
||||
void IUpdateWaves(float dt);
|
||||
void IUpdateWave(float dt, int i);
|
||||
hsBool IAnyBoundsVisible(plPipeline* pipe) const;
|
||||
|
||||
void IInitWave(int i);
|
||||
void IReInitWaves();
|
||||
|
||||
void IUpdateRefObject();
|
||||
void IUpdateWindDir(hsScalar dt);
|
||||
void IUpdateWindDir(float dt);
|
||||
|
||||
void IShiftCenter(plSceneObject* so) const;
|
||||
void IFloatBuoys(hsScalar dt);
|
||||
void IFloatBuoy(hsScalar dt, plSceneObject* so);
|
||||
void IFloatBuoys(float dt);
|
||||
void IFloatBuoy(float dt, plSceneObject* so);
|
||||
|
||||
// Bookkeeping
|
||||
void IAddTarget(const plKey& key);
|
||||
void IRemoveTarget(const plKey& key);
|
||||
|
||||
void ISetWindSpeed(hsScalar s);
|
||||
void ISetWindSpeed(float s);
|
||||
|
||||
hsBool IOnReceive(plGenRefMsg* refMsg);
|
||||
hsBool IOnRemove(plGenRefMsg* refMsg);
|
||||
|
||||
hsBool ITransContinue(hsScalar dt);
|
||||
void IStartTransition(hsScalar dt);
|
||||
hsScalar ITransitionDelay() const;
|
||||
void ITransition(hsScalar dt);
|
||||
hsBool ITransContinue(float dt);
|
||||
void IStartTransition(float dt);
|
||||
float ITransitionDelay() const;
|
||||
void ITransition(float dt);
|
||||
|
||||
hsBool ITransTexContinue(hsScalar dt);
|
||||
void IStartTexTransition(hsScalar dt);
|
||||
void ITransTex(hsScalar dt);
|
||||
hsBool ITransTexContinue(float dt);
|
||||
void IStartTexTransition(float dt);
|
||||
void ITransTex(float dt);
|
||||
|
||||
void IInitTexWave(int i);
|
||||
void ISetupTextureWaves();
|
||||
|
||||
void IUpdateLayers(hsScalar dt);
|
||||
void IUpdateBumpLayers(hsScalar dt);
|
||||
void IUpdateLayers(float dt);
|
||||
void IUpdateBumpLayers(float dt);
|
||||
|
||||
plRenderRequest* ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, hsScalar pri);
|
||||
plRenderRequest* ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, float pri);
|
||||
void ISubmitRenderRequests();
|
||||
|
||||
plRenderTarget* ICreateTransferRenderTarget(const char* name, int size);
|
||||
@ -398,7 +398,7 @@ protected:
|
||||
plMipmap* ICreateBiasNoiseMap();
|
||||
void IAddBumpBiasLayer(hsGMaterial* mat);
|
||||
|
||||
plMipmap* ICreateBumpBitmapFFP(hsScalar amp, hsScalar dx, hsScalar dy) const;
|
||||
plMipmap* ICreateBumpBitmapFFP(float amp, float dx, float dy) const;
|
||||
hsGMaterial* ICreateBumpLayersFFP();
|
||||
plMipmap* ICreateBumpMipmapPS();
|
||||
plLayer* ICreateBumpLayerPS(plMipmap* mipMap, hsGMaterial* bumpMat, int which);
|
||||
@ -413,10 +413,10 @@ protected:
|
||||
void ICheckTargetMaterials();
|
||||
|
||||
plDrawableSpans* ICreateGraphDrawable(plDrawableSpans* drawable, hsGMaterial* mat, int nWid);
|
||||
plDrawableSpans* ICreateEmptyGraphDrawable(const char* name, UInt32 ref, int wich);
|
||||
hsGMaterial* ICreateEmptyMaterial(const char* name, UInt32 ref, int which);
|
||||
plDrawableSpans* ICreateEmptyGraphDrawable(const char* name, uint32_t ref, int wich);
|
||||
hsGMaterial* ICreateEmptyMaterial(const char* name, uint32_t ref, int which);
|
||||
plLayer* ICreateBlankLayer(const char* name, int suff);
|
||||
plMipmap* ICreateBlankTex(const char* name, int width, int height, UInt32 ref);
|
||||
plMipmap* ICreateBlankTex(const char* name, int width, int height, uint32_t ref);
|
||||
plMipmap* ICreateGraphShoreTex(int width, int height);
|
||||
plMipmap* ICreateBubbleShoreTex(int width, int height);
|
||||
void IRefillBubbleShoreTex();
|
||||
@ -440,12 +440,12 @@ protected:
|
||||
|
||||
void IAddGraphPShader(hsGMaterial* mat, int iPass);
|
||||
void IAddGraphVShader(hsGMaterial* mat, int iPass);
|
||||
void IUpdateGraphShader(hsScalar dt, int iPass);
|
||||
void IUpdateGraphShader(float dt, int iPass);
|
||||
void IInitGraph(int iPass);
|
||||
void IShuffleDownGraphs(int iPass);
|
||||
|
||||
// type is either plLayRefMsg::kVertexShader or plLayRefMsg::kPixelShader.
|
||||
void IAddShaderToLayers(hsGMaterial* mat, int iFirst, int iLast, UInt8 type, plShader* shader);
|
||||
void IAddShaderToLayers(hsGMaterial* mat, int iFirst, int iLast, uint8_t type, plShader* shader);
|
||||
|
||||
void IAddBumpPixelShader(hsGMaterial* mat, int iShader, int iFirst, int iLast);
|
||||
void IAddBumpVertexShader(hsGMaterial* mat, int iShader, int iFirst, int iLast);
|
||||
@ -474,7 +474,7 @@ protected:
|
||||
void IUpdateShoreVShader(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l);
|
||||
void IUpdateFixedVShader(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l);
|
||||
void IUpdateFixedPShader(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l);
|
||||
void IUpdateGraphShaders(plPipeline* pipe, hsScalar dt);
|
||||
void IUpdateGraphShaders(plPipeline* pipe, float dt);
|
||||
void IUpdateDecVShader(int t, plPipeline* pipe);
|
||||
void IUpdateDecVShaders(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l);
|
||||
|
||||
@ -482,9 +482,9 @@ protected:
|
||||
virtual int IDecalRef() const { return kRefDecal; }
|
||||
|
||||
inline void LogF(const char *format, ...) const;
|
||||
inline void LogF(UInt32 color, const char *format, ...) const;
|
||||
inline void LogF(uint32_t color, const char *format, ...) const;
|
||||
inline void IRestartLog() const;
|
||||
inline void GraphLen(hsScalar len) const;
|
||||
inline void GraphLen(float len) const;
|
||||
inline void IRestartGraph() const;
|
||||
|
||||
public:
|
||||
@ -496,14 +496,14 @@ public:
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; }
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; }
|
||||
|
||||
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);
|
||||
|
||||
hsScalar EvalPoint(hsPoint3& pos, hsVector3& norm);
|
||||
float EvalPoint(hsPoint3& pos, hsVector3& norm);
|
||||
|
||||
// Getters and Setters for Python twiddling
|
||||
//
|
||||
@ -512,112 +512,112 @@ public:
|
||||
//
|
||||
// Geometric wave parameters. These are all safe to twiddle at any time or speed.
|
||||
// The new settings take effect as new waves are spawned.
|
||||
void SetGeoMaxLength(hsScalar s, hsScalar secs=0) { fState.fGeoState.fMaxLength.Set(s, secs); }
|
||||
void SetGeoMinLength(hsScalar s, hsScalar secs=0) { fState.fGeoState.fMinLength.Set(s, secs); }
|
||||
void SetGeoAmpOverLen(hsScalar s, hsScalar secs=0) { fState.fGeoState.fAmpOverLen.Set(s, secs); }
|
||||
void SetGeoChop(hsScalar s, hsScalar secs=0) { fState.fGeoState.fChop.Set(s, secs); }
|
||||
void SetGeoAngleDev(hsScalar s, hsScalar secs=0) { fState.fGeoState.fAngleDev.Set(s, secs); }
|
||||
void SetGeoMaxLength(float s, float secs=0) { fState.fGeoState.fMaxLength.Set(s, secs); }
|
||||
void SetGeoMinLength(float s, float secs=0) { fState.fGeoState.fMinLength.Set(s, secs); }
|
||||
void SetGeoAmpOverLen(float s, float secs=0) { fState.fGeoState.fAmpOverLen.Set(s, secs); }
|
||||
void SetGeoChop(float s, float secs=0) { fState.fGeoState.fChop.Set(s, secs); }
|
||||
void SetGeoAngleDev(float s, float secs=0) { fState.fGeoState.fAngleDev.Set(s, secs); }
|
||||
|
||||
// Texture wave parameters. Safe to twiddle any time or speed.
|
||||
// The new settings take effect as new waves are spawned.
|
||||
void SetTexMaxLength(hsScalar s, hsScalar secs=0) { fState.fTexState.fMaxLength.Set(s, secs); }
|
||||
void SetTexMinLength(hsScalar s, hsScalar secs=0) { fState.fTexState.fMinLength.Set(s, secs); }
|
||||
void SetTexAmpOverLen(hsScalar s, hsScalar secs=0) { fState.fTexState.fAmpOverLen.Set(s, secs); }
|
||||
void SetTexChop(hsScalar s, hsScalar secs=0) { fState.fTexState.fChop.Set(s, secs); }
|
||||
void SetTexAngleDev(hsScalar s, hsScalar secs=0) { fState.fTexState.fAngleDev.Set(s, secs); }
|
||||
void SetTexMaxLength(float s, float secs=0) { fState.fTexState.fMaxLength.Set(s, secs); }
|
||||
void SetTexMinLength(float s, float secs=0) { fState.fTexState.fMinLength.Set(s, secs); }
|
||||
void SetTexAmpOverLen(float s, float secs=0) { fState.fTexState.fAmpOverLen.Set(s, secs); }
|
||||
void SetTexChop(float s, float secs=0) { fState.fTexState.fChop.Set(s, secs); }
|
||||
void SetTexAngleDev(float s, float secs=0) { fState.fTexState.fAngleDev.Set(s, secs); }
|
||||
|
||||
// The size in feet of one tile of the ripple texture. If you change this (I don't
|
||||
// recommend it), you need to change it very slowly or it will look very stupid.
|
||||
void SetRippleScale(hsScalar s, hsScalar secs=0) { fState.fRippleScale.Set(s, secs); }
|
||||
void SetRippleScale(float s, float secs=0) { fState.fRippleScale.Set(s, secs); }
|
||||
|
||||
// The direction the wind is blowing (waves will be more or less perpindicular to wind dir).
|
||||
// Change somewhat slowly, like over 30 seconds.
|
||||
void SetWindDir(const hsVector3& s, hsScalar secs=0) { fState.fWindDir.Set(s, secs); }
|
||||
void SetWindDir(const hsVector3& s, float secs=0) { fState.fWindDir.Set(s, secs); }
|
||||
|
||||
// Change these gently, effect is immediate.
|
||||
void SetSpecularNoise(hsScalar s, hsScalar secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kNoise] = s; fState.fSpecVec.Set(spec, secs); }
|
||||
void SetSpecularStart(hsScalar s, hsScalar secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecStart] = s; fState.fSpecVec.Set(spec, secs); }
|
||||
void SetSpecularEnd(hsScalar s, hsScalar secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecEnd] = s; fState.fSpecVec.Set(spec, secs); }
|
||||
void SetSpecularNoise(float s, float secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kNoise] = s; fState.fSpecVec.Set(spec, secs); }
|
||||
void SetSpecularStart(float s, float secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecStart] = s; fState.fSpecVec.Set(spec, secs); }
|
||||
void SetSpecularEnd(float s, float secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecEnd] = s; fState.fSpecVec.Set(spec, secs); }
|
||||
|
||||
// Water Height is overriden if the ref object is animated.
|
||||
void SetWaterHeight(hsScalar s, hsScalar secs=0) { fState.fWaterHeight.Set(s, secs); }
|
||||
void SetWaterHeight(float s, float secs=0) { fState.fWaterHeight.Set(s, secs); }
|
||||
|
||||
// Water Offset and DepthFalloff are complicated, and not immediately interesting to animate.
|
||||
void SetWaterOffset(const hsVector3& s, hsScalar secs=0) { fState.fWaterOffset.Set(s, secs); }
|
||||
void SetOpacOffset(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fWaterOffset; off.fX = s; fState.fWaterOffset.Set(off, secs); }
|
||||
void SetReflOffset(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fWaterOffset; off.fY = s; fState.fWaterOffset.Set(off, secs); }
|
||||
void SetWaveOffset(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fWaterOffset; off.fZ = s; fState.fWaterOffset.Set(off, secs); }
|
||||
void SetDepthFalloff(const hsVector3& s, hsScalar secs=0) { fState.fDepthFalloff.Set(s, secs); }
|
||||
void SetOpacFalloff(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fDepthFalloff; off.fX = s; fState.fDepthFalloff.Set(off, secs); }
|
||||
void SetReflFalloff(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fDepthFalloff; off.fY = s; fState.fDepthFalloff.Set(off, secs); }
|
||||
void SetWaveFalloff(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fDepthFalloff; off.fZ = s; fState.fDepthFalloff.Set(off, secs); }
|
||||
void SetWaterOffset(const hsVector3& s, float secs=0) { fState.fWaterOffset.Set(s, secs); }
|
||||
void SetOpacOffset(float s, float secs=0) { hsVector3 off = fState.fWaterOffset; off.fX = s; fState.fWaterOffset.Set(off, secs); }
|
||||
void SetReflOffset(float s, float secs=0) { hsVector3 off = fState.fWaterOffset; off.fY = s; fState.fWaterOffset.Set(off, secs); }
|
||||
void SetWaveOffset(float s, float secs=0) { hsVector3 off = fState.fWaterOffset; off.fZ = s; fState.fWaterOffset.Set(off, secs); }
|
||||
void SetDepthFalloff(const hsVector3& s, float secs=0) { fState.fDepthFalloff.Set(s, secs); }
|
||||
void SetOpacFalloff(float s, float secs=0) { hsVector3 off = fState.fDepthFalloff; off.fX = s; fState.fDepthFalloff.Set(off, secs); }
|
||||
void SetReflFalloff(float s, float secs=0) { hsVector3 off = fState.fDepthFalloff; off.fY = s; fState.fDepthFalloff.Set(off, secs); }
|
||||
void SetWaveFalloff(float s, float secs=0) { hsVector3 off = fState.fDepthFalloff; off.fZ = s; fState.fDepthFalloff.Set(off, secs); }
|
||||
|
||||
// Max and Min Atten aren't very interesting, and will probably go away.
|
||||
void SetMaxAtten(const hsVector3& s, hsScalar secs=0) { fState.fMaxAtten.Set(s, secs); }
|
||||
void SetMinAtten(const hsVector3& s, hsScalar secs=0) { fState.fMinAtten.Set(s, secs); }
|
||||
void SetMaxAtten(const hsVector3& s, float secs=0) { fState.fMaxAtten.Set(s, secs); }
|
||||
void SetMinAtten(const hsVector3& s, float secs=0) { fState.fMinAtten.Set(s, secs); }
|
||||
|
||||
// Skipping the shore parameters, because they are never used.
|
||||
|
||||
// Water colors, adjust slowly, effect is immediate.
|
||||
void SetWaterTint(const hsColorRGBA& s, hsScalar secs=0) { fState.fWaterTint.Set(s, secs); }
|
||||
void SetWaterRGB(const hsVector3& col, hsScalar secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetWaterOpacity()); SetWaterTint(rgb, secs); }
|
||||
void SetWaterOpacity(hsScalar s, hsScalar secs=0) { hsColorRGBA col = GetWaterTint(); col.a = s; SetWaterTint(col, secs); }
|
||||
void SetSpecularTint(const hsColorRGBA& s, hsScalar secs=0) { fState.fSpecularTint.Set(s, secs); }
|
||||
void SetSpecularRGB(const hsVector3& col, hsScalar secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetSpecularMute()); SetSpecularTint(rgb, secs); }
|
||||
void SetSpecularMute(hsScalar s, hsScalar secs=0) { hsColorRGBA col = GetSpecularTint(); col.a = s; SetSpecularTint(col, secs); }
|
||||
void SetWaterTint(const hsColorRGBA& s, float secs=0) { fState.fWaterTint.Set(s, secs); }
|
||||
void SetWaterRGB(const hsVector3& col, float secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetWaterOpacity()); SetWaterTint(rgb, secs); }
|
||||
void SetWaterOpacity(float s, float secs=0) { hsColorRGBA col = GetWaterTint(); col.a = s; SetWaterTint(col, secs); }
|
||||
void SetSpecularTint(const hsColorRGBA& s, float secs=0) { fState.fSpecularTint.Set(s, secs); }
|
||||
void SetSpecularRGB(const hsVector3& col, float secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetSpecularMute()); SetSpecularTint(rgb, secs); }
|
||||
void SetSpecularMute(float s, float secs=0) { hsColorRGBA col = GetSpecularTint(); col.a = s; SetSpecularTint(col, secs); }
|
||||
|
||||
// The environment map is essentially projected onto a sphere. Moving the center of
|
||||
// the sphere north will move the reflections north, changing the radius of the
|
||||
// sphere effects parallax in the obvious way.
|
||||
void SetEnvCenter(const hsPoint3& s, hsScalar secs=0) { fState.fEnvCenter.Set(s, secs); }
|
||||
void SetEnvRadius(hsScalar s, hsScalar secs=0) { fState.fEnvRadius.Set(s, secs); }
|
||||
void SetEnvCenter(const hsPoint3& s, float secs=0) { fState.fEnvCenter.Set(s, secs); }
|
||||
void SetEnvRadius(float s, float secs=0) { fState.fEnvRadius.Set(s, secs); }
|
||||
|
||||
// Now a way to get current values. See the accompanying Setter for notes on
|
||||
// what the parameter means.
|
||||
//
|
||||
hsScalar GetGeoMaxLength() const { return fState.fGeoState.fMaxLength; }
|
||||
hsScalar GetGeoMinLength() const { return fState.fGeoState.fMinLength; }
|
||||
hsScalar GetGeoAmpOverLen() const { return fState.fGeoState.fAmpOverLen; }
|
||||
hsScalar GetGeoChop() const { return fState.fGeoState.fChop; }
|
||||
hsScalar GetGeoAngleDev() const { return fState.fGeoState.fAngleDev; }
|
||||
float GetGeoMaxLength() const { return fState.fGeoState.fMaxLength; }
|
||||
float GetGeoMinLength() const { return fState.fGeoState.fMinLength; }
|
||||
float GetGeoAmpOverLen() const { return fState.fGeoState.fAmpOverLen; }
|
||||
float GetGeoChop() const { return fState.fGeoState.fChop; }
|
||||
float GetGeoAngleDev() const { return fState.fGeoState.fAngleDev; }
|
||||
|
||||
hsScalar GetTexMaxLength() const { return fState.fTexState.fMaxLength; }
|
||||
hsScalar GetTexMinLength() const { return fState.fTexState.fMinLength; }
|
||||
hsScalar GetTexAmpOverLen() const { return fState.fTexState.fAmpOverLen; }
|
||||
hsScalar GetTexChop() const { return fState.fTexState.fChop; }
|
||||
hsScalar GetTexAngleDev() const { return fState.fTexState.fAngleDev; }
|
||||
float GetTexMaxLength() const { return fState.fTexState.fMaxLength; }
|
||||
float GetTexMinLength() const { return fState.fTexState.fMinLength; }
|
||||
float GetTexAmpOverLen() const { return fState.fTexState.fAmpOverLen; }
|
||||
float GetTexChop() const { return fState.fTexState.fChop; }
|
||||
float GetTexAngleDev() const { return fState.fTexState.fAngleDev; }
|
||||
|
||||
hsScalar GetRippleScale() const { return fState.fRippleScale; }
|
||||
float GetRippleScale() const { return fState.fRippleScale; }
|
||||
|
||||
hsVector3 GetWindDir() const { return fState.fWindDir; }
|
||||
|
||||
hsScalar GetSpecularNoise() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kNoise]; }
|
||||
hsScalar GetSpecularStart() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecStart]; }
|
||||
hsScalar GetSpecularEnd() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecEnd]; }
|
||||
float GetSpecularNoise() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kNoise]; }
|
||||
float GetSpecularStart() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecStart]; }
|
||||
float GetSpecularEnd() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecEnd]; }
|
||||
|
||||
hsScalar GetWaterHeight() const { return fState.fWaterHeight; }
|
||||
float GetWaterHeight() const { return fState.fWaterHeight; }
|
||||
|
||||
hsVector3 GetWaterOffset() const { return fState.fWaterOffset; }
|
||||
hsScalar GetOpacOffset() const { hsVector3 off = fState.fWaterOffset; return off.fX; }
|
||||
hsScalar GetReflOffset() const { hsVector3 off = fState.fWaterOffset; return off.fY; }
|
||||
hsScalar GetWaveOffset() const { hsVector3 off = fState.fWaterOffset; return off.fZ; }
|
||||
float GetOpacOffset() const { hsVector3 off = fState.fWaterOffset; return off.fX; }
|
||||
float GetReflOffset() const { hsVector3 off = fState.fWaterOffset; return off.fY; }
|
||||
float GetWaveOffset() const { hsVector3 off = fState.fWaterOffset; return off.fZ; }
|
||||
hsVector3 GetDepthFalloff() const { return fState.fDepthFalloff; }
|
||||
hsScalar GetOpacFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fX; }
|
||||
hsScalar GetReflFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fY; }
|
||||
hsScalar GetWaveFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fZ; }
|
||||
float GetOpacFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fX; }
|
||||
float GetReflFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fY; }
|
||||
float GetWaveFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fZ; }
|
||||
|
||||
hsVector3 GetMaxAtten() const { return fState.fMaxAtten; }
|
||||
hsVector3 GetMinAtten() const { return fState.fMinAtten; }
|
||||
|
||||
hsColorRGBA GetWaterTint() const { return fState.fWaterTint; }
|
||||
hsVector3 GetWaterRGB() const { hsColorRGBA col = GetWaterTint(); return hsVector3(col.r, col.g, col.b); }
|
||||
hsScalar GetWaterOpacity() const { return GetWaterTint().a; }
|
||||
float GetWaterOpacity() const { return GetWaterTint().a; }
|
||||
hsColorRGBA GetSpecularTint() const { return fState.fSpecularTint; }
|
||||
hsVector3 GetSpecularRGB() const { hsColorRGBA col = GetSpecularTint(); return hsVector3(col.r, col.g, col.b); }
|
||||
hsScalar GetSpecularMute() const { return GetSpecularTint().a; }
|
||||
float GetSpecularMute() const { return GetSpecularTint().a; }
|
||||
|
||||
hsPoint3 GetEnvCenter() const { return fState.fEnvCenter; }
|
||||
hsScalar GetEnvRadius() const { return fState.fEnvRadius; }
|
||||
float GetEnvRadius() const { return fState.fEnvRadius; }
|
||||
|
||||
// Export/debugging functions. For runtime, use message interface (plGenRefMsg, plWaveMsg).
|
||||
void AddTarget(const plKey& key);
|
||||
@ -637,15 +637,15 @@ public:
|
||||
|
||||
virtual hsBool SetupRippleMat(hsGMaterial* mat, const plRipVSConsts& ripConsts);
|
||||
|
||||
virtual hsScalar GetHeight() const { return State().fWaterHeight; }
|
||||
virtual float GetHeight() const { return State().fWaterHeight; }
|
||||
|
||||
const plFixedWaterState7::WaveState& GeoState() const { return State().fGeoState; }
|
||||
const plFixedWaterState7::WaveState& TexState() const { return State().fTexState; }
|
||||
const plFixedWaterState7& State() const { return fState; }
|
||||
void SetState(const plFixedWaterState7& state, hsScalar dur);
|
||||
void SetState(const plFixedWaterState7& state, float dur);
|
||||
|
||||
void SetEnvSize(UInt32 s) { fEnvSize = s; }
|
||||
UInt32 GetEnvSize() const { return fEnvSize; }
|
||||
void SetEnvSize(uint32_t s) { fEnvSize = s; }
|
||||
uint32_t GetEnvSize() const { return fEnvSize; }
|
||||
|
||||
void StopLog();
|
||||
void StartLog();
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plWaveSetBase.h"
|
||||
|
||||
#include "hsResMgr.h"
|
||||
@ -56,11 +56,11 @@ plWaveSetBase::~plWaveSetBase()
|
||||
|
||||
void plWaveSetBase::AddShore(plKey key)
|
||||
{
|
||||
hsgResMgr::ResMgr()->SendRef(key, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, IShoreRef()), plRefFlags::kPassiveRef);
|
||||
hsgResMgr::ResMgr()->SendRef(key, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, IShoreRef()), plRefFlags::kPassiveRef);
|
||||
}
|
||||
|
||||
void plWaveSetBase::AddDecal(plKey key)
|
||||
{
|
||||
hsgResMgr::ResMgr()->SendRef(key, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, IDecalRef()), plRefFlags::kPassiveRef);
|
||||
hsgResMgr::ResMgr()->SendRef(key, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, IDecalRef()), plRefFlags::kPassiveRef);
|
||||
}
|
||||
|
||||
|
@ -61,12 +61,12 @@ public:
|
||||
CLASSNAME_REGISTER( plWaveSetBase );
|
||||
GETINTERFACE_ANY( plWaveSetBase, plMultiModifier );
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) { return false; }
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; }
|
||||
|
||||
Int32 GetNumProperties() const { return 0; }
|
||||
int32_t GetNumProperties() const { return 0; }
|
||||
|
||||
virtual hsBool SetupRippleMat(hsGMaterial* mat, const plRipVSConsts& ripConsts) = 0;
|
||||
virtual hsScalar GetHeight() const = 0;
|
||||
virtual float GetHeight() const = 0;
|
||||
virtual hsVector3 GetWindDir() const = 0;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user