49 std::array<uint32_t, kMaxStyles>
styles {};
50 std::array<float, kMaxStyles>
weights { 1.0f, 0.0f, 0.0f, 0.0f };
57 if (from == to || t >= 1.0f)
return Single(to);
58 if (t <= 0.0f)
return Single(from);
61 b.
styles = t >= 0.5f ? std::array<uint32_t, kMaxStyles>{ to, from } : std::array<uint32_t, kMaxStyles>{ from, to };
62 b.
weights = t >= 0.5f ? std::array<float, kMaxStyles>{ t, 1.0f - t } : std::array<float, kMaxStyles>{ 1.0f - t, t };
70 for (
int i = 0; i <
count; ++i)
71 if (
styles[
size_t(i)] == style)
100 uint32_t fromStyleIndex, uint32_t toStyleIndex,
float blendT,
153 virtual void RenderGlyph(
tachyon::float2 pos,
tachyon::float2 size,
tachyon::float2 uvMin,
tachyon::float2 uvMax,
float scale,
int bpp,
int mode,
VisualColorStyleIndex textColorIndex,
tachyon::IntRect clipRect,
tachyon::ImageIndex textureIndex =
tachyon::ImageIndex::Invalid,
float shadowBlur = -1.0f) = 0;
169 g.bpp, g.mode, g.color, clipRect, g.textureIndex);
Definition gui_renderer.h:78
virtual void StopResizing()=0
virtual void RenderBox(tachyon::IntRect rect, tachyon::IntRect clipRect, const StyleBlend &styles, tachyon::VisualColorStyleIndex colorStyleIndex={}, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, tachyon::IntRect snappedPx={})=0
Draws a styled box, styles mixed.
void RenderLine(tachyon::int2 p0, tachyon::int2 p1, tachyon::IntRect clipRect, const LineStyle &lineStyle)
Definition gui_renderer.h:120
void RenderBox(tachyon::IntRect rect, tachyon::IntRect clipRect, VisualBoxStyleIndex boxStyleIndex, tachyon::ElementState state, tachyon::VisualColorStyleIndex colorStyleIndex={}, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, tachyon::IntRect snappedPx={})
virtual bool DrawsChanged(ID) const
Whether the window's draws this frame differ from its last frame's (as of its EndWindow); true when t...
Definition gui_renderer.h:196
virtual void InvalidateScopeCapture(ID)
Drops the capture of scopeId.
Definition gui_renderer.h:211
virtual bool BeginWindow(ID id)=0
virtual void RenderQuad(tachyon::IntRect rect, tachyon::IntRect clipRect, tachyon::VisualColorStyleIndex colorStyleIndex, float cornerRadius=0.0f, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, const tachyon::UVRect &uv={}, const tachyon::ImageDisplay &display={})=0
Draws a filled, optionally rounded and textured rect: a box without borders, style blending or elemen...
virtual void RenderGlyph(tachyon::float2 pos, tachyon::float2 size, tachyon::float2 uvMin, tachyon::float2 uvMax, float scale, int bpp, int mode, VisualColorStyleIndex textColorIndex, tachyon::IntRect clipRect, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, float shadowBlur=-1.0f)=0
A glyph from the text atlas.
virtual void RenderGlyphs(std::span< const GlyphInstance > glyphs, tachyon::float2 offset, tachyon::IntRect clipRect)
RenderGlyph for each of glyphs, moved by offset, in order: a text's glyphs at once.
Definition gui_renderer.h:165
virtual void RenderDot(tachyon::float2 pos, tachyon::IntRect clipRect, float size, tachyon::color4f color)=0
virtual void SetOpacity(float)
How opaque what is drawn from now on is, 0 to 1 (1 until set).
Definition gui_renderer.h:88
virtual void RenderLine(tachyon::int2 p0, tachyon::int2 p1, tachyon::int2 p2, tachyon::int2 p3, tachyon::IntRect clipRect, const LineStyle &lineStyle)=0
virtual void EndScopeCapture(ID)
Ends the capture of scopeId and draws it into the current window.
Definition gui_renderer.h:205
void RenderFilledPolygon(std::span< const tachyon::float2 > points, tachyon::IntRect clipRect, VisualColorStyleIndex colorIndex, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid)
Convex polygon, fan-triangulated from points[0]; needs at least 3 points.
virtual void BeginScopeCapture(ID)
Starts recording primitives under scopeId, replacing its previous capture.
Definition gui_renderer.h:203
virtual bool HasScopeCapture(ID) const
True when scopeId has a non-empty capture.
Definition gui_renderer.h:209
virtual void SetTransform(tachyon::float3x2 transformation)=0
virtual ~GUIRenderer()
Definition gui_renderer.h:80
virtual void RenderShadow(tachyon::IntRect rect, tachyon::IntRect clipRect, tachyon::VisualColorStyleIndex colorStyleIndex, float cornerRadius, int blur)=0
A box shadow: rect is the shadow's shape, which fades out over blur pixels on either side of its edge...
virtual void RenderDots(std::span< const tachyon::float2 > positions, tachyon::IntRect clipRect, float size, tachyon::color4f color)
RenderDot at each of positions, in order, all alike.
Definition gui_renderer.h:129
virtual void EndWindow()=0
static uint32_t StyleIndex(VisualBoxStyleIndex boxStyleIndex, tachyon::ElementState state)
The flat GPU style index of boxStyleIndex in state, as RenderBox takes it.
void RenderArc(tachyon::float2 center, float radius, float width, float startTurns, float sweepTurns, tachyon::IntRect clipRect, VisualColorStyleIndex colorIndex)
Part of a ring width wide, centred on the circle of radius around center, with round ends.
virtual void RenderCircle(tachyon::float2 center, float radius, tachyon::IntRect clipRect, const LineStyle &lineStyle)=0
A circle outline lineStyle.lineWidth wide, exactly round.
virtual void RenderOccluder(tachyon::IntRect, tachyon::IntRect)
Draws nothing: marks rect as covered by opaque content drawn after this call, so what was drawn befor...
Definition gui_renderer.h:147
virtual bool StartResizing(ID id)=0
virtual void ClearScopeCaptures()
Drops every capture.
Definition gui_renderer.h:213
void RenderBox(tachyon::IntRect rect, tachyon::IntRect clipRect, VisualBoxStyleIndex boxStyleIndex, tachyon::VisualColorStyleIndex colorStyleIndex={}, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, tachyon::IntRect snappedPx={})
void RenderBox(tachyon::IntRect rect, tachyon::IntRect clipRect, uint32_t fromStyleIndex, uint32_t toStyleIndex, float blendT, tachyon::VisualColorStyleIndex colorStyleIndex={}, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, tachyon::IntRect snappedPx={})
As above, blended from fromStyleIndex to toStyleIndex (flat GPU style indices) by blendT in [0,...
Definition gui_renderer.h:99
void RenderPolyline(std::span< const tachyon::int2 > points, bool closed, tachyon::IntRect clipRect, const LineStyle &style)
Outlined polyline; closed adds a segment from the last point back to the first.
virtual void RenderTriangle(tachyon::float2 p0, tachyon::float2 p1, tachyon::float2 p2, tachyon::IntRect clipRect, tachyon::VisualColorStyleIndex colorStyleIndex, tachyon::ImageIndex textureIndex=tachyon::ImageIndex::Invalid, TriangleEdges hardEdges=TriangleEdges::None)=0
A filled triangle.
virtual bool ReplayScopeCapture(ID, tachyon::int2)
Draws the capture of scopeId again, moved by delta pixels; false if there is none.
Definition gui_renderer.h:207
@ None
Definition gui_element_flags.h:18
TriangleEdges
A triangle's edges, for the ones drawn without a soft edge: where it meets another triangle of the sa...
Definition gui_renderer.h:24
ImageIndex
Index of an image in the graphics context's image set, as the shaders sample it.
Definition gui_image.h:99
@ Edge01
p0 to p1
Definition gui_renderer.h:26
@ Edge20
p2 to p0
Definition gui_renderer.h:28
@ None
Definition gui_renderer.h:25
@ Edge12
p1 to p2
Definition gui_renderer.h:27
@ Invalid
Definition gui_image.h:99
VisualColorStyleIndex
Index into StyleManager's color style pool; Invalid (0) draws nothing (transparent).
Definition gui_style.h:33
VisualBoxStyleIndex
Index into StyleManager's visual box style pool; Invalid (0) = none.
Definition gui_style_ref.h:17
ElementState
Interaction state bits of an element; they pick the Style::states variant it draws with.
Definition gui_style.h:42
#define TACHYON_ENUM_OPERATORS(EnumType)
Definition gui_enum_operators.h:8
Definition gui_logging.h:24
One glyph of RenderGlyphs: RenderGlyph's arguments, its position relative.
Definition gui_renderer.h:157
tachyon::float2 uvMin
Definition gui_renderer.h:158
uint16_t bpp
Definition gui_renderer.h:160
tachyon::ImageIndex textureIndex
Definition gui_renderer.h:161
tachyon::float2 uvMax
Definition gui_renderer.h:158
tachyon::float2 size
Definition gui_renderer.h:158
uint16_t mode
Definition gui_renderer.h:160
float scale
Definition gui_renderer.h:159
VisualColorStyleIndex color
Definition gui_renderer.h:162
tachyon::float2 pos
Definition gui_renderer.h:158
A 64-bit element ID whose bit layout depends on its IDMode.
Definition gui_id.h:23
How an image is shown, in this order:
Definition gui_image.h:42
Definition gui_base_types.h:406
Definition gui_renderer.h:33
float gradientScale
fraction of gradient to cover
Definition gui_renderer.h:40
float dashOffset
Definition gui_renderer.h:38
float gradientOffset
start of gradient range [0,1]
Definition gui_renderer.h:39
float dashSize
Definition gui_renderer.h:37
float lineWidth
Definition gui_renderer.h:36
VisualColorStyleIndex colorStyleIndex
Defaults to VisualColorStyleIndex::Invalid.
Definition gui_renderer.h:35
A box's look as a mix of up to four of its state styles (flat GPU style indices, as GUIRenderer::Styl...
Definition gui_renderer.h:47
std::array< uint32_t, kMaxStyles > styles
Definition gui_renderer.h:49
static constexpr int kMaxStyles
Definition gui_renderer.h:48
static StyleBlend Between(uint32_t from, uint32_t to, float t)
from mixed with to, t (0 to 1) of the way to to.
Definition gui_renderer.h:55
bool IsBlending() const
Definition gui_renderer.h:65
std::array< float, kMaxStyles > weights
Definition gui_renderer.h:50
uint8_t count
Definition gui_renderer.h:51
static StyleBlend Single(uint32_t style)
Definition gui_renderer.h:53
float WeightOf(uint32_t style) const
The share of style; 0 when it isn't in the mix.
Definition gui_renderer.h:67
The part of an image to draw, in UV: 0,0 is its top-left corner and 1,1 its bottom-right.
Definition gui_image.h:15
Definition gui_base_types.h:394
Definition gui_base_types.h:120
float y
Definition gui_base_types.h:121
float x
Definition gui_base_types.h:121
2D affine transform matrix (2 rows x 3 columns): x' = r0.x*x + r0.y*y + r0.z y' = r1....
Definition gui_base_types.h:218
Integer 2D vector.
Definition gui_base_types.h:18