coastline 0.0.4
Loading...
Searching...
No Matches
frontend.h File Reference

The space, the fades, and the sounds the splash screens and the menus of the console share. More...

#include <array>
#include <cstdint>
#include <filesystem>
#include <optional>
#include <string_view>
#include <vector>
#include <SDL3/SDL.h>
#include <nlohmann/json.hpp>
#include "common/audio.h"
#include "scenerenderer.h"
Include dependency graph for frontend.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  coastline::StageVertex
 A vertex of a shaded triangle of a stage: its place and its colour. More...
struct  coastline::ScreenFade
 The fade of the screen: a wipe whose level goes to its target at a rate, and the edges of the picture it shows, in pixels of the 320 by 240 screen. More...

Namespaces

namespace  coastline

Functions

constexpr std::uint32_t coastline::SfxVolume (std::uint32_t right, std::uint32_t left)
constexpr std::array< std::uint32_t, 2 > coastline::CombineLerp (std::uint32_t a0, std::uint32_t b0, std::uint32_t c0, std::uint32_t d0, std::uint32_t alphaA0, std::uint32_t alphaB0, std::uint32_t alphaC0, std::uint32_t alphaD0, std::uint32_t a1, std::uint32_t b1, std::uint32_t c1, std::uint32_t d1, std::uint32_t alphaA1, std::uint32_t alphaB1, std::uint32_t alphaC1, std::uint32_t alphaD1)
 The two words of gDPSetCombineLERP(), from the colour and alpha inputs of each cycle.
Matrix4 coastline::Translation (float x, float y, float z)
Matrix4 coastline::Scale (float s)
Matrix4 coastline::RotationX (float angle)
Matrix4 coastline::RotationZ (float angle)
std::array< float, 2 > coastline::ScreenExtent (float aspect)
 The part of the frame the 4:3 screen of the menus covers, centred: the whole height of a frame wider than 4:3 and the whole width of a narrower one.
Matrix4 coastline::MenuProjection (float aspect, float nearPlane, float farPlane, const std::optional< Matrix4 > &camera=std::nullopt)
 The camera of the menus, which looks at the middle of the 320 by 240 screen from 290 in front of it with a field of 45 degrees, onto the 4:3 screen centred in the frame, to a depth from 0 to 1.
Matrix4 coastline::FlatProjection (float aspect)
Matrix4 coastline::ScreenModelAt (float x, float y, float z, float angle, float scale)
 DrawModelAt() of the console: a model turned about its own axis, scaled, stood up, and placed.
Matrix4 coastline::StageCamera (float aspect, const std::array< float, 3 > &eye, int x, int y, int width, int height, const std::optional< Matrix4 > &camera=std::nullopt)
 SetupCameraMatrix() of the console for the trackside camera of a stage of the menus.
Matrix4 coastline::StageFrameAt (float x, float y, float angle)
 The frame of a car on a stage of the menus in the space of the console, facing an angle about z, 0.254 above the stage.
Matrix4 coastline::StageCarAt (float x, float y, float angle)
 The place of a car on a stage of the menus, facing an angle about z, 0.254 above the stage.
Reflection coastline::StageReflection (const RenderTexture *texture, const std::array< float, 3 > &eye)
 The reflection of the sky on a car as RenderVehicleModel() sets it up for the trackside camera of the menus looking at the origin from an eye: the axes of guLookAtReflectF() from the heading of the camera, and the window of the tile turning with the heading.
void coastline::AddTriangle (std::vector< FlatVertex > &quads, const StageVertex &a, const StageVertex &b, const StageVertex &c)
 Add a shaded triangle to flat quads, as a quad whose last corner repeats its third.
SDL_Rect coastline::FrameRect (Uint32 frameWidth, Uint32 frameHeight, int x, int y, int width, int height)
Lighting coastline::ReadLighting (const nlohmann::json &light)
std::optional< std::vector< s8 > > coastline::ReadSound (const std::filesystem::path &path)
s16 coastline::PlaySoundEffect (std::vector< s8 > &sample, std::uint32_t volume)
 Play a sound on a free sound effect channel.

Variables

constexpr float coastline::HALF_PI = 1.570796371f
 A quarter turn in radians, in the single precision of the console.
constexpr float coastline::PI = 3.141592741f
 A half turn in radians, in the single precision of the console.
constexpr float coastline::TWO_PI = 6.283185482f
 A whole turn in radians, in the single precision of the console.
constexpr float coastline::SCREEN_WIDTH = 320.0f
 The low-resolution screen of the console, in pixels.
constexpr float coastline::SCREEN_HEIGHT = 240.0f
 The height of the low-resolution console screen, in pixels.
constexpr std::size_t coastline::SOUND_PADDING = 0x100
 The silence after each sound, for the mixer to read zeros past its end.
constexpr std::uint64_t coastline::SFX_STEP_ONE = 1ull << 32
 The 32.32 step that plays a sample at its own rate.
constexpr u8 coastline::MAX_SFX_VOLUME = 0xFF
 The volume of the sound effects at full level.
constexpr std::uint32_t coastline::COMBINED = 0
 The previous cycle's result as an RDP colour-combiner input.
constexpr std::uint32_t coastline::TEXEL0 = 1
 The first sampled texel as an RDP colour-combiner input.
constexpr std::uint32_t coastline::TEXEL1 = 2
 The second sampled texel as an RDP colour-combiner input.
constexpr std::uint32_t coastline::PRIMITIVE = 3
 The primitive colour as an RDP colour-combiner input.
constexpr std::uint32_t coastline::SHADE = 4
 The interpolated vertex colour as an RDP colour-combiner input.
constexpr std::uint32_t coastline::ENVIRONMENT = 5
 The environment colour as an RDP colour-combiner input.
constexpr std::uint32_t coastline::ZERO_AB = 15
 The zero selector for the A and B RDP colour-combiner operands.
constexpr std::uint32_t coastline::ZERO_D = 7
 The zero selector for the D RDP colour-combiner operand.
constexpr std::uint32_t coastline::ZERO_ALPHA = 7
 The zero selector for an RDP alpha-combiner operand.
constexpr std::array< std::string_view, 7 > coastline::STAGE_CAR_PARTS
 The parts of a car RenderVehicleModel() draws in the menus: the near detail, the textured parts, the painted body, and the normal wheels.
const Lighting coastline::STAGE_CAR_LIGHTING
 The lights RenderVehicleModel() lights a car with in the menus: g_DefaultLights, from (84, 84, 84), in the colours of SetupWeatherLights() in clear weather.

Detailed Description

The space, the fades, and the sounds the splash screens and the menus of the console share.