dtGame::GroundClamper Class Reference

This is a utility class for doing ground clamping. More...

#include <groundclamper.h>

List of all members.

Public Member Functions

 GroundClamper ()
virtual ~GroundClamper ()
dtCore::TransformableGetTerrainActor ()
 
Returns:
the terrain actor using the given name. If it has not yet been queried, the query will run when this is called.

const dtCore::TransformableGetTerrainActor () const
 
Returns:
the terrain actor using the given name. If it has not yet been queried, the query will run when this is called.

void SetTerrainActor (dtCore::Transformable *newTerrain)
 changes the actor to use for the terrain.
void UpdateEyePoint ()
 Caches the eyepoint from the eye point actor. This MUST be called each frame before clamping.
const osg::Vec3 & GetLastEyePoint () const
dtCore::TransformableGetEyePointActor ()
 
Returns:
the actor to use as an eye point for ground clamping. This determines which LOD to clamp to.

const dtCore::TransformableGetEyePointActor () const
 
Returns:
the actor to use as an eye point for ground clamping. This determines which LOD to clamp to.

void SetEyePointActor (dtCore::Transformable *newEyePointActor)
 changes the actor to use for the terrain.
void SetHighResGroundClampingRange (float range)
 Sets the maximum distance from the player that three intersection point clamping will be used.
float GetHighResGroundClampingRange () const
 
Returns:
the maximum distance from the player that three intersection point clamping will be used.

void SetLowResGroundClampingRange (float range)
 Sets the maximum distance from the player that three intersection point clamping will be used.
float GetLowResGroundClampingRange () const
 
Returns:
the maximum distance from the player that three intersection point clamping will be used.

void SetIntermittentGroundClampingTimeDelta (float newDelta)
 Sets the delta time between clamping when clamping in intermittent mode.
float GetIntermittentGroundClampingTimeDelta () const
 
Returns:
the delta time between clamping when clamping in intermittent mode.

void SetIntermittentGroundClampingSmoothingTime (float newTime)
 Sets the smoothing time between offsets when clamping in intermittent mode.
float GetIntermittentGroundClampingSmoothingTime () const
 
Returns:
the smoothing time between offsets when clamping in intermittent mode.

void CalculateAndSetBoundingBox (osg::Vec3 &modelDimensions, dtGame::GameActorProxy &gameActorProxy, GroundClampingData &data)
 Calculates the bounding box for the given proxy, stores it in the data object, and populates the Vec3.
bool GetClosestHit (dtCore::BatchIsector::SingleISector &single, float pointz, osg::Vec3 &hit, osg::Vec3 &normal)
 Gets the ground clamping hit that is closest to the deadreckoned z value.
void ClampToGround (GroundClampingType &type, double currentTime, dtCore::Transform &xform, dtGame::GameActorProxy &gameActorProxy, GroundClampingData &data)
 Clamps an actor to the ground.
void ClampToGroundThreePoint (dtCore::Transform &xform, dtGame::GameActorProxy &gameActorProxy, GroundClampingData &data)
 Version of clamping that uses three intersection points to calculate the height and the rotation.
void ClampToGroundIntermittent (double currentTime, dtCore::Transform &xform, dtGame::GameActorProxy &gameActorProxy, GroundClampingData &data)
 Clamps an actor to the ground by running an intersection query occasionally and saving the offset.
void RunClampBatch ()
 This should be called manually at the end an group of ground clamping calls.
dtCore::BatchIsectorGetGroundClampIsector ()

Classes

class  GroundClampingType


Detailed Description

This is a utility class for doing ground clamping.

Constructor & Destructor Documentation

dtGame::GroundClamper::GroundClamper (  ) 

dtGame::GroundClamper::~GroundClamper (  )  [virtual]


Member Function Documentation

dtCore::Transformable* dtGame::GroundClamper::GetTerrainActor (  )  [inline]

Returns:
the terrain actor using the given name. If it has not yet been queried, the query will run when this is called.

const dtCore::Transformable* dtGame::GroundClamper::GetTerrainActor (  )  const [inline]

Returns:
the terrain actor using the given name. If it has not yet been queried, the query will run when this is called.

void dtGame::GroundClamper::SetTerrainActor ( dtCore::Transformable newTerrain  ) 

changes the actor to use for the terrain.

void dtGame::GroundClamper::UpdateEyePoint (  ) 

Caches the eyepoint from the eye point actor. This MUST be called each frame before clamping.

