minor refractoring

This commit is contained in:
Dander7BD 2014-02-11 09:32:49 +01:00
parent f53926444f
commit d5e85b4258
2 changed files with 11 additions and 11 deletions

View File

@ -88,9 +88,9 @@ const Quaternion & Camera_Basic::GetRotation() const
if( this->rotationIsOutOfDate ) if( this->rotationIsOutOfDate )
{ {
// Maintain rotation resolution by keeping axis within [0, 2pi] (trigonometric methods gets faster too) // Maintain rotation resolution by keeping axis within [0, 2pi] (trigonometric methods gets faster too)
Float4 numerator; Float4 integer;
::std::modf( this->angularAxis * (0.5f / pi), numerator.xyz ); ::std::modf( this->angularAxis * (0.5f / pi), integer.xyz );
this->angularAxis -= ((2.0f * pi) * numerator).xyz; this->angularAxis -= ((2.0f * pi) * integer).xyz;
this->rotation = Rotation( this->angularAxis ); this->rotation = Rotation( this->angularAxis );
this->rotationIsOutOfDate = false; this->rotationIsOutOfDate = false;

View File

@ -125,17 +125,17 @@ namespace std
} }
/******************************************************************* /*******************************************************************
* @param numerator of the vector vec * @param integer part of the elements in vector vec
* @return the denomiator of the vector vec. * @return the fract part of the elements in vector vec.
*******************************************************************/ *******************************************************************/
template<typename ScalarType> template<typename ScalarType>
inline ::LinearAlgebra::Vector3<ScalarType> modf( const ::LinearAlgebra::Vector3<ScalarType> &vec, ::LinearAlgebra::Vector3<ScalarType> &numerator ) inline ::LinearAlgebra::Vector3<ScalarType> modf( const ::LinearAlgebra::Vector3<ScalarType> &vec, ::LinearAlgebra::Vector3<ScalarType> &integer )
{ {
::LinearAlgebra::Vector3<ScalarType> denominator; ::LinearAlgebra::Vector3<ScalarType> fract;
denominator.x = (ScalarType)modf( vec.x, &numerator.x ); fract.x = (ScalarType)modf( vec.x, &integer.x );
denominator.y = (ScalarType)modf( vec.y, &numerator.y ); fract.y = (ScalarType)modf( vec.y, &integer.y );
denominator.z = (ScalarType)modf( vec.z, &numerator.z ); fract.z = (ScalarType)modf( vec.z, &integer.z );
return denominator; return fract;
} }
/******************************************************************* /*******************************************************************