VR-Forces 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 Types | Protected Member Functions | Protected Attributes
makVrv::DtSceneObjectUpdater Class Reference

Scene Object Updater.

DtSceneObjectUpdater is a distributed object managed by DtTickableManager. It provides an API and infrastructure used by deriving objects to update the position and orientation of scene objects in render space. DtSceneObjectUpdaters may be chained together in a list to perform multiple position and/or orientation transformations. For example, one updater might dead reckon position and orientation based on kinematic info, the next in the chain could ground clamp the object. A third might adjust the ground clamped position to support terrain scaling.

02/23/2020 - Added support for determine whether an updater chain should be placed on the threaded or unthreaded DtTickableManager tickable list

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

Classes

struct  AdaptiveTickRateLODParams
 

Public Member Functions

 DtSceneObjectUpdater (DtDe &de, DtUniqueID id)
 
virtual ~DtSceneObjectUpdater ()
 
virtual void setNextUpdater (DtSceneObjectUpdater *nextUpdater)
 
virtual void setPrevUpdater (DtSceneObjectUpdater *prevUpdater)
 
virtual bool needsUpdate (DtTime tNow)
 
virtual void update (DtTime tNow)
 
virtual void updateAdaptiveTickrate (const DtVector &lastPos, const DtTime &deltaTime)
 
virtual void setVertexToUpdate (unsigned int vertex)
 
virtual void setInputPosition (const DtVector &position)
 
virtual void setInputOrientation (const DtTaitBryan &orientation)
 
virtual void setOutputPosition (const DtVector &position)
 
virtual DtVector outputPosition () const
 
virtual void setOutputOrientation (const DtTaitBryan &orientation)
 
virtual DtTaitBryan outputOrientation () const
 
virtual void setOutputPositionAndOrientation (const DtVector &position, const DtTaitBryan &orientation)
 
virtual DtTime lastUpdateTime () const
 
virtual void setSceneObject (DtSceneObject *sceneObject, bool addToTickableMgrIfHead)
 
virtual void setSceneObject (DtSceneObject *sceneObject)
 
DtUniqueID uniqueId () const
 
DtSceneObjectUpdaterfindNextUpdater () const
 
DtSceneObjectUpdaterfindPrevUpdater () const
 
virtual bool isChainThreadSafe (DtSceneObjectUpdater *firstUpdater)
 
virtual DtSceneObjectUpdaterchainHead ()
 
virtual void setIsThreadSafe (bool safe)
 
virtual void setTickableEnabled (bool enabled) override
 
virtual void setAdaptiveTickLodEnabled (bool enabled)
 
virtual bool adaptiveTickLodEnabled () const override
 
virtual void setLodScaleSpeedFactor (float factor)
 
virtual float lodScaleSpeedFactor () const
 
virtual void setLodRadiusStart (float ratius)
 
virtual float lodRadiusStart () const
 
virtual void setLodRadiusEnd (float ratius)
 
virtual float lodRadiusEnd () const
 
virtual void setNearLodUpdateRate (int nearRate)
 
virtual int nearLodUpdateRate () const
 
virtual void setFarLodUpdateRate (int maxRate)
 
virtual int farLodUpdateRate () const
 
DtSceneObjectfindActiveSceneObject ()
 
DtSceneObject *const findActiveSceneObject () const
 
DtSceneObjectfindSceneObjectForModelSet (DtModelSetId modelSet)
 
DtSceneObject *const findSceneObjectForModelSet (DtModelSetId modelSet) const
 
virtual void addSceneObjectToUpdate (DtModelSetId modelSet, DtSceneObject *sceneObject, bool addToTickableMgrIfHead=true)
 
virtual void removeSceneObjectToUpdate (DtModelSetId modelSet, DtSceneObject *sceneObject)
 
virtual void addSceneObjectToUpdateAtChainEnd (DtModelSetId modelSet, DtSceneObject *sceneObject, bool addToTickableMgrIfHead=true)
 
virtual void removeSceneObjectToUpdateAtChainEnd (DtModelSetId modelSet, DtSceneObject *sceneObject)
 
