mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 19:29:09 +00:00
Fix Endian functions names in hsTypes and hsStream.
Function and macro names for endianness were previously vague, and on big-endian systems entirely misleading. The names are now properly descriptive of what they actually do.
This commit is contained in:
@ -107,15 +107,15 @@ void hsG3DDeviceMode::Read( hsStream* s )
|
||||
{
|
||||
Clear();
|
||||
|
||||
fFlags = s->ReadSwap32();
|
||||
fWidth = s->ReadSwap32();
|
||||
fHeight = s->ReadSwap32();
|
||||
fDepth = s->ReadSwap32();
|
||||
fFlags = s->ReadLE32();
|
||||
fWidth = s->ReadLE32();
|
||||
fHeight = s->ReadLE32();
|
||||
fDepth = s->ReadLE32();
|
||||
|
||||
fZStencilDepths.Reset();
|
||||
UInt8 count= s->ReadByte();
|
||||
while( count-- )
|
||||
fZStencilDepths.Append( s->ReadSwap16() );
|
||||
fZStencilDepths.Append( s->ReadLE16() );
|
||||
|
||||
/// Version 9
|
||||
fFSAATypes.Reset();
|
||||
@ -128,15 +128,15 @@ void hsG3DDeviceMode::Read( hsStream* s )
|
||||
|
||||
void hsG3DDeviceMode::Write( hsStream* s ) const
|
||||
{
|
||||
s->WriteSwap32(fFlags);
|
||||
s->WriteSwap32(fWidth);
|
||||
s->WriteSwap32(fHeight);
|
||||
s->WriteSwap32(fDepth);
|
||||
s->WriteLE32(fFlags);
|
||||
s->WriteLE32(fWidth);
|
||||
s->WriteLE32(fHeight);
|
||||
s->WriteLE32(fDepth);
|
||||
|
||||
UInt8 i, count = (UInt8)fZStencilDepths.GetCount();
|
||||
s->WriteByte( count );
|
||||
for( i = 0; i < count; i++ )
|
||||
s->WriteSwap16( fZStencilDepths[ i ] );
|
||||
s->WriteLE16( fZStencilDepths[ i ] );
|
||||
|
||||
/// Version 9
|
||||
count = (UInt8)fFSAATypes.GetCount();
|
||||
@ -330,11 +330,11 @@ void hsG3DDeviceRecord::Read(hsStream* s)
|
||||
Clear();
|
||||
|
||||
/// Read version
|
||||
fRecordVersion = s->ReadSwap32();
|
||||
fRecordVersion = s->ReadLE32();
|
||||
hsAssert( fRecordVersion <= kCurrRecordVersion, "Invalid version number in hsG3DDeviceRecord::Read()" );
|
||||
if( fRecordVersion == kCurrRecordVersion )
|
||||
{
|
||||
fFlags = s->ReadSwap32();
|
||||
fFlags = s->ReadLE32();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -346,53 +346,53 @@ void hsG3DDeviceRecord::Read(hsStream* s)
|
||||
}
|
||||
|
||||
/// Now read everything else in as normal
|
||||
fG3DDeviceType = s->ReadSwap32();
|
||||
fG3DDeviceType = s->ReadLE32();
|
||||
|
||||
int len;
|
||||
|
||||
len = s->ReadSwap32();
|
||||
len = s->ReadLE32();
|
||||
fG3DDriverDesc = TRACKED_NEW char[len + 1];
|
||||
s->Read(len, fG3DDriverDesc);
|
||||
fG3DDriverDesc[len] = 0;
|
||||
|
||||
len = s->ReadSwap32();
|
||||
len = s->ReadLE32();
|
||||
fG3DDriverName = TRACKED_NEW char[len + 1];
|
||||
s->Read(len, fG3DDriverName);
|
||||
fG3DDriverName[len] = 0;
|
||||
|
||||
len = s->ReadSwap32();
|
||||
len = s->ReadLE32();
|
||||
fG3DDriverVersion = TRACKED_NEW char[len + 1];
|
||||
s->Read(len, fG3DDriverVersion);
|
||||
fG3DDriverVersion[len] = 0;
|
||||
|
||||
len = s->ReadSwap32();
|
||||
len = s->ReadLE32();
|
||||
fG3DDeviceDesc = TRACKED_NEW char[len + 1];
|
||||
s->Read(len, fG3DDeviceDesc);
|
||||
fG3DDeviceDesc[len] = 0;
|
||||
|
||||
|
||||
fCaps.Read(s);
|
||||
fLayersAtOnce = s->ReadSwap32();
|
||||
fMemoryBytes = s->ReadSwap32();
|
||||
fLayersAtOnce = s->ReadLE32();
|
||||
fMemoryBytes = s->ReadLE32();
|
||||
|
||||
len = s->ReadSwap32();
|
||||
len = s->ReadLE32();
|
||||
fModes.SetCount(len);
|
||||
int i;
|
||||
for( i = 0; i < len; i++ )
|
||||
fModes[i].Read( s );
|
||||
|
||||
/// Version 3 stuff
|
||||
fZBiasRating = s->ReadSwapFloat();
|
||||
fLODBiasRating = s->ReadSwapFloat();
|
||||
fFogExpApproxStart = s->ReadSwapFloat();
|
||||
fFogExp2ApproxStart = s->ReadSwapFloat();
|
||||
fFogEndBias = s->ReadSwapFloat();
|
||||
fZBiasRating = s->ReadLEFloat();
|
||||
fLODBiasRating = s->ReadLEFloat();
|
||||
fFogExpApproxStart = s->ReadLEFloat();
|
||||
fFogExp2ApproxStart = s->ReadLEFloat();
|
||||
fFogEndBias = s->ReadLEFloat();
|
||||
|
||||
/// Version 7 stuff
|
||||
float knee, kneeVal;
|
||||
knee = s->ReadSwapFloat(); kneeVal = s->ReadSwapFloat();
|
||||
knee = s->ReadLEFloat(); kneeVal = s->ReadLEFloat();
|
||||
SetFogKneeParams( kFogExp, knee, kneeVal );
|
||||
knee = s->ReadSwapFloat(); kneeVal = s->ReadSwapFloat();
|
||||
knee = s->ReadLEFloat(); kneeVal = s->ReadLEFloat();
|
||||
SetFogKneeParams( kFogExp2, knee, kneeVal );
|
||||
|
||||
/// Version 9 stuff
|
||||
@ -407,51 +407,51 @@ void hsG3DDeviceRecord::Read(hsStream* s)
|
||||
|
||||
void hsG3DDeviceRecord::Write(hsStream* s) const
|
||||
{
|
||||
s->WriteSwap32( fRecordVersion );
|
||||
s->WriteLE32( fRecordVersion );
|
||||
|
||||
s->WriteSwap32(fFlags);
|
||||
s->WriteLE32(fFlags);
|
||||
|
||||
s->WriteSwap32(fG3DDeviceType);
|
||||
s->WriteLE32(fG3DDeviceType);
|
||||
|
||||
int len;
|
||||
|
||||
len = hsStrlen(fG3DDriverDesc);
|
||||
s->WriteSwap32(len);
|
||||
s->WriteLE32(len);
|
||||
s->Write(len, fG3DDriverDesc);
|
||||
|
||||
len = hsStrlen(fG3DDriverName);
|
||||
s->WriteSwap32(len);
|
||||
s->WriteLE32(len);
|
||||
s->Write(len, fG3DDriverName);
|
||||
|
||||
len = hsStrlen(fG3DDriverVersion);
|
||||
s->WriteSwap32(len);
|
||||
s->WriteLE32(len);
|
||||
s->Write(len, fG3DDriverVersion);
|
||||
|
||||
len = hsStrlen(fG3DDeviceDesc);
|
||||
s->WriteSwap32(len);
|
||||
s->WriteLE32(len);
|
||||
s->Write(len, fG3DDeviceDesc);
|
||||
|
||||
fCaps.Write(s);
|
||||
s->WriteSwap32(fLayersAtOnce);
|
||||
s->WriteSwap32(fMemoryBytes);
|
||||
s->WriteLE32(fLayersAtOnce);
|
||||
s->WriteLE32(fMemoryBytes);
|
||||
|
||||
s->WriteSwap32(fModes.GetCount());
|
||||
s->WriteLE32(fModes.GetCount());
|
||||
int i;
|
||||
for( i = 0; i < fModes.GetCount(); i++ )
|
||||
fModes[i].Write( s );
|
||||
|
||||
/// Version 3 data
|
||||
s->WriteSwapFloat( fZBiasRating );
|
||||
s->WriteSwapFloat( fLODBiasRating );
|
||||
s->WriteSwapFloat( fFogExpApproxStart );
|
||||
s->WriteSwapFloat( fFogExp2ApproxStart );
|
||||
s->WriteSwapFloat( fFogEndBias );
|
||||
s->WriteLEFloat( fZBiasRating );
|
||||
s->WriteLEFloat( fLODBiasRating );
|
||||
s->WriteLEFloat( fFogExpApproxStart );
|
||||
s->WriteLEFloat( fFogExp2ApproxStart );
|
||||
s->WriteLEFloat( fFogEndBias );
|
||||
|
||||
/// Version 7 data
|
||||
s->WriteSwapFloat( fFogKnees[ kFogExp ] );
|
||||
s->WriteSwapFloat( fFogKneeVals[ kFogExp ] );
|
||||
s->WriteSwapFloat( fFogKnees[ kFogExp2 ] );
|
||||
s->WriteSwapFloat( fFogKneeVals[ kFogExp2 ] );
|
||||
s->WriteLEFloat( fFogKnees[ kFogExp ] );
|
||||
s->WriteLEFloat( fFogKneeVals[ kFogExp ] );
|
||||
s->WriteLEFloat( fFogKnees[ kFogExp2 ] );
|
||||
s->WriteLEFloat( fFogKneeVals[ kFogExp2 ] );
|
||||
|
||||
/// Version 9 data
|
||||
s->WriteByte( fAASetting );
|
||||
|
@ -418,12 +418,12 @@ void plDynamicEnvMap::Read(hsStream* s, hsResMgr* mgr)
|
||||
UInt32 sz = plCubicRenderTarget::Read(s);
|
||||
|
||||
fPos.Read(s);
|
||||
fHither = s->ReadSwapScalar();
|
||||
fYon = s->ReadSwapScalar();
|
||||
fFogStart = s->ReadSwapScalar();
|
||||
fHither = s->ReadLEScalar();
|
||||
fYon = s->ReadLEScalar();
|
||||
fFogStart = s->ReadLEScalar();
|
||||
fColor.Read(s);
|
||||
|
||||
fRefreshRate = s->ReadSwapScalar();
|
||||
fRefreshRate = s->ReadLEScalar();
|
||||
|
||||
SetPosition(fPos);
|
||||
|
||||
@ -431,12 +431,12 @@ void plDynamicEnvMap::Read(hsStream* s, hsResMgr* mgr)
|
||||
|
||||
fIncCharacters = s->ReadByte();
|
||||
SetIncludeCharacters(fIncCharacters);
|
||||
int nVis = s->ReadSwap32();
|
||||
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);
|
||||
|
||||
nVis = s->ReadSwap32();
|
||||
nVis = s->ReadLE32();
|
||||
for( i = 0; i < nVis; i++)
|
||||
{
|
||||
char *name = s->ReadSafeString();
|
||||
@ -458,22 +458,22 @@ void plDynamicEnvMap::Write(hsStream* s, hsResMgr* mgr)
|
||||
UInt32 sz = plCubicRenderTarget::Write(s);
|
||||
|
||||
fPos.Write(s);
|
||||
s->WriteSwapScalar(fHither);
|
||||
s->WriteSwapScalar(fYon);
|
||||
s->WriteSwapScalar(fFogStart);
|
||||
s->WriteLEScalar(fHither);
|
||||
s->WriteLEScalar(fYon);
|
||||
s->WriteLEScalar(fFogStart);
|
||||
fColor.Write(s);
|
||||
|
||||
s->WriteSwapScalar(fRefreshRate);
|
||||
s->WriteLEScalar(fRefreshRate);
|
||||
|
||||
sz += sizeof(fPos) + sizeof(fHither) + sizeof(fYon) + sizeof(fFogStart) + sizeof(fColor) + sizeof(fRefreshRate);
|
||||
|
||||
s->WriteByte(fIncCharacters);
|
||||
s->WriteSwap32(fVisRegions.GetCount());
|
||||
s->WriteLE32(fVisRegions.GetCount());
|
||||
int i;
|
||||
for( i = 0; i < fVisRegions.GetCount(); i++ )
|
||||
mgr->WriteKey(s, fVisRegions[i]);
|
||||
|
||||
s->WriteSwap32(fVisRegionNames.Count());
|
||||
s->WriteLE32(fVisRegionNames.Count());
|
||||
for( i = 0; i < fVisRegionNames.Count(); i++)
|
||||
{
|
||||
s->WriteSafeString(fVisRegionNames[i]);
|
||||
@ -887,12 +887,12 @@ void plDynamicCamMap::Read(hsStream* s, hsResMgr* mgr)
|
||||
hsKeyedObject::Read(s, mgr);
|
||||
plRenderTarget::Read(s);
|
||||
|
||||
fHither = s->ReadSwapScalar();
|
||||
fYon = s->ReadSwapScalar();
|
||||
fFogStart = s->ReadSwapScalar();
|
||||
fHither = s->ReadLEScalar();
|
||||
fYon = s->ReadLEScalar();
|
||||
fFogStart = s->ReadLEScalar();
|
||||
fColor.Read(s);
|
||||
|
||||
fRefreshRate = s->ReadSwapScalar();
|
||||
fRefreshRate = s->ReadLEScalar();
|
||||
fIncCharacters = s->ReadBool();
|
||||
SetIncludeCharacters(fIncCharacters);
|
||||
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefCamera), plRefFlags::kPassiveRef);
|
||||
@ -903,11 +903,11 @@ void plDynamicCamMap::Read(hsStream* s, hsResMgr* mgr)
|
||||
for (i = 0; i < numTargs; i++)
|
||||
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, kRefTargetNode), plRefFlags::kPassiveRef);
|
||||
|
||||
int nVis = s->ReadSwap32();
|
||||
int nVis = s->ReadLE32();
|
||||
for( i = 0; i < nVis; i++ )
|
||||
mgr->ReadKeyNotifyMe(s, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefVisSet), plRefFlags::kActiveRef);
|
||||
|
||||
nVis = s->ReadSwap32();
|
||||
nVis = s->ReadLE32();
|
||||
for( i = 0; i < nVis; i++)
|
||||
{
|
||||
char *name = s->ReadSafeString();
|
||||
@ -933,12 +933,12 @@ void plDynamicCamMap::Write(hsStream* s, hsResMgr* mgr)
|
||||
hsKeyedObject::Write(s, mgr);
|
||||
plRenderTarget::Write(s);
|
||||
|
||||
s->WriteSwapScalar(fHither);
|
||||
s->WriteSwapScalar(fYon);
|
||||
s->WriteSwapScalar(fFogStart);
|
||||
s->WriteLEScalar(fHither);
|
||||
s->WriteLEScalar(fYon);
|
||||
s->WriteLEScalar(fFogStart);
|
||||
fColor.Write(s);
|
||||
|
||||
s->WriteSwapScalar(fRefreshRate);
|
||||
s->WriteLEScalar(fRefreshRate);
|
||||
s->WriteByte(fIncCharacters);
|
||||
mgr->WriteKey(s, (fCamera ? fCamera->GetKey() : nil));
|
||||
mgr->WriteKey(s, (fRootNode ? fRootNode->GetKey() : nil));
|
||||
@ -948,11 +948,11 @@ void plDynamicCamMap::Write(hsStream* s, hsResMgr* mgr)
|
||||
for (i = 0; i < fTargetNodes.GetCount(); i++)
|
||||
mgr->WriteKey(s, fTargetNodes[i]);
|
||||
|
||||
s->WriteSwap32(fVisRegions.GetCount());
|
||||
s->WriteLE32(fVisRegions.GetCount());
|
||||
for( i = 0; i < fVisRegions.GetCount(); i++ )
|
||||
mgr->WriteKey(s, fVisRegions[i]);
|
||||
|
||||
s->WriteSwap32(fVisRegionNames.Count());
|
||||
s->WriteLE32(fVisRegionNames.Count());
|
||||
for( i = 0; i < fVisRegionNames.Count(); i++)
|
||||
{
|
||||
s->WriteSafeString(fVisRegionNames[i]);
|
||||
|
@ -192,9 +192,9 @@ void plFogEnvironment::Read( hsStream *s, hsResMgr *mgr )
|
||||
hsKeyedObject::Read( s, mgr );
|
||||
|
||||
fType = s->ReadByte();
|
||||
fStart = s->ReadSwapFloat();
|
||||
fEnd = s->ReadSwapFloat();
|
||||
fDensity = s->ReadSwapFloat();
|
||||
fStart = s->ReadLEFloat();
|
||||
fEnd = s->ReadLEFloat();
|
||||
fDensity = s->ReadLEFloat();
|
||||
fColor.Read( s );
|
||||
}
|
||||
|
||||
@ -205,9 +205,9 @@ void plFogEnvironment::Write( hsStream *s, hsResMgr *mgr )
|
||||
hsKeyedObject::Write( s, mgr );
|
||||
|
||||
s->WriteByte( fType );
|
||||
s->WriteSwapFloat( fStart );
|
||||
s->WriteSwapFloat( fEnd );
|
||||
s->WriteSwapFloat( fDensity );
|
||||
s->WriteLEFloat( fStart );
|
||||
s->WriteLEFloat( fEnd );
|
||||
s->WriteLEFloat( fDensity );
|
||||
fColor.Write( s );
|
||||
}
|
||||
|
||||
|
@ -76,19 +76,19 @@ const UInt32 plGBufferGroup::kMaxNumIndicesPerBuffer = 32000;
|
||||
|
||||
void plGBufferTriangle::Read( hsStream *s )
|
||||
{
|
||||
fIndex1 = s->ReadSwap16();
|
||||
fIndex2 = s->ReadSwap16();
|
||||
fIndex3 = s->ReadSwap16();
|
||||
fSpanIndex = s->ReadSwap16();
|
||||
fIndex1 = s->ReadLE16();
|
||||
fIndex2 = s->ReadLE16();
|
||||
fIndex3 = s->ReadLE16();
|
||||
fSpanIndex = s->ReadLE16();
|
||||
fCenter.Read( s );
|
||||
}
|
||||
|
||||
void plGBufferTriangle::Write( hsStream *s )
|
||||
{
|
||||
s->WriteSwap16( fIndex1 );
|
||||
s->WriteSwap16( fIndex2 );
|
||||
s->WriteSwap16( fIndex3 );
|
||||
s->WriteSwap16( fSpanIndex );
|
||||
s->WriteLE16( fIndex1 );
|
||||
s->WriteLE16( fIndex2 );
|
||||
s->WriteLE16( fIndex3 );
|
||||
s->WriteLE16( fSpanIndex );
|
||||
fCenter.Write( s );
|
||||
}
|
||||
|
||||
@ -96,16 +96,16 @@ void plGBufferTriangle::Write( hsStream *s )
|
||||
|
||||
void plGBufferCell::Read( hsStream *s )
|
||||
{
|
||||
fVtxStart = s->ReadSwap32();
|
||||
fColorStart = s->ReadSwap32();
|
||||
fLength = s->ReadSwap32();
|
||||
fVtxStart = s->ReadLE32();
|
||||
fColorStart = s->ReadLE32();
|
||||
fLength = s->ReadLE32();
|
||||
}
|
||||
|
||||
void plGBufferCell::Write( hsStream *s )
|
||||
{
|
||||
s->WriteSwap32( fVtxStart );
|
||||
s->WriteSwap32( fColorStart );
|
||||
s->WriteSwap32( fLength );
|
||||
s->WriteLE32( fVtxStart );
|
||||
s->WriteLE32( fColorStart );
|
||||
s->WriteLE32( fLength );
|
||||
}
|
||||
|
||||
//// Constructor //////////////////////////////////////////////////////////////
|
||||
@ -367,8 +367,8 @@ void plGBufferGroup::Read( hsStream *s )
|
||||
plGBufferColor *cData;
|
||||
|
||||
|
||||
s->ReadSwap( &fFormat );
|
||||
totalDynSize = s->ReadSwap32();
|
||||
s->ReadLE( &fFormat );
|
||||
totalDynSize = s->ReadLE32();
|
||||
fStride = ICalcVertexSize( fLiteStride );
|
||||
|
||||
fVertBuffSizes.Reset();
|
||||
@ -383,12 +383,12 @@ void plGBufferGroup::Read( hsStream *s )
|
||||
|
||||
plVertCoder coder;
|
||||
/// Create buffers and read in as we go
|
||||
count = s->ReadSwap32();
|
||||
count = s->ReadLE32();
|
||||
for( i = 0; i < count; i++ )
|
||||
{
|
||||
if( fFormat & kEncoded )
|
||||
{
|
||||
const UInt16 numVerts = s->ReadSwap16();
|
||||
const UInt16 numVerts = s->ReadLE16();
|
||||
const UInt32 size = numVerts * fStride;
|
||||
|
||||
fVertBuffSizes.Append(size);
|
||||
@ -407,7 +407,7 @@ void plGBufferGroup::Read( hsStream *s )
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = s->ReadSwap32();
|
||||
temp = s->ReadLE32();
|
||||
|
||||
fVertBuffSizes.Append( temp );
|
||||
fVertBuffStarts.Append(0);
|
||||
@ -419,7 +419,7 @@ void plGBufferGroup::Read( hsStream *s )
|
||||
fVertBuffStorage.Append( vData );
|
||||
plProfile_NewMem(MemBufGrpVertex, temp);
|
||||
|
||||
temp = s->ReadSwap32();
|
||||
temp = s->ReadLE32();
|
||||
fColorBuffCounts.Append( temp );
|
||||
|
||||
if( temp > 0 )
|
||||
@ -435,17 +435,17 @@ void plGBufferGroup::Read( hsStream *s )
|
||||
}
|
||||
}
|
||||
|
||||
count = s->ReadSwap32();
|
||||
count = s->ReadLE32();
|
||||
for( i = 0; i < count; i++ )
|
||||
{
|
||||
temp = s->ReadSwap32();
|
||||
temp = s->ReadLE32();
|
||||
fIdxBuffCounts.Append( temp );
|
||||
fIdxBuffStarts.Append(0);
|
||||
fIdxBuffEnds.Append(-1);
|
||||
|
||||
iData = TRACKED_NEW UInt16[ temp ];
|
||||
hsAssert( iData != nil, "Not enough memory to read in indices" );
|
||||
s->ReadSwap16( temp, (UInt16 *)iData );
|
||||
s->ReadLE16( temp, (UInt16 *)iData );
|
||||
fIdxBuffStorage.Append( iData );
|
||||
plProfile_NewMem(MemBufGrpIndex, temp * sizeof(UInt16));
|
||||
}
|
||||
@ -453,7 +453,7 @@ void plGBufferGroup::Read( hsStream *s )
|
||||
/// Read in cell arrays, one per vBuffer
|
||||
for( i = 0; i < fVertBuffStorage.GetCount(); i++ )
|
||||
{
|
||||
temp = s->ReadSwap32();
|
||||
temp = s->ReadLE32();
|
||||
|
||||
fCells.Append( TRACKED_NEW hsTArray<plGBufferCell> );
|
||||
fCells[ i ]->SetCount( temp );
|
||||
@ -487,20 +487,20 @@ void plGBufferGroup::Write( hsStream *s )
|
||||
for( i = 0; i < fIdxBuffCounts.GetCount(); i++ )
|
||||
totalDynSize += sizeof( UInt16 ) * fIdxBuffCounts[ i ];
|
||||
|
||||
s->WriteSwap( fFormat );
|
||||
s->WriteSwap32( totalDynSize );
|
||||
s->WriteLE( fFormat );
|
||||
s->WriteLE32( totalDynSize );
|
||||
|
||||
plVertCoder coder;
|
||||
|
||||
/// Write out dyanmic data
|
||||
s->WriteSwap32( (UInt32)fVertBuffStorage.GetCount() );
|
||||
s->WriteLE32( (UInt32)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->WriteSwap16((UInt16)numVerts);
|
||||
s->WriteLE16((UInt16)numVerts);
|
||||
coder.Write(s, fVertBuffStorage[i], fFormat, fStride, (UInt16)numVerts);
|
||||
|
||||
#ifdef VERT_LOG
|
||||
@ -518,27 +518,27 @@ void plGBufferGroup::Write( hsStream *s )
|
||||
|
||||
#else // MF_VERTCODE_ENABLED
|
||||
|
||||
s->WriteSwap32( fVertBuffSizes[ i ] );
|
||||
s->WriteLE32( fVertBuffSizes[ i ] );
|
||||
s->Write( fVertBuffSizes[ i ], (void *)fVertBuffStorage[ i ] );
|
||||
|
||||
|
||||
s->WriteSwap32( fColorBuffCounts[ i ] );
|
||||
s->WriteLE32( fColorBuffCounts[ i ] );
|
||||
s->Write( fColorBuffCounts[ i ] * sizeof( plGBufferColor ), (void *)fColorBuffStorage[ i ] );
|
||||
|
||||
#endif // MF_VERTCODE_ENABLED
|
||||
}
|
||||
|
||||
s->WriteSwap32( (UInt32)fIdxBuffCounts.GetCount() );
|
||||
s->WriteLE32( (UInt32)fIdxBuffCounts.GetCount() );
|
||||
for( i = 0; i < fIdxBuffStorage.GetCount(); i++ )
|
||||
{
|
||||
s->WriteSwap32( fIdxBuffCounts[ i ] );
|
||||
s->WriteSwap16( fIdxBuffCounts[ i ], fIdxBuffStorage[ i ] );
|
||||
s->WriteLE32( fIdxBuffCounts[ i ] );
|
||||
s->WriteLE16( fIdxBuffCounts[ i ], fIdxBuffStorage[ i ] );
|
||||
}
|
||||
|
||||
/// Write out cell arrays
|
||||
for( i = 0; i < fVertBuffStorage.GetCount(); i++ )
|
||||
{
|
||||
s->WriteSwap32( fCells[ i ]->GetCount() );
|
||||
s->WriteLE32( fCells[ i ]->GetCount() );
|
||||
for( j = 0; j < fCells[ i ]->GetCount(); j++ )
|
||||
(*fCells[ i ])[ j ].Write( s );
|
||||
}
|
||||
|
@ -94,23 +94,23 @@ UInt32 plRenderTarget::Read( hsStream *s )
|
||||
{
|
||||
UInt32 total = plBitmap::Read( s );
|
||||
|
||||
fWidth = s->ReadSwap16();
|
||||
fHeight = s->ReadSwap16();
|
||||
fWidth = s->ReadLE16();
|
||||
fHeight = s->ReadLE16();
|
||||
|
||||
fProportionalViewport = s->ReadBool();
|
||||
if( fProportionalViewport )
|
||||
{
|
||||
fViewport.fProportional.fLeft = s->ReadSwapScalar();
|
||||
fViewport.fProportional.fTop = s->ReadSwapScalar();
|
||||
fViewport.fProportional.fRight = s->ReadSwapScalar();
|
||||
fViewport.fProportional.fBottom = s->ReadSwapScalar();
|
||||
fViewport.fProportional.fLeft = s->ReadLEScalar();
|
||||
fViewport.fProportional.fTop = s->ReadLEScalar();
|
||||
fViewport.fProportional.fRight = s->ReadLEScalar();
|
||||
fViewport.fProportional.fBottom = s->ReadLEScalar();
|
||||
}
|
||||
else
|
||||
{
|
||||
fViewport.fAbsolute.fLeft = s->ReadSwap16();
|
||||
fViewport.fAbsolute.fTop = s->ReadSwap16();
|
||||
fViewport.fAbsolute.fRight = s->ReadSwap16();
|
||||
fViewport.fAbsolute.fBottom = s->ReadSwap16();
|
||||
fViewport.fAbsolute.fLeft = s->ReadLE16();
|
||||
fViewport.fAbsolute.fTop = s->ReadLE16();
|
||||
fViewport.fAbsolute.fRight = s->ReadLE16();
|
||||
fViewport.fAbsolute.fBottom = s->ReadLE16();
|
||||
}
|
||||
|
||||
fZDepth = s->ReadByte();
|
||||
@ -123,23 +123,23 @@ UInt32 plRenderTarget::Write( hsStream *s )
|
||||
{
|
||||
UInt32 total = plBitmap::Write( s );
|
||||
|
||||
s->WriteSwap16( fWidth );
|
||||
s->WriteSwap16( fHeight );
|
||||
s->WriteLE16( fWidth );
|
||||
s->WriteLE16( fHeight );
|
||||
|
||||
s->WriteBool( fProportionalViewport );
|
||||
if( fProportionalViewport )
|
||||
{
|
||||
s->WriteSwapScalar( fViewport.fProportional.fLeft );
|
||||
s->WriteSwapScalar( fViewport.fProportional.fTop );
|
||||
s->WriteSwapScalar( fViewport.fProportional.fRight );
|
||||
s->WriteSwapScalar( fViewport.fProportional.fBottom );
|
||||
s->WriteLEScalar( fViewport.fProportional.fLeft );
|
||||
s->WriteLEScalar( fViewport.fProportional.fTop );
|
||||
s->WriteLEScalar( fViewport.fProportional.fRight );
|
||||
s->WriteLEScalar( fViewport.fProportional.fBottom );
|
||||
}
|
||||
else
|
||||
{
|
||||
s->WriteSwap16( fViewport.fAbsolute.fLeft );
|
||||
s->WriteSwap16( fViewport.fAbsolute.fTop );
|
||||
s->WriteSwap16( fViewport.fAbsolute.fRight );
|
||||
s->WriteSwap16( fViewport.fAbsolute.fBottom );
|
||||
s->WriteLE16( fViewport.fAbsolute.fLeft );
|
||||
s->WriteLE16( fViewport.fAbsolute.fTop );
|
||||
s->WriteLE16( fViewport.fAbsolute.fRight );
|
||||
s->WriteLE16( fViewport.fAbsolute.fBottom );
|
||||
}
|
||||
|
||||
s->WriteByte( fZDepth );
|
||||
|
@ -118,14 +118,14 @@ static inline void IWriteFloat(hsStream* s, const UInt8*& src, const hsScalar of
|
||||
// hsAssert(fval < hsScalar(UInt16(0xffff)), "Bad offset?");
|
||||
|
||||
const UInt16 ival = UInt16(floor(fval + 0.5f));
|
||||
s->WriteSwap16(ival);
|
||||
s->WriteLE16(ival);
|
||||
|
||||
src += 4;
|
||||
}
|
||||
|
||||
static inline void IReadFloat(hsStream* s, UInt8*& dst, const hsScalar offset, const hsScalar quantum)
|
||||
{
|
||||
const UInt16 ival = s->ReadSwap16();
|
||||
const UInt16 ival = s->ReadLE16();
|
||||
float fval = float(ival) * quantum;
|
||||
fval += offset;
|
||||
|
||||
@ -141,9 +141,9 @@ inline void plVertCoder::IEncodeFloat(hsStream* s, const UInt32 vertsLeft, const
|
||||
{
|
||||
ICountFloats(src, (UInt16)vertsLeft, kQuanta[field], stride, fFloats[field][chan].fOffset, fFloats[field][chan].fAllSame, fFloats[field][chan].fCount);
|
||||
|
||||
s->WriteSwapScalar(fFloats[field][chan].fOffset);
|
||||
s->WriteLEScalar(fFloats[field][chan].fOffset);
|
||||
s->WriteBool(fFloats[field][chan].fAllSame);
|
||||
s->WriteSwap16(fFloats[field][chan].fCount);
|
||||
s->WriteLE16(fFloats[field][chan].fCount);
|
||||
|
||||
}
|
||||
if (!fFloats[field][chan].fAllSame)
|
||||
@ -158,9 +158,9 @@ inline void plVertCoder::IDecodeFloat(hsStream* s, const int field, const int ch
|
||||
{
|
||||
if( !fFloats[field][chan].fCount )
|
||||
{
|
||||
fFloats[field][chan].fOffset = s->ReadSwapScalar();
|
||||
fFloats[field][chan].fOffset = s->ReadLEScalar();
|
||||
fFloats[field][chan].fAllSame = s->ReadBool();
|
||||
fFloats[field][chan].fCount = s->ReadSwap16();
|
||||
fFloats[field][chan].fCount = s->ReadLE16();
|
||||
}
|
||||
|
||||
if (!fFloats[field][chan].fAllSame)
|
||||
@ -283,7 +283,7 @@ inline void plVertCoder::IEncodeByte(hsStream* s, const int chan, const UInt32 v
|
||||
UInt16 cnt = fColors[chan].fCount;
|
||||
if( fColors[chan].fSame )
|
||||
cnt |= kSameMask;
|
||||
s->WriteSwap16(cnt);
|
||||
s->WriteLE16(cnt);
|
||||
|
||||
if( fColors[chan].fSame )
|
||||
s->WriteByte(*src);
|
||||
@ -300,7 +300,7 @@ inline void plVertCoder::IDecodeByte(hsStream* s, const int chan, UInt8*& dst, c
|
||||
{
|
||||
if( !fColors[chan].fCount )
|
||||
{
|
||||
UInt16 cnt = s->ReadSwap16();
|
||||
UInt16 cnt = s->ReadLE16();
|
||||
if( cnt & kSameMask )
|
||||
{
|
||||
fColors[chan].fSame = true;
|
||||
@ -356,7 +356,7 @@ inline void plVertCoder::IEncode(hsStream* s, const UInt32 vertsLeft, const UInt
|
||||
if( format & plGBufferGroup::kSkinIndices )
|
||||
{
|
||||
const UInt32 idx = *(UInt32*)src;
|
||||
s->WriteSwap32(idx);
|
||||
s->WriteLE32(idx);
|
||||
src += 4;
|
||||
}
|
||||
}
|
||||
@ -395,7 +395,7 @@ inline void plVertCoder::IDecode(hsStream* s, UInt8*& dst, const UInt32 stride,
|
||||
if( format & plGBufferGroup::kSkinIndices )
|
||||
{
|
||||
UInt32* idx = (UInt32*)dst;
|
||||
*idx = s->ReadSwap32();
|
||||
*idx = s->ReadLE32();
|
||||
dst += 4;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user