VR-Forces 5.0.2 Developer's Guide
 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. 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.

Classes

struct  EntityInfo
 

Public Member Functions

 DtObserverAnimator (DtDe &de, DtObserver &obs, DtVector geocEndPos, DtTaitBryan geocEndOri, double endZoom, float smoothTime=3.0f)
 
 DtObserverAnimator (DtDe &de, DtObserver &obs, DtVector cigEndPos, DtQuat cigEndOri, double endZoom, float smoothTime=3.0f)
 
 DtObserverAnimator (DtDe &de, DtObserver &obs, DtVector relativeEndPos, DtQuat relativeEndOri, double endZoom, DtUniqueID attachedTo, DtUniqueID secondaryAttachedTo, DtObserverObject::AttachType attachedType, float smoothTime=3.0f)
 
 DtObserverAnimator (DtDe &de, DtObserver &obs, makArchives::DtObserverStateRecord &rec, float smoothTime=3.0f)
 
virtual ~DtObserverAnimator ()
 
virtual void tick ()
 
virtual bool isDone () const
 
virtual DtObserverobserver () const
 

Protected Member Functions

virtual EntityInfo entityInfo (makVrv::DtDe &de, const std::string &displayName)
 
virtual EntityInfo entityInfo (makVrv::DtDe &de, DtUniqueID elementId)
 
virtual void updateTargets ()
 
void onInit ()
 
virtual void updateObserver ()
 
virtual DtVector calcTargetPosition ()
 
virtual DtQuat calcTargetOrientation ()
 
virtual void calculateUpVector ()
 
virtual void interpolatePosition (double t)
 
virtual void interpolateOrientation (double t)
 
virtual void interpolateZoom (double t)
 
virtual void finish ()
 
virtual void slot_coordinateSystemChanged ()
 
virtual double altitude (const DtVector &geoPos)
 
virtual DtVector surfaceAt (const DtVector &geoPos)
 
virtual DtVector clampAltitude (const DtVector &geoPos)
 
virtual DtVector bounce (double dt, DtVector start, DtVector end)
 
virtual double altitudeContrib ()
 
virtual double phase1Contrib (double t)
 
virtual double phase3Contrib (double t)
 
virtual double calculatePercentage (double s, double e, double t)
 
virtual double calculateEasedPercent (double t)
 
void initCoordinateSystem ()
 

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
 
DtSignalConnectionManager myConnections
 
DtCoordinateSystemmyCoordinateSystem = nullptr
 

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 void makVrv::DtObserverAnimator::slot_coordinateSystemChanged ( )
protectedvirtual

slot for when the coordinate system changes

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.

void makVrv::DtObserverAnimator::initCoordinateSystem ( )
protected

purposely not virtual. called from each of the 3 constructors

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
DtSignalConnectionManager makVrv::DtObserverAnimator::myConnections
protected
DtCoordinateSystem* makVrv::DtObserverAnimator::myCoordinateSystem = nullptr
protected

local clone of the system wide coordinate system. for thread safety.


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

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)