- Public Member Functions inherited from makVrv::DtTickable
virtual bool updateIfNeeded (DtTime tNow)
 
virtual ~DtTickable ()
 
virtual bool isThreadSafe () const
 
virtual void setTickableListState (TickableListState safeList)
 
virtual TickableListState tickableListState () const
 
virtual void setUpdatePeriod (unsigned int period)
 
virtual unsigned int updatePeriod () const
 

Public Attributes

Signals

Signal that this updater is being destroyed

boost::signalslib::signal
< void(const DtUniqueID &) > 
signal_updaterToBeDeleted
 

Protected Types

using ModelSetToSceneObjectMap = std::unordered_map< DtModelSetId, DtSceneObject * >
 
using SceneObjectConnectionsMap = std::unordered_map< DtUniqueID, boost::signalslib::connection >
 

Protected Member Functions

virtual void removeThreadSafeChainFromManager (DtSceneObjectUpdater *head)
 
virtual void removeUnThreadSafeChainFromManager (DtSceneObjectUpdater *head)
 
virtual void addThreadSafeChainToManager (DtSceneObjectUpdater *head)
 
virtual void addUnThreadSafeChainToManager (DtSceneObjectUpdater *head)
 
virtual void placeChainOnCorrectTickableList (DtSceneObjectUpdater *head)
 
Slots

Slot called when the a scene object is to be deleted. If its the scene object that this updater is updating, then the local scene object copy is set to false

virtual void slot_sceneObjectToBeDeleted (const DtUniqueID &id)
 
- Protected Member Functions inherited from makVrv::DtTickable
 DtTickable (DtTickableManagerInterface *manager)
 
 DtTickable ()=delete
 
virtual void slot_managerAboutToBeDeleted ()
 

Protected Attributes

DtDemyDe
 
DtUniqueID myUniqueId
 
DtModelSetId myModelSet
 
boost::signalslib::connection mySceneObjectConnection
 
DtSceneObjectUpdatermyNextUpdater
 
DtSceneObjectUpdatermyPrevUpdater
 
unsigned int myVertexToUpdate
 
DtVector myLastPositionForAdaptiveTickRate
 
DtVector myInputPosition
 
DtTaitBryan myInputOrientation
 
DtVector myLastOutputPosition
 
DtTaitBryan myLastOutputOrientation
 
bool myPositionDataOutputted
 
bool myOrientationDataOutputted
 
ModelSetToSceneObjectMap mySceneObjectMap
 
SceneObjectConnectionsMap mySceneObjectConnectionsMap
 
AdaptiveTickRateLODParams myAdaptiveTickRateLODParams
 
- Protected Attributes inherited from makVrv::DtTickable
DtTickableManagerInterfacemyManager
 
DtSignalConnectionManager myConnections
 
unsigned int myFrameCounter
 
unsigned int myFrameToUpdate
 
unsigned int myUpdatePeriod
 
unsigned int myTickableIndex
 
DtTime myLastUpdateTime
 
bool myIsThreadSafe
 
TickableListState myTickableListState
 

Additional Inherited Members

- Public Types inherited from makVrv::DtTickable
enum  TickableListState { TickableNotOnList, TickableOnMainList, TickableOnThreadSafeList }
 

Member Typedef Documentation

using makVrv::DtSceneObjectUpdater::SceneObjectConnectionsMap = std::unordered_map<DtUniqueID,boost::signalslib::connection>
protected

Constructor & Destructor Documentation

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

CTOR.

Parameters
[in]deis the display engine.
[in]idis a unique identifier for this distributed object.
virtual makVrv::DtSceneObjectUpdater::~DtSceneObjectUpdater ( )
virtual

Virtual DTOR.

Member Function Documentation

virtual void makVrv::DtSceneObjectUpdater::setNextUpdater ( DtSceneObjectUpdater nextUpdater)
virtual

Set the next updater in the updater chain.

