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

Detailed Description

The primary function of this class is management of first person arms and gun model. This class owns the first person model agent and first person mimic model updater, and is responsible for selecting the appropriate first person model depending on active gun and/or equipment, hiding or showing the model based on 1st/3rd person view mode or other condition such as death, (re)positioning model relative to camera based on posture, and setting aiming and firing state of first person model when necessary. This class also manages overlay effects such as sniper rifle sights and blood overlay effects that indicate when and from where the player is taking hits.

#include <humanRenderUpdater.h>

Inheritance diagram for makVre::DtHumanRenderUpdater:
[legend]

Classes

struct  HitEffectInfo
 

Public Member Functions

 DtHumanRenderUpdater ()
 
virtual ~DtHumanRenderUpdater () override
 
virtual bool initialize (makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
void showFirstPerson ()
 
void hideFirstPerson ()
 
void showThirdPerson ()
 
void setThirdPersonVisible (bool visible)
 
void setFirstPersonModelOffset (DtVector translation, DtTaitBryan rotation=DtTaitBryan())
 
bool findFirstPersonModelOffset (HumanPosture posture, bool aiming, bool usingVr, DtVector *translation=nullptr, DtTaitBryan *rotation=nullptr)
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
virtual bool postInitialize ()
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Types

using HitEffectEnum
 
using HitEffectState
 

Protected Member Functions

bool initializeRenderObjects ()
 
void clearSceneSelection ()
 
void configureDeadReckoningAndSmoothing ()
 
void updateBloodSightEffects ()
 
void updateFirstPersonModel (double dt)
 
void updateThirdPersonModel (double dt)
 
void updateAimingEffects ()
 
void updateEquipmentEffects ()
 
void updateHealthEffects ()
 
void updateHitEffects (double dt)
 
virtual void startHitEffect (HitEffectEnum hitEffect)
 
virtual void stopHitEffect (HitEffectEnum hitEffect)
 
virtual makVre::DtVreMessageResult handleFireMessage (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleReportDetonationLocationMessage (makVre::DtVreMessage *msg)
 
void onHealthChanged (double val)
 
const makVrv::DtDeadReckonUpdater * lookupDeadReckonUpdater (makVrv::DtSceneObject *myDisSceneObject)
 
virtual void slot_disSceneObjectToBeDeleted (const makVrv::DtUniqueID &id)
 
std::string findFirstPersonModelDef (const std::string &gun, const std::string &appearance)
 
diguyCharacter * findDisDiguyCharacter ()
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

double myHitEffectDuration
 
double myHealthEffectHealthMinimum
 
double myHealthEffectHealthMaximum
 
double myHealthEffectOpacityMaximum
 
DtInitTable myFirstPersonModelMap
 
DtInitTable myFirstPersonModelTable
 
makVrv::DtCharacterModelAgent * myFirstPersonModelAgent
 
makVrv::DtSceneObjectAgent * myFirstPersonSceneObjectAgent
 
DtFpsFirstPersonUpdaterAgentmyFirstPersonUpdaterAgent
 
DtFpsOrientationUpdaterAgentmyOrientationUpdaterAgent
 
makVrv::DtSceneObject * myDisSceneObject
 
std::string myDisGun
 
std::string myDisAppearance
 
bool myShowingFirstPerson
 
int myArmsPosture
 
bool myWeaponDown
 
bool myLastKnownAiming
 
bool myRenderObjectsInitialized
 
bool myFirstPersonObjectsInitialized
 
makVrv::DtOsgChannel * myChannel
 
double myEndSightEffect
 
Equipment myLastKnownEquipment
 
double myModelSwitchDelay
 
double myModelShowDelay
 
double myArmsPitch
 
double myArcPitchAddition
 
double myFirstPersonModelPitchOffset
 
double myFirstPersonModelHeadingOffset
 
bool myUsingVr
 
DtAttributeHandleType< bool > myHideFirstPersonModelWhileAiming
 
bool myFirstPersonVisibleBeforeAiming
 
std::vector< std::pair< HitEffectEnum, HitEffectInfo > > myHitEffect
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Member Typedef Documentation

◆ HitEffectEnum

Initial value:
enum {
HIT_EFFECT_LEFT_SIDE,
HIT_EFFECT_RIGHT_SIDE,
HIT_EFFECT_ALL_SIDES,
HIT_EFFECT_NUMBER_EFFECTS
}

Enumeration of hit effect positions.

Used to track the timers for each hit effect location

◆ HitEffectState

Initial value:
enum {
HIT_EFFECT_STATE_OFF,
HIT_EFFECT_STATE_ON,
HIT_EFFECT_STATE_INTERRUPT
}

Enumeration of hit effect states.

These states are necessary to have interruptible hit effects

Constructor & Destructor Documentation

◆ DtHumanRenderUpdater()

makVre::DtHumanRenderUpdater::DtHumanRenderUpdater ( )

Default constructor.

◆ ~DtHumanRenderUpdater()

virtual makVre::DtHumanRenderUpdater::~DtHumanRenderUpdater ( )
overridevirtual

Virtual destructor.

Member Function Documentation

◆ initialize()

virtual bool makVre::DtHumanRenderUpdater::initialize ( makVre::DtPlayerStation * player,
makVre::DtInitTable & config )
overridevirtual

Initializes the render updater component.

Parameters
playerPointer to the player station
configConfiguration settings for initialization
Returns
True if initialization was successful, false otherwise

Reimplemented from makVre::DtPlayerComponent.

References makVre::DtPlayerComponent::player().

◆ tick()

virtual void makVre::DtHumanRenderUpdater::tick ( double dt)
overridevirtual

Updates rendering elements for the current frame.

Parameters
dtDelta time since the last frame in seconds

Implements makVre::DtPlayerComponent.

◆ shutdown()

virtual void makVre::DtHumanRenderUpdater::shutdown ( )
overridevirtual

Cleans up resources when the component is being shut down.

Reimplemented from makVre::DtPlayerComponent.

◆ type()

virtual const char * makVre::DtHumanRenderUpdater::type ( ) const
overridevirtual

Returns the component type identifier.

Returns
String identifier for this component type

Returns the type identifier string for this component, which is used by the VR-Engage framework for component identification and management. The returned value matches DtHumanRenderUpdaterType.

Implements makVre::DtPlayerComponent.

◆ showFirstPerson()

void makVre::DtHumanRenderUpdater::showFirstPerson ( )

Shows the first-person model.

◆ hideFirstPerson()

void makVre::DtHumanRenderUpdater::hideFirstPerson ( )

Hides the first-person model.

◆ showThirdPerson()

void makVre::DtHumanRenderUpdater::showThirdPerson ( )

Shows the third-person model.

◆ setThirdPersonVisible()

void makVre::DtHumanRenderUpdater::setThirdPersonVisible ( bool visible)

Sets the visibility of the third-person model.

Parameters
visibleTrue to show the model, false to hide it

◆ setFirstPersonModelOffset()

void makVre::DtHumanRenderUpdater::setFirstPersonModelOffset ( DtVector translation,
DtTaitBryan rotation = DtTaitBryan() )

Sets the offset of the first-person model.

Parameters
translationTranslation offset vector
rotationRotation offset in Tait-Bryan angles

◆ findFirstPersonModelOffset()

bool makVre::DtHumanRenderUpdater::findFirstPersonModelOffset ( HumanPosture posture,
bool aiming,
bool usingVr,
DtVector * translation = nullptr,
DtTaitBryan * rotation = nullptr )

Finds the appropriate first-person model offset for the given state.

Parameters
postureCurrent human posture
aimingTrue if the player is currently aiming
usingVrTrue if VR mode is active
translation[out] Pointer to receive the translation offset, can be nullptr
rotation[out] Pointer to receive the rotation offset, can be nullptr
Returns
True if offsets were found, false otherwise

◆ initializeRenderObjects()

bool makVre::DtHumanRenderUpdater::initializeRenderObjects ( )
protected

Initializes render objects like models and effects.

Returns
True if initialization was successful, false otherwise

◆ clearSceneSelection()

void makVre::DtHumanRenderUpdater::clearSceneSelection ( )
protected

Clears any active scene selections.

◆ configureDeadReckoningAndSmoothing()

void makVre::DtHumanRenderUpdater::configureDeadReckoningAndSmoothing ( )
protected

Configures dead reckoning and movement smoothing.

◆ updateBloodSightEffects()

void makVre::DtHumanRenderUpdater::updateBloodSightEffects ( )
protected

Updates blood sight (damage) overlay effects.

◆ updateFirstPersonModel()

void makVre::DtHumanRenderUpdater::updateFirstPersonModel ( double dt)
protected

Updates the first-person model state and position.

Parameters
dtDelta time since the last frame in seconds

◆ updateThirdPersonModel()

void makVre::DtHumanRenderUpdater::updateThirdPersonModel ( double dt)
protected

Updates the third-person model state and position.

Parameters
dtDelta time since the last frame in seconds

◆ updateAimingEffects()

void makVre::DtHumanRenderUpdater::updateAimingEffects ( )
protected

Updates aiming-related visual effects.

◆ updateEquipmentEffects()

void makVre::DtHumanRenderUpdater::updateEquipmentEffects ( )
protected

Updates equipment-related visual effects.

◆ updateHealthEffects()

void makVre::DtHumanRenderUpdater::updateHealthEffects ( )
protected

Updates health-related visual effects.

Updates the effect that shows when the human's damage state is slight or moderate

◆ updateHitEffects()

void makVre::DtHumanRenderUpdater::updateHitEffects ( double dt)
protected

Updates hit-related visual effects.

Parameters
dtDelta time since the last frame in seconds

Updates the hit effect when the human is hit by a munition. It shows effects on the right, left, or all corners of the GUI.

◆ startHitEffect()

virtual void makVre::DtHumanRenderUpdater::startHitEffect ( HitEffectEnum hitEffect)
protectedvirtual

Starts a hit effect timer.

Parameters
hitEffectThe hit effect type to start

◆ stopHitEffect()

virtual void makVre::DtHumanRenderUpdater::stopHitEffect ( HitEffectEnum hitEffect)
protectedvirtual

Stops a hit effect timer.

Parameters
hitEffectThe hit effect type to stop

◆ handleFireMessage()

virtual makVre::DtVreMessageResult makVre::DtHumanRenderUpdater::handleFireMessage ( makVre::DtVreMessage * msg)
protectedvirtual

Handles fire messages.

Parameters
msgPointer to the message being processed
Returns
Message processing result

◆ handleReportDetonationLocationMessage()

virtual makVre::DtVreMessageResult makVre::DtHumanRenderUpdater::handleReportDetonationLocationMessage ( makVre::DtVreMessage * msg)
protectedvirtual

Handles detonation location messages.

Parameters
msgPointer to the message being processed
Returns
Message processing result

◆ onHealthChanged()

void makVre::DtHumanRenderUpdater::onHealthChanged ( double val)
protected

Handles changes in player health.

Parameters
valNew health value

◆ lookupDeadReckonUpdater()

const makVrv::DtDeadReckonUpdater * makVre::DtHumanRenderUpdater::lookupDeadReckonUpdater ( makVrv::DtSceneObject * myDisSceneObject)
protected

Looks up the dead reckoning updater for a scene object.

Parameters
myDisSceneObjectPointer to the scene object
Returns
Pointer to the dead reckoning updater, or nullptr if not found

References myDisSceneObject.

◆ slot_disSceneObjectToBeDeleted()

virtual void makVre::DtHumanRenderUpdater::slot_disSceneObjectToBeDeleted ( const makVrv::DtUniqueID & id)
protectedvirtual

Handles scene object deletion notifications.

Parameters
idUnique ID of the scene object being deleted

◆ findFirstPersonModelDef()

std::string makVre::DtHumanRenderUpdater::findFirstPersonModelDef ( const std::string & gun,
const std::string & appearance )
protected

Finds the appropriate first-person model definition.

Parameters
gunCurrent weapon identifier
appearanceCurrent appearance identifier
Returns
Model definition identifier string

◆ findDisDiguyCharacter()

diguyCharacter * makVre::DtHumanRenderUpdater::findDisDiguyCharacter ( )
protected

Finds the DI-Guy character for the player.

Returns
Pointer to the DI-Guy character, or nullptr if not found

Member Data Documentation

◆ myHitEffectDuration

double makVre::DtHumanRenderUpdater::myHitEffectDuration
protected

Duration of hit effects in seconds.

◆ myHealthEffectHealthMinimum

double makVre::DtHumanRenderUpdater::myHealthEffectHealthMinimum
protected

Minimum health value for health effect visibility.

The minimum health that the health effect will change. Don't want the screen to go completely opaque

◆ myHealthEffectHealthMaximum

double makVre::DtHumanRenderUpdater::myHealthEffectHealthMaximum
protected

Maximum health value for health effect visibility.

The maximum health that the health effect will change

◆ myHealthEffectOpacityMaximum

double makVre::DtHumanRenderUpdater::myHealthEffectOpacityMaximum
protected

Maximum opacity value for health effects.

◆ myFirstPersonModelMap

DtInitTable makVre::DtHumanRenderUpdater::myFirstPersonModelMap
protected

Mapping between weapons and model definitions.

◆ myFirstPersonModelTable

DtInitTable makVre::DtHumanRenderUpdater::myFirstPersonModelTable
protected

Configuration table for first-person models.

◆ myFirstPersonModelAgent

makVrv::DtCharacterModelAgent* makVre::DtHumanRenderUpdater::myFirstPersonModelAgent
protected

Agent managing the first-person character model.

◆ myFirstPersonSceneObjectAgent

makVrv::DtSceneObjectAgent* makVre::DtHumanRenderUpdater::myFirstPersonSceneObjectAgent
protected

Agent managing the first-person scene object.

◆ myFirstPersonUpdaterAgent

DtFpsFirstPersonUpdaterAgent* makVre::DtHumanRenderUpdater::myFirstPersonUpdaterAgent
protected

Agent managing first-person model updates.

◆ myOrientationUpdaterAgent

DtFpsOrientationUpdaterAgent* makVre::DtHumanRenderUpdater::myOrientationUpdaterAgent
protected

Agent managing orientation updates.

◆ myDisSceneObject

makVrv::DtSceneObject* makVre::DtHumanRenderUpdater::myDisSceneObject
protected

Main scene object for the player entity.

Referenced by lookupDeadReckonUpdater().

◆ myDisGun

std::string makVre::DtHumanRenderUpdater::myDisGun
protected

Current weapon identifier.

◆ myDisAppearance

std::string makVre::DtHumanRenderUpdater::myDisAppearance
protected

Current appearance identifier.

◆ myShowingFirstPerson

bool makVre::DtHumanRenderUpdater::myShowingFirstPerson
protected

Flag indicating if first-person view is currently shown.

◆ myArmsPosture

int makVre::DtHumanRenderUpdater::myArmsPosture
protected

Current posture of the arms model.

◆ myWeaponDown

bool makVre::DtHumanRenderUpdater::myWeaponDown
protected

Flag indicating if weapon is in the down position.

◆ myLastKnownAiming

bool makVre::DtHumanRenderUpdater::myLastKnownAiming
protected

Last known aiming state.

◆ myRenderObjectsInitialized

bool makVre::DtHumanRenderUpdater::myRenderObjectsInitialized
protected

Flag indicating if render objects have been initialized.

◆ myFirstPersonObjectsInitialized

bool makVre::DtHumanRenderUpdater::myFirstPersonObjectsInitialized
protected

Flag indicating if first-person objects have been initialized.

◆ myChannel

makVrv::DtOsgChannel* makVre::DtHumanRenderUpdater::myChannel
protected

Pointer to the main rendering channel.

◆ myEndSightEffect

double makVre::DtHumanRenderUpdater::myEndSightEffect
protected

Time when the sight effect should end.

◆ myLastKnownEquipment

Equipment makVre::DtHumanRenderUpdater::myLastKnownEquipment
protected

Last known equipment state.

◆ myModelSwitchDelay

double makVre::DtHumanRenderUpdater::myModelSwitchDelay
protected

Delay before switching models in seconds.

◆ myModelShowDelay

double makVre::DtHumanRenderUpdater::myModelShowDelay
protected

Delay before showing models in seconds.

◆ myArmsPitch

double makVre::DtHumanRenderUpdater::myArmsPitch
protected

Current pitch angle of the arms model.

◆ myArcPitchAddition

double makVre::DtHumanRenderUpdater::myArcPitchAddition
protected

Additional pitch angle for arc aiming.

◆ myFirstPersonModelPitchOffset

double makVre::DtHumanRenderUpdater::myFirstPersonModelPitchOffset
protected

Pitch offset for the first-person model.

◆ myFirstPersonModelHeadingOffset

double makVre::DtHumanRenderUpdater::myFirstPersonModelHeadingOffset
protected

Heading (yaw) offset for the first-person model.

◆ myUsingVr

bool makVre::DtHumanRenderUpdater::myUsingVr
protected

Flag indicating if VR mode is active.

◆ myHideFirstPersonModelWhileAiming

DtAttributeHandleType<bool> makVre::DtHumanRenderUpdater::myHideFirstPersonModelWhileAiming
protected

Flag indicating whether to hide the first-person player model while aiming (not applicable in VR)

◆ myFirstPersonVisibleBeforeAiming

bool makVre::DtHumanRenderUpdater::myFirstPersonVisibleBeforeAiming
protected

Tracks whether first-person model was visible before entering aiming mode.

◆ myHitEffect

std::vector<std::pair<HitEffectEnum, HitEffectInfo> > makVre::DtHumanRenderUpdater::myHitEffect
protected

Collection of hit effects and their information.

Timer used to control the hit effect which appears in the corners of the GUI


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