coastline 0.0.4
Loading...
Searching...
No Matches
coastline::RaceView Class Reference

The models of the track and the cars of a race, and their drawing from the state of the race. More...

#include <raceview.h>

Public Member Functions

 ~RaceView ()
 Release race rendering resources before the renderer's GPU device is destroyed.
 RaceView (const RaceView &)=delete
 Prevent copying renderer-bound race resources.
RaceView & operator= (const RaceView &)=delete
 Prevent assignment of renderer-bound race resources.
void Draw (SceneRenderer &renderer, float share) const
 Draw each view of the race from the active camera of its vehicle, the views laid out as the race lays them out, blended between the last two frames of the race as the PC release blends them, and the HUD of each view over it.
void ToggleFreeCamera ()
 Toggle a free camera initialised from the first viewport without changing race cameras.
bool FreeCameraEnabled () const
void MoveFreeCamera (float seconds, const std::array< float, 3 > &movement, const std::array< float, 2 > &rotation)
 Move the free camera independently of simulation time, including while paused.
std::array< float, 4 > ClearColor () const

Static Public Member Functions

static std::unique_ptr< RaceView > Load (SceneRenderer &renderer, const std::filesystem::path &defaults, int track, std::span< const RaceCar > cars)
 Read the models of a track and the cars of the import.

Detailed Description

The models of the track and the cars of a race, and their drawing from the state of the race.

Constructor & Destructor Documentation

◆ ~RaceView()

coastline::RaceView::~RaceView ( )

Release race rendering resources before the renderer's GPU device is destroyed.

◆ RaceView()

coastline::RaceView::RaceView ( const RaceView & )
delete

Prevent copying renderer-bound race resources.

Member Function Documentation

◆ Load()

std::unique_ptr< RaceView > coastline::RaceView::Load ( SceneRenderer & renderer,
const std::filesystem::path & defaults,
int track,
std::span< const RaceCar > cars )
static

Read the models of a track and the cars of the import.

Parameters
rendererThe renderer that draws them.
defaultsThe directory of the assets of the selected pack.
trackThe track, an index of g_apszTrackFilenames.
carsThe car of each vehicle of the race, from the first. A vehicle that takes another car or colour during the race loads it as it is drawn.
Returns
The view, or nothing with the reason logged.

◆ operator=()

RaceView & coastline::RaceView::operator= ( const RaceView & )
delete

Prevent assignment of renderer-bound race resources.

◆ Draw()

void coastline::RaceView::Draw ( SceneRenderer & renderer,
float share ) const

Draw each view of the race from the active camera of its vehicle, the views laid out as the race lays them out, blended between the last two frames of the race as the PC release blends them, and the HUD of each view over it.

Parameters
rendererThe renderer of the frame, between Begin() and End().
shareHow far the frame is from the previous frame of the race to the current one, from 0 to 1.

◆ ToggleFreeCamera()

void coastline::RaceView::ToggleFreeCamera ( )

Toggle a free camera initialised from the first viewport without changing race cameras.

Enabling requires an active camera in the first viewport.

◆ FreeCameraEnabled()

bool coastline::RaceView::FreeCameraEnabled ( ) const
Returns
Whether the free camera replaces the first viewport and hides the HUD.

◆ MoveFreeCamera()

void coastline::RaceView::MoveFreeCamera ( float seconds,
const std::array< float, 3 > & movement,
const std::array< float, 2 > & rotation )

Move the free camera independently of simulation time, including while paused.

Parameters
secondsFrame duration in seconds, clamped to [0, 0.1].
movementForward, rightward, and upward motion in world units per second.
rotationYaw and pitch changes in radians for this frame.

◆ ClearColor()

std::array< float, 4 > coastline::RaceView::ClearColor ( ) const
Returns
The colour the frame clears to: the fog of the race in a single view, and black around the views of a split screen.

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