#include <imgui.h>
#include <cmath>
#include <cstdint>
#include "global/types.h"
Go to the source code of this file.
|
| MatchKits | chooseMatchKits (TeamID homeTeam, TeamID awayTeam) |
| |
| MatchKits | chooseMatchKits (TeamID homeTeam, TeamID awayTeam, const ClubColours *homeColours, const ClubColours *awayColours) |
| |
| const ClubIdentity * | findClubIdentity (TeamID team) |
| |
| constexpr ImU32 | kitColorFromRgb (std::uint32_t rgb) |
| |
| float | kitColorDistance (ImU32 first, ImU32 second) |
| |
| ImU32 | kitNumberColor (const KitColors &kit) |
| |
| ImU32 | goalkeeperGloveColor (const KitColors &kit) |
| |
| ImU32 | shadeColor (ImU32 color, float factor) |
| |
| ImU32 | mixColor (ImU32 first, ImU32 second, float t) |
| |
| constexpr ImU32 | mixColor256 (ImU32 first, ImU32 second, std::uint32_t t256) |
| |
| constexpr ImU32 | shadeColor256 (ImU32 color, std::uint32_t factor256) |
| |
| constexpr ImU32 | withAlpha (ImU32 color, std::uint8_t alpha) |
| |
| constexpr std::uint32_t | cosmeticHash (std::uint32_t value) |
| |
◆ chooseMatchKits() [1/2]
Picks the strips of a match. Clubs with colours in the data pack wear them (primary shirt, secondary trim and shorts); others get a deterministic original strip from their id. The away side switches to its reversed colours, then to a change strip, when its shirt is too close to the home shirt, and both goalkeepers wear colours distinct from every outfield shirt and from each other. Every view (2D, 3D, HUD swatches) uses this so a club always looks the same.
◆ chooseMatchKits() [2/2]
Same, with explicit club colours (null: the hashed original strip).
◆ cosmeticHash()
| constexpr std::uint32_t cosmeticHash |
( |
std::uint32_t |
value | ) |
|
|
constexpr |
Small deterministic integer hash shared by the 3D view's cosmetics.
◆ findClubIdentity()
The club's data-pack identity (short name, colours, stadium), read once per process and cached; null for clubs the pack does not describe.
◆ goalkeeperGloveColor()
| ImU32 goalkeeperGloveColor |
( |
const KitColors & |
kit | ) |
|
Goalkeeper gloves: the stock colour that stands out most on the shirt.
◆ kitColorDistance()
| float kitColorDistance |
( |
ImU32 |
first, |
|
|
ImU32 |
second |
|
) |
| |
Perceptual ("redmean") RGB distance between two packed colours.
◆ kitColorFromRgb()
| constexpr ImU32 kitColorFromRgb |
( |
std::uint32_t |
rgb | ) |
|
|
constexpr |
Converts a 0xRRGGBB colour to an opaque IM_COL32.
◆ kitNumberColor()
| ImU32 kitNumberColor |
( |
const KitColors & |
kit | ) |
|
Colour of the numbers and names printed on a shirt: the trim when it contrasts with the shirt, otherwise white or near-black, whichever stands out more.
◆ mixColor()
| ImU32 mixColor |
( |
ImU32 |
first, |
|
|
ImU32 |
second, |
|
|
float |
t |
|
) |
| |
|
inline |
Linear blend of two packed colours (alpha included).
◆ mixColor256()
| constexpr ImU32 mixColor256 |
( |
ImU32 |
first, |
|
|
ImU32 |
second, |
|
|
std::uint32_t |
t256 |
|
) |
| |
|
constexpr |
Integer versions for hot loops: blend with t256 in 0..256 and scale the RGB channels by factor256 / 256 (at most 2x, clamped at 255).
◆ shadeColor()
| ImU32 shadeColor |
( |
ImU32 |
color, |
|
|
float |
factor |
|
) |
| |
|
inline |
Scales the RGB channels of a packed colour, keeping its alpha.
◆ shadeColor256()
| constexpr ImU32 shadeColor256 |
( |
ImU32 |
color, |
|
|
std::uint32_t |
factor256 |
|
) |
| |
|
constexpr |
◆ withAlpha()
| constexpr ImU32 withAlpha |
( |
ImU32 |
color, |
|
|
std::uint8_t |
alpha |
|
) |
| |
|
constexpr |
Replaces the alpha channel of a packed colour.
◆ KIT_CLASH_DISTANCE
| constexpr float KIT_CLASH_DISTANCE = 190.0f |
|
inlineconstexpr |
Minimum kitColorDistance treated as a readable contrast.