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:
@ -62,14 +62,14 @@ protected:
|
||||
hsDynamicArray<plKey> fFogNodes;
|
||||
// hsGEnvironment::FogState fAvgFog;
|
||||
|
||||
virtual hsScalar IGetStrength(hsSceneNode* node) = 0;
|
||||
virtual float IGetStrength(hsSceneNode* node) = 0;
|
||||
|
||||
void IPopNodes();
|
||||
void IPushNodes();
|
||||
|
||||
void IZeroAvgFog();
|
||||
void IAverageNodes();
|
||||
// void IAccumFog(hsGEnvironment* env, hsScalar wgt);
|
||||
// void IAccumFog(hsGEnvironment* env, float wgt);
|
||||
|
||||
public:
|
||||
hsFogControl() {}
|
||||
@ -78,7 +78,7 @@ public:
|
||||
CLASSNAME_REGISTER( hsFogControl );
|
||||
GETINTERFACE_ANY( hsFogControl, plCreatable );
|
||||
|
||||
virtual UInt32 GetType() = 0;
|
||||
virtual uint32_t GetType() = 0;
|
||||
|
||||
// virtual hsGEnvironment* GetHomeEnv() = 0;
|
||||
virtual void Init(hsSceneNode* node);
|
||||
@ -120,21 +120,21 @@ protected:
|
||||
};
|
||||
|
||||
hsDynamicArray<plKey> fPortals;
|
||||
hsScalar fDefRadius;
|
||||
float fDefRadius;
|
||||
|
||||
UInt32 fStatus;
|
||||
uint32_t fStatus;
|
||||
|
||||
void IFindFogNodes();
|
||||
virtual hsScalar IGetStrength(hsSceneNode* node);
|
||||
virtual float IGetStrength(hsSceneNode* node);
|
||||
public:
|
||||
hsPortalFogControl();
|
||||
|
||||
void SetDefaultRadius(hsScalar r) { fDefRadius = r; }
|
||||
hsScalar GetDefaultRadius() { return fDefRadius; }
|
||||
void SetDefaultRadius(float r) { fDefRadius = r; }
|
||||
float GetDefaultRadius() { return fDefRadius; }
|
||||
|
||||
hsPortal* GetPortal(int i);
|
||||
|
||||
virtual UInt32 GetType() { return kFogCtlPortal; }
|
||||
virtual uint32_t GetType() { return kFogCtlPortal; }
|
||||
|
||||
virtual void Init(hsSceneNode* node);
|
||||
virtual void Blend();
|
||||
|
@ -42,15 +42,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
//#define DYNAHEADER_CREATE_STORAGE
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "hsWindows.h"
|
||||
|
||||
|
||||
#include "hsG3DDeviceSelector.h"
|
||||
#include "hsStream.h"
|
||||
#include "hsUtils.h"
|
||||
|
||||
#include "plPipeline.h"
|
||||
|
||||
#ifdef HS_OPEN_GL
|
||||
@ -113,7 +113,7 @@ void hsG3DDeviceMode::Read( hsStream* s )
|
||||
fDepth = s->ReadLE32();
|
||||
|
||||
fZStencilDepths.Reset();
|
||||
UInt8 count= s->ReadByte();
|
||||
uint8_t count= s->ReadByte();
|
||||
while( count-- )
|
||||
fZStencilDepths.Append( s->ReadLE16() );
|
||||
|
||||
@ -133,13 +133,13 @@ void hsG3DDeviceMode::Write( hsStream* s ) const
|
||||
s->WriteLE32(fHeight);
|
||||
s->WriteLE32(fDepth);
|
||||
|
||||
UInt8 i, count = (UInt8)fZStencilDepths.GetCount();
|
||||
uint8_t i, count = (uint8_t)fZStencilDepths.GetCount();
|
||||
s->WriteByte( count );
|
||||
for( i = 0; i < count; i++ )
|
||||
s->WriteLE16( fZStencilDepths[ i ] );
|
||||
|
||||
/// Version 9
|
||||
count = (UInt8)fFSAATypes.GetCount();
|
||||
count = (uint8_t)fFSAATypes.GetCount();
|
||||
s->WriteByte( count );
|
||||
for( i = 0; i < count; i++ )
|
||||
s->WriteByte( fFSAATypes[ i ] );
|
||||
@ -252,7 +252,7 @@ const char* hsG3DDeviceRecord::GetG3DDeviceTypeName() const
|
||||
"OpenGL"
|
||||
};
|
||||
|
||||
UInt32 devType = GetG3DDeviceType();
|
||||
uint32_t devType = GetG3DDeviceType();
|
||||
if( devType > hsG3DDeviceSelector::kNumDevTypes )
|
||||
devType = hsG3DDeviceSelector::kDevTypeUnknown;
|
||||
|
||||
@ -351,22 +351,22 @@ void hsG3DDeviceRecord::Read(hsStream* s)
|
||||
int len;
|
||||
|
||||
len = s->ReadLE32();
|
||||
fG3DDriverDesc = TRACKED_NEW char[len + 1];
|
||||
fG3DDriverDesc = new char[len + 1];
|
||||
s->Read(len, fG3DDriverDesc);
|
||||
fG3DDriverDesc[len] = 0;
|
||||
|
||||
len = s->ReadLE32();
|
||||
fG3DDriverName = TRACKED_NEW char[len + 1];
|
||||
fG3DDriverName = new char[len + 1];
|
||||
s->Read(len, fG3DDriverName);
|
||||
fG3DDriverName[len] = 0;
|
||||
|
||||
len = s->ReadLE32();
|
||||
fG3DDriverVersion = TRACKED_NEW char[len + 1];
|
||||
fG3DDriverVersion = new char[len + 1];
|
||||
s->Read(len, fG3DDriverVersion);
|
||||
fG3DDriverVersion[len] = 0;
|
||||
|
||||
len = s->ReadLE32();
|
||||
fG3DDeviceDesc = TRACKED_NEW char[len + 1];
|
||||
fG3DDeviceDesc = new char[len + 1];
|
||||
s->Read(len, fG3DDeviceDesc);
|
||||
fG3DDeviceDesc[len] = 0;
|
||||
|
||||
@ -570,7 +570,7 @@ void hsG3DDeviceSelector::RemoveUnusableDevModes(hsBool bTough)
|
||||
else if( fRecords[i].GetG3DDeviceType() == hsG3DDeviceSelector::kDevTypeDirect3D ||
|
||||
fRecords[i].GetG3DDeviceType() == hsG3DDeviceSelector::kDevTypeDirect3DTnL )
|
||||
{
|
||||
UInt32 totalMem;
|
||||
uint32_t totalMem;
|
||||
char devDesc[ 256 ];
|
||||
|
||||
|
||||
@ -631,7 +631,7 @@ void hsG3DDeviceSelector::RemoveUnusableDevModes(hsBool bTough)
|
||||
// Microsoft, the best way to do this is to add in the memory necessary for
|
||||
// the entire desktop. Okay, whatever...
|
||||
|
||||
UInt32 hsG3DDeviceSelector::IAdjustDirectXMemory( UInt32 cardMem )
|
||||
uint32_t hsG3DDeviceSelector::IAdjustDirectXMemory( uint32_t cardMem )
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
HDC deskDC;
|
||||
@ -677,7 +677,7 @@ void hsG3DDeviceSelector::Enumerate(hsWinRef winRef)
|
||||
tempClass.hInstance = GetModuleHandle( nil );
|
||||
tempClass.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
|
||||
tempClass.lpszClassName = fTempWinClass;
|
||||
UInt16 ret = RegisterClass(&tempClass);
|
||||
uint16_t ret = RegisterClass(&tempClass);
|
||||
hsAssert(ret, "Cannot create temporary window class to test for device modes" );
|
||||
#endif
|
||||
|
||||
@ -698,7 +698,7 @@ void hsG3DDeviceSelector::Enumerate(hsWinRef winRef)
|
||||
|
||||
hsBool hsG3DDeviceSelector::GetDefault (hsG3DDeviceModeRecord *dmr)
|
||||
{
|
||||
Int32 iTnL, iD3D, iOpenGL, device, mode, i;
|
||||
int32_t iTnL, iD3D, iOpenGL, device, mode, i;
|
||||
device = iTnL = iD3D = iOpenGL = mode = -1;
|
||||
|
||||
if (device == -1)
|
||||
@ -1117,7 +1117,7 @@ void hsG3DDeviceSelector::IGetExtOpenGLInfo( hsG3DDeviceRecord &devRec )
|
||||
} while( c2 >= extString && ( isdigit( *c2 ) || isspace( *c2 ) ) );
|
||||
c2++;
|
||||
|
||||
strncpy( str, c2, (UInt32)c - (UInt32)c2 );
|
||||
strncpy( str, c2, (uint32_t)c - (uint32_t)c2 );
|
||||
j = atoi( str );
|
||||
sprintf( str, "ITryOpenGL(): Device has %d MB texture memory\n", j );
|
||||
hsStatusMessage( str );
|
||||
@ -1169,7 +1169,7 @@ void hsG3DDeviceSelector::IGetExtOpenGLInfo( hsG3DDeviceRecord &devRec )
|
||||
#ifdef HS_OPEN_GL
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
|
||||
UInt32 hsG3DDeviceSelector::ICreateTempOpenGLContext( HDC hDC, hsBool32 makeItFull )
|
||||
uint32_t hsG3DDeviceSelector::ICreateTempOpenGLContext( HDC hDC, hsBool32 makeItFull )
|
||||
{
|
||||
DEVMODE modeInfo;
|
||||
int pixFmt;
|
||||
@ -1213,7 +1213,7 @@ UInt32 hsG3DDeviceSelector::ICreateTempOpenGLContext( HDC hDC, hsBool32 makeItF
|
||||
|
||||
pixFmt = ChoosePixelFormat( hDC, &pfd );
|
||||
if( pixFmt > 0 && SetPixelFormat( hDC, pixFmt, &pfd ) )
|
||||
return (UInt32)wglCreateContext( hDC );
|
||||
return (uint32_t)wglCreateContext( hDC );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1230,7 +1230,7 @@ namespace
|
||||
/// The table consists of entries for each of our supported chipsets in the table,
|
||||
/// plus, flags to be forced set and flags to be forced cleared. Also included
|
||||
/// is a Z-buffer suckiness rating, which represents how badly we need to bias
|
||||
/// the z and w values to avoid z-buffer artifacts, stored as an hsScalar (i.e
|
||||
/// the z and w values to avoid z-buffer artifacts, stored as an float (i.e
|
||||
/// a float). A rating of 0 means very good/default (read: Nvidia), while, say,
|
||||
/// a 9.0 (i.e. shift the scale 9 times above normal) means s****y, like, say,
|
||||
/// a Savage4. Also also included is a forced value for max # of layers (0 means
|
||||
@ -1281,13 +1281,13 @@ namespace
|
||||
|
||||
typedef struct
|
||||
{
|
||||
hsScalar fFogExpApproxStart;
|
||||
hsScalar fFogExp2ApproxStart;
|
||||
hsScalar fFogEndBias;
|
||||
hsScalar fFogExpKnee; // Fog knees
|
||||
hsScalar fFogExpKneeVal;
|
||||
hsScalar fFogExp2Knee;
|
||||
hsScalar fFogExp2KneeVal;
|
||||
float fFogExpApproxStart;
|
||||
float fFogExp2ApproxStart;
|
||||
float fFogEndBias;
|
||||
float fFogExpKnee; // Fog knees
|
||||
float fFogExpKneeVal;
|
||||
float fFogExp2Knee;
|
||||
float fFogExp2KneeVal;
|
||||
} FogTweakTable;
|
||||
|
||||
FogTweakTable dsDefaultFogVals = { 0, 0, 254.0 / 255.0, 0.5f, 0.15f, 0.5f, 0.15f };
|
||||
@ -1298,27 +1298,27 @@ namespace
|
||||
|
||||
|
||||
typedef struct {
|
||||
UInt8 fType; // Our chipset ID
|
||||
UInt32 *fFlagsToSet;
|
||||
UInt32 *fFlagsToClear;
|
||||
hsScalar fZSuckiness; // See above
|
||||
UInt32 fForceMaxLayers; // The max # of layers we REALLY want (0 to not force)
|
||||
hsScalar fLODRating;
|
||||
uint8_t fType; // Our chipset ID
|
||||
uint32_t *fFlagsToSet;
|
||||
uint32_t *fFlagsToClear;
|
||||
float fZSuckiness; // See above
|
||||
uint32_t fForceMaxLayers; // The max # of layers we REALLY want (0 to not force)
|
||||
float fLODRating;
|
||||
FogTweakTable *fFogTweaks;
|
||||
} CFTable;
|
||||
|
||||
UInt32 dsSavageCapsClr[] = {
|
||||
uint32_t dsSavageCapsClr[] = {
|
||||
4, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsCompressTextures,
|
||||
hsG3DDeviceSelector::kCapsFogExp,
|
||||
hsG3DDeviceSelector::kCapsFogExp2,
|
||||
hsG3DDeviceSelector::kCapsDoesSmallTextures };
|
||||
|
||||
UInt32 dsSavageCapsSet[] = {
|
||||
uint32_t dsSavageCapsSet[] = {
|
||||
1, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsBadYonStuff };
|
||||
|
||||
UInt32 dsSavage2kCapsClr[] = {
|
||||
uint32_t dsSavage2kCapsClr[] = {
|
||||
5, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsCompressTextures,
|
||||
hsG3DDeviceSelector::kCapsPixelFog,
|
||||
@ -1326,45 +1326,45 @@ namespace
|
||||
hsG3DDeviceSelector::kCapsFogExp2,
|
||||
hsG3DDeviceSelector::kCapsDoesSmallTextures };
|
||||
|
||||
UInt32 dsS3GenerCapsClr[] = {
|
||||
uint32_t dsS3GenerCapsClr[] = {
|
||||
4, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsCompressTextures,
|
||||
hsG3DDeviceSelector::kCapsFogExp,
|
||||
hsG3DDeviceSelector::kCapsFogExp2,
|
||||
hsG3DDeviceSelector::kCapsDoesSmallTextures };
|
||||
|
||||
UInt32 dsATIFuryCapsClr[] = {
|
||||
uint32_t dsATIFuryCapsClr[] = {
|
||||
3, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsFogExp,
|
||||
hsG3DDeviceSelector::kCapsFogExp2,
|
||||
hsG3DDeviceSelector::kCapsPixelFog };
|
||||
|
||||
UInt32 dsATIRageCapsClr[] = {
|
||||
uint32_t dsATIRageCapsClr[] = {
|
||||
4, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsFogExp,
|
||||
hsG3DDeviceSelector::kCapsFogExp2,
|
||||
hsG3DDeviceSelector::kCapsDoesSmallTextures,
|
||||
hsG3DDeviceSelector::kCapsPixelFog };
|
||||
|
||||
UInt32 dsATIGenerCapsClr[] = {
|
||||
uint32_t dsATIGenerCapsClr[] = {
|
||||
4, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsPixelFog,
|
||||
hsG3DDeviceSelector::kCapsFogExp,
|
||||
hsG3DDeviceSelector::kCapsFogExp2,
|
||||
hsG3DDeviceSelector::kCapsDoesSmallTextures };
|
||||
|
||||
UInt32 dsATIRadeonCapsSet[] = {
|
||||
uint32_t dsATIRadeonCapsSet[] = {
|
||||
2, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsBadManaged,
|
||||
hsG3DDeviceSelector::kCapsShareDepth
|
||||
};
|
||||
|
||||
UInt32 dsATIRadeonCapsClr[] = {
|
||||
uint32_t dsATIRadeonCapsClr[] = {
|
||||
2, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsWBuffer,
|
||||
hsG3DDeviceSelector::kCapsDoesSmallTextures };
|
||||
|
||||
UInt32 dsATIR7X00CapsSet[] = {
|
||||
uint32_t dsATIR7X00CapsSet[] = {
|
||||
4, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsCantShadow,
|
||||
hsG3DDeviceSelector::kCapsBadManaged,
|
||||
@ -1372,7 +1372,7 @@ namespace
|
||||
hsG3DDeviceSelector::kCapsNoAniso
|
||||
};
|
||||
|
||||
UInt32 dsATIR7500CapsSet[] = {
|
||||
uint32_t dsATIR7500CapsSet[] = {
|
||||
5, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsMaxUVWSrc2,
|
||||
hsG3DDeviceSelector::kCapsCantShadow,
|
||||
@ -1381,70 +1381,70 @@ namespace
|
||||
hsG3DDeviceSelector::kCapsNoAniso
|
||||
};
|
||||
|
||||
UInt32 dsATIR7X00CapsClr[] = {
|
||||
uint32_t dsATIR7X00CapsClr[] = {
|
||||
2, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsWBuffer,
|
||||
hsG3DDeviceSelector::kCapsDoesSmallTextures };
|
||||
|
||||
UInt32 dsATIR8X00CapsSet[] = {
|
||||
uint32_t dsATIR8X00CapsSet[] = {
|
||||
2, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsBadManaged,
|
||||
hsG3DDeviceSelector::kCapsShareDepth
|
||||
};
|
||||
|
||||
UInt32 dsATIR8X00CapsClr[] = {
|
||||
uint32_t dsATIR8X00CapsClr[] = {
|
||||
2, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsWBuffer,
|
||||
hsG3DDeviceSelector::kCapsDoesSmallTextures };
|
||||
|
||||
UInt32 dsTNTCapsClr[] = {
|
||||
uint32_t dsTNTCapsClr[] = {
|
||||
1, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsDoesSmallTextures };
|
||||
|
||||
UInt32 dsDefaultCapsClr[] = {
|
||||
uint32_t dsDefaultCapsClr[] = {
|
||||
1, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsDoesSmallTextures };
|
||||
|
||||
UInt32 dsMG400CapsClr[] = {
|
||||
uint32_t dsMG400CapsClr[] = {
|
||||
1, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsDoesSmallTextures };
|
||||
|
||||
UInt32 dsKYROCapsClr[] = {
|
||||
uint32_t dsKYROCapsClr[] = {
|
||||
2, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsDoesSmallTextures,
|
||||
hsG3DDeviceSelector::kCapsPixelFog };
|
||||
|
||||
UInt32 dsKYROCapsSet[] = {
|
||||
uint32_t dsKYROCapsSet[] = {
|
||||
1, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsNoKindaSmallTexs };
|
||||
|
||||
UInt32 ds3dfxV5CapsClr[] = {
|
||||
uint32_t ds3dfxV5CapsClr[] = {
|
||||
2, // First integer is always the length
|
||||
hsG3DDeviceSelector::kCapsFogExp,
|
||||
hsG3DDeviceSelector::kCapsFogExp2 };
|
||||
|
||||
UInt32 dsMatroxParheliaSet[] = {
|
||||
uint32_t dsMatroxParheliaSet[] = {
|
||||
1,
|
||||
hsG3DDeviceSelector::kCapsNoAA };
|
||||
|
||||
UInt32 dsGeForceSet[] = {
|
||||
uint32_t dsGeForceSet[] = {
|
||||
2,
|
||||
hsG3DDeviceSelector::kCapsCantProj,
|
||||
hsG3DDeviceSelector::kCapsDoubleFlush };
|
||||
|
||||
UInt32 dsGeForce2Set[] = {
|
||||
uint32_t dsGeForce2Set[] = {
|
||||
1,
|
||||
hsG3DDeviceSelector::kCapsDoubleFlush };
|
||||
|
||||
UInt32 dsGeForce3Set[] = {
|
||||
uint32_t dsGeForce3Set[] = {
|
||||
1,
|
||||
hsG3DDeviceSelector::kCapsSingleFlush };
|
||||
|
||||
UInt32 dsGeForce4MXSet[] = {
|
||||
uint32_t dsGeForce4MXSet[] = {
|
||||
1,
|
||||
hsG3DDeviceSelector::kCapsSingleFlush };
|
||||
|
||||
UInt32 dsGeForce4Set[] = {
|
||||
uint32_t dsGeForce4Set[] = {
|
||||
1,
|
||||
hsG3DDeviceSelector::kCapsSingleFlush
|
||||
};
|
||||
@ -1802,7 +1802,7 @@ void hsG3DDeviceSelector::IFudgeDirectXDevice( hsG3DDeviceRecord &record,
|
||||
// Given a chipset ID, looks the values up in the CFT and sets the appropriate
|
||||
// values.
|
||||
|
||||
void hsG3DDeviceSelector::ISetFudgeFactors( UInt8 chipsetID, hsG3DDeviceRecord &record )
|
||||
void hsG3DDeviceSelector::ISetFudgeFactors( uint8_t chipsetID, hsG3DDeviceRecord &record )
|
||||
{
|
||||
int i, maxIDs, j;
|
||||
|
||||
@ -1971,7 +1971,7 @@ void plDemoDebugFile::Write( char *string1, char *string2 )
|
||||
#endif
|
||||
}
|
||||
|
||||
void plDemoDebugFile::Write( char *string1, Int32 value )
|
||||
void plDemoDebugFile::Write( char *string1, int32_t value )
|
||||
{
|
||||
#if M3DDEMOINFO // Demo Debug Build
|
||||
if( !fIsOpen )
|
||||
|
@ -86,15 +86,15 @@ class hsG3DDeviceMode
|
||||
kDiscarded = 0x1
|
||||
};
|
||||
protected:
|
||||
UInt32 fFlags;
|
||||
uint32_t fFlags;
|
||||
|
||||
UInt32 fWidth;
|
||||
UInt32 fHeight;
|
||||
UInt32 fDepth;
|
||||
uint32_t fWidth;
|
||||
uint32_t fHeight;
|
||||
uint32_t fDepth;
|
||||
|
||||
hsTArray<UInt16> fZStencilDepths; // Array of supported depth/stencil buffer formats.
|
||||
hsTArray<uint16_t> fZStencilDepths; // Array of supported depth/stencil buffer formats.
|
||||
// Each entry is of the form: ( stencil bit count << 8 ) | ( depth bit count )
|
||||
hsTArray<UInt8> fFSAATypes; // Array of multisample types supported (each one 2-16)
|
||||
hsTArray<uint8_t> fFSAATypes; // Array of multisample types supported (each one 2-16)
|
||||
|
||||
hsBool fCanRenderToCubics;
|
||||
|
||||
@ -107,24 +107,24 @@ public:
|
||||
void Clear();
|
||||
|
||||
hsBool GetDiscarded() const { return 0 != (fFlags & kDiscarded); }
|
||||
UInt32 GetWidth() const { return fWidth; }
|
||||
UInt32 GetHeight() const { return fHeight; }
|
||||
UInt32 GetColorDepth() const { return fDepth; }
|
||||
UInt8 GetNumZStencilDepths( void ) const { return fZStencilDepths.GetCount(); }
|
||||
UInt16 GetZStencilDepth( UInt8 i ) const { return fZStencilDepths[ i ]; }
|
||||
UInt8 GetNumFSAATypes( void ) const { return fFSAATypes.GetCount(); }
|
||||
UInt8 GetFSAAType( UInt8 i ) const { return fFSAATypes[ i ]; }
|
||||
uint32_t GetWidth() const { return fWidth; }
|
||||
uint32_t GetHeight() const { return fHeight; }
|
||||
uint32_t GetColorDepth() const { return fDepth; }
|
||||
uint8_t GetNumZStencilDepths( void ) const { return fZStencilDepths.GetCount(); }
|
||||
uint16_t GetZStencilDepth( uint8_t i ) const { return fZStencilDepths[ i ]; }
|
||||
uint8_t GetNumFSAATypes( void ) const { return fFSAATypes.GetCount(); }
|
||||
uint8_t GetFSAAType( uint8_t i ) const { return fFSAATypes[ i ]; }
|
||||
hsBool GetCanRenderToCubics( void ) const { return fCanRenderToCubics; }
|
||||
|
||||
void SetDiscarded(hsBool on=true) { if(on) fFlags |= kDiscarded; else fFlags &= ~kDiscarded; }
|
||||
void SetWidth(UInt32 w) { fWidth = w; }
|
||||
void SetHeight(UInt32 h) { fHeight = h; }
|
||||
void SetColorDepth(UInt32 d) { fDepth = d; }
|
||||
void SetWidth(uint32_t w) { fWidth = w; }
|
||||
void SetHeight(uint32_t h) { fHeight = h; }
|
||||
void SetColorDepth(uint32_t d) { fDepth = d; }
|
||||
void ClearZStencilDepths( void ) { fZStencilDepths.Reset(); }
|
||||
void AddZStencilDepth( UInt16 depth ) { fZStencilDepths.Append( depth ); }
|
||||
void AddZStencilDepth( uint16_t depth ) { fZStencilDepths.Append( depth ); }
|
||||
|
||||
void ClearFSAATypes( void ) { fFSAATypes.Reset(); }
|
||||
void AddFSAAType( UInt8 type ) { fFSAATypes.Append( type ); }
|
||||
void AddFSAAType( uint8_t type ) { fFSAATypes.Append( type ); }
|
||||
|
||||
void SetCanRenderToCubics( hsBool can ) { fCanRenderToCubics = can; }
|
||||
|
||||
@ -149,7 +149,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
UInt32 fRecordVersion; /// Version starts at 2 (see .cpp for explanation)
|
||||
uint32_t fRecordVersion; /// Version starts at 2 (see .cpp for explanation)
|
||||
enum {
|
||||
kCurrRecordVersion = 0x0b
|
||||
/// Version history:
|
||||
@ -167,10 +167,10 @@ protected:
|
||||
};
|
||||
|
||||
/// Version < 2 Data
|
||||
UInt32 fFlags;
|
||||
uint32_t fFlags;
|
||||
|
||||
UInt32 fG3DDeviceType;
|
||||
UInt32 fG3DHALorHEL;
|
||||
uint32_t fG3DDeviceType;
|
||||
uint32_t fG3DHALorHEL;
|
||||
|
||||
|
||||
char* fG3DDriverDesc;
|
||||
@ -179,8 +179,8 @@ protected:
|
||||
char* fG3DDeviceDesc;
|
||||
|
||||
hsBitVector fCaps;
|
||||
UInt32 fLayersAtOnce;
|
||||
UInt32 fMemoryBytes;
|
||||
uint32_t fLayersAtOnce;
|
||||
uint32_t fMemoryBytes;
|
||||
|
||||
hsTArray<hsG3DDeviceMode> fModes;
|
||||
|
||||
@ -198,10 +198,10 @@ protected:
|
||||
float fFogKneeVals[ kNumFogTypes ];
|
||||
|
||||
/// Version 9 - The actual AA setting we use
|
||||
UInt8 fAASetting;
|
||||
uint8_t fAASetting;
|
||||
|
||||
/// Version A - the anisotropic level we use
|
||||
UInt8 fMaxAnisotropicSamples; // 1 to disable, up to max allowed in hardware
|
||||
uint8_t fMaxAnisotropicSamples; // 1 to disable, up to max allowed in hardware
|
||||
int fPixelShaderMajorVer;
|
||||
int fPixelShaderMinorVer;
|
||||
|
||||
@ -212,28 +212,28 @@ public:
|
||||
hsG3DDeviceRecord(const hsG3DDeviceRecord& src);
|
||||
hsG3DDeviceRecord& operator=(const hsG3DDeviceRecord& src);
|
||||
|
||||
UInt32 GetG3DDeviceType() const { return fG3DDeviceType; }
|
||||
uint32_t GetG3DDeviceType() const { return fG3DDeviceType; }
|
||||
const char* GetG3DDeviceTypeName() const;
|
||||
UInt32 GetG3DHALorHEL() const { return fG3DHALorHEL; }
|
||||
uint32_t GetG3DHALorHEL() const { return fG3DHALorHEL; }
|
||||
|
||||
UInt32 GetMemoryBytes() const { return fMemoryBytes; }
|
||||
uint32_t GetMemoryBytes() const { return fMemoryBytes; }
|
||||
|
||||
const char* GetDriverDesc() const { return fG3DDriverDesc; }
|
||||
const char* GetDriverName() const { return fG3DDriverName; }
|
||||
const char* GetDriverVersion() const { return fG3DDriverVersion; }
|
||||
const char* GetDeviceDesc() const { return fG3DDeviceDesc; }
|
||||
|
||||
void SetG3DDeviceType(UInt32 t) { fG3DDeviceType = t; }
|
||||
void SetG3DHALorHEL(UInt32 h) { fG3DHALorHEL = h; }
|
||||
void SetMemoryBytes(UInt32 b) { fMemoryBytes = b; }
|
||||
void SetG3DDeviceType(uint32_t t) { fG3DDeviceType = t; }
|
||||
void SetG3DHALorHEL(uint32_t h) { fG3DHALorHEL = h; }
|
||||
void SetMemoryBytes(uint32_t b) { fMemoryBytes = b; }
|
||||
|
||||
void SetDriverDesc(const char* s);
|
||||
void SetDriverName(const char* s);
|
||||
void SetDriverVersion(const char* s);
|
||||
void SetDeviceDesc(const char* s);
|
||||
|
||||
hsBool GetCap(UInt32 cap) const { return fCaps.IsBitSet(cap); }
|
||||
void SetCap(UInt32 cap, hsBool on=true) { fCaps.SetBit(cap, on); }
|
||||
hsBool GetCap(uint32_t cap) const { return fCaps.IsBitSet(cap); }
|
||||
void SetCap(uint32_t cap, hsBool on=true) { fCaps.SetBit(cap, on); }
|
||||
|
||||
float GetZBiasRating( void ) const { return fZBiasRating; }
|
||||
void SetZBiasRating( float rating ) { fZBiasRating = rating; }
|
||||
@ -249,17 +249,17 @@ public:
|
||||
float GetFogEndBias( void ) const { return fFogEndBias; }
|
||||
void SetFogEndBias( float rating ) { fFogEndBias = rating; }
|
||||
|
||||
void GetFogKneeParams( UInt8 type, float &knee, float &kneeVal ) const { knee = fFogKnees[ type ]; kneeVal = fFogKneeVals[ type ]; }
|
||||
void SetFogKneeParams( UInt8 type, float knee, float kneeVal ) { fFogKnees[ type ] = knee; fFogKneeVals[ type ] = kneeVal; }
|
||||
void GetFogKneeParams( uint8_t type, float &knee, float &kneeVal ) const { knee = fFogKnees[ type ]; kneeVal = fFogKneeVals[ type ]; }
|
||||
void SetFogKneeParams( uint8_t type, float knee, float kneeVal ) { fFogKnees[ type ] = knee; fFogKneeVals[ type ] = kneeVal; }
|
||||
|
||||
UInt32 GetLayersAtOnce() const { return fLayersAtOnce; }
|
||||
void SetLayersAtOnce(UInt32 n) { fLayersAtOnce = n; }
|
||||
uint32_t GetLayersAtOnce() const { return fLayersAtOnce; }
|
||||
void SetLayersAtOnce(uint32_t n) { fLayersAtOnce = n; }
|
||||
|
||||
UInt8 GetAASetting() const { return fAASetting; }
|
||||
void SetAASetting( UInt8 s ) { fAASetting = s; }
|
||||
uint8_t GetAASetting() const { return fAASetting; }
|
||||
void SetAASetting( uint8_t s ) { fAASetting = s; }
|
||||
|
||||
UInt8 GetMaxAnisotropicSamples( void ) const { return fMaxAnisotropicSamples; }
|
||||
void SetMaxAnisotropicSamples( UInt8 num ) { fMaxAnisotropicSamples = num; }
|
||||
uint8_t GetMaxAnisotropicSamples( void ) const { return fMaxAnisotropicSamples; }
|
||||
void SetMaxAnisotropicSamples( uint8_t num ) { fMaxAnisotropicSamples = num; }
|
||||
|
||||
void SetDiscarded(hsBool on=true) { if(on)fFlags |= kDiscarded; else fFlags &= ~kDiscarded; }
|
||||
hsBool GetDiscarded() const { return 0 != (fFlags & kDiscarded); }
|
||||
@ -393,7 +393,7 @@ protected:
|
||||
#endif // HS_SELECT_DX7
|
||||
void IFudgeDirectXDevice( hsG3DDeviceRecord &record,
|
||||
D3DEnum_DriverInfo *driverInfo, D3DEnum_DeviceInfo *deviceInfo );
|
||||
UInt32 IAdjustDirectXMemory( UInt32 cardMem );
|
||||
uint32_t IAdjustDirectXMemory( uint32_t cardMem );
|
||||
|
||||
hsBool IGetD3DCardInfo( hsG3DDeviceRecord &record, void *driverInfo, void *deviceInfo,
|
||||
DWORD *vendorID, DWORD *deviceID, char **driverString, char **descString );
|
||||
@ -409,11 +409,11 @@ protected:
|
||||
hsG3DDeviceRecord &devRec, char *driverName );
|
||||
#ifdef HS_OPEN_GL
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
UInt32 ICreateTempOpenGLContext( HDC hDC, hsBool makeItFull );
|
||||
uint32_t ICreateTempOpenGLContext( HDC hDC, hsBool makeItFull );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void ISetFudgeFactors( UInt8 chipsetID, hsG3DDeviceRecord &record );
|
||||
void ISetFudgeFactors( uint8_t chipsetID, hsG3DDeviceRecord &record );
|
||||
|
||||
public:
|
||||
hsG3DDeviceSelector();
|
||||
@ -463,7 +463,7 @@ class plDemoDebugFile
|
||||
static void Write( char *string1, char *string2 );
|
||||
|
||||
// Static function to write a string and a signed integer value to the DDF
|
||||
static void Write( char *string1, Int32 value );
|
||||
static void Write( char *string1, int32_t value );
|
||||
|
||||
// Enables or disables the DDF class
|
||||
static void Enable( hsBool yes ) { fEnabled = yes; }
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plPipeline.h"
|
||||
#include "hsGColorizer.h"
|
||||
|
||||
|
@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#ifndef hsGColorizer_inc
|
||||
#define hsGColorizer_inc
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "hsColorRGBA.h"
|
||||
|
||||
class plPipeline;
|
||||
|
@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include <ddraw.h>
|
||||
|
||||
|
@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#ifndef hsGDDrawDllLoad_inc
|
||||
#define hsGDDrawDllLoad_inc
|
||||
|
||||
#include "hsConfig.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
class hsGDDrawDllLoad
|
||||
|
@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
class hsGDeviceRef : public hsRefCnt
|
||||
{
|
||||
protected:
|
||||
UInt32 fFlags;
|
||||
uint32_t fFlags;
|
||||
|
||||
public:
|
||||
// Note, derived classes define more flags. Take care if adding flags here.
|
||||
@ -65,7 +65,7 @@ public:
|
||||
kDirty = 0x1
|
||||
};
|
||||
|
||||
UInt32 fUseTime; // time stamp when last used - stat gather only
|
||||
uint32_t fUseTime; // time stamp when last used - stat gather only
|
||||
|
||||
hsBool IsDirty() const { return (fFlags & kDirty); }
|
||||
void SetDirty(hsBool on) { if(on)fFlags |= kDirty; else fFlags &= ~kDirty; }
|
||||
|
@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
|
||||
#include "hsWindows.h"
|
||||
|
||||
typedef HWND hsWinRef;
|
||||
|
||||
#else // Whatever
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plCaptureRender.h"
|
||||
|
||||
#ifndef MF_FRONTBUFF_CAPTURE
|
||||
@ -128,14 +128,14 @@ void plCaptureRenderRequest::Render(plPipeline* pipe, plPageTreeMgr* pageMgr)
|
||||
hsTArray<plCaptureRenderMsg*> plCaptureRender::fProcessed;
|
||||
|
||||
// plCaptureRender::Capture
|
||||
hsBool plCaptureRender::Capture(const plKey& ack, UInt16 width, UInt16 height)
|
||||
hsBool plCaptureRender::Capture(const plKey& ack, uint16_t width, uint16_t height)
|
||||
{
|
||||
// Create our render target
|
||||
const UInt16 flags = plRenderTarget::kIsOffscreen;
|
||||
const UInt8 bitDepth(32);
|
||||
const UInt8 zDepth(-1);
|
||||
const UInt8 stencilDepth(-1);
|
||||
plRenderTarget* rt = TRACKED_NEW plRenderTarget(flags, width, height, bitDepth, zDepth, stencilDepth);
|
||||
const uint16_t flags = plRenderTarget::kIsOffscreen;
|
||||
const uint8_t bitDepth(32);
|
||||
const uint8_t zDepth(-1);
|
||||
const uint8_t stencilDepth(-1);
|
||||
plRenderTarget* rt = new plRenderTarget(flags, width, height, bitDepth, zDepth, stencilDepth);
|
||||
|
||||
static int idx=0;
|
||||
plString buff = plString::Format("tRT%d", idx++);
|
||||
@ -143,14 +143,14 @@ hsBool plCaptureRender::Capture(const plKey& ack, UInt16 width, UInt16 height)
|
||||
|
||||
|
||||
// Create a render request and render request message
|
||||
plCaptureRenderRequest* req = TRACKED_NEW plCaptureRenderRequest;
|
||||
plCaptureRenderRequest* req = new plCaptureRenderRequest;
|
||||
|
||||
const hsScalar pri(-100.f);
|
||||
const float pri(-100.f);
|
||||
req->SetPriority(pri);
|
||||
|
||||
req->SetRenderTarget(rt);
|
||||
|
||||
const UInt32 renderState
|
||||
const uint32_t renderState
|
||||
= plPipeline::kRenderNormal
|
||||
| plPipeline::kRenderClearColor
|
||||
| plPipeline::kRenderClearDepth;
|
||||
@ -160,7 +160,7 @@ hsBool plCaptureRender::Capture(const plKey& ack, UInt16 width, UInt16 height)
|
||||
req->RequestAck(ack);
|
||||
|
||||
// Submit
|
||||
plRenderRequestMsg* msg = TRACKED_NEW plRenderRequestMsg(ack, req);
|
||||
plRenderRequestMsg* msg = new plRenderRequestMsg(ack, req);
|
||||
hsRefCnt_SafeUnRef(req);
|
||||
msg->Send();
|
||||
|
||||
@ -186,7 +186,7 @@ hsBool plCaptureRender::IProcess(plPipeline* pipe, const plKey& ack, plRenderTar
|
||||
mipMap->Ref();
|
||||
|
||||
// Stash it, and send it off during the update phase.
|
||||
plCaptureRenderMsg* msg = TRACKED_NEW plCaptureRenderMsg(ack, mipMap);
|
||||
plCaptureRenderMsg* msg = new plCaptureRenderMsg(ack, mipMap);
|
||||
fProcessed.Append(msg);
|
||||
|
||||
return true;
|
||||
@ -213,18 +213,18 @@ void plCaptureRender::Update(plPipeline* pipe)
|
||||
|
||||
for( i = 0; i < fCapReqs.GetCount(); i++ )
|
||||
{
|
||||
plMipmap* mipmap = TRACKED_NEW plMipmap(fCapReqs[i].fWidth, fCapReqs[i].fHeight, plMipmap::kARGB32Config, 1);
|
||||
plMipmap* mipmap = new plMipmap(fCapReqs[i].fWidth, fCapReqs[i].fHeight, plMipmap::kARGB32Config, 1);
|
||||
|
||||
pipe->CaptureScreen(mipmap, false, fCapReqs[i].fWidth, fCapReqs[i].fHeight);
|
||||
|
||||
plCaptureRenderMsg* msg = TRACKED_NEW plCaptureRenderMsg(fCapReqs[i].fAck, mipmap);
|
||||
plCaptureRenderMsg* msg = new plCaptureRenderMsg(fCapReqs[i].fAck, mipmap);
|
||||
msg->Send();
|
||||
}
|
||||
|
||||
fCapReqs.Reset();
|
||||
}
|
||||
|
||||
hsBool plCaptureRender::Capture(const plKey& ack, UInt16 width, UInt16 height)
|
||||
hsBool plCaptureRender::Capture(const plKey& ack, uint16_t width, uint16_t height)
|
||||
{
|
||||
CapInfo capInfo;
|
||||
capInfo.fAck = ack;
|
||||
|
@ -71,7 +71,7 @@ protected:
|
||||
friend class plClient;
|
||||
public:
|
||||
|
||||
static hsBool Capture(const plKey& ack, UInt16 width=800, UInt16 height=600);
|
||||
static hsBool Capture(const plKey& ack, uint16_t width=800, uint16_t height=600);
|
||||
|
||||
};
|
||||
|
||||
@ -89,8 +89,8 @@ protected:
|
||||
{
|
||||
public:
|
||||
plKey fAck;
|
||||
UInt16 fWidth;
|
||||
UInt16 fHeight;
|
||||
uint16_t fWidth;
|
||||
uint16_t fHeight;
|
||||
};
|
||||
|
||||
static hsTArray<CapInfo> fCapReqs;
|
||||
@ -100,7 +100,7 @@ protected:
|
||||
friend class plClient;
|
||||
public:
|
||||
|
||||
static hsBool Capture(const plKey& ack, UInt16 width=800, UInt16 height=600);
|
||||
static hsBool Capture(const plKey& ack, uint16_t width=800, uint16_t height=600);
|
||||
|
||||
};
|
||||
|
||||
|
@ -95,7 +95,7 @@ class plCubicRenderTarget : public plRenderTarget
|
||||
fFaces[0] = fFaces[1] = fFaces[2] = fFaces[3] = fFaces[4] = fFaces[5] = nil;
|
||||
}
|
||||
|
||||
plCubicRenderTarget( UInt16 flags, UInt16 width, UInt16 height, UInt8 bitDepth, UInt8 zDepth = -1, UInt8 sDepth = -1 )
|
||||
plCubicRenderTarget( uint16_t flags, uint16_t width, uint16_t height, uint8_t bitDepth, uint8_t zDepth = -1, uint8_t sDepth = -1 )
|
||||
: plRenderTarget( flags, width, height, bitDepth, zDepth, sDepth )
|
||||
{
|
||||
int i;
|
||||
@ -103,7 +103,7 @@ class plCubicRenderTarget : public plRenderTarget
|
||||
|
||||
for( i = 0; i < 6; i++ )
|
||||
{
|
||||
fFaces[i] = TRACKED_NEW plRenderTarget( flags, width, height, bitDepth, zDepth, sDepth );
|
||||
fFaces[i] = new plRenderTarget( flags, width, height, bitDepth, zDepth, sDepth );
|
||||
fFaces[i]->fParent = this;
|
||||
fWorldToCameras[i].Reset();
|
||||
fCameraToWorlds[i].Reset();
|
||||
@ -120,16 +120,16 @@ class plCubicRenderTarget : public plRenderTarget
|
||||
}
|
||||
|
||||
// Get the total size in bytes
|
||||
virtual UInt32 GetTotalSize( void ) const;
|
||||
virtual uint32_t GetTotalSize( void ) const;
|
||||
|
||||
virtual void SetCameraMatrix(const hsPoint3& pos);
|
||||
virtual const hsMatrix44& GetWorldToCamera(UInt8 face) const { return fWorldToCameras[face]; }
|
||||
virtual const hsMatrix44& GetCameraToWorld(UInt8 face) const { return fCameraToWorlds[face]; }
|
||||
virtual const hsMatrix44& GetWorldToCamera(uint8_t face) const { return fWorldToCameras[face]; }
|
||||
virtual const hsMatrix44& GetCameraToWorld(uint8_t face) const { return fCameraToWorlds[face]; }
|
||||
|
||||
plRenderTarget *GetFace(UInt8 face) const { return fFaces[face]; }
|
||||
plRenderTarget *GetFace(uint8_t face) const { return fFaces[face]; }
|
||||
|
||||
virtual UInt32 Read(hsStream *s);
|
||||
virtual UInt32 Write(hsStream *s);
|
||||
virtual uint32_t Read(hsStream *s);
|
||||
virtual uint32_t Write(hsStream *s);
|
||||
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plCubicRenderTargetModifier.h"
|
||||
#include "plCubicRenderTarget.h"
|
||||
#include "plgDispatch.h"
|
||||
@ -97,9 +97,9 @@ void plCubicRenderTargetModifier::ICreateRenderRequest( int face )
|
||||
|
||||
|
||||
if( rr == nil )
|
||||
rr = fRequests[ face ] = TRACKED_NEW plRenderRequest;
|
||||
rr = fRequests[ face ] = new plRenderRequest;
|
||||
|
||||
UInt32 renderState
|
||||
uint32_t renderState
|
||||
= plPipeline::kRenderNormal
|
||||
| plPipeline::kRenderClearColor
|
||||
| plPipeline::kRenderClearDepth;
|
||||
@ -124,7 +124,7 @@ void plCubicRenderTargetModifier::ICreateRenderRequest( int face )
|
||||
|
||||
//// IEval ////////////////////////////////////////////////////////////////////
|
||||
|
||||
hsBool plCubicRenderTargetModifier::IEval( double secs, hsScalar del, UInt32 dirty )
|
||||
hsBool plCubicRenderTargetModifier::IEval( double secs, float del, uint32_t dirty )
|
||||
{
|
||||
hsPoint3 center;
|
||||
hsMatrix44 mtx, invMtx;
|
||||
@ -156,7 +156,7 @@ hsBool plCubicRenderTargetModifier::IEval( double secs, hsScalar del, UInt32 di
|
||||
{
|
||||
fRequests[ i ]->SetCameraTransform(fCubic->GetWorldToCamera(i), fCubic->GetCameraToWorld(i));
|
||||
|
||||
msg = TRACKED_NEW plRenderRequestMsg( nil, fRequests[ i ] );
|
||||
msg = new plRenderRequestMsg( nil, fRequests[ i ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
}
|
||||
@ -178,7 +178,7 @@ hsBool plCubicRenderTargetModifier::MsgReceive( plMessage* msg )
|
||||
if( eval )
|
||||
{
|
||||
const double secs = eval->DSeconds();
|
||||
const hsScalar del = eval->DelSeconds();
|
||||
const float del = eval->DelSeconds();
|
||||
IEval( secs, del, 0 );
|
||||
return true;
|
||||
}
|
||||
@ -241,10 +241,10 @@ void plCubicRenderTargetModifier::Read( hsStream *s, hsResMgr *mgr )
|
||||
hsKeyedObject::Read( s, mgr );
|
||||
|
||||
plGenRefMsg* msg;
|
||||
msg = TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, 0 ); // SceneObject
|
||||
msg = new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, 0 ); // SceneObject
|
||||
mgr->ReadKeyNotifyMe( s, msg, plRefFlags::kActiveRef );
|
||||
|
||||
msg = TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, 0 ); // cubicRT
|
||||
msg = new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, 0 ); // cubicRT
|
||||
mgr->ReadKeyNotifyMe( s, msg, plRefFlags::kActiveRef );
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ protected:
|
||||
|
||||
plRenderRequest *fRequests[ 6 ];
|
||||
|
||||
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // required by plModifier
|
||||
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // required by plModifier
|
||||
|
||||
void ICreateRenderRequest( int face );
|
||||
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plCullTree.h"
|
||||
#include "plDrawable/plSpaceTree.h"
|
||||
#include "hsFastMath.h"
|
||||
@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#define MF_DEBUG_NORM
|
||||
#ifdef MF_DEBUG_NORM
|
||||
|
||||
#define IDEBUG_NORMALIZE( a, b ) { hsScalar len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared()); a *= len; b *= len; }
|
||||
#define IDEBUG_NORMALIZE( a, b ) { float len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared()); a *= len; b *= len; }
|
||||
|
||||
#else // MF_DEBUG_NORM
|
||||
#define IDEBUG_NORMALIZE( a, b )
|
||||
@ -60,10 +60,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
//#define CULL_SMALL_TOLERANCE
|
||||
#ifdef CULL_SMALL_TOLERANCE
|
||||
//static const hsScalar kTolerance = 1.e-5f;
|
||||
static const hsScalar kTolerance = 1.e-3f;
|
||||
//static const float kTolerance = 1.e-5f;
|
||||
static const float kTolerance = 1.e-3f;
|
||||
#else //CULL_SMALL_TOLERANCE
|
||||
static const hsScalar kTolerance = 1.e-1f;
|
||||
static const float kTolerance = 1.e-1f;
|
||||
#endif // CULL_SMALL_TOLERANCE
|
||||
|
||||
plProfile_CreateCounter("Harvest Nodes", "Draw", HarvestNodes);
|
||||
@ -128,8 +128,8 @@ plCullNode::plCullStatus plCullNode::TestBounds(const hsBounds3Ext& bnd) const
|
||||
// side timings to be sure. Still looking for some reasonably constructed real data sets. mf
|
||||
#define MF_TEST_SPHERE_FIRST
|
||||
#ifdef MF_TEST_SPHERE_FIRST
|
||||
hsScalar dist = fNorm.InnerProduct(bnd.GetCenter()) + fDist;
|
||||
hsScalar rad = bnd.GetRadius();
|
||||
float dist = fNorm.InnerProduct(bnd.GetCenter()) + fDist;
|
||||
float rad = bnd.GetRadius();
|
||||
if( dist < -rad )
|
||||
return kCulled;
|
||||
if( dist > rad )
|
||||
@ -139,7 +139,7 @@ plCullNode::plCullStatus plCullNode::TestBounds(const hsBounds3Ext& bnd) const
|
||||
hsPoint2 depth;
|
||||
bnd.TestPlane(fNorm, depth);
|
||||
|
||||
const hsScalar kSafetyDist = -0.1f;
|
||||
const float kSafetyDist = -0.1f;
|
||||
if( depth.fY + fDist < kSafetyDist )
|
||||
return kCulled;
|
||||
|
||||
@ -149,7 +149,7 @@ plCullNode::plCullStatus plCullNode::TestBounds(const hsBounds3Ext& bnd) const
|
||||
return kSplit;
|
||||
}
|
||||
|
||||
plCullNode::plCullStatus plCullNode::ITestSphereRecur(const hsPoint3& center, hsScalar rad) const
|
||||
plCullNode::plCullStatus plCullNode::ITestSphereRecur(const hsPoint3& center, float rad) const
|
||||
{
|
||||
plCullNode::plCullStatus retVal = TestSphere(center, rad);
|
||||
|
||||
@ -198,9 +198,9 @@ plCullNode::plCullStatus plCullNode::ITestSphereRecur(const hsPoint3& center, hs
|
||||
return kCulled;
|
||||
}
|
||||
|
||||
plCullNode::plCullStatus plCullNode::TestSphere(const hsPoint3& center, hsScalar rad) const
|
||||
plCullNode::plCullStatus plCullNode::TestSphere(const hsPoint3& center, float rad) const
|
||||
{
|
||||
hsScalar dist = fNorm.InnerProduct(center) + fDist;
|
||||
float dist = fNorm.InnerProduct(center) + fDist;
|
||||
if( dist < -rad )
|
||||
return kCulled;
|
||||
if( dist > rad )
|
||||
@ -210,7 +210,7 @@ plCullNode::plCullStatus plCullNode::TestSphere(const hsPoint3& center, hsScalar
|
||||
}
|
||||
|
||||
// For this Cull Node, recur down the space hierarchy pruning out who to test for the next Cull Node.
|
||||
plCullNode::plCullStatus plCullNode::ITestNode(const plSpaceTree* space, Int16 who, hsLargeArray<Int16>& clear, hsLargeArray<Int16>& split, hsLargeArray<Int16>& culled) const
|
||||
plCullNode::plCullStatus plCullNode::ITestNode(const plSpaceTree* space, int16_t who, hsLargeArray<int16_t>& clear, hsLargeArray<int16_t>& split, hsLargeArray<int16_t>& culled) const
|
||||
{
|
||||
if( space->IsDisabled(who) || (space->GetNode(who).fWorldBounds.GetType() != kBoundsNormal) )
|
||||
{
|
||||
@ -263,21 +263,21 @@ plCullNode::plCullStatus plCullNode::ITestNode(const plSpaceTree* space, Int16 w
|
||||
// We reclaim the scratch indices in clear and split when we're done (SetCount(0)), but we can't
|
||||
// reclaim the culled, because our caller may be looking at who all we culled. See below in split.
|
||||
// If a node is disabled, we can just ignore we ever got called.
|
||||
void plCullNode::ITestNode(const plSpaceTree* space, Int16 who, hsBitVector& totList, hsBitVector& outList) const
|
||||
void plCullNode::ITestNode(const plSpaceTree* space, int16_t who, hsBitVector& totList, hsBitVector& outList) const
|
||||
{
|
||||
if( space->IsDisabled(who) )
|
||||
return;
|
||||
|
||||
UInt32 myClearStart = ScratchClear().GetCount();
|
||||
UInt32 mySplitStart = ScratchSplit().GetCount();
|
||||
UInt32 myCullStart = ScratchCulled().GetCount();
|
||||
uint32_t myClearStart = ScratchClear().GetCount();
|
||||
uint32_t mySplitStart = ScratchSplit().GetCount();
|
||||
uint32_t myCullStart = ScratchCulled().GetCount();
|
||||
|
||||
if( kPureSplit == ITestNode(space, who, ScratchClear(), ScratchSplit(), ScratchCulled()) )
|
||||
ScratchSplit().Append(who);
|
||||
|
||||
UInt32 myClearEnd = ScratchClear().GetCount();
|
||||
UInt32 mySplitEnd = ScratchSplit().GetCount();
|
||||
UInt32 myCullEnd = ScratchCulled().GetCount();
|
||||
uint32_t myClearEnd = ScratchClear().GetCount();
|
||||
uint32_t mySplitEnd = ScratchSplit().GetCount();
|
||||
uint32_t myCullEnd = ScratchCulled().GetCount();
|
||||
|
||||
int i;
|
||||
// If there's no OuterChild, everything in clear and split is visible. Everything in culled
|
||||
@ -368,7 +368,7 @@ void plCullNode::ITestNode(const plSpaceTree* space, Int16 who, hsBitVector& tot
|
||||
ScratchCulled().SetCount(myCullStart);
|
||||
}
|
||||
|
||||
void plCullNode::IHarvest(const plSpaceTree* space, hsTArray<Int16>& outList) const
|
||||
void plCullNode::IHarvest(const plSpaceTree* space, hsTArray<int16_t>& outList) const
|
||||
{
|
||||
ITestNode(space, space->GetRoot(), ScratchTotVec(), ScratchBitVec());
|
||||
space->BitVectorToList(outList, ScratchBitVec());
|
||||
@ -384,7 +384,7 @@ void plCullNode::IHarvest(const plSpaceTree* space, hsTArray<Int16>& outList) co
|
||||
// This section builds the tree from the input cullpoly's
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray<hsScalar>& depths,
|
||||
void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray<float>& depths,
|
||||
hsBitVector& inVerts,
|
||||
hsBitVector& outVerts,
|
||||
hsBitVector& onVerts,
|
||||
@ -415,7 +415,7 @@ void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray<hsScalar>& de
|
||||
if( outVerts.IsBitSet(outPoly.fVerts.GetCount()-1) )
|
||||
{
|
||||
hsPoint3 interp;
|
||||
hsScalar t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp);
|
||||
float t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp);
|
||||
// add interp
|
||||
onVerts.SetBit(outPoly.fVerts.GetCount());
|
||||
if( poly.fClipped.IsBitSet(i-1) )
|
||||
@ -429,7 +429,7 @@ void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray<hsScalar>& de
|
||||
if( inVerts.IsBitSet(outPoly.fVerts.GetCount()-1) )
|
||||
{
|
||||
hsPoint3 interp;
|
||||
hsScalar t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp);
|
||||
float t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp);
|
||||
// add interp
|
||||
onVerts.SetBit(outPoly.fVerts.GetCount());
|
||||
if( poly.fClipped.IsBitSet(i-1) )
|
||||
@ -451,7 +451,7 @@ void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray<hsScalar>& de
|
||||
||(outVerts.IsBitSet(outPoly.fVerts.GetCount()-1) && inVerts.IsBitSet(0)) )
|
||||
{
|
||||
hsPoint3 interp;
|
||||
hsScalar t = IInterpVert(poly.fVerts[poly.fVerts.GetCount()-1], poly.fVerts[0], interp);
|
||||
float t = IInterpVert(poly.fVerts[poly.fVerts.GetCount()-1], poly.fVerts[0], interp);
|
||||
onVerts.SetBit(outPoly.fVerts.GetCount());
|
||||
if( poly.fClipped.IsBitSet(poly.fVerts.GetCount()-1) )
|
||||
outPoly.fClipped.SetBit(outPoly.fVerts.GetCount());
|
||||
@ -477,7 +477,7 @@ void plCullNode::ITakeHalfPoly(const plCullPoly& srcPoly,
|
||||
if( onVerts.IsBitSet(vtxIdx[i]) && onVerts.IsBitSet(vtxIdx[last]) && onVerts.IsBitSet(vtxIdx[next]) )
|
||||
{
|
||||
#if 0 // FISH
|
||||
hsScalar dot = hsVector3(&srcPoly.fVerts[vtxIdx[last]], &srcPoly.fVerts[vtxIdx[i]]).InnerProduct(hsVector3(&srcPoly.fVerts[vtxIdx[next]], &srcPoly.fVerts[vtxIdx[i]]));
|
||||
float dot = hsVector3(&srcPoly.fVerts[vtxIdx[last]], &srcPoly.fVerts[vtxIdx[i]]).InnerProduct(hsVector3(&srcPoly.fVerts[vtxIdx[next]], &srcPoly.fVerts[vtxIdx[i]]));
|
||||
if( dot <= 0 )
|
||||
#endif // FISH
|
||||
continue;
|
||||
@ -512,7 +512,7 @@ plCullNode::plCullStatus plCullNode::ISplitPoly(const plCullPoly& poly,
|
||||
plCullPoly*& innerPoly,
|
||||
plCullPoly*& outerPoly) const
|
||||
{
|
||||
static hsTArray<hsScalar> depths;
|
||||
static hsTArray<float> depths;
|
||||
depths.SetCount(poly.fVerts.GetCount());
|
||||
|
||||
static hsBitVector onVerts;
|
||||
@ -597,12 +597,12 @@ plCullNode::plCullStatus plCullNode::ISplitPoly(const plCullPoly& poly,
|
||||
return kSplit;
|
||||
}
|
||||
|
||||
hsScalar plCullNode::IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const
|
||||
float plCullNode::IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const
|
||||
{
|
||||
hsVector3 oneToOh;
|
||||
oneToOh.Set(&p0, &p1);
|
||||
|
||||
hsScalar t = -(fNorm.InnerProduct(p1) + fDist) / fNorm.InnerProduct(oneToOh);
|
||||
float t = -(fNorm.InnerProduct(p1) + fDist) / fNorm.InnerProduct(oneToOh);
|
||||
if( t >= 1.f )
|
||||
{
|
||||
out = p0;
|
||||
@ -658,8 +658,8 @@ void plCullTree::AddPoly(const plCullPoly& poly)
|
||||
|
||||
hsVector3 cenToEye(&fViewPos, &poly.fCenter);
|
||||
hsFastMath::NormalizeAppr(cenToEye);
|
||||
hsScalar camDist = cenToEye.InnerProduct(poly.fNorm);
|
||||
plConst(hsScalar) kTol(0.1f);
|
||||
float camDist = cenToEye.InnerProduct(poly.fNorm);
|
||||
plConst(float) kTol(0.1f);
|
||||
hsBool backFace = camDist < -kTol;
|
||||
if( !backFace && (camDist < kTol) )
|
||||
return;
|
||||
@ -709,7 +709,7 @@ void plCullTree::AddPoly(const plCullPoly& poly)
|
||||
#endif // DEBUG_POINTERS
|
||||
}
|
||||
|
||||
Int16 plCullTree::IAddPolyRecur(const plCullPoly& poly, Int16 iNode)
|
||||
int16_t plCullTree::IAddPolyRecur(const plCullPoly& poly, int16_t iNode)
|
||||
{
|
||||
if( poly.fVerts.GetCount() < 3 )
|
||||
return iNode;
|
||||
@ -759,16 +759,16 @@ Int16 plCullTree::IAddPolyRecur(const plCullPoly& poly, Int16 iNode)
|
||||
return iNode;
|
||||
}
|
||||
|
||||
Int16 plCullTree::IMakePolyNode(const plCullPoly& poly, int i0, int i1) const
|
||||
int16_t plCullTree::IMakePolyNode(const plCullPoly& poly, int i0, int i1) const
|
||||
{
|
||||
Int16 retINode = fNodeList.GetCount();
|
||||
int16_t retINode = fNodeList.GetCount();
|
||||
plCullNode* nextNode = fNodeList.Push();
|
||||
hsVector3 a;
|
||||
hsVector3 b;
|
||||
a.Set(&poly.fVerts[i0], &fViewPos);
|
||||
b.Set(&poly.fVerts[i1], &fViewPos);
|
||||
hsVector3 n = a % b;
|
||||
hsScalar d = -n.InnerProduct(fViewPos);
|
||||
float d = -n.InnerProduct(fViewPos);
|
||||
|
||||
IDEBUG_NORMALIZE(n, d);
|
||||
|
||||
@ -777,21 +777,21 @@ Int16 plCullTree::IMakePolyNode(const plCullPoly& poly, int i0, int i1) const
|
||||
return retINode;
|
||||
}
|
||||
|
||||
Int16 plCullTree::IMakeHoleSubTree(const plCullPoly& poly) const
|
||||
int16_t plCullTree::IMakeHoleSubTree(const plCullPoly& poly) const
|
||||
{
|
||||
if( fCapturePolys )
|
||||
IVisPoly(poly, true);
|
||||
|
||||
int firstNode = fNodeList.GetCount();
|
||||
|
||||
Int16 iNode = -1;
|
||||
int16_t iNode = -1;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < poly.fVerts.GetCount()-1; i++ )
|
||||
{
|
||||
if( !poly.fClipped.IsBitSet(i) )
|
||||
{
|
||||
Int16 child = IMakePolyNode(poly, i, i+1);
|
||||
int16_t child = IMakePolyNode(poly, i, i+1);
|
||||
if( iNode >= 0 )
|
||||
IGetNode(iNode)->fOuterChild = child;
|
||||
iNode = child;
|
||||
@ -799,7 +799,7 @@ Int16 plCullTree::IMakeHoleSubTree(const plCullPoly& poly) const
|
||||
}
|
||||
if( !poly.fClipped.IsBitSet(i) )
|
||||
{
|
||||
Int16 child = IMakePolyNode(poly, i, 0);
|
||||
int16_t child = IMakePolyNode(poly, i, 0);
|
||||
if( iNode >= 0 )
|
||||
IGetNode(iNode)->fOuterChild = child;
|
||||
iNode = child;
|
||||
@ -813,7 +813,7 @@ Int16 plCullTree::IMakeHoleSubTree(const plCullPoly& poly) const
|
||||
return firstNode;
|
||||
}
|
||||
|
||||
Int16 plCullTree::IMakePolySubTree(const plCullPoly& poly) const
|
||||
int16_t plCullTree::IMakePolySubTree(const plCullPoly& poly) const
|
||||
{
|
||||
poly.Validate();
|
||||
|
||||
@ -825,14 +825,14 @@ Int16 plCullTree::IMakePolySubTree(const plCullPoly& poly) const
|
||||
|
||||
int firstNode = fNodeList.GetCount();
|
||||
|
||||
Int16 iNode = -1;
|
||||
int16_t iNode = -1;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < poly.fVerts.GetCount()-1; i++ )
|
||||
{
|
||||
if( !poly.fClipped.IsBitSet(i) )
|
||||
{
|
||||
Int16 child = IMakePolyNode(poly, i, i+1);
|
||||
int16_t child = IMakePolyNode(poly, i, i+1);
|
||||
if( iNode >= 0 )
|
||||
IGetNode(iNode)->fInnerChild = child;
|
||||
iNode = child;
|
||||
@ -840,7 +840,7 @@ Int16 plCullTree::IMakePolySubTree(const plCullPoly& poly) const
|
||||
}
|
||||
if( !poly.fClipped.IsBitSet(i) )
|
||||
{
|
||||
Int16 child = IMakePolyNode(poly, i, 0);
|
||||
int16_t child = IMakePolyNode(poly, i, 0);
|
||||
if( iNode >= 0 )
|
||||
IGetNode(iNode)->fInnerChild = child;
|
||||
iNode = child;
|
||||
@ -971,7 +971,7 @@ void plCullTree::ReleaseCapture() const
|
||||
// End visualization section of the program
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
void plCullTree::ISetupScratch(UInt16 nNodes)
|
||||
void plCullTree::ISetupScratch(uint16_t nNodes)
|
||||
{
|
||||
ScratchPolys().SetCount(nNodes << 1);
|
||||
ScratchPolys().SetCount(0);
|
||||
@ -996,11 +996,11 @@ void plCullTree::InitFrustum(const hsMatrix44& world2NDC)
|
||||
fNodeList.SetCount(6);
|
||||
fNodeList.SetCount(0);
|
||||
|
||||
Int16 lastIdx = -1;
|
||||
int16_t lastIdx = -1;
|
||||
|
||||
plCullNode* node;
|
||||
hsVector3 norm;
|
||||
hsScalar dist;
|
||||
float dist;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < 2; i++ )
|
||||
@ -1067,7 +1067,7 @@ void plCullTree::SetViewPos(const hsPoint3& p)
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Use the tree
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void plCullTree::Harvest(const plSpaceTree* space, hsTArray<Int16>& outList) const
|
||||
void plCullTree::Harvest(const plSpaceTree* space, hsTArray<int16_t>& outList) const
|
||||
{
|
||||
outList.SetCount(0);
|
||||
if (!space->IsEmpty())
|
||||
@ -1080,7 +1080,7 @@ hsBool plCullTree::BoundsVisible(const hsBounds3Ext& bnd) const
|
||||
return plCullNode::kCulled != IGetRoot()->ITestBoundsRecur(bnd);
|
||||
}
|
||||
|
||||
hsBool plCullTree::SphereVisible(const hsPoint3& center, hsScalar rad) const
|
||||
hsBool plCullTree::SphereVisible(const hsPoint3& center, float rad) const
|
||||
{
|
||||
return plCullNode::kCulled != IGetRoot()->ITestSphereRecur(center, rad);
|
||||
}
|
||||
|
@ -70,13 +70,13 @@ protected:
|
||||
mutable hsTArray<hsPoint3> fVisVerts;
|
||||
mutable hsTArray<hsVector3> fVisNorms;
|
||||
mutable hsTArray<hsColorRGBA> fVisColors;
|
||||
mutable hsTArray<UInt16> fVisTris;
|
||||
mutable hsScalar fVisYon;
|
||||
mutable hsTArray<uint16_t> fVisTris;
|
||||
mutable float fVisYon;
|
||||
|
||||
mutable hsTArray<plCullPoly> fScratchPolys;
|
||||
mutable hsLargeArray<Int16> fScratchClear;
|
||||
mutable hsLargeArray<Int16> fScratchSplit;
|
||||
mutable hsLargeArray<Int16> fScratchCulled;
|
||||
mutable hsLargeArray<int16_t> fScratchClear;
|
||||
mutable hsLargeArray<int16_t> fScratchSplit;
|
||||
mutable hsLargeArray<int16_t> fScratchCulled;
|
||||
mutable hsBitVector fScratchBitVec;
|
||||
mutable hsBitVector fScratchTotVec;
|
||||
|
||||
@ -87,28 +87,28 @@ protected:
|
||||
|
||||
hsPoint3 fViewPos;
|
||||
|
||||
Int16 fRoot;
|
||||
int16_t fRoot;
|
||||
mutable hsTArray<plCullNode> fNodeList; // Scratch list we make the tree from.
|
||||
plCullNode* IGetRoot() const { return IGetNode(fRoot); }
|
||||
plCullNode* IGetNode(Int16 i) const { return i >= 0 ? &fNodeList[i] : nil; }
|
||||
plCullNode* IGetNode(int16_t i) const { return i >= 0 ? &fNodeList[i] : nil; }
|
||||
|
||||
void ITestNode(const plSpaceTree* space, Int16 who, hsTArray<Int16>& outList) const; // Appends to outlist
|
||||
void ITestList(const plSpaceTree* space, const hsTArray<Int16>& inList, hsTArray<Int16>& outList) const;
|
||||
void ITestNode(const plSpaceTree* space, int16_t who, hsTArray<int16_t>& outList) const; // Appends to outlist
|
||||
void ITestList(const plSpaceTree* space, const hsTArray<int16_t>& inList, hsTArray<int16_t>& outList) const;
|
||||
|
||||
Int16 IAddPolyRecur(const plCullPoly& poly, Int16 iNode);
|
||||
Int16 IMakeHoleSubTree(const plCullPoly& poly) const;
|
||||
Int16 IMakePolySubTree(const plCullPoly& poly) const;
|
||||
Int16 IMakePolyNode(const plCullPoly& poly, int i0, int i1) const;
|
||||
int16_t IAddPolyRecur(const plCullPoly& poly, int16_t iNode);
|
||||
int16_t IMakeHoleSubTree(const plCullPoly& poly) const;
|
||||
int16_t IMakePolySubTree(const plCullPoly& poly) const;
|
||||
int16_t IMakePolyNode(const plCullPoly& poly, int i0, int i1) const;
|
||||
|
||||
// Some scratch areas for the nodes use when building the tree etc.
|
||||
hsTArray<plCullPoly>& ScratchPolys() const { return fScratchPolys; }
|
||||
hsLargeArray<Int16>& ScratchClear() const { return fScratchClear; }
|
||||
hsLargeArray<Int16>& ScratchSplit() const { return fScratchSplit; }
|
||||
hsLargeArray<Int16>& ScratchCulled() const { return fScratchCulled; }
|
||||
hsLargeArray<int16_t>& ScratchClear() const { return fScratchClear; }
|
||||
hsLargeArray<int16_t>& ScratchSplit() const { return fScratchSplit; }
|
||||
hsLargeArray<int16_t>& ScratchCulled() const { return fScratchCulled; }
|
||||
hsBitVector& ScratchBitVec() const { return fScratchBitVec; }
|
||||
hsBitVector& ScratchTotVec() const { return fScratchTotVec; }
|
||||
|
||||
void ISetupScratch(UInt16 nNodes);
|
||||
void ISetupScratch(uint16_t nNodes);
|
||||
|
||||
friend class plCullNode;
|
||||
|
||||
@ -121,20 +121,20 @@ public:
|
||||
void SetViewPos(const hsPoint3& pos);
|
||||
void AddPoly(const plCullPoly& poly);
|
||||
|
||||
UInt32 GetNumNodes() const { return fNodeList.GetCount(); }
|
||||
uint32_t GetNumNodes() const { return fNodeList.GetCount(); }
|
||||
|
||||
virtual void Harvest(const plSpaceTree* space, hsTArray<Int16>& outList) const;
|
||||
virtual void Harvest(const plSpaceTree* space, hsTArray<int16_t>& outList) const;
|
||||
virtual hsBool BoundsVisible(const hsBounds3Ext& bnd) const;
|
||||
virtual hsBool SphereVisible(const hsPoint3& center, hsScalar rad) const;
|
||||
virtual hsBool SphereVisible(const hsPoint3& center, float rad) const;
|
||||
|
||||
// Visualization stuff. Only to be called by the pipeline (or some other vis manager).
|
||||
void SetVisualizationYon(hsScalar y) const { fVisYon = y; }
|
||||
void SetVisualizationYon(float y) const { fVisYon = y; }
|
||||
void BeginCapturePolys() const { fCapturePolys = true; }
|
||||
void EndCapturePolys() const { fCapturePolys = false; }
|
||||
hsTArray<hsPoint3>& GetCaptureVerts() const { return fVisVerts; }
|
||||
hsTArray<hsVector3>& GetCaptureNorms() const { return fVisNorms; }
|
||||
hsTArray<hsColorRGBA>& GetCaptureColors() const { return fVisColors; }
|
||||
hsTArray<UInt16>& GetCaptureTris() const { return fVisTris; }
|
||||
hsTArray<uint16_t>& GetCaptureTris() const { return fVisTris; }
|
||||
void ReleaseCapture() const;
|
||||
};
|
||||
|
||||
@ -150,16 +150,16 @@ enum plCullStatus
|
||||
};
|
||||
protected:
|
||||
hsVector3 fNorm;
|
||||
hsScalar fDist;
|
||||
float fDist;
|
||||
|
||||
hsBool fIsFace;
|
||||
|
||||
Int16 fInnerChild;
|
||||
Int16 fOuterChild;
|
||||
int16_t fInnerChild;
|
||||
int16_t fOuterChild;
|
||||
|
||||
const plCullTree* fTree;
|
||||
|
||||
plCullNode* IGetNode(Int16 i) const;
|
||||
plCullNode* IGetNode(int16_t i) const;
|
||||
|
||||
#ifdef DEBUG_POINTERS
|
||||
mutable plCullNode* fInnerPtr;
|
||||
@ -172,50 +172,50 @@ protected:
|
||||
|
||||
// Bounds only version
|
||||
plCullNode::plCullStatus ITestBoundsRecur(const hsBounds3Ext& bnd) const;
|
||||
plCullNode::plCullStatus ITestSphereRecur(const hsPoint3& center, hsScalar rad) const;
|
||||
plCullNode::plCullStatus ITestSphereRecur(const hsPoint3& center, float rad) const;
|
||||
|
||||
// Using the nodes
|
||||
plCullNode::plCullStatus ITestNode(const plSpaceTree* space, Int16 who, hsLargeArray<Int16>& clear, hsLargeArray<Int16>& split, hsLargeArray<Int16>& culled) const;
|
||||
void ITestNode(const plSpaceTree* space, Int16 who, hsBitVector& totList, hsBitVector& outList) const;
|
||||
void IHarvest(const plSpaceTree* space, hsTArray<Int16>& outList) const;
|
||||
plCullNode::plCullStatus ITestNode(const plSpaceTree* space, int16_t who, hsLargeArray<int16_t>& clear, hsLargeArray<int16_t>& split, hsLargeArray<int16_t>& culled) const;
|
||||
void ITestNode(const plSpaceTree* space, int16_t who, hsBitVector& totList, hsBitVector& outList) const;
|
||||
void IHarvest(const plSpaceTree* space, hsTArray<int16_t>& outList) const;
|
||||
|
||||
// Constructing the tree
|
||||
hsScalar IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const;
|
||||
float IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const;
|
||||
plCullNode::plCullStatus ISplitPoly(const plCullPoly& poly, plCullPoly*& innerPoly, plCullPoly*& outerPoly) const;
|
||||
void IMarkClipped(const plCullPoly& poly, const hsBitVector& onVerts) const;
|
||||
void ITakeHalfPoly(const plCullPoly& scrPoly,
|
||||
const hsTArray<int>& vtxIdx,
|
||||
const hsBitVector& onVerts,
|
||||
plCullPoly& outPoly) const;
|
||||
void IBreakPoly(const plCullPoly& poly, const hsTArray<hsScalar>& depths,
|
||||
void IBreakPoly(const plCullPoly& poly, const hsTArray<float>& depths,
|
||||
hsBitVector& inVerts,
|
||||
hsBitVector& outVerts,
|
||||
hsBitVector& onVerts,
|
||||
plCullPoly& srcPoly) const;
|
||||
|
||||
hsTArray<plCullPoly>& ScratchPolys() const { return fTree->ScratchPolys(); }
|
||||
hsLargeArray<Int16>& ScratchClear() const { return fTree->ScratchClear(); }
|
||||
hsLargeArray<Int16>& ScratchSplit() const { return fTree->ScratchSplit(); }
|
||||
hsLargeArray<Int16>& ScratchCulled() const { return fTree->ScratchCulled(); }
|
||||
hsLargeArray<int16_t>& ScratchClear() const { return fTree->ScratchClear(); }
|
||||
hsLargeArray<int16_t>& ScratchSplit() const { return fTree->ScratchSplit(); }
|
||||
hsLargeArray<int16_t>& ScratchCulled() const { return fTree->ScratchCulled(); }
|
||||
hsBitVector& ScratchBitVec() const { return fTree->ScratchBitVec(); }
|
||||
hsBitVector& ScratchTotVec() const { return fTree->ScratchTotVec(); }
|
||||
|
||||
friend class plCullTree;
|
||||
public:
|
||||
|
||||
void Init(const plCullTree* t, const hsVector3& n, hsScalar d) { fIsFace = false; fTree = t; fInnerChild = fOuterChild = -1; SetPlane(n, d); }
|
||||
void Init(const plCullTree* t, const hsVector3& n, float d) { fIsFace = false; fTree = t; fInnerChild = fOuterChild = -1; SetPlane(n, d); }
|
||||
void Init(const plCullTree* t, const plCullPoly& poly) { Init(t, poly.fNorm, poly.fDist); }
|
||||
|
||||
void SetPlane(const hsVector3& n, hsScalar d) { fNorm = n; fDist = d; }
|
||||
void SetPlane(const hsVector3& n, float d) { fNorm = n; fDist = d; }
|
||||
|
||||
const hsVector3& GetNormal() const { return fNorm; }
|
||||
const hsScalar GetDist() const { return fDist; }
|
||||
const float GetDist() const { return fDist; }
|
||||
|
||||
plCullStatus TestBounds(const hsBounds3Ext& bnd) const;
|
||||
plCullStatus TestSphere(const hsPoint3& center, hsScalar rad) const;
|
||||
plCullStatus TestSphere(const hsPoint3& center, float rad) const;
|
||||
};
|
||||
|
||||
inline plCullNode* plCullNode::IGetNode(Int16 i) const
|
||||
inline plCullNode* plCullNode::IGetNode(int16_t i) const
|
||||
{
|
||||
return fTree->IGetNode(i);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
plCuller() {}
|
||||
~plCuller() {}
|
||||
|
||||
virtual void Harvest(const plSpaceTree* space, hsTArray<Int16>& outList) const = 0;
|
||||
virtual void Harvest(const plSpaceTree* space, hsTArray<int16_t>& outList) const = 0;
|
||||
};
|
||||
|
||||
#endif // plCuller_inc
|
||||
|
@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDTProgressMgr.h"
|
||||
#include "plPipeline.h"
|
||||
#include "plDebugText.h"
|
||||
@ -124,7 +124,7 @@ void plDTProgressMgr::Deactivate()
|
||||
|
||||
void plDTProgressMgr::Draw( plPipeline *p )
|
||||
{
|
||||
UInt16 scrnWidth, scrnHeight, width, height, x, y;
|
||||
uint16_t scrnWidth, scrnHeight, width, height, x, y;
|
||||
plDebugText &text = plDebugText::Instance();
|
||||
|
||||
plOperationProgress *prog;
|
||||
@ -133,8 +133,8 @@ void plDTProgressMgr::Draw( plPipeline *p )
|
||||
if( fOperations == nil )
|
||||
return;
|
||||
|
||||
scrnWidth = (UInt16)p->Width();
|
||||
scrnHeight = (UInt16)p->Height();
|
||||
scrnWidth = (uint16_t)p->Width();
|
||||
scrnHeight = (uint16_t)p->Height();
|
||||
|
||||
width = scrnWidth - 64;
|
||||
height = 16;
|
||||
@ -177,12 +177,12 @@ void plDTProgressMgr::Draw( plPipeline *p )
|
||||
//// IDrawTheStupidThing /////////////////////////////////////////////////////
|
||||
|
||||
void plDTProgressMgr::IDrawTheStupidThing( plPipeline *p, plOperationProgress *prog,
|
||||
UInt16 x, UInt16 y, UInt16 width, UInt16 height )
|
||||
uint16_t x, uint16_t y, uint16_t width, uint16_t height )
|
||||
{
|
||||
plDebugText &text = plDebugText::Instance();
|
||||
|
||||
// Lets just set the color to blue
|
||||
UInt32 color = 0xff302b3a;
|
||||
uint32_t color = 0xff302b3a;
|
||||
|
||||
if( prog->GetMax() > 0.f )
|
||||
{
|
||||
@ -193,12 +193,12 @@ void plDTProgressMgr::IDrawTheStupidThing( plPipeline *p, plOperationProgress
|
||||
width -= 4;
|
||||
height -= 4;
|
||||
|
||||
UInt16 drawWidth = width;
|
||||
Int16 drawX = x;
|
||||
UInt16 rightX = drawX + drawWidth;
|
||||
uint16_t drawWidth = width;
|
||||
int16_t drawX = x;
|
||||
uint16_t rightX = drawX + drawWidth;
|
||||
|
||||
if (prog->GetProgress() <= prog->GetMax())
|
||||
drawWidth = (UInt16)( (hsScalar)width * prog->GetProgress() / prog->GetMax() );
|
||||
drawWidth = (uint16_t)( (float)width * prog->GetProgress() / prog->GetMax() );
|
||||
|
||||
rightX = drawX + drawWidth;
|
||||
|
||||
@ -223,7 +223,7 @@ void plDTProgressMgr::IDrawTheStupidThing( plPipeline *p, plOperationProgress
|
||||
const char* unitTerm = (timeRemain == 1) ? "SECOND" : "SECONDS";
|
||||
sprintf(remainStr, "%s%d %s REMAINING", remainStr, timeRemain, unitTerm);
|
||||
|
||||
text.DrawString(x, y + height + 2, remainStr, (UInt32)0xff635e6d );
|
||||
text.DrawString(x, y + height + 2, remainStr, (uint32_t)0xff635e6d );
|
||||
|
||||
x -= 2;
|
||||
y -= 2;
|
||||
@ -241,12 +241,12 @@ void plDTProgressMgr::IDrawTheStupidThing( plPipeline *p, plOperationProgress
|
||||
{
|
||||
if( prog->GetTitle()[ 0 ] != 0 )
|
||||
{
|
||||
text.DrawString( x, y, prog->GetTitle(), (UInt32)0xccb0b0b0 );
|
||||
x += (UInt16)text.CalcStringWidth( prog->GetTitle() );
|
||||
text.DrawString( x, y, prog->GetTitle(), (uint32_t)0xccb0b0b0 );
|
||||
x += (uint16_t)text.CalcStringWidth( prog->GetTitle() );
|
||||
}
|
||||
|
||||
if( prog->GetStatusText()[ 0 ] != 0 )
|
||||
text.DrawString( x, y, prog->GetStatusText(), (UInt32)0xccb0b0b0 );
|
||||
text.DrawString( x, y, prog->GetStatusText(), (uint32_t)0xccb0b0b0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ class plPipeline;
|
||||
class plDTProgressMgr : public plProgressMgr
|
||||
{
|
||||
protected:
|
||||
Int32 fCurrentImage;
|
||||
int32_t fCurrentImage;
|
||||
float fLastDraw;
|
||||
plPlate* fActivePlate;
|
||||
plPlate* fStaticTextPlate;
|
||||
@ -71,7 +71,7 @@ class plDTProgressMgr : public plProgressMgr
|
||||
void Deactivate();
|
||||
|
||||
void IDrawTheStupidThing( plPipeline *p, plOperationProgress *prog,
|
||||
UInt16 x, UInt16 y, UInt16 width, UInt16 height );
|
||||
uint16_t x, uint16_t y, uint16_t width, uint16_t height );
|
||||
|
||||
public:
|
||||
|
||||
|
@ -67,17 +67,17 @@ class plDXVertexBufferRef : public plDXDeviceRef
|
||||
{
|
||||
public:
|
||||
IDirect3DVertexBuffer9* fD3DBuffer;
|
||||
UInt32 fCount;
|
||||
UInt32 fIndex;
|
||||
UInt32 fVertexSize;
|
||||
Int32 fOffset;
|
||||
UInt8 fFormat;
|
||||
uint32_t fCount;
|
||||
uint32_t fIndex;
|
||||
uint32_t fVertexSize;
|
||||
int32_t fOffset;
|
||||
uint8_t fFormat;
|
||||
|
||||
plGBufferGroup* fOwner;
|
||||
UInt8* fData;
|
||||
uint8_t* fData;
|
||||
IDirect3DDevice9* fDevice; // For releasing the VertexShader
|
||||
|
||||
UInt32 fRefTime;
|
||||
uint32_t fRefTime;
|
||||
|
||||
enum {
|
||||
kRebuiltSinceUsed = 0x10, // kDirty = 0x1 is in hsGDeviceRef
|
||||
@ -85,8 +85,8 @@ class plDXVertexBufferRef : public plDXDeviceRef
|
||||
kSkinned = 0x40
|
||||
};
|
||||
|
||||
hsBool HasFlag(UInt32 f) const { return 0 != (fFlags & f); }
|
||||
void SetFlag(UInt32 f, hsBool on) { if(on) fFlags |= f; else fFlags &= ~f; }
|
||||
hsBool HasFlag(uint32_t f) const { return 0 != (fFlags & f); }
|
||||
void SetFlag(uint32_t f, hsBool on) { if(on) fFlags |= f; else fFlags &= ~f; }
|
||||
|
||||
hsBool RebuiltSinceUsed() const { return HasFlag(kRebuiltSinceUsed); }
|
||||
void SetRebuiltSinceUsed(hsBool b) { SetFlag(kRebuiltSinceUsed, b); }
|
||||
@ -97,8 +97,8 @@ class plDXVertexBufferRef : public plDXDeviceRef
|
||||
hsBool Skinned() const { return HasFlag(kSkinned); }
|
||||
void SetSkinned(hsBool b) { SetFlag(kSkinned, b); }
|
||||
|
||||
hsBool Expired(UInt32 t) const { return Volatile() && (IsDirty() || (fRefTime != t)); }
|
||||
void SetRefTime(UInt32 t) { fRefTime = t; }
|
||||
hsBool Expired(uint32_t t) const { return Volatile() && (IsDirty() || (fRefTime != t)); }
|
||||
void SetRefTime(uint32_t t) { fRefTime = t; }
|
||||
|
||||
void Link( plDXVertexBufferRef **back ) { plDXDeviceRef::Link( (plDXDeviceRef **)back ); }
|
||||
plDXVertexBufferRef* GetNext() { return (plDXVertexBufferRef *)fNext; }
|
||||
@ -125,11 +125,11 @@ class plDXIndexBufferRef : public plDXDeviceRef
|
||||
{
|
||||
public:
|
||||
IDirect3DIndexBuffer9* fD3DBuffer;
|
||||
UInt32 fCount;
|
||||
UInt32 fIndex;
|
||||
Int32 fOffset;
|
||||
uint32_t fCount;
|
||||
uint32_t fIndex;
|
||||
int32_t fOffset;
|
||||
plGBufferGroup* fOwner;
|
||||
UInt32 fRefTime;
|
||||
uint32_t fRefTime;
|
||||
D3DPOOL fPoolType;
|
||||
|
||||
enum {
|
||||
@ -137,8 +137,8 @@ class plDXIndexBufferRef : public plDXDeviceRef
|
||||
kVolatile = 0x20
|
||||
};
|
||||
|
||||
hsBool HasFlag(UInt32 f) const { return 0 != (fFlags & f); }
|
||||
void SetFlag(UInt32 f, hsBool on) { if(on) fFlags |= f; else fFlags &= ~f; }
|
||||
hsBool HasFlag(uint32_t f) const { return 0 != (fFlags & f); }
|
||||
void SetFlag(uint32_t f, hsBool on) { if(on) fFlags |= f; else fFlags &= ~f; }
|
||||
|
||||
hsBool RebuiltSinceUsed() const { return HasFlag(kRebuiltSinceUsed); }
|
||||
void SetRebuiltSinceUsed(hsBool b) { SetFlag(kRebuiltSinceUsed, b); }
|
||||
@ -146,8 +146,8 @@ class plDXIndexBufferRef : public plDXDeviceRef
|
||||
hsBool Volatile() const { return HasFlag(kVolatile); }
|
||||
void SetVolatile(hsBool b) { SetFlag(kVolatile, b); }
|
||||
|
||||
hsBool Expired(UInt32 t) const { return Volatile() && (IsDirty() || (fRefTime != t)); }
|
||||
void SetRefTime(UInt32 t) { fRefTime = t; }
|
||||
hsBool Expired(uint32_t t) const { return Volatile() && (IsDirty() || (fRefTime != t)); }
|
||||
void SetRefTime(uint32_t t) { fRefTime = t; }
|
||||
|
||||
void Link( plDXIndexBufferRef **back ) { plDXDeviceRef::Link( (plDXDeviceRef **)back ); }
|
||||
plDXIndexBufferRef* GetNext() { return (plDXIndexBufferRef *)fNext; }
|
||||
|
@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#ifndef _plDXDeviceRef_h
|
||||
#define _plDXDeviceRef_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "hsGDeviceRef.h"
|
||||
|
||||
|
||||
|
@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include <d3d9.h>
|
||||
#include <ddraw.h>
|
||||
@ -157,8 +157,8 @@ void plDXIndexBufferRef::Release( void )
|
||||
{
|
||||
if( fD3DBuffer != nil )
|
||||
{
|
||||
plProfile_DelMem(MemIndex, fCount * sizeof(UInt16));
|
||||
PROFILE_POOL_MEM(fPoolType, fCount * sizeof(UInt16), false, "IndexBuff");
|
||||
plProfile_DelMem(MemIndex, fCount * sizeof(uint16_t));
|
||||
PROFILE_POOL_MEM(fPoolType, fCount * sizeof(uint16_t), false, "IndexBuff");
|
||||
ReleaseObject( fD3DBuffer );
|
||||
}
|
||||
|
||||
@ -171,8 +171,8 @@ void plDXIndexBufferRef::Release( void )
|
||||
|
||||
//// Set //////////////////////////////////////////////////////////////////////
|
||||
|
||||
plDXTextureRef& plDXTextureRef::Set( D3DFORMAT ft, UInt32 ml, UInt32 mw, UInt32 mh, UInt32 np,
|
||||
UInt32 sz, UInt32 manSize, UInt32* lSz, void* pd, hsBool ed, hsBool renderTarget )
|
||||
plDXTextureRef& plDXTextureRef::Set( D3DFORMAT ft, uint32_t ml, uint32_t mw, uint32_t mh, uint32_t np,
|
||||
uint32_t sz, uint32_t manSize, uint32_t* lSz, void* pd, hsBool ed, hsBool renderTarget )
|
||||
{
|
||||
if( fDataSize > 0 )
|
||||
plProfile_DelMem(MemTexture, fDataSize + sizeof(plDXTextureRef));
|
||||
@ -194,7 +194,7 @@ plDXTextureRef& plDXTextureRef::Set( D3DFORMAT ft, UInt32 ml, UInt32 mw, UInt32
|
||||
fLevelSizes = lSz;
|
||||
else
|
||||
{
|
||||
fLevelSizes = TRACKED_NEW UInt32[1];
|
||||
fLevelSizes = new uint32_t[1];
|
||||
fLevelSizes[0] = sz;
|
||||
}
|
||||
fData = pd;
|
||||
@ -207,8 +207,8 @@ plDXTextureRef& plDXTextureRef::Set( D3DFORMAT ft, UInt32 ml, UInt32 mw, UInt32
|
||||
|
||||
//// Constructor & Destructor /////////////////////////////////////////////////
|
||||
|
||||
plDXTextureRef::plDXTextureRef( D3DFORMAT ft, UInt32 ml, UInt32 mw, UInt32 mh, UInt32 np,
|
||||
UInt32 sz, UInt32 manSize, UInt32* lSz, void* pd, hsBool ed, hsBool renderTarget )
|
||||
plDXTextureRef::plDXTextureRef( D3DFORMAT ft, uint32_t ml, uint32_t mw, uint32_t mh, uint32_t np,
|
||||
uint32_t sz, uint32_t manSize, uint32_t* lSz, void* pd, hsBool ed, hsBool renderTarget )
|
||||
{
|
||||
fLevelSizes = nil;
|
||||
fOwner = nil;
|
||||
@ -303,7 +303,7 @@ void plDXLightRef::UpdateD3DInfo( IDirect3DDevice9 *dev, plDXLightSettings *s
|
||||
|
||||
fD3DInfo.Falloff = spotOwner->GetFalloff();
|
||||
fD3DInfo.Theta = spotOwner->GetSpotInner() * 2;
|
||||
// fD3DInfo.Phi = spotOwner->GetProjection() ? hsScalarPI : spotOwner->GetSpotOuter() * 2;
|
||||
// fD3DInfo.Phi = spotOwner->GetProjection() ? M_PI : spotOwner->GetSpotOuter() * 2;
|
||||
// D3D doesn't seem to like a Phi of PI, even though that's supposed to be the
|
||||
// largest legal value. Symptom is an erratic, intermitant, unpredictable failure
|
||||
// of the light to light, with bizarreness like lighting one object but not the object
|
||||
@ -367,7 +367,7 @@ void plDXLightRef::Release( void )
|
||||
|
||||
//// Constructor //////////////////////////////////////////////////////////////
|
||||
|
||||
plDXRenderTargetRef::plDXRenderTargetRef( D3DFORMAT tp, UInt32 ml, plRenderTarget *owner, hsBool releaseDepthOnDelete )
|
||||
plDXRenderTargetRef::plDXRenderTargetRef( D3DFORMAT tp, uint32_t ml, plRenderTarget *owner, hsBool releaseDepthOnDelete )
|
||||
: plDXTextureRef( tp, ml, owner->GetWidth(), owner->GetHeight(),
|
||||
owner->GetWidth() * owner->GetHeight(),
|
||||
owner->GetWidth() * owner->GetHeight() * ( owner->GetPixelSize() >> 3 ),
|
||||
@ -397,7 +397,7 @@ plDXRenderTargetRef::plDXRenderTargetRef( D3DFORMAT tp, UInt32 ml, plRenderTarge
|
||||
|
||||
//// Set //////////////////////////////////////////////////////////////////////
|
||||
|
||||
plDXRenderTargetRef& plDXRenderTargetRef::Set( D3DFORMAT tp, UInt32 ml, plRenderTarget *owner )
|
||||
plDXRenderTargetRef& plDXRenderTargetRef::Set( D3DFORMAT tp, uint32_t ml, plRenderTarget *owner )
|
||||
{
|
||||
fOwner = owner;
|
||||
|
||||
|
@ -44,13 +44,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "hsGDDrawDllLoad.h"
|
||||
#include "hsG3DDeviceSelector.h"
|
||||
#include "hsUtils.h"
|
||||
|
||||
|
||||
//// Local Typedefs ///////////////////////////////////////////////////////////
|
||||
|
||||
typedef LPDIRECT3D9 (WINAPI * Direct3DCreateProc)( UINT sdkVersion );
|
||||
|
||||
const UInt8 hsGDirect3DTnLEnumerate::kNumDisplayFormats = 6;
|
||||
const uint8_t hsGDirect3DTnLEnumerate::kNumDisplayFormats = 6;
|
||||
const D3DFORMAT hsGDirect3DTnLEnumerate::kDisplayFormats[] =
|
||||
{
|
||||
D3DFMT_A1R5G5B5,
|
||||
@ -353,8 +353,8 @@ void hsGDirect3DTnLEnumerate::IEnumAdapterDevices( IDirect3D9 *pD3D, UINT iAd
|
||||
const TCHAR* strDeviceDescs[] = { "HAL", "REF" };
|
||||
const D3DDEVTYPE deviceTypes[] = { D3DDEVTYPE_HAL, D3DDEVTYPE_REF };
|
||||
|
||||
BOOL *formatWorks = TRACKED_NEW BOOL[kNumDisplayFormats + 1]; // One for each format
|
||||
DWORD *behavior = TRACKED_NEW DWORD[kNumDisplayFormats + 1];
|
||||
BOOL *formatWorks = new BOOL[kNumDisplayFormats + 1]; // One for each format
|
||||
DWORD *behavior = new DWORD[kNumDisplayFormats + 1];
|
||||
UINT iDevice;
|
||||
for (iDevice = 0; iDevice < numDeviceTypes; iDevice++)
|
||||
{
|
||||
@ -368,7 +368,7 @@ void hsGDirect3DTnLEnumerate::IEnumAdapterDevices( IDirect3D9 *pD3D, UINT iAd
|
||||
|
||||
/// Loop through the formats, checking each against this device to see
|
||||
/// if it will work. If so, add all modes matching that format
|
||||
UInt8 iFormat;
|
||||
uint8_t iFormat;
|
||||
for (iFormat = 0; iFormat < kNumDisplayFormats + 1; iFormat++ )
|
||||
{
|
||||
// the desktop format gets to be first, everything else is nudged over one.
|
||||
@ -666,8 +666,8 @@ hsBool hsG3DDeviceSelector::IGetD3DCardInfo( hsG3DDeviceRecord &record,
|
||||
plDemoDebugFile::Write( "DeviceSelector detected DX Direct3D device. Info:" );
|
||||
plDemoDebugFile::Write( " Driver Description", (char *)adapterInfo->Description );
|
||||
plDemoDebugFile::Write( " Driver Name", (char *)adapterInfo->Driver );
|
||||
plDemoDebugFile::Write( " Vendor ID", (Int32)adapterInfo->VendorId );
|
||||
plDemoDebugFile::Write( " Device ID", (Int32)adapterInfo->DeviceId );
|
||||
plDemoDebugFile::Write( " Vendor ID", (int32_t)adapterInfo->VendorId );
|
||||
plDemoDebugFile::Write( " Device ID", (int32_t)adapterInfo->DeviceId );
|
||||
plDemoDebugFile::Write( " Version", (char *)record.GetDriverVersion() );
|
||||
plDemoDebugFile::Write( " Memory size (in MB)", record.GetMemoryBytes() / ( 1024 * 1024 ) );
|
||||
plDemoDebugFile::Write( " Memory size (in bytes)", record.GetMemoryBytes() );
|
||||
@ -843,7 +843,7 @@ void hsG3DDeviceSelector::ITryDirect3DTnLDevice(D3DEnum_DeviceInfo* devInfo, hsG
|
||||
if( devInfo->fDDCaps.MaxAnisotropy <= 1 )
|
||||
devRec.SetMaxAnisotropicSamples( 0 );
|
||||
else
|
||||
devRec.SetMaxAnisotropicSamples( (UInt8)devInfo->fDDCaps.MaxAnisotropy );
|
||||
devRec.SetMaxAnisotropicSamples( (uint8_t)devInfo->fDDCaps.MaxAnisotropy );
|
||||
|
||||
if (D3DSHADER_VERSION_MAJOR(devInfo->fDDCaps.PixelShaderVersion) > 0)
|
||||
devRec.SetCap(kCapsPixelShader);
|
||||
@ -862,7 +862,7 @@ void hsG3DDeviceSelector::ITryDirect3DTnLDevice(D3DEnum_DeviceInfo* devInfo, hsG
|
||||
|
||||
const struct
|
||||
{
|
||||
D3DFORMAT fmt; UInt16 depth;
|
||||
D3DFORMAT fmt; uint16_t depth;
|
||||
} depths[] = { { D3DFMT_D16, 0x0010 }, { D3DFMT_D24X8, 0x0018 }, { D3DFMT_D32, 0x0020 },
|
||||
{ D3DFMT_D15S1, 0x010f }, { D3DFMT_D24X4S4, 0x0418 }, { D3DFMT_D24S8, 0x0818 }, { D3DFMT_UNKNOWN, 0 } };
|
||||
|
||||
|
@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
*==LICENSE==*/
|
||||
#ifndef hsGDirect3DTnLEnumerate_h
|
||||
#define hsGDirect3DTnLEnumerate_h
|
||||
#include "hsConfig.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include "hsTemplates.h"
|
||||
//#include "plMemTrackerOff.h"
|
||||
@ -138,7 +138,7 @@ protected:
|
||||
hsBool ICheckCubicRenderTargets( IDirect3D9 *pD3D, UINT iAdapter, D3DDEVTYPE deviceType, D3DEnum_ModeInfo *modeInfo );
|
||||
HRESULT IConfirmDevice( D3DCAPS9* pCaps, DWORD dwBehavior, D3DFORMAT format );
|
||||
|
||||
static const UInt8 kNumDisplayFormats;
|
||||
static const uint8_t kNumDisplayFormats;
|
||||
static const D3DFORMAT kDisplayFormats[];
|
||||
|
||||
public:
|
||||
@ -153,7 +153,7 @@ public:
|
||||
HRESULT D3DEnum_SelectDefaultMode(int width, int height, int depth);
|
||||
HRESULT D3DEnum_SelectDefaultDriver( DWORD dwFlags );
|
||||
|
||||
UInt32 GetNumDrivers() { return fDrivers.GetCount(); }
|
||||
uint32_t GetNumDrivers() { return fDrivers.GetCount(); }
|
||||
D3DEnum_DriverInfo* GetDriver(int i) { return &fDrivers[i]; }
|
||||
|
||||
D3DEnum_DriverInfo* GetCurrentDriver() { return fCurrentDriver; }
|
||||
|
@ -69,8 +69,8 @@ class plDXLightRef : public plDXDeviceRef
|
||||
plLightInfo *fOwner;
|
||||
|
||||
D3DLIGHT9 fD3DInfo;
|
||||
UInt32 fD3DIndex;
|
||||
hsScalar fScale;
|
||||
uint32_t fD3DIndex;
|
||||
float fScale;
|
||||
|
||||
plDXLightSettings *fParentSettings;
|
||||
IDirect3DDevice9 *fD3DDevice;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -140,7 +140,7 @@ class plDXPlateManager : public plPlateManager
|
||||
struct plPlateVertex
|
||||
{
|
||||
hsPoint3 fPoint;
|
||||
UInt32 fColor;
|
||||
uint32_t fColor;
|
||||
hsPoint3 fUV;
|
||||
};
|
||||
|
||||
@ -221,9 +221,9 @@ protected:
|
||||
D3DFORMAT fSharedDepthFormat[2];
|
||||
|
||||
// Dynamic buffers
|
||||
UInt32 fVtxRefTime;
|
||||
UInt32 fNextDynVtx;
|
||||
UInt32 fDynVtxSize;
|
||||
uint32_t fVtxRefTime;
|
||||
uint32_t fNextDynVtx;
|
||||
uint32_t fDynVtxSize;
|
||||
IDirect3DVertexBuffer9* fDynVtxBuff;
|
||||
hsBool fManagedAlloced;
|
||||
hsBool fAllocUnManaged;
|
||||
@ -250,8 +250,8 @@ protected:
|
||||
|
||||
hsGMaterial* fCurrMaterial;
|
||||
plLayerInterface* fCurrLay;
|
||||
UInt32 fCurrLayerIdx, fCurrNumLayers, fCurrRenderLayer;
|
||||
UInt32 fCurrLightingMethod; // Based on plSpan flags
|
||||
uint32_t fCurrLayerIdx, fCurrNumLayers, fCurrRenderLayer;
|
||||
uint32_t fCurrLightingMethod; // Based on plSpan flags
|
||||
|
||||
D3DCULL fCurrCullMode;
|
||||
hsGMatState fMatOverOn;
|
||||
@ -268,8 +268,8 @@ protected:
|
||||
plLayerInterface* fOverBaseLayer;
|
||||
plLayerInterface* fOverAllLayer;
|
||||
hsTArray<plLayerInterface*> fPiggyBackStack;
|
||||
Int32 fMatPiggyBacks;
|
||||
Int32 fActivePiggyBacks;
|
||||
int32_t fMatPiggyBacks;
|
||||
int32_t fActivePiggyBacks;
|
||||
|
||||
UINT fCurrentAdapter;
|
||||
D3DEnum_DriverInfo* fCurrentDriver;
|
||||
@ -281,31 +281,31 @@ protected:
|
||||
hsGMatState fOldLayerState[ 8 ];
|
||||
hsBool fLayerTransform[ 8 ];
|
||||
float fLayerLODBias[ 8 ];
|
||||
UInt32 fLayerUVWSrcs[ 8 ];
|
||||
UInt32 fLayerXformFlags[ 8 ];
|
||||
UInt32 fLastEndingStage;
|
||||
uint32_t fLayerUVWSrcs[ 8 ];
|
||||
uint32_t fLayerXformFlags[ 8 ];
|
||||
uint32_t fLastEndingStage;
|
||||
hsBool fTexturing;
|
||||
hsBool fForceMatHandle;
|
||||
|
||||
UInt32 fInSceneDepth;
|
||||
UInt32 fTextUseTime; // inc'd every frame - stat gather only
|
||||
static UInt32 fTexManaged;
|
||||
static UInt32 fTexUsed;
|
||||
static UInt32 fVtxManaged;
|
||||
static UInt32 fVtxUsed;
|
||||
UInt32 fEvictTime;
|
||||
UInt32 fManagedSeen;
|
||||
UInt32 fManagedCutoff;
|
||||
uint32_t fInSceneDepth;
|
||||
uint32_t fTextUseTime; // inc'd every frame - stat gather only
|
||||
static uint32_t fTexManaged;
|
||||
static uint32_t fTexUsed;
|
||||
static uint32_t fVtxManaged;
|
||||
static uint32_t fVtxUsed;
|
||||
uint32_t fEvictTime;
|
||||
uint32_t fManagedSeen;
|
||||
uint32_t fManagedCutoff;
|
||||
|
||||
double fTime; // World time.
|
||||
UInt32 fFrame; // inc'd every time the camera moves.
|
||||
UInt32 fRenderCnt; // inc'd every begin scene.
|
||||
uint32_t fFrame; // inc'd every time the camera moves.
|
||||
uint32_t fRenderCnt; // inc'd every begin scene.
|
||||
|
||||
// View stuff
|
||||
plDXViewSettings fView;
|
||||
|
||||
hsBitVector fDebugFlags;
|
||||
UInt32 fDebugSpanGraphY;
|
||||
uint32_t fDebugSpanGraphY;
|
||||
|
||||
// Fog
|
||||
plDXFogSettings fCurrFog;
|
||||
@ -321,12 +321,12 @@ protected:
|
||||
hsTArray<plRenderTarget*> fRenderTargetPool64;
|
||||
hsTArray<plRenderTarget*> fRenderTargetPool32;
|
||||
enum { kMaxRenderTargetNext = 10 };
|
||||
UInt32 fRenderTargetNext[kMaxRenderTargetNext];
|
||||
uint32_t fRenderTargetNext[kMaxRenderTargetNext];
|
||||
plDXTextureRef* fULutTextureRef;
|
||||
plRenderTarget* fBlurScratchRTs[kMaxRenderTargetNext];
|
||||
plRenderTarget* fBlurDestRTs[kMaxRenderTargetNext];
|
||||
IDirect3DVertexBuffer9* fBlurVBuffers[kMaxRenderTargetNext];
|
||||
UInt32 fBlurVSHandle;
|
||||
uint32_t fBlurVSHandle;
|
||||
|
||||
hsTArray<plClothingOutfit*> fClothingOutfits;
|
||||
hsTArray<plClothingOutfit*> fPrevClothingOutfits;
|
||||
@ -334,7 +334,7 @@ protected:
|
||||
// Debug stuff
|
||||
plDrawableSpans *fBoundsSpans;
|
||||
hsGMaterial *fBoundsMat;
|
||||
hsTArray<UInt32> fBSpansToDelete;
|
||||
hsTArray<uint32_t> fBSpansToDelete;
|
||||
|
||||
plStatusLogDrawer *fLogDrawer;
|
||||
|
||||
@ -350,29 +350,29 @@ protected:
|
||||
hsBool IRefreshDynVertices(plGBufferGroup* group, plDXVertexBufferRef* vRef);
|
||||
hsBool ICheckAuxBuffers(const plAuxSpan* span);
|
||||
hsBool ICheckDynBuffers(plDrawableSpans* drawable, plGBufferGroup* group, const plSpan* span);
|
||||
void ICheckStaticVertexBuffer(plDXVertexBufferRef* vRef, plGBufferGroup* owner, UInt32 idx);
|
||||
void ICheckStaticVertexBuffer(plDXVertexBufferRef* vRef, plGBufferGroup* owner, uint32_t idx);
|
||||
void ICheckIndexBuffer(plDXIndexBufferRef* iRef);
|
||||
void IFillStaticVertexBufferRef(plDXVertexBufferRef *ref, plGBufferGroup *group, UInt32 idx);
|
||||
void IFillIndexBufferRef(plDXIndexBufferRef* iRef, plGBufferGroup* owner, UInt32 idx);
|
||||
void ISetupVertexBufferRef(plGBufferGroup* owner, UInt32 idx, plDXVertexBufferRef* vRef);
|
||||
void ISetupIndexBufferRef(plGBufferGroup* owner, UInt32 idx, plDXIndexBufferRef* iRef);
|
||||
void IFillStaticVertexBufferRef(plDXVertexBufferRef *ref, plGBufferGroup *group, uint32_t idx);
|
||||
void IFillIndexBufferRef(plDXIndexBufferRef* iRef, plGBufferGroup* owner, uint32_t idx);
|
||||
void ISetupVertexBufferRef(plGBufferGroup* owner, uint32_t idx, plDXVertexBufferRef* vRef);
|
||||
void ISetupIndexBufferRef(plGBufferGroup* owner, uint32_t idx, plDXIndexBufferRef* iRef);
|
||||
void ICreateDynamicBuffers();
|
||||
void IReleaseDynamicBuffers();
|
||||
|
||||
void IAddBoundsSpan( plDrawableSpans *ice, const hsBounds3Ext *bounds, UInt32 bndColor = 0xffff0000 );
|
||||
void IAddNormalsSpan( plDrawableSpans *ice, plIcicle *span, plDXVertexBufferRef *vRef, UInt32 bndColor );
|
||||
void IAddBoundsSpan( plDrawableSpans *ice, const hsBounds3Ext *bounds, uint32_t bndColor = 0xffff0000 );
|
||||
void IAddNormalsSpan( plDrawableSpans *ice, plIcicle *span, plDXVertexBufferRef *vRef, uint32_t bndColor );
|
||||
|
||||
// Rendering
|
||||
hsBool IFlipSurface();
|
||||
long IGetBufferD3DFormat(UInt8 format) const;
|
||||
UInt32 IGetBufferFormatSize(UInt8 format) const;
|
||||
void IGetVisibleSpans( plDrawableSpans* drawable, hsTArray<Int16>& visList, plVisMgr* visMgr );
|
||||
void IRenderSpans( plDrawableSpans *ice, const hsTArray<Int16>& visList );
|
||||
long IGetBufferD3DFormat(uint8_t format) const;
|
||||
uint32_t IGetBufferFormatSize(uint8_t format) const;
|
||||
void IGetVisibleSpans( plDrawableSpans* drawable, hsTArray<int16_t>& visList, plVisMgr* visMgr );
|
||||
void IRenderSpans( plDrawableSpans *ice, const hsTArray<int16_t>& visList );
|
||||
hsBool ILoopOverLayers(const plRenderPrimFunc& render, hsGMaterial* material, const plSpan& span);
|
||||
void IRenderBufferSpan( const plIcicle& span,
|
||||
hsGDeviceRef *vb, hsGDeviceRef *ib,
|
||||
hsGMaterial *material,
|
||||
UInt32 vStart, UInt32 vLength, UInt32 iStart, UInt32 iLength );
|
||||
uint32_t vStart, uint32_t vLength, uint32_t iStart, uint32_t iLength );
|
||||
void IRenderAuxSpan(const plSpan& span, const plAuxSpan* aux);
|
||||
void IRenderAuxSpans(const plSpan& span);
|
||||
|
||||
@ -382,14 +382,14 @@ protected:
|
||||
|
||||
// Lighting
|
||||
hsGDeviceRef *IMakeLightRef( plLightInfo *owner );
|
||||
void IScaleD3DLight( plDXLightRef *ref, hsScalar scale);
|
||||
void IScaleD3DLight( plDXLightRef *ref, float scale);
|
||||
void ICalcLighting( const plLayerInterface *currLayer, const plSpan *currSpan );
|
||||
void IDisableSpanLights();
|
||||
void IRestoreSpanLights();
|
||||
void ISelectLights( plSpan *span, int numLights, hsBool proj );
|
||||
void IEnableLights( plSpan *span );
|
||||
void IMakeLightLists(plVisMgr* visMgr);
|
||||
void ICheckLighting(plDrawableSpans* drawable, hsTArray<Int16>& visList, plVisMgr* visMgr);
|
||||
void ICheckLighting(plDrawableSpans* drawable, hsTArray<int16_t>& visList, plVisMgr* visMgr);
|
||||
inline void inlEnsureLightingOff();
|
||||
inline void inlEnsureLightingOn();
|
||||
void IRenderProjection(const plRenderPrimFunc& render, plLightInfo* li);
|
||||
@ -397,29 +397,29 @@ protected:
|
||||
void IRenderProjectionEach(const plRenderPrimFunc& render, hsGMaterial* material, int iPass, const plSpan& span);
|
||||
void IRenderOverWire(const plRenderPrimFunc& render, hsGMaterial* material, const plSpan& span);
|
||||
|
||||
hsBool ISkipBumpMap(hsGMaterial* newMat, UInt32& layer, const plSpan* currSpan) const;
|
||||
hsBool ISkipBumpMap(hsGMaterial* newMat, uint32_t& layer, const plSpan* currSpan) const;
|
||||
void ISetBumpMatrices(const plLayerInterface* layer, const plSpan* span);
|
||||
const hsMatrix44& IGetBumpMatrix(UInt32 miscFlags) const;
|
||||
const hsMatrix44& IGetBumpMatrix(uint32_t miscFlags) const;
|
||||
|
||||
// Materials
|
||||
const hsGMatState& ICompositeLayerState(int which, plLayerInterface* layer);
|
||||
Int32 IHandleMaterial(hsGMaterial* newMat, UInt32 which, const plSpan* currSpan);
|
||||
int32_t IHandleMaterial(hsGMaterial* newMat, uint32_t which, const plSpan* currSpan);
|
||||
void IHandleFirstTextureStage( plLayerInterface* layer );
|
||||
void IHandleShadeMode();
|
||||
void IHandleZMode();
|
||||
void IHandleMiscMode();
|
||||
void IHandleTextureStage(UInt32 stage, plLayerInterface* layer);
|
||||
void IHandleTextureStage(uint32_t stage, plLayerInterface* layer);
|
||||
void IHandleFirstStageBlend();
|
||||
void IHandleBumpEnv(int stage, UInt32 blendFlags);
|
||||
void IHandleBumpEnv(int stage, uint32_t blendFlags);
|
||||
void IHandleStageBlend(int stage);
|
||||
void IHandleStageClamp(int stage);
|
||||
void IHandleStageTransform(int stage, plLayerInterface* layer);
|
||||
void IHandleTextureMode(plLayerInterface* layer);
|
||||
void IUseTextureRef(int stage, hsGDeviceRef* dRef, plLayerInterface* layer);
|
||||
void IStageStop(UInt32 stage);
|
||||
UInt32 ILayersAtOnce(hsGMaterial* mat, UInt32 which);
|
||||
void IStageStop(uint32_t stage);
|
||||
uint32_t ILayersAtOnce(hsGMaterial* mat, uint32_t which);
|
||||
hsBool ICanEatLayer(plLayerInterface* lay);
|
||||
void ISetLayer(UInt32 lay);
|
||||
void ISetLayer(uint32_t lay);
|
||||
void IBottomLayer();
|
||||
|
||||
// Push special effects
|
||||
@ -439,34 +439,34 @@ protected:
|
||||
|
||||
// Stenciling
|
||||
virtual hsBool StencilEnable( hsBool enable );
|
||||
virtual void StencilSetCompareFunc( UInt8 func, UInt32 refValue );
|
||||
virtual void StencilSetMask( UInt32 mask, UInt32 writeMask );
|
||||
virtual void StencilSetOps( UInt8 passOp, UInt8 failOp, UInt8 passButZFailOp );
|
||||
virtual void StencilSetCompareFunc( uint8_t func, uint32_t refValue );
|
||||
virtual void StencilSetMask( uint32_t mask, uint32_t writeMask );
|
||||
virtual void StencilSetOps( uint8_t passOp, uint8_t failOp, uint8_t passButZFailOp );
|
||||
virtual hsBool StencilGetCaps( plStencilCaps *caps );
|
||||
|
||||
hsGDeviceRef *MakeTextureRef( plLayerInterface* layer, plMipmap *b );
|
||||
void IReloadTexture( plDXTextureRef *ref );
|
||||
void IFillD3DTexture( plDXTextureRef *ref );
|
||||
void IFillD3DCubeTexture( plDXCubeTextureRef *ref );
|
||||
void IGetD3DTextureFormat( plBitmap *b, D3DFORMAT &formatType, UInt32& texSize );
|
||||
void IFormatTextureData( UInt32 formatType, UInt32 numPix, hsRGBAColor32* const src, void *dst );
|
||||
void *IGetPixelScratch( UInt32 size );
|
||||
void IGetD3DTextureFormat( plBitmap *b, D3DFORMAT &formatType, uint32_t& texSize );
|
||||
void IFormatTextureData( uint32_t formatType, uint32_t numPix, hsRGBAColor32* const src, void *dst );
|
||||
void *IGetPixelScratch( uint32_t size );
|
||||
hsGDeviceRef *IMakeCubicTextureRef( plLayerInterface* layer, plCubicEnvironmap *cubic );
|
||||
hsBool IProcessMipmapLevels( plMipmap *mipmap, UInt32 &numLevels,
|
||||
UInt32 *&levelSizes, UInt32 &totalSize,
|
||||
UInt32 &numPixels, void *&textureData, hsBool noMip );
|
||||
hsBool IProcessMipmapLevels( plMipmap *mipmap, uint32_t &numLevels,
|
||||
uint32_t *&levelSizes, uint32_t &totalSize,
|
||||
uint32_t &numPixels, void *&textureData, hsBool noMip );
|
||||
IDirect3DTexture9 *IMakeD3DTexture( plDXTextureRef *ref, D3DFORMAT formatType );
|
||||
IDirect3DCubeTexture9 *IMakeD3DCubeTexture( plDXTextureRef *ref, D3DFORMAT formatType );
|
||||
|
||||
// Visualization of active occluders
|
||||
void IMakeOcclusionSnap();
|
||||
|
||||
hsBool IAvatarSort(plDrawableSpans* d, const hsTArray<Int16>& visList);
|
||||
hsBool IAvatarSort(plDrawableSpans* d, const hsTArray<int16_t>& visList);
|
||||
void IBlendVertsIntoBuffer( plSpan* span,
|
||||
hsMatrix44* matrixPalette, int numMatrices,
|
||||
const UInt8 *src, UInt8 format, UInt32 srcStride,
|
||||
UInt8 *dest, UInt32 destStride, UInt32 count, UInt16 localUVWChans );
|
||||
hsBool ISoftwareVertexBlend( plDrawableSpans* drawable, const hsTArray<Int16>& visList );
|
||||
const uint8_t *src, uint8_t format, uint32_t srcStride,
|
||||
uint8_t *dest, uint32_t destStride, uint32_t count, uint16_t localUVWChans );
|
||||
hsBool ISoftwareVertexBlend( plDrawableSpans* drawable, const hsTArray<int16_t>& visList );
|
||||
|
||||
|
||||
void ILinkDevRef( plDXDeviceRef *ref, plDXDeviceRef **refList );
|
||||
@ -492,7 +492,7 @@ protected:
|
||||
void IClearMembers();
|
||||
void ISetCaps();
|
||||
void IRestrictCaps( const hsG3DDeviceRecord& devRec );
|
||||
void ISetGraphicsCapability(UInt32 v);
|
||||
void ISetGraphicsCapability(uint32_t v);
|
||||
|
||||
hsBool IFindDepthFormat(D3DPRESENT_PARAMETERS& params);
|
||||
hsBool IFindCompressedFormats();
|
||||
@ -572,12 +572,12 @@ protected:
|
||||
void IReleaseBlurVBuffers();
|
||||
void IMakeRenderTargetPools();
|
||||
void IResetRenderTargetPools();
|
||||
plRenderTarget* IFindRenderTarget(UInt32& w, UInt32& h, hsBool ortho);
|
||||
plRenderTarget* IFindRenderTarget(uint32_t& w, uint32_t& h, hsBool ortho);
|
||||
void IReleaseRenderTargetPools();
|
||||
|
||||
// Selection
|
||||
void IAttachSlaveToReceivers(int iSlave, plDrawableSpans* drawable, const hsTArray<Int16>& visList);
|
||||
void IAttachShadowsToReceivers(plDrawableSpans* drawable, const hsTArray<Int16>& visList);
|
||||
void IAttachSlaveToReceivers(int iSlave, plDrawableSpans* drawable, const hsTArray<int16_t>& visList);
|
||||
void IAttachShadowsToReceivers(plDrawableSpans* drawable, const hsTArray<int16_t>& visList);
|
||||
hsBool IAcceptsShadow(const plSpan* span, plShadowSlave* slave);
|
||||
hsBool IReceivesShadows(const plSpan* span, hsGMaterial* mat);
|
||||
void ISetShadowFromGroup(plDrawableSpans* drawable, const plSpan* span, plLightInfo* liInfo);
|
||||
@ -593,7 +593,7 @@ protected:
|
||||
// Postprocess (blurring)
|
||||
hsBool ISetBlurQuadToRender(plRenderTarget* smap);
|
||||
void IRenderBlurBackToShadowMap(plRenderTarget* smap, plRenderTarget* scratch, plRenderTarget* dst);
|
||||
void IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, hsScalar scale);
|
||||
void IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, float scale);
|
||||
void IBlurSetRenderTarget(plRenderTarget* rt);
|
||||
int IGetScratchRenderTarget(plRenderTarget* smap);
|
||||
void IBlurShadowMap(plShadowSlave* slave);
|
||||
@ -601,15 +601,15 @@ protected:
|
||||
// Avatar Texture Rendering
|
||||
double fAvRTShrinkValidSince;
|
||||
hsTArray<plRenderTarget*> fAvRTPool;
|
||||
UInt16 fAvRTWidth;
|
||||
UInt32 fAvNextFreeRT;
|
||||
uint16_t fAvRTWidth;
|
||||
uint32_t fAvNextFreeRT;
|
||||
void IFillAvRTPool();
|
||||
hsBool IFillAvRTPool(UInt16 numRTs, UInt16 width); // Returns true if we successfully filled the pool. Otherwise cleans up.
|
||||
hsBool IFillAvRTPool(uint16_t numRTs, uint16_t width); // Returns true if we successfully filled the pool. Otherwise cleans up.
|
||||
void IReleaseAvRTPool();
|
||||
plRenderTarget* IGetNextAvRT();
|
||||
void IFreeAvRT(plRenderTarget* tex);
|
||||
void IPreprocessAvatarTextures();
|
||||
void IDrawClothingQuad(hsScalar x, hsScalar y, hsScalar w, hsScalar h, hsScalar uOff, hsScalar vOff, plMipmap *tex);
|
||||
void IDrawClothingQuad(float x, float y, float w, float h, float uOff, float vOff, plMipmap *tex);
|
||||
void IClearClothingOutfits(hsTArray<plClothingOutfit*>* outfits);
|
||||
|
||||
void IPrintDeviceInitError();
|
||||
@ -626,9 +626,9 @@ public:
|
||||
virtual IDirect3DDevice9* GetD3DDevice() const { return fD3DDevice; }
|
||||
|
||||
// Typical 3D device
|
||||
virtual hsBool PreRender(plDrawable* drawable, hsTArray<Int16>& visList, plVisMgr* visMgr=nil);
|
||||
virtual hsBool PrepForRender(plDrawable* drawable, hsTArray<Int16>& visList, plVisMgr* visMgr=nil);
|
||||
virtual void Render(plDrawable* d, const hsTArray<Int16>& visList);
|
||||
virtual hsBool PreRender(plDrawable* drawable, hsTArray<int16_t>& visList, plVisMgr* visMgr=nil);
|
||||
virtual hsBool PrepForRender(plDrawable* drawable, hsTArray<int16_t>& visList, plVisMgr* visMgr=nil);
|
||||
virtual void Render(plDrawable* d, const hsTArray<int16_t>& visList);
|
||||
virtual void Draw(plDrawable* d);
|
||||
|
||||
virtual void PushRenderRequest(plRenderRequest* req);
|
||||
@ -637,10 +637,10 @@ public:
|
||||
void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false );
|
||||
|
||||
virtual void ClearRenderTarget( plDrawable* d );
|
||||
virtual void ClearRenderTarget( const hsColorRGBA* col = nil, const hsScalar* depth = nil );
|
||||
virtual void SetClear(const hsColorRGBA* col=nil, const hsScalar* depth=nil);
|
||||
virtual void ClearRenderTarget( const hsColorRGBA* col = nil, const float* depth = nil );
|
||||
virtual void SetClear(const hsColorRGBA* col=nil, const float* depth=nil);
|
||||
virtual hsColorRGBA GetClearColor() const;
|
||||
virtual hsScalar GetClearDepth() const;
|
||||
virtual float GetClearDepth() const;
|
||||
virtual hsGDeviceRef* MakeRenderTargetRef( plRenderTarget *owner );
|
||||
virtual hsGDeviceRef* SharedRenderTargetRef(plRenderTarget* sharer, plRenderTarget *owner);
|
||||
virtual void PushRenderTarget( plRenderTarget *target );
|
||||
@ -657,58 +657,58 @@ public:
|
||||
virtual void EndVisMgr(plVisMgr* visMgr);
|
||||
|
||||
virtual hsBool IsFullScreen() const { return fSettings.fFullscreen; }
|
||||
virtual UInt32 Width() const { return fView.fTransform.GetViewPortWidth(); }
|
||||
virtual UInt32 Height() const { return fView.fTransform.GetViewPortHeight(); }
|
||||
virtual UInt32 ColorDepth() const { return fSettings.fColorDepth; }
|
||||
virtual void Resize( UInt32 width, UInt32 height );
|
||||
virtual uint32_t Width() const { return fView.fTransform.GetViewPortWidth(); }
|
||||
virtual uint32_t Height() const { return fView.fTransform.GetViewPortHeight(); }
|
||||
virtual uint32_t ColorDepth() const { return fSettings.fColorDepth; }
|
||||
virtual void Resize( uint32_t width, uint32_t height );
|
||||
|
||||
// Culling. Might be used in Update before bothering to do any serious computation.
|
||||
virtual hsBool TestVisibleWorld(const hsBounds3Ext& wBnd);
|
||||
virtual hsBool TestVisibleWorld(const plSceneObject* sObj);
|
||||
virtual hsBool HarvestVisible(plSpaceTree* space, hsTArray<Int16>& visList);
|
||||
virtual hsBool HarvestVisible(plSpaceTree* space, hsTArray<int16_t>& visList);
|
||||
virtual hsBool SubmitOccluders(const hsTArray<const plCullPoly*>& polyList);
|
||||
|
||||
// Debug flags
|
||||
virtual void SetDebugFlag( UInt32 flag, hsBool on );
|
||||
virtual hsBool IsDebugFlagSet( UInt32 flag ) const;
|
||||
virtual void SetDebugFlag( uint32_t flag, hsBool on );
|
||||
virtual hsBool IsDebugFlagSet( uint32_t flag ) const;
|
||||
|
||||
// These are also only for debugging.
|
||||
virtual void SetMaxCullNodes(UInt16 n) { fView.fCullMaxNodes = n; }
|
||||
virtual UInt16 GetMaxCullNodes() const { return fView.fCullMaxNodes; }
|
||||
virtual void SetMaxCullNodes(uint16_t n) { fView.fCullMaxNodes = n; }
|
||||
virtual uint16_t GetMaxCullNodes() const { return fView.fCullMaxNodes; }
|
||||
|
||||
virtual hsBool CheckResources();
|
||||
virtual void LoadResources(); // Tells us where it's a good time to load in unmanaged resources.
|
||||
|
||||
// Properties
|
||||
virtual void SetProperty( UInt32 prop, hsBool on ) { on ? fSettings.fProperties |= prop : fSettings.fProperties &= ~prop; }
|
||||
virtual hsBool GetProperty( UInt32 prop ) const { return ( fSettings.fProperties & prop ) ? true : false; }
|
||||
virtual void SetProperty( uint32_t prop, hsBool on ) { on ? fSettings.fProperties |= prop : fSettings.fProperties &= ~prop; }
|
||||
virtual hsBool GetProperty( uint32_t prop ) const { return ( fSettings.fProperties & prop ) ? true : false; }
|
||||
|
||||
virtual UInt32 GetMaxLayersAtOnce() const { return fSettings.fMaxLayersAtOnce; }
|
||||
virtual uint32_t GetMaxLayersAtOnce() const { return fSettings.fMaxLayersAtOnce; }
|
||||
|
||||
// Drawable type mask
|
||||
virtual void SetDrawableTypeMask( UInt32 mask ) { fView.fDrawableTypeMask = mask; }
|
||||
virtual UInt32 GetDrawableTypeMask() const { return fView.fDrawableTypeMask; }
|
||||
virtual void SetSubDrawableTypeMask( UInt32 mask ) { fView.fSubDrawableTypeMask = mask; }
|
||||
virtual UInt32 GetSubDrawableTypeMask() const { return fView.fSubDrawableTypeMask; }
|
||||
virtual void SetDrawableTypeMask( uint32_t mask ) { fView.fDrawableTypeMask = mask; }
|
||||
virtual uint32_t GetDrawableTypeMask() const { return fView.fDrawableTypeMask; }
|
||||
virtual void SetSubDrawableTypeMask( uint32_t mask ) { fView.fSubDrawableTypeMask = mask; }
|
||||
virtual uint32_t GetSubDrawableTypeMask() const { return fView.fSubDrawableTypeMask; }
|
||||
|
||||
// Create a debug text font object
|
||||
virtual plTextFont *MakeTextFont( char *face, UInt16 size );
|
||||
virtual plTextFont *MakeTextFont( char *face, uint16_t size );
|
||||
|
||||
// Create and/or Refresh geometry buffers
|
||||
virtual void CheckVertexBufferRef(plGBufferGroup* owner, UInt32 idx);
|
||||
virtual void CheckIndexBufferRef(plGBufferGroup* owner, UInt32 idx);
|
||||
virtual void CheckVertexBufferRef(plGBufferGroup* owner, uint32_t idx);
|
||||
virtual void CheckIndexBufferRef(plGBufferGroup* owner, uint32_t idx);
|
||||
|
||||
virtual hsBool OpenAccess(plAccessSpan& dst, plDrawableSpans* d, const plVertexSpan* span, hsBool readOnly);
|
||||
virtual hsBool CloseAccess(plAccessSpan& acc);
|
||||
|
||||
virtual void CheckTextureRef(plLayerInterface* lay);
|
||||
static void FreeManagedTexture(UInt32 sz) { hsAssert(fTexManaged >= sz, "Freeing mem we don't have"); fTexManaged -= sz; }
|
||||
static void AllocManagedTexture(UInt32 sz) { fTexManaged += sz; }
|
||||
static void FreeManagedVertex(UInt32 sz) { hsAssert(fVtxManaged >= sz, "Freeing mem we don't have"); fVtxManaged -= sz; }
|
||||
static void AllocManagedVertex(UInt32 sz) { fVtxManaged += sz; }
|
||||
static void FreeManagedTexture(uint32_t sz) { hsAssert(fTexManaged >= sz, "Freeing mem we don't have"); fTexManaged -= sz; }
|
||||
static void AllocManagedTexture(uint32_t sz) { fTexManaged += sz; }
|
||||
static void FreeManagedVertex(uint32_t sz) { hsAssert(fVtxManaged >= sz, "Freeing mem we don't have"); fVtxManaged -= sz; }
|
||||
static void AllocManagedVertex(uint32_t sz) { fVtxManaged += sz; }
|
||||
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
static void ProfilePoolMem(D3DPOOL poolType, UInt32 size, hsBool add, char *id);
|
||||
static void ProfilePoolMem(D3DPOOL poolType, uint32_t size, hsBool add, char *id);
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
|
||||
// From a D3DFORMAT enumeration, return the bit depth associated with it.
|
||||
@ -725,17 +725,17 @@ public:
|
||||
virtual hsVector3 GetViewDirWorld() const { return GetViewTransform().GetDirection(); }
|
||||
virtual void GetViewAxesWorld(hsVector3 axes[3] /* ac,up,at */ ) const;
|
||||
|
||||
virtual void GetFOV(hsScalar& fovX, hsScalar& fovY) const;
|
||||
virtual void SetFOV(hsScalar fovX, hsScalar fovY);
|
||||
virtual void GetFOV(float& fovX, float& fovY) const;
|
||||
virtual void SetFOV(float fovX, float fovY);
|
||||
|
||||
virtual void GetSize(hsScalar& width, hsScalar& height) const;
|
||||
virtual void SetSize(hsScalar width, hsScalar height);
|
||||
virtual void GetSize(float& width, float& height) const;
|
||||
virtual void SetSize(float width, float height);
|
||||
|
||||
virtual void GetDepth(hsScalar& hither, hsScalar& yon) const;
|
||||
virtual void SetDepth(hsScalar hither, hsScalar yon);
|
||||
virtual void GetDepth(float& hither, float& yon) const;
|
||||
virtual void SetDepth(float hither, float yon);
|
||||
|
||||
virtual hsScalar GetZBiasScale() const;
|
||||
virtual void SetZBiasScale(hsScalar scale);
|
||||
virtual float GetZBiasScale() const;
|
||||
virtual void SetZBiasScale(float scale);
|
||||
|
||||
virtual const hsMatrix44& GetWorldToCamera() const;
|
||||
virtual const hsMatrix44& GetCameraToWorld() const;
|
||||
@ -747,8 +747,8 @@ public:
|
||||
virtual const hsMatrix44& GetWorldToLocal() const;
|
||||
virtual const hsMatrix44& GetLocalToWorld() const;
|
||||
|
||||
virtual void ScreenToWorldPoint( int n, UInt32 stride, Int32 *scrX, Int32 *scrY,
|
||||
hsScalar dist, UInt32 strideOut, hsPoint3 *worldOut );
|
||||
virtual void ScreenToWorldPoint( int n, uint32_t stride, int32_t *scrX, int32_t *scrY,
|
||||
float dist, uint32_t strideOut, hsPoint3 *worldOut );
|
||||
|
||||
virtual void RefreshMatrices();
|
||||
virtual void RefreshScreenMatrices();
|
||||
@ -767,11 +767,11 @@ public:
|
||||
virtual plLayerInterface* PushPiggyBackLayer(plLayerInterface* li);
|
||||
virtual plLayerInterface* PopPiggyBackLayer(plLayerInterface* li);
|
||||
|
||||
virtual UInt32 GetMaterialOverrideOn(hsGMatState::StateIdx category) const;
|
||||
virtual UInt32 GetMaterialOverrideOff(hsGMatState::StateIdx category) const;
|
||||
virtual uint32_t GetMaterialOverrideOn(hsGMatState::StateIdx category) const;
|
||||
virtual uint32_t GetMaterialOverrideOff(hsGMatState::StateIdx category) const;
|
||||
|
||||
virtual hsGMatState PushMaterialOverride(const hsGMatState& state, hsBool on);
|
||||
virtual hsGMatState PushMaterialOverride(hsGMatState::StateIdx cat, UInt32 which, hsBool on);
|
||||
virtual hsGMatState PushMaterialOverride(hsGMatState::StateIdx cat, uint32_t which, hsBool on);
|
||||
virtual void PopMaterialOverride(const hsGMatState& restore, hsBool on);
|
||||
virtual const hsGMatState& GetMaterialOverride(hsBool on) const;
|
||||
|
||||
@ -782,10 +782,10 @@ public:
|
||||
virtual void SubmitShadowSlave(plShadowSlave* slave);
|
||||
virtual void SubmitClothingOutfit(plClothingOutfit* co);
|
||||
|
||||
virtual hsBool SetGamma(hsScalar eR, hsScalar eG, hsScalar eB);
|
||||
virtual hsBool SetGamma(const UInt16* const tabR, const UInt16* const tabG, const UInt16* const tabB);
|
||||
virtual hsBool SetGamma(float eR, float eG, float eB);
|
||||
virtual hsBool SetGamma(const uint16_t* const tabR, const uint16_t* const tabG, const uint16_t* const tabB);
|
||||
|
||||
virtual hsBool CaptureScreen( plMipmap *dest, bool flipVertical = false, UInt16 desiredWidth = 0, UInt16 desiredHeight = 0 );
|
||||
virtual hsBool CaptureScreen( plMipmap *dest, bool flipVertical = false, uint16_t desiredWidth = 0, uint16_t desiredHeight = 0 );
|
||||
virtual plMipmap* ExtractMipMap(plRenderTarget* targ);
|
||||
|
||||
/// Error handling
|
||||
|
@ -39,14 +39,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsConfig.h"
|
||||
#include "hsWindows.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include <D3d9.h>
|
||||
#include <D3dx9core.h>
|
||||
|
||||
#include "hsTypes.h"
|
||||
|
||||
#include "plDXPixelShader.h"
|
||||
|
||||
#include "plSurface/plShader.h"
|
||||
@ -73,7 +70,7 @@ void plDXPixelShader::Release()
|
||||
ISetError(nil);
|
||||
}
|
||||
|
||||
hsBool plDXPixelShader::VerifyFormat(UInt8 format) const
|
||||
hsBool plDXPixelShader::VerifyFormat(uint8_t format) const
|
||||
{
|
||||
return (fOwner->GetInputFormat() & format) == fOwner->GetInputFormat();
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
void Release();
|
||||
void Link(plDXPixelShader** back) { plDXDeviceRef::Link((plDXDeviceRef**)back); }
|
||||
|
||||
hsBool VerifyFormat(UInt8 format) const;
|
||||
hsBool VerifyFormat(uint8_t format) const;
|
||||
IDirect3DPixelShader9 *GetShader(plDXPipeline* pipe);
|
||||
};
|
||||
|
||||
|
@ -74,8 +74,8 @@ class plDXRenderTargetRef: public plDXTextureRef
|
||||
plDXRenderTargetRef *GetNext( void ) { return (plDXRenderTargetRef *)fNext; }
|
||||
|
||||
|
||||
plDXRenderTargetRef( D3DFORMAT tp, UInt32 ml, plRenderTarget *owner, hsBool releaseDepthOnDelete = true );
|
||||
plDXRenderTargetRef& Set( D3DFORMAT tp, UInt32 ml, plRenderTarget *owner );
|
||||
plDXRenderTargetRef( D3DFORMAT tp, uint32_t ml, plRenderTarget *owner, hsBool releaseDepthOnDelete = true );
|
||||
plDXRenderTargetRef& Set( D3DFORMAT tp, uint32_t ml, plRenderTarget *owner );
|
||||
|
||||
virtual void SetOwner( plRenderTarget *targ ) { fOwner = (plBitmap *)targ; }
|
||||
|
||||
|
@ -77,12 +77,12 @@ class plDXIndexBufferRef;
|
||||
class plDXViewSettings
|
||||
{
|
||||
public:
|
||||
UInt32 fRenderState;
|
||||
uint32_t fRenderState;
|
||||
|
||||
plRenderRequest* fRenderRequest;
|
||||
|
||||
UInt32 fDrawableTypeMask;
|
||||
UInt32 fSubDrawableTypeMask;
|
||||
uint32_t fDrawableTypeMask;
|
||||
uint32_t fSubDrawableTypeMask;
|
||||
|
||||
DWORD fClearColor;
|
||||
float fClearDepth;
|
||||
@ -91,7 +91,7 @@ public:
|
||||
|
||||
plCullTree fCullTree;
|
||||
hsBool fCullTreeDirty;
|
||||
UInt16 fCullMaxNodes;
|
||||
uint16_t fCullMaxNodes;
|
||||
|
||||
enum XformResets
|
||||
{
|
||||
@ -102,7 +102,7 @@ public:
|
||||
kResetAll = 0x07
|
||||
};
|
||||
|
||||
UInt8 fXformResetFlags;
|
||||
uint8_t fXformResetFlags;
|
||||
hsBool fLocalToWorldLeftHanded;
|
||||
hsBool fWorldToCamLeftHanded;
|
||||
|
||||
@ -134,17 +134,17 @@ class plDXGeneralSettings
|
||||
|
||||
hsBool fFullscreen;
|
||||
hsWinRef fHWnd;
|
||||
UInt32 fColorDepth;
|
||||
UInt8 fNumAASamples;
|
||||
UInt32 fD3DCaps, fBoardKluge, fStageEnd;
|
||||
UInt32 fMaxNumLights;
|
||||
UInt32 fMaxNumProjectors;
|
||||
UInt32 fMaxLayersAtOnce;
|
||||
UInt32 fMaxPiggyBacks;
|
||||
Int32 fBoundsDrawLevel;
|
||||
UInt32 fProperties;
|
||||
uint32_t fColorDepth;
|
||||
uint8_t fNumAASamples;
|
||||
uint32_t fD3DCaps, fBoardKluge, fStageEnd;
|
||||
uint32_t fMaxNumLights;
|
||||
uint32_t fMaxNumProjectors;
|
||||
uint32_t fMaxLayersAtOnce;
|
||||
uint32_t fMaxPiggyBacks;
|
||||
int32_t fBoundsDrawLevel;
|
||||
uint32_t fProperties;
|
||||
DWORD fClearColor;
|
||||
UInt8 fMaxAnisotropicSamples;
|
||||
uint8_t fMaxAnisotropicSamples;
|
||||
D3DPRESENT_PARAMETERS fPresentParams;
|
||||
hsBool fVeryAnnoyingTextureInvalidFlag;
|
||||
hsBool fNoGammaCorrect;
|
||||
@ -166,7 +166,7 @@ class plDXGeneralSettings
|
||||
plDXDeviceRef *fCurrRenderTargetRef;
|
||||
plDXVertexBufferRef *fCurrVertexBuffRef;
|
||||
plDXIndexBufferRef *fCurrIndexBuffRef;
|
||||
UInt32 fOrigWidth, fOrigHeight;
|
||||
uint32_t fOrigWidth, fOrigHeight;
|
||||
|
||||
IDirect3DVertexShader9 *fCurrVertexShader;
|
||||
IDirect3DPixelShader9 *fCurrPixelShader;
|
||||
@ -218,9 +218,9 @@ class plDXFogSettings
|
||||
public:
|
||||
plFogEnvironment* fEnvPtr; // nil means no fog
|
||||
D3DFOGMODE fMode;
|
||||
UInt8 fIsVertex;
|
||||
UInt8 fIsShader;
|
||||
UInt32 fHexColor;
|
||||
uint8_t fIsVertex;
|
||||
uint8_t fIsShader;
|
||||
uint32_t fHexColor;
|
||||
float fStart;
|
||||
float fEnd;
|
||||
float fDensity;
|
||||
@ -248,8 +248,8 @@ class plDXLightSettings
|
||||
hsBitVector fUsedFlags;
|
||||
hsBitVector fEnabledFlags;
|
||||
hsBitVector fHoldFlags;
|
||||
UInt32 fNextIndex, fLastIndex;
|
||||
UInt16 fTime;
|
||||
uint32_t fNextIndex, fLastIndex;
|
||||
uint16_t fTime;
|
||||
plLightInfo* fActiveList;
|
||||
plDXLightRef* fRefList;
|
||||
plDXPipeline* fPipeline;
|
||||
@ -259,7 +259,7 @@ class plDXLightSettings
|
||||
hsTArray<plLightInfo*> fCharLights;
|
||||
hsTArray<plLightInfo*> fVisLights;
|
||||
|
||||
UInt32 fNextShadowLight;
|
||||
uint32_t fNextShadowLight;
|
||||
hsTArray<plDXLightRef*> fShadowLights;
|
||||
|
||||
plDXLightSettings();
|
||||
@ -269,9 +269,9 @@ class plDXLightSettings
|
||||
// Releases/deletes anything associated with these settings
|
||||
void Release( void );
|
||||
// Reserve a D3D light index
|
||||
UInt32 ReserveD3DIndex( void );
|
||||
uint32_t ReserveD3DIndex( void );
|
||||
// Release a reserved D3D light index
|
||||
void ReleaseD3DIndex( UInt32 idx );
|
||||
void ReleaseD3DIndex( uint32_t idx );
|
||||
};
|
||||
|
||||
//// Stencil Settings /////////////////////////////////////////////////////////
|
||||
@ -279,13 +279,13 @@ class plDXLightSettings
|
||||
class plDXStencilSettings
|
||||
{
|
||||
public:
|
||||
UInt8 fDepth;
|
||||
uint8_t fDepth;
|
||||
hsBool fEnabled;
|
||||
UInt8 fCmpFunc;
|
||||
UInt8 fFailOp, fPassOp, fPassButZFailOp;
|
||||
UInt32 fRefValue;
|
||||
UInt32 fMask;
|
||||
UInt32 fWriteMask;
|
||||
uint8_t fCmpFunc;
|
||||
uint8_t fFailOp, fPassOp, fPassButZFailOp;
|
||||
uint32_t fRefValue;
|
||||
uint32_t fMask;
|
||||
uint32_t fWriteMask;
|
||||
|
||||
void Reset( void )
|
||||
{
|
||||
|
@ -39,13 +39,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsConfig.h"
|
||||
#include "hsWindows.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include <D3d9.h>
|
||||
#include <D3dx9core.h>
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include "plDXShader.h"
|
||||
|
||||
|
@ -50,15 +50,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsConfig.h"
|
||||
#include "hsWindows.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include <d3d9.h>
|
||||
#include <ddraw.h>
|
||||
#include <d3dx9mesh.h>
|
||||
|
||||
#include "hsWinRef.h"
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDXTextFont.h"
|
||||
#include "plDXPipeline.h"
|
||||
|
||||
@ -77,14 +76,14 @@ static D3DXMATRIX d3dIdentityMatrix( 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
// * 4 primitives per char max (for bold text)
|
||||
// * 3 verts per primitive
|
||||
|
||||
//const UInt32 kNumVertsInBuffer(32768);
|
||||
const UInt32 kNumVertsInBuffer(4608);
|
||||
//const uint32_t kNumVertsInBuffer(32768);
|
||||
const uint32_t kNumVertsInBuffer(4608);
|
||||
|
||||
// See the declaration for plFontVertex in plTextFont.h for info
|
||||
const DWORD plDXTextFont::kFVF = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE3(0);
|
||||
|
||||
IDirect3DVertexBuffer9* plDXTextFont::fBuffer = nil;
|
||||
UInt32 plDXTextFont::fBufferCursor = 0;
|
||||
uint32_t plDXTextFont::fBufferCursor = 0;
|
||||
|
||||
//// Constructor & Destructor /////////////////////////////////////////////////
|
||||
|
||||
@ -103,7 +102,7 @@ plDXTextFont::~plDXTextFont()
|
||||
|
||||
//// ICreateTexture ///////////////////////////////////////////////////////////
|
||||
|
||||
void plDXTextFont::ICreateTexture( UInt16 *data )
|
||||
void plDXTextFont::ICreateTexture( uint16_t *data )
|
||||
{
|
||||
HRESULT hr;
|
||||
D3DLOCKED_RECT lockInfo;
|
||||
@ -120,7 +119,7 @@ void plDXTextFont::ICreateTexture( UInt16 *data )
|
||||
|
||||
// Lock the texture and write our values out
|
||||
fD3DTexture->LockRect( 0, &lockInfo, 0, 0 );
|
||||
memcpy( lockInfo.pBits, data, fTextureWidth * fTextureHeight * sizeof( UInt16 ) );
|
||||
memcpy( lockInfo.pBits, data, fTextureWidth * fTextureHeight * sizeof( uint16_t ) );
|
||||
fD3DTexture->UnlockRect( nil );
|
||||
}
|
||||
|
||||
@ -203,7 +202,7 @@ void plDXTextFont::DestroyObjects()
|
||||
|
||||
//// IDrawPrimitive ///////////////////////////////////////////////////////////
|
||||
|
||||
void plDXTextFont::IDrawPrimitive( UInt32 count, plFontVertex *array )
|
||||
void plDXTextFont::IDrawPrimitive( uint32_t count, plFontVertex *array )
|
||||
{
|
||||
plFontVertex *v;
|
||||
|
||||
@ -248,7 +247,7 @@ void plDXTextFont::IDrawPrimitive( UInt32 count, plFontVertex *array )
|
||||
|
||||
//// IDrawLines ///////////////////////////////////////////////////////////////
|
||||
|
||||
void plDXTextFont::IDrawLines( UInt32 count, plFontVertex *array )
|
||||
void plDXTextFont::IDrawLines( uint32_t count, plFontVertex *array )
|
||||
{
|
||||
if( !fBuffer )
|
||||
return;
|
||||
|
@ -60,15 +60,15 @@ protected:
|
||||
IDirect3DDevice9 *fDevice;
|
||||
|
||||
static IDirect3DVertexBuffer9 *fBuffer;
|
||||
static UInt32 fBufferCursor;
|
||||
static uint32_t fBufferCursor;
|
||||
|
||||
IDirect3DStateBlock9 *fOldStateBlock;
|
||||
IDirect3DStateBlock9 *fTextStateBlock;
|
||||
|
||||
virtual void ICreateTexture( UInt16 *data );
|
||||
virtual void ICreateTexture( uint16_t *data );
|
||||
virtual void IInitStateBlocks( void );
|
||||
virtual void IDrawPrimitive( UInt32 count, plFontVertex *array );
|
||||
virtual void IDrawLines( UInt32 count, plFontVertex *array );
|
||||
virtual void IDrawPrimitive( uint32_t count, plFontVertex *array );
|
||||
virtual void IDrawLines( uint32_t count, plFontVertex *array );
|
||||
|
||||
public:
|
||||
plDXTextFont( plPipeline *pipe, IDirect3DDevice9 *device );
|
||||
|
@ -82,24 +82,24 @@ class plDXTextureRef : public plDXDeviceRef
|
||||
IDirect3DBaseTexture9 *fD3DTexture;
|
||||
D3DFORMAT fFormatType; // Format of the D3D texture object
|
||||
|
||||
UInt32 fMMLvs; // Number of mipmap levels
|
||||
UInt32 fMaxWidth; // Width of the highest mipmap level
|
||||
UInt32 fMaxHeight; // Height of the highest mipmap level (no pun intended)
|
||||
UInt32 fNumPix; // total num texels in all mip levels
|
||||
UInt32 fDataSize; // size of fData[0..n] in bytes
|
||||
UInt32* fLevelSizes; // fLevelSize[i] == size in bytes of level i
|
||||
//UInt32 fCurrLOD; // Current LOD setting for this texture
|
||||
uint32_t fMMLvs; // Number of mipmap levels
|
||||
uint32_t fMaxWidth; // Width of the highest mipmap level
|
||||
uint32_t fMaxHeight; // Height of the highest mipmap level (no pun intended)
|
||||
uint32_t fNumPix; // total num texels in all mip levels
|
||||
uint32_t fDataSize; // size of fData[0..n] in bytes
|
||||
uint32_t* fLevelSizes; // fLevelSize[i] == size in bytes of level i
|
||||
//uint32_t fCurrLOD; // Current LOD setting for this texture
|
||||
|
||||
plBitmap *fOwner;
|
||||
|
||||
void* fData; // for reloading
|
||||
|
||||
UInt32 GetFlags( void ) { return fFlags; }
|
||||
void SetFlags( UInt32 flag ) { fFlags = flag; }
|
||||
uint32_t GetFlags( void ) { return fFlags; }
|
||||
void SetFlags( uint32_t flag ) { fFlags = flag; }
|
||||
|
||||
plDXTextureRef& Set( D3DFORMAT tp, UInt32 ml, UInt32 mw, UInt32 mh, UInt32 np, UInt32 sz, UInt32 manSize, UInt32* lSz, void* pd, hsBool ed=false, hsBool renderTarget = false );
|
||||
plDXTextureRef& Set( D3DFORMAT tp, uint32_t ml, uint32_t mw, uint32_t mh, uint32_t np, uint32_t sz, uint32_t manSize, uint32_t* lSz, void* pd, hsBool ed=false, hsBool renderTarget = false );
|
||||
|
||||
plDXTextureRef( D3DFORMAT tp, UInt32 ml, UInt32 mw, UInt32 mh, UInt32 np, UInt32 sz, UInt32 manSize, UInt32* lSz, void* pd, hsBool ed=false, hsBool renderTarget = false );
|
||||
plDXTextureRef( D3DFORMAT tp, uint32_t ml, uint32_t mw, uint32_t mh, uint32_t np, uint32_t sz, uint32_t manSize, uint32_t* lSz, void* pd, hsBool ed=false, hsBool renderTarget = false );
|
||||
virtual ~plDXTextureRef();
|
||||
|
||||
void Link( plDXTextureRef **back ) { plDXDeviceRef::Link( (plDXDeviceRef **)back ); }
|
||||
@ -113,7 +113,7 @@ class plDXCubeTextureRef : public plDXTextureRef
|
||||
public:
|
||||
void *fFaceData[ 5 ]; // First face is in the inherited fData
|
||||
|
||||
plDXCubeTextureRef( D3DFORMAT tp, UInt32 ml, UInt32 mw, UInt32 mh, UInt32 np, UInt32 sz, UInt32 manSize, UInt32* lSz, void* pd, hsBool ed=false, hsBool renderTarget = false ) :
|
||||
plDXCubeTextureRef( D3DFORMAT tp, uint32_t ml, uint32_t mw, uint32_t mh, uint32_t np, uint32_t sz, uint32_t manSize, uint32_t* lSz, void* pd, hsBool ed=false, hsBool renderTarget = false ) :
|
||||
plDXTextureRef( tp, ml, mw, mh, np, sz, manSize, lSz, pd, ed, renderTarget )
|
||||
{
|
||||
|
||||
|
@ -39,13 +39,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsConfig.h"
|
||||
#include "hsWindows.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include <D3d9.h>
|
||||
#include <D3dx9core.h>
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include "plDXVertexShader.h"
|
||||
|
||||
@ -73,7 +72,7 @@ void plDXVertexShader::Release()
|
||||
ISetError(nil);
|
||||
}
|
||||
|
||||
hsBool plDXVertexShader::VerifyFormat(UInt8 format) const
|
||||
hsBool plDXVertexShader::VerifyFormat(uint8_t format) const
|
||||
{
|
||||
return (fOwner->GetInputFormat() & format) == fOwner->GetInputFormat();
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
virtual void Release();
|
||||
void Link(plDXVertexShader** back) { plDXDeviceRef::Link((plDXDeviceRef**)back); }
|
||||
|
||||
hsBool VerifyFormat(UInt8 format) const;
|
||||
hsBool VerifyFormat(uint8_t format) const;
|
||||
IDirect3DVertexShader9* GetShader(plDXPipeline* pipe);
|
||||
};
|
||||
|
||||
|
@ -57,7 +57,7 @@ plDebugText plDebugText::fInstance;
|
||||
|
||||
//// DrawString //////////////////////////////////////////////////////////////
|
||||
|
||||
void plDebugText::DrawString( UInt16 x, UInt16 y, const char *string, UInt32 hexColor, UInt8 style )
|
||||
void plDebugText::DrawString( uint16_t x, uint16_t y, const char *string, uint32_t hexColor, uint8_t style )
|
||||
{
|
||||
if( IsEnabled() && fManager && string != nil && string[ 0 ] != 0 )
|
||||
fManager->AddString( x, y, string, hexColor, style, fDrawOnTopMode );
|
||||
@ -65,7 +65,7 @@ void plDebugText::DrawString( UInt16 x, UInt16 y, const char *string, UInt32
|
||||
|
||||
//// CalcStringWidth /////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 plDebugText::CalcStringWidth( const char *string )
|
||||
uint32_t plDebugText::CalcStringWidth( const char *string )
|
||||
{
|
||||
if( IsEnabled() && fManager && string )
|
||||
return fManager->CalcStringWidth( string );
|
||||
@ -78,7 +78,7 @@ UInt32 plDebugText::CalcStringWidth( const char *string )
|
||||
// to create a background for our console; will be obliterated once we figure
|
||||
// a better way to do so.
|
||||
|
||||
void plDebugText::DrawRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor )
|
||||
void plDebugText::DrawRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor )
|
||||
{
|
||||
if( IsEnabled() && fManager )
|
||||
fManager->DrawRect( left, top, right, bottom, hexColor, fDrawOnTopMode );
|
||||
@ -86,7 +86,7 @@ void plDebugText::DrawRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bot
|
||||
|
||||
//// Draw3DBorder ////////////////////////////////////////////////////////////
|
||||
|
||||
void plDebugText::Draw3DBorder( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor1, UInt32 hexColor2 )
|
||||
void plDebugText::Draw3DBorder( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor1, uint32_t hexColor2 )
|
||||
{
|
||||
if( IsEnabled() && fManager )
|
||||
fManager->Draw3DBorder( left, top, right, bottom, hexColor1, hexColor2, fDrawOnTopMode );
|
||||
@ -94,13 +94,13 @@ void plDebugText::Draw3DBorder( UInt16 left, UInt16 top, UInt16 right, UInt16
|
||||
|
||||
//// GetScreenSize ///////////////////////////////////////////////////////////
|
||||
|
||||
void plDebugText::GetScreenSize( UInt32 *width, UInt32 *height )
|
||||
void plDebugText::GetScreenSize( uint32_t *width, uint32_t *height )
|
||||
{
|
||||
if( fManager )
|
||||
fManager->GetScreenSize( width, height );
|
||||
}
|
||||
|
||||
UInt16 plDebugText::GetFontHeight()
|
||||
uint16_t plDebugText::GetFontHeight()
|
||||
{
|
||||
if (fManager)
|
||||
return fManager->GetFontHeight();
|
||||
@ -113,7 +113,7 @@ UInt16 plDebugText::GetFontHeight()
|
||||
|
||||
//// plDebugTextNode Constructor /////////////////////////////////////////////
|
||||
|
||||
plDebugTextManager::plDebugTextNode::plDebugTextNode( const char *s, UInt32 c, UInt16 x, UInt16 y, UInt8 style )
|
||||
plDebugTextManager::plDebugTextNode::plDebugTextNode( const char *s, uint32_t c, uint16_t x, uint16_t y, uint8_t style )
|
||||
{
|
||||
HSMemory::Clear( fText, sizeof( fText ) );
|
||||
strncpy( fText, s, sizeof( fText ) - 1 );
|
||||
@ -123,7 +123,7 @@ plDebugTextManager::plDebugTextNode::plDebugTextNode( const char *s, UInt32 c, U
|
||||
fStyle = style;
|
||||
}
|
||||
|
||||
plDebugTextManager::plDebugTextNode::plDebugTextNode( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 c )
|
||||
plDebugTextManager::plDebugTextNode::plDebugTextNode( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t c )
|
||||
{
|
||||
memset( fText, 0, sizeof( fText ) );
|
||||
fColor = c;
|
||||
@ -134,7 +134,7 @@ plDebugTextManager::plDebugTextNode::plDebugTextNode( UInt16 left, UInt16 top, U
|
||||
fStyle = 0xff;
|
||||
}
|
||||
|
||||
plDebugTextManager::plDebugTextNode::plDebugTextNode( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 c1, UInt32 c2 )
|
||||
plDebugTextManager::plDebugTextNode::plDebugTextNode( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t c1, uint32_t c2 )
|
||||
{
|
||||
memset( fText, 0, sizeof( fText ) );
|
||||
fColor = c1;
|
||||
@ -156,7 +156,7 @@ plDebugTextManager::~plDebugTextManager()
|
||||
|
||||
//// AddString ///////////////////////////////////////////////////////////////
|
||||
|
||||
void plDebugTextManager::AddString( UInt16 x, UInt16 y, const char *s, UInt32 hexColor, UInt8 style, hsBool drawOnTop )
|
||||
void plDebugTextManager::AddString( uint16_t x, uint16_t y, const char *s, uint32_t hexColor, uint8_t style, hsBool drawOnTop )
|
||||
{
|
||||
if( drawOnTop )
|
||||
fDrawOnTopList.Append( plDebugTextNode( s, hexColor, x, y, style ) );
|
||||
@ -169,7 +169,7 @@ void plDebugTextManager::AddString( UInt16 x, UInt16 y, const char *s, UInt32
|
||||
// to create a background for our console; will be obliterated once we figure
|
||||
// a better way to do so.
|
||||
|
||||
void plDebugTextManager::DrawRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor, hsBool drawOnTop )
|
||||
void plDebugTextManager::DrawRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor, hsBool drawOnTop )
|
||||
{
|
||||
if( drawOnTop )
|
||||
fDrawOnTopList.Append( plDebugTextNode( left, top, right, bottom, hexColor ) );
|
||||
@ -179,7 +179,7 @@ void plDebugTextManager::DrawRect( UInt16 left, UInt16 top, UInt16 right, UIn
|
||||
|
||||
//// Draw3DBorder ////////////////////////////////////////////////////////////
|
||||
|
||||
void plDebugTextManager::Draw3DBorder( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor1, UInt32 hexColor2, hsBool drawOnTop )
|
||||
void plDebugTextManager::Draw3DBorder( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor1, uint32_t hexColor2, hsBool drawOnTop )
|
||||
{
|
||||
if( drawOnTop )
|
||||
fDrawOnTopList.Append( plDebugTextNode( left, top, right, bottom, hexColor1, hexColor2 ) );
|
||||
@ -275,7 +275,7 @@ void plDebugTextManager::DrawToDevice( plPipeline *pipe )
|
||||
|
||||
//// CalcStringWidth /////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 plDebugTextManager::CalcStringWidth( const char *string )
|
||||
uint32_t plDebugTextManager::CalcStringWidth( const char *string )
|
||||
{
|
||||
if( !plDebugText::Instance().IsEnabled() || fFont == nil )
|
||||
return 0;
|
||||
@ -285,7 +285,7 @@ UInt32 plDebugTextManager::CalcStringWidth( const char *string )
|
||||
|
||||
//// GetScreenSize ///////////////////////////////////////////////////////////
|
||||
|
||||
void plDebugTextManager::GetScreenSize( UInt32 *width, UInt32 *height )
|
||||
void plDebugTextManager::GetScreenSize( uint32_t *width, uint32_t *height )
|
||||
{
|
||||
if( width != nil )
|
||||
*width = fSWidth;
|
||||
@ -293,7 +293,7 @@ void plDebugTextManager::GetScreenSize( UInt32 *width, UInt32 *height )
|
||||
*height = fSHeight;
|
||||
}
|
||||
|
||||
UInt16 plDebugTextManager::GetFontHeight()
|
||||
uint16_t plDebugTextManager::GetFontHeight()
|
||||
{
|
||||
if (fFont)
|
||||
return fFont->GetFontHeight();
|
||||
|
@ -48,10 +48,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#ifndef _plDebugText_h
|
||||
#define _plDebugText_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "hsColorRGBA.h"
|
||||
#include "hsTemplates.h"
|
||||
#include "hsUtils.h"
|
||||
|
||||
|
||||
//// plDebugText Class Definition ////////////////////////////////////////////
|
||||
|
||||
@ -82,7 +82,7 @@ class plDebugText
|
||||
plDebugTextManager *fManager;
|
||||
|
||||
char fFontFace[ 128 ];
|
||||
UInt16 fFontSize;
|
||||
uint16_t fFontSize;
|
||||
hsBool fEnabled, fLockEnable, fDrawOnTopMode;
|
||||
|
||||
public:
|
||||
@ -97,56 +97,56 @@ class plDebugText
|
||||
|
||||
static plDebugText &Instance( void ) { return fInstance; }
|
||||
|
||||
UInt32 CalcStringWidth( const char *string );
|
||||
uint32_t CalcStringWidth( const char *string );
|
||||
|
||||
void DrawString( UInt16 x, UInt16 y, const char *string, UInt32 hexColor, UInt8 style = 0 );
|
||||
void DrawString( uint16_t x, uint16_t y, const char *string, uint32_t hexColor, uint8_t style = 0 );
|
||||
|
||||
void DrawString( UInt16 x, UInt16 y, const char *string, hsColorRGBA &color, UInt8 style = 0 )
|
||||
void DrawString( uint16_t x, uint16_t y, const char *string, hsColorRGBA &color, uint8_t style = 0 )
|
||||
{
|
||||
UInt32 hex;
|
||||
UInt8 r, g, b, a;
|
||||
uint32_t hex;
|
||||
uint8_t r, g, b, a;
|
||||
|
||||
|
||||
r = (UInt8)( color.r * 255.0 );
|
||||
g = (UInt8)( color.g * 255.0 );
|
||||
b = (UInt8)( color.b * 255.0 );
|
||||
a = (UInt8)( color.a * 255.0 );
|
||||
r = (uint8_t)( color.r * 255.0 );
|
||||
g = (uint8_t)( color.g * 255.0 );
|
||||
b = (uint8_t)( color.b * 255.0 );
|
||||
a = (uint8_t)( color.a * 255.0 );
|
||||
hex = ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b );
|
||||
|
||||
DrawString( x, y, string, hex, style );
|
||||
}
|
||||
|
||||
void DrawString( UInt16 x, UInt16 y, const char *string, UInt8 r = 255, UInt8 g = 255, UInt8 b = 255, UInt8 a = 255, UInt8 style = 0 )
|
||||
void DrawString( uint16_t x, uint16_t y, const char *string, uint8_t r = 255, uint8_t g = 255, uint8_t b = 255, uint8_t a = 255, uint8_t style = 0 )
|
||||
{
|
||||
DrawString( x, y, string, (UInt32)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ) ), style );
|
||||
DrawString( x, y, string, (uint32_t)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ) ), style );
|
||||
}
|
||||
|
||||
void SetDrawOnTopMode( hsBool enable ) { fDrawOnTopMode = enable; }
|
||||
|
||||
/// TEMPORARY FUNCTION (until we can find a better way to do this, one way or the other)
|
||||
void DrawRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor );
|
||||
void DrawRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor );
|
||||
|
||||
/// TEMPORARY FUNCTION (until we can find a better way to do this, one way or the other)
|
||||
void DrawRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt8 r, UInt8 g, UInt8 b, UInt8 a = 255 )
|
||||
void DrawRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255 )
|
||||
{
|
||||
DrawRect( left, top, right, bottom, (UInt32)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ) ) );
|
||||
DrawRect( left, top, right, bottom, (uint32_t)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | ( b ) ) );
|
||||
}
|
||||
|
||||
/// EVEN MORE TEMPORARY FUNCTION (until we can find a better way to do this, one way or the other)
|
||||
void Draw3DBorder( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor1, UInt32 hexColor2 );
|
||||
void Draw3DBorder( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor1, uint32_t hexColor2 );
|
||||
|
||||
void SetManager( plDebugTextManager *m ) { fManager = m; }
|
||||
|
||||
void SetFont(const char *face, UInt16 size ) { hsStrncpy( fFontFace, face, sizeof( fFontFace ) ); fFontSize = size; }
|
||||
void SetFont(const char *face, uint16_t size ) { hsStrncpy( fFontFace, face, sizeof( fFontFace ) ); fFontSize = size; }
|
||||
const char *GetFontFace( void ) { return fFontFace; }
|
||||
const UInt16 GetFontSize( void ) { return fFontSize; }
|
||||
UInt16 GetFontHeight();
|
||||
const uint16_t GetFontSize( void ) { return fFontSize; }
|
||||
uint16_t GetFontHeight();
|
||||
|
||||
void SetEnable( hsBool on ) { fEnabled = on; }
|
||||
void DisablePermanently( void ) { fEnabled = false; fLockEnable = true; }
|
||||
const hsBool IsEnabled( void ) { return fEnabled; }
|
||||
|
||||
void GetScreenSize( UInt32 *width, UInt32 *height );
|
||||
void GetScreenSize( uint32_t *width, uint32_t *height );
|
||||
};
|
||||
|
||||
//// plDebugTextManager Class Definition /////////////////////////////////////
|
||||
@ -160,14 +160,14 @@ class plDebugTextManager
|
||||
struct plDebugTextNode
|
||||
{
|
||||
char fText[ 256 ];
|
||||
UInt32 fColor, fDarkColor;
|
||||
UInt16 fX, fY, fRight, fBottom; // Last 2 are for rects only
|
||||
UInt8 fStyle; // 0xff means rectangle, 0xfe means 3d border
|
||||
uint32_t fColor, fDarkColor;
|
||||
uint16_t fX, fY, fRight, fBottom; // Last 2 are for rects only
|
||||
uint8_t fStyle; // 0xff means rectangle, 0xfe means 3d border
|
||||
|
||||
plDebugTextNode() { fText[ 0 ] = 0; fColor = 0; fX = fY = 0; fStyle = 0; }
|
||||
plDebugTextNode( const char *s, UInt32 c, UInt16 x, UInt16 y, UInt8 style );
|
||||
plDebugTextNode( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 c );
|
||||
plDebugTextNode( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 c1, UInt32 c2 );
|
||||
plDebugTextNode( const char *s, uint32_t c, uint16_t x, uint16_t y, uint8_t style );
|
||||
plDebugTextNode( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t c );
|
||||
plDebugTextNode( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t c1, uint32_t c2 );
|
||||
~plDebugTextNode() {;}
|
||||
};
|
||||
|
||||
@ -175,27 +175,27 @@ class plDebugTextManager
|
||||
hsTArray<plDebugTextNode> fDrawOnTopList;
|
||||
|
||||
plTextFont *fFont;
|
||||
UInt32 fSWidth, fSHeight;
|
||||
uint32_t fSWidth, fSHeight;
|
||||
|
||||
public:
|
||||
|
||||
plDebugTextManager() { plDebugText::Instance().SetManager( this ); fFont = nil; }
|
||||
~plDebugTextManager();
|
||||
|
||||
void AddString( UInt16 x, UInt16 y, const char *s, UInt32 hexColor, UInt8 style, hsBool drawOnTop = false );
|
||||
UInt32 CalcStringWidth( const char *string );
|
||||
void AddString( uint16_t x, uint16_t y, const char *s, uint32_t hexColor, uint8_t style, hsBool drawOnTop = false );
|
||||
uint32_t CalcStringWidth( const char *string );
|
||||
|
||||
/// TEMPORARY FUNCTION (until we can find a better way to do this, one way or the other)
|
||||
void DrawRect( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor, hsBool drawOnTop = false );
|
||||
void DrawRect( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor, hsBool drawOnTop = false );
|
||||
|
||||
/// EVEN MORE TEMPORARY FUNCTION (until we can find a better way to do this, one way or the other)
|
||||
void Draw3DBorder( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom, UInt32 hexColor1, UInt32 hexColor2, hsBool drawOnTop = false );
|
||||
void Draw3DBorder( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint32_t hexColor1, uint32_t hexColor2, hsBool drawOnTop = false );
|
||||
|
||||
void DrawToDevice( plPipeline *pipe );
|
||||
|
||||
void GetScreenSize( UInt32 *width, UInt32 *height );
|
||||
void GetScreenSize( uint32_t *width, uint32_t *height );
|
||||
|
||||
UInt16 GetFontHeight();
|
||||
uint16_t GetFontHeight();
|
||||
};
|
||||
|
||||
|
||||
|
@ -60,9 +60,9 @@ public:
|
||||
kTypeSplatList = 0x2
|
||||
};
|
||||
protected:
|
||||
UInt32 fPrimType;
|
||||
uint32_t fPrimType;
|
||||
|
||||
UInt32 fDrawProps;
|
||||
uint32_t fDrawProps;
|
||||
|
||||
hsGMaterial* fMaterial;
|
||||
|
||||
@ -73,8 +73,8 @@ public:
|
||||
virtual const hsBounds3Ext& GetLocalBounds() const = 0;
|
||||
|
||||
hsGMaterial* GetMaterial() { return fMaterial; }
|
||||
UInt32 GetPrimType() { return fPrimType; }
|
||||
UInt32 GetDrawProps() { return fDrawProps; }
|
||||
uint32_t GetPrimType() { return fPrimType; }
|
||||
uint32_t GetDrawProps() { return fDrawProps; }
|
||||
};
|
||||
|
||||
class plTriListPrim : public plDrawPrim
|
||||
|
@ -40,7 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plDynamicEnvMap.h"
|
||||
|
||||
#include "plPipeline.h"
|
||||
@ -82,12 +82,12 @@ plDynamicEnvMap::plDynamicEnvMap()
|
||||
fColor.Set(0,0,0,1.f);
|
||||
int i;
|
||||
for( i = 0; i < 6; i++ )
|
||||
fReqMsgs[i] = TRACKED_NEW plRenderRequestMsg(nil, &fReqs[i]);;
|
||||
fReqMsgs[i] = new plRenderRequestMsg(nil, &fReqs[i]);;
|
||||
|
||||
SetPosition(fPos);
|
||||
}
|
||||
|
||||
plDynamicEnvMap::plDynamicEnvMap(UInt16 width, UInt16 height, UInt8 bitDepth, UInt8 zDepth, UInt8 sDepth)
|
||||
plDynamicEnvMap::plDynamicEnvMap(uint16_t width, uint16_t height, uint8_t bitDepth, uint8_t zDepth, uint8_t sDepth)
|
||||
: fPos(0,0,0),
|
||||
fHither(0.3f),
|
||||
fYon(0.f), // yon < hither means ignore and use current settings
|
||||
@ -103,7 +103,7 @@ plDynamicEnvMap::plDynamicEnvMap(UInt16 width, UInt16 height, UInt8 bitDepth, UI
|
||||
fColor.Set(0,0,0,1.f);
|
||||
int i;
|
||||
for( i = 0; i < 6; i++ )
|
||||
fReqMsgs[i] = TRACKED_NEW plRenderRequestMsg(nil, &fReqs[i]);;
|
||||
fReqMsgs[i] = new plRenderRequestMsg(nil, &fReqs[i]);;
|
||||
|
||||
SetPosition(fPos);
|
||||
}
|
||||
@ -155,17 +155,17 @@ void plDynamicEnvMap::IUpdatePosition()
|
||||
SetCameraMatrix(fPos);
|
||||
}
|
||||
|
||||
void plDynamicEnvMap::SetHither(hsScalar f)
|
||||
void plDynamicEnvMap::SetHither(float f)
|
||||
{
|
||||
fHither = f;
|
||||
}
|
||||
|
||||
void plDynamicEnvMap::SetYon(hsScalar f)
|
||||
void plDynamicEnvMap::SetYon(float f)
|
||||
{
|
||||
fYon = f;
|
||||
}
|
||||
|
||||
void plDynamicEnvMap::SetFogStart(hsScalar f)
|
||||
void plDynamicEnvMap::SetFogStart(float f)
|
||||
{
|
||||
fFogStart = f;
|
||||
}
|
||||
@ -175,7 +175,7 @@ void plDynamicEnvMap::SetColor(const hsColorRGBA& col)
|
||||
fColor = col;
|
||||
}
|
||||
|
||||
void plDynamicEnvMap::SetRefreshRate(hsScalar secs)
|
||||
void plDynamicEnvMap::SetRefreshRate(float secs)
|
||||
{
|
||||
fRefreshRate = secs / 6.f;
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey());
|
||||
@ -183,7 +183,7 @@ void plDynamicEnvMap::SetRefreshRate(hsScalar secs)
|
||||
|
||||
void plDynamicEnvMap::ISetupRenderRequests()
|
||||
{
|
||||
UInt32 renderState
|
||||
uint32_t renderState
|
||||
= plPipeline::kRenderNormal
|
||||
| plPipeline::kRenderClearColor
|
||||
| plPipeline::kRenderClearDepth;
|
||||
@ -408,14 +408,14 @@ void plDynamicEnvMap::SetIncludeCharacters(hsBool b)
|
||||
|
||||
void plDynamicEnvMap::AddVisRegion(plVisRegion* reg)
|
||||
{
|
||||
plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefVisSet);
|
||||
plGenRefMsg* msg = new plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefVisSet);
|
||||
hsgResMgr::ResMgr()->AddViaNotify(reg->GetKey(), msg, plRefFlags::kActiveRef);
|
||||
}
|
||||
|
||||
void plDynamicEnvMap::Read(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
hsKeyedObject::Read(s, mgr);
|
||||
UInt32 sz = plCubicRenderTarget::Read(s);
|
||||
uint32_t sz = plCubicRenderTarget::Read(s);
|
||||
|
||||
fPos.Read(s);
|
||||
fHither = s->ReadLEScalar();
|
||||
@ -434,17 +434,17 @@ void plDynamicEnvMap::Read(hsStream* s, hsResMgr* mgr)
|
||||
int nVis = s->ReadLE32();
|
||||
int i;
|
||||
for( i = 0; i < nVis; i++ )
|
||||
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisSet), plRefFlags::kActiveRef);
|
||||
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisSet), plRefFlags::kActiveRef);
|
||||
|
||||
nVis = s->ReadLE32();
|
||||
for( i = 0; i < nVis; i++)
|
||||
{
|
||||
plKey key = plKeyFinder::Instance().StupidSearch(nil, nil, plVisRegion::Index(), s->ReadSafeString_TEMP());
|
||||
if (key)
|
||||
hsgResMgr::ResMgr()->AddViaNotify(key, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisSet), plRefFlags::kActiveRef);
|
||||
hsgResMgr::ResMgr()->AddViaNotify(key, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisSet), plRefFlags::kActiveRef);
|
||||
}
|
||||
|
||||
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefRootNode), plRefFlags::kActiveRef);
|
||||
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefRootNode), plRefFlags::kActiveRef);
|
||||
|
||||
Init();
|
||||
}
|
||||
@ -453,7 +453,7 @@ void plDynamicEnvMap::Write(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
hsKeyedObject::Write(s, mgr);
|
||||
|
||||
UInt32 sz = plCubicRenderTarget::Write(s);
|
||||
uint32_t sz = plCubicRenderTarget::Write(s);
|
||||
|
||||
fPos.Write(s);
|
||||
s->WriteLEScalar(fHither);
|
||||
@ -482,7 +482,7 @@ void plDynamicEnvMap::Write(hsStream* s, hsResMgr* mgr)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
UInt8 plDynamicCamMap::fFlags = kReflectionEnabled | kReflectionCapable;
|
||||
uint8_t plDynamicCamMap::fFlags = kReflectionEnabled | kReflectionCapable;
|
||||
|
||||
plDynamicCamMap::plDynamicCamMap() :
|
||||
fHither(0.3f),
|
||||
@ -497,10 +497,10 @@ fIncCharacters(false),
|
||||
fDisableTexture(nil)
|
||||
{
|
||||
fColor.Set(0,0,0,1.f);
|
||||
fReqMsg = TRACKED_NEW plRenderRequestMsg(nil, &fReq);
|
||||
fReqMsg = new plRenderRequestMsg(nil, &fReq);
|
||||
}
|
||||
|
||||
plDynamicCamMap::plDynamicCamMap(UInt16 width, UInt16 height, UInt8 bitDepth, UInt8 zDepth, UInt8 sDepth) :
|
||||
plDynamicCamMap::plDynamicCamMap(uint16_t width, uint16_t height, uint8_t bitDepth, uint8_t zDepth, uint8_t sDepth) :
|
||||
fHither(0.3f),
|
||||
fYon(-1.f),
|
||||
fFogStart(-1.f),
|
||||
@ -514,7 +514,7 @@ fDisableTexture(nil),
|
||||
plRenderTarget(plRenderTarget::kIsTexture, width, height, bitDepth, zDepth, sDepth)
|
||||
{
|
||||
fColor.Set(0,0,0,1.f);
|
||||
fReqMsg = TRACKED_NEW plRenderRequestMsg(nil, &fReq);
|
||||
fReqMsg = new plRenderRequestMsg(nil, &fReq);
|
||||
}
|
||||
|
||||
plDynamicCamMap::~plDynamicCamMap()
|
||||
@ -537,7 +537,7 @@ void plDynamicCamMap::Init()
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey());
|
||||
}
|
||||
|
||||
void plDynamicCamMap::SetRefreshRate(hsScalar secs)
|
||||
void plDynamicCamMap::SetRefreshRate(float secs)
|
||||
{
|
||||
fRefreshRate = secs;
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey());
|
||||
@ -733,13 +733,13 @@ void plDynamicCamMap::IPrepTextureLayers()
|
||||
{
|
||||
fMatLayers[i]->SetUVWSrc(plLayerInterface::kUVWPosition);
|
||||
fMatLayers[i]->SetMiscFlags(hsGMatState::kMiscCam2Screen | hsGMatState::kMiscPerspProjection);
|
||||
hsgResMgr::ResMgr()->SendRef(GetKey(), TRACKED_NEW plGenRefMsg(fMatLayers[i]->GetKey(), plRefMsg::kOnRequest, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef);
|
||||
hsgResMgr::ResMgr()->SendRef(GetKey(), new plGenRefMsg(fMatLayers[i]->GetKey(), plRefMsg::kOnRequest, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef);
|
||||
}
|
||||
else
|
||||
{
|
||||
fMatLayers[i]->SetUVWSrc(0);
|
||||
fMatLayers[i]->SetMiscFlags(0);
|
||||
hsgResMgr::ResMgr()->SendRef(fDisableTexture->GetKey(), TRACKED_NEW plGenRefMsg(fMatLayers[i]->GetKey(), plRefMsg::kOnRequest, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef);
|
||||
hsgResMgr::ResMgr()->SendRef(fDisableTexture->GetKey(), new plGenRefMsg(fMatLayers[i]->GetKey(), plRefMsg::kOnRequest, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -861,7 +861,7 @@ void plDynamicCamMap::SetIncludeCharacters(hsBool b)
|
||||
|
||||
void plDynamicCamMap::AddVisRegion(plVisRegion* reg)
|
||||
{
|
||||
hsgResMgr::ResMgr()->AddViaNotify( reg->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plGenRefMsg::kOnReplace, -1, kRefVisSet ), plRefFlags::kActiveRef );
|
||||
hsgResMgr::ResMgr()->AddViaNotify( reg->GetKey(), new plGenRefMsg( GetKey(), plGenRefMsg::kOnReplace, -1, kRefVisSet ), plRefFlags::kActiveRef );
|
||||
}
|
||||
|
||||
void plDynamicCamMap::SetEnabled(hsBool enable)
|
||||
@ -893,32 +893,32 @@ void plDynamicCamMap::Read(hsStream* s, hsResMgr* mgr)
|
||||
fRefreshRate = s->ReadLEScalar();
|
||||
fIncCharacters = s->ReadBool();
|
||||
SetIncludeCharacters(fIncCharacters);
|
||||
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefCamera), plRefFlags::kPassiveRef);
|
||||
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefRootNode), plRefFlags::kActiveRef);
|
||||
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefCamera), plRefFlags::kPassiveRef);
|
||||
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefRootNode), plRefFlags::kActiveRef);
|
||||
|
||||
int numTargs = s->ReadByte();
|
||||
int i;
|
||||
for (i = 0; i < numTargs; i++)
|
||||
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, kRefTargetNode), plRefFlags::kPassiveRef);
|
||||
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, kRefTargetNode), plRefFlags::kPassiveRef);
|
||||
|
||||
int nVis = s->ReadLE32();
|
||||
for( i = 0; i < nVis; i++ )
|
||||
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefVisSet), plRefFlags::kActiveRef);
|
||||
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefVisSet), plRefFlags::kActiveRef);
|
||||
|
||||
nVis = s->ReadLE32();
|
||||
for( i = 0; i < nVis; i++)
|
||||
{
|
||||
plKey key = plKeyFinder::Instance().StupidSearch(nil, nil, plVisRegion::Index(), s->ReadSafeString_TEMP());
|
||||
if (key)
|
||||
hsgResMgr::ResMgr()->AddViaNotify(key, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisSet), plRefFlags::kActiveRef);
|
||||
hsgResMgr::ResMgr()->AddViaNotify(key, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefVisSet), plRefFlags::kActiveRef);
|
||||
}
|
||||
|
||||
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefDisableTexture), plRefFlags::kActiveRef);
|
||||
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefDisableTexture), plRefFlags::kActiveRef);
|
||||
|
||||
UInt8 numLayers = s->ReadByte();
|
||||
uint8_t numLayers = s->ReadByte();
|
||||
for (i = 0; i < numLayers; i++)
|
||||
{
|
||||
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatLayer), plRefFlags::kPassiveRef);
|
||||
mgr->ReadKeyNotifyMe(s, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefMatLayer), plRefFlags::kPassiveRef);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
@ -72,12 +72,12 @@ protected:
|
||||
|
||||
plSceneObject* fRootNode;
|
||||
hsPoint3 fPos;
|
||||
hsScalar fHither;
|
||||
hsScalar fYon;
|
||||
hsScalar fFogStart;
|
||||
float fHither;
|
||||
float fYon;
|
||||
float fFogStart;
|
||||
hsColorRGBA fColor;
|
||||
|
||||
hsScalar fRefreshRate;
|
||||
float fRefreshRate;
|
||||
double fLastRefresh;
|
||||
int fLastRender;
|
||||
int fOutStanding;
|
||||
@ -99,7 +99,7 @@ protected:
|
||||
|
||||
public:
|
||||
plDynamicEnvMap();
|
||||
plDynamicEnvMap(UInt16 width, UInt16 height, UInt8 bitDepth, UInt8 zDepth = -1, UInt8 sDepth = -1);
|
||||
plDynamicEnvMap(uint16_t width, uint16_t height, uint8_t bitDepth, uint8_t zDepth = -1, uint8_t sDepth = -1);
|
||||
|
||||
virtual ~plDynamicEnvMap();
|
||||
|
||||
@ -116,18 +116,18 @@ public:
|
||||
void Init();
|
||||
|
||||
void SetPosition(const hsPoint3& pos);
|
||||
void SetHither(hsScalar f);
|
||||
void SetYon(hsScalar f);
|
||||
void SetFogStart(hsScalar f);
|
||||
void SetHither(float f);
|
||||
void SetYon(float f);
|
||||
void SetFogStart(float f);
|
||||
void SetColor(const hsColorRGBA& col);
|
||||
void SetRefreshRate(hsScalar secs);
|
||||
void SetRefreshRate(float secs);
|
||||
|
||||
hsPoint3 GetPosition() const;
|
||||
hsScalar GetHither() const { return fHither; }
|
||||
hsScalar GetYon() const { return fYon; }
|
||||
hsScalar GetFogStart() const { return fFogStart; }
|
||||
float GetHither() const { return fHither; }
|
||||
float GetYon() const { return fYon; }
|
||||
float GetFogStart() const { return fFogStart; }
|
||||
hsColorRGBA GetColor() const { return fColor; }
|
||||
hsScalar GetRefreshRate() const { return 6.f * fRefreshRate; }
|
||||
float GetRefreshRate() const { return 6.f * fRefreshRate; }
|
||||
|
||||
void AddVisRegion(plVisRegion* reg); // Will just send a ref
|
||||
|
||||
@ -153,16 +153,16 @@ public:
|
||||
kRefMatLayer,
|
||||
};
|
||||
|
||||
hsScalar fHither;
|
||||
hsScalar fYon;
|
||||
hsScalar fFogStart;
|
||||
float fHither;
|
||||
float fYon;
|
||||
float fFogStart;
|
||||
hsColorRGBA fColor;
|
||||
|
||||
protected:
|
||||
plRenderRequest fReq;
|
||||
plRenderRequestMsg* fReqMsg;
|
||||
|
||||
hsScalar fRefreshRate;
|
||||
float fRefreshRate;
|
||||
double fLastRefresh;
|
||||
int fOutStanding;
|
||||
|
||||
@ -177,7 +177,7 @@ protected:
|
||||
// Extra info for swapping around textures when reflections are disabled.
|
||||
plBitmap* fDisableTexture;
|
||||
hsTArray<plLayer*> fMatLayers;
|
||||
static UInt8 fFlags;
|
||||
static uint8_t fFlags;
|
||||
enum
|
||||
{
|
||||
kReflectionCapable = 0x01,
|
||||
@ -196,7 +196,7 @@ protected:
|
||||
|
||||
public:
|
||||
plDynamicCamMap();
|
||||
plDynamicCamMap(UInt16 width, UInt16 height, UInt8 bitDepth, UInt8 zDepth = -1, UInt8 sDepth = -1);
|
||||
plDynamicCamMap(uint16_t width, uint16_t height, uint8_t bitDepth, uint8_t zDepth = -1, uint8_t sDepth = -1);
|
||||
|
||||
virtual ~plDynamicCamMap();
|
||||
|
||||
@ -212,7 +212,7 @@ public:
|
||||
void Init();
|
||||
|
||||
void SetIncludeCharacters(hsBool b);
|
||||
void SetRefreshRate(hsScalar secs);
|
||||
void SetRefreshRate(float secs);
|
||||
void AddVisRegion(plVisRegion* reg);
|
||||
void SetVisRegionName(char *name){ fVisRegionNames.Push(name); }
|
||||
|
||||
|
@ -47,6 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "plFogEnvironment.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "plTweak.h"
|
||||
|
||||
//// Constructors & Destructor ///////////////////////////////////////////////
|
||||
@ -56,12 +57,12 @@ plFogEnvironment::plFogEnvironment()
|
||||
fType = kNoFog;
|
||||
}
|
||||
|
||||
plFogEnvironment::plFogEnvironment( hsScalar start, hsScalar end, hsScalar density, hsColorRGBA &color )
|
||||
plFogEnvironment::plFogEnvironment( float start, float end, float density, hsColorRGBA &color )
|
||||
{
|
||||
Set( start, end, density, &color );
|
||||
}
|
||||
|
||||
plFogEnvironment::plFogEnvironment( FogType type, hsScalar end, hsScalar density, hsColorRGBA &color )
|
||||
plFogEnvironment::plFogEnvironment( FogType type, float end, float density, hsColorRGBA &color )
|
||||
{
|
||||
SetExp( type, end, density, &color );
|
||||
}
|
||||
@ -72,7 +73,7 @@ plFogEnvironment::~plFogEnvironment()
|
||||
|
||||
//// Set /////////////////////////////////////////////////////////////////////
|
||||
|
||||
void plFogEnvironment::Set( hsScalar start, hsScalar end, hsScalar density, const hsColorRGBA *color )
|
||||
void plFogEnvironment::Set( float start, float end, float density, const hsColorRGBA *color )
|
||||
{
|
||||
if( density <= 0.f )
|
||||
{
|
||||
@ -92,7 +93,7 @@ void plFogEnvironment::Set( hsScalar start, hsScalar end, hsScalar density, c
|
||||
fColor = *color;
|
||||
}
|
||||
|
||||
void plFogEnvironment::SetExp( FogType type, hsScalar end, hsScalar density, const hsColorRGBA *color )
|
||||
void plFogEnvironment::SetExp( FogType type, float end, float density, const hsColorRGBA *color )
|
||||
{
|
||||
hsAssert( type == kExpFog || type == kExp2Fog, "Invalid fog type passed to plFogEnvironment" );
|
||||
if( density <= 0.f )
|
||||
@ -117,7 +118,7 @@ void plFogEnvironment::SetExp( FogType type, hsScalar end, hsScalar density,
|
||||
// Gets the parameters. Sets start to 0 if the type is not linear (can be
|
||||
// nil).
|
||||
|
||||
void plFogEnvironment::GetParameters( hsScalar *start, hsScalar *end, hsScalar *density, hsColorRGBA *color )
|
||||
void plFogEnvironment::GetParameters( float *start, float *end, float *density, hsColorRGBA *color )
|
||||
{
|
||||
hsAssert( fType != kLinearFog || start != nil, "Trying to get non-linear paramters on linear fog!" );
|
||||
hsAssert( end != nil && density != nil && color != nil, "Bad pointer to plFogEnvironment::GetParameters()" );
|
||||
@ -138,7 +139,7 @@ void plFogEnvironment::GetParameters( hsScalar *start, hsScalar *end, hsScala
|
||||
// scale our end value out by the density. The whole formula is:
|
||||
// pipelineEnd = ( end - start ) / density + start
|
||||
|
||||
void plFogEnvironment::GetPipelineParams( hsScalar *start, hsScalar *end, hsColorRGBA *color )
|
||||
void plFogEnvironment::GetPipelineParams( float *start, float *end, hsColorRGBA *color )
|
||||
{
|
||||
// hsAssert( fType == kLinearFog, "Getting linear pipeline params on non-linear fog!" );
|
||||
|
||||
@ -173,7 +174,7 @@ void plFogEnvironment::GetPipelineParams( hsScalar *start, hsScalar *end, hsC
|
||||
// to modulate the density by the end value so that it actually ends at the
|
||||
// right spot.
|
||||
|
||||
void plFogEnvironment::GetPipelineParams( hsScalar *density, hsColorRGBA *color )
|
||||
void plFogEnvironment::GetPipelineParams( float *density, hsColorRGBA *color )
|
||||
{
|
||||
const float ln256 = logf( 256.f );
|
||||
const float sqrtLn256 = sqrtf( ln256 );
|
||||
|
@ -49,10 +49,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#define _plFogEnvironment_h
|
||||
|
||||
#include "pnKeyedObject/hsKeyedObject.h"
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "hsColorRGBA.h"
|
||||
#include "hsTemplates.h"
|
||||
#include "hsUtils.h"
|
||||
|
||||
|
||||
|
||||
//// plFogEnvironment Class Definition ////////////////////////////////////////////
|
||||
@ -62,9 +62,9 @@ class plFogEnvironment : public hsKeyedObject
|
||||
{
|
||||
protected:
|
||||
|
||||
UInt8 fType;
|
||||
hsScalar fStart; // Used for linear fog only
|
||||
hsScalar fEnd, fDensity; // Always used!
|
||||
uint8_t fType;
|
||||
float fStart; // Used for linear fog only
|
||||
float fEnd, fDensity; // Always used!
|
||||
hsColorRGBA fColor;
|
||||
|
||||
public:
|
||||
@ -81,15 +81,15 @@ class plFogEnvironment : public hsKeyedObject
|
||||
};
|
||||
|
||||
plFogEnvironment();
|
||||
plFogEnvironment( hsScalar start, hsScalar end, hsScalar density, hsColorRGBA &color );
|
||||
plFogEnvironment( FogType type, hsScalar end, hsScalar density, hsColorRGBA &color );
|
||||
plFogEnvironment( float start, float end, float density, hsColorRGBA &color );
|
||||
plFogEnvironment( FogType type, float end, float density, hsColorRGBA &color );
|
||||
~plFogEnvironment();
|
||||
|
||||
// Sets the parameters for linear fog
|
||||
void Set( hsScalar start, hsScalar end, hsScalar density, const hsColorRGBA *color = nil );
|
||||
void Set( float start, float end, float density, const hsColorRGBA *color = nil );
|
||||
|
||||
// Sets the parameters for exp or exp^2 fog
|
||||
void SetExp( FogType type, hsScalar end, hsScalar density, const hsColorRGBA *color = nil );
|
||||
void SetExp( FogType type, float end, float density, const hsColorRGBA *color = nil );
|
||||
|
||||
// Sets the color
|
||||
void SetColor( hsColorRGBA &color ) { fColor = color; }
|
||||
@ -98,19 +98,19 @@ class plFogEnvironment : public hsKeyedObject
|
||||
void Clear( void ) { fType = kNoFog; }
|
||||
|
||||
// Gets the type
|
||||
UInt8 GetType( void ) { return fType; }
|
||||
uint8_t GetType( void ) { return fType; }
|
||||
|
||||
// Gets the color
|
||||
hsColorRGBA &GetColor( void ) { return fColor; }
|
||||
|
||||
// Gets the parameters. Sets start to 0 if the type is not linear (can be nil)
|
||||
void GetParameters( hsScalar *start, hsScalar *end, hsScalar *density, hsColorRGBA *color );
|
||||
void GetParameters( float *start, float *end, float *density, hsColorRGBA *color );
|
||||
|
||||
// Gets linear pipeline (DX) specific parameters.
|
||||
void GetPipelineParams( hsScalar *start, hsScalar *end, hsColorRGBA *color );
|
||||
void GetPipelineParams( float *start, float *end, hsColorRGBA *color );
|
||||
|
||||
// Gets exp or exp^2 pipeline (DX) specific parameters.
|
||||
void GetPipelineParams( hsScalar *density, hsColorRGBA *color );
|
||||
void GetPipelineParams( float *density, hsColorRGBA *color );
|
||||
|
||||
virtual void Read(hsStream *s, hsResMgr *mgr);
|
||||
virtual void Write(hsStream *s, hsResMgr *mgr);
|
||||
|
@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsWindows.h"
|
||||
|
||||
#include "HeadSpin.h"
|
||||
#include "plGBufferGroup.h"
|
||||
#include "hsStream.h"
|
||||
@ -68,8 +68,8 @@ plProfile_CreateMemCounter("Buf Group Indices", "Memory", MemBufGrpIndex);
|
||||
plProfile_CreateTimer("Refill Vertex", "Draw", DrawRefillVertex);
|
||||
plProfile_CreateTimer("Refill Index", "Draw", DrawRefillIndex);
|
||||
|
||||
const UInt32 plGBufferGroup::kMaxNumVertsPerBuffer = 32000;
|
||||
const UInt32 plGBufferGroup::kMaxNumIndicesPerBuffer = 32000;
|
||||
const uint32_t plGBufferGroup::kMaxNumVertsPerBuffer = 32000;
|
||||
const uint32_t plGBufferGroup::kMaxNumIndicesPerBuffer = 32000;
|
||||
|
||||
|
||||
//// plGBufferTriangle Read and Write /////////////////////////////////////////
|
||||
@ -110,7 +110,7 @@ void plGBufferCell::Write( hsStream *s )
|
||||
|
||||
//// Constructor //////////////////////////////////////////////////////////////
|
||||
|
||||
plGBufferGroup::plGBufferGroup( UInt8 format, hsBool vertsVolatile, hsBool idxVolatile, int LOD )
|
||||
plGBufferGroup::plGBufferGroup( uint8_t format, hsBool vertsVolatile, hsBool idxVolatile, int LOD )
|
||||
{
|
||||
fVertBuffStorage.Reset();
|
||||
fIdxBuffStorage.Reset();
|
||||
@ -131,7 +131,7 @@ plGBufferGroup::plGBufferGroup( UInt8 format, hsBool vertsVolatile, hsBool idxVo
|
||||
|
||||
plGBufferGroup::~plGBufferGroup()
|
||||
{
|
||||
UInt32 i;
|
||||
uint32_t i;
|
||||
|
||||
CleanUp();
|
||||
|
||||
@ -168,7 +168,7 @@ void plGBufferGroup::TidyUp( void )
|
||||
*/
|
||||
}
|
||||
|
||||
void plGBufferGroup::PurgeVertBuffer(UInt32 idx)
|
||||
void plGBufferGroup::PurgeVertBuffer(uint32_t idx)
|
||||
{
|
||||
if( AreVertsVolatile() )
|
||||
return;
|
||||
@ -190,7 +190,7 @@ void plGBufferGroup::PurgeVertBuffer(UInt32 idx)
|
||||
return;
|
||||
}
|
||||
|
||||
void plGBufferGroup::PurgeIndexBuffer(UInt32 idx)
|
||||
void plGBufferGroup::PurgeIndexBuffer(uint32_t idx)
|
||||
{
|
||||
if( AreIdxVolatile() )
|
||||
return;
|
||||
@ -213,7 +213,7 @@ void plGBufferGroup::CleanUp( void )
|
||||
}
|
||||
for( i = 0; i < fIdxBuffStorage.GetCount(); i++ )
|
||||
{
|
||||
plProfile_DelMem(MemBufGrpIndex, fIdxBuffCounts[i] * sizeof(UInt16));
|
||||
plProfile_DelMem(MemBufGrpIndex, fIdxBuffCounts[i] * sizeof(uint16_t));
|
||||
delete [] fIdxBuffStorage[ i ];
|
||||
}
|
||||
for( i = 0; i < fColorBuffStorage.GetCount(); i++ )
|
||||
@ -241,7 +241,7 @@ void plGBufferGroup::CleanUp( void )
|
||||
|
||||
//// SetVertexBufferRef ///////////////////////////////////////////////////////
|
||||
|
||||
void plGBufferGroup::SetVertexBufferRef( UInt32 index, hsGDeviceRef *vb )
|
||||
void plGBufferGroup::SetVertexBufferRef( uint32_t index, hsGDeviceRef *vb )
|
||||
{
|
||||
hsAssert( index < fVertexBufferRefs.GetCount() + 1, "Vertex buffers must be assigned linearly!" );
|
||||
|
||||
@ -259,7 +259,7 @@ void plGBufferGroup::SetVertexBufferRef( UInt32 index, hsGDeviceRef *vb )
|
||||
|
||||
//// SetIndexBufferRef ////////////////////////////////////////////////////////
|
||||
|
||||
void plGBufferGroup::SetIndexBufferRef( UInt32 index, hsGDeviceRef *ib )
|
||||
void plGBufferGroup::SetIndexBufferRef( uint32_t index, hsGDeviceRef *ib )
|
||||
{
|
||||
hsAssert( index < fIndexBufferRefs.GetCount() + 1, "Index buffers must be assigned linearly!" );
|
||||
|
||||
@ -286,7 +286,7 @@ void plGBufferGroup::PrepForRendering( plPipeline *pipe, hsBool adjustForNvid
|
||||
|
||||
}
|
||||
|
||||
hsGDeviceRef* plGBufferGroup::GetVertexBufferRef(UInt32 i)
|
||||
hsGDeviceRef* plGBufferGroup::GetVertexBufferRef(uint32_t i)
|
||||
{
|
||||
if( i >= fVertexBufferRefs.GetCount() )
|
||||
fVertexBufferRefs.ExpandAndZero(i+1);
|
||||
@ -294,7 +294,7 @@ hsGDeviceRef* plGBufferGroup::GetVertexBufferRef(UInt32 i)
|
||||
return fVertexBufferRefs[i];
|
||||
}
|
||||
|
||||
hsGDeviceRef* plGBufferGroup::GetIndexBufferRef(UInt32 i)
|
||||
hsGDeviceRef* plGBufferGroup::GetIndexBufferRef(uint32_t i)
|
||||
{
|
||||
if( i >= fIndexBufferRefs.GetCount() )
|
||||
fIndexBufferRefs.ExpandAndZero(i+1);
|
||||
@ -329,9 +329,9 @@ void plGBufferGroup::ISendStorageToBuffers( plPipeline *pipe, hsBool adjustFo
|
||||
|
||||
//// ICalcVertexSize //////////////////////////////////////////////////////////
|
||||
|
||||
UInt8 plGBufferGroup::ICalcVertexSize( UInt8 &liteStride )
|
||||
uint8_t plGBufferGroup::ICalcVertexSize( uint8_t &liteStride )
|
||||
{
|
||||
UInt8 size;
|
||||
uint8_t size;
|
||||
|
||||
|
||||
size = sizeof( float ) * ( 3 + 3 ); // pos + normal
|
||||
@ -349,7 +349,7 @@ UInt8 plGBufferGroup::ICalcVertexSize( UInt8 &liteStride )
|
||||
{
|
||||
size += sizeof( float ) * fNumSkinWeights;
|
||||
if( fFormat & kSkinIndices )
|
||||
size += sizeof( UInt32 );
|
||||
size += sizeof( uint32_t );
|
||||
}
|
||||
|
||||
liteStride = size;
|
||||
@ -361,9 +361,9 @@ UInt8 plGBufferGroup::ICalcVertexSize( UInt8 &liteStride )
|
||||
|
||||
void plGBufferGroup::Read( hsStream *s )
|
||||
{
|
||||
UInt32 totalDynSize, i, count, temp = 0, j;
|
||||
UInt8 *vData;
|
||||
UInt16 *iData;
|
||||
uint32_t totalDynSize, i, count, temp = 0, j;
|
||||
uint8_t *vData;
|
||||
uint16_t *iData;
|
||||
plGBufferColor *cData;
|
||||
|
||||
|
||||
@ -388,14 +388,14 @@ void plGBufferGroup::Read( hsStream *s )
|
||||
{
|
||||
if( fFormat & kEncoded )
|
||||
{
|
||||
const UInt16 numVerts = s->ReadLE16();
|
||||
const UInt32 size = numVerts * fStride;
|
||||
const uint16_t numVerts = s->ReadLE16();
|
||||
const uint32_t size = numVerts * fStride;
|
||||
|
||||
fVertBuffSizes.Append(size);
|
||||
fVertBuffStarts.Append(0);
|
||||
fVertBuffEnds.Append(-1);
|
||||
|
||||
vData = TRACKED_NEW UInt8[size];
|
||||
vData = new uint8_t[size];
|
||||
fVertBuffStorage.Append( vData );
|
||||
plProfile_NewMem(MemBufGrpVertex, temp);
|
||||
|
||||
@ -413,7 +413,7 @@ void plGBufferGroup::Read( hsStream *s )
|
||||
fVertBuffStarts.Append(0);
|
||||
fVertBuffEnds.Append(-1);
|
||||
|
||||
vData = TRACKED_NEW UInt8[ temp ];
|
||||
vData = new uint8_t[ temp ];
|
||||
hsAssert( vData != nil, "Not enough memory to read in vertices" );
|
||||
s->Read( temp, (void *)vData );
|
||||
fVertBuffStorage.Append( vData );
|
||||
@ -424,7 +424,7 @@ void plGBufferGroup::Read( hsStream *s )
|
||||
|
||||
if( temp > 0 )
|
||||
{
|
||||
cData = TRACKED_NEW plGBufferColor[ temp ];
|
||||
cData = new plGBufferColor[ temp ];
|
||||
s->Read( temp * sizeof( plGBufferColor ), (void *)cData );
|
||||
plProfile_NewMem(MemBufGrpVertex, temp * sizeof(plGBufferColor));
|
||||
}
|
||||
@ -443,11 +443,11 @@ void plGBufferGroup::Read( hsStream *s )
|
||||
fIdxBuffStarts.Append(0);
|
||||
fIdxBuffEnds.Append(-1);
|
||||
|
||||
iData = TRACKED_NEW UInt16[ temp ];
|
||||
iData = new uint16_t[ temp ];
|
||||
hsAssert( iData != nil, "Not enough memory to read in indices" );
|
||||
s->ReadLE16( temp, (UInt16 *)iData );
|
||||
s->ReadLE16( temp, (uint16_t *)iData );
|
||||
fIdxBuffStorage.Append( iData );
|
||||
plProfile_NewMem(MemBufGrpIndex, temp * sizeof(UInt16));
|
||||
plProfile_NewMem(MemBufGrpIndex, temp * sizeof(uint16_t));
|
||||
}
|
||||
|
||||
/// Read in cell arrays, one per vBuffer
|
||||
@ -455,7 +455,7 @@ void plGBufferGroup::Read( hsStream *s )
|
||||
{
|
||||
temp = s->ReadLE32();
|
||||
|
||||
fCells.Append( TRACKED_NEW hsTArray<plGBufferCell> );
|
||||
fCells.Append( new hsTArray<plGBufferCell> );
|
||||
fCells[ i ]->SetCount( temp );
|
||||
|
||||
for( j = 0; j < temp; j++ )
|
||||
@ -468,7 +468,7 @@ void plGBufferGroup::Read( hsStream *s )
|
||||
|
||||
void plGBufferGroup::Write( hsStream *s )
|
||||
{
|
||||
UInt32 totalDynSize, i, j;
|
||||
uint32_t totalDynSize, i, j;
|
||||
|
||||
#define MF_VERTCODE_ENABLED
|
||||
#ifdef MF_VERTCODE_ENABLED
|
||||
@ -485,7 +485,7 @@ void plGBufferGroup::Write( hsStream *s )
|
||||
for( i = 0; i < fVertBuffSizes.GetCount(); i++ )
|
||||
totalDynSize += fVertBuffSizes[ i ];
|
||||
for( i = 0; i < fIdxBuffCounts.GetCount(); i++ )
|
||||
totalDynSize += sizeof( UInt16 ) * fIdxBuffCounts[ i ];
|
||||
totalDynSize += sizeof( uint16_t ) * fIdxBuffCounts[ i ];
|
||||
|
||||
s->WriteLE( fFormat );
|
||||
s->WriteLE32( totalDynSize );
|
||||
@ -493,15 +493,15 @@ void plGBufferGroup::Write( hsStream *s )
|
||||
plVertCoder coder;
|
||||
|
||||
/// Write out dyanmic data
|
||||
s->WriteLE32( (UInt32)fVertBuffStorage.GetCount() );
|
||||
s->WriteLE32( (uint32_t)fVertBuffStorage.GetCount() );
|
||||
for( i = 0; i < fVertBuffStorage.GetCount(); i++ )
|
||||
{
|
||||
#ifdef MF_VERTCODE_ENABLED
|
||||
|
||||
hsAssert(fCells[i]->GetCount() == 1, "Data must be interleaved for compression");
|
||||
UInt32 numVerts = fVertBuffSizes[i] / fStride;
|
||||
s->WriteLE16((UInt16)numVerts);
|
||||
coder.Write(s, fVertBuffStorage[i], fFormat, fStride, (UInt16)numVerts);
|
||||
uint32_t numVerts = fVertBuffSizes[i] / fStride;
|
||||
s->WriteLE16((uint16_t)numVerts);
|
||||
coder.Write(s, fVertBuffStorage[i], fFormat, fStride, (uint16_t)numVerts);
|
||||
|
||||
#ifdef VERT_LOG
|
||||
char buf[256];
|
||||
@ -528,7 +528,7 @@ void plGBufferGroup::Write( hsStream *s )
|
||||
#endif // MF_VERTCODE_ENABLED
|
||||
}
|
||||
|
||||
s->WriteLE32( (UInt32)fIdxBuffCounts.GetCount() );
|
||||
s->WriteLE32( (uint32_t)fIdxBuffCounts.GetCount() );
|
||||
for( i = 0; i < fIdxBuffStorage.GetCount(); i++ )
|
||||
{
|
||||
s->WriteLE32( fIdxBuffCounts[ i ] );
|
||||
@ -561,10 +561,10 @@ void plGBufferGroup::Write( hsStream *s )
|
||||
// Note 2: for simplicity sake, we only do this for groups with ONE interleaved
|
||||
// cell. Doing this for multiple separated cells would be, literally, hell.
|
||||
|
||||
void plGBufferGroup::DeleteVertsFromStorage( UInt32 which, UInt32 start, UInt32 length )
|
||||
void plGBufferGroup::DeleteVertsFromStorage( uint32_t which, uint32_t start, uint32_t length )
|
||||
{
|
||||
UInt8 *dstPtr, *srcPtr;
|
||||
UInt32 amount;
|
||||
uint8_t *dstPtr, *srcPtr;
|
||||
uint32_t amount;
|
||||
|
||||
|
||||
hsAssert( fCells[ which ]->GetCount() == 1, "Cannot delete verts on a mixed buffer group" );
|
||||
@ -600,7 +600,7 @@ void plGBufferGroup::DeleteVertsFromStorage( UInt32 which, UInt32 start, UInt
|
||||
// Adjusts indices >= a given threshold by a given delta. Use it to adjust
|
||||
// indices after vertex deletion. Affects only the given buffer.
|
||||
|
||||
void plGBufferGroup::AdjustIndicesInStorage( UInt32 which, UInt16 threshhold, Int16 delta )
|
||||
void plGBufferGroup::AdjustIndicesInStorage( uint32_t which, uint16_t threshhold, int16_t delta )
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -620,10 +620,10 @@ void plGBufferGroup::AdjustIndicesInStorage( UInt32 which, UInt16 threshhold,
|
||||
// Deletes a span of indices from the index storage. Remember to Prep this
|
||||
// group after doing this!
|
||||
|
||||
void plGBufferGroup::DeleteIndicesFromStorage( UInt32 which, UInt32 start, UInt32 length )
|
||||
void plGBufferGroup::DeleteIndicesFromStorage( uint32_t which, uint32_t start, uint32_t length )
|
||||
{
|
||||
UInt16 *dstPtr, *srcPtr;
|
||||
UInt32 amount;
|
||||
uint16_t *dstPtr, *srcPtr;
|
||||
uint32_t amount;
|
||||
|
||||
|
||||
hsAssert( start + length <= fIdxBuffCounts[ which ], "Illegal range to DeleteIndicesFromStorage()" );
|
||||
@ -635,11 +635,11 @@ void plGBufferGroup::DeleteIndicesFromStorage( UInt32 which, UInt32 start, UI
|
||||
|
||||
amount = fIdxBuffCounts[ which ] - ( start + length );
|
||||
|
||||
memmove( dstPtr, srcPtr, amount * sizeof( UInt16 ) );
|
||||
memmove( dstPtr, srcPtr, amount * sizeof( uint16_t ) );
|
||||
}
|
||||
|
||||
fIdxBuffCounts[ which ] -= length;
|
||||
plProfile_DelMem(MemBufGrpIndex, length * sizeof(UInt16));
|
||||
plProfile_DelMem(MemBufGrpIndex, length * sizeof(uint16_t));
|
||||
|
||||
if( fIndexBufferRefs.GetCount() > which && fIndexBufferRefs[ which ] != nil )
|
||||
{
|
||||
@ -652,7 +652,7 @@ void plGBufferGroup::DeleteIndicesFromStorage( UInt32 which, UInt32 start, UI
|
||||
//// GetNumPrimaryVertsLeft ///////////////////////////////////////////////////
|
||||
// Base on the cells, so we can take instanced cells into account
|
||||
|
||||
UInt32 plGBufferGroup::GetNumPrimaryVertsLeft( void ) const
|
||||
uint32_t plGBufferGroup::GetNumPrimaryVertsLeft( void ) const
|
||||
{
|
||||
return GetNumVertsLeft( 0 );
|
||||
}
|
||||
@ -660,12 +660,12 @@ UInt32 plGBufferGroup::GetNumPrimaryVertsLeft( void ) const
|
||||
//// GetNumVertsLeft //////////////////////////////////////////////////////////
|
||||
// Base on the cells, so we can take instanced cells into account
|
||||
|
||||
UInt32 plGBufferGroup::GetNumVertsLeft( UInt32 idx ) const
|
||||
uint32_t plGBufferGroup::GetNumVertsLeft( uint32_t idx ) const
|
||||
{
|
||||
if( idx >= fCells.GetCount() )
|
||||
return kMaxNumVertsPerBuffer;
|
||||
|
||||
UInt32 i, total = kMaxNumVertsPerBuffer;
|
||||
uint32_t i, total = kMaxNumVertsPerBuffer;
|
||||
|
||||
|
||||
for( i = 0; i < fCells[ idx ]->GetCount(); i++ )
|
||||
@ -677,7 +677,7 @@ UInt32 plGBufferGroup::GetNumVertsLeft( UInt32 idx ) const
|
||||
//// IMakeCell ////////////////////////////////////////////////////////////////
|
||||
// Get a cell from the given cell array.
|
||||
|
||||
UInt32 plGBufferGroup::IMakeCell( UInt32 vbIndex, UInt8 flags, UInt32 vStart, UInt32 cStart, UInt32 len, UInt32 *offset )
|
||||
uint32_t plGBufferGroup::IMakeCell( uint32_t vbIndex, uint8_t flags, uint32_t vStart, uint32_t cStart, uint32_t len, uint32_t *offset )
|
||||
{
|
||||
hsTArray<plGBufferCell> *cells = fCells[ vbIndex ];
|
||||
|
||||
@ -692,20 +692,20 @@ UInt32 plGBufferGroup::IMakeCell( UInt32 vbIndex, UInt8 flags, UInt32 vStart, U
|
||||
if( flags & kReserveSeparated )
|
||||
cells->Append( plGBufferCell( vStart, cStart, len ) );
|
||||
else
|
||||
cells->Append( plGBufferCell( (UInt32)-1, cStart, len ) );
|
||||
cells->Append( plGBufferCell( (uint32_t)-1, cStart, len ) );
|
||||
*offset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Merge if the last cell was an interleaved cell
|
||||
if( cells->GetCount() > 0 && (*cells)[ cells->GetCount() - 1 ].fColorStart == (UInt32)-1 )
|
||||
if( cells->GetCount() > 0 && (*cells)[ cells->GetCount() - 1 ].fColorStart == (uint32_t)-1 )
|
||||
{
|
||||
*offset = (*cells)[ cells->GetCount() - 1 ].fLength;
|
||||
(*cells)[ cells->GetCount() - 1 ].fLength += len;
|
||||
}
|
||||
else
|
||||
{
|
||||
cells->Append( plGBufferCell( vStart, (UInt32)-1, len ) );
|
||||
cells->Append( plGBufferCell( vStart, (uint32_t)-1, len ) );
|
||||
*offset = 0;
|
||||
}
|
||||
}
|
||||
@ -718,10 +718,10 @@ UInt32 plGBufferGroup::IMakeCell( UInt32 vbIndex, UInt8 flags, UInt32 vStart, U
|
||||
// and starting position. Basically does what AppendToVertStorage() used to
|
||||
// do except it doesn't actually copy any data into the space reserved.
|
||||
|
||||
hsBool plGBufferGroup::ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset, UInt8 flags )
|
||||
hsBool plGBufferGroup::ReserveVertStorage( uint32_t numVerts, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset, uint8_t flags )
|
||||
{
|
||||
UInt8 *storagePtr = nil;
|
||||
UInt32 cStartIdx = 0, vStartIdx = 0;
|
||||
uint8_t *storagePtr = nil;
|
||||
uint32_t cStartIdx = 0, vStartIdx = 0;
|
||||
plGBufferColor *cStoragePtr = nil;
|
||||
int i;
|
||||
|
||||
@ -758,7 +758,7 @@ hsBool plGBufferGroup::ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UI
|
||||
fColorBuffStorage.Append( nil );
|
||||
fColorBuffCounts.Append( 0 );
|
||||
|
||||
fCells.Append( TRACKED_NEW hsTArray<plGBufferCell> );
|
||||
fCells.Append( new hsTArray<plGBufferCell> );
|
||||
}
|
||||
|
||||
*vbIndex = i;
|
||||
@ -770,7 +770,7 @@ hsBool plGBufferGroup::ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UI
|
||||
{
|
||||
/// Increase the storage size
|
||||
vStartIdx = fVertBuffSizes[ i ];
|
||||
storagePtr = TRACKED_NEW UInt8[ fVertBuffSizes[ i ] + numVerts * fLiteStride ];
|
||||
storagePtr = new uint8_t[ fVertBuffSizes[ i ] + numVerts * fLiteStride ];
|
||||
if( fVertBuffSizes[ i ] > 0 )
|
||||
memcpy( storagePtr, fVertBuffStorage[ i ], fVertBuffSizes[ i ] );
|
||||
fVertBuffSizes[ i ] += numVerts * fLiteStride;
|
||||
@ -779,7 +779,7 @@ hsBool plGBufferGroup::ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UI
|
||||
|
||||
/// Color too
|
||||
cStartIdx = fColorBuffCounts[ i ];
|
||||
cStoragePtr = TRACKED_NEW plGBufferColor[ fColorBuffCounts[ i ] + numVerts ];
|
||||
cStoragePtr = new plGBufferColor[ fColorBuffCounts[ i ] + numVerts ];
|
||||
if( fColorBuffCounts[ i ] > 0 )
|
||||
memcpy( cStoragePtr, fColorBuffStorage[ i ], fColorBuffCounts[ i ] * sizeof( plGBufferColor ) );
|
||||
}
|
||||
@ -789,7 +789,7 @@ hsBool plGBufferGroup::ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UI
|
||||
|
||||
/// Increase the storage size
|
||||
vStartIdx = fVertBuffSizes[ i ];
|
||||
storagePtr = TRACKED_NEW UInt8[ fVertBuffSizes[ i ] + numVerts * fStride ];
|
||||
storagePtr = new uint8_t[ fVertBuffSizes[ i ] + numVerts * fStride ];
|
||||
if( fVertBuffSizes[ i ] > 0 )
|
||||
memcpy( storagePtr, fVertBuffStorage[ i ], fVertBuffSizes[ i ] );
|
||||
fVertBuffSizes[ i ] += numVerts * fStride;
|
||||
@ -836,7 +836,7 @@ hsBool plGBufferGroup::ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UI
|
||||
// same format.
|
||||
// Updated 6.15.2001 mcn to use ReserveVertStorage().
|
||||
|
||||
void plGBufferGroup::AppendToVertStorage( plGeometrySpan *srcSpan, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset )
|
||||
void plGBufferGroup::AppendToVertStorage( plGeometrySpan *srcSpan, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset )
|
||||
{
|
||||
if( !ReserveVertStorage( srcSpan->fNumVerts, vbIndex, cell, offset, kReserveInterleaved ) )
|
||||
return;
|
||||
@ -848,7 +848,7 @@ void plGBufferGroup::AppendToVertStorage( plGeometrySpan *srcSpan, UInt32 *vb
|
||||
// Same as AppendToVertStorage(), but writes only the verts to the vertex
|
||||
// storage and the colors to the separate color storage.
|
||||
|
||||
void plGBufferGroup::AppendToVertAndColorStorage( plGeometrySpan *srcSpan, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset )
|
||||
void plGBufferGroup::AppendToVertAndColorStorage( plGeometrySpan *srcSpan, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset )
|
||||
{
|
||||
if( !ReserveVertStorage( srcSpan->fNumVerts, vbIndex, cell, offset, kReserveSeparated ) )
|
||||
return;
|
||||
@ -859,7 +859,7 @@ void plGBufferGroup::AppendToVertAndColorStorage( plGeometrySpan *srcSpan, UI
|
||||
//// AppendToColorStorage /////////////////////////////////////////////////////
|
||||
// Same as AppendToVertStorage(), but writes JUST to color storage.
|
||||
|
||||
void plGBufferGroup::AppendToColorStorage( plGeometrySpan *srcSpan, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset, UInt32 origCell )
|
||||
void plGBufferGroup::AppendToColorStorage( plGeometrySpan *srcSpan, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset, uint32_t origCell )
|
||||
{
|
||||
if( !ReserveVertStorage( srcSpan->fNumVerts, vbIndex, cell, offset, kReserveColors ) )
|
||||
return;
|
||||
@ -872,7 +872,7 @@ void plGBufferGroup::AppendToColorStorage( plGeometrySpan *srcSpan, UInt32 *v
|
||||
//// IGetStartVtxPointer //////////////////////////////////////////////////////
|
||||
// Get the start vertex and color buffer pointers for a given cell and offset
|
||||
|
||||
void plGBufferGroup::IGetStartVtxPointer( UInt32 vbIndex, UInt32 cell, UInt32 offset, UInt8 *&tempPtr, plGBufferColor *&cPtr )
|
||||
void plGBufferGroup::IGetStartVtxPointer( uint32_t vbIndex, uint32_t cell, uint32_t offset, uint8_t *&tempPtr, plGBufferColor *&cPtr )
|
||||
{
|
||||
hsAssert( vbIndex < fVertBuffStorage.GetCount(), "Invalid vbIndex in StuffToVertStorage()" );
|
||||
hsAssert( cell < fCells[ vbIndex ]->GetCount(), "Invalid cell in StuffToVertStorage()" );
|
||||
@ -885,23 +885,23 @@ void plGBufferGroup::IGetStartVtxPointer( UInt32 vbIndex, UInt32 cell, UInt32
|
||||
|
||||
if( offset > 0 )
|
||||
{
|
||||
tempPtr += offset * ( ( (*fCells[ vbIndex ])[ cell ].fColorStart == (UInt32)-1 ) ? fStride : fLiteStride );
|
||||
tempPtr += offset * ( ( (*fCells[ vbIndex ])[ cell ].fColorStart == (uint32_t)-1 ) ? fStride : fLiteStride );
|
||||
cPtr += offset;
|
||||
}
|
||||
}
|
||||
|
||||
//// GetVertBufferCount ///////////////////////////////////////////////////////
|
||||
|
||||
UInt32 plGBufferGroup::GetVertBufferCount( UInt32 idx ) const
|
||||
uint32_t plGBufferGroup::GetVertBufferCount( uint32_t idx ) const
|
||||
{
|
||||
return GetVertStartFromCell( idx, fCells[ idx ]->GetCount(), 0 );
|
||||
}
|
||||
|
||||
//// GetVertStartFromCell /////////////////////////////////////////////////////
|
||||
|
||||
UInt32 plGBufferGroup::GetVertStartFromCell( UInt32 vbIndex, UInt32 cell, UInt32 offset ) const
|
||||
uint32_t plGBufferGroup::GetVertStartFromCell( uint32_t vbIndex, uint32_t cell, uint32_t offset ) const
|
||||
{
|
||||
UInt32 i, numVerts;
|
||||
uint32_t i, numVerts;
|
||||
|
||||
|
||||
hsAssert( vbIndex < fVertBuffStorage.GetCount(), "Invalid vbIndex in StuffToVertStorage()" );
|
||||
@ -920,9 +920,9 @@ UInt32 plGBufferGroup::GetVertStartFromCell( UInt32 vbIndex, UInt32 cell, UInt3
|
||||
// Stuffs data from a plGeometrySpan into the specified location in the
|
||||
// specified vertex buffer.
|
||||
|
||||
void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIndex, UInt32 cell, UInt32 offset, UInt8 flags )
|
||||
void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, uint32_t vbIndex, uint32_t cell, uint32_t offset, uint8_t flags )
|
||||
{
|
||||
UInt8 *tempPtr, stride;
|
||||
uint8_t *tempPtr, stride;
|
||||
plGBufferColor *cPtr;
|
||||
int i, j, numVerts;
|
||||
plGBufferCell *cellPtr;
|
||||
@ -933,7 +933,7 @@ void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIn
|
||||
|
||||
IGetStartVtxPointer( vbIndex, cell, offset, tempPtr, cPtr );
|
||||
cellPtr = &(*fCells[ vbIndex ])[ cell ];
|
||||
stride = ( cellPtr->fColorStart != (UInt32)-1 ) ? fLiteStride : fStride;
|
||||
stride = ( cellPtr->fColorStart != (uint32_t)-1 ) ? fLiteStride : fStride;
|
||||
|
||||
numVerts = srcSpan->fNumVerts;
|
||||
|
||||
@ -942,12 +942,12 @@ void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIn
|
||||
{
|
||||
hsPoint3 pos;
|
||||
float weights[ 3 ];
|
||||
UInt32 weightIndices;
|
||||
uint32_t weightIndices;
|
||||
hsVector3 norm;
|
||||
UInt32 color, specColor;
|
||||
uint32_t color, specColor;
|
||||
hsPoint3 uvs[ plGeometrySpan::kMaxNumUVChannels ];
|
||||
float *fPtr;
|
||||
UInt32 *dPtr;
|
||||
uint32_t *dPtr;
|
||||
|
||||
|
||||
// Gotta swap the data around, since plGeometrySpans store the data slightly differently
|
||||
@ -985,7 +985,7 @@ void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIn
|
||||
|
||||
if( fNumSkinWeights > 1 )
|
||||
{
|
||||
dPtr = (UInt32 *)fPtr;
|
||||
dPtr = (uint32_t *)fPtr;
|
||||
*dPtr = weightIndices;
|
||||
|
||||
dPtr++;
|
||||
@ -1000,7 +1000,7 @@ void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIn
|
||||
|
||||
if( flags & kReserveInterleaved )
|
||||
{
|
||||
dPtr = (UInt32 *)fPtr;
|
||||
dPtr = (uint32_t *)fPtr;
|
||||
dPtr[ 0 ] = color;
|
||||
dPtr[ 1 ] = specColor;
|
||||
dPtr += 2;
|
||||
@ -1033,9 +1033,9 @@ void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIn
|
||||
//// ReserveIndexStorage //////////////////////////////////////////////////////
|
||||
// Same as ReserveVertStorage(), only for indices :)
|
||||
|
||||
hsBool plGBufferGroup::ReserveIndexStorage( UInt32 numIndices, UInt32 *ibIndex, UInt32 *ibStart, UInt16 **dataPtr )
|
||||
hsBool plGBufferGroup::ReserveIndexStorage( uint32_t numIndices, uint32_t *ibIndex, uint32_t *ibStart, uint16_t **dataPtr )
|
||||
{
|
||||
UInt16 *storagePtr;
|
||||
uint16_t *storagePtr;
|
||||
int i;
|
||||
|
||||
|
||||
@ -1065,9 +1065,9 @@ hsBool plGBufferGroup::ReserveIndexStorage( UInt32 numIndices, UInt32 *ibIndex,
|
||||
*ibStart = fIdxBuffCounts[ i ];
|
||||
|
||||
/// Increase the storage size
|
||||
storagePtr = TRACKED_NEW UInt16[ fIdxBuffCounts[ i ] + numIndices ];
|
||||
storagePtr = new uint16_t[ fIdxBuffCounts[ i ] + numIndices ];
|
||||
if( fIdxBuffCounts[ i ] > 0 )
|
||||
memcpy( storagePtr, fIdxBuffStorage[ i ], fIdxBuffCounts[ i ] * sizeof( UInt16 ) );
|
||||
memcpy( storagePtr, fIdxBuffStorage[ i ], fIdxBuffCounts[ i ] * sizeof( uint16_t ) );
|
||||
|
||||
if( dataPtr != nil )
|
||||
*dataPtr = storagePtr + fIdxBuffCounts[ i ];
|
||||
@ -1078,7 +1078,7 @@ hsBool plGBufferGroup::ReserveIndexStorage( UInt32 numIndices, UInt32 *ibIndex,
|
||||
delete [] fIdxBuffStorage[ i ];
|
||||
fIdxBuffStorage[ i ] = storagePtr;
|
||||
fIdxBuffCounts[ i ] += numIndices;
|
||||
plProfile_NewMem(MemBufGrpIndex, numIndices * sizeof(UInt16));
|
||||
plProfile_NewMem(MemBufGrpIndex, numIndices * sizeof(uint16_t));
|
||||
|
||||
/// All done!
|
||||
if( fIndexBufferRefs.GetCount() > i && fIndexBufferRefs[ i ] != nil )
|
||||
@ -1093,10 +1093,10 @@ hsBool plGBufferGroup::ReserveIndexStorage( UInt32 numIndices, UInt32 *ibIndex,
|
||||
//// AppendToIndexStorage /////////////////////////////////////////////////////
|
||||
// Same as AppendToVertStorage, only for the index buffers and indices. Duh :)
|
||||
|
||||
void plGBufferGroup::AppendToIndexStorage( UInt32 numIndices, UInt16 *data, UInt32 addToAll,
|
||||
UInt32 *ibIndex, UInt32 *ibStart )
|
||||
void plGBufferGroup::AppendToIndexStorage( uint32_t numIndices, uint16_t *data, uint32_t addToAll,
|
||||
uint32_t *ibIndex, uint32_t *ibStart )
|
||||
{
|
||||
UInt16 *tempPtr;
|
||||
uint16_t *tempPtr;
|
||||
int i;
|
||||
|
||||
|
||||
@ -1105,7 +1105,7 @@ void plGBufferGroup::AppendToIndexStorage( UInt32 numIndices, UInt16 *data, U
|
||||
|
||||
/// Copy new indices over, offsetting them as we were told to
|
||||
for( i = 0; i < numIndices; i++ )
|
||||
tempPtr[ i ] = data[ i ] + (UInt16)addToAll;
|
||||
tempPtr[ i ] = data[ i ] + (uint16_t)addToAll;
|
||||
|
||||
/// All done!
|
||||
}
|
||||
@ -1114,15 +1114,15 @@ void plGBufferGroup::AppendToIndexStorage( UInt32 numIndices, UInt16 *data, U
|
||||
// Returns an array of plGBufferTriangles representing the span of indices
|
||||
// specified.
|
||||
|
||||
plGBufferTriangle *plGBufferGroup::ConvertToTriList( Int16 spanIndex, UInt32 whichIdx, UInt32 whichVtx, UInt32 whichCell, UInt32 start, UInt32 numTriangles )
|
||||
plGBufferTriangle *plGBufferGroup::ConvertToTriList( int16_t spanIndex, uint32_t whichIdx, uint32_t whichVtx, uint32_t whichCell, uint32_t start, uint32_t numTriangles )
|
||||
{
|
||||
plGBufferTriangle *array;
|
||||
UInt16 *storagePtr;
|
||||
UInt8 *vertStgPtr, stride;
|
||||
uint16_t *storagePtr;
|
||||
uint8_t *vertStgPtr, stride;
|
||||
float *vertPtr;
|
||||
int i, j;
|
||||
hsPoint3 center;
|
||||
UInt32 offsetBy;
|
||||
uint32_t offsetBy;
|
||||
plGBufferColor *wastePtr;
|
||||
|
||||
|
||||
@ -1134,13 +1134,13 @@ plGBufferTriangle *plGBufferGroup::ConvertToTriList( Int16 spanIndex, UInt32 w
|
||||
hsAssert( whichCell < fCells[ whichVtx ]->GetCount(), "Invalid cell to ConvertToTriList()" );
|
||||
|
||||
/// Create the array and fill it
|
||||
array = TRACKED_NEW plGBufferTriangle[ numTriangles ];
|
||||
array = new plGBufferTriangle[ numTriangles ];
|
||||
hsAssert( array != nil, "Not enough memory to create triangle data in ConvertToTriList()" );
|
||||
|
||||
storagePtr = fIdxBuffStorage[ whichIdx ];
|
||||
IGetStartVtxPointer( whichVtx, whichCell, 0, vertStgPtr, wastePtr );
|
||||
offsetBy = GetVertStartFromCell( whichVtx, whichCell, 0 );
|
||||
stride = ( (*fCells[ whichVtx ])[ whichCell ].fColorStart == (UInt32)-1 ) ? fStride : fLiteStride;
|
||||
stride = ( (*fCells[ whichVtx ])[ whichCell ].fColorStart == (uint32_t)-1 ) ? fStride : fLiteStride;
|
||||
|
||||
for( i = 0, j = 0; i < numTriangles; i++, j += 3 )
|
||||
{
|
||||
@ -1183,9 +1183,9 @@ plGBufferTriangle *plGBufferGroup::ConvertToTriList( Int16 spanIndex, UInt32 w
|
||||
// Stuffs the indices from an array of plGBufferTriangles into the index
|
||||
// storage.
|
||||
|
||||
void plGBufferGroup::StuffFromTriList( UInt32 which, UInt32 start, UInt32 numTriangles, UInt16 *data )
|
||||
void plGBufferGroup::StuffFromTriList( uint32_t which, uint32_t start, uint32_t numTriangles, uint16_t *data )
|
||||
{
|
||||
UInt16 *storagePtr;
|
||||
uint16_t *storagePtr;
|
||||
|
||||
|
||||
/// Sanity checks
|
||||
@ -1217,7 +1217,7 @@ void plGBufferGroup::StuffFromTriList( UInt32 which, UInt32 start, UInt32 num
|
||||
|
||||
//// StuffTri /////////////////////////////////////////////////////////////////
|
||||
|
||||
void plGBufferGroup::StuffTri( UInt32 iBuff, UInt32 iTri, UInt16 idx0, UInt16 idx1, UInt16 idx2 )
|
||||
void plGBufferGroup::StuffTri( uint32_t iBuff, uint32_t iTri, uint16_t idx0, uint16_t idx1, uint16_t idx2 )
|
||||
{
|
||||
/// Sanity checks
|
||||
hsAssert( iBuff < fIdxBuffStorage.GetCount(), "Invalid index buffer ID to StuffFromTriList()" );
|
||||
@ -1231,9 +1231,9 @@ void plGBufferGroup::StuffTri( UInt32 iBuff, UInt32 iTri, UInt16 idx0, UInt16
|
||||
|
||||
//// Accessor Functions ///////////////////////////////////////////////////////
|
||||
|
||||
hsPoint3 &plGBufferGroup::Position( int iBuff, UInt32 cell, int iVtx )
|
||||
hsPoint3 &plGBufferGroup::Position( int iBuff, uint32_t cell, int iVtx )
|
||||
{
|
||||
UInt8 *vertStgPtr;
|
||||
uint8_t *vertStgPtr;
|
||||
plGBufferColor *cPtr;
|
||||
|
||||
IGetStartVtxPointer( iBuff, cell, iVtx, vertStgPtr, cPtr );
|
||||
@ -1241,9 +1241,9 @@ hsPoint3 &plGBufferGroup::Position( int iBuff, UInt32 cell, int iVtx )
|
||||
return *(hsPoint3 *)( vertStgPtr + 0 );
|
||||
}
|
||||
|
||||
hsVector3 &plGBufferGroup::Normal( int iBuff, UInt32 cell, int iVtx )
|
||||
hsVector3 &plGBufferGroup::Normal( int iBuff, uint32_t cell, int iVtx )
|
||||
{
|
||||
UInt8 *vertStgPtr;
|
||||
uint8_t *vertStgPtr;
|
||||
plGBufferColor *cPtr;
|
||||
|
||||
IGetStartVtxPointer( iBuff, cell, iVtx, vertStgPtr, cPtr );
|
||||
@ -1251,43 +1251,43 @@ hsVector3 &plGBufferGroup::Normal( int iBuff, UInt32 cell, int iVtx )
|
||||
return *(hsVector3 *)( vertStgPtr + sizeof( hsPoint3 ) );
|
||||
}
|
||||
|
||||
UInt32 &plGBufferGroup::Color( int iBuff, UInt32 cell, int iVtx )
|
||||
uint32_t &plGBufferGroup::Color( int iBuff, uint32_t cell, int iVtx )
|
||||
{
|
||||
UInt8 *vertStgPtr;
|
||||
uint8_t *vertStgPtr;
|
||||
plGBufferColor *cPtr;
|
||||
|
||||
IGetStartVtxPointer( iBuff, cell, iVtx, vertStgPtr, cPtr );
|
||||
|
||||
if( (*fCells[ iBuff ])[ cell ].fColorStart != (UInt32)-1 )
|
||||
return *(UInt32 *)( &cPtr->fDiffuse );
|
||||
if( (*fCells[ iBuff ])[ cell ].fColorStart != (uint32_t)-1 )
|
||||
return *(uint32_t *)( &cPtr->fDiffuse );
|
||||
else
|
||||
return *(UInt32 *)( vertStgPtr + 2 * sizeof( hsPoint3 ) );
|
||||
return *(uint32_t *)( vertStgPtr + 2 * sizeof( hsPoint3 ) );
|
||||
}
|
||||
|
||||
UInt32 &plGBufferGroup::Specular( int iBuff, UInt32 cell, int iVtx )
|
||||
uint32_t &plGBufferGroup::Specular( int iBuff, uint32_t cell, int iVtx )
|
||||
{
|
||||
UInt8 *vertStgPtr;
|
||||
uint8_t *vertStgPtr;
|
||||
plGBufferColor *cPtr;
|
||||
|
||||
IGetStartVtxPointer( iBuff, cell, iVtx, vertStgPtr, cPtr );
|
||||
|
||||
if( (*fCells[ iBuff ])[ cell ].fColorStart != (UInt32)-1 )
|
||||
return *(UInt32 *)( &cPtr->fSpecular );
|
||||
if( (*fCells[ iBuff ])[ cell ].fColorStart != (uint32_t)-1 )
|
||||
return *(uint32_t *)( &cPtr->fSpecular );
|
||||
else
|
||||
return *(UInt32 *)( vertStgPtr + 2 * sizeof( hsPoint3 ) );
|
||||
return *(uint32_t *)( vertStgPtr + 2 * sizeof( hsPoint3 ) );
|
||||
}
|
||||
|
||||
hsPoint3 &plGBufferGroup::UV( int iBuff, UInt32 cell, int iVtx, int channel )
|
||||
hsPoint3 &plGBufferGroup::UV( int iBuff, uint32_t cell, int iVtx, int channel )
|
||||
{
|
||||
UInt8 *vertStgPtr;
|
||||
uint8_t *vertStgPtr;
|
||||
plGBufferColor *cPtr;
|
||||
|
||||
IGetStartVtxPointer( iBuff, cell, iVtx, vertStgPtr, cPtr );
|
||||
|
||||
vertStgPtr += 2 * sizeof( hsPoint3 ) + channel * sizeof( hsPoint3 );
|
||||
|
||||
if( (*fCells[ iBuff ])[ cell ].fColorStart != (UInt32)-1 )
|
||||
if( (*fCells[ iBuff ])[ cell ].fColorStart != (uint32_t)-1 )
|
||||
return *(hsPoint3 *)( vertStgPtr );
|
||||
else
|
||||
return *(hsPoint3 *)( vertStgPtr + 2 * sizeof( UInt32 ) );
|
||||
return *(hsPoint3 *)( vertStgPtr + 2 * sizeof( uint32_t ) );
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
class plGBufferTriangle
|
||||
{
|
||||
public:
|
||||
UInt16 fIndex1, fIndex2, fIndex3, fSpanIndex;
|
||||
uint16_t fIndex1, fIndex2, fIndex3, fSpanIndex;
|
||||
hsPoint3 fCenter;
|
||||
|
||||
void Read( hsStream *s );
|
||||
@ -78,11 +78,11 @@ class plGBufferTriangle
|
||||
class plGBufferCell
|
||||
{
|
||||
public:
|
||||
UInt32 fVtxStart; // In bytes
|
||||
UInt32 fColorStart; // In bytes
|
||||
UInt32 fLength;
|
||||
uint32_t fVtxStart; // In bytes
|
||||
uint32_t fColorStart; // In bytes
|
||||
uint32_t fLength;
|
||||
|
||||
plGBufferCell( UInt32 vStart, UInt32 cStart, UInt32 len )
|
||||
plGBufferCell( uint32_t vStart, uint32_t cStart, uint32_t len )
|
||||
{
|
||||
fVtxStart = vStart; fColorStart = cStart; fLength = len;
|
||||
}
|
||||
@ -96,7 +96,7 @@ class plGBufferCell
|
||||
class plGBufferColor
|
||||
{
|
||||
public:
|
||||
UInt32 fDiffuse, fSpecular;
|
||||
uint32_t fDiffuse, fSpecular;
|
||||
};
|
||||
|
||||
//// plGBufferGroup Class Definition //////////////////////////////////////////
|
||||
@ -112,12 +112,12 @@ class plGeometrySpan;
|
||||
class plGBufferGroup
|
||||
{
|
||||
protected:
|
||||
UInt8 fFormat;
|
||||
UInt8 fStride;
|
||||
UInt8 fLiteStride;
|
||||
UInt8 fNumSkinWeights;
|
||||
UInt32 fNumVerts;
|
||||
UInt32 fNumIndices;
|
||||
uint8_t fFormat;
|
||||
uint8_t fStride;
|
||||
uint8_t fLiteStride;
|
||||
uint8_t fNumSkinWeights;
|
||||
uint32_t fNumVerts;
|
||||
uint32_t fNumIndices;
|
||||
hsBool fVertsVolatile;
|
||||
hsBool fIdxVolatile;
|
||||
int fLOD;
|
||||
@ -125,16 +125,16 @@ class plGBufferGroup
|
||||
hsTArray<hsGDeviceRef *> fVertexBufferRefs;
|
||||
hsTArray<hsGDeviceRef *> fIndexBufferRefs;
|
||||
|
||||
hsTArray<UInt32> fVertBuffSizes;
|
||||
hsTArray<UInt32> fIdxBuffCounts;
|
||||
hsTArray<UInt32> fColorBuffCounts;
|
||||
hsTArray<UInt8 *> fVertBuffStorage;
|
||||
hsTArray<UInt16 *> fIdxBuffStorage;
|
||||
hsTArray<uint32_t> fVertBuffSizes;
|
||||
hsTArray<uint32_t> fIdxBuffCounts;
|
||||
hsTArray<uint32_t> fColorBuffCounts;
|
||||
hsTArray<uint8_t *> fVertBuffStorage;
|
||||
hsTArray<uint16_t *> fIdxBuffStorage;
|
||||
|
||||
hsTArray<UInt32> fVertBuffStarts;
|
||||
hsTArray<Int32> fVertBuffEnds;
|
||||
hsTArray<UInt32> fIdxBuffStarts;
|
||||
hsTArray<Int32> fIdxBuffEnds;
|
||||
hsTArray<uint32_t> fVertBuffStarts;
|
||||
hsTArray<int32_t> fVertBuffEnds;
|
||||
hsTArray<uint32_t> fIdxBuffStarts;
|
||||
hsTArray<int32_t> fIdxBuffEnds;
|
||||
|
||||
hsTArray<plGBufferColor *> fColorBuffStorage;
|
||||
|
||||
@ -142,17 +142,17 @@ class plGBufferGroup
|
||||
|
||||
virtual void ISendStorageToBuffers( plPipeline *pipe, hsBool adjustForNvidiaLighting );
|
||||
|
||||
UInt8 ICalcVertexSize( UInt8 &liteStride );
|
||||
uint8_t ICalcVertexSize( uint8_t &liteStride );
|
||||
|
||||
UInt8* IVertBuffStorage(int iBuff, int iVtx) const { return fVertBuffStorage[iBuff] + iVtx*fStride; }
|
||||
uint8_t* IVertBuffStorage(int iBuff, int iVtx) const { return fVertBuffStorage[iBuff] + iVtx*fStride; }
|
||||
|
||||
UInt32 IMakeCell( UInt32 vbIndex, UInt8 flags, UInt32 vStart, UInt32 cStart, UInt32 len, UInt32 *offset );
|
||||
void IGetStartVtxPointer( UInt32 vbIndex, UInt32 cell, UInt32 offset, UInt8 *&tempPtr, plGBufferColor *&cPtr );
|
||||
uint32_t IMakeCell( uint32_t vbIndex, uint8_t flags, uint32_t vStart, uint32_t cStart, uint32_t len, uint32_t *offset );
|
||||
void IGetStartVtxPointer( uint32_t vbIndex, uint32_t cell, uint32_t offset, uint8_t *&tempPtr, plGBufferColor *&cPtr );
|
||||
|
||||
public:
|
||||
|
||||
static const UInt32 kMaxNumVertsPerBuffer;
|
||||
static const UInt32 kMaxNumIndicesPerBuffer;
|
||||
static const uint32_t kMaxNumVertsPerBuffer;
|
||||
static const uint32_t kMaxNumIndicesPerBuffer;
|
||||
|
||||
enum Formats
|
||||
{
|
||||
@ -179,37 +179,37 @@ class plGBufferGroup
|
||||
kReserveIsolate = 0x10
|
||||
};
|
||||
|
||||
plGBufferGroup(UInt8 format, hsBool vertsVolatile, hsBool idxVolatile, int LOD = 0);
|
||||
plGBufferGroup(uint8_t format, hsBool vertsVolatile, hsBool idxVolatile, int LOD = 0);
|
||||
~plGBufferGroup();
|
||||
|
||||
UInt8 GetNumUVs( void ) const { return ( fFormat & kUVCountMask ); }
|
||||
UInt8 GetNumWeights() const { return (fFormat & kSkinWeightMask) >> 4; }
|
||||
uint8_t GetNumUVs( void ) const { return ( fFormat & kUVCountMask ); }
|
||||
uint8_t GetNumWeights() const { return (fFormat & kSkinWeightMask) >> 4; }
|
||||
|
||||
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; }
|
||||
|
||||
void DirtyVertexBuffer(int i);
|
||||
void DirtyIndexBuffer(int i);
|
||||
hsBool VertexReady(int i) const { return (i < fVertexBufferRefs.GetCount()) && fVertexBufferRefs[i]; }
|
||||
hsBool IndexReady(int i) const { return (i < fIndexBufferRefs.GetCount()) && fIndexBufferRefs[i]; }
|
||||
UInt8 GetVertexSize( void ) const { return fStride; }
|
||||
UInt8 GetVertexLiteStride( void ) const { return fLiteStride; }
|
||||
UInt8 GetVertexFormat( void ) const { return fFormat; }
|
||||
UInt32 GetMemUsage( void ) const { return ( fNumVerts * GetVertexSize() ) + ( fNumIndices * sizeof( UInt16 ) ); }
|
||||
UInt32 GetNumVerts( void ) const { return fNumVerts; }
|
||||
UInt32 GetNumIndices( void ) const { return fNumIndices; }
|
||||
UInt32 GetNumPrimaryVertsLeft( void ) const;
|
||||
UInt32 GetNumVertsLeft( UInt32 idx ) const;
|
||||
uint8_t GetVertexSize( void ) const { return fStride; }
|
||||
uint8_t GetVertexLiteStride( void ) const { return fLiteStride; }
|
||||
uint8_t GetVertexFormat( void ) const { return fFormat; }
|
||||
uint32_t GetMemUsage( void ) const { return ( fNumVerts * GetVertexSize() ) + ( fNumIndices * sizeof( uint16_t ) ); }
|
||||
uint32_t GetNumVerts( void ) const { return fNumVerts; }
|
||||
uint32_t GetNumIndices( void ) const { return fNumIndices; }
|
||||
uint32_t GetNumPrimaryVertsLeft( void ) const;
|
||||
uint32_t GetNumVertsLeft( uint32_t idx ) const;
|
||||
|
||||
UInt32 GetVertBufferSize(UInt32 idx) const { return fVertBuffSizes[idx]; }
|
||||
UInt32 GetVertBufferCount(UInt32 idx) const;
|
||||
UInt32 GetIndexBufferCount(UInt32 idx) const { return fIdxBuffCounts[idx]; }
|
||||
UInt32 GetVertStartFromCell(UInt32 idx, UInt32 cell, UInt32 offset) const;
|
||||
uint32_t GetVertBufferSize(uint32_t idx) const { return fVertBuffSizes[idx]; }
|
||||
uint32_t GetVertBufferCount(uint32_t idx) const;
|
||||
uint32_t GetIndexBufferCount(uint32_t idx) const { return fIdxBuffCounts[idx]; }
|
||||
uint32_t GetVertStartFromCell(uint32_t idx, uint32_t cell, uint32_t offset) const;
|
||||
|
||||
// These should only be called by the pipeline, because only it knows when it's safe.
|
||||
// If the data is volatile, these are no-ops
|
||||
void PurgeVertBuffer(UInt32 idx);
|
||||
void PurgeIndexBuffer(UInt32 idx);
|
||||
void PurgeVertBuffer(uint32_t idx);
|
||||
void PurgeIndexBuffer(uint32_t idx);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// The following group of functions is an advanced optimization, and a pretty
|
||||
@ -220,43 +220,43 @@ class plGBufferGroup
|
||||
// things may work faster. If you set them incorrectly, be sure to save
|
||||
// all files before running.
|
||||
// All of these are indices, not bytes. from the beginning of the buffer.
|
||||
UInt32 GetVertBufferStart(UInt32 idx) const { return fVertBuffStarts[idx]; }
|
||||
UInt32 GetVertBufferEnd(UInt32 idx) const { return fVertBuffEnds[idx] >= 0 ? UInt32(fVertBuffEnds[idx]) : GetVertBufferCount(idx); }
|
||||
UInt32 GetIndexBufferStart(UInt32 idx) const { return fIdxBuffStarts[idx]; }
|
||||
UInt32 GetIndexBufferEnd(UInt32 idx) const { return fIdxBuffEnds[idx] >= 0 ? UInt32(fIdxBuffEnds[idx]) : GetIndexBufferCount(idx); }
|
||||
uint32_t GetVertBufferStart(uint32_t idx) const { return fVertBuffStarts[idx]; }
|
||||
uint32_t GetVertBufferEnd(uint32_t idx) const { return fVertBuffEnds[idx] >= 0 ? uint32_t(fVertBuffEnds[idx]) : GetVertBufferCount(idx); }
|
||||
uint32_t GetIndexBufferStart(uint32_t idx) const { return fIdxBuffStarts[idx]; }
|
||||
uint32_t GetIndexBufferEnd(uint32_t idx) const { return fIdxBuffEnds[idx] >= 0 ? uint32_t(fIdxBuffEnds[idx]) : GetIndexBufferCount(idx); }
|
||||
|
||||
void SetVertBufferStart(UInt32 idx, UInt32 s) { fVertBuffStarts[idx] = s; }
|
||||
void SetVertBufferEnd(UInt32 idx, UInt32 e) { fVertBuffEnds[idx] = e; }
|
||||
void SetIndexBufferStart(UInt32 idx, UInt32 s) { fIdxBuffStarts[idx] = s; }
|
||||
void SetIndexBufferEnd(UInt32 idx, UInt32 e) { fIdxBuffEnds[idx] = e; }
|
||||
void SetVertBufferStart(uint32_t idx, uint32_t s) { fVertBuffStarts[idx] = s; }
|
||||
void SetVertBufferEnd(uint32_t idx, uint32_t e) { fVertBuffEnds[idx] = e; }
|
||||
void SetIndexBufferStart(uint32_t idx, uint32_t s) { fIdxBuffStarts[idx] = s; }
|
||||
void SetIndexBufferEnd(uint32_t idx, uint32_t e) { fIdxBuffEnds[idx] = e; }
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 GetNumVertexBuffers( void ) const { return fVertBuffStorage.GetCount(); }
|
||||
UInt32 GetNumIndexBuffers( void ) const { return fIdxBuffStorage.GetCount(); }
|
||||
uint32_t GetNumVertexBuffers( void ) const { return fVertBuffStorage.GetCount(); }
|
||||
uint32_t GetNumIndexBuffers( void ) const { return fIdxBuffStorage.GetCount(); }
|
||||
|
||||
UInt8 *GetVertBufferData( UInt32 idx ) { return fVertBuffStorage[ idx ]; }
|
||||
UInt16 *GetIndexBufferData( UInt32 idx ) { return fIdxBuffStorage[ idx ]; }
|
||||
plGBufferColor *GetColorBufferData( UInt32 idx ) { return fColorBuffStorage[ idx ]; }
|
||||
uint8_t *GetVertBufferData( uint32_t idx ) { return fVertBuffStorage[ idx ]; }
|
||||
uint16_t *GetIndexBufferData( uint32_t idx ) { return fIdxBuffStorage[ idx ]; }
|
||||
plGBufferColor *GetColorBufferData( uint32_t idx ) { return fColorBuffStorage[ idx ]; }
|
||||
|
||||
hsGDeviceRef *GetVertexBufferRef( UInt32 i );
|
||||
hsGDeviceRef *GetIndexBufferRef( UInt32 i );
|
||||
hsGDeviceRef *GetVertexBufferRef( uint32_t i );
|
||||
hsGDeviceRef *GetIndexBufferRef( uint32_t i );
|
||||
|
||||
UInt32 GetNumCells( UInt32 idx ) const { return fCells[ idx ]->GetCount(); }
|
||||
plGBufferCell *GetCell( UInt32 idx, UInt32 cell ) { return &( (*fCells[ idx ])[ cell ] ); }
|
||||
uint32_t GetNumCells( uint32_t idx ) const { return fCells[ idx ]->GetCount(); }
|
||||
plGBufferCell *GetCell( uint32_t idx, uint32_t cell ) { return &( (*fCells[ idx ])[ cell ] ); }
|
||||
|
||||
void SetVertexBufferRef( UInt32 index, hsGDeviceRef *vb );
|
||||
void SetIndexBufferRef( UInt32 index, hsGDeviceRef *ib );
|
||||
void SetVertexBufferRef( uint32_t index, hsGDeviceRef *vb );
|
||||
void SetIndexBufferRef( uint32_t index, hsGDeviceRef *ib );
|
||||
|
||||
virtual void Read( hsStream* s );
|
||||
virtual void Write( hsStream* s );
|
||||
|
||||
// Accessor functions
|
||||
hsPoint3 &Position( int iBuff, UInt32 cell, int iVtx );
|
||||
hsVector3 &Normal( int iBuff, UInt32 cell, int iVtx );
|
||||
UInt32 &Color( int iBuff, UInt32 cell, int iVtx );
|
||||
UInt32 &Specular( int iBuff, UInt32 cell, int iVtx );
|
||||
hsPoint3 &UV( int iBuff, UInt32 cell, int iVtx, int channel );
|
||||
UInt32 Format() const { return fFormat; }
|
||||
hsPoint3 &Position( int iBuff, uint32_t cell, int iVtx );
|
||||
hsVector3 &Normal( int iBuff, uint32_t cell, int iVtx );
|
||||
uint32_t &Color( int iBuff, uint32_t cell, int iVtx );
|
||||
uint32_t &Specular( int iBuff, uint32_t cell, int iVtx );
|
||||
hsPoint3 &UV( int iBuff, uint32_t cell, int iVtx, int channel );
|
||||
uint32_t Format() const { return fFormat; }
|
||||
|
||||
// Take temp accumulators and actually build buffer data from them
|
||||
void TidyUp( void );
|
||||
@ -268,34 +268,34 @@ class plGBufferGroup
|
||||
void PrepForRendering( plPipeline *pipe, hsBool adjustForNvidiaLighting );
|
||||
|
||||
// Reserves space in a vertex buffer
|
||||
hsBool ReserveVertStorage( UInt32 numVerts, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset, UInt8 flags );
|
||||
hsBool ReserveVertStorage( uint32_t numVerts, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset, uint8_t flags );
|
||||
|
||||
// Append vertex data to the first available storage buffer
|
||||
void AppendToVertStorage( plGeometrySpan *srcSpan, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset );
|
||||
void AppendToVertAndColorStorage( plGeometrySpan *srcSpan, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset );
|
||||
void AppendToColorStorage( plGeometrySpan *srcSpan, UInt32 *vbIndex, UInt32 *cell, UInt32 *offset, UInt32 origCell );
|
||||
void AppendToVertStorage( plGeometrySpan *srcSpan, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset );
|
||||
void AppendToVertAndColorStorage( plGeometrySpan *srcSpan, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset );
|
||||
void AppendToColorStorage( plGeometrySpan *srcSpan, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset, uint32_t origCell );
|
||||
|
||||
// Reserves space in an index buffer
|
||||
hsBool ReserveIndexStorage( UInt32 numIndices, UInt32 *ibIndex, UInt32 *ibStart, UInt16 **dataPtr = nil );
|
||||
hsBool ReserveIndexStorage( uint32_t numIndices, uint32_t *ibIndex, uint32_t *ibStart, uint16_t **dataPtr = nil );
|
||||
|
||||
// Append index data to the first available storage buffer
|
||||
void AppendToIndexStorage( UInt32 numIndices, UInt16 *data, UInt32 addToAll, UInt32 *ibIndex, UInt32 *ibStart );
|
||||
void AppendToIndexStorage( uint32_t numIndices, uint16_t *data, uint32_t addToAll, uint32_t *ibIndex, uint32_t *ibStart );
|
||||
|
||||
|
||||
/// Dynamic functions (addition/deletion of raw data)
|
||||
void DeleteVertsFromStorage( UInt32 which, UInt32 start, UInt32 length );
|
||||
void AdjustIndicesInStorage( UInt32 which, UInt16 threshhold, Int16 delta );
|
||||
void DeleteIndicesFromStorage( UInt32 which, UInt32 start, UInt32 length );
|
||||
void DeleteVertsFromStorage( uint32_t which, uint32_t start, uint32_t length );
|
||||
void AdjustIndicesInStorage( uint32_t which, uint16_t threshhold, int16_t delta );
|
||||
void DeleteIndicesFromStorage( uint32_t which, uint32_t start, uint32_t length );
|
||||
|
||||
// Returns an array of plGBufferTriangles representing the span of indices specified
|
||||
plGBufferTriangle *ConvertToTriList( Int16 spanIndex, UInt32 whichIdx, UInt32 whichVtx, UInt32 whichCell, UInt32 start, UInt32 numTriangles );
|
||||
plGBufferTriangle *ConvertToTriList( int16_t spanIndex, uint32_t whichIdx, uint32_t whichVtx, uint32_t whichCell, uint32_t start, uint32_t numTriangles );
|
||||
|
||||
// Stuffs the indices from an array of plGBufferTriangles into the index storage
|
||||
void StuffFromTriList( UInt32 which, UInt32 start, UInt32 numTriangles, UInt16 *data );
|
||||
void StuffTri( UInt32 iBuff, UInt32 iTri, UInt16 idx0, UInt16 idx1, UInt16 idx2 );
|
||||
void StuffFromTriList( uint32_t which, uint32_t start, uint32_t numTriangles, uint16_t *data );
|
||||
void StuffTri( uint32_t iBuff, uint32_t iTri, uint16_t idx0, uint16_t idx1, uint16_t idx2 );
|
||||
|
||||
// Stuff the data from a geometry span into vertex storage
|
||||
void StuffToVertStorage( plGeometrySpan *srcSpan, UInt32 vbIndex, UInt32 cell, UInt32 offset, UInt8 flags );
|
||||
void StuffToVertStorage( plGeometrySpan *srcSpan, uint32_t vbIndex, uint32_t cell, uint32_t offset, uint8_t flags );
|
||||
|
||||
// Are our verts volatile?
|
||||
hsBool AreVertsVolatile() const { return fVertsVolatile; }
|
||||
|
@ -45,8 +45,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsWindows.h"
|
||||
#include "hsTypes.h"
|
||||
|
||||
#include "HeadSpin.h"
|
||||
#include "plPipeline.h"
|
||||
#include "plPlates.h"
|
||||
|
||||
@ -75,7 +75,7 @@ void SetHInstance(void *instance)
|
||||
//// plPlate Functions ///////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 plPlate::fMagicUniqueKeyInt = 0;
|
||||
uint32_t plPlate::fMagicUniqueKeyInt = 0;
|
||||
|
||||
plPlate::plPlate( plPlate **owningHandle )
|
||||
{
|
||||
@ -107,7 +107,7 @@ plPlate::~plPlate()
|
||||
|
||||
//// SetPosition /////////////////////////////////////////////////////////////
|
||||
|
||||
void plPlate::SetPosition( hsScalar x, hsScalar y, hsScalar z )
|
||||
void plPlate::SetPosition( float x, float y, float z )
|
||||
{
|
||||
hsVector3 triple;
|
||||
|
||||
@ -130,14 +130,14 @@ void plPlate::SetPosition( hsScalar x, hsScalar y, hsScalar z )
|
||||
|
||||
//// SetSize /////////////////////////////////////////////////////////////////
|
||||
|
||||
void plPlate::SetSize( hsScalar width, hsScalar height, bool adjustByAspectRation )
|
||||
void plPlate::SetSize( float width, float height, bool adjustByAspectRation )
|
||||
{
|
||||
hsVector3 size;
|
||||
|
||||
width *= fDepth / 1.0f;
|
||||
height *= fDepth / 1.0f;
|
||||
|
||||
size.fX = adjustByAspectRation ? (width * ((hsScalar)plPlateManager::Instance().GetPipeHeight() / (hsScalar)plPlateManager::Instance().GetPipeWidth())) : width;
|
||||
size.fX = adjustByAspectRation ? (width * ((float)plPlateManager::Instance().GetPipeHeight() / (float)plPlateManager::Instance().GetPipeWidth())) : width;
|
||||
size.fY = height;
|
||||
size.fZ = 1.0f;
|
||||
|
||||
@ -166,7 +166,7 @@ void plPlate::SetTexture(plBitmap *texture)
|
||||
hsGMaterial *material;
|
||||
plString keyName;
|
||||
|
||||
material = TRACKED_NEW hsGMaterial();
|
||||
material = new hsGMaterial();
|
||||
keyName = plString::Format( "PlateBlank#%d", fMagicUniqueKeyInt++ );
|
||||
hsgResMgr::ResMgr()->NewKey( keyName, material, plLocation::kGlobalFixedLoc );
|
||||
layer = material->MakeBaseLayer();
|
||||
@ -176,14 +176,14 @@ void plPlate::SetTexture(plBitmap *texture)
|
||||
layer->SetOpacity( fOpacity );
|
||||
layer->SetUVWSrc(plLayerInterface::kUVWPassThru);
|
||||
|
||||
hsgResMgr::ResMgr()->AddViaNotify(texture->GetKey(), TRACKED_NEW plGenRefMsg(layer->GetKey(), plRefMsg::kOnCreate, -1, plLayRefMsg::kTexture), plRefFlags::kActiveRef);
|
||||
hsgResMgr::ResMgr()->AddViaNotify(texture->GetKey(), new plGenRefMsg(layer->GetKey(), plRefMsg::kOnCreate, -1, plLayRefMsg::kTexture), plRefFlags::kActiveRef);
|
||||
|
||||
SetMaterial(material);
|
||||
}
|
||||
|
||||
//// SetOpacity //////////////////////////////////////////////////////////////
|
||||
|
||||
void plPlate::SetOpacity( hsScalar opacity )
|
||||
void plPlate::SetOpacity( float opacity )
|
||||
{
|
||||
if( fMaterial != nil && fMaterial->GetLayer( 0 ) != nil )
|
||||
{
|
||||
@ -198,7 +198,7 @@ void plPlate::SetOpacity( hsScalar opacity )
|
||||
// Creates a new material for this plate with either a specified texture
|
||||
// or an empty, white-filled bitmap.
|
||||
|
||||
plMipmap *plPlate::CreateMaterial( UInt32 width, UInt32 height, hsBool withAlpha, plMipmap* texture )
|
||||
plMipmap *plPlate::CreateMaterial( uint32_t width, uint32_t height, hsBool withAlpha, plMipmap* texture )
|
||||
{
|
||||
plLayer *layer;
|
||||
hsGMaterial *material;
|
||||
@ -212,7 +212,7 @@ plMipmap *plPlate::CreateMaterial( UInt32 width, UInt32 height, hsBool withAl
|
||||
else
|
||||
{
|
||||
/// Create a new bitmap
|
||||
fMipmap = TRACKED_NEW plMipmap( width, height, withAlpha ? plMipmap::kARGB32Config : plMipmap::kRGB32Config, 1 );
|
||||
fMipmap = new plMipmap( width, height, withAlpha ? plMipmap::kARGB32Config : plMipmap::kRGB32Config, 1 );
|
||||
memset( fMipmap->GetImage(), 0xff, height * fMipmap->GetRowBytes() );
|
||||
keyName = plString::Format( "PlateBitmap#%d", fMagicUniqueKeyInt++ );
|
||||
hsgResMgr::ResMgr()->NewKey( keyName, fMipmap, plLocation::kGlobalFixedLoc );
|
||||
@ -220,7 +220,7 @@ plMipmap *plPlate::CreateMaterial( UInt32 width, UInt32 height, hsBool withAl
|
||||
}
|
||||
|
||||
/// NOW create a layer wrapper and a material for that layer
|
||||
material = TRACKED_NEW hsGMaterial();
|
||||
material = new hsGMaterial();
|
||||
keyName = plString::Format( "PlateBlank#%d", fMagicUniqueKeyInt++ );
|
||||
hsgResMgr::ResMgr()->NewKey( keyName, material, plLocation::kGlobalFixedLoc );
|
||||
layer = material->MakeBaseLayer();
|
||||
@ -229,7 +229,7 @@ plMipmap *plPlate::CreateMaterial( UInt32 width, UInt32 height, hsBool withAl
|
||||
layer->SetBlendFlags( layer->GetBlendFlags() | hsGMatState::kBlendAlpha );
|
||||
layer->SetOpacity( fOpacity );
|
||||
|
||||
hsgResMgr::ResMgr()->AddViaNotify( fMipmap->GetKey(), TRACKED_NEW plLayRefMsg( layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef );
|
||||
hsgResMgr::ResMgr()->AddViaNotify( fMipmap->GetKey(), new plLayRefMsg( layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture ), plRefFlags::kActiveRef );
|
||||
|
||||
// Set up a ref to these. Since we don't have a key, we use the
|
||||
// generic RefObject() (and matching UnRefObject() when we're done).
|
||||
@ -249,7 +249,7 @@ void plPlate::CreateFromResource(const char *resName)
|
||||
{
|
||||
if (resName)
|
||||
{
|
||||
plMipmap* resTexture = TRACKED_NEW plMipmap;
|
||||
plMipmap* resTexture = new plMipmap;
|
||||
resTexture->CopyFrom(plClientResMgr::Instance().getResource(resName));
|
||||
|
||||
plString keyName = plString::Format( "PlateResource#%d", fMagicUniqueKeyInt++ );
|
||||
@ -325,7 +325,7 @@ plGraphPlate::~plGraphPlate()
|
||||
|
||||
//// IMakePow2 ///////////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 plGraphPlate::IMakePow2( UInt32 value )
|
||||
uint32_t plGraphPlate::IMakePow2( uint32_t value )
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -336,9 +336,9 @@ UInt32 plGraphPlate::IMakePow2( UInt32 value )
|
||||
|
||||
//// SetDataRange ////////////////////////////////////////////////////////////
|
||||
|
||||
void plGraphPlate::SetDataRange( UInt32 min, UInt32 max, UInt32 width )
|
||||
void plGraphPlate::SetDataRange( uint32_t min, uint32_t max, uint32_t width )
|
||||
{
|
||||
UInt32 height;
|
||||
uint32_t height;
|
||||
|
||||
|
||||
width = IMakePow2( width + 4 );
|
||||
@ -356,7 +356,7 @@ void plGraphPlate::SetDataRange( UInt32 min, UInt32 max, UInt32 width )
|
||||
|
||||
//// SetDataLabels ///////////////////////////////////////////////////////////
|
||||
|
||||
void plGraphPlate::SetDataLabels( UInt32 min, UInt32 max )
|
||||
void plGraphPlate::SetDataLabels( uint32_t min, uint32_t max )
|
||||
{
|
||||
fLabelMin = min;
|
||||
fLabelMax = max;
|
||||
@ -366,7 +366,7 @@ void plGraphPlate::SetDataLabels( UInt32 min, UInt32 max )
|
||||
|
||||
void plGraphPlate::ClearData( void )
|
||||
{
|
||||
UInt32 *bits = (UInt32 *)fMipmap->GetImage(), *ptr;
|
||||
uint32_t *bits = (uint32_t *)fMipmap->GetImage(), *ptr;
|
||||
int i;
|
||||
|
||||
|
||||
@ -394,9 +394,9 @@ void plGraphPlate::ClearData( void )
|
||||
//// AddData /////////////////////////////////////////////////////////////////
|
||||
// Scroll graph data left by one, then add the new value
|
||||
|
||||
void plGraphPlate::AddData( Int32 value, Int32 value2, Int32 value3, Int32 value4 )
|
||||
void plGraphPlate::AddData( int32_t value, int32_t value2, int32_t value3, int32_t value4 )
|
||||
{
|
||||
std::vector<Int32> values;
|
||||
std::vector<int32_t> values;
|
||||
if (value != -1)
|
||||
values.push_back(value);
|
||||
if (value2 != -1)
|
||||
@ -408,15 +408,15 @@ void plGraphPlate::AddData( Int32 value, Int32 value2, Int32 value3, Int32 va
|
||||
AddData(values);
|
||||
}
|
||||
|
||||
void plGraphPlate::AddData( std::vector<Int32> values )
|
||||
void plGraphPlate::AddData( std::vector<int32_t> values )
|
||||
{
|
||||
hsAssert( fMipmap != nil, "Trying to add data to an uninitialized plGraphPlate" );
|
||||
|
||||
fMipmap->SetCurrLevel( 0 );
|
||||
|
||||
UInt32 *bits = (UInt32 *)fMipmap->GetImage(), *ptr;
|
||||
UInt32 *minDPos = fMipmap->GetAddr32( 3, fMipmap->GetHeight() - 3 - 10 );
|
||||
UInt32 *maxDPos = fMipmap->GetAddr32( 3, 2 );
|
||||
uint32_t *bits = (uint32_t *)fMipmap->GetImage(), *ptr;
|
||||
uint32_t *minDPos = fMipmap->GetAddr32( 3, fMipmap->GetHeight() - 3 - 10 );
|
||||
uint32_t *maxDPos = fMipmap->GetAddr32( 3, 2 );
|
||||
int i, j;
|
||||
std::vector<int> lows, his;
|
||||
float lineCtr, lineInc;
|
||||
@ -446,7 +446,7 @@ void plGraphPlate::AddData( std::vector<Int32> values )
|
||||
values[ i ] = fLabelMax;
|
||||
else if( values[ i ] < fLabelMin )
|
||||
values[ i ] = fLabelMin;
|
||||
values[ i ] = (UInt32)( (float)values[ i ] * ( fMipmap->GetHeight() - 4 ) / ( fLabelMax - fLabelMin + 1 ) );
|
||||
values[ i ] = (uint32_t)( (float)values[ i ] * ( fMipmap->GetHeight() - 4 ) / ( fLabelMax - fLabelMin + 1 ) );
|
||||
|
||||
if( values[ i ] < fLastValues[ i ] )
|
||||
{
|
||||
@ -472,7 +472,7 @@ void plGraphPlate::AddData( std::vector<Int32> values )
|
||||
if( lineInt != lastLineInt )
|
||||
bumpCtr = 2;
|
||||
|
||||
memmove( ptr, ptr + 1, ( fMipmap->GetWidth() - 5 ) * sizeof( UInt32 ) );
|
||||
memmove( ptr, ptr + 1, ( fMipmap->GetWidth() - 5 ) * sizeof( uint32_t ) );
|
||||
int dataIndex;
|
||||
bool dataPlotted = false;
|
||||
for (dataIndex = 0; dataIndex < values.size(); dataIndex++)
|
||||
@ -519,7 +519,7 @@ void plGraphPlate::AddData( std::vector<Int32> values )
|
||||
|
||||
//// SetColors ///////////////////////////////////////////////////////////////
|
||||
|
||||
void plGraphPlate::SetColors( UInt32 bgHexColor, UInt32 axesHexColor, UInt32 dataHexColor, UInt32 graphHexColor )
|
||||
void plGraphPlate::SetColors( uint32_t bgHexColor, uint32_t axesHexColor, uint32_t dataHexColor, uint32_t graphHexColor )
|
||||
{
|
||||
fBGHexColor = bgHexColor;
|
||||
fAxesHexColor = axesHexColor;
|
||||
@ -534,9 +534,9 @@ void plGraphPlate::SetColors( UInt32 bgHexColor, UInt32 axesHexColor, UInt32
|
||||
|
||||
//// SetDataColors ///////////////////////////////////////////////////////////
|
||||
|
||||
void plGraphPlate::SetDataColors( UInt32 hexColor1, UInt32 hexColor2, UInt32 hexColor3, UInt32 hexColor4 )
|
||||
void plGraphPlate::SetDataColors( uint32_t hexColor1, uint32_t hexColor2, uint32_t hexColor3, uint32_t hexColor4 )
|
||||
{
|
||||
std::vector<UInt32> colors;
|
||||
std::vector<uint32_t> colors;
|
||||
colors.push_back(hexColor1);
|
||||
colors.push_back(hexColor2);
|
||||
colors.push_back(hexColor3);
|
||||
@ -544,7 +544,7 @@ void plGraphPlate::SetDataColors( UInt32 hexColor1, UInt32 hexColor2, UInt32
|
||||
SetDataColors(colors);
|
||||
}
|
||||
|
||||
void plGraphPlate::SetDataColors( const std::vector<UInt32> & hexColors )
|
||||
void plGraphPlate::SetDataColors( const std::vector<uint32_t> & hexColors )
|
||||
{
|
||||
fDataHexColors = hexColors;
|
||||
}
|
||||
@ -583,7 +583,7 @@ void plGraphPlate::SetLabelText( const std::vector<std::string> & text )
|
||||
|
||||
//// IDrawNumber /////////////////////////////////////////////////////////////
|
||||
|
||||
void plGraphPlate::IDrawNumber( UInt32 number, UInt32 *dataPtr, UInt32 stride, UInt32 color )
|
||||
void plGraphPlate::IDrawNumber( uint32_t number, uint32_t *dataPtr, uint32_t stride, uint32_t color )
|
||||
{
|
||||
char str[ 16 ];
|
||||
int i;
|
||||
@ -599,7 +599,7 @@ void plGraphPlate::IDrawNumber( UInt32 number, UInt32 *dataPtr, UInt32 stride
|
||||
|
||||
//// IDrawDigit //////////////////////////////////////////////////////////////
|
||||
|
||||
void plGraphPlate::IDrawDigit( char digit, UInt32 *dataPtr, UInt32 stride, UInt32 color )
|
||||
void plGraphPlate::IDrawDigit( char digit, uint32_t *dataPtr, uint32_t stride, uint32_t color )
|
||||
{
|
||||
/// Yes, I know this is ugly. Move it into another file if you like.
|
||||
char digits[ 10 ][ 5 * 3 ] =
|
||||
@ -698,20 +698,20 @@ plPlateManager::~plPlateManager()
|
||||
|
||||
void plPlateManager::CreatePlate( plPlate **handle )
|
||||
{
|
||||
plPlate *plate = TRACKED_NEW plPlate( handle );
|
||||
plPlate *plate = new plPlate( handle );
|
||||
|
||||
|
||||
plate->ILink( &fPlates );
|
||||
*handle = plate;
|
||||
}
|
||||
|
||||
void plPlateManager::CreatePlate( plPlate **handle, hsScalar width, hsScalar height )
|
||||
void plPlateManager::CreatePlate( plPlate **handle, float width, float height )
|
||||
{
|
||||
CreatePlate( handle );
|
||||
(*handle)->SetSize( width, height );
|
||||
}
|
||||
|
||||
void plPlateManager::CreatePlate( plPlate **handle, hsScalar x, hsScalar y, hsScalar width, hsScalar height )
|
||||
void plPlateManager::CreatePlate( plPlate **handle, float x, float y, float width, float height )
|
||||
{
|
||||
CreatePlate( handle );
|
||||
(*handle)->SetPosition( x, y );
|
||||
@ -720,7 +720,7 @@ void plPlateManager::CreatePlate( plPlate **handle, hsScalar x, hsScalar y, h
|
||||
|
||||
void plPlateManager::CreateGraphPlate( plGraphPlate **handle )
|
||||
{
|
||||
plGraphPlate *plate = TRACKED_NEW plGraphPlate( (plPlate **)handle );
|
||||
plGraphPlate *plate = new plGraphPlate( (plPlate **)handle );
|
||||
|
||||
|
||||
plate->ILink( &fPlates );
|
||||
@ -740,12 +740,12 @@ void plPlateManager::DestroyPlate( plPlate *plate )
|
||||
|
||||
//// GetPipeWidth/Height /////////////////////////////////////////////////////
|
||||
|
||||
UInt32 plPlateManager::GetPipeWidth( void )
|
||||
uint32_t plPlateManager::GetPipeWidth( void )
|
||||
{
|
||||
return fOwner->Width();
|
||||
}
|
||||
|
||||
UInt32 plPlateManager::GetPipeHeight( void )
|
||||
uint32_t plPlateManager::GetPipeHeight( void )
|
||||
{
|
||||
return fOwner->Height();
|
||||
}
|
||||
@ -774,7 +774,7 @@ void plPlateManager::IResortPlate( plPlate *plate, bool fromCurrent )
|
||||
|
||||
//// SetPlateScreenPos ///////////////////////////////////////////////////////
|
||||
|
||||
void plPlateManager::SetPlateScreenPos( plPlate *plate, UInt32 x, UInt32 y )
|
||||
void plPlateManager::SetPlateScreenPos( plPlate *plate, uint32_t x, uint32_t y )
|
||||
{
|
||||
float cX = ( (float)x / fOwner->Width() ) * 2.0f - 1.0f;
|
||||
float cY = ( (float)y / fOwner->Height() ) * 2.0f - 1.0f;
|
||||
@ -782,7 +782,7 @@ void plPlateManager::SetPlateScreenPos( plPlate *plate, UInt32 x, UInt32 y )
|
||||
plate->SetPosition( cX, cY );
|
||||
}
|
||||
|
||||
void plPlateManager::SetPlatePixelSize( plPlate *plate, UInt32 pWidth, UInt32 pHeight )
|
||||
void plPlateManager::SetPlatePixelSize( plPlate *plate, uint32_t pWidth, uint32_t pHeight )
|
||||
{
|
||||
float width = (float)pWidth / fOwner->Width() * 2.0f;
|
||||
float height = (float)pHeight / fOwner->Height() * 2.0f;
|
||||
|
@ -48,11 +48,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#ifndef _plPlates_h
|
||||
#define _plPlates_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "hsStlUtils.h"
|
||||
#include "hsColorRGBA.h"
|
||||
#include "hsTemplates.h"
|
||||
#include "hsUtils.h"
|
||||
|
||||
#include "hsMatrix44.h"
|
||||
|
||||
|
||||
@ -77,8 +77,8 @@ class plPlate
|
||||
hsMatrix44 fXformMatrix;
|
||||
hsGMaterial *fMaterial;
|
||||
plMipmap *fMipmap;
|
||||
hsScalar fDepth, fOpacity;
|
||||
UInt32 fFlags;
|
||||
float fDepth, fOpacity;
|
||||
uint32_t fFlags;
|
||||
char fTitle[ 64 ];
|
||||
|
||||
plPlate *fNext;
|
||||
@ -86,7 +86,7 @@ class plPlate
|
||||
|
||||
plPlate **fOwningHandle;
|
||||
|
||||
static UInt32 fMagicUniqueKeyInt;
|
||||
static uint32_t fMagicUniqueKeyInt;
|
||||
|
||||
plPlate( plPlate** owningHandle );
|
||||
virtual ~plPlate();
|
||||
@ -104,7 +104,7 @@ class plPlate
|
||||
fPrevPtr = nil;
|
||||
}
|
||||
|
||||
void ISetResourceAlphas(UInt32 colorKey);
|
||||
void ISetResourceAlphas(uint32_t colorKey);
|
||||
|
||||
public:
|
||||
|
||||
@ -125,24 +125,24 @@ class plPlate
|
||||
hsGMaterial *GetMaterial( void ) { return fMaterial; }
|
||||
hsMatrix44 &GetTransform( void ) { return fXformMatrix; }
|
||||
const char *GetTitle( void ) { return fTitle; }
|
||||
UInt32 GetFlags( void ) { return fFlags; }
|
||||
uint32_t GetFlags( void ) { return fFlags; }
|
||||
const plMipmap *GetMipmap( void ) { return fMipmap; }
|
||||
|
||||
void SetVisible( hsBool vis ) { if( vis ) fFlags |= kFlagVisible; else fFlags &= ~kFlagVisible; }
|
||||
hsBool IsVisible( void );
|
||||
|
||||
void SetOpacity( hsScalar opacity = 1.f );
|
||||
void SetOpacity( float opacity = 1.f );
|
||||
|
||||
plPlate *GetNext( void ) { return fNext; }
|
||||
|
||||
|
||||
/// Helper functions
|
||||
|
||||
void SetDepth( hsScalar depth) { fDepth = depth; }
|
||||
void SetPosition( hsScalar x, hsScalar y, hsScalar z = -1.0f );
|
||||
void SetSize( hsScalar width, hsScalar height, bool adjustByAspectRatio = false );
|
||||
void SetDepth( float depth) { fDepth = depth; }
|
||||
void SetPosition( float x, float y, float z = -1.0f );
|
||||
void SetSize( float width, float height, bool adjustByAspectRatio = false );
|
||||
|
||||
plMipmap *CreateMaterial( UInt32 width, UInt32 height, hsBool withAlpha, plMipmap* texture = NULL );
|
||||
plMipmap *CreateMaterial( uint32_t width, uint32_t height, hsBool withAlpha, plMipmap* texture = NULL );
|
||||
void CreateFromResource( const char *resName );
|
||||
void ReloadFromResource( const char *resName );
|
||||
};
|
||||
@ -154,37 +154,37 @@ class plPlate
|
||||
class plGraphPlate : public plPlate
|
||||
{
|
||||
protected:
|
||||
UInt32 fBGHexColor, fAxesHexColor, fGraphHexColor;
|
||||
std::vector<UInt32> fDataHexColors;
|
||||
UInt32 fMin, fMax, fLabelMin, fLabelMax;
|
||||
std::vector<Int32> fLastValues;
|
||||
uint32_t fBGHexColor, fAxesHexColor, fGraphHexColor;
|
||||
std::vector<uint32_t> fDataHexColors;
|
||||
uint32_t fMin, fMax, fLabelMin, fLabelMax;
|
||||
std::vector<int32_t> fLastValues;
|
||||
std::vector<std::string> fLabelText;
|
||||
|
||||
UInt32 IMakePow2( UInt32 value );
|
||||
void IDrawNumber( UInt32 number, UInt32 *dataPtr, UInt32 stride, UInt32 color );
|
||||
void IDrawDigit( char digit, UInt32 *dataPtr, UInt32 stride, UInt32 color );
|
||||
uint32_t IMakePow2( uint32_t value );
|
||||
void IDrawNumber( uint32_t number, uint32_t *dataPtr, uint32_t stride, uint32_t color );
|
||||
void IDrawDigit( char digit, uint32_t *dataPtr, uint32_t stride, uint32_t color );
|
||||
|
||||
public:
|
||||
plGraphPlate( plPlate **owningHandle );
|
||||
virtual ~plGraphPlate();
|
||||
|
||||
void SetDataRange( UInt32 min, UInt32 max, UInt32 width );
|
||||
void SetDataLabels( UInt32 min, UInt32 max );
|
||||
void SetDataRange( uint32_t min, uint32_t max, uint32_t width );
|
||||
void SetDataLabels( uint32_t min, uint32_t max );
|
||||
void SetLabelText( char *text1, char *text2 = nil, char *text3 = nil, char *text4 = nil );
|
||||
void SetLabelText( const std::vector<std::string> & text );
|
||||
void ClearData( void );
|
||||
|
||||
void AddData( Int32 value, Int32 value2 = -1, Int32 value3 = -1, Int32 value4 = -1 );
|
||||
void AddData( std::vector<Int32> values );
|
||||
void AddData( int32_t value, int32_t value2 = -1, int32_t value3 = -1, int32_t value4 = -1 );
|
||||
void AddData( std::vector<int32_t> values );
|
||||
|
||||
void SetColors( UInt32 bgHexColor = 0x80000000, UInt32 axesHexColor = 0xffffffff, UInt32 dataHexColor = 0xff00ff00, UInt32 graphHexColor = 0x80ff0000 );
|
||||
void SetDataColors( UInt32 hexColor1 = 0xff00ff00, UInt32 hexColor2 = 0xff0000ff, UInt32 hexColor3 = 0xffffff00, UInt32 hexColor4 = 0xffff00ff );
|
||||
void SetDataColors( const std::vector<UInt32> & hexColors );
|
||||
void SetColors( uint32_t bgHexColor = 0x80000000, uint32_t axesHexColor = 0xffffffff, uint32_t dataHexColor = 0xff00ff00, uint32_t graphHexColor = 0x80ff0000 );
|
||||
void SetDataColors( uint32_t hexColor1 = 0xff00ff00, uint32_t hexColor2 = 0xff0000ff, uint32_t hexColor3 = 0xffffff00, uint32_t hexColor4 = 0xffff00ff );
|
||||
void SetDataColors( const std::vector<uint32_t> & hexColors );
|
||||
|
||||
const char *GetLabelText( int i ) { return fLabelText[ i ].c_str(); }
|
||||
const UInt32 GetDataColor( int i ) { return fDataHexColors[ i ]; }
|
||||
const UInt32 GetNumLabels() { return fLabelText.size(); }
|
||||
const UInt32 GetNumColors() { return fDataHexColors.size(); }
|
||||
const uint32_t GetDataColor( int i ) { return fDataHexColors[ i ]; }
|
||||
const uint32_t GetNumLabels() { return fLabelText.size(); }
|
||||
const uint32_t GetNumColors() { return fDataHexColors.size(); }
|
||||
};
|
||||
|
||||
//// plPlateManager Class Definition /////////////////////////////////////////
|
||||
@ -227,18 +227,18 @@ class plPlateManager
|
||||
static bool InstanceValid( void ) { return fInstance != nil; }
|
||||
|
||||
void CreatePlate( plPlate **handle );
|
||||
void CreatePlate( plPlate **handle, hsScalar width, hsScalar height );
|
||||
void CreatePlate( plPlate **handle, hsScalar x, hsScalar y, hsScalar width, hsScalar height );
|
||||
void CreatePlate( plPlate **handle, float width, float height );
|
||||
void CreatePlate( plPlate **handle, float x, float y, float width, float height );
|
||||
|
||||
void CreateGraphPlate( plGraphPlate **handle );
|
||||
|
||||
void DestroyPlate( plPlate *plate );
|
||||
|
||||
void SetPlateScreenPos( plPlate *plate, UInt32 x, UInt32 y );
|
||||
void SetPlatePixelSize( plPlate *plate, UInt32 pWidth, UInt32 pHeight );
|
||||
void SetPlateScreenPos( plPlate *plate, uint32_t x, uint32_t y );
|
||||
void SetPlatePixelSize( plPlate *plate, uint32_t pWidth, uint32_t pHeight );
|
||||
|
||||
UInt32 GetPipeWidth( void );
|
||||
UInt32 GetPipeHeight( void );
|
||||
uint32_t GetPipeWidth( void );
|
||||
uint32_t GetPipeHeight( void );
|
||||
void DrawToDevice( plPipeline *pipe );
|
||||
|
||||
hsBool IsValid( void ) { return fCreatedSucessfully; }
|
||||
|
@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plRenderTarget.h"
|
||||
#include "plCubicRenderTarget.h"
|
||||
#include "hsStream.h"
|
||||
@ -90,9 +90,9 @@ hsBool plRenderTarget::MsgReceive(plMessage* msg)
|
||||
return plBitmap::MsgReceive(msg);
|
||||
}
|
||||
|
||||
UInt32 plRenderTarget::Read( hsStream *s )
|
||||
uint32_t plRenderTarget::Read( hsStream *s )
|
||||
{
|
||||
UInt32 total = plBitmap::Read( s );
|
||||
uint32_t total = plBitmap::Read( s );
|
||||
|
||||
fWidth = s->ReadLE16();
|
||||
fHeight = s->ReadLE16();
|
||||
@ -116,12 +116,12 @@ UInt32 plRenderTarget::Read( hsStream *s )
|
||||
fZDepth = s->ReadByte();
|
||||
fStencilDepth = s->ReadByte();
|
||||
|
||||
return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( hsScalar ) : sizeof( UInt16 ) ) + sizeof( hsBool );
|
||||
return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( float ) : sizeof( uint16_t ) ) + sizeof( hsBool );
|
||||
}
|
||||
|
||||
UInt32 plRenderTarget::Write( hsStream *s )
|
||||
uint32_t plRenderTarget::Write( hsStream *s )
|
||||
{
|
||||
UInt32 total = plBitmap::Write( s );
|
||||
uint32_t total = plBitmap::Write( s );
|
||||
|
||||
s->WriteLE16( fWidth );
|
||||
s->WriteLE16( fHeight );
|
||||
@ -145,23 +145,23 @@ UInt32 plRenderTarget::Write( hsStream *s )
|
||||
s->WriteByte( fZDepth );
|
||||
s->WriteByte( fStencilDepth );
|
||||
|
||||
return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( hsScalar ) : sizeof( UInt16 ) ) + sizeof( hsBool );
|
||||
return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( float ) : sizeof( uint16_t ) ) + sizeof( hsBool );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//// plCubicRenderTarget Functions ////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 plCubicRenderTarget::Read( hsStream *s )
|
||||
uint32_t plCubicRenderTarget::Read( hsStream *s )
|
||||
{
|
||||
int i;
|
||||
UInt32 total = plRenderTarget::Read( s );
|
||||
uint32_t total = plRenderTarget::Read( s );
|
||||
|
||||
|
||||
for( i = 0; i < 6; i++ )
|
||||
{
|
||||
if( fFaces[ i ] == nil )
|
||||
fFaces[ i ] = TRACKED_NEW plRenderTarget();
|
||||
fFaces[ i ] = new plRenderTarget();
|
||||
|
||||
fFaces[ i ]->fParent = this;
|
||||
total += fFaces[ i ]->Read( s );
|
||||
@ -170,10 +170,10 @@ UInt32 plCubicRenderTarget::Read( hsStream *s )
|
||||
return total;
|
||||
}
|
||||
|
||||
UInt32 plCubicRenderTarget::Write( hsStream *s )
|
||||
uint32_t plCubicRenderTarget::Write( hsStream *s )
|
||||
{
|
||||
int i;
|
||||
UInt32 total = plRenderTarget::Write( s );
|
||||
uint32_t total = plRenderTarget::Write( s );
|
||||
|
||||
|
||||
for( i = 0; i < 6; i++ )
|
||||
@ -184,9 +184,9 @@ UInt32 plCubicRenderTarget::Write( hsStream *s )
|
||||
return total;
|
||||
}
|
||||
|
||||
UInt32 plCubicRenderTarget::GetTotalSize( void ) const
|
||||
uint32_t plCubicRenderTarget::GetTotalSize( void ) const
|
||||
{
|
||||
UInt32 size = 0, i;
|
||||
uint32_t size = 0, i;
|
||||
|
||||
for( i = 0; i < 6; i++ )
|
||||
{
|
||||
|
@ -71,30 +71,30 @@ class plRenderTarget : public plBitmap
|
||||
|
||||
protected:
|
||||
|
||||
UInt16 fWidth, fHeight;
|
||||
uint16_t fWidth, fHeight;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
UInt16 fLeft, fTop, fRight, fBottom;
|
||||
uint16_t fLeft, fTop, fRight, fBottom;
|
||||
} fAbsolute;
|
||||
struct
|
||||
{
|
||||
hsScalar fLeft, fTop, fRight, fBottom;
|
||||
float fLeft, fTop, fRight, fBottom;
|
||||
} fProportional;
|
||||
} fViewport;
|
||||
|
||||
hsBool fApplyTexQuality;
|
||||
hsBool fProportionalViewport;
|
||||
UInt8 fZDepth, fStencilDepth;
|
||||
uint8_t fZDepth, fStencilDepth;
|
||||
|
||||
plCubicRenderTarget *fParent;
|
||||
|
||||
virtual void SetKey(plKey k);
|
||||
|
||||
virtual UInt32 Read( hsStream *s );
|
||||
virtual UInt32 Write( hsStream *s );
|
||||
virtual uint32_t Read( hsStream *s );
|
||||
virtual uint32_t Write( hsStream *s );
|
||||
public:
|
||||
|
||||
CLASSNAME_REGISTER( plRenderTarget );
|
||||
@ -116,7 +116,7 @@ class plRenderTarget : public plBitmap
|
||||
plPipeResReq::Request();
|
||||
}
|
||||
|
||||
plRenderTarget( UInt16 flags, UInt16 width, UInt16 height, UInt8 bitDepth, UInt8 zDepth = 0xff, UInt8 stencilDepth = 0xff )
|
||||
plRenderTarget( uint16_t flags, uint16_t width, uint16_t height, uint8_t bitDepth, uint8_t zDepth = 0xff, uint8_t stencilDepth = 0xff )
|
||||
{
|
||||
fWidth = width;
|
||||
fHeight = height;
|
||||
@ -136,7 +136,7 @@ class plRenderTarget : public plBitmap
|
||||
}
|
||||
|
||||
// Render-to-Screen constructor
|
||||
plRenderTarget( UInt16 flags, hsScalar left, hsScalar top, hsScalar right, hsScalar bottom, UInt8 bitDepth, UInt8 zDepth = 0xff, UInt8 stencilDepth = 0xff )
|
||||
plRenderTarget( uint16_t flags, float left, float top, float right, float bottom, uint8_t bitDepth, uint8_t zDepth = 0xff, uint8_t stencilDepth = 0xff )
|
||||
{
|
||||
fWidth = 0; // Can't really set these, at least not yet
|
||||
fHeight = 0;
|
||||
@ -157,7 +157,7 @@ class plRenderTarget : public plBitmap
|
||||
|
||||
virtual ~plRenderTarget() {}
|
||||
|
||||
virtual void SetViewport( UInt16 left, UInt16 top, UInt16 right, UInt16 bottom )
|
||||
virtual void SetViewport( uint16_t left, uint16_t top, uint16_t right, uint16_t bottom )
|
||||
{
|
||||
ASSERT_ABSOLUTE;
|
||||
fViewport.fAbsolute.fLeft = left;
|
||||
@ -166,7 +166,7 @@ class plRenderTarget : public plBitmap
|
||||
fViewport.fAbsolute.fBottom = bottom;
|
||||
}
|
||||
|
||||
virtual void SetViewport( hsScalar left, hsScalar top, hsScalar right, hsScalar bottom )
|
||||
virtual void SetViewport( float left, float top, float right, float bottom )
|
||||
{
|
||||
ASSERT_PROPORTIONAL;
|
||||
fViewport.fProportional.fLeft = left;
|
||||
@ -175,26 +175,26 @@ class plRenderTarget : public plBitmap
|
||||
fViewport.fProportional.fBottom = bottom;
|
||||
}
|
||||
|
||||
UInt16 GetWidth( void ) { return fWidth; }
|
||||
UInt16 GetHeight( void ) { return fHeight; }
|
||||
UInt8 GetZDepth( void ) { return fZDepth; }
|
||||
UInt8 GetStencilDepth( void ) { return fStencilDepth; }
|
||||
uint16_t GetWidth( void ) { return fWidth; }
|
||||
uint16_t GetHeight( void ) { return fHeight; }
|
||||
uint8_t GetZDepth( void ) { return fZDepth; }
|
||||
uint8_t GetStencilDepth( void ) { return fStencilDepth; }
|
||||
|
||||
UInt16 GetVPLeft( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fLeft; }
|
||||
UInt16 GetVPTop( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fTop; }
|
||||
UInt16 GetVPRight( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fRight; }
|
||||
UInt16 GetVPBottom( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fBottom; }
|
||||
uint16_t GetVPLeft( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fLeft; }
|
||||
uint16_t GetVPTop( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fTop; }
|
||||
uint16_t GetVPRight( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fRight; }
|
||||
uint16_t GetVPBottom( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fBottom; }
|
||||
|
||||
hsScalar GetVPLeftProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fLeft; }
|
||||
hsScalar GetVPTopProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fTop; }
|
||||
hsScalar GetVPRightProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fRight; }
|
||||
hsScalar GetVPBottomProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fBottom; }
|
||||
float GetVPLeftProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fLeft; }
|
||||
float GetVPTopProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fTop; }
|
||||
float GetVPRightProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fRight; }
|
||||
float GetVPBottomProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fBottom; }
|
||||
|
||||
hsBool ViewIsProportional( void ) const { return fProportionalViewport; }
|
||||
|
||||
plCubicRenderTarget *GetParent( void ) const { return fParent; }
|
||||
|
||||
virtual UInt32 GetTotalSize( void ) const { return fWidth * fHeight * ( fPixelSize >> 3 ); }
|
||||
virtual uint32_t GetTotalSize( void ) const { return fWidth * fHeight * ( fPixelSize >> 3 ); }
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
|
@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plStatusLogDrawer.h"
|
||||
#include "plPipeline.h"
|
||||
#include "plDebugText.h"
|
||||
@ -57,7 +57,7 @@ void plStatusLogDrawer::IDrawLogNames(plStatusLog* curLog, plStatusLog* firstLog
|
||||
{
|
||||
plDebugText& drawText = plDebugText::Instance();
|
||||
|
||||
UInt32 width = 0, numLogs = 0;
|
||||
uint32_t width = 0, numLogs = 0;
|
||||
|
||||
plStatusLog* iLog = firstLog;
|
||||
while (iLog)
|
||||
@ -67,17 +67,17 @@ void plStatusLogDrawer::IDrawLogNames(plStatusLog* curLog, plStatusLog* firstLog
|
||||
numLogs++;
|
||||
}
|
||||
|
||||
UInt32 height = drawText.GetFontHeight() + 2;
|
||||
drawText.DrawRect(0, 0, (UInt16)width, (UInt16)(height*numLogs), 0, 0, 0);
|
||||
uint32_t height = drawText.GetFontHeight() + 2;
|
||||
drawText.DrawRect(0, 0, (uint16_t)width, (uint16_t)(height*numLogs), 0, 0, 0);
|
||||
|
||||
UInt32 yPos = 0;
|
||||
uint32_t yPos = 0;
|
||||
iLog = firstLog;
|
||||
while (iLog)
|
||||
{
|
||||
if (iLog == curLog)
|
||||
drawText.DrawString(2, (UInt16)yPos, iLog->GetFileName(), 0, 255, 0);
|
||||
drawText.DrawString(2, (uint16_t)yPos, iLog->GetFileName(), 0, 255, 0);
|
||||
else
|
||||
drawText.DrawString(2, (UInt16)yPos, iLog->GetFileName());
|
||||
drawText.DrawString(2, (uint16_t)yPos, iLog->GetFileName());
|
||||
|
||||
iLog = iLog->fNext;
|
||||
yPos += height;
|
||||
|
@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#ifndef _plStencil_h
|
||||
#define _plStencil_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
|
||||
|
||||
//// Stencil Caps /////////////////////////////////////////////////////////////
|
||||
@ -96,8 +96,8 @@ class plStencilCaps
|
||||
};
|
||||
|
||||
hsBool fIsSupported;
|
||||
UInt8 fSupportedDepths;
|
||||
UInt8 fSupportedOps;
|
||||
uint8_t fSupportedDepths;
|
||||
uint8_t fSupportedOps;
|
||||
};
|
||||
|
||||
#endif // _plStencil_h
|
||||
|
@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsWindows.h"
|
||||
|
||||
#include "HeadSpin.h"
|
||||
#include "plTextFont.h"
|
||||
#include "plDebugText.h"
|
||||
@ -73,11 +73,11 @@ plTextFont::~plTextFont()
|
||||
|
||||
//// IInitFontTexture /////////////////////////////////////////////////////////
|
||||
|
||||
UInt16 *plTextFont::IInitFontTexture( void )
|
||||
uint16_t *plTextFont::IInitFontTexture( void )
|
||||
{
|
||||
int nHeight, x, y, c;
|
||||
char myChar[ 2 ] = "x";
|
||||
UInt16 *tBits;
|
||||
uint16_t *tBits;
|
||||
|
||||
DWORD *bitmapBits;
|
||||
BITMAPINFO bmi;
|
||||
@ -138,7 +138,7 @@ UInt16 *plTextFont::IInitFontTexture( void )
|
||||
myChar[ 0 ] = c;
|
||||
GetTextExtentPoint32( hDC, myChar, 1, &size );
|
||||
|
||||
if( (UInt32)( x + size.cx + 1 ) > fTextureWidth )
|
||||
if( (uint32_t)( x + size.cx + 1 ) > fTextureWidth )
|
||||
{
|
||||
x = 0;
|
||||
y += size.cy + 1;
|
||||
@ -146,8 +146,8 @@ UInt16 *plTextFont::IInitFontTexture( void )
|
||||
|
||||
ExtTextOut( hDC, x, y, ETO_OPAQUE, nil, myChar, 1, nil );
|
||||
|
||||
fCharInfo[ c ].fW = (UInt16)size.cx;
|
||||
fCharInfo[ c ].fH = (UInt16)size.cy;
|
||||
fCharInfo[ c ].fW = (uint16_t)size.cx;
|
||||
fCharInfo[ c ].fH = (uint16_t)size.cy;
|
||||
fCharInfo[ c ].fUVs[ 0 ].fX = (float)x / (float)fTextureWidth;
|
||||
fCharInfo[ c ].fUVs[ 0 ].fY = (float)y / (float)fTextureHeight;
|
||||
fCharInfo[ c ].fUVs[ 1 ].fX = (float)( x + size.cx ) / (float)fTextureWidth;
|
||||
@ -166,7 +166,7 @@ UInt16 *plTextFont::IInitFontTexture( void )
|
||||
fCharInfo[ '\t' ].fH = fCharInfo[ 32 ].fH;
|
||||
|
||||
/// Now create the data block
|
||||
UInt16 *data = TRACKED_NEW UInt16[ fTextureWidth * fTextureHeight ];
|
||||
uint16_t *data = new uint16_t[ fTextureWidth * fTextureHeight ];
|
||||
tBits = data;
|
||||
for( y = 0; y < fTextureHeight; y++ )
|
||||
{
|
||||
@ -193,7 +193,7 @@ UInt16 *plTextFont::IInitFontTexture( void )
|
||||
|
||||
//// Create ///////////////////////////////////////////////////////////////////
|
||||
|
||||
void plTextFont::Create( char *face, UInt16 size )
|
||||
void plTextFont::Create( char *face, uint16_t size )
|
||||
{
|
||||
// Init normal stuff
|
||||
strncpy( fFace, face, sizeof( fFace ) );
|
||||
@ -204,7 +204,7 @@ void plTextFont::Create( char *face, UInt16 size )
|
||||
|
||||
void plTextFont::IInitObjects( void )
|
||||
{
|
||||
UInt16 *data;
|
||||
uint16_t *data;
|
||||
|
||||
|
||||
// Create texture
|
||||
@ -222,8 +222,8 @@ void plTextFont::IInitObjects( void )
|
||||
|
||||
//// DrawString ///////////////////////////////////////////////////////////////
|
||||
|
||||
void plTextFont::DrawString( const char *string, int sX, int sY, UInt32 hexColor,
|
||||
UInt8 style, UInt32 rightEdge )
|
||||
void plTextFont::DrawString( const char *string, int sX, int sY, uint32_t hexColor,
|
||||
uint8_t style, uint32_t rightEdge )
|
||||
{
|
||||
static hsTArray<plFontVertex> verts;
|
||||
|
||||
@ -355,7 +355,7 @@ void plTextFont::DrawString( const char *string, int sX, int sY, UInt32 hexCo
|
||||
|
||||
//// CalcStringWidth //////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 plTextFont::CalcStringWidth( const char *string )
|
||||
uint32_t plTextFont::CalcStringWidth( const char *string )
|
||||
{
|
||||
int i, width = 0;
|
||||
|
||||
@ -378,7 +378,7 @@ UInt32 plTextFont::CalcStringWidth( const char *string )
|
||||
// to create a background for our console; will be obliterated once we figure
|
||||
// a better way to do so.
|
||||
|
||||
void plTextFont::DrawRect( int left, int top, int right, int bottom, UInt32 hexColor )
|
||||
void plTextFont::DrawRect( int left, int top, int right, int bottom, uint32_t hexColor )
|
||||
{
|
||||
static hsTArray<plFontVertex> verts;
|
||||
int i;
|
||||
@ -412,7 +412,7 @@ void plTextFont::DrawRect( int left, int top, int right, int bottom, UInt32 h
|
||||
// second. I just LOOOOVE temporary functions :)
|
||||
// Note: this way sucks. Live with it.
|
||||
|
||||
void plTextFont::Draw3DBorder( int left, int top, int right, int bottom, UInt32 hexColor1, UInt32 hexColor2 )
|
||||
void plTextFont::Draw3DBorder( int left, int top, int right, int bottom, uint32_t hexColor1, uint32_t hexColor2 )
|
||||
{
|
||||
static hsTArray<plFontVertex> verts;
|
||||
int i;
|
||||
|
@ -67,14 +67,14 @@ class plTextFont
|
||||
|
||||
struct plDXCharInfo
|
||||
{
|
||||
UInt16 fW, fH;
|
||||
uint16_t fW, fH;
|
||||
hsPoint3 fUVs[ 2 ];
|
||||
};
|
||||
|
||||
struct plFontVertex
|
||||
{
|
||||
hsPoint3 fPoint;
|
||||
UInt32 fColor;
|
||||
uint32_t fColor;
|
||||
hsPoint3 fUV;
|
||||
|
||||
plFontVertex& operator=(const int zero)
|
||||
@ -87,13 +87,13 @@ class plTextFont
|
||||
}
|
||||
};
|
||||
|
||||
UInt32 fMaxNumIndices;
|
||||
UInt32 fTextureWidth, fTextureHeight;
|
||||
uint32_t fMaxNumIndices;
|
||||
uint32_t fTextureWidth, fTextureHeight;
|
||||
|
||||
char fFace[ 128 ];
|
||||
UInt16 fSize;
|
||||
uint16_t fSize;
|
||||
hsBool fInitialized;
|
||||
UInt16 fFontHeight;
|
||||
uint16_t fFontHeight;
|
||||
|
||||
plPipeline *fPipe;
|
||||
|
||||
@ -104,12 +104,12 @@ class plTextFont
|
||||
|
||||
|
||||
virtual void IInitObjects( void );
|
||||
virtual void ICreateTexture( UInt16 *data ) = 0;
|
||||
virtual void ICreateTexture( uint16_t *data ) = 0;
|
||||
virtual void IInitStateBlocks( void ) = 0;
|
||||
virtual void IDrawPrimitive( UInt32 count, plFontVertex *array ) = 0;
|
||||
virtual void IDrawLines( UInt32 count, plFontVertex *array ) = 0;
|
||||
virtual void IDrawPrimitive( uint32_t count, plFontVertex *array ) = 0;
|
||||
virtual void IDrawLines( uint32_t count, plFontVertex *array ) = 0;
|
||||
|
||||
UInt16 *IInitFontTexture( void );
|
||||
uint16_t *IInitFontTexture( void );
|
||||
|
||||
void IUnlink( void )
|
||||
{
|
||||
@ -127,14 +127,14 @@ class plTextFont
|
||||
plTextFont( plPipeline *pipe );
|
||||
virtual ~plTextFont();
|
||||
|
||||
void Create( char *face, UInt16 size );
|
||||
void DrawString( const char *string, int x, int y, UInt32 hexColor, UInt8 style, UInt32 rightEdge = 0 );
|
||||
void DrawRect( int left, int top, int right, int bottom, UInt32 hexColor );
|
||||
void Draw3DBorder( int left, int top, int right, int bottom, UInt32 hexColor1, UInt32 hexColor2 );
|
||||
UInt32 CalcStringWidth( const char *string );
|
||||
UInt32 GetFontSize( void ) { return fSize; }
|
||||
void Create( char *face, uint16_t size );
|
||||
void DrawString( const char *string, int x, int y, uint32_t hexColor, uint8_t style, uint32_t rightEdge = 0 );
|
||||
void DrawRect( int left, int top, int right, int bottom, uint32_t hexColor );
|
||||
void Draw3DBorder( int left, int top, int right, int bottom, uint32_t hexColor1, uint32_t hexColor2 );
|
||||
uint32_t CalcStringWidth( const char *string );
|
||||
uint32_t GetFontSize( void ) { return fSize; }
|
||||
|
||||
UInt16 GetFontHeight() { return fFontHeight; }
|
||||
uint16_t GetFontHeight() { return fFontHeight; }
|
||||
|
||||
virtual void DestroyObjects( void ) = 0;
|
||||
virtual void SaveStates( void ) = 0;
|
||||
|
@ -50,8 +50,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsWindows.h"
|
||||
#include "hsTypes.h"
|
||||
|
||||
#include "HeadSpin.h"
|
||||
#include "hsMatrix44.h"
|
||||
#include "pnKeyedObject/hsKeyedObject.h"
|
||||
#include "plTextGenerator.h"
|
||||
@ -77,7 +77,7 @@ plTextGenerator::plTextGenerator()
|
||||
fHost = nil;
|
||||
}
|
||||
|
||||
plTextGenerator::plTextGenerator( plMipmap *host, UInt16 width, UInt16 height )
|
||||
plTextGenerator::plTextGenerator( plMipmap *host, uint16_t width, uint16_t height )
|
||||
{
|
||||
fHost = nil;
|
||||
Attach( host, width, height );
|
||||
@ -96,9 +96,9 @@ plTextGenerator::~plTextGenerator()
|
||||
// Grab onto a plMipmap, suck the texture out of it and replace it with our
|
||||
// own.
|
||||
|
||||
void plTextGenerator::Attach( plMipmap *host, UInt16 width, UInt16 height )
|
||||
void plTextGenerator::Attach( plMipmap *host, uint16_t width, uint16_t height )
|
||||
{
|
||||
UInt16 textWidth, textHeight;
|
||||
uint16_t textWidth, textHeight;
|
||||
|
||||
|
||||
hsAssert( fHost == nil, "Attempting to attach an already attached plTextGenerator" );
|
||||
@ -151,7 +151,7 @@ void plTextGenerator::Attach( plMipmap *host, UInt16 width, UInt16 height )
|
||||
}
|
||||
|
||||
/// Send ourselves a passive ref of the mipmap, so we get notified if and when it goes away
|
||||
hsgResMgr::ResMgr()->AddViaNotify( fHost->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, 0 ), plRefFlags::kActiveRef );
|
||||
hsgResMgr::ResMgr()->AddViaNotify( fHost->GetKey(), new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, 0 ), plRefFlags::kActiveRef );
|
||||
#endif
|
||||
/// All done!
|
||||
}
|
||||
@ -160,7 +160,7 @@ void plTextGenerator::Attach( plMipmap *host, UInt16 width, UInt16 height )
|
||||
// OS-specific. Allocates a rectangular bitmap of the given dimensions that
|
||||
// the OS can draw text into. Returns a pointer to the pixels.
|
||||
|
||||
UInt32 *plTextGenerator::IAllocateOSSurface( UInt16 width, UInt16 height )
|
||||
uint32_t *plTextGenerator::IAllocateOSSurface( uint16_t width, uint16_t height )
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
|
||||
@ -201,7 +201,7 @@ UInt32 *plTextGenerator::IAllocateOSSurface( UInt16 width, UInt16 height )
|
||||
|
||||
SelectObject( fWinAlphaDC, fWinAlphaBitmap );
|
||||
|
||||
return (UInt32 *)fWinRGBBits;
|
||||
return (uint32_t *)fWinRGBBits;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -257,8 +257,8 @@ void plTextGenerator::IDestroyOSSurface( void )
|
||||
void plTextGenerator::ClearToColor( hsColorRGBA &color )
|
||||
{
|
||||
int i;
|
||||
UInt32 *data = (UInt32 *)fHost->fImage;
|
||||
UInt32 hexColor = color.ToARGB32();
|
||||
uint32_t *data = (uint32_t *)fHost->fImage;
|
||||
uint32_t hexColor = color.ToARGB32();
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
GdiFlush();
|
||||
@ -269,14 +269,14 @@ void plTextGenerator::ClearToColor( hsColorRGBA &color )
|
||||
|
||||
// Fill our alpha bitmap as well, since we use that too
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
memset( fWinAlphaBits, (UInt8)( color.a * 255.f ), fHost->fWidth * fHost->fHeight );
|
||||
memset( fWinAlphaBits, (uint8_t)( color.a * 255.f ), fHost->fWidth * fHost->fHeight );
|
||||
#endif
|
||||
}
|
||||
|
||||
//// SetFont //////////////////////////////////////////////////////////////////
|
||||
// OS-specific. Load the given font for drawing the text with.
|
||||
|
||||
void plTextGenerator::SetFont( const char *face, UInt16 size, hsBool antiAliasRGB )
|
||||
void plTextGenerator::SetFont( const char *face, uint16_t size, hsBool antiAliasRGB )
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
if( fWinFont != nil )
|
||||
@ -338,14 +338,14 @@ void plTextGenerator::SetTextColor( hsColorRGBA &color, hsBool blockRGB )
|
||||
|
||||
//// DrawString ///////////////////////////////////////////////////////////////
|
||||
|
||||
void plTextGenerator::DrawString( UInt16 x, UInt16 y, const char *text )
|
||||
void plTextGenerator::DrawString( uint16_t x, uint16_t y, const char *text )
|
||||
{
|
||||
wchar_t *wText = hsStringToWString(text);
|
||||
DrawString(x,y,wText);
|
||||
delete [] wText;
|
||||
}
|
||||
|
||||
void plTextGenerator::DrawString( UInt16 x, UInt16 y, const wchar_t *text )
|
||||
void plTextGenerator::DrawString( uint16_t x, uint16_t y, const wchar_t *text )
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
|
||||
@ -357,14 +357,14 @@ void plTextGenerator::DrawString( UInt16 x, UInt16 y, const wchar_t *text )
|
||||
|
||||
//// DrawClippedString ////////////////////////////////////////////////////////
|
||||
|
||||
void plTextGenerator::DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 width, UInt16 height )
|
||||
void plTextGenerator::DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t width, uint16_t height )
|
||||
{
|
||||
wchar_t *wText = hsStringToWString(text);
|
||||
DrawClippedString(x,y,wText,width,height);
|
||||
delete [] wText;
|
||||
}
|
||||
|
||||
void plTextGenerator::DrawClippedString( Int16 x, Int16 y, const wchar_t *text, UInt16 width, UInt16 height )
|
||||
void plTextGenerator::DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t width, uint16_t height )
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
|
||||
@ -379,14 +379,14 @@ void plTextGenerator::DrawClippedString( Int16 x, Int16 y, const wchar_t *tex
|
||||
|
||||
//// DrawClippedString ////////////////////////////////////////////////////////
|
||||
|
||||
void plTextGenerator::DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height )
|
||||
void plTextGenerator::DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height )
|
||||
{
|
||||
wchar_t *wText = hsStringToWString(text);
|
||||
DrawClippedString(x,y,wText,clipX,clipY,width,height);
|
||||
delete [] wText;
|
||||
}
|
||||
|
||||
void plTextGenerator::DrawClippedString( Int16 x, Int16 y, const wchar_t *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height )
|
||||
void plTextGenerator::DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height )
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
|
||||
@ -401,14 +401,14 @@ void plTextGenerator::DrawClippedString( Int16 x, Int16 y, const wchar_t *tex
|
||||
|
||||
//// DrawWrappedString ////////////////////////////////////////////////////////
|
||||
|
||||
void plTextGenerator::DrawWrappedString( UInt16 x, UInt16 y, const char *text, UInt16 width, UInt16 height )
|
||||
void plTextGenerator::DrawWrappedString( uint16_t x, uint16_t y, const char *text, uint16_t width, uint16_t height )
|
||||
{
|
||||
wchar_t *wText = hsStringToWString(text);
|
||||
DrawWrappedString(x,y,wText,width,height);
|
||||
delete [] wText;
|
||||
}
|
||||
|
||||
void plTextGenerator::DrawWrappedString( UInt16 x, UInt16 y, const wchar_t *text, UInt16 width, UInt16 height )
|
||||
void plTextGenerator::DrawWrappedString( uint16_t x, uint16_t y, const wchar_t *text, uint16_t width, uint16_t height )
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
|
||||
@ -428,15 +428,15 @@ void plTextGenerator::DrawWrappedString( UInt16 x, UInt16 y, const wchar_t *t
|
||||
|
||||
//// CalcStringWidth //////////////////////////////////////////////////////////
|
||||
|
||||
UInt16 plTextGenerator::CalcStringWidth( const char *text, UInt16 *height )
|
||||
uint16_t plTextGenerator::CalcStringWidth( const char *text, uint16_t *height )
|
||||
{
|
||||
wchar_t *wText = hsStringToWString(text);
|
||||
UInt16 retVal = CalcStringWidth(wText,height);
|
||||
uint16_t retVal = CalcStringWidth(wText,height);
|
||||
delete [] wText;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
UInt16 plTextGenerator::CalcStringWidth( const wchar_t *text, UInt16 *height )
|
||||
uint16_t plTextGenerator::CalcStringWidth( const wchar_t *text, uint16_t *height )
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
|
||||
@ -444,22 +444,22 @@ UInt16 plTextGenerator::CalcStringWidth( const wchar_t *text, UInt16 *heigh
|
||||
::GetTextExtentPoint32W( fWinRGBDC, text, wcslen( text ), &size );
|
||||
|
||||
if( height != nil )
|
||||
*height = (UInt16)size.cy;
|
||||
*height = (uint16_t)size.cy;
|
||||
|
||||
return (UInt16)size.cx;
|
||||
return (uint16_t)size.cx;
|
||||
#endif
|
||||
}
|
||||
|
||||
//// CalcWrappedStringSize ////////////////////////////////////////////////////
|
||||
|
||||
void plTextGenerator::CalcWrappedStringSize( const char *text, UInt16 *width, UInt16 *height )
|
||||
void plTextGenerator::CalcWrappedStringSize( const char *text, uint16_t *width, uint16_t *height )
|
||||
{
|
||||
wchar_t *wText = hsStringToWString(text);
|
||||
CalcWrappedStringSize(wText,width,height);
|
||||
delete [] wText;
|
||||
}
|
||||
|
||||
void plTextGenerator::CalcWrappedStringSize( const wchar_t *text, UInt16 *width, UInt16 *height )
|
||||
void plTextGenerator::CalcWrappedStringSize( const wchar_t *text, uint16_t *width, uint16_t *height )
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
|
||||
@ -468,15 +468,15 @@ void plTextGenerator::CalcWrappedStringSize( const wchar_t *text, UInt16 *wid
|
||||
|
||||
::DrawTextW( fWinRGBDC, text, wcslen( text ), &r, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_WORDBREAK | DT_CALCRECT );
|
||||
|
||||
*width = (UInt16)(r.right);
|
||||
*width = (uint16_t)(r.right);
|
||||
if( height != nil )
|
||||
*height = (UInt16)r.bottom;
|
||||
*height = (uint16_t)r.bottom;
|
||||
#endif
|
||||
}
|
||||
|
||||
//// FillRect /////////////////////////////////////////////////////////////////
|
||||
|
||||
void plTextGenerator::FillRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color )
|
||||
void plTextGenerator::FillRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color )
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
|
||||
@ -500,7 +500,7 @@ void plTextGenerator::FillRect( UInt16 x, UInt16 y, UInt16 width, UInt16 heig
|
||||
|
||||
//// FrameRect ////////////////////////////////////////////////////////////////
|
||||
|
||||
void plTextGenerator::FrameRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color )
|
||||
void plTextGenerator::FrameRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color )
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
|
||||
@ -531,9 +531,9 @@ void plTextGenerator::FlushToHost( void )
|
||||
GdiFlush();
|
||||
|
||||
// Now copy our alpha channel over. I hate the GDI
|
||||
UInt32 i = fHost->fWidth * fHost->fHeight;
|
||||
UInt32 *dest = fWinRGBBits;
|
||||
UInt8 *src = fWinAlphaBits;
|
||||
uint32_t i = fHost->fWidth * fHost->fHeight;
|
||||
uint32_t *dest = fWinRGBBits;
|
||||
uint8_t *src = fWinAlphaBits;
|
||||
|
||||
/* while( i-- )
|
||||
{
|
||||
@ -559,14 +559,14 @@ void plTextGenerator::FlushToHost( void )
|
||||
|
||||
//// GetTextWidth/Height //////////////////////////////////////////////////////
|
||||
|
||||
UInt16 plTextGenerator::GetTextWidth( void )
|
||||
uint16_t plTextGenerator::GetTextWidth( void )
|
||||
{
|
||||
return ( fHost != nil ) ? (UInt16)(fHost->fWidth) : 0;
|
||||
return ( fHost != nil ) ? (uint16_t)(fHost->fWidth) : 0;
|
||||
}
|
||||
|
||||
UInt16 plTextGenerator::GetTextHeight( void )
|
||||
uint16_t plTextGenerator::GetTextHeight( void )
|
||||
{
|
||||
return ( fHost != nil ) ? (UInt16)(fHost->fHeight) : 0;
|
||||
return ( fHost != nil ) ? (uint16_t)(fHost->fHeight) : 0;
|
||||
}
|
||||
|
||||
//// GetLayerTransform ////////////////////////////////////////////////////////
|
||||
|
@ -69,61 +69,61 @@ class plTextGenerator : public hsKeyedObject
|
||||
protected:
|
||||
|
||||
plMipmap *fHost;
|
||||
UInt16 fWidth, fHeight;
|
||||
uint16_t fWidth, fHeight;
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
HDC fWinRGBDC;
|
||||
HBITMAP fWinRGBBitmap;
|
||||
HFONT fWinFont;
|
||||
UInt32 *fWinRGBBits;
|
||||
uint32_t *fWinRGBBits;
|
||||
|
||||
HFONT fWinAlphaFont;
|
||||
HDC fWinAlphaDC;
|
||||
HBITMAP fWinAlphaBitmap;
|
||||
UInt8 *fWinAlphaBits;
|
||||
uint8_t *fWinAlphaBits;
|
||||
#endif
|
||||
|
||||
UInt32 *IAllocateOSSurface( UInt16 width, UInt16 height );
|
||||
uint32_t *IAllocateOSSurface( uint16_t width, uint16_t height );
|
||||
void IDestroyOSSurface( void );
|
||||
|
||||
public:
|
||||
|
||||
plTextGenerator();
|
||||
plTextGenerator( plMipmap *host, UInt16 width, UInt16 height );
|
||||
plTextGenerator( plMipmap *host, uint16_t width, uint16_t height );
|
||||
virtual ~plTextGenerator();
|
||||
|
||||
void Attach( plMipmap *host, UInt16 width, UInt16 height );
|
||||
void Attach( plMipmap *host, uint16_t width, uint16_t height );
|
||||
void Detach( void );
|
||||
|
||||
/// Operations to perform on the text block
|
||||
|
||||
void ClearToColor( hsColorRGBA &color );
|
||||
|
||||
void SetFont( const char *face, UInt16 size, hsBool antiAliasRGB = true );
|
||||
void SetFont( const char *face, uint16_t size, hsBool antiAliasRGB = true );
|
||||
void SetTextColor( hsColorRGBA &color, hsBool blockRGB = false );
|
||||
|
||||
void DrawString( UInt16 x, UInt16 y, const char *text );
|
||||
void DrawString( UInt16 x, UInt16 y, const wchar_t *text );
|
||||
void DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 width, UInt16 height );
|
||||
void DrawClippedString( Int16 x, Int16 y, const wchar_t *text, UInt16 width, UInt16 height );
|
||||
void DrawClippedString( Int16 x, Int16 y, const char *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height );
|
||||
void DrawClippedString( Int16 x, Int16 y, const wchar_t *text, UInt16 clipX, UInt16 clipY, UInt16 width, UInt16 height );
|
||||
void DrawWrappedString( UInt16 x, UInt16 y, const char *text, UInt16 width, UInt16 height );
|
||||
void DrawWrappedString( UInt16 x, UInt16 y, const wchar_t *text, UInt16 width, UInt16 height );
|
||||
UInt16 CalcStringWidth( const char *text, UInt16 *height = nil );
|
||||
UInt16 CalcStringWidth( const wchar_t *text, UInt16 *height = nil );
|
||||
void CalcWrappedStringSize( const char *text, UInt16 *width, UInt16 *height );
|
||||
void CalcWrappedStringSize( const wchar_t *text, UInt16 *width, UInt16 *height );
|
||||
void FillRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color );
|
||||
void FrameRect( UInt16 x, UInt16 y, UInt16 width, UInt16 height, hsColorRGBA &color );
|
||||
void DrawString( uint16_t x, uint16_t y, const char *text );
|
||||
void DrawString( uint16_t x, uint16_t y, const wchar_t *text );
|
||||
void DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t width, uint16_t height );
|
||||
void DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t width, uint16_t height );
|
||||
void DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height );
|
||||
void DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height );
|
||||
void DrawWrappedString( uint16_t x, uint16_t y, const char *text, uint16_t width, uint16_t height );
|
||||
void DrawWrappedString( uint16_t x, uint16_t y, const wchar_t *text, uint16_t width, uint16_t height );
|
||||
uint16_t CalcStringWidth( const char *text, uint16_t *height = nil );
|
||||
uint16_t CalcStringWidth( const wchar_t *text, uint16_t *height = nil );
|
||||
void CalcWrappedStringSize( const char *text, uint16_t *width, uint16_t *height );
|
||||
void CalcWrappedStringSize( const wchar_t *text, uint16_t *width, uint16_t *height );
|
||||
void FillRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color );
|
||||
void FrameRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color );
|
||||
|
||||
void FlushToHost( void );
|
||||
|
||||
UInt16 GetTextWidth( void );
|
||||
UInt16 GetTextHeight( void );
|
||||
uint16_t GetTextWidth( void );
|
||||
uint16_t GetTextHeight( void );
|
||||
|
||||
UInt16 GetWidth( void ) { return fWidth; }
|
||||
UInt16 GetHeight( void ) { return fHeight; }
|
||||
uint16_t GetWidth( void ) { return fWidth; }
|
||||
uint16_t GetHeight( void ) { return fHeight; }
|
||||
|
||||
// Since the textGen can actually create a texture bigger than you were expecting,
|
||||
// you want to be able to apply a layer texture transform that will compensate. This
|
||||
|
@ -52,8 +52,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsWindows.h"
|
||||
#include "hsTypes.h"
|
||||
|
||||
#include "HeadSpin.h"
|
||||
#include "plTransitionMgr.h"
|
||||
#include "plPlates.h"
|
||||
|
||||
@ -129,7 +129,7 @@ void plTransitionMgr::ICreatePlate( void )
|
||||
plMipmap *ourMip = fEffectPlate->CreateMaterial( 16, 16, true );
|
||||
for( y = 0; y < ourMip->GetHeight(); y++ )
|
||||
{
|
||||
UInt32 *pixels = ourMip->GetAddr32( 0, y );
|
||||
uint32_t *pixels = ourMip->GetAddr32( 0, y );
|
||||
for( x = 0; x < ourMip->GetWidth(); x++ )
|
||||
pixels[ x ] = 0xff000000;
|
||||
}
|
||||
@ -139,7 +139,7 @@ void plTransitionMgr::ICreatePlate( void )
|
||||
|
||||
//// IStartFadeOut ///////////////////////////////////////////////////////////
|
||||
|
||||
void plTransitionMgr::IStartFadeOut( hsScalar lengthInSecs, UInt8 effect )
|
||||
void plTransitionMgr::IStartFadeOut( float lengthInSecs, uint8_t effect )
|
||||
{
|
||||
fCurrentEffect = effect; // default - kFadeOut;
|
||||
fEffectLength = lengthInSecs;
|
||||
@ -177,7 +177,7 @@ void plTransitionMgr::IStartFadeOut( hsScalar lengthInSecs, UInt8 effect )
|
||||
|
||||
//// IStartFadeIn ////////////////////////////////////////////////////////////
|
||||
|
||||
void plTransitionMgr::IStartFadeIn( hsScalar lengthInSecs, UInt8 effect )
|
||||
void plTransitionMgr::IStartFadeIn( float lengthInSecs, uint8_t effect )
|
||||
{
|
||||
fCurrentEffect = effect; // default - kFadeIn;
|
||||
fEffectLength = lengthInSecs;
|
||||
@ -265,17 +265,17 @@ hsBool plTransitionMgr::MsgReceive( plMessage* msg )
|
||||
// So instead we don't start the clock until we get our first plTimeMsg.
|
||||
|
||||
|
||||
fLastTime = (hsScalar)(time->DSeconds());
|
||||
fLastTime = (float)(time->DSeconds());
|
||||
return false;
|
||||
}
|
||||
|
||||
fEffectLength -= (hsScalar)( time->DSeconds() - fLastTime );//*/time->DelSeconds();
|
||||
fEffectLength -= (float)( time->DSeconds() - fLastTime );//*/time->DelSeconds();
|
||||
if( fEffectLength < 0 )
|
||||
IStop();
|
||||
else
|
||||
{
|
||||
// Grab the layer so we can set the opacity
|
||||
fCurrOpacity += (hsScalar)(fOpacDelta * ( time->DSeconds() - fLastTime ));//*/time->DelSeconds();
|
||||
fCurrOpacity += (float)(fOpacDelta * ( time->DSeconds() - fLastTime ));//*/time->DelSeconds();
|
||||
if( fEffectPlate == nil )
|
||||
ICreatePlate();
|
||||
|
||||
@ -290,7 +290,7 @@ hsBool plTransitionMgr::MsgReceive( plMessage* msg )
|
||||
plgAudioSys::SetGlobalFadeVolume( 1.f - fCurrOpacity );
|
||||
|
||||
|
||||
fLastTime = (hsScalar)(time->DSeconds());
|
||||
fLastTime = (float)(time->DSeconds());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -48,10 +48,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#ifndef _plTransitionMgr_h
|
||||
#define _plTransitionMgr_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "hsTemplates.h"
|
||||
#include "pnKeyedObject/hsKeyedObject.h"
|
||||
#include "hsUtils.h"
|
||||
|
||||
|
||||
|
||||
//// Class Definition ////////////////////////////////////////////////////////
|
||||
@ -74,13 +74,13 @@ class plTransitionMgr : public hsKeyedObject
|
||||
kTransitionFadeOut
|
||||
};
|
||||
|
||||
UInt8 fCurrentEffect;
|
||||
uint8_t fCurrentEffect;
|
||||
hsBool fRegisteredForTime, fHoldAtEnd, fPlaying, fNoSoundFade;
|
||||
hsScalar fEffectLength, fCurrOpacity, fOpacDelta;
|
||||
hsScalar fLastTime;
|
||||
float fEffectLength, fCurrOpacity, fOpacDelta;
|
||||
float fLastTime;
|
||||
|
||||
void IStartFadeIn( hsScalar lengthInSecs, UInt8 effect = kFadeIn );
|
||||
void IStartFadeOut( hsScalar lengthInSecs, UInt8 effect = kFadeOut );
|
||||
void IStartFadeIn( float lengthInSecs, uint8_t effect = kFadeIn );
|
||||
void IStartFadeOut( float lengthInSecs, uint8_t effect = kFadeOut );
|
||||
|
||||
void ICreatePlate( void );
|
||||
|
||||
|
@ -40,23 +40,23 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "HeadSpin.h"
|
||||
#include "plVertCoder.h"
|
||||
|
||||
#include "hsStream.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "plGBufferGroup.h"
|
||||
|
||||
const hsScalar kPosQuantum = 1.f / hsScalar(1 << 10);
|
||||
const hsScalar kWeightQuantum = 1.f / hsScalar(1 << 15);
|
||||
const hsScalar kUVWQuantum = 1.f / hsScalar(1 << 16);
|
||||
const float kPosQuantum = 1.f / float(1 << 10);
|
||||
const float kWeightQuantum = 1.f / float(1 << 15);
|
||||
const float kUVWQuantum = 1.f / float(1 << 16);
|
||||
|
||||
UInt32 plVertCoder::fCodedVerts = 0;
|
||||
UInt32 plVertCoder::fCodedBytes = 0;
|
||||
UInt32 plVertCoder::fRawBytes = 0;
|
||||
UInt32 plVertCoder::fSkippedBytes = 0;
|
||||
uint32_t plVertCoder::fCodedVerts = 0;
|
||||
uint32_t plVertCoder::fCodedBytes = 0;
|
||||
uint32_t plVertCoder::fRawBytes = 0;
|
||||
uint32_t plVertCoder::fSkippedBytes = 0;
|
||||
|
||||
static const hsScalar kQuanta[plVertCoder::kNumFloatFields] =
|
||||
static const float kQuanta[plVertCoder::kNumFloatFields] =
|
||||
{
|
||||
kPosQuantum,
|
||||
kWeightQuantum,
|
||||
@ -73,24 +73,24 @@ static const hsScalar kQuanta[plVertCoder::kNumFloatFields] =
|
||||
};
|
||||
|
||||
|
||||
inline void plVertCoder::ICountFloats(const UInt8* src, UInt16 maxCnt, const hsScalar quant, const UInt32 stride,
|
||||
hsScalar& lo, hsBool &allSame, UInt16& count)
|
||||
inline void plVertCoder::ICountFloats(const uint8_t* src, uint16_t maxCnt, const float quant, const uint32_t stride,
|
||||
float& lo, hsBool &allSame, uint16_t& count)
|
||||
{
|
||||
lo = *(hsScalar*)src;
|
||||
lo = *(float*)src;
|
||||
lo = floor(lo / quant + 0.5f) * quant;
|
||||
allSame = false;
|
||||
hsScalar hi = lo;
|
||||
float hi = lo;
|
||||
|
||||
count = 1;
|
||||
|
||||
const hsScalar maxRange = hsScalar(UInt16(0xffff)) * quant;
|
||||
const float maxRange = float(uint16_t(0xffff)) * quant;
|
||||
|
||||
src += stride;
|
||||
maxCnt--;
|
||||
|
||||
while( maxCnt-- )
|
||||
{
|
||||
hsScalar val = *(hsScalar*)src;
|
||||
float val = *(float*)src;
|
||||
val = floor(val / quant + 0.5f) * quant;
|
||||
if( val < lo )
|
||||
{
|
||||
@ -110,36 +110,36 @@ inline void plVertCoder::ICountFloats(const UInt8* src, UInt16 maxCnt, const hsS
|
||||
allSame = (lo == hi);
|
||||
}
|
||||
|
||||
static inline void IWriteFloat(hsStream* s, const UInt8*& src, const hsScalar offset, const hsScalar quantum)
|
||||
static inline void IWriteFloat(hsStream* s, const uint8_t*& src, const float offset, const float quantum)
|
||||
{
|
||||
float fval = *(float*)src;
|
||||
fval -= offset;
|
||||
fval /= quantum;
|
||||
// hsAssert(fval < hsScalar(UInt16(0xffff)), "Bad offset?");
|
||||
// hsAssert(fval < float(uint16_t(0xffff)), "Bad offset?");
|
||||
|
||||
const UInt16 ival = UInt16(floor(fval + 0.5f));
|
||||
const uint16_t ival = uint16_t(floor(fval + 0.5f));
|
||||
s->WriteLE16(ival);
|
||||
|
||||
src += 4;
|
||||
}
|
||||
|
||||
static inline void IReadFloat(hsStream* s, UInt8*& dst, const hsScalar offset, const hsScalar quantum)
|
||||
static inline void IReadFloat(hsStream* s, uint8_t*& dst, const float offset, const float quantum)
|
||||
{
|
||||
const UInt16 ival = s->ReadLE16();
|
||||
const uint16_t ival = s->ReadLE16();
|
||||
float fval = float(ival) * quantum;
|
||||
fval += offset;
|
||||
|
||||
hsScalar* val = (hsScalar*)dst;
|
||||
float* val = (float*)dst;
|
||||
*val = fval;
|
||||
|
||||
dst += 4;
|
||||
}
|
||||
|
||||
inline void plVertCoder::IEncodeFloat(hsStream* s, const UInt32 vertsLeft, const int field, const int chan, const UInt8*& src, const UInt32 stride)
|
||||
inline void plVertCoder::IEncodeFloat(hsStream* s, const uint32_t vertsLeft, const int field, const int chan, const uint8_t*& src, const uint32_t stride)
|
||||
{
|
||||
if( !fFloats[field][chan].fCount )
|
||||
{
|
||||
ICountFloats(src, (UInt16)vertsLeft, kQuanta[field], stride, fFloats[field][chan].fOffset, fFloats[field][chan].fAllSame, fFloats[field][chan].fCount);
|
||||
ICountFloats(src, (uint16_t)vertsLeft, kQuanta[field], stride, fFloats[field][chan].fOffset, fFloats[field][chan].fAllSame, fFloats[field][chan].fCount);
|
||||
|
||||
s->WriteLEScalar(fFloats[field][chan].fOffset);
|
||||
s->WriteBool(fFloats[field][chan].fAllSame);
|
||||
@ -154,7 +154,7 @@ inline void plVertCoder::IEncodeFloat(hsStream* s, const UInt32 vertsLeft, const
|
||||
fFloats[field][chan].fCount--;
|
||||
}
|
||||
|
||||
inline void plVertCoder::IDecodeFloat(hsStream* s, const int field, const int chan, UInt8*& dst, const UInt32 stride)
|
||||
inline void plVertCoder::IDecodeFloat(hsStream* s, const int field, const int chan, uint8_t*& dst, const uint32_t stride)
|
||||
{
|
||||
if( !fFloats[field][chan].fCount )
|
||||
{
|
||||
@ -167,57 +167,57 @@ inline void plVertCoder::IDecodeFloat(hsStream* s, const int field, const int ch
|
||||
IReadFloat(s, dst, fFloats[field][chan].fOffset, kQuanta[field]);
|
||||
else
|
||||
{
|
||||
*((hsScalar*)dst) = fFloats[field][chan].fOffset;
|
||||
*((float*)dst) = fFloats[field][chan].fOffset;
|
||||
dst += 4;
|
||||
}
|
||||
|
||||
fFloats[field][chan].fCount--;
|
||||
}
|
||||
|
||||
static inline int INumWeights(const UInt8 format)
|
||||
static inline int INumWeights(const uint8_t format)
|
||||
{
|
||||
return (format & plGBufferGroup::kSkinWeightMask) >> 4;
|
||||
}
|
||||
|
||||
static const hsScalar kNormalScale(Int16(0x7fff));
|
||||
static const hsScalar kInvNormalScale(1.f / kNormalScale);
|
||||
static const float kNormalScale(int16_t(0x7fff));
|
||||
static const float kInvNormalScale(1.f / kNormalScale);
|
||||
|
||||
inline void plVertCoder::IEncodeNormal(hsStream* s, const UInt8*& src, const UInt32 stride)
|
||||
inline void plVertCoder::IEncodeNormal(hsStream* s, const uint8_t*& src, const uint32_t stride)
|
||||
{
|
||||
|
||||
hsScalar x = *(hsScalar*)src;
|
||||
s->WriteByte((UInt8)((x / 2.f + .5f) * 255.9f));
|
||||
float x = *(float*)src;
|
||||
s->WriteByte((uint8_t)((x / 2.f + .5f) * 255.9f));
|
||||
src += 4;
|
||||
|
||||
x = *(hsScalar*)src;
|
||||
s->WriteByte((UInt8)((x / 2.f + .5f) * 255.9f));
|
||||
x = *(float*)src;
|
||||
s->WriteByte((uint8_t)((x / 2.f + .5f) * 255.9f));
|
||||
src += 4;
|
||||
|
||||
x = *(hsScalar*)src;
|
||||
s->WriteByte((UInt8)((x / 2.f + .5f) * 255.9f));
|
||||
x = *(float*)src;
|
||||
s->WriteByte((uint8_t)((x / 2.f + .5f) * 255.9f));
|
||||
src += 4;
|
||||
}
|
||||
|
||||
inline void plVertCoder::IDecodeNormal(hsStream* s, UInt8*& dst, const UInt32 stride)
|
||||
inline void plVertCoder::IDecodeNormal(hsStream* s, uint8_t*& dst, const uint32_t stride)
|
||||
{
|
||||
|
||||
UInt8 ix = s->ReadByte();
|
||||
hsScalar* x = (hsScalar*)dst;
|
||||
uint8_t ix = s->ReadByte();
|
||||
float* x = (float*)dst;
|
||||
*x = (ix / 255.9f - .5f) * 2.f;
|
||||
dst += 4;
|
||||
|
||||
ix = s->ReadByte();
|
||||
x = (hsScalar*)dst;
|
||||
x = (float*)dst;
|
||||
*x = (ix / 255.9f - .5f) * 2.f;
|
||||
dst += 4;
|
||||
|
||||
ix = s->ReadByte();
|
||||
x = (hsScalar*)dst;
|
||||
x = (float*)dst;
|
||||
*x = (ix / 255.9f - .5f) * 2.f;
|
||||
dst += 4;
|
||||
}
|
||||
|
||||
inline void plVertCoder::ICountBytes(const UInt32 vertsLeft, const UInt8* src, const UInt32 stride, UInt16& len, UInt8& same)
|
||||
inline void plVertCoder::ICountBytes(const uint32_t vertsLeft, const uint8_t* src, const uint32_t stride, uint16_t& len, uint8_t& same)
|
||||
{
|
||||
// We want to run length encode this. So we're looking here for either
|
||||
// the number of consecutive bytes of the same value,
|
||||
@ -228,7 +228,7 @@ inline void plVertCoder::ICountBytes(const UInt32 vertsLeft, const UInt8* src, c
|
||||
|
||||
if( vertsLeft < 4 )
|
||||
{
|
||||
len = (UInt16)vertsLeft;
|
||||
len = (uint16_t)vertsLeft;
|
||||
same = false;
|
||||
|
||||
return;
|
||||
@ -268,19 +268,19 @@ inline void plVertCoder::ICountBytes(const UInt32 vertsLeft, const UInt8* src, c
|
||||
return;
|
||||
}
|
||||
|
||||
len = (UInt16)vertsLeft;
|
||||
len = (uint16_t)vertsLeft;
|
||||
return;
|
||||
}
|
||||
|
||||
static const UInt16 kSameMask(0x8000);
|
||||
static const uint16_t kSameMask(0x8000);
|
||||
|
||||
inline void plVertCoder::IEncodeByte(hsStream* s, const int chan, const UInt32 vertsLeft, const UInt8*& src, const UInt32 stride)
|
||||
inline void plVertCoder::IEncodeByte(hsStream* s, const int chan, const uint32_t vertsLeft, const uint8_t*& src, const uint32_t stride)
|
||||
{
|
||||
if( !fColors[chan].fCount )
|
||||
{
|
||||
ICountBytes(vertsLeft, src, stride, fColors[chan].fCount, fColors[chan].fSame);
|
||||
|
||||
UInt16 cnt = fColors[chan].fCount;
|
||||
uint16_t cnt = fColors[chan].fCount;
|
||||
if( fColors[chan].fSame )
|
||||
cnt |= kSameMask;
|
||||
s->WriteLE16(cnt);
|
||||
@ -296,11 +296,11 @@ inline void plVertCoder::IEncodeByte(hsStream* s, const int chan, const UInt32 v
|
||||
fColors[chan].fCount--;
|
||||
}
|
||||
|
||||
inline void plVertCoder::IDecodeByte(hsStream* s, const int chan, UInt8*& dst, const UInt32 stride)
|
||||
inline void plVertCoder::IDecodeByte(hsStream* s, const int chan, uint8_t*& dst, const uint32_t stride)
|
||||
{
|
||||
if( !fColors[chan].fCount )
|
||||
{
|
||||
UInt16 cnt = s->ReadLE16();
|
||||
uint16_t cnt = s->ReadLE16();
|
||||
if( cnt & kSameMask )
|
||||
{
|
||||
fColors[chan].fSame = true;
|
||||
@ -323,7 +323,7 @@ inline void plVertCoder::IDecodeByte(hsStream* s, const int chan, UInt8*& dst, c
|
||||
fColors[chan].fCount--;
|
||||
}
|
||||
|
||||
inline void plVertCoder::IEncodeColor(hsStream* s, const UInt32 vertsLeft, const UInt8*& src, const UInt32 stride)
|
||||
inline void plVertCoder::IEncodeColor(hsStream* s, const uint32_t vertsLeft, const uint8_t*& src, const uint32_t stride)
|
||||
{
|
||||
IEncodeByte(s, 0, vertsLeft, src, stride);
|
||||
IEncodeByte(s, 1, vertsLeft, src, stride);
|
||||
@ -331,7 +331,7 @@ inline void plVertCoder::IEncodeColor(hsStream* s, const UInt32 vertsLeft, const
|
||||
IEncodeByte(s, 3, vertsLeft, src, stride);
|
||||
}
|
||||
|
||||
inline void plVertCoder::IDecodeColor(hsStream* s, UInt8*& dst, const UInt32 stride)
|
||||
inline void plVertCoder::IDecodeColor(hsStream* s, uint8_t*& dst, const uint32_t stride)
|
||||
{
|
||||
IDecodeByte(s, 0, dst, stride);
|
||||
IDecodeByte(s, 1, dst, stride);
|
||||
@ -339,7 +339,7 @@ inline void plVertCoder::IDecodeColor(hsStream* s, UInt8*& dst, const UInt32 str
|
||||
IDecodeByte(s, 3, dst, stride);
|
||||
}
|
||||
|
||||
inline void plVertCoder::IEncode(hsStream* s, const UInt32 vertsLeft, const UInt8*& src, const UInt32 stride, const UInt8 format)
|
||||
inline void plVertCoder::IEncode(hsStream* s, const uint32_t vertsLeft, const uint8_t*& src, const uint32_t stride, const uint8_t format)
|
||||
{
|
||||
IEncodeFloat(s, vertsLeft, kPosition, 0, src, stride);
|
||||
IEncodeFloat(s, vertsLeft, kPosition, 1, src, stride);
|
||||
@ -355,7 +355,7 @@ inline void plVertCoder::IEncode(hsStream* s, const UInt32 vertsLeft, const UInt
|
||||
|
||||
if( format & plGBufferGroup::kSkinIndices )
|
||||
{
|
||||
const UInt32 idx = *(UInt32*)src;
|
||||
const uint32_t idx = *(uint32_t*)src;
|
||||
s->WriteLE32(idx);
|
||||
src += 4;
|
||||
}
|
||||
@ -378,7 +378,7 @@ inline void plVertCoder::IEncode(hsStream* s, const UInt32 vertsLeft, const UInt
|
||||
}
|
||||
}
|
||||
|
||||
inline void plVertCoder::IDecode(hsStream* s, UInt8*& dst, const UInt32 stride, const UInt8 format)
|
||||
inline void plVertCoder::IDecode(hsStream* s, uint8_t*& dst, const uint32_t stride, const uint8_t format)
|
||||
{
|
||||
IDecodeFloat(s, kPosition, 0, dst, stride);
|
||||
IDecodeFloat(s, kPosition, 1, dst, stride);
|
||||
@ -394,7 +394,7 @@ inline void plVertCoder::IDecode(hsStream* s, UInt8*& dst, const UInt32 stride,
|
||||
|
||||
if( format & plGBufferGroup::kSkinIndices )
|
||||
{
|
||||
UInt32* idx = (UInt32*)dst;
|
||||
uint32_t* idx = (uint32_t*)dst;
|
||||
*idx = s->ReadLE32();
|
||||
dst += 4;
|
||||
}
|
||||
@ -405,7 +405,7 @@ inline void plVertCoder::IDecode(hsStream* s, UInt8*& dst, const UInt32 stride,
|
||||
IDecodeColor(s, dst, stride);
|
||||
|
||||
// COLOR2
|
||||
UInt32* trash = (UInt32*)dst;
|
||||
uint32_t* trash = (uint32_t*)dst;
|
||||
*trash = 0;
|
||||
dst += 4;
|
||||
|
||||
@ -419,7 +419,7 @@ inline void plVertCoder::IDecode(hsStream* s, UInt8*& dst, const UInt32 stride,
|
||||
}
|
||||
}
|
||||
|
||||
void plVertCoder::Read(hsStream* s, UInt8* dst, const UInt8 format, const UInt32 stride, const UInt16 numVerts)
|
||||
void plVertCoder::Read(hsStream* s, uint8_t* dst, const uint8_t format, const uint32_t stride, const uint16_t numVerts)
|
||||
{
|
||||
Clear();
|
||||
|
||||
@ -429,11 +429,11 @@ void plVertCoder::Read(hsStream* s, UInt8* dst, const UInt8 format, const UInt32
|
||||
}
|
||||
|
||||
|
||||
void plVertCoder::Write(hsStream* s, const UInt8* src, const UInt8 format, const UInt32 stride, const UInt16 numVerts)
|
||||
void plVertCoder::Write(hsStream* s, const uint8_t* src, const uint8_t format, const uint32_t stride, const uint16_t numVerts)
|
||||
{
|
||||
Clear();
|
||||
|
||||
UInt32 streamStart = s->GetPosition();
|
||||
uint32_t streamStart = s->GetPosition();
|
||||
|
||||
int numLeft = numVerts;
|
||||
while( numLeft )
|
||||
|
@ -60,43 +60,43 @@ protected:
|
||||
class FloatCode
|
||||
{
|
||||
public:
|
||||
hsScalar fOffset;
|
||||
float fOffset;
|
||||
hsBool fAllSame;
|
||||
UInt16 fCount;
|
||||
uint16_t fCount;
|
||||
};
|
||||
|
||||
FloatCode fFloats[kNumFloatFields][3];
|
||||
|
||||
class ByteCode
|
||||
class byteCode
|
||||
{
|
||||
public:
|
||||
UInt16 fCount;
|
||||
UInt8 fVal;
|
||||
UInt8 fSame;
|
||||
uint16_t fCount;
|
||||
uint8_t fVal;
|
||||
uint8_t fSame;
|
||||
};
|
||||
|
||||
ByteCode fColors[4];
|
||||
byteCode fColors[4];
|
||||
|
||||
static UInt32 fCodedVerts;
|
||||
static UInt32 fCodedBytes;
|
||||
static UInt32 fRawBytes;
|
||||
static UInt32 fSkippedBytes;
|
||||
static uint32_t fCodedVerts;
|
||||
static uint32_t fCodedBytes;
|
||||
static uint32_t fRawBytes;
|
||||
static uint32_t fSkippedBytes;
|
||||
|
||||
inline void ICountFloats(const UInt8* src, UInt16 maxCnt, const hsScalar quant, const UInt32 stride, hsScalar& lo, hsBool& allSame, UInt16& count);
|
||||
inline void IEncodeFloat(hsStream* s, const UInt32 vertsLeft, const int field, const int chan, const UInt8*& src, const UInt32 stride);
|
||||
inline void IDecodeFloat(hsStream* s, const int field, const int chan, UInt8*& dst, const UInt32 stride);
|
||||
inline void ICountFloats(const uint8_t* src, uint16_t maxCnt, const float quant, const uint32_t stride, float& lo, hsBool& allSame, uint16_t& count);
|
||||
inline void IEncodeFloat(hsStream* s, const uint32_t vertsLeft, const int field, const int chan, const uint8_t*& src, const uint32_t stride);
|
||||
inline void IDecodeFloat(hsStream* s, const int field, const int chan, uint8_t*& dst, const uint32_t stride);
|
||||
|
||||
inline void IEncodeNormal(hsStream* s, const UInt8*& src, const UInt32 stride);
|
||||
inline void IDecodeNormal(hsStream* s, UInt8*& dst, const UInt32 stride);
|
||||
inline void IEncodeNormal(hsStream* s, const uint8_t*& src, const uint32_t stride);
|
||||
inline void IDecodeNormal(hsStream* s, uint8_t*& dst, const uint32_t stride);
|
||||
|
||||
inline void ICountBytes(const UInt32 vertsLeft, const UInt8* src, const UInt32 stride, UInt16& len, UInt8& same);
|
||||
inline void IEncodeByte(hsStream* s, const int chan, const UInt32 vertsLeft, const UInt8*& src, const UInt32 stride);
|
||||
inline void IDecodeByte(hsStream* s, const int chan, UInt8*& dst, const UInt32 stride);
|
||||
inline void IEncodeColor(hsStream* s, const UInt32 vertsLeft, const UInt8*& src, const UInt32 stride);
|
||||
inline void IDecodeColor(hsStream* s, UInt8*& dst, const UInt32 stride);
|
||||
inline void ICountBytes(const uint32_t vertsLeft, const uint8_t* src, const uint32_t stride, uint16_t& len, uint8_t& same);
|
||||
inline void IEncodeByte(hsStream* s, const int chan, const uint32_t vertsLeft, const uint8_t*& src, const uint32_t stride);
|
||||
inline void IDecodeByte(hsStream* s, const int chan, uint8_t*& dst, const uint32_t stride);
|
||||
inline void IEncodeColor(hsStream* s, const uint32_t vertsLeft, const uint8_t*& src, const uint32_t stride);
|
||||
inline void IDecodeColor(hsStream* s, uint8_t*& dst, const uint32_t stride);
|
||||
|
||||
inline void IEncode(hsStream* s, const UInt32 vertsLeft, const UInt8*& src, const UInt32 stride, const UInt8 format);
|
||||
inline void IDecode(hsStream* s, UInt8*& dst, const UInt32 stride, const UInt8 format);
|
||||
inline void IEncode(hsStream* s, const uint32_t vertsLeft, const uint8_t*& src, const uint32_t stride, const uint8_t format);
|
||||
inline void IDecode(hsStream* s, uint8_t*& dst, const uint32_t stride, const uint8_t format);
|
||||
|
||||
public:
|
||||
plVertCoder();
|
||||
@ -104,19 +104,19 @@ public:
|
||||
|
||||
void Clear();
|
||||
|
||||
void Read(hsStream* s, UInt8* dst, const UInt8 format, const UInt32 stride, const UInt16 numVerts);
|
||||
void Write(hsStream* s, const UInt8* src, const UInt8 format, const UInt32 stride, const UInt16 numVerts);
|
||||
void Read(hsStream* s, uint8_t* dst, const uint8_t format, const uint32_t stride, const uint16_t numVerts);
|
||||
void Write(hsStream* s, const uint8_t* src, const uint8_t format, const uint32_t stride, const uint16_t numVerts);
|
||||
|
||||
|
||||
static void ClearAverage() { fCodedVerts = 0; fCodedBytes = 0; fRawBytes = 0; fSkippedBytes = 0; }
|
||||
static UInt32 CodedBytes() { return fCodedBytes; }
|
||||
static UInt32 RawBytes() { return fRawBytes; }
|
||||
static UInt32 CodedVerts() { return fCodedVerts; }
|
||||
static uint32_t CodedBytes() { return fCodedBytes; }
|
||||
static uint32_t RawBytes() { return fRawBytes; }
|
||||
static uint32_t CodedVerts() { return fCodedVerts; }
|
||||
static float AverageCodedVertSize() { return fCodedVerts ? float(fCodedBytes) / float(fCodedVerts) : 0; }
|
||||
static float AverageRawVertSize() { return fCodedVerts ? float(fRawBytes) / float(fCodedVerts) : 0; }
|
||||
|
||||
static UInt32 SkippedBytes() { return fSkippedBytes; }
|
||||
static void AddSkippedBytes(UInt32 f) { fSkippedBytes += f; }
|
||||
static uint32_t SkippedBytes() { return fSkippedBytes; }
|
||||
static void AddSkippedBytes(uint32_t f) { fSkippedBytes += f; }
|
||||
};
|
||||
|
||||
#endif // plVertCoder_inc
|
||||
|
Reference in New Issue
Block a user