PRooFPS-dd Dev Doc 1.0
PRooFPS-dd Developer Documentation
Loading...
Searching...
No Matches
proofps_dd::CameraHandling Class Reference

Detailed Description

Definition at line 26 of file CameraHandling.h.

#include <CameraHandling.h>

+ Inheritance diagram for proofps_dd::CameraHandling:

Public Types

enum class  SpectatingView { Free , PlayerFollow }
 

Public Member Functions

CConsole & getConsole () const
 
 CameraHandling (PR00FsUltimateRenderingEngine &pure, Durations &durations, Maps &maps)
 
 CameraHandling (const CameraHandling &)=delete
 
CameraHandlingoperator= (const CameraHandling &)=delete
 
 CameraHandling (CameraHandling &&)=delete
 
CameraHandling && operator= (CameraHandling &&)=delete
 
SpectatingViewcameraGetSpectatingView ()
 
void cameraToggleSpectatingView ()
 Toggles between different camera spectating views.
 
PureVector & cameraGetPosToFollowWhenSpectating ()
 This is essentially controlled by cameraUpdatePosAndAngle() when we are in spectator mode, however it is allowed to be accessed by the user to update it in "free camera spectating view".
 
const pge_network::PgeNetworkConnectionHandle & cameraGetPlayerConnectionHandleToFollowWhenSpectating () const
 
bool findNextValidPlayerToFollowInPlayerSpectatingView (const std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > &mapPlayers)
 Useful when we want to iterate to the next spectatable player in "player follow spectating view".
 
bool findPrevValidPlayerToFollowInPlayerSpectatingView (const std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > &mapPlayers)
 Useful when we want to iterate to the previous spectatable player in "player follow spectating view".
 
bool findAnyValidPlayerToFollowInPlayerSpectatingView (const std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > &mapPlayers, PureVector &posPlayerToFollow)
 Useful when we are toggling spectating view to player follow view, or in each frame to check if followed player is still valid in player follow view.
 

Static Public Member Functions

static const char * getLoggerModuleName ()
 
static bool canSpectatePlayer (const Player &player)
 Use this function when iterating over players, to decide if we can spectate this player.
 

Protected Member Functions

void cameraInitForGameStart ()
 
void cameraPositionToMapCenter ()
 
void cameraUpdatePosAndAngle (pge_audio::PgeAudio &audio, const std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > &mapPlayers, const Player &player, XHair &xhair, const float &fFps, bool bCamFollowsXHair, bool bCamTiltingAllowed, bool bCamRollAllowed)
 
PureVector & cameraGetShakeForce ()
 

Private Member Functions

void cameraSmoothShakeForceTowardsZero (const float &fFps)
 
void cameraUpdateShakeFactorXY (const float &fFps)
 
void cameraUpdatePosAndAngleToFollowPos (PureCamera &cam, const PureVector &vecFollowPos, const XHair &xhair, const float &fFps, bool bCamFollowsXHair, bool bCamTiltingAllowed)
 
void cameraUpdatePosAndAngleWhenSpectating (const std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > &mapPlayers, PureCamera &cam, XHair &xhair, const float &fFps, bool bCamFollowsXHair, bool bCamTiltingAllowed)
 
void cameraUpdatePosAndAngleWhenPlayerIsSomersaulting (PureCamera &cam, const Player &player)
 
void cameraUpdatePosAndAngleWhenPlayerIsInNormalSituation (PureCamera &cam, const Player &player, const XHair &xhair, const float &fFps, bool bCamFollowsXHair, bool bCamTiltingAllowed)
 

Private Attributes

PR00FsUltimateRenderingEngine & m_pure
 
Durationsm_durations
 
Mapsm_maps
 
float m_fCameraMinY = 0.f
 
PureVector m_vecCamShakeForce
 
float m_fShakeFactorX = 0.f
 
float m_fShakeFactorY = 0.f
 
float m_fShakeDegree = 0.f
 
PureVector m_vecPosToFollowInFreeCameraView {}
 
SpectatingView m_eSpectatingView { SpectatingView::PlayerFollow }
 
pge_network::PgeNetworkConnectionHandle m_connHandlePlayerToFollowInSpectatingView { pge_network::ServerConnHandle }
 

Member Enumeration Documentation

◆ SpectatingView

Enumerator
Free 
PlayerFollow 

Definition at line 30 of file CameraHandling.h.

Constructor & Destructor Documentation

◆ CameraHandling() [1/3]

proofps_dd::CameraHandling::CameraHandling ( PR00FsUltimateRenderingEngine & pure,
proofps_dd::Durations & durations,
proofps_dd::Maps & maps )

Definition at line 51 of file CameraHandling.cpp.

◆ CameraHandling() [2/3]

proofps_dd::CameraHandling::CameraHandling ( const CameraHandling & )
delete

◆ CameraHandling() [3/3]

proofps_dd::CameraHandling::CameraHandling ( CameraHandling && )
delete

