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>
|
| virtual void | actualUpdate (makVrv::DtChannelManager *mgr, makVrv::DtChannel *channel) |
| |
◆ DtCenterOfViewTickable()
| makVre::DtCenterOfViewTickable::DtCenterOfViewTickable |
( |
makVrv::DtDe & | de | ) |
|
Constructor.
- Parameters
-
| de | Reference 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.
◆ update()
| virtual void makVre::DtCenterOfViewTickable::update |
( |
DtTime | tNow | ) |
|
|
overridevirtual |
Updates the center of view.
- Parameters
-
| tNow | Current 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
-
| tNow | Current 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
-
| obj | Pointer 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
-
| mgr | Pointer to the channel manager |
| channel | Pointer 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.
◆ 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: