Ejemplo n.º 1
0
//------------------------------------------------------------------------------
//!
void
CameraManipulator::tilt( float primAngle, float secAngle )
{
   primAngle *= _flipTiltH;
   secAngle  *= _flipTiltV;

   // TODO
   // Clamping of secondary angle...

   // Rotate the referential.
   camera()->referential( _ref.getRotated( _primaryAxis, primAngle ) );

   // Calculate the rotation quaternion and it matrix.
   Quatd quat = Quatd::axisAngle( _primaryAxis, primAngle );
   Mat4d mat = quat.toMatrix();

   // Rotate the SecondaryAxis.
   Vec3f secondaryAxis = mat * _secondaryAxis;

   // Rotate the referential.
   Reff ref = camera()->referential().getRotated( secondaryAxis, secAngle );
   ref.orientation().normalize();
   camera()->referential( ref );

   // Move the POI.
   _poi = mat * ( _grabPoi - _ref.position() );

   quat = Quatd::axisAngle( secondaryAxis, secAngle );
   _poi = quat.toMatrix()*_poi;
   _poi += _ref.position();
}
Ejemplo n.º 2
0
//------------------------------------------------------------------------------
//!
void
CameraManipulator::orbit( float primAngle, float secAngle )
{
   primAngle *= _flipOrbitH;
   secAngle  *= _flipOrbitV;

   // Rotate the referential.
   camera()->referential( _ref.getRotated( _poi, _primaryAxis, primAngle ) );

   // Rotate the SecondaryAxis.
   Quatd quat = Quatd::axisAngle( _primaryAxis, primAngle );

   Vec3f secondaryAxis = quat.toMatrix() * _secondaryAxis;

   // Rotate the referential.
   Reff ref = camera()->referential().getRotated( _poi, secondaryAxis, secAngle );
   ref.orientation().normalize();
   camera()->referential( ref );
}