Browse Source

GBufferGroup colors to std::vector

Adam Johnson 10 years ago
parent
commit
e7a0f4a4d1
  1. 28
      Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.cpp
  2. 14
      Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.h

28
Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.cpp

@ -114,7 +114,7 @@ plGBufferGroup::plGBufferGroup( uint8_t format, bool vertsVolatile, bool idxVola
{
fVertBuffStorage.Reset();
fIdxBuffStorage.Reset();
fColorBuffStorage.Reset();
fColorBuffStorage.clear();
fVertexBufferRefs.Reset();
fIndexBufferRefs.Reset();
fCells.clear();
@ -216,7 +216,7 @@ void plGBufferGroup::CleanUp( void )
plProfile_DelMem(MemBufGrpIndex, fIdxBuffCounts[i] * sizeof(uint16_t));
delete [] fIdxBuffStorage[ i ];
}
for( i = 0; i < fColorBuffStorage.GetCount(); i++ )
for (size_t i = 0; i < fColorBuffStorage.size(); ++i)
{
plProfile_DelMem(MemBufGrpVertex, fColorBuffCounts[i] * sizeof(plGBufferColor));
delete [] fColorBuffStorage[ i ];
@ -233,8 +233,8 @@ void plGBufferGroup::CleanUp( void )
fIdxBuffCounts.Reset();
fIdxBuffStarts.Reset();
fIdxBuffEnds.Reset();
fColorBuffStorage.Reset();
fColorBuffCounts.Reset();
fColorBuffStorage.clear();
fColorBuffCounts.clear();
fCells.clear();
}
@ -374,7 +374,7 @@ void plGBufferGroup::Read( hsStream *s )
fVertBuffSizes.Reset();
fVertBuffStarts.Reset();
fVertBuffEnds.Reset();
fColorBuffCounts.Reset();
fColorBuffCounts.clear();
fIdxBuffCounts.Reset();
fIdxBuffStarts.Reset();
fIdxBuffEnds.Reset();
@ -401,8 +401,8 @@ void plGBufferGroup::Read( hsStream *s )
coder.Read(s, vData, fFormat, fStride, numVerts);
fColorBuffCounts.Append(0);
fColorBuffStorage.Append(nil);
fColorBuffCounts.push_back(0);
fColorBuffStorage.push_back(nullptr);
}
else
@ -420,7 +420,7 @@ void plGBufferGroup::Read( hsStream *s )
plProfile_NewMem(MemBufGrpVertex, temp);
temp = s->ReadLE32();
fColorBuffCounts.Append( temp );
fColorBuffCounts.push_back( temp );
if( temp > 0 )
{
@ -431,7 +431,7 @@ void plGBufferGroup::Read( hsStream *s )
else
cData = nil;
fColorBuffStorage.Append( cData );
fColorBuffStorage.push_back( cData );
}
}
@ -753,8 +753,8 @@ bool plGBufferGroup::ReserveVertStorage( uint32_t numVerts, uint32_t *vbIndex
fVertBuffStarts.Append(0);
fVertBuffEnds.Append(-1);
fColorBuffStorage.Append( nil );
fColorBuffCounts.Append( 0 );
fColorBuffStorage.push_back(nullptr);
fColorBuffCounts.push_back(0);
fCells.push_back( new std::vector<plGBufferCell> );
}
@ -795,15 +795,15 @@ bool plGBufferGroup::ReserveVertStorage( uint32_t numVerts, uint32_t *vbIndex
}
/// Switch over
if( storagePtr != nil )
if (storagePtr)
{
if( fVertBuffStorage[ i ] != nil )
delete [] fVertBuffStorage[ i ];
fVertBuffStorage[ i ] = storagePtr;
}
if( cStoragePtr != nil )
if (cStoragePtr)
{
if( fColorBuffStorage[ i ] != nil )
if (fColorBuffStorage[ i ])
delete [] fColorBuffStorage[ i ];
fColorBuffStorage[ i ] = cStoragePtr;
fColorBuffCounts[ i ] += numVerts;

14
Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.h

@ -125,18 +125,18 @@ class plGBufferGroup
hsTArray<hsGDeviceRef *> fVertexBufferRefs;
hsTArray<hsGDeviceRef *> fIndexBufferRefs;
hsTArray<uint32_t> fVertBuffSizes;
hsTArray<uint32_t> fIdxBuffCounts;
hsTArray<uint32_t> fColorBuffCounts;
hsTArray<uint8_t *> fVertBuffStorage;
hsTArray<uint16_t *> fIdxBuffStorage;
hsTArray<uint32_t> fVertBuffSizes;
hsTArray<uint32_t> fIdxBuffCounts;
std::vector<uint32_t> fColorBuffCounts;
hsTArray<uint8_t *> fVertBuffStorage;
hsTArray<uint16_t *> fIdxBuffStorage;
hsTArray<uint32_t> fVertBuffStarts;
hsTArray<int32_t> fVertBuffEnds;
hsTArray<uint32_t> fIdxBuffStarts;
hsTArray<int32_t> fIdxBuffEnds;
hsTArray<plGBufferColor *> fColorBuffStorage;
std::vector<plGBufferColor*> fColorBuffStorage;
std::vector<std::vector<plGBufferCell>*> fCells;
@ -236,7 +236,7 @@ class plGBufferGroup
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 ]; }
plGBufferColor *GetColorBufferData( size_t idx ) { return fColorBuffStorage[ idx ]; }
hsGDeviceRef *GetVertexBufferRef( uint32_t i );
hsGDeviceRef *GetIndexBufferRef( uint32_t i );

Loading…
Cancel
Save