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

Method GetBoundingSphere

trinity/Eve/EveTransform.cpp:354–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352}
353
354bool EveTransform::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const
355{
356 bool valid = false;
357 Vector3 minBounds, maxBounds;
358 if( m_overrideBoundsMax.x != m_overrideBoundsMin.x || m_overrideBoundsMax.y != m_overrideBoundsMin.y || m_overrideBoundsMax.z != m_overrideBoundsMin.z )
359 {
360 minBounds = m_overrideBoundsMin;
361 maxBounds = m_overrideBoundsMax;
362 BoundingSphereFromBox( sphere, minBounds, maxBounds, &m_worldTransform );
363 valid = true;
364 }
365 else if( m_mesh && m_mesh->GetBoundingBox( minBounds, maxBounds ) )
366 {
367 BoundingSphereFromBox( sphere, minBounds, maxBounds, &m_worldTransform );
368 valid = true;
369 }
370
371 if( query == EVE_BOUNDS_WITH_CHILDREN )
372 {
373 Vector4 boundingSphere( 0, 0, 0, 100.f );
374 for( auto it = m_children.cbegin(); it != m_children.cend(); it++ )
375 {
376 if( ( *it )->GetBoundingSphere( boundingSphere, query ) )
377 {
378 BoundingSphereSetOrUpdate( boundingSphere, sphere, valid );
379 valid = true;
380 }
381 }
382 }
383
384 return valid;
385}
386
387void EveTransform::UpdateModelCenterWorldPosition( Vector3& position, Be::Time t )
388{

Callers

nothing calls this directly

Calls 3

BoundingSphereFromBoxFunction · 0.85
GetBoundingBoxMethod · 0.45

Tested by

no test coverage detected