Camera_Basic edits
This commit is contained in:
parent
1a86ed23cc
commit
77eceaf285
|
@ -68,6 +68,16 @@ void Camera_Basic::Rotate( const Float3 &deltaAngularAxis )
|
|||
this->rotationIsOutOfDate = true;
|
||||
}
|
||||
|
||||
const Float3 & Camera_Basic::GetPosition() const
|
||||
{
|
||||
return this->translation;
|
||||
}
|
||||
|
||||
const Float3 & Camera_Basic::GetAngularAxis() const
|
||||
{
|
||||
return this->angularAxis;
|
||||
}
|
||||
|
||||
Float3 Camera_Basic::GetNormalOf( const Float3 &axis ) const
|
||||
{
|
||||
return WorldAxisOf( this->GetRotation(), axis );
|
||||
|
@ -77,8 +87,10 @@ const Quaternion & Camera_Basic::GetRotation() const
|
|||
{
|
||||
if( this->rotationIsOutOfDate )
|
||||
{
|
||||
/*Float4 temp;
|
||||
::std::fmod( Float4(this->angularAxis, 0.0f) );*/
|
||||
// Maintain rotation resolution by keeping axis within [0, 2pi] (trigonometric methods gets faster too)
|
||||
Float4 numerator;
|
||||
::std::modf( this->angularAxis * (0.5f / pi), numerator.xyz );
|
||||
this->angularAxis -= ((2.0f * pi) * numerator).xyz;
|
||||
|
||||
this->rotation = Rotation( this->angularAxis );
|
||||
this->rotationIsOutOfDate = false;
|
||||
|
|
|
@ -21,6 +21,8 @@ public:
|
|||
void Move( const ::Oyster::Math::Float3 &deltaPosition );
|
||||
void Rotate( const ::Oyster::Math::Float3 &deltaAngularAxis );
|
||||
|
||||
const ::Oyster::Math::Float3 & GetPosition() const;
|
||||
const ::Oyster::Math::Float3 & GetAngularAxis() const;
|
||||
::Oyster::Math::Float3 GetNormalOf( const ::Oyster::Math::Float3 &axis ) const;
|
||||
const ::Oyster::Math::Quaternion & GetRotation() const;
|
||||
::Oyster::Math::Float3x3 & GetRotationMatrix( ::Oyster::Math::Float3x3 &targetMem ) const;
|
||||
|
@ -30,7 +32,8 @@ public:
|
|||
::Oyster::Math::Float4x4 & GetViewsProjMatrix( Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() ) const;
|
||||
|
||||
private:
|
||||
::Oyster::Math::Float3 translation, angularAxis;
|
||||
::Oyster::Math::Float3 translation;
|
||||
mutable ::Oyster::Math::Float3 angularAxis;
|
||||
::Oyster::Math::Float4x4 projection;
|
||||
mutable ::Oyster::Math::Quaternion rotation;
|
||||
mutable bool rotationIsOutOfDate;
|
||||
|
|
Loading…
Reference in New Issue