MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ vertices()

std::vector< Kakshya::MeshVertex > MayaFlux::Portal::Text::TextRun::vertices ( const GlyphMap &  map,
uint32_t  slot 
)

Vertices for the background, if any, then every glyph.

Parameters
mapLayout pixels to output space.
slotAtlas image slot in the shader's texture array.

Definition at line 86 of file TextRun.cpp.

87{
88 if (stale()) {
90 }
91
92 std::vector<Kakshya::MeshVertex> out;
93
94 if (m_params.background.a > 0.F) {
95 const glm::vec2 a = map({ 0.F, 0.F });
96 const glm::vec2 b = map(extent());
97 const auto quad = Kinesis::textured_mesh_rect(
98 { .min = glm::min(a, b), .max = glm::max(a, b) },
99 0.F, glm::vec3(m_params.background));
100 out.insert(out.end(), quad.begin(), quad.end());
101 }
102
103 const auto glyphs = glyph_vertices(m_layout.quads, m_params.color, m_params.spans, map, slot);
104 out.insert(out.end(), glyphs.begin(), glyphs.end());
105 return out;
106}
size_t a
size_t b
std::vector< float > * out
glm::vec2 extent() const
Size in pixels the run is drawn at.
Definition TextRun.cpp:68
bool stale() const
True when the atlas the layout was built against has since been replaced or has grown,...
Definition TextRun.cpp:43
std::array< Kakshya::MeshVertex, 6 > textured_mesh_rect(Kinesis::AABB2D region, float weight, glm::vec3 color)
Generate a UV-mapped TRIANGLE_LIST quad (6 vertices, 2 triangles) from an AABB2D, as Kakshya::MeshVer...
constexpr T map(T x, T in_lo, T in_hi, T out_lo, T out_hi) noexcept
Map x from [in_lo, in_hi] to [out_lo, out_hi], unclamped.
Definition Scalar.hpp:18
std::vector< Kakshya::MeshVertex > glyph_vertices(std::span< const GlyphQuad > quads, glm::vec4 color, std::span< const StyleSpan > spans, const GlyphMap &map, uint32_t slot)
Triangle list vertices for glyph quads, six per quad.
Definition GlyphMesh.cpp:14
std::vector< GlyphQuad > quads
glm::vec4 color
RGBA color applied to all glyphs not covered by a span in spans.
Definition InkPress.hpp:70
std::vector< StyleSpan > spans
Optional per-byte-range color overrides. Empty applies color uniformly.
Definition InkPress.hpp:94
glm::vec4 background
RGBA fill composited beneath every glyph.
Definition InkPress.hpp:84

References a, b, MayaFlux::Portal::Text::PressParams::background, MayaFlux::Portal::Text::PressParams::color, extent(), MayaFlux::Portal::Text::glyph_vertices(), lay_out_text(), m_layout, m_params, out, MayaFlux::Portal::Text::LayoutResult::quads, MayaFlux::Portal::Text::PressParams::spans, stale(), and MayaFlux::Kinesis::textured_mesh_rect().

Referenced by MayaFlux::Portal::Forma::internal::TextSlice::refresh().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: