|
@@ -1302,14 +1302,14 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|
|
// Loop through batches allocating buffers and submitting render instances.
|
|
|
for ( U32 i = 0; i < batches.size(); i++ )
|
|
|
{
|
|
|
- DecalBatch ¤tBatch = batches[i];
|
|
|
+ currentBatch = &batches[i];
|
|
|
|
|
|
// Copy data into the system memory arrays, from all decals in this batch...
|
|
|
|
|
|
DecalVertex *vpPtr = vertData;
|
|
|
U16 *pbPtr = indexData;
|
|
|
|
|
|
- U32 lastDecal = currentBatch.startDecal + currentBatch.decalCount;
|
|
|
+ U32 lastDecal = currentBatch->startDecal + currentBatch->decalCount;
|
|
|
|
|
|
U32 voffset = 0;
|
|
|
U32 ioffset = 0;
|
|
@@ -1317,13 +1317,13 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|
|
// This is an ugly hack for ProjectedShadow!
|
|
|
GFXTextureObject *customTex = NULL;
|
|
|
|
|
|
- for ( U32 j = currentBatch.startDecal; j < lastDecal; j++ )
|
|
|
+ for ( U32 j = currentBatch->startDecal; j < lastDecal; j++ )
|
|
|
{
|
|
|
- DecalInstance *dinst = mDecalQueue[j];
|
|
|
+ dinst = mDecalQueue[j];
|
|
|
|
|
|
const U32 indxCount =
|
|
|
- (dinst->mIndxCount > currentBatch.iCount) ?
|
|
|
- currentBatch.iCount : dinst->mIndxCount;
|
|
|
+ (dinst->mIndxCount > currentBatch->iCount) ?
|
|
|
+ currentBatch->iCount : dinst->mIndxCount;
|
|
|
for ( U32 k = 0; k < indxCount; k++ )
|
|
|
{
|
|
|
*( pbPtr + ioffset + k ) = dinst->mIndices[k] + voffset;
|
|
@@ -1332,8 +1332,8 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|
|
ioffset += indxCount;
|
|
|
|
|
|
const U32 vertCount =
|
|
|
- (dinst->mVertCount > currentBatch.vCount) ?
|
|
|
- currentBatch.vCount : dinst->mVertCount;
|
|
|
+ (dinst->mVertCount > currentBatch->vCount) ?
|
|
|
+ currentBatch->vCount : dinst->mVertCount;
|
|
|
dMemcpy( vpPtr + voffset, dinst->mVerts, sizeof( DecalVertex ) * vertCount );
|
|
|
voffset += vertCount;
|
|
|
|
|
@@ -1342,8 +1342,8 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|
|
customTex = *dinst->mCustomTex;
|
|
|
}
|
|
|
|
|
|
- AssertFatal( ioffset == currentBatch.iCount, "bad" );
|
|
|
- AssertFatal( voffset == currentBatch.vCount, "bad" );
|
|
|
+ AssertFatal( ioffset == currentBatch->iCount, "bad" );
|
|
|
+ AssertFatal( voffset == currentBatch->vCount, "bad" );
|
|
|
|
|
|
// Get handles to video memory buffers we will be filling...
|
|
|
|
|
@@ -1385,9 +1385,9 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|
|
pb->lock( &pbPtr );
|
|
|
|
|
|
// Memcpy from system to video memory.
|
|
|
- const U32 vpCount = sizeof( DecalVertex ) * currentBatch.vCount;
|
|
|
+ const U32 vpCount = sizeof( DecalVertex ) * currentBatch->vCount;
|
|
|
dMemcpy( vpPtr, vertData, vpCount );
|
|
|
- const U32 pbCount = sizeof( U16 ) * currentBatch.iCount;
|
|
|
+ const U32 pbCount = sizeof( U16 ) * currentBatch->iCount;
|
|
|
dMemcpy( pbPtr, indexData, pbCount );
|
|
|
|
|
|
pb->unlock();
|
|
@@ -1400,7 +1400,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|
|
|
|
|
// Get the best lights for the current camera position
|
|
|
// if the materail is forward lit and we haven't got them yet.
|
|
|
- if ( currentBatch.matInst->isForwardLit() && !baseRenderInst.lights[0] )
|
|
|
+ if ( currentBatch->matInst->isForwardLit() && !baseRenderInst.lights[0] )
|
|
|
{
|
|
|
LightQuery query;
|
|
|
query.init( rootFrustum.getPosition(),
|
|
@@ -1416,15 +1416,15 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|
|
ri->primBuff = pb;
|
|
|
ri->vertBuff = vb;
|
|
|
|
|
|
- ri->matInst = currentBatch.matInst;
|
|
|
+ ri->matInst = currentBatch->matInst;
|
|
|
|
|
|
ri->prim = renderPass->allocPrim();
|
|
|
ri->prim->type = GFXTriangleList;
|
|
|
ri->prim->minIndex = 0;
|
|
|
ri->prim->startIndex = 0;
|
|
|
- ri->prim->numPrimitives = currentBatch.iCount / 3;
|
|
|
+ ri->prim->numPrimitives = currentBatch->iCount / 3;
|
|
|
ri->prim->startVertex = 0;
|
|
|
- ri->prim->numVertices = currentBatch.vCount;
|
|
|
+ ri->prim->numVertices = currentBatch->vCount;
|
|
|
|
|
|
// Ugly hack for ProjectedShadow!
|
|
|
if ( customTex )
|
|
@@ -1433,7 +1433,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
|
|
|
// The decal bin will contain render instances for both decals and decalRoad's.
|
|
|
// Dynamic decals render last, then editor decals and roads in priority order.
|
|
|
// DefaultKey is sorted in descending order.
|
|
|
- ri->defaultKey = currentBatch.dynamic ? 0xFFFFFFFF : (U32)currentBatch.priority;
|
|
|
+ ri->defaultKey = currentBatch->dynamic ? 0xFFFFFFFF : (U32)currentBatch->priority;
|
|
|
ri->defaultKey2 = 1;//(U32)lastDecal->mDataBlock;
|
|
|
|
|
|
renderPass->addInst( ri );
|