Issue found with PVS-Studio:

Many instances of a function or expression being used repeatedly, which can lower performance.

Fixed it in these cases by creating on local var, reference or pointer that's used instead.
This commit is contained in:
Areloch 2015-07-13 22:51:17 -05:00
parent ec63398042
commit 2002d74b78
38 changed files with 465 additions and 371 deletions

View file

@ -815,8 +815,10 @@ bool SceneCullingState::isOccludedByTerrain( SceneObject* object ) const
if( !terrain )
continue;
MatrixF terrWorldTransform = terrain->getWorldTransform();
Point3F localCamPos = getCameraState().getViewPosition();
terrain->getWorldTransform().mulP( localCamPos );
terrWorldTransform.mulP(localCamPos);
F32 height;
terrain->getHeight( Point2F( localCamPos.x, localCamPos.y ), &height );
bool aboveTerrain = ( height <= localCamPos.z );
@ -837,10 +839,10 @@ bool SceneCullingState::isOccludedByTerrain( SceneObject* object ) const
Point3F ll(rBox.maxExtents.x, rBox.minExtents.y, rBox.maxExtents.z);
Point3F lr(rBox.maxExtents.x, rBox.maxExtents.y, rBox.maxExtents.z);
terrain->getWorldTransform().mulP(ul);
terrain->getWorldTransform().mulP(ur);
terrain->getWorldTransform().mulP(ll);
terrain->getWorldTransform().mulP(lr);
terrWorldTransform.mulP(ul);
terrWorldTransform.mulP(ur);
terrWorldTransform.mulP(ll);
terrWorldTransform.mulP(lr);
Point3F xBaseL0_s = ul - localCamPos;
Point3F xBaseL0_e = lr - localCamPos;