-// ======================
-// Need these because of mixed matrix types
-static void sgMultMat4(sgdMat4 dst, sgdMat4 m1, sgMat4 m2)
-{
- for ( int j = 0 ; j < 4 ; j++ )
- {
- dst[0][j] = m2[0][0] * m1[0][j] +
- m2[0][1] * m1[1][j] +
- m2[0][2] * m1[2][j] +
- m2[0][3] * m1[3][j] ;
-
- dst[1][j] = m2[1][0] * m1[0][j] +
- m2[1][1] * m1[1][j] +
- m2[1][2] * m1[2][j] +
- m2[1][3] * m1[3][j] ;
-
- dst[2][j] = m2[2][0] * m1[0][j] +
- m2[2][1] * m1[1][j] +
- m2[2][2] * m1[2][j] +
- m2[2][3] * m1[3][j] ;
-
- dst[3][j] = m2[3][0] * m1[0][j] +
- m2[3][1] * m1[1][j] +
- m2[3][2] * m1[2][j] +
- m2[3][3] * m1[3][j] ;
- }
-}
-
-// ======================
-static void ssgGetEntityTransform(ssgEntity *entity, sgMat4 m )
-{
- /*
- Walk backwards up the tree, transforming the
- vertex by all the matrices along the way.
-
- Upwards recursion hurts my head.
- */
-
- sgMat4 mat ;
-
- /*
- If this node has a parent - get the composite
- matrix for the parent.
- */
- if ( entity->getNumParents() > 0 )
- ssgGetEntityTransform ( entity->getParent(0), mat ) ;
- else
- sgMakeIdentMat4 ( mat ) ;
-
- /*
- If this node has a transform - then concatenate it.
- */
- if ( entity -> isAKindOf ( ssgTypeTransform () ) ) {
- sgMat4 this_mat ;
- ((ssgTransform *) entity) -> getTransform ( this_mat ) ;
- sgPostMultMat4 ( mat, this_mat ) ;
- }
-
- sgCopyMat4 ( m, mat ) ;
-}
-
-// ======================
-// return the passed entitity's bsphere's center point radius and
-// fully formed current model matrix for entity
-static void ssgGetCurrentBSphere( ssgEntity *entity, sgVec3 center, float *radius, sgMat4 m )
-{
- sgSphere *bsphere = entity->getBSphere();
- *radius = (double)bsphere->getRadius();
- sgCopyVec3( center, bsphere->getCenter() );
- sgMakeIdentMat4 ( m ) ;
- ssgGetEntityTransform( entity, m );
-}
-