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

Method GetDynamicBounds

trinity/Tr2GStateAnimation.cpp:740–773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

738
739
740bool Tr2GStateAnimation::GetDynamicBounds( Vector4& boundingSphere, Vector3& aabbMin, Vector3& aabbMax )
741{
742 Vector3 transformed[8];
743 if( m_boneBounds.empty() && !InitializeBoundingInfo() )
744 {
745 return false;
746 }
747
748 BoundingSphereInitialize( boundingSphere );
749 BoundingBoxInitialize( aabbMin, aabbMax );
750
751 for( unsigned i = 0; i < m_boneBounds.size(); ++i )
752 {
753 const Matrix* mat = reinterpret_cast<const Matrix*>( GrannyGetWorldPose4x4( m_worldPose, m_boneBounds[i].m_boneIndex ) );
754
755 for( unsigned point = 0; point < 8; point++ )
756 {
757 transformed[point] = TransformCoord( m_boneBounds[i].m_corners[point], *mat );
758 BoundingBoxUpdate( aabbMin, aabbMax, transformed[point] );
759 BoundingSphereUpdate( transformed[point], boundingSphere );
760 }
761 }
762
763 const granny_file_info* fi = GetFileInfo();
764 if( fi )
765 {
766 aabbMin += *reinterpret_cast<Vector3*>( fi->Models[m_modelIndex]->InitialPlacement.Position );
767 aabbMax += *reinterpret_cast<Vector3*>( fi->Models[m_modelIndex]->InitialPlacement.Position );
768 boundingSphere.x += fi->Models[m_modelIndex]->InitialPlacement.Position[0];
769 boundingSphere.y += fi->Models[m_modelIndex]->InitialPlacement.Position[1];
770 boundingSphere.z += fi->Models[m_modelIndex]->InitialPlacement.Position[2];
771 }
772 return true;
773}
774
775void Tr2GStateAnimation::RenderBones( const Matrix& modelTransform )
776{

Callers

nothing calls this directly

Calls 6

BoundingSphereInitializeFunction · 0.85
BoundingBoxInitializeFunction · 0.85
BoundingBoxUpdateFunction · 0.85
BoundingSphereUpdateFunction · 0.85
emptyMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected