MCPcopy Create free account
hub / github.com/carbonengine/trinity / UpdateSwarm

Method UpdateSwarm

trinity/Eve/SpaceObject/EveSwarm.cpp:497–643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495
496
497void EveSwarm::UpdateSwarm( Be::Time t )
498{
499 CCP_STATS_ZONE( __FUNCTION__ );
500 if( t == m_timeLast )
501 {
502 return;
503 }
504 if( !m_timeLast )
505 {
506 m_timeLast = t;
507 }
508
509 Vector3 worldTransformLast = m_worldPosition;
510 UpdateWorldTransform( t );
511
512 if( !m_started )
513 {
514 // Set initial position
515 for( unsigned i = 0; i < m_vehicles.size(); i++ )
516 {
517 m_vehicles[i].position = m_worldPosition;
518 }
519 }
520
521 float timeDelta = TimeAsFloat( t - m_timeLast );
522 float timeSeconds = TimeAsFloat( t - m_timeLast ) * m_behavior.m_timeMultiplier;
523 if( timeSeconds > m_behavior.m_maxTime )
524 {
525 timeSeconds = m_behavior.m_maxTime;
526 }
527
528 m_timeSinceUpdate += timeDelta;
529 m_timeLast = t;
530
531 bool updateNow = m_isVisible || m_timeSinceUpdate >= m_lodUpdateTime;
532 if( !updateNow )
533 {
534 if( m_started )
535 {
536 Vector3 movement = m_worldPosition - worldTransformLast;
537 // Update velocities and positions
538 for( unsigned i = 0; i < m_vehicles.size(); i++ )
539 {
540 m_vehicles[i].position += movement;
541 }
542 m_squadBoundsMax += movement;
543 m_squadBoundsMin += movement;
544 }
545 m_started = true;
546 return;
547 }
548 m_timeSinceUpdate = 0;
549
550 Vector3 originShift( 0.f, 0.f, 0.f );
551 Vector3d originNow( 0.0, 0.0, 0.0 );
552 IEveReferencePointPtr refObject( BlueCastPtr( m_ballPosition ) );
553 if( refObject )
554 {

Callers

nothing calls this directly

Calls 9

BoundingBoxInitializeFunction · 0.85
CrossFunction · 0.85
BoundingBoxUpdateFunction · 0.85
LengthFunction · 0.85
LerpFunction · 0.85
TriLinearizeFunction · 0.85
sizeMethod · 0.80
AsVector3Method · 0.80
Vector3Class · 0.50

Tested by

no test coverage detected