Member Function Documentation

◆ cameraGetPlayerConnectionHandleToFollowWhenSpectating()

const pge_network::PgeNetworkConnectionHandle & proofps_dd::CameraHandling::cameraGetPlayerConnectionHandleToFollowWhenSpectating ( ) const
Returns
Connection handle of the player who was most recently found to be spectated. Might not be valid anymore, therefore it is advised to do a sanity check with the returned value.

Definition at line 104 of file CameraHandling.cpp.

◆ cameraGetPosToFollowWhenSpectating()

PureVector & proofps_dd::CameraHandling::cameraGetPosToFollowWhenSpectating ( )

This is essentially controlled by cameraUpdatePosAndAngle() when we are in spectator mode, however it is allowed to be accessed by the user to update it in "free camera spectating view".

Definition at line 95 of file CameraHandling.cpp.

◆ cameraGetShakeForce()

PureVector & proofps_dd::CameraHandling::cameraGetShakeForce ( )
protected

Definition at line 455 of file CameraHandling.cpp.

◆ cameraGetSpectatingView()

proofps_dd::CameraHandling::SpectatingView & proofps_dd::CameraHandling::cameraGetSpectatingView ( )

Definition at line 70 of file CameraHandling.cpp.

◆ cameraInitForGameStart()

void proofps_dd::CameraHandling::cameraInitForGameStart ( )
protected

Definition at line 379 of file CameraHandling.cpp.

◆ cameraPositionToMapCenter()

void proofps_dd::CameraHandling::cameraPositionToMapCenter ( )
protected

Definition at line 388 of file CameraHandling.cpp.

◆ cameraSmoothShakeForceTowardsZero()

void proofps_dd::CameraHandling::cameraSmoothShakeForceTowardsZero ( const float & fFps)
private

Definition at line 464 of file CameraHandling.cpp.

◆ cameraToggleSpectatingView()

void proofps_dd::CameraHandling::cameraToggleSpectatingView ( )

Toggles between different camera spectating views.

Note: even if it toggles to SpectatingView::PlayerFollow view, later cameraUpdatePosAndAngleWhenSpectating() might toggle it back to SpectatingView::Free view.

Definition at line 80 of file CameraHandling.cpp.

◆ cameraUpdatePosAndAngle()

void proofps_dd::CameraHandling::cameraUpdatePosAndAngle ( pge_audio::PgeAudio & audio,
const std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > & mapPlayers,
const Player & player,
XHair & xhair,
const float & fFps,
bool bCamFollowsXHair,
bool bCamTiltingAllowed,
bool bCamRollAllowed )
protected

Definition at line 407 of file CameraHandling.cpp.

◆ cameraUpdatePosAndAngleToFollowPos()

void proofps_dd::CameraHandling::cameraUpdatePosAndAngleToFollowPos ( PureCamera & cam,
const PureVector & vecFollowPos,
const XHair & xhair,
const float & fFps,
bool bCamFollowsXHair,
bool bCamTiltingAllowed )
private

Definition at line 509 of file CameraHandling.cpp.

◆ cameraUpdatePosAndAngleWhenPlayerIsInNormalSituation()

void proofps_dd::CameraHandling::cameraUpdatePosAndAngleWhenPlayerIsInNormalSituation ( PureCamera & cam,
const Player & player,
const XHair & xhair,
const float & fFps,
bool bCamFollowsXHair,
bool bCamTiltingAllowed )
private

Definition at line 684 of file CameraHandling.cpp.

◆ cameraUpdatePosAndAngleWhenPlayerIsSomersaulting()

void proofps_dd::CameraHandling::cameraUpdatePosAndAngleWhenPlayerIsSomersaulting ( PureCamera & cam,
const Player & player )
private

Definition at line 665 of file CameraHandling.cpp.

◆ cameraUpdatePosAndAngleWhenSpectating()

void proofps_dd::CameraHandling::cameraUpdatePosAndAngleWhenSpectating ( const std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > & mapPlayers,
PureCamera & cam,
XHair & xhair,
const float & fFps,
bool bCamFollowsXHair,
bool bCamTiltingAllowed )
private

Definition at line 617 of file CameraHandling.cpp.

◆ cameraUpdateShakeFactorXY()

void proofps_dd::CameraHandling::cameraUpdateShakeFactorXY ( const float & fFps)
private

Definition at line 487 of file CameraHandling.cpp.

◆ canSpectatePlayer()

bool proofps_dd::CameraHandling::canSpectatePlayer ( const Player & player)
static

Use this function when iterating over players, to decide if we can spectate this player.

Requires the only one existing GameMode instance.

Returns
True if the given player can be spectated in PlayerFollow spectating view, false otherwise. False if there is no existing GameMode instance.

Definition at line 33 of file CameraHandling.cpp.

◆ findAnyValidPlayerToFollowInPlayerSpectatingView()

