Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
TextVertexFormat.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
3#pragma once
4
6
7namespace esengine {
8
9// JS/native text submission: x, y, u, v, r, g, b, a, sdfBias.
10// The boundary validator and the renderer must consume the same stride.
11inline constexpr i32 TEXT_VERTEX_FLOATS = 9;
12
15enum class TextGlyphMode : u8 {
16 Color = 0,
17 Sdf = 1,
18 Mask = 2,
19 Fill = 3,
20};
21
24 return raw >= 0 && raw <= static_cast<i32>(TextGlyphMode::Fill) ? static_cast<TextGlyphMode>(raw) : TextGlyphMode::Color;
25}
26
27} // namespace esengine
Core type definitions and utilities for ESEngine.
TextGlyphMode textGlyphModeFromRaw(i32 raw)
The mode a raw script-side value names; anything out of range is Color, the draw that cannot be wrong...
std::int32_t i32
Signed 32-bit integer.
Definition Types.hpp:54
constexpr i32 TEXT_VERTEX_FLOATS
std::uint8_t u8
Unsigned 8-bit integer.
Definition Types.hpp:41
@ Mask
Alpha alone is coverage and the page's colour is ignored: the silhouette of a glyph whose outline is ...
@ Sdf
Alpha is a signed distance; coverage is derived from it, and sdfBias grows the glyph (an outline pass...
@ Color
The page's RGBA, tinted: a rasterized atlas that carries native-AA coverage in alpha,...
@ Fill
Red x alpha is coverage: the glyph proper of that page. Mask underneath and Fill on top is the outlin...