36 glm::mat4 matrix( 1.0f );
38 matrix = glm::translate( matrix, aOffset );
39 matrix = glm::rotate( matrix, glm::radians( -aRotation.z ), { 0.0f, 0.0f, 1.0f } );
40 matrix = glm::rotate( matrix, glm::radians( -aRotation.y ), { 0.0f, 1.0f, 0.0f } );
41 matrix = glm::rotate( matrix, glm::radians( -aRotation.x ), { 1.0f, 0.0f, 0.0f } );
43 return glm::scale( matrix, aScale );
51 const float sinBeta = -aRotation[0][2];
52 const float beta = std::asin( glm::clamp( sinBeta, -1.0f, 1.0f ) );
53 const float cosBeta = std::cos( beta );
61 gamma = std::atan2( sinBeta * aRotation[2][1], aRotation[1][1] );
65 alpha = std::atan2( aRotation[1][2], aRotation[2][2] );
66 gamma = std::atan2( aRotation[0][1], aRotation[0][0] );
69 return SFVEC3F( -glm::degrees( alpha ), -glm::degrees( beta ), -glm::degrees( gamma ) );
SFVEC3F InterpolateModelRotation(const SFVEC3F &aStart, const SFVEC3F &aEnd, float aT)
Interpolate between two model orientations along the shortest arc.
glm::mat4 CalcModelMatrix(const SFVEC3F &aOffset, const SFVEC3F &aRotation, const SFVEC3F &aScale)
Build the model-to-footprint transform used by rendering and picking.