bool proofps_dd::CameraHandling::findAnyValidPlayerToFollowInPlayerSpectatingView ( const std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > & mapPlayers,
PureVector & posPlayerToFollow )

Useful when we are toggling spectating view to player follow view, or in each frame to check if followed player is still valid in player follow view.

First checks validity of already saved player to follow (who we have been following), and finds different player only if that player is not valid anymore.

If the function returns true, the following function returns valid data:

Parameters
mapPlayersList of all connected players where we are searching for a player to be spectated.
posPlayerToFollowA valid position of the player selected to be spectated. Valid only if the function returns true.
Returns
True if cameraGetPlayerConnectionHandleToFollowWhenSpectating() is still valid or another valid player has been found and cameraGetPlayerConnectionHandleToFollowWhenSpectating() has now become valid again, false otherwise. False means we cannot follow anyone, need to switch back to free camera spectating view.

Definition at line 340 of file CameraHandling.cpp.

◆ findNextValidPlayerToFollowInPlayerSpectatingView()

bool proofps_dd::CameraHandling::findNextValidPlayerToFollowInPlayerSpectatingView ( const std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > & mapPlayers)

Useful when we want to iterate to the next spectatable player in "player follow spectating view".

If the function returns true, the following function returns valid data:

Parameters
mapPlayersList of all connected players where we are searching for a player to be spectated.
Returns
True if cameraGetPlayerConnectionHandleToFollowWhenSpectating() is still valid or another valid player has been found and cameraGetPlayerConnectionHandleToFollowWhenSpectating() has now been updated, false otherwise. False means we cannot follow anyone, need to switch back to "free camera spectating view".

Definition at line 122 of file CameraHandling.cpp.

◆ findPrevValidPlayerToFollowInPlayerSpectatingView()

bool proofps_dd::CameraHandling::findPrevValidPlayerToFollowInPlayerSpectatingView ( const std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > & mapPlayers)

Useful when we want to iterate to the previous spectatable player in "player follow spectating view".

If the function returns true, the following function returns valid data:

Parameters
mapPlayersList of all connected players where we are searching for a player to be spectated.
Returns
True if cameraGetPlayerConnectionHandleToFollowWhenSpectating() is still valid or another valid player has been found and cameraGetPlayerConnectionHandleToFollowWhenSpectating() has now been updated, false otherwise. False means we cannot follow anyone, need to switch back to "free camera spectating view".

Definition at line 214 of file CameraHandling.cpp.

◆ getConsole()

CConsole & proofps_dd::CameraHandling::getConsole ( ) const

Definition at line 46 of file CameraHandling.cpp.

◆ getLoggerModuleName()

const char * proofps_dd::CameraHandling::getLoggerModuleName ( )
static

Definition at line 28 of file CameraHandling.cpp.

◆ operator=() [1/2]

CameraHandling && proofps_dd::CameraHandling::operator= ( CameraHandling && )
delete

◆ operator=() [2/2]

CameraHandling & proofps_dd::CameraHandling::operator= ( const CameraHandling & )
delete

Member Data Documentation

◆ m_connHandlePlayerToFollowInSpectatingView

pge_network::PgeNetworkConnectionHandle proofps_dd::CameraHandling::m_connHandlePlayerToFollowInSpectatingView { pge_network::ServerConnHandle }
private

Definition at line 104 of file CameraHandling.h.

◆ m_durations

Durations& proofps_dd::CameraHandling::m_durations
private

Definition at line 94 of file CameraHandling.h.

◆ m_eSpectatingView

SpectatingView proofps_dd::CameraHandling::m_eSpectatingView { SpectatingView::PlayerFollow }
private

Definition at line 103 of file CameraHandling.h.

◆ m_fCameraMinY

float proofps_dd::CameraHandling::m_fCameraMinY = 0.f
private

Definition at line 97 of file CameraHandling.h.

◆ m_fShakeDegree

float proofps_dd::CameraHandling::m_fShakeDegree = 0.f
private

Definition at line 101 of file CameraHandling.h.

◆ m_fShakeFactorX

float proofps_dd::CameraHandling::m_fShakeFactorX = 0.f
private

Definition at line 99 of file CameraHandling.h.

◆ m_fShakeFactorY

float proofps_dd::CameraHandling::m_fShakeFactorY = 0.f
private

Definition at line 100 of file CameraHandling.h.

◆ m_maps

Maps& proofps_dd::CameraHandling::m_maps
private

Definition at line 95 of file CameraHandling.h.

◆ m_pure

PR00FsUltimateRenderingEngine& proofps_dd::CameraHandling::m_pure
private

Definition at line 93 of file CameraHandling.h.

◆ m_vecCamShakeForce

PureVector proofps_dd::CameraHandling::m_vecCamShakeForce
private

Definition at line 98 of file CameraHandling.h.

◆ m_vecPosToFollowInFreeCameraView

PureVector proofps_dd::CameraHandling::m_vecPosToFollowInFreeCameraView {}
private

Definition at line 102 of file CameraHandling.h.


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