| 496 | |
| 497 | template< S32 NUM_DIMENSIONS, class Object > |
| 498 | void ScopeTracker< NUM_DIMENSIONS, Object >::updateObject( Object object ) |
| 499 | { |
| 500 | PROFILE_SCOPE( ScopeTracker_updateObject ); |
| 501 | |
| 502 | if( object == mReferenceObject ) |
| 503 | { |
| 504 | // Get the reference center position. |
| 505 | |
| 506 | F32 position[ NUM_DIMENSIONS ]; |
| 507 | Deref( mReferenceObject ).getReferenceCenter( position ); |
| 508 | |
| 509 | // Move the reference tracking node. |
| 510 | |
| 511 | for( U32 n = 0; n < NUM_DIMENSIONS; ++ n ) |
| 512 | _moveTrackingNode( n, Deref( mReferenceObject ).getMinTrackingNode( n ), position[ n ] ); |
| 513 | |
| 514 | // Flush the potential-scope-in list. |
| 515 | |
| 516 | while( !mPotentialScopeInObjects.empty() ) |
| 517 | { |
| 518 | Object obj = mPotentialScopeInObjects.last(); |
| 519 | mPotentialScopeInObjects.decrement(); |
| 520 | |
| 521 | if( Deref(obj).isInScope() ) |
| 522 | _onScopeIn(obj); |
| 523 | } |
| 524 | } |
| 525 | else |
| 526 | { |
| 527 | // Get the object bounds. |
| 528 | |
| 529 | F32 minBounds[ NUM_DIMENSIONS ]; |
| 530 | F32 maxBounds[ NUM_DIMENSIONS ]; |
| 531 | |
| 532 | Deref( object ).getBounds( minBounds, maxBounds ); |
| 533 | |
| 534 | // Move the object's tracking nodes. |
| 535 | |
| 536 | bool wasInScope = Deref( object ).isInScope(); |
| 537 | for( U32 n = 0; n < NUM_DIMENSIONS; ++ n ) |
| 538 | { |
| 539 | NodeType* minNode = Deref( object ).getMinTrackingNode( n ); |
| 540 | NodeType* maxNode = Deref( object ).getMaxTrackingNode( n ); |
| 541 | |
| 542 | _moveTrackingNode( n, minNode, minBounds[ n ] ); |
| 543 | _moveTrackingNode( n, maxNode, maxBounds[ n ] ); |
| 544 | } |
| 545 | |
| 546 | // Rescope the object, if necessary. |
| 547 | |
| 548 | if( wasInScope && !Deref( object ).isInScope() ) |
| 549 | _onScopeOut( object ); |
| 550 | else if( !wasInScope && Deref( object ).isInScope() ) |
| 551 | _onScopeIn( object ); |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | //----------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected