Player12
An open source football management simulator
Loading...
Searching...
No Matches
MatchCamera3D Class Reference

#include <match_camera_3d.h>

Classes

struct  Rig
 

Public Member Functions

void update (const MatchCameraFocus &focus, MatchCameraMode mode, const MatchCameraControl &control, float deltaSeconds)
 
void snap (const MatchCameraFocus &focus, MatchCameraMode mode)
 
RenderMath::Vec3 eye () const
 
RenderMath::Vec3 target () const
 
float verticalFov () const
 
float zoom () const
 
float yaw () const
 
float pitch () const
 
float distance () const
 
RenderMath::Vec3 freeTarget () const
 
float freePitch () const
 
float freeDistance () const
 
MatchDirectorShot directorShot () const
 
int directorCuts () const
 

Private Member Functions

Rig desiredRig (const MatchCameraFocus &focus, MatchCameraMode mode) const
 
Rig directorRig (const MatchCameraFocus &focus) const
 
bool direct (const MatchCameraFocus &focus, float deltaSeconds)
 
void steerFree (const MatchCameraFocus &focus, const MatchCameraControl &control)
 

Private Attributes

Rig current
 
Rig freeRig
 
float zoomFactor = 1.0f
 
float chaseYaw = 0.0f
 
bool initialized = false
 
bool freeActive = false
 
MatchDirectorShot shot = MatchDirectorShot::BROADCAST
 
int cuts = 0
 
float shotSeconds = 0.0f
 
float sinceReverse = 1e6f
 
float sinceGoalLine = 1e6f
 
float attackSeconds = 0.0f
 
float goalLineX = 0.0f
 

Detailed Description

Smoothly damped orbit camera with broadcast, tactical, end and chase presets, a user-driven free orbit camera and a TV director.

The camera is described by a look-at target plus yaw, pitch, distance and vertical field of view. Each preset produces a desired rig from the focus and every parameter is damped exponentially with real frame time, so the motion is identical at any frame rate and mode switches glide instead of cutting. The free camera starts from whatever pose was on screen when it was selected, so a drag in any preset takes over seamlessly; its pitch, distance and target are clamped so it never dips under the pitch, leaves the stadium bowl or loses the pitch.

The director stays on the broadcast camera and cuts (never glides) to a reverse angle while an attack builds in the final third, to a goal-line view for shots and to a close-up of a goal celebration, each with a minimum hold and a cooldown. With reduced motion it keeps the broadcast camera throughout.

Member Function Documentation

◆ desiredRig()

MatchCamera3D::Rig MatchCamera3D::desiredRig ( const MatchCameraFocus &  focus,
MatchCameraMode  mode 
) const
private

◆ direct()

bool MatchCamera3D::direct ( const MatchCameraFocus &  focus,
float  deltaSeconds 
)
private

Picks the director's shot; true when it cut to a new one.

◆ directorCuts()

int MatchCamera3D::directorCuts ( ) const
inline

◆ directorRig()

MatchCamera3D::Rig MatchCamera3D::directorRig ( const MatchCameraFocus &  focus) const
private

◆ directorShot()

MatchDirectorShot MatchCamera3D::directorShot ( ) const
inline

The director's current shot and how many cuts it has made.

◆ distance()

float MatchCamera3D::distance ( ) const
inline

◆ eye()

Vec3 MatchCamera3D::eye ( ) const

◆ freeDistance()

float MatchCamera3D::freeDistance ( ) const
inline

◆ freePitch()

float MatchCamera3D::freePitch ( ) const
inline

◆ freeTarget()

RenderMath::Vec3 MatchCamera3D::freeTarget ( ) const
inline

Where the free camera is heading (after clamps), for tests.

◆ pitch()

float MatchCamera3D::pitch ( ) const
inline

◆ snap()

void MatchCamera3D::snap ( const MatchCameraFocus &  focus,
MatchCameraMode  mode 
)

Jumps straight to the desired framing (first frame, tests).

◆ steerFree()

void MatchCamera3D::steerFree ( const MatchCameraFocus &  focus,
const MatchCameraControl &  control 
)
private

Applies one frame of user control to the free rig and clamps it.

◆ target()

RenderMath::Vec3 MatchCamera3D::target ( ) const
inline

◆ update()

void MatchCamera3D::update ( const MatchCameraFocus &  focus,
MatchCameraMode  mode,
const MatchCameraControl &  control,
float  deltaSeconds 
)

Advances the camera towards the preset's desired framing.

◆ verticalFov()

float MatchCamera3D::verticalFov ( ) const
inline

◆ yaw()

float MatchCamera3D::yaw ( ) const
inline

Current orbit parameters (radians, metres).

◆ zoom()

float MatchCamera3D::zoom ( ) const
inline

Member Data Documentation

◆ attackSeconds

float MatchCamera3D::attackSeconds = 0.0f
private

◆ chaseYaw

float MatchCamera3D::chaseYaw = 0.0f
private

◆ current

Rig MatchCamera3D::current
private

◆ cuts

int MatchCamera3D::cuts = 0
private

◆ freeActive

bool MatchCamera3D::freeActive = false
private

◆ freeRig

Rig MatchCamera3D::freeRig
private

Desired pose of the free camera (the user's, before bowl clamping).

◆ goalLineX

float MatchCamera3D::goalLineX = 0.0f
private

Goal line (x) the goal-line camera watches.

◆ initialized

bool MatchCamera3D::initialized = false
private

◆ shot

MatchDirectorShot MatchCamera3D::shot = MatchDirectorShot::BROADCAST
private

◆ shotSeconds

float MatchCamera3D::shotSeconds = 0.0f
private

◆ sinceGoalLine

float MatchCamera3D::sinceGoalLine = 1e6f
private

◆ sinceReverse

float MatchCamera3D::sinceReverse = 1e6f
private

◆ zoomFactor

float MatchCamera3D::zoomFactor = 1.0f
private

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