VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Protected Member Functions | Protected Attributes
makVrv::DtObserverAnimator Class Reference

Encapsulates the process of animating an observer to a given location. More...

Classes

struct  EntityInfo
 Data structure used to store information about an entity that the observer is moving towards and will attach to. More...

Public Member Functions

 DtObserverAnimator (DtDe &de, DtObserver &obs, DtVector geocEndPos, DtTaitBryan geocEndOri, double endZoom, float smoothTime=3.0f)
 Constructor for movement to absolute position and rotation in that are passed in as geocentric coordinates.
 DtObserverAnimator (DtDe &de, DtObserver &obs, DtVector cigEndPos, DtQuat cigEndOri, double endZoom, float smoothTime=3.0f)
 Constructor for movement to absolute position rotation in IG space.
 DtObserverAnimator (DtDe &de, DtObserver &obs, DtVector relativeEndPos, DtQuat relativeEndOri, double endZoom, DtUniqueID attachedTo, DtUniqueID secondaryAttachedTo, DtObserverObject::AttachType attachedType, float smoothTime=3.0f)
 Constructor for movement to relative position and rotation while attached to an entity.
 DtObserverAnimator (DtDe &de, DtObserver &obs, makArchives::DtObserverStateRecord &rec, float smoothTime=3.0f)
 Constructor for animating to a saved view.
virtual ~DtObserverAnimator ()
 DTOR.
virtual void tick ()
 Called every frame by the DtInputDriver to update the observer.
virtual bool isDone () const
 Is true when this animation is complete.
virtual DtObserverobserver () const
 Get the observer this animation is controlling.

Protected Member Functions

virtual EntityInfo entityInfo (makVrv::DtDe &de, const std::string &displayName)
 lookup functions to find entity info based on a display name or DtUniqueID
virtual EntityInfo entityInfo (makVrv::DtDe &de, DtUniqueID elementId)
virtual void updateTargets ()
 updates the target orientation and position.
void onInit ()
virtual void updateObserver ()
 sets the observer's position, orientation, and zoom level based on how far through the animation it is
virtual DtVector calcTargetPosition ()
 calculates the target position that we are trying to animate to.
virtual DtQuat calcTargetOrientation ()
 calculates the target orientation that we are trying to animate to.
virtual void calculateUpVector ()
 Calculates the up vector based on where in the world the observer is.
virtual void interpolatePosition (double t)
 Determines a new position using linear interpolation between start and end positions.
virtual void interpolateOrientation (double t)
 Determines the new orientation using spherical linear interpolation between start and end orientations.
virtual void interpolateZoom (double t)
 Determines the new zoom level based on linear interpolation between the start and stop zoom levels.
virtual void finish ()
 this marks the observer as ready to be cleaned up and sets the observer in an attachment mode if one is required.
virtual double altitude (const DtVector &geoPos)
 given a geocentric position find the altitude (estimate) above sea level
virtual DtVector surfaceAt (const DtVector &geoPos)
 determine the sea level position for a given position
virtual DtVector clampAltitude (const DtVector &geoPos)
 clamps the position to a max altitude
virtual DtVector bounce (double dt, DtVector start, DtVector end)
 Determine the amount of bounce give a start position, end position and the percentage between the two positions.
virtual double altitudeContrib ()
 Determine percentage contribution for looking down that should be added.
virtual double phase1Contrib (double t)
 Determine if the input time is within the first 10% of the animation.
virtual double phase3Contrib (double t)
 Determine if the input time is within the last 10% of the animation.
virtual double calculatePercentage (double s, double e, double t)
 Given a start,end and current time, determine the percentage through the animation.
virtual double calculateEasedPercent (double t)
 Take the raw percentage and get an eased percentage.

Protected Attributes

DtEasermyEaser
makVrv::DtDemyDe
makVrv::DtObservermyObserver
float mySmoothTime
bool myIsDone
DtObserverObject::AttachType myAttachType
bool myIsAttached
DtUniqueID myAttachedTo
DtUniqueID mySecondaryAttachedTo
DtVector myLocationTrackAttachment
DtVector myStartPosition
DtVector myPreviousPosition
DtVector myCurrentPosition
DtVector myEndPosition
DtVector myOffsetPosition
DtVector myUpVector
DtQuat myStartOrientation
DtQuat myCurrentOrientation
DtQuat myEndOrienation
DtQuat myOffsetOrientation
DtVector myTargetPosition
DtQuat myTargetOrientation
bool myIs2DObsMode
double myStartZoom
double myCurrentZoom
double myEndZoom
double myStartTime
double myCurrentTime
double myEndTime
double myTravelDistance
double myCurrentAltitude
bool myShouldUseVelocity
bool myShouldFaceEarth

