Skip to content

Commit 8ca0322

Browse files
committed
vrad: Use for range loop for displacements tree
1 parent aef0476 commit 8ca0322

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

utils/vrad/vraddisps.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -506,19 +506,19 @@ void CVRadDispMgr::MakePatches( void )
506506
float flTotalArea = 0.0f;
507507

508508
// Create patches for all of the displacements.
509-
int nTreeCount = m_DispTrees.Count();
510-
for( int iTree = 0; iTree < nTreeCount; ++iTree )
509+
const intp nTreeCount = m_DispTrees.Count();
510+
for( auto &tree : m_DispTrees )
511511
{
512512
// Get the current displacement collision tree.
513-
CVRADDispColl *pDispTree = m_DispTrees[iTree].m_pDispTree;
513+
CVRADDispColl *pDispTree = tree.m_pDispTree;
514514
if( !pDispTree )
515515
continue;
516516

517517
flTotalArea += pDispTree->CreateParentPatches();
518518
}
519519

520520
// Print stats.
521-
qprintf( "%i Displacements\n", nTreeCount );
521+
qprintf( "%zd Displacements\n", nTreeCount );
522522
qprintf( "%i Square Feet [%.2f Square Inches]\n", ( int )( flTotalArea / 144.0f ), flTotalArea );
523523
}
524524
//-----------------------------------------------------------------------------
@@ -619,11 +619,10 @@ void CVRadDispMgr::ClipRayToDispInLeaf( DispTested_t &dispTested, Ray_t const &r
619619

620620
void CVRadDispMgr::AddPolysForRayTrace( void )
621621
{
622-
int nTreeCount = m_DispTrees.Count();
623-
for( int iTree = 0; iTree < nTreeCount; ++iTree )
622+
for( auto &tree : m_DispTrees )
624623
{
625624
// Get the current displacement collision tree.
626-
CVRADDispColl *pDispTree = m_DispTrees[iTree].m_pDispTree;
625+
CVRADDispColl *pDispTree = tree.m_pDispTree;
627626

628627
// Add the triangles of the tree to the RT environment
629628
pDispTree->AddPolysForRayTrace();

0 commit comments

Comments
 (0)