const osg::Vec3& dtGame::GroundClamper::GetLastEyePoint (  )  const [inline]

dtCore::Transformable* dtGame::GroundClamper::GetEyePointActor (  )  [inline]

Returns:
the actor to use as an eye point for ground clamping. This determines which LOD to clamp to.

const dtCore::Transformable* dtGame::GroundClamper::GetEyePointActor (  )  const [inline]

Returns:
the actor to use as an eye point for ground clamping. This determines which LOD to clamp to.

void dtGame::GroundClamper::SetEyePointActor ( dtCore::Transformable newEyePointActor  ) 

changes the actor to use for the terrain.

void dtGame::GroundClamper::SetHighResGroundClampingRange ( float  range  ) 

Sets the maximum distance from the player that three intersection point clamping will be used.

After this, one intersection will be used. < 0 means don't do high res.

float dtGame::GroundClamper::GetHighResGroundClampingRange (  )  const [inline]

Returns:
the maximum distance from the player that three intersection point clamping will be used.

void dtGame::GroundClamper::SetLowResGroundClampingRange ( float  range  ) 

Sets the maximum distance from the player that three intersection point clamping will be used.

After this, one intersection will be used. < 0 means don't do low res.

float dtGame::GroundClamper::GetLowResGroundClampingRange (  )  const [inline]

Returns:
the maximum distance from the player that three intersection point clamping will be used.

void dtGame::GroundClamper::SetIntermittentGroundClampingTimeDelta ( float  newDelta  )  [inline]

Sets the delta time between clamping when clamping in intermittent mode.

float dtGame::GroundClamper::GetIntermittentGroundClampingTimeDelta (  )  const [inline]

Returns:
the delta time between clamping when clamping in intermittent mode.

void dtGame::GroundClamper::SetIntermittentGroundClampingSmoothingTime ( float  newTime  )  [inline]

Sets the smoothing time between offsets when clamping in intermittent mode.

float dtGame::GroundClamper::GetIntermittentGroundClampingSmoothingTime (  )  const [inline]

Returns:
the smoothing time between offsets when clamping in intermittent mode.

void dtGame::GroundClamper::CalculateAndSetBoundingBox ( osg::Vec3 &  modelDimensions,
dtGame::GameActorProxy gameActorProxy,
GroundClampingData data 
)

Calculates the bounding box for the given proxy, stores it in the data object, and populates the Vec3.

bool dtGame::GroundClamper::GetClosestHit ( dtCore::BatchIsector::SingleISector single,
float  pointz,
osg::Vec3 &  hit,
osg::Vec3 &  normal 
)

Gets the ground clamping hit that is closest to the deadreckoned z value.

void dtGame::GroundClamper::ClampToGround ( GroundClamper::GroundClampingType type,
double  currentTime,
dtCore::Transform xform,
dtGame::GameActorProxy gameActorProxy,
GroundClampingData data 
)

Clamps an actor to the ground.

It will pick, based on the type and eye point which algorithm to Use.

Parameters:
type the ground clamping type to perform.
currentTime the current simulation time. Used for intermittent gc.
xform the current absolute transform of the actor.
gameActorProxy the actual actor. This is passed case collision geometry is needed.
helper the deadreckoning helper for the actor

void dtGame::GroundClamper::ClampToGroundThreePoint ( dtCore::Transform xform,
dtGame::GameActorProxy gameActorProxy,
GroundClampingData data 
)

Version of clamping that uses three intersection points to calculate the height and the rotation.

void dtGame::GroundClamper::ClampToGroundIntermittent ( double  currentTime,
dtCore::Transform xform,
dtGame::GameActorProxy gameActorProxy,
GroundClampingData data 
)

Clamps an actor to the ground by running an intersection query occasionally and saving the offset.

Parameters:
currentTime the current simulation time.
xform the current absolute transform of the actor.
gameActorProxy the actual actor. This is passed case collision geometry is needed.
helper the deadreckoning helper for the actor

void dtGame::GroundClamper::RunClampBatch (  ) 

This should be called manually at the end an group of ground clamping calls.

It will go through any remaining ground clamping queries and run them in a batch. This is normally called when the number queued reaches a threshold, but in most cases some are left waiting at the end of a group of calls.

dtCore::BatchIsector & dtGame::GroundClamper::GetGroundClampIsector (  ) 


http://www.delta3d.org
2.0.0 generated 14 Feb 2008