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

DtGroundClampingUpdater is a scene object updater that is given a position and orientation, and depending on how it is configured, updates a scene object with a position and orientation that are clamped to the underlying terrain. More...

Inheritance diagram for makVrv::DtGroundClampingUpdater:
Inheritance graph
[legend]

Public Types

enum  GroundClampingMode {
  ClampNone = 0, ClampOrientation = 1, ClampPosition = 2, ClampUpright = 4,
  ClampOrientationAndPosition = ClampOrientation | ClampPosition, ClampOrientationAndUpright = ClampOrientation | ClampUpright, ClampPositionAndUpright = ClampPosition | ClampUpright, ClampAll = ClampOrientation | ClampPosition | ClampUpright
}
 Ground Clamping Modes. More...

Public Member Functions

 DtGroundClampingUpdater (DtDe &de, DtUniqueID id)
 CTOR.
virtual ~DtGroundClampingUpdater ()
 DTOR.
virtual void update (DtTime tNow)
 Calls doGroundClamp()
virtual void setEnabled (bool enabled)
 Set whether this updater is enabled.
virtual void setMode (GroundClampingMode mode)
 Set the type of ground clamping to do.
bool isClamping () const
 Determine if clamping is enabled, we're close enough, etc.
bool isClampingUp () const
 Check to see if the mode supports clamping up.
bool isClampingOrientation () const
 Check to see if the mode supports clamping orientation.
bool isClampingPosition () const
 Check to see if the mode supports clamping position.
virtual void setCullCylinderRadiusScale (float scale)
 Set the scale multiplier used to determine whether or not to cull the target according to its distance from the eye-point.
virtual void setClampAlways (bool enabled)
 When enabled, this causes clamping every frame (use judiciously)
virtual void setCheckForCulling (bool)
 When enabled check for object culling.
virtual void doGroundClamp (DtTime tNow)
 do the actual clamping.
virtual void setClampTimeThreshold (double)
 Sets the threshold for ground clamping by sim time.
- Public Member Functions inherited from makVrv::DtSceneObjectUpdater
 DtSceneObjectUpdater (DtDe &de, DtUniqueID id)
 CTOR.
virtual ~DtSceneObjectUpdater ()
 Virtual DTOR.
virtual void setNextUpdater (DtSceneObjectUpdater *nextUpdater)
 Set the next updater in the updater chain.
virtual void setPrevUpdater (DtSceneObjectUpdater *prevUpdater)
 Set the previous updater in the updater chain.
virtual bool needsUpdate (DtTime tNow)
 The check function called by DtTickableManager to verify if an update is required.
virtual void setVertexToUpdate (unsigned int vertex)
 Specify which vertex in the scene object this updater updates.
virtual void setInputPosition (const DtVector &position)
 Set the position input to this updater.
virtual void setInputOrientation (const DtTaitBryan &orientation)
 Set the orientation input to this updater.
virtual void setOutputPosition (const DtVector &position)
 Output the resultant position.
virtual void setOutputOrientation (const DtTaitBryan &orientation)
 Output the resultant orientation.
virtual DtTime lastUpdateTime () const
 Get the time-stamp of the last update.
virtual void setSceneObject (DtSceneObject *sceneObject)
 Set the scene object to be updated.
DtUniqueID uniqueId () const
 Returns the distributed object id of this updater.
DtSceneObjectUpdaterfindNextUpdater () const
 Return the next updater in the updater chain.
DtSceneObjectUpdaterfindPrevUpdater () const
 Return the previous updater in the updater chain.
DtSceneObjectfindSceneObject ()
 Get the current scene object for this updater.
DtSceneObject *const findSceneObject () const
 const correct version
- Public Member Functions inherited from makVrv::DtTickable
virtual ~DtTickable ()
 Virtual DTOR.