Parameters
[in]nextUpdateris the next updater in this updater chain When the next updater is null, it indicates that the updater is at the end of the chain. Its output will be used to set the appropriate vertex (set using setVertexToUpdate) in the scene object. Updaters with a non-null next updater will provide its outputs to the inputs of the next updater.

Reimplemented in makVrv::DtSurfaceClampingUpdater.

virtual void makVrv::DtSceneObjectUpdater::setPrevUpdater ( DtSceneObjectUpdater prevUpdater)
virtual

Set the previous updater in the updater chain.

Parameters
[in]prevUpdateris the prev updater in this updater chain When the previous updater is null, it indicates that this is the start of the updater chain; intial position and information is provided using setInputPosition and setInputOrientation.
virtual bool makVrv::DtSceneObjectUpdater::needsUpdate ( DtTime  tNow)
virtual

The check function called by DtTickableManager to verify if an update is required. If this function returns true, the DtTickableManager will then call update().

Parameters
[in]tNowis the current time-stamp.
Return values
trueif this object needs to be ticked.
falseotherwise. This base class method uses both the time and the presence of valid input transforms to determine if the updater should be ticked. Will always be true if the object is being observed

Reimplemented from makVrv::DtTickable.

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

The update function called by DtTickableManager during update-ticks.

Parameters
[in]tNowis the current time-stamp.
Note
All classes deriving from DtSceneObjectUpdater must call DtSceneObjectUpdater::update() AFTER their own update completes for chaining (and pass-thru) to work correctly.

Implements makVrv::DtTickable.

Reimplemented in makVrv::DtMultiPointEmbarkationUpdater, makVrv::DtEmbarkationUpdater, makVrv::DtGroundClampingUpdater, makVrv::DtSurfaceClampingUpdater, makVrv::DtVertexUpdater, makVrv::DtMultiPointSceneObjectUpdater, makVrv::DtWaterClampingUpdater, makVrv::DtDeadReckonUpdater, and makVrv::DtTerrainScalingUpdater.

virtual void makVrv::DtSceneObjectUpdater::updateAdaptiveTickrate ( const DtVector lastPos,
const DtTime deltaTime 
)
virtual

This is called by the update function after all the original chaining updates happen.

Parameters
[in]lastPosis the position right before update was run .
[in]deltaTimeis useful for calculating velocity of the objects
virtual void makVrv::DtSceneObjectUpdater::setVertexToUpdate ( unsigned int  vertex)
virtual

Specify which vertex in the scene object this updater updates.

Parameters
[in]vertexis the vertex in the scene object to update.

Reimplemented in makVrv::DtSurfaceClampingUpdater.

virtual void makVrv::DtSceneObjectUpdater::setInputPosition ( const DtVector position)
virtual

Set the position input to this updater.

Parameters
[in]positionis the position to use.

Reimplemented in makVrv::DtSurfaceClampingUpdater, and makVrv::DtDeadReckonUpdater.

virtual void makVrv::DtSceneObjectUpdater::setInputOrientation ( const DtTaitBryan &  orientation)
virtual

Set the orientation input to this updater.

Parameters
[in]orientationis the orientation to use.

Reimplemented in makVrv::DtDeadReckonUpdater, and makVrv::DtSurfaceClampingUpdater.

virtual void makVrv::DtSceneObjectUpdater::setOutputPosition ( const DtVector position)
virtual

Output the resultant position. If there is a next updater, this will call that updater's setInputPosition with the result. Otherwise the result will be provided to the specified scene object.

Parameters
[in]positionis the position to set.
virtual DtVector makVrv::DtSceneObjectUpdater::outputPosition ( ) const
virtual

Get the last output position.

virtual void makVrv::DtSceneObjectUpdater::setOutputOrientation ( const DtTaitBryan &  orientation)
virtual

Output the resultant orientation. If there is a next updater, this will call that updater's setInputOrientaiton with the result. Otherwise the result will be provided to the specified scene object.

Parameters
[in]orientationis the orientation to set.
virtual DtTaitBryan makVrv::DtSceneObjectUpdater::outputOrientation ( ) const
virtual

