nngn
Loading...
Searching...
No Matches
gen.h
Go to the documentation of this file.
1#ifndef NNGN_RENDER_GEN_H
2#define NNGN_RENDER_GEN_H
3
4#include "collision/colliders.h"
5#include "font/font.h"
6#include "font/text.h"
7#include "font/textbox.h"
8#include "graphics/graphics.h"
9
10#include "light.h"
11#include "renderers.h"
12
13namespace nngn {
14
15struct Gen {
16 // Primitives
17 static void quad_indices(u64 i, u64 n, u32 *p);
18 static void quad_vertices(
19 Vertex **p, vec2 bl, vec2 tr, float z, vec3 norm,
20 u32 tex, vec2 uv0, vec2 uv1);
21 static void quad_vertices(
22 Vertex **p, vec2 bl, vec2 tr, float z, vec3 norm, vec3 color);
24 Vertex **p, vec2 bl, vec2 tr, float y, vec3 norm,
25 u32 tex, vec2 uv0, vec2 uv1);
26 static inline void quad_vertices_zsprite(
27 Vertex **p, vec2 bl, vec2 tr, float z, vec3 norm,
28 u32 tex, vec2 uv0, vec2 uv1);
29 static void cube_vertices(Vertex **p, vec3 pos, vec3 size, vec3 color);
30 static void cube_vertices(
31 Vertex **p, vec3 pos, vec3 size,
32 u32 tex, const std::array<vec4, 6> &uv);
33 // Utilities
34 static float text_color(u8 r, u8 g, u8 b);
35 static float text_color(u32 c);
36 // Renderers
37 static void sprite_ortho(Vertex **p, SpriteRenderer *x);
39 static void sprite_persp(Vertex **p, SpriteRenderer *x);
41 static void cube_ortho(Vertex **p, CubeRenderer *x);
42 static void cube_persp(Vertex **p, CubeRenderer *x);
43 static void voxel_ortho(Vertex **p, VoxelRenderer *x);
44 static void voxel_persp(Vertex **p, VoxelRenderer *x);
45 static void sprite_debug(Vertex **p, SpriteRenderer *x);
46 static void cube_debug(Vertex **p, CubeRenderer *x);
47 static void voxel_debug(Vertex **p, VoxelRenderer *x);
48 static void text(
49 Vertex **p, u64 n,
50 const Font &font, const Text &txt, bool mono, float left,
51 vec2 *pos_p, float *color_p, u64 *i_p, u64 *n_visible_p);
52 static void textbox(Vertex **p, const Textbox &x);
53 static void selection(Vertex **p, const SpriteRenderer &x);
54 static void aabb(Vertex **p, const AABBCollider &x, vec3 color);
55 static void aabb_circle(Vertex **p, const AABBCollider &x);
56 static void bb(Vertex **p, const BBCollider &x, vec3 color);
57 static void coll_sphere(Vertex **p, const SphereCollider &x);
58 static void light(Vertex **p, const Light &x, vec3 pos);
59 static void light_range(Vertex **p, const Light &x);
60private:
61 static constexpr std::array<vec2, 2>
62 CIRCLE_UV_32 = {{{ 32/512.0f, 1}, { 64/512.0f, 1 - 32/512.0f}}},
63 CIRCLE_UV_64 = {{{128/512.0f, 1}, {256/512.0f, 1 - 128/512.0f}}};
64};
65
66inline void Gen::quad_indices(u64 i_64, u64 n, u32 *p) {
67 constexpr std::size_t n_verts = 4, log2 = std::countr_zero(n_verts);
68 auto i = static_cast<u32>(i_64) << log2;
69 for(const auto e = i + (n << log2); i != e; i += n_verts) {
70 *p++ = i ; *(p++) = i + 1; *(p++) = i + 2;
71 *p++ = i + 2; *(p++) = i + 1; *(p++) = i + 3;
72 }
73}
74
75inline void Gen::quad_vertices(
76 Vertex **pp, vec2 bl, vec2 tr, float z, vec3 norm, vec3 color
77) {
78 auto *p = *pp;
79 *p++ = {{bl, z}, norm, color};
80 *p++ = {{tr.x, bl.y, z}, norm, color};
81 *p++ = {{bl.x, tr.y, z}, norm, color};
82 *p++ = {{tr, z}, norm, color};
83 *pp = p;
84}
85
86inline void Gen::quad_vertices(
87 Vertex **pp, vec2 bl, vec2 tr, float z, vec3 norm,
88 u32 tex, vec2 uv0, vec2 uv1
89) {
90 const auto tex_f = static_cast<float>(tex);
91 auto *p = *pp;
92 *p++ = {{bl, z}, norm, {uv0.x, uv0.y, tex_f}};
93 *p++ = {{tr.x, bl.y, z}, norm, {uv1.x, uv0.y, tex_f}};
94 *p++ = {{bl.x, tr.y, z}, norm, {uv0.x, uv1.y, tex_f}};
95 *p++ = {{tr, z}, norm, {uv1.x, uv1.y, tex_f}};
96 *pp = p;
97}
98
99inline void Gen::quad_vertices_persp(
100 Vertex **pp, vec2 bl, vec2 tr, float y, vec3 norm,
101 u32 tex, vec2 uv0, vec2 uv1
102) {
103 const auto tex_f = static_cast<float>(tex);
104 auto *p = *pp;
105 *p++ = {{bl.x, y, bl.y}, norm, {uv0.x, uv0.y, tex_f}};
106 *p++ = {{tr.x, y, bl.y}, norm, {uv1.x, uv0.y, tex_f}};
107 *p++ = {{bl.x, y, tr.y}, norm, {uv0.x, uv1.y, tex_f}};
108 *p++ = {{tr.x, y, tr.y}, norm, {uv1.x, uv1.y, tex_f}};
109 *pp = p;
110}
111
113 Vertex **pp, vec2 bl, vec2 tr, float z, vec3 norm,
114 u32 tex, vec2 uv0, vec2 uv1
115) {
116 const auto tex_f = static_cast<float>(tex);
117 auto *p = *pp;
118 *p++ = {{bl.x, bl.y, z}, norm, {uv0.x, uv0.y, tex_f}};
119 *p++ = {{tr.x, bl.y, z}, norm, {uv1.x, uv0.y, tex_f}};
120 *p++ = {{bl.x, tr.y, z + tr.y - bl.y}, norm, {uv0.x, uv1.y, tex_f}};
121 *p++ = {{tr.x, tr.y, z + tr.y - bl.y}, norm, {uv1.x, uv1.y, tex_f}};
122 *pp = p;
123}
124
125inline void Gen::cube_vertices(Vertex **pp, vec3 pos, vec3 size, vec3 color) {
126 const auto s = size / 2.0f;
127 const auto bl = pos - s, tr = pos + s;
128 auto *p = *pp;
129 *p++ = { bl , { 0, 0, -1}, color};
130 *p++ = {{bl.x, tr.y, bl.z}, { 0, 0, -1}, color};
131 *p++ = {{tr.x, bl.y, bl.z}, { 0, 0, -1}, color};
132 *p++ = {{tr.x, tr.y, bl.z}, { 0, 0, -1}, color};
133 *p++ = {{bl.x, bl.y, tr.z}, { 0, 0, 1}, color};
134 *p++ = {{tr.x, bl.y, tr.z}, { 0, 0, 1}, color};
135 *p++ = {{bl.x, tr.y, tr.z}, { 0, 0, 1}, color};
136 *p++ = { tr , { 0, 0, 1}, color};
137 *p++ = { bl , {-1, 0, 0}, color};
138 *p++ = {{bl.x, bl.y, tr.z}, {-1, 0, 0}, color};
139 *p++ = {{bl.x, tr.y, bl.z}, {-1, 0, 0}, color};
140 *p++ = {{bl.x, tr.y, tr.z}, {-1, 0, 0}, color};
141 *p++ = {{tr.x, bl.y, bl.z}, { 1, 0, 0}, color};
142 *p++ = {{tr.x, tr.y, bl.z}, { 1, 0, 0}, color};
143 *p++ = {{tr.x, bl.y, tr.z}, { 1, 0, 0}, color};
144 *p++ = { tr , { 1, 0, 0}, color};
145 *p++ = { bl , { 0, -1, 0}, color};
146 *p++ = {{tr.x, bl.y, bl.z}, { 0, -1, 0}, color};
147 *p++ = {{bl.x, bl.y, tr.z}, { 0, -1, 0}, color};
148 *p++ = {{tr.x, bl.y, tr.z}, { 0, -1, 0}, color};
149 *p++ = {{bl.x, tr.y, bl.z}, { 0, 1, 0}, color};
150 *p++ = {{bl.x, tr.y, tr.z}, { 0, 1, 0}, color};
151 *p++ = {{tr.x, tr.y, bl.z}, { 0, 1, 0}, color};
152 *p++ = { tr , { 0, 1, 0}, color};
153 *pp = p;
154}
155
156inline void Gen::cube_vertices(
157 Vertex **p, vec3 pos, vec3 size,
158 u32 tex, const std::array<vec4, 6> &uv
159) {
160 const auto ftex = static_cast<float>(tex);
161 const auto s = size / 2.0f;
162 const auto bl = pos - s, tr = pos + s;
163 auto uv_ = uv[5];
164 *((*p)++) = { bl , { 0, 0, -1}, {uv_.xy(), ftex}};
165 *((*p)++) = {{bl.x, tr.y, bl.z}, { 0, 0, -1}, {uv_.xw(), ftex}};
166 *((*p)++) = {{tr.x, bl.y, bl.z}, { 0, 0, -1}, {uv_.zy(), ftex}};
167 *((*p)++) = {{tr.x, tr.y, bl.z}, { 0, 0, -1}, {uv_.zw(), ftex}};
168 uv_ = uv[4];
169 *((*p)++) = {{bl.x, bl.y, tr.z}, { 0, 0, 1}, {uv_.xy(), ftex}};
170 *((*p)++) = {{tr.x, bl.y, tr.z}, { 0, 0, 1}, {uv_.zy(), ftex}};
171 *((*p)++) = {{bl.x, tr.y, tr.z}, { 0, 0, 1}, {uv_.xw(), ftex}};
172 *((*p)++) = { tr , { 0, 0, 1}, {uv_.zw(), ftex}};
173 uv_ = uv[1];
174 *((*p)++) = { bl , {-1, 0, 0}, {uv_.xy(), ftex}};
175 *((*p)++) = {{bl.x, bl.y, tr.z}, {-1, 0, 0}, {uv_.xw(), ftex}};
176 *((*p)++) = {{bl.x, tr.y, bl.z}, {-1, 0, 0}, {uv_.zy(), ftex}};
177 *((*p)++) = {{bl.x, tr.y, tr.z}, {-1, 0, 0}, {uv_.zw(), ftex}};
178 uv_ = uv[0];
179 *((*p)++) = {{tr.x, bl.y, bl.z}, { 1, 0, 0}, {uv_.xy(), ftex}};
180 *((*p)++) = {{tr.x, tr.y, bl.z}, { 1, 0, 0}, {uv_.zy(), ftex}};
181 *((*p)++) = {{tr.x, bl.y, tr.z}, { 1, 0, 0}, {uv_.xw(), ftex}};
182 *((*p)++) = { tr , { 1, 0, 0}, {uv_.zw(), ftex}};
183 uv_ = uv[3];
184 *((*p)++) = { bl , { 0, -1, 0}, {uv_.xy(), ftex}};
185 *((*p)++) = {{tr.x, bl.y, bl.z}, { 0, -1, 0}, {uv_.zy(), ftex}};
186 *((*p)++) = {{bl.x, bl.y, tr.z}, { 0, -1, 0}, {uv_.xw(), ftex}};
187 *((*p)++) = {{tr.x, bl.y, tr.z}, { 0, -1, 0}, {uv_.zw(), ftex}};
188 uv_ = uv[2];
189 *((*p)++) = {{bl.x, tr.y, bl.z}, { 0, 1, 0}, {uv_.xy(), ftex}};
190 *((*p)++) = {{bl.x, tr.y, tr.z}, { 0, 1, 0}, {uv_.xw(), ftex}};
191 *((*p)++) = {{tr.x, tr.y, bl.z}, { 0, 1, 0}, {uv_.zy(), ftex}};
192 *((*p)++) = { tr , { 0, 1, 0}, {uv_.zw(), ftex}};
193}
194
195inline float Gen::text_color(u8 r, u8 g, u8 b) {
196 return Gen::text_color((static_cast<u32>(r) << 16)
197 | (static_cast<u32>(g) << 8)
198 | static_cast<u32>(b));
199}
200
201inline float Gen::text_color(u32 c) {
202 float ret = {};
203 static_assert(sizeof(ret) == sizeof(c));
204 std::memcpy(&ret, &c, sizeof(ret));
205 return ret;
206}
207
208inline void Gen::sprite_ortho(Vertex **p, SpriteRenderer *x) {
209 x->flags.clear(Renderer::Flag::UPDATED);
210 const auto pos = x->pos.xy();
211 const auto s = x->size / 2.0f;
213 p, pos - s, pos + s, -pos.y - x->z_off,
214 {0, 0, 1}, x->tex, x->uv[0], x->uv[1]);
215}
216
217inline void Gen::sprite_orthoz(Vertex **p, SpriteRenderer *x) {
218 constexpr auto nl = Math::sq2_2<float>();
219 x->flags.clear(Renderer::Flag::UPDATED);
220 const auto pos = x->pos.xy();
221 const auto s = x->size / 2.0f;
223 p, pos - s, pos + s, -(s.y + x->z_off),
224 {0, -nl, nl}, x->tex, x->uv[0], x->uv[1]);
225}
226
227inline void Gen::sprite_persp(Vertex **p, SpriteRenderer *x) {
228 x->flags.clear(Renderer::Flag::UPDATED);
229 const auto s = x->size / 2.0f;
230 const vec2 bl = {x->pos.x - s.x, -s.y - x->z_off};
232 p, bl, {x->pos.x + s.x, bl.y + x->size.y},
233 x->pos.y + x->z_off, {0, -1, 0}, x->tex, x->uv[0], x->uv[1]);
234}
235
236inline void Gen::screen_sprite(Vertex **p, SpriteRenderer *x) {
237 x->flags.clear(Renderer::Flag::UPDATED);
238 const auto pos = x->pos.xy();
239 const auto s = x->size / 2.0f;
241 p, pos - s, pos + s, x->pos.z,
242 {0, 0, 1}, x->tex, x->uv[0], x->uv[1]);
243}
244
245inline void Gen::cube_ortho(Vertex **p, CubeRenderer *x) {
246 x->flags.clear(Renderer::Flag::UPDATED);
248 p, {x->pos.x, x->pos.y, x->pos.z - x->pos.y},
249 vec3{x->size}, x->color);
250}
251
252inline void Gen::cube_persp(Vertex **p, CubeRenderer *x) {
253 x->flags.clear(Renderer::Flag::UPDATED);
254 Gen::cube_vertices(p, x->pos, vec3{x->size}, x->color);
255}
256
257inline void Gen::voxel_ortho(Vertex **p, VoxelRenderer *x) {
258 x->flags.clear(Renderer::Flag::UPDATED);
260 p, {x->pos.x, x->pos.y, x->pos.z - x->pos.y},
261 x->size, x->tex, x->uv);
262}
263
264inline void Gen::voxel_persp(Vertex **p, VoxelRenderer *x) {
265 x->flags.clear(Renderer::Flag::UPDATED);
266 Gen::cube_vertices(p, x->pos, x->size, x->tex, x->uv);
267}
268
269inline void Gen::sprite_debug(Vertex **p, SpriteRenderer *x) {
270 constexpr vec3 norm = {0, 0, 1};
271 const auto pos = x->pos.xy();
272 auto s = x->size / 2.0f;
273 vec2 bl = pos - s, tr = pos + s;
274 Gen::quad_vertices(p, bl, tr, 0, norm, {1, 1, 1});
275 s = {0.5f, 0.5f};
276 bl = pos - s;
277 tr = pos + s;
278 Gen::quad_vertices(p, bl, tr, 0, norm, {1, 0, 0});
279 bl.y = x->pos.y + x->z_off - s.y;
280 tr.y = x->pos.y + x->z_off + s.y;
281 Gen::quad_vertices(p, bl, tr, 0, norm, {1, 0, 0});
282}
283
284inline void Gen::cube_debug(Vertex **p, CubeRenderer *x) {
285 Gen::cube_vertices(p, x->pos, vec3{x->size}, {1, 1, 1});
286}
287
288inline void Gen::voxel_debug(Vertex **p, VoxelRenderer *x) {
289 Gen::cube_vertices(p, x->pos, vec3{x->size}, {1, 1, 1});
290}
291
292inline void Gen::text(
293 Vertex **p, u64 n,
294 const Font &font, const Text &txt, bool mono, float left,
295 vec2 *pos_p, float *color_p, u64 *i_p, u64 *n_visible_p
296) {
297 auto pos = *pos_p;
298 auto color = *color_p;
299 auto i = static_cast<std::size_t>(*i_p);
300 auto n_visible = *n_visible_p;
301 const auto font_size = static_cast<float>(font.size);
302 while(n--) {
303 using C = Textbox::Command;
304 const auto c = static_cast<unsigned char>(txt.str[i++]);
305 switch(c) {
306 case '\n': pos = {left, pos.y - font_size - txt.spacing}; continue;
307 case C::TEXT_WHITE: color = Gen::text_color(255, 255, 255); continue;
308 case C::TEXT_RED: color = Gen::text_color(255, 32, 32); continue;
309 case C::TEXT_GREEN: color = Gen::text_color(32, 255, 32); continue;
310 case C::TEXT_BLUE: color = Gen::text_color(32, 32, 255); continue;
311 }
312 const auto fc = font.chars[static_cast<std::size_t>(c)];
313 const auto size = static_cast<vec2>(fc.size);
314 const auto cpos = pos
315 + vec2(font_size / 2, txt.size.y - font_size / 2)
316 + static_cast<vec2>(fc.bearing);
318 p, cpos, cpos + size, color,
319 {0, 0, 1}, static_cast<u32>(c),
320 {0, size.y / font_size}, {size.x / font_size, 0});
321 pos.x += mono ? font_size : fc.advance;
322 ++n_visible;
323 }
324 *pos_p = pos;
325 *color_p = color;
326 *i_p = static_cast<u64>(i);
327 *n_visible_p = n_visible;
328}
329
330inline void Gen::textbox(Vertex **p, const Textbox &x) {
331 constexpr vec3 norm = {0, 0, 1};
332 constexpr vec3 title_color = {0, 0, 1};
333 constexpr vec3 box_color = {1, 1, 1};
334 Gen::quad_vertices(p, x.title_bl, x.title_tr, 0, norm, title_color);
335 Gen::quad_vertices(p, x.str_bl, x.str_tr, 0, norm, box_color);
336}
337
338inline void Gen::selection(Vertex **p, const SpriteRenderer &x) {
339 const auto pos = x.pos.xy();
340 const auto s = x.size / 2.0f;
341 nngn::Gen::quad_vertices(p, pos - s, pos + s, 0, {0, 0, 1}, {1, 1, 0});
342}
343
344inline void Gen::aabb(Vertex **p, const AABBCollider &x, vec3 color) {
345 Gen::quad_vertices(p, x.bl, x.tr, 0, {0, 0, 1}, color);
346}
347
348inline void Gen::aabb_circle(Vertex **p, const AABBCollider &x) {
349 const auto uv = x.radius < 32.0f ? Gen::CIRCLE_UV_32 : Gen::CIRCLE_UV_64;
351 p, x.center - x.radius, x.center + x.radius, 0, {0, 0, 1}, 1,
352 uv[0], uv[1]);
353}
354
355inline void Gen::bb(Vertex **pp, const BBCollider &x, vec3 color) {
356 constexpr vec3 norm = {0, 0, 1};
357 std::array<vec2, 4> rot = {{
358 {x.bl.x, x.bl.y},
359 {x.tr.x, x.bl.y},
360 {x.bl.x, x.tr.y},
361 {x.tr.x, x.tr.y},
362 }};
363 const auto pos = x.bl + (x.tr - x.bl) / 2.0f;
364 for(auto &r : rot) {
365 r -= pos;
366 r = {
367 r.x * x.cos - r.y * x.sin,
368 r.x * x.sin + r.y * x.cos,
369 };
370 r += pos;
371 }
372 auto *p = *pp;
373 *p++ = {{rot[0], 0}, norm, color};
374 *p++ = {{rot[1], 0}, norm, color};
375 *p++ = {{rot[2], 0}, norm, color};
376 *p++ = {{rot[3], 0}, norm, color};
377 *pp = p;
378}
379
380inline void Gen::coll_sphere(Vertex **p, const SphereCollider &x) {
381 const auto uv = x.r / 2.0f < 32.0f ? CIRCLE_UV_32 : CIRCLE_UV_64;
382 const auto pos = x.pos.xy();
383 Gen::quad_vertices(p, pos - x.r, pos + x.r, 0, {0, 0, 1}, 1, uv[0], uv[1]);
384}
385
386inline void Gen::light(Vertex **p, const Light &x, vec3 pos) {
387 Gen::cube_vertices(p, pos, vec3{8}, x.color.xyz());
388}
389
390inline void Gen::light_range(Vertex **p, const Light &x) {
391 Gen::cube_vertices(p, x.pos, vec3{0.2f * x.range()}, x.color.xyz());
392}
393
394}
395
396#endif
Definition: textbox.h:18
for i
Definition: font.lua:5
r
Definition: gamma.lua:7
g
Definition: gamma.lua:7
c
Definition: gamma.lua:11
font
Definition: repl.lua:1
pos
Definition: lua_audio.cpp:17
#define C(T)
n
Definition: dump_lights.lua:5
z
Definition: input.lua:25
p
Definition: input.lua:29
std::chrono::seconds s
Definition: timing.cpp:6
static constexpr nngn::vec2 tr
Definition: collision.cpp:8
static constexpr nngn::vec2 bl
Definition: collision.cpp:8
e
Definition: math.lua:4
auto size(const Colliders &c)
Definition: lua_collision.cpp:29
Definition: audio.cpp:7
std::uint32_t u32
Definition: def.h:14
vec2_base< float > vec2
Definition: vec2.h:29
std::uint64_t u64
Definition: def.h:15
vec3_base< float > vec3
Definition: vec3.h:51
std::uint8_t u8
Definition: def.h:12
Definition: colliders.h:34
Definition: colliders.h:44
Definition: renderers.h:44
Definition: font.h:18
static void quad_vertices(Vertex **p, vec2 bl, vec2 tr, float z, vec3 norm, vec3 color)
static void quad_vertices_zsprite(Vertex **p, vec2 bl, vec2 tr, float z, vec3 norm, u32 tex, vec2 uv0, vec2 uv1)
Definition: gen.h:112
static void light(Vertex **p, const Light &x, vec3 pos)
static void voxel_ortho(Vertex **p, VoxelRenderer *x)
static void quad_vertices_persp(Vertex **p, vec2 bl, vec2 tr, float y, vec3 norm, u32 tex, vec2 uv0, vec2 uv1)
Definition: gen.h:99
static void sprite_debug(Vertex **p, SpriteRenderer *x)
static void light(Vertex **p, const Light &x, vec3 pos)
Definition: gen.h:386
static void voxel_persp(Vertex **p, VoxelRenderer *x)
static void sprite_ortho(Vertex **p, SpriteRenderer *x)
static void cube_persp(Vertex **p, CubeRenderer *x)
Definition: gen.h:252
static void aabb(Vertex **p, const AABBCollider &x, vec3 color)
static void quad_vertices(Vertex **p, vec2 bl, vec2 tr, float z, vec3 norm, u32 tex, vec2 uv0, vec2 uv1)
Definition: gen.h:86
static void textbox(Vertex **p, const Textbox &x)
static void text(Vertex **p, u64 n, const Font &font, const Text &txt, bool mono, float left, vec2 *pos_p, float *color_p, u64 *i_p, u64 *n_visible_p)
Definition: gen.h:292
static void cube_ortho(Vertex **p, CubeRenderer *x)
static void voxel_debug(Vertex **p, VoxelRenderer *x)
static void sprite_persp(Vertex **p, SpriteRenderer *x)
Definition: gen.h:227
static void voxel_debug(Vertex **p, VoxelRenderer *x)
Definition: gen.h:288
static void screen_sprite(Vertex **p, SpriteRenderer *x)
Definition: gen.h:236
static void quad_vertices_zsprite(Vertex **p, vec2 bl, vec2 tr, float z, vec3 norm, u32 tex, vec2 uv0, vec2 uv1)
static void screen_sprite(Vertex **p, SpriteRenderer *x)
static void textbox(Vertex **p, const Textbox &x)
Definition: gen.h:330
static void sprite_orthoz(Vertex **p, SpriteRenderer *x)
Definition: gen.h:217
static void cube_debug(Vertex **p, CubeRenderer *x)
static void cube_vertices(Vertex **p, vec3 pos, vec3 size, vec3 color)
Definition: gen.h:125
static void sprite_orthoz(Vertex **p, SpriteRenderer *x)
static void light_range(Vertex **p, const Light &x)
static void cube_ortho(Vertex **p, CubeRenderer *x)
Definition: gen.h:245
static constexpr std::array< vec2, 2 > CIRCLE_UV_64
Definition: gen.h:63
static void voxel_ortho(Vertex **p, VoxelRenderer *x)
Definition: gen.h:257
static void aabb_circle(Vertex **p, const AABBCollider &x)
static void sprite_persp(Vertex **p, SpriteRenderer *x)
static float text_color(u8 r, u8 g, u8 b)
Definition: gen.h:195
static void bb(Vertex **p, const BBCollider &x, vec3 color)
static float text_color(u8 r, u8 g, u8 b)
static void coll_sphere(Vertex **p, const SphereCollider &x)
static void quad_vertices_persp(Vertex **p, vec2 bl, vec2 tr, float y, vec3 norm, u32 tex, vec2 uv0, vec2 uv1)
static void quad_vertices(Vertex **p, vec2 bl, vec2 tr, float z, vec3 norm, u32 tex, vec2 uv0, vec2 uv1)
static void coll_sphere(Vertex **p, const SphereCollider &x)
Definition: gen.h:380
static void text(Vertex **p, u64 n, const Font &font, const Text &txt, bool mono, float left, vec2 *pos_p, float *color_p, u64 *i_p, u64 *n_visible_p)
static void sprite_debug(Vertex **p, SpriteRenderer *x)
Definition: gen.h:269
static void voxel_persp(Vertex **p, VoxelRenderer *x)
Definition: gen.h:264
static void cube_vertices(Vertex **p, vec3 pos, vec3 size, vec3 color)
static void cube_vertices(Vertex **p, vec3 pos, vec3 size, u32 tex, const std::array< vec4, 6 > &uv)
static void aabb(Vertex **p, const AABBCollider &x, vec3 color)
Definition: gen.h:344
static void cube_persp(Vertex **p, CubeRenderer *x)
static float text_color(u32 c)
static void quad_indices(u64 i, u64 n, u32 *p)
Definition: gen.h:66
static void quad_indices(u64 i, u64 n, u32 *p)
static constexpr std::array< vec2, 2 > CIRCLE_UV_32
Definition: gen.h:62
static void sprite_ortho(Vertex **p, SpriteRenderer *x)
Definition: gen.h:208
static void aabb_circle(Vertex **p, const AABBCollider &x)
Definition: gen.h:348
static void selection(Vertex **p, const SpriteRenderer &x)
Definition: gen.h:338
static void bb(Vertex **p, const BBCollider &x, vec3 color)
Definition: gen.h:355
static void light_range(Vertex **p, const Light &x)
Definition: gen.h:390
static void selection(Vertex **p, const SpriteRenderer &x)
static void cube_debug(Vertex **p, CubeRenderer *x)
Definition: gen.h:284
Definition: light.h:25
Definition: colliders.h:53
Definition: renderers.h:33
Definition: text.h:12
Definition: graphics.h:136
Definition: renderers.h:50
constexpr vec2_base< T > xy() const
Definition: vec2.h:18
T x
Definition: vec2.h:12
T y
Definition: vec2.h:12
T x
Definition: vec3.h:13
constexpr vec2_base< T > xy() const
Definition: vec3.h:26
constexpr vec3_base< T > xyz() const
Definition: vec3.h:34