Adding support for matrix4x4 construction from position, rotation and scaling parameters
parent
5e603d9ed8
commit
6b471317d2
|
@ -79,6 +79,14 @@ public:
|
||||||
/** construction from 3x3 matrix, remaining elements are set to identity */
|
/** construction from 3x3 matrix, remaining elements are set to identity */
|
||||||
explicit aiMatrix4x4t( const aiMatrix3x3t<TReal>& m);
|
explicit aiMatrix4x4t( const aiMatrix3x3t<TReal>& m);
|
||||||
|
|
||||||
|
/** construction from position, rotation and scaling components
|
||||||
|
* @param scaling The scaling for the x,y,z axes
|
||||||
|
* @param rotation The rotation as a hamilton quaternion
|
||||||
|
* @param position The position for the x,y,z axes
|
||||||
|
*/
|
||||||
|
aiMatrix4x4t(aiVector3t<TReal>& scaling, aiQuaterniont<TReal>& rotation,
|
||||||
|
aiVector3t<TReal>& position);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// array access operators
|
// array access operators
|
||||||
|
|
|
@ -102,6 +102,34 @@ inline aiMatrix4x4t<TReal>::aiMatrix4x4t (const aiMatrix3x3t<TReal>& m)
|
||||||
d1 = static_cast<TReal>(0.0); d2 = static_cast<TReal>(0.0); d3 = static_cast<TReal>(0.0); d4 = static_cast<TReal>(1.0);
|
d1 = static_cast<TReal>(0.0); d2 = static_cast<TReal>(0.0); d3 = static_cast<TReal>(0.0); d4 = static_cast<TReal>(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------------------
|
||||||
|
template <typename TReal>
|
||||||
|
inline aiMatrix4x4t<TReal>::aiMatrix4x4t (aiVector3t<TReal>& scaling, aiQuaterniont<TReal>& rotation, aiVector3t<TReal>& position)
|
||||||
|
{
|
||||||
|
// build a 3x3 rotation matrix
|
||||||
|
aiMatrix3x3t<TReal> m = rotation.GetMatrix();
|
||||||
|
|
||||||
|
a1 = m.a1 * scaling.x;
|
||||||
|
a2 = m.a2 * scaling.x;
|
||||||
|
a3 = m.a3 * scaling.x;
|
||||||
|
a4 = position.x;
|
||||||
|
|
||||||
|
b1 = m.b1 * scaling.y;
|
||||||
|
b2 = m.b2 * scaling.y;
|
||||||
|
b3 = m.b3 * scaling.y;
|
||||||
|
b4 = position.y;
|
||||||
|
|
||||||
|
c1 = m.c1 * scaling.z;
|
||||||
|
c2 = m.c2 * scaling.z;
|
||||||
|
c3 = m.c3 * scaling.z;
|
||||||
|
c4= position.z;
|
||||||
|
|
||||||
|
d1 = static_cast<TReal>(0.0);
|
||||||
|
d2 = static_cast<TReal>(0.0);
|
||||||
|
d3 = static_cast<TReal>(0.0);
|
||||||
|
d4 = static_cast<TReal>(1.0);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
template <typename TReal>
|
template <typename TReal>
|
||||||
inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::operator *= (const aiMatrix4x4t<TReal>& m)
|
inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::operator *= (const aiMatrix4x4t<TReal>& m)
|
||||||
|
|
Loading…
Reference in New Issue