Get the last output orientation.

virtual void makVrv::DtSceneObjectUpdater::setOutputPositionAndOrientation ( const DtVector position,
const DtTaitBryan &  orientation 
)
virtual

Set both the position and orientation at the same time. This allows the scene obejct and DtModels to set both at the same time which can avoid additional calculations when the two depend on each other. Currently only the DtDiGuyCharacterModel takes advantage of the performance improvement.

virtual DtTime makVrv::DtSceneObjectUpdater::lastUpdateTime ( ) const
virtual

Get the time-stamp of the last update.

Returns
The last update time.
virtual void makVrv::DtSceneObjectUpdater::setSceneObject ( DtSceneObject sceneObject,
bool  addToTickableMgrIfHead 
)
virtual

Set the scene object to be updated.

Parameters
[in]sceneObjectis the scene object to receive updates.
[in]addToTickableMgrIfHeadwill allow (or disallow) the updater to be added to the tickable manager if it is currently has no 'previous' updater. This is a workaround used for cases where updaters aren't part of a simple chain, like the buoyancy and ground clamping updaters which are owned by a surface updater Calls addSceneObjectToUpdate with the model set of the scene object Left for backwards compatibility, please use addSceneObjectToUpdate.
virtual void makVrv::DtSceneObjectUpdater::setSceneObject ( DtSceneObject sceneObject)
virtual

Set the scene object to be updated.

Parameters
[in]sceneObjectis the scene object to receive updates. Calls setSceneObject(DtSceneObject* sceneObject, bool addToTickableMgrIfHead) with addToTickableMgrIfHead=true for back compatibility
virtual void makVrv::DtSceneObjectUpdater::setAdaptiveTickLodEnabled ( bool  enabled)
virtual

Following methods are all used for adaptive tick rate LOD Adaptive tick rate will increase or decrease how often this updater updates based on these LOD parameters.

Set/Get if the adaptive tick lod update system is on for this updater

virtual bool makVrv::DtSceneObjectUpdater::adaptiveTickLodEnabled ( ) const
overridevirtual

Following methods are all used for adaptive tick rate LOD Adaptive tick rate will increase or decrease how often this updater updates based on these LOD parameters.

Set/Get if the adaptive tick lod update system is on for this updater

Reimplemented from makVrv::DtTickable.

virtual void makVrv::DtSceneObjectUpdater::setLodScaleSpeedFactor ( float  factor)
virtual

sets the value that linearly adjusts the range of the lod radii by the velocity

virtual float makVrv::DtSceneObjectUpdater::lodScaleSpeedFactor ( ) const
virtual

gets the value that linearly adjusts the range of the lod radii by the velocity

virtual void makVrv::DtSceneObjectUpdater::setLodRadiusStart ( float  ratius)
virtual

sets the near radius where the update rate starts to fall off

virtual float makVrv::DtSceneObjectUpdater::lodRadiusStart ( ) const
virtual

gets the near radius where the update rate starts to fall off

virtual void makVrv::DtSceneObjectUpdater::setLodRadiusEnd ( float  ratius)
virtual

sets the far radius where the update rate stops falling off

virtual float makVrv::DtSceneObjectUpdater::lodRadiusEnd ( ) const
virtual

gets the far radius where the update rate stops falling off

virtual void makVrv::DtSceneObjectUpdater::setNearLodUpdateRate ( int  nearRate)
virtual

sets the update rate at the near radius, defaults to every six ticks

virtual int makVrv::DtSceneObjectUpdater::nearLodUpdateRate ( ) const
virtual

gets the update rate at the near radius, defaults to every six ticks

virtual void makVrv::DtSceneObjectUpdater::setFarLodUpdateRate ( int  maxRate)
virtual

the update rate at the far radius, defaults to every 30 ticks

virtual int makVrv::DtSceneObjectUpdater::farLodUpdateRate ( ) const
virtual

gets the update rate at the far radius defaults to every 30 ticks

DtSceneObject* makVrv::DtSceneObjectUpdater::findActiveSceneObject ( )
inline

