
332 GPGPU Programming for Games and Science
// Multiplication of transforms. M0 is ’ this ’, M1 is ’transform ’,
// and the function returns M0∗M1 .
Transform<Real> operator∗ ( Transform<Real> const& transform ) const ;
private :
// Compute th e b a s e −c la s s Matrix4x4<Real> from the channels .
void UpdateMatrix () ;
Quaternion<Real> mQuaternion ;
Real mTranslation [3 ] , mScale ;
} ;
LISTING 6.41:TheTransform class in GTEngine.
The
Transform class stores the individual channels for rotation, translation,
and uniform scale. Each
Set* operation invokes the private UpdateMatrix that
computes the actual 4 × 4 affine representation and stores it in the
Matrix4x4 ...