| 738 | |
| 739 | |
| 740 | bool 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 | |
| 775 | void Tr2GStateAnimation::RenderBones( const Matrix& modelTransform ) |
| 776 | { |
nothing calls this directly
no test coverage detected