Find an active scene object.

Returns
A pointer to the scene object or NULL if not set.
DtSceneObject* const makVrv::DtSceneObjectUpdater::findActiveSceneObject ( ) const
inline

const correct version

DtSceneObject* makVrv::DtSceneObjectUpdater::findSceneObjectForModelSet ( DtModelSetId  modelSet)
inline

Find an active scene object.

Returns
A pointer to the scene object or NULL if not set.
DtSceneObject* const makVrv::DtSceneObjectUpdater::findSceneObjectForModelSet ( DtModelSetId  modelSet) const
inline

Find an active scene object.

Returns
A pointer to the scene object or NULL if not set.
DtUniqueID makVrv::DtSceneObjectUpdater::uniqueId ( ) const
inline

Returns the distributed object id of this updater.

DtSceneObjectUpdater* makVrv::DtSceneObjectUpdater::findNextUpdater ( ) const
inline

Return the next updater in the updater chain.

DtSceneObjectUpdater* makVrv::DtSceneObjectUpdater::findPrevUpdater ( ) const
inline

Return the previous updater in the updater chain.

virtual bool makVrv::DtSceneObjectUpdater::isChainThreadSafe ( DtSceneObjectUpdater firstUpdater)
virtual

Check all the updaters in the current chain and determine if the chain is thread safe. Called to determine which tickable list the first updater should be placed on.

virtual DtSceneObjectUpdater* makVrv::DtSceneObjectUpdater::chainHead ( )
virtual

Find the first updater in the chain.

virtual void makVrv::DtSceneObjectUpdater::setIsThreadSafe ( bool  safe)
virtual

Override the DtTickable base class' method so retest the entire chain this updater belongs to.

Reimplemented from makVrv::DtTickable.

virtual void makVrv::DtSceneObjectUpdater::addSceneObjectToUpdate ( DtModelSetId  modelSet,
DtSceneObject sceneObject,
bool  addToTickableMgrIfHead = true 
)
virtual

Add / Remove a scene to apply updates to Adds the updater to the tickable update list if it is not there already.

Reimplemented in makVrv::DtDeadReckonUpdater, and makVrv::DtSurfaceClampingUpdater.

virtual void makVrv::DtSceneObjectUpdater::removeSceneObjectToUpdate ( DtModelSetId  modelSet,
DtSceneObject sceneObject 
)
virtual

Add / Remove a scene to apply updates to Adds the updater to the tickable update list if it is not there already.

Reimplemented in makVrv::DtDeadReckonUpdater, and makVrv::DtSurfaceClampingUpdater.

virtual void makVrv::DtSceneObjectUpdater::addSceneObjectToUpdateAtChainEnd ( DtModelSetId  modelSet,
DtSceneObject sceneObject,
bool  addToTickableMgrIfHead = true 
)
virtual

Chain end methods will iterate the chain using findNextUpdater and then call addSceneObjectToUpdate / removeSceneObjectToUpdate on the last updater.

virtual void makVrv::DtSceneObjectUpdater::removeSceneObjectToUpdateAtChainEnd ( DtModelSetId  modelSet,
DtSceneObject sceneObject 
)
virtual

Add / Remove a scene to apply updates to Adds the updater to the tickable update list if it is not there already.

virtual void makVrv::DtSceneObjectUpdater::setTickableEnabled ( bool  enabled)
overridevirtual

Set whether this updater should get ticked or not.

Reimplemented from makVrv::DtTickable.

virtual void makVrv::DtSceneObjectUpdater::slot_sceneObjectToBeDeleted ( const DtUniqueID id)
protectedvirtual
virtual void makVrv::DtSceneObjectUpdater::removeThreadSafeChainFromManager ( DtSceneObjectUpdater head)
protectedvirtual

Helper method to remove an updater (not necessarily this one, but rather the one at the head of the chain that this updater belongs to) from the DtTickableManager's thread-safe tickable list. Catches the exception that DtTickableManager may throw and outputs an appropriate message to the debug log.

