VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtCenterOfViewTickable Class Reference

Detailed Description

DtCenterOfViewTickable is a component that updates the display channels to keep the view centered on a specified scene object (typically an entity). It inherits from DtTickable, allowing it to receive regular update calls from the display engine's main loop. This is useful for keeping the camera focused on a moving entity, such as the player's vehicle or avatar.

#include <centerOfViewTickable.h>

Inheritance diagram for makVre::DtCenterOfViewTickable:
[legend]

Public Member Functions

 DtCenterOfViewTickable (makVrv::DtDe &de)
 
virtual ~DtCenterOfViewTickable () override
 
virtual void update (DtTime tNow) override
 
virtual bool needsUpdate (DtTime tNow) override
 
virtual void setSceneObject (makVrv::DtSceneObjectAgent *obj)
 

Protected Member Functions

virtual void actualUpdate (makVrv::DtChannelManager *mgr, makVrv::DtChannel *channel)
 

Protected Attributes

DtTime myLastUpdatedTime
 
makVrv::DtDe & myDe
 
makVrv::DtSceneObjectAgent * mySceneObject
 

Constructor & Destructor Documentation

◆ DtCenterOfViewTickable()

makVre::DtCenterOfViewTickable::DtCenterOfViewTickable ( makVrv::DtDe & de)

Constructor.

Parameters
deReference to the display engine

Creates a new center-of-view tickable component associated with the specified display engine. The component starts without a target scene object.

References de().

◆ ~DtCenterOfViewTickable()

virtual makVre::DtCenterOfViewTickable::~DtCenterOfViewTickable ( )
overridevirtual

Virtual destructor.

Ensures proper cleanup of resources used by derived classes.

Member Function Documentation

◆ update()

virtual void makVre::DtCenterOfViewTickable::update ( DtTime tNow)
overridevirtual

Updates the center of view.

Parameters
tNowCurrent simulation time

Called by the tickable manager to update the view center. This method updates the view to keep it centered on the target scene object. If no scene object is set, this method does nothing.

◆ needsUpdate()

virtual bool makVre::DtCenterOfViewTickable::needsUpdate ( DtTime tNow)
overridevirtual

Checks if an update is needed.

Parameters
tNowCurrent simulation time
Returns
True if an update should be performed, false otherwise

Determines whether the view center needs to be updated at the current time. This helps optimize performance by avoiding unnecessary updates.

◆ setSceneObject()

virtual void makVre::DtCenterOfViewTickable::setSceneObject ( makVrv::DtSceneObjectAgent * obj)
virtual

Sets the target scene object.

Parameters
objPointer to the scene object to center on

Sets the scene object that the view should be centered on. This can be changed at any time to switch the focus to a different entity. Setting this to NULL disables the centering functionality.

◆ actualUpdate()

virtual void makVre::DtCenterOfViewTickable::actualUpdate ( makVrv::DtChannelManager * mgr,
makVrv::DtChannel * channel )
protectedvirtual

Performs the actual view update.

Parameters
mgrPointer to the channel manager
channelPointer to the channel being updated

Internal method that performs the actual work of updating a specific display channel to center on the target scene object. This method is called for each relevant channel by the update method.

Member Data Documentation

◆ myLastUpdatedTime

DtTime makVre::DtCenterOfViewTickable::myLastUpdatedTime
protected

Time of the last update.

Stores the simulation time of the last performed update to control update frequency and avoid redundant updates.

◆ myDe

makVrv::DtDe& makVre::DtCenterOfViewTickable::myDe
protected

Reference to the display engine.

Provides access to channels, scene objects, and other display resources.

◆ mySceneObject

makVrv::DtSceneObjectAgent* makVre::DtCenterOfViewTickable::mySceneObject
protected

Target scene object to center on.

The scene object that the view should be centered on. May be NULL if no centering is currently desired.


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