coastline 0.0.4
Loading...
Searching...
No Matches
raceview.h
Go to the documentation of this file.
1#pragma once
2
8
9#include <array>
10#include <cstdint>
11#include <filesystem>
12#include <memory>
13#include <optional>
14#include <span>
15
16class FrameSnapshot;
17
18namespace coastline {
19
20class SceneRenderer;
21
33
35class RaceView {
36public:
48 const std::filesystem::path &defaults,
49 int track,
54 RaceView(const RaceView &) = delete;
56 RaceView &operator=(const RaceView &) = delete;
57
67 void Draw(SceneRenderer &renderer, float share) const;
68
75 bool FreeCameraEnabled() const;
83 void MoveFreeCamera(float seconds,
84 const std::array<float, 3> &movement,
85 const std::array<float, 2> &rotation);
86
92
93private:
94 struct State;
95 explicit RaceView(std::unique_ptr<State> state);
96 struct CarInView;
97 void DrawView(SceneRenderer &renderer, FrameSnapshot *snapshot, int index, bool mirror) const;
98 void DrawCar(SceneRenderer &renderer, const CarInView &view) const;
100};
101
114float RaceFieldOfView(float fovy, float aspect, float scale = 1.0f);
115
116} // namespace coastline
Captured race geometry, cameras, and particles for interpolation between simulation steps.
Definition snapshot.h:18
std::array< float, 4 > ClearColor() 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.
bool FreeCameraEnabled() const
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.
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...
RaceView & operator=(const RaceView &)=delete
Prevent assignment of renderer-bound race resources.
RaceView(const RaceView &)=delete
Prevent copying renderer-bound race resources.
void ToggleFreeCamera()
Toggle a free camera initialised from the first viewport without changing race cameras.
~RaceView()
Release race rendering resources before the renderer's GPU device is destroyed.
The renderer of a frame.
Definition scenerenderer.h:467
Definition assetimport.h:11
float RaceFieldOfView(float fovy, float aspect, float scale=1.0f)
The vertical field of view of a view of the race on a frame.
The car of a vehicle of a race.
Definition raceview.h:23
int car
Definition raceview.h:24
bool otherLook
Whether the car draws in its other look, with its highlighted parts reflecting the sky in place of it...
Definition raceview.h:31
std::optional< std::filesystem::path > images
Path to a menu preview or custom-decal document supplying race images.
Definition raceview.h:28
std::array< std::uint8_t, 3 > paint
Definition raceview.h:25