virtual void makVrv::DtSceneObjectUpdater::removeUnThreadSafeChainFromManager ( DtSceneObjectUpdater head)
protectedvirtual

Helper method to remove an updater (not necessarily this one, but rather the one at the head of the chain that this updater belongs to) from the DtTickableManager's un-thread-safe tickable list. Catches the exception that DtTickableManager may throw and outputs an appropriate message to the debug log.

virtual void makVrv::DtSceneObjectUpdater::addThreadSafeChainToManager ( DtSceneObjectUpdater head)
protectedvirtual

Helper method to add an updater (not necessarily this one, but rather the one at the head of the chain that this updater belongs to) to the DtTickableManager's thread-safe tickable list. Catches the exception that DtTickableManager may throw and outputs an appropriate message to the debug log.

virtual void makVrv::DtSceneObjectUpdater::addUnThreadSafeChainToManager ( DtSceneObjectUpdater head)
protectedvirtual

Helper method to add an updater (not necessarily this one, but rather the one at the head of the chain that this updater belongs to) to the DtTickableManager's un-thread-safe tickable list. Catches the exception that DtTickableManager may throw and outputs an appropriate message to the debug log.

virtual void makVrv::DtSceneObjectUpdater::placeChainOnCorrectTickableList ( DtSceneObjectUpdater head)
protectedvirtual

Examines the chain for the given head updater, removes the head from the approriate ticable list if necessary, and then adds the head to the correct (threaded or unthreaded) tickable list.

Member Data Documentation

boost::signalslib::signal< void ( const DtUniqueID& ) > makVrv::DtSceneObjectUpdater::signal_updaterToBeDeleted
DtDe& makVrv::DtSceneObjectUpdater::myDe
protected

The display engine.

DtUniqueID makVrv::DtSceneObjectUpdater::myUniqueId
protected

This distributed object's unique identifier.

DtModelSetId makVrv::DtSceneObjectUpdater::myModelSet
protected

A pointer to the current scene object being updated.

This updater is registered as a modelset-specific tickable; this is the modelset it's registered with

boost::signalslib::connection makVrv::DtSceneObjectUpdater::mySceneObjectConnection
protected
DtSceneObjectUpdater* makVrv::DtSceneObjectUpdater::myNextUpdater
protected

The next updater in the chain (or NULL)

DtSceneObjectUpdater* makVrv::DtSceneObjectUpdater::myPrevUpdater
protected

The previous updater in the chain (or NULL)

unsigned int makVrv::DtSceneObjectUpdater::myVertexToUpdate
protected

The default scene object vertex to update.

DtVector makVrv::DtSceneObjectUpdater::myLastPositionForAdaptiveTickRate
protected

Used to calculate the velocity for adaptive tick rate.

DtVector makVrv::DtSceneObjectUpdater::myInputPosition
protected

Input position.

DtTaitBryan makVrv::DtSceneObjectUpdater::myInputOrientation
protected

Input Orientation.

DtVector makVrv::DtSceneObjectUpdater::myLastOutputPosition
protected

Last Output position.

DtTaitBryan makVrv::DtSceneObjectUpdater::myLastOutputOrientation
protected

Last Output Orientation.

bool makVrv::DtSceneObjectUpdater::myPositionDataOutputted
protected

Flag to indicate if setOutputPosition has been called this tick. If a deriving updater hasn't called setOutputPosition, this base class will copy the input position to the output.

bool makVrv::DtSceneObjectUpdater::myOrientationDataOutputted
protected

Flag to indicate if setOutputOrientation has been called this tick. If a deriving updater hasn't called setOutputPosition, this base class will copy the input orientation to the output.

ModelSetToSceneObjectMap makVrv::DtSceneObjectUpdater::mySceneObjectMap
protected
SceneObjectConnectionsMap makVrv::DtSceneObjectUpdater::mySceneObjectConnectionsMap
protected
AdaptiveTickRateLODParams makVrv::DtSceneObjectUpdater::myAdaptiveTickRateLODParams
protected

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

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)