virtual void setUpdatePeriod (unsigned int period)
 Specify how often (in # of frames) this tickable should call update.
virtual unsigned int updatePeriod () const

Protected Member Functions

bool computeGroundClampingHit (const DtVector &up, const DtVector &unclampedPosition, DtVector &hitLocation, DtVector &hitNormal)
 Compute the location and normal ground clamping hit for the current position returns true if a hit was achieved.
void computeIntersectionOrigin (const DtVector &up, const DtVector &unclampedPosition, DtVector &origin) const
 Get the position to use as object origin when ground clamping.
bool needClampThisTick () const
 Determine if we need to clamp this tick, or can use the last clamp.
bool targetIsMoving (const DtVector &newPos, const DtVector &lastPos) const
 Determine if our position has changed since the last time we were clamped.
bool targetIsTurning (const DtTaitBryan &newOri, const DtTaitBryan &lastOri) const
 Determine if our orientation has changed since the last time we were clamped.
bool checkCulling (const DtVector &up) const
 Check to see if the object is culled.
void clampToWater (DtTime tNow)
- Protected Member Functions inherited from makVrv::DtSceneObjectUpdater
virtual void slot_sceneObjectToBeDeleted (const DtUniqueID &id)
- Protected Member Functions inherited from makVrv::DtTickable
 DtTickable (DtTickableManagerInterface *manager)
 CTOR.
 DtTickable ()
 Unimplemented default CTOR.
virtual void slot_managerAboutToBeDeleted ()

Static Protected Member Functions

static void computePerpendicularRotation (const DtVector &pos, const DtVector &hitNormal, const DtTaitBryan &orientation, DtTaitBryan &output)
 Find an orientation perpendicular to the normal vector.
static double angleDifference (double prev, double curr)
 compensating for rollover issues

Protected Attributes

bool myHaveLastClampedPosition
bool myHaveLastClampedOrientation
DtVector myLastClampedPosition
DtTaitBryan myLastClampedOrientation
DtVector myUnclampedPosition
DtTaitBryan myUnclampedOrientation
DtVector myLastUnclampedPosition
DtTaitBryan myLastUnclampedOrientation
double myLastCacheUpdateTime
double myLastClampTime
float myCullCylinderScale
 Object is not ground clamped if the camera is farther away than this times the object's bounding radius.
GroundClampingMode myMode
 The type of clamping this updater is doing.
DtIntersectionCachemyIntersectionCache
 Ground clamping optimization variables.
bool myEnabledFlag
 Ground clamping state.
bool myClampAlwaysFlag
 Always clamp regardless of time.
bool myClampCulledLastFrame
 Was the unclamped position outside the cull cylinder last frame.
bool myCheckForCull
 Whether or not to check to see if object is culled. Default is true.
double myClampTimeThreshold
bool myBecameEnabledThisTick
- Protected Attributes inherited from makVrv::DtSceneObjectUpdater
DtDemyDe
 The display engine.
DtUniqueID myUniqueId
 This distributed object's unique identifier.
DtSceneObjectmySceneObject
 A pointer to the current scene object being updated.
DtTime myLastUpdateTime
 The last time stamp when the update()
DtSceneObjectUpdatermyNextUpdater
 The next updater in the chain (or NULL)
DtSceneObjectUpdatermyPrevUpdater
 The previous updater in the chain (or NULL)
unsigned int myVertexToUpdate
 The default scene object vertex to update.
DtVector myInputPosition
 Input position.
DtTaitBryan myInputOrientation
 Input Orientation.
bool myPositionDataOutputted
 Flag to indicate if setOutputPosition has been called this tick.
bool myOrientationDataOutputted
 Flag to indicate if setOutputOrientation has been called this tick.
- Protected Attributes inherited from makVrv::DtTickable
DtTickableManagerInterfacemyManager
 Pointer to manager for removal during destruction.
DtSignalConnectionManager myConnections
unsigned int myFrameCounter
unsigned int myFrameToUpdate
unsigned int myUpdatePeriod

Static Protected Attributes

static const double theClampTimeThreshold
static const double theMaxCacheInterval
static const double theClampDistThreshold
static const double theClampOrientThreshold
static const double theIsectLength

Additional Inherited Members

- Public Attributes inherited from makVrv::DtSceneObjectUpdater
boost::signal< void(const
DtUniqueID &) > 
signal_updaterToBeDeleted

Detailed Description

DtGroundClampingUpdater is a scene object updater that is given a position and orientation, and depending on how it is configured, updates a scene object with a position and orientation that are clamped to the underlying terrain.

Member Enumeration Documentation

Ground Clamping Modes.

Enumerator:
ClampNone 
ClampOrientation 
ClampPosition 
ClampUpright 
ClampOrientationAndPosition 
ClampOrientationAndUpright 
ClampPositionAndUpright 
ClampAll 

Constructor & Destructor Documentation

makVrv::DtGroundClampingUpdater::DtGroundClampingUpdater ( DtDe de,
DtUniqueID  id 
)

CTOR.

virtual makVrv::DtGroundClampingUpdater::~DtGroundClampingUpdater ( )
virtual

DTOR.

Member Function Documentation

virtual void makVrv::DtGroundClampingUpdater::update ( DtTime  tNow)
virtual

Calls doGroundClamp()

Reimplemented from makVrv::DtSceneObjectUpdater.

virtual void makVrv::DtGroundClampingUpdater::setEnabled ( bool  enabled)
virtual

Set whether this updater is enabled.

A disabled updater will not ground clamp.

virtual void makVrv::DtGroundClampingUpdater::setMode ( GroundClampingMode  mode)
virtual

Set the type of ground clamping to do.

bool makVrv::DtGroundClampingUpdater::isClamping ( ) const

Determine if clamping is enabled, we're close enough, etc.

bool makVrv::DtGroundClampingUpdater::isClampingUp ( ) const
inline

Check to see if the mode supports clamping up.

bool makVrv::DtGroundClampingUpdater::isClampingOrientation ( ) const
inline

Check to see if the mode supports clamping orientation.

bool makVrv::DtGroundClampingUpdater::isClampingPosition ( ) const
inline

Check to see if the mode supports clamping position.

virtual void makVrv::DtGroundClampingUpdater::setCullCylinderRadiusScale ( float  scale)
virtual

Set the scale multiplier used to determine whether or not to cull the target according to its distance from the eye-point.

Calculates a cylinder with radius equal to the target's bounding radius multiplied by the scale factor and infinite length, oriented along the local up vector. If the eye-point is outside of that cylinder, the target will not be ground clamped.

virtual void makVrv::DtGroundClampingUpdater::setClampAlways ( bool  enabled)
virtual

When enabled, this causes clamping every frame (use judiciously)

virtual void makVrv::DtGroundClampingUpdater::setCheckForCulling ( bool  )
virtual

When enabled check for object culling.

virtual void makVrv::DtGroundClampingUpdater::doGroundClamp ( DtTime  tNow)
virtual

do the actual clamping.

Called by update() Returns true if the object was ground clamped.

virtual void makVrv::DtGroundClampingUpdater::setClampTimeThreshold ( double  )
virtual

Sets the threshold for ground clamping by sim time.

Any number < 0 will prevent updating based purely on simtime only. Default is 3 seconds. Set time in seconds

static void makVrv::DtGroundClampingUpdater::computePerpendicularRotation ( const DtVector pos,
const DtVector hitNormal,
const DtTaitBryan &  orientation,
DtTaitBryan &  output 
)
staticprotected

Find an orientation perpendicular to the normal vector.

bool makVrv::DtGroundClampingUpdater::computeGroundClampingHit ( const DtVector up,
const DtVector unclampedPosition,
DtVector hitLocation,
DtVector hitNormal 
)
protected

Compute the location and normal ground clamping hit for the current position returns true if a hit was achieved.

void makVrv::DtGroundClampingUpdater::computeIntersectionOrigin ( const DtVector up,
const DtVector unclampedPosition,
DtVector origin 
) const
protected

Get the position to use as object origin when ground clamping.

bool makVrv::DtGroundClampingUpdater::needClampThisTick ( ) const
protected

Determine if we need to clamp this tick, or can use the last clamp.

bool makVrv::DtGroundClampingUpdater::targetIsMoving ( const DtVector newPos,
const DtVector lastPos 
) const
protected

Determine if our position has changed since the last time we were clamped.

bool makVrv::DtGroundClampingUpdater::targetIsTurning ( const DtTaitBryan &  newOri,
const DtTaitBryan &  lastOri 
) const
protected

Determine if our orientation has changed since the last time we were clamped.

bool makVrv::DtGroundClampingUpdater::checkCulling ( const DtVector up) const
protected

Check to see if the object is culled.

void makVrv::DtGroundClampingUpdater::clampToWater ( DtTime  tNow)
protected
static double makVrv::DtGroundClampingUpdater::angleDifference ( double  prev,
double  curr 
)
staticprotected

compensating for rollover issues

Member Data Documentation

const double makVrv::DtGroundClampingUpdater::theClampTimeThreshold
staticprotected
const double makVrv::DtGroundClampingUpdater::theMaxCacheInterval
staticprotected
const double makVrv::DtGroundClampingUpdater::theClampDistThreshold
staticprotected
const double makVrv::DtGroundClampingUpdater::theClampOrientThreshold
staticprotected
const double makVrv::DtGroundClampingUpdater::theIsectLength
staticprotected
bool makVrv::DtGroundClampingUpdater::myHaveLastClampedPosition
protected
bool makVrv::DtGroundClampingUpdater::myHaveLastClampedOrientation
protected
DtVector makVrv::DtGroundClampingUpdater::myLastClampedPosition
protected
DtTaitBryan makVrv::DtGroundClampingUpdater::myLastClampedOrientation
protected
DtVector makVrv::DtGroundClampingUpdater::myUnclampedPosition
protected
DtTaitBryan makVrv::DtGroundClampingUpdater::myUnclampedOrientation
protected
DtVector makVrv::DtGroundClampingUpdater::myLastUnclampedPosition
protected
DtTaitBryan makVrv::DtGroundClampingUpdater::myLastUnclampedOrientation
protected
double makVrv::DtGroundClampingUpdater::myLastCacheUpdateTime
protected
double makVrv::DtGroundClampingUpdater::myLastClampTime
protected
float makVrv::DtGroundClampingUpdater::myCullCylinderScale
protected

Object is not ground clamped if the camera is farther away than this times the object's bounding radius.

GroundClampingMode makVrv::DtGroundClampingUpdater::myMode
protected

The type of clamping this updater is doing.

DtIntersectionCache* makVrv::DtGroundClampingUpdater::myIntersectionCache
protected

Ground clamping optimization variables.

bool makVrv::DtGroundClampingUpdater::myEnabledFlag
protected

Ground clamping state.

bool makVrv::DtGroundClampingUpdater::myClampAlwaysFlag
protected

Always clamp regardless of time.

bool makVrv::DtGroundClampingUpdater::myClampCulledLastFrame
protected

Was the unclamped position outside the cull cylinder last frame.

bool makVrv::DtGroundClampingUpdater::myCheckForCull
protected

Whether or not to check to see if object is culled. Default is true.

double makVrv::DtGroundClampingUpdater::myClampTimeThreshold
protected
bool makVrv::DtGroundClampingUpdater::myBecameEnabledThisTick
protected

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

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)