![]() |
VR-Forces 4.0.4 Class Documentation
|
DtGroundClampingUpdater is an 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...

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, bool doNotAddToMgr=false) | |
| CTOR. | |
| virtual | ~DtGroundClampingUpdater () |
| DTOR. | |
| virtual void | update (double simTime) |
| Calls doGroundClamp() followed by updateSceneObject() | |
| virtual void | setPosition (const DtVector &position) |
| Set the object's position (assumes origin, or, index 0) | |
| virtual void | setOrientation (const DtTaitBryan &ori) |
| Set the object's orientation (assumes origin, or, index 0) | |
| virtual void | setPosition (int index, const DtVector &) |
| Sets the position at the specified index. | |
| virtual void | setOrientation (int index, const DtTaitBryan &) |
| Sets the orienation at the specified index. | |
| virtual void | removeSpatial (int) |
| Removes position and orientation at specified index. | |
| virtual void | resetToUnclamped () |
| Resets all to unclamped positions. | |
| 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 bool | doGroundClamp () |
| do the actual clamping. | |
| virtual void | setClampTimeThreshold (double) |
| Sets the threshold for ground clamping by sim time. | |
Protected Types | |
| typedef std::vector< DtVector > | Positions |
| typedef std::vector< DtTaitBryan > | Orientations |
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. | |
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 | |
| Positions | myLastUnclampedPositions |
| Orientations | myLastUnclampedOrientations |
| Positions | myUnclampedPositions |
| Orientations | myUnclampedOrientations |
| 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. | |
| DtIntersectionCache * | myIntersectionCache |
| 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 |
Static Protected Attributes | |
| static const double | theClampTimeThreshold |
| static const double | theMaxCacheInterval |
| static const double | theClampDistThreshold |
| static const double | theClampOrientThreshold |
| static const double | theIsectLength |
DtGroundClampingUpdater is an 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.
typedef std::vector<DtVector> makVrv::DtGroundClampingUpdater::Positions [protected] |
typedef std::vector<DtTaitBryan> makVrv::DtGroundClampingUpdater::Orientations [protected] |
| makVrv::DtGroundClampingUpdater::DtGroundClampingUpdater | ( | DtDe & | de, |
| DtUniqueID | id, | ||
| bool | doNotAddToMgr = false |
||
| ) |
CTOR.
| virtual makVrv::DtGroundClampingUpdater::~DtGroundClampingUpdater | ( | ) | [virtual] |
DTOR.
| virtual void makVrv::DtGroundClampingUpdater::update | ( | double | simTime | ) | [virtual] |
Calls doGroundClamp() followed by updateSceneObject()
Implements makVrv::DtUpdater.
| virtual void makVrv::DtGroundClampingUpdater::setPosition | ( | const DtVector & | position | ) | [virtual] |
Set the object's position (assumes origin, or, index 0)
| virtual void makVrv::DtGroundClampingUpdater::setOrientation | ( | const DtTaitBryan & | ori | ) | [virtual] |
Set the object's orientation (assumes origin, or, index 0)
| virtual void makVrv::DtGroundClampingUpdater::setPosition | ( | int | index, |
| const DtVector & | |||
| ) | [virtual] |
Sets the position at the specified index.
Will resize array if index is greater than current array size
| virtual void makVrv::DtGroundClampingUpdater::setOrientation | ( | int | index, |
| const DtTaitBryan & | |||
| ) | [virtual] |
Sets the orienation at the specified index.
Will resize array if index is greater than current array size
| virtual void makVrv::DtGroundClampingUpdater::removeSpatial | ( | int | ) | [virtual] |
Removes position and orientation at specified index.
| virtual void makVrv::DtGroundClampingUpdater::resetToUnclamped | ( | ) | [virtual] |
Resets all to unclamped positions.
| 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.
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 bool makVrv::DtGroundClampingUpdater::doGroundClamp | ( | ) | [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 | ||
| ) | [static, protected] |
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.
| static double makVrv::DtGroundClampingUpdater::angleDifference | ( | double | prev, |
| double | curr | ||
| ) | [static, protected] |
compensating for rollover issues
const double makVrv::DtGroundClampingUpdater::theClampTimeThreshold [static, protected] |
const double makVrv::DtGroundClampingUpdater::theMaxCacheInterval [static, protected] |
const double makVrv::DtGroundClampingUpdater::theClampDistThreshold [static, protected] |
const double makVrv::DtGroundClampingUpdater::theClampOrientThreshold [static, protected] |
const double makVrv::DtGroundClampingUpdater::theIsectLength [static, 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.
The type of clamping this updater is doing.
Ground clamping optimization variables.
bool makVrv::DtGroundClampingUpdater::myEnabledFlag [protected] |
Ground clamping state.
Always clamp regardless of time.
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] |