Detailed Description

Encapsulates the process of animating an observer to a given location.

The animator will smoothly move the observer from it's current location to the new location over a user definable period. If the target location is a point attached to a simulated entity, then the observer will be moved to the entity and then attached to it.

Constructor & Destructor Documentation

makVrv::DtObserverAnimator::DtObserverAnimator ( DtDe de,
DtObserver obs,
DtVector  geocEndPos,
DtTaitBryan  geocEndOri,
double  endZoom,
float  smoothTime = 3.0f 
)

Constructor for movement to absolute position and rotation in that are passed in as geocentric coordinates.

makVrv::DtObserverAnimator::DtObserverAnimator ( DtDe de,
DtObserver obs,
DtVector  cigEndPos,
DtQuat  cigEndOri,
double  endZoom,
float  smoothTime = 3.0f 
)

Constructor for movement to absolute position rotation in IG space.

makVrv::DtObserverAnimator::DtObserverAnimator ( DtDe de,
DtObserver obs,
DtVector  relativeEndPos,
DtQuat  relativeEndOri,
double  endZoom,
DtUniqueID  attachedTo,
DtUniqueID  secondaryAttachedTo,
DtObserverObject::AttachType  attachedType,
float  smoothTime = 3.0f 
)

Constructor for movement to relative position and rotation while attached to an entity.

makVrv::DtObserverAnimator::DtObserverAnimator ( DtDe de,
DtObserver obs,
makArchives::DtObserverStateRecord rec,
float  smoothTime = 3.0f 
)

Constructor for animating to a saved view.

virtual makVrv::DtObserverAnimator::~DtObserverAnimator ( )
virtual

DTOR.

Member Function Documentation

virtual void makVrv::DtObserverAnimator::tick ( )
virtual

Called every frame by the DtInputDriver to update the observer.

virtual bool makVrv::DtObserverAnimator::isDone ( ) const
virtual

Is true when this animation is complete.

This is called by the DtInputDriver so that it can remove completed animations

virtual DtObserver* makVrv::DtObserverAnimator::observer ( ) const
virtual

Get the observer this animation is controlling.

virtual EntityInfo makVrv::DtObserverAnimator::entityInfo ( makVrv::DtDe de,
const std::string &  displayName 
)
protectedvirtual

lookup functions to find entity info based on a display name or DtUniqueID

virtual EntityInfo makVrv::DtObserverAnimator::entityInfo ( makVrv::DtDe de,
DtUniqueID  elementId 
)
protectedvirtual
virtual void makVrv::DtObserverAnimator::updateTargets ( )
protectedvirtual

updates the target orientation and position.

This needs to be called every frame in case the observer is moving to an attached mode on a moving entity

void makVrv::DtObserverAnimator::onInit ( )
protected
virtual void makVrv::DtObserverAnimator::updateObserver ( )
protectedvirtual

sets the observer's position, orientation, and zoom level based on how far through the animation it is

virtual DtVector makVrv::DtObserverAnimator::calcTargetPosition ( )
protectedvirtual

calculates the target position that we are trying to animate to.

Called by updateObserver()

virtual DtQuat makVrv::DtObserverAnimator::calcTargetOrientation ( )
protectedvirtual

calculates the target orientation that we are trying to animate to.

Called by updateObserver()

virtual void makVrv::DtObserverAnimator::calculateUpVector ( )
protectedvirtual

Calculates the up vector based on where in the world the observer is.

This is an estimation of up.

virtual void makVrv::DtObserverAnimator::interpolatePosition ( double  t)
protectedvirtual

Determines a new position using linear interpolation between start and end positions.

All calculations are done in geocentric space. If there is a large distance to travel, this will also introduce an altitude adjustment called bounce. Input time T is modified by an easing function so that starts and stops, especially over large distances (which will result in large velocities) are not jarring.

virtual void makVrv::DtObserverAnimator::interpolateOrientation ( double  t)
protectedvirtual

Determines the new orientation using spherical linear interpolation between start and end orientations.

All calculations are done using CIG quaternions. If there is a large distance to travel, this will orient to the direction of movement and if there is a large enough bounce to take the observer into orbit, this will orient the observer to the earth keeping good pixels on the screen at all times. Input time T is modified by an easing function so that starts and stops, especially over large distances (which will result in large velocities) are not jarring

virtual void makVrv::DtObserverAnimator::interpolateZoom ( double  t)
protectedvirtual

