MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / _setScope

Method _setScope

Engine/source/util/scopeTracker.h:717–755  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715
716template< S32 NUM_DIMENSIONS, class Object >
717void ScopeTracker< NUM_DIMENSIONS, Object >::_setScope( Object object )
718{
719 // If there's no reference object, all objects are out of scope.
720
721 if( !mReferenceObject || object == mReferenceObject )
722 {
723 Deref( object ).clearScopeMask();
724 return;
725 }
726
727 const bool wasInScope = Deref( object ).isInScope();
728
729 // Set the scoping state on each axis.
730
731 for( U32 n = 0; n < NUM_DIMENSIONS; ++ n )
732 {
733 const F32 referencePos = Deref( mReferenceObject ).getMinTrackingNode( n )->getPosition();
734 const F32 objectMin = Deref( object ).getMinTrackingNode( n )->getPosition();
735 const F32 objectMax = Deref( object ).getMaxTrackingNode( n )->getPosition();
736
737 bool isInScope = referencePos >= objectMin
738 && referencePos <= objectMax;
739
740 Deref( object ).setInScope( n, isInScope );
741 }
742
743 // Scope in/out if the scoping state has changed.
744
745 if( Deref( object ).isInScope() )
746 {
747 if( !wasInScope )
748 _onScopeIn( object );
749 }
750 else
751 {
752 if( wasInScope )
753 _onScopeOut( object );
754 }
755}
756
757//-----------------------------------------------------------------------------
758

Callers

nothing calls this directly

Calls 6

clearScopeMaskMethod · 0.80
isInScopeMethod · 0.80
getMinTrackingNodeMethod · 0.80
getMaxTrackingNodeMethod · 0.80
setInScopeMethod · 0.80
getPositionMethod · 0.45

Tested by

no test coverage detected