Untitled
Loading...
Searching...
No Matches
text.vert
Go to the documentation of this file.
1
2#version 430 core
3
4
5struct TextBox {
6
7 uint visible;
8 uint hovered;
9 uint shadow;
12 uint mask;
14 uint state;
15 uint pad0;
16 uint pad1;
17 uint pad2;
21
22};
23
24
25layout(std430, binding = 8) buffer TextBoxData{
26
27 TextBox boxes[];
28
29};
30
55
56
57layout(std430, binding = 9) buffer UIData {
58
59 UIElement elements[];
60
61};
62
63
64
65layout(location = 0) in vec2 aPosition;
66layout(location = 1) in vec2 aUV;
67layout(location = 2) in vec2 aCenter;
68layout(location = 3) in vec4 aColor;
69layout(location = 4) in vec4 aFill;
70layout(location = 5) in uint aState;
71layout(location = 6) in uint aUID;
72
76flat out uint vState;
77flat out uint vHovered;
79flat out uint vShadow;
80uniform uint uShadowPass;
81flat out vec2 vCenter;
83flat out uint vVisible;
85flat out vec4 vContPos;
87flat out vec2 vContSize;
88flat out uint vContType;
89flat out uint vMask;
90flat out vec4 vPadding;
91flat out float vContRadius;
92
93uniform mat4 uOrtho;
94
95void main() {
96 TextBox b = boxes[aUID];
97 vColor = aColor;
98 vState = b.state;
99 vFill = aFill;
100 vHovered = b.hovered;
102 vShadow = b.shadow;
103 vCenter = aCenter;
104
105 vVisible = b.visible;
106 vec2 pos = aPosition;
107 vec2 uv = vec2(aUV.xy);
108 vUV = clamp(uv, 0.0, 1.0);
109 vPos = pos;
110
111 vScreenPos = b.model * vec4(pos, 0.0, 1.0);
112 // minor issue here might be if container id is stale and points to garbage but we only check for -1
113 if (b.container_id != -1 && b.mask == 1)
114 {
115
116 UIElement c = elements[b.container_id];
117 vContPos = c.model * vec4(c.pos, 0.0, 1.0);
118 vPadding = c.padding;
120 vContSize = c.size;
121 vContType = c.type;
122 vMask = 1;
123 vContScale = c.scale;
124 }
125 else
126 {
127 vMask = 0;
128 }
129
130 if (uShadowPass == 1)
131 {
132 pos += b.shadow_dir * b.shadow_dist;
133 }
134 gl_Position = uOrtho * b.model * vec4(pos, 0.0, 1.0);
135}
136
layout(local_size_x=16, local_size_y=16) in
void main()
in vec2 uv
uint state
Definition text.vert:40
uint hovered
Definition text.vert:8
uint type
Definition text.vert:41
vec2 pos
Definition text.vert:37
uint shadow
Definition text.vert:35
uint pad0
Definition text.vert:50
uint pad1
Definition text.vert:16
uint mask
Definition text.vert:12
uint masked
Definition text.vert:48
float shadow_dist
Unused.
Definition text.vert:36
uint container_id
Definition text.vert:49
uint pad2
Definition text.vert:17
vec2 size
Size of the SDF.
Definition text.vert:38
vec4 padding
Definition text.vert:44
uint container_id
Definition text.vert:11
mat4 model
Definition text.vert:20
uint pad0
Definition text.vert:15
vec2 translation
X and Y coords where Y+ is down.
Definition text.vert:45
vec2 shadow_dir
Which direction to offset the drop shadow in.
Definition text.vert:13
uint hovered
Definition text.vert:34
vec4 color
The color of the text.
Definition text.vert:18
mat4 model
Definition text.vert:51
vec2 scale
Scale.
Definition text.vert:46
vec4 fill
The fill of the text.
Definition text.vert:19
vec4 fill
Unused.
Definition text.vert:43
uint state
Definition text.vert:14
uint visible
Definition text.vert:33
uint shadow
Definition text.vert:9
vec2 shadow_dir
Unused.
Definition text.vert:39
float radius
The radius of the circle OR the radius of a rectangle's corners.
Definition text.vert:47
uint visible
Definition text.vert:7
vec4 color
Color of the shape.
Definition text.vert:42
float shadow_dist
How far the drop shadow is.
Definition text.vert:10
A structure holding a Font ID and text to be rendered and transformed with its properties.
Definition text.vert:5
UIElements that are contained within a UIMenu that may receive events, be contained within UIContaine...
Definition text.vert:31
in vec2 vUV
Definition lightmap.frag:13
float clamp(float a, float b, float c)
Definition mathf.h:379
in vec3 vPos
Definition sky.frag:7
flat in float vContRadius
Definition text.frag:20
flat in vec2 vCenter
Definition text.frag:17
flat in uint vVisible
Definition text.frag:11
flat in uint vMask
Definition text.frag:23
flat in vec4 vPadding
Definition text.frag:19
flat in vec2 vContSize
Definition text.frag:21
flat in uint vHovered
Definition text.frag:14
in vec4 vScreenPos
Definition text.frag:25
flat in uint vState
Definition text.frag:10
uniform uint uShadowPass
Definition text.frag:16
flat in vec2 vContScale
Definition text.frag:24
flat in uint vContType
Definition text.frag:22
in vec2 vShadowDir
Definition text.frag:12
in vec4 vFill
Definition text.frag:9
flat in uint vShadow
Definition text.frag:13
flat in vec4 vContPos
Definition text.frag:18
uniform mat4 uOrtho
Definition text.vert:93
Definition types.h:21
Definition types.h:11
Definition types.h:13
in vec3 vColor
Definition wireframe.frag:5