Determines the new zoom level based on linear interpolation between the start and stop zoom levels.

Input time T is modified by an easing function so that starts and stops, especially over large distances (which will result in large velocities) are not jarring

virtual void makVrv::DtObserverAnimator::finish ( )
protectedvirtual

this marks the observer as ready to be cleaned up and sets the observer in an attachment mode if one is required.

virtual double makVrv::DtObserverAnimator::altitude ( const DtVector geoPos)
protectedvirtual

given a geocentric position find the altitude (estimate) above sea level

virtual DtVector makVrv::DtObserverAnimator::surfaceAt ( const DtVector geoPos)
protectedvirtual

determine the sea level position for a given position

virtual DtVector makVrv::DtObserverAnimator::clampAltitude ( const DtVector geoPos)
protectedvirtual

clamps the position to a max altitude

virtual DtVector makVrv::DtObserverAnimator::bounce ( double  dt,
DtVector  start,
DtVector  end 
)
protectedvirtual

Determine the amount of bounce give a start position, end position and the percentage between the two positions.

virtual double makVrv::DtObserverAnimator::altitudeContrib ( )
protectedvirtual

Determine percentage contribution for looking down that should be added.

For extremely high observer positions this will return 1 causing the observer to face the earth

virtual double makVrv::DtObserverAnimator::phase1Contrib ( double  t)
protectedvirtual

Determine if the input time is within the first 10% of the animation.

This will cause the observer to orient to the velocity vector instead of the end orientation

virtual double makVrv::DtObserverAnimator::phase3Contrib ( double  t)
protectedvirtual

Determine if the input time is within the last 10% of the animation.

This will cause the observer to start to rotate to the desired position

virtual double makVrv::DtObserverAnimator::calculatePercentage ( double  s,
double  e,
double  t 
)
protectedvirtual

Given a start,end and current time, determine the percentage through the animation.

virtual double makVrv::DtObserverAnimator::calculateEasedPercent ( double  t)
protectedvirtual

Take the raw percentage and get an eased percentage.

This will reduce jarring at the beginning and ending of the animation

Member Data Documentation

DtEaser* makVrv::DtObserverAnimator::myEaser
protected
makVrv::DtDe& makVrv::DtObserverAnimator::myDe
protected
makVrv::DtObserver& makVrv::DtObserverAnimator::myObserver
protected
float makVrv::DtObserverAnimator::mySmoothTime
protected
bool makVrv::DtObserverAnimator::myIsDone
protected
DtObserverObject::AttachType makVrv::DtObserverAnimator::myAttachType
protected
bool makVrv::DtObserverAnimator::myIsAttached
protected
DtUniqueID makVrv::DtObserverAnimator::myAttachedTo
protected
DtUniqueID makVrv::DtObserverAnimator::mySecondaryAttachedTo
protected
DtVector makVrv::DtObserverAnimator::myLocationTrackAttachment
protected
DtVector makVrv::DtObserverAnimator::myStartPosition
protected
DtVector makVrv::DtObserverAnimator::myPreviousPosition
protected
DtVector makVrv::DtObserverAnimator::myCurrentPosition
protected
DtVector makVrv::DtObserverAnimator::myEndPosition
protected
DtVector makVrv::DtObserverAnimator::myOffsetPosition
protected
DtVector makVrv::DtObserverAnimator::myUpVector
protected
DtQuat makVrv::DtObserverAnimator::myStartOrientation
protected
DtQuat makVrv::DtObserverAnimator::myCurrentOrientation
protected
DtQuat makVrv::DtObserverAnimator::myEndOrienation
protected
DtQuat makVrv::DtObserverAnimator::myOffsetOrientation
protected
DtVector makVrv::DtObserverAnimator::myTargetPosition
protected
DtQuat makVrv::DtObserverAnimator::myTargetOrientation
protected
bool makVrv::DtObserverAnimator::myIs2DObsMode
protected
double makVrv::DtObserverAnimator::myStartZoom
protected
double makVrv::DtObserverAnimator::myCurrentZoom
protected
double makVrv::DtObserverAnimator::myEndZoom
protected
double makVrv::DtObserverAnimator::myStartTime
protected
double makVrv::DtObserverAnimator::myCurrentTime
protected
double makVrv::DtObserverAnimator::myEndTime
protected
double makVrv::DtObserverAnimator::myTravelDistance
protected
double makVrv::DtObserverAnimator::myCurrentAltitude
protected
bool makVrv::DtObserverAnimator::myShouldUseVelocity
protected
bool makVrv::DtObserverAnimator::myShouldFaceEarth
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)