System info & network

This commit is contained in:
2023-09-26 19:40:16 +02:00
commit 504ba77654
89 changed files with 39577 additions and 0 deletions

27
code/render/2d.h Normal file
View File

@@ -0,0 +1,27 @@
#ifndef _PIUMA_RENDER_2D_H_
#define _PIUMA_RENDER_2D_H_
#include "../lib/types.h"
#include "../lib/math.h"
#include "../lib/geometry.h"
#include "primitives.h"
// Immediate functions: less efficient but easy to use
void r_2d_immediate_segment(v2 a, v2 b, v4 a_color, v4 b_color, f32 thickness = 1.0f);
void r_2d_immediate_polygonal_chain(u64 count, v2 *vertices, v4 color, f32 thickness = 1.0f);
void r_2d_immediate_triangle(v2 a, v2 b, v2 c, v4 a_color, v4 b_color, v4 c_color, v2 a_uv = {0,0}, v2 b_uv = {0,0}, v2 c_uv = {0,0}, r_texture *texture = NULL);
void r_2d_immediate_quad(v2 a, v2 b, v2 c, v2 d, v4 color, v2 a_uv = {0,0}, v2 b_uv = {0,0}, v2 c_uv = {0,0}, v2 d_uv = {0,0}, r_texture *texture = NULL);
void r_2d_immediate_rectangle(Rect r, v4 color, Rect uv = {0,0,1,1}, r_texture *texture = NULL);
void r_2d_immediate_rounded_rectangle(Rect r, f32 radius, v4 color);
void r_2d_immediate_mesh(u64 count, v2 *vertices, v4 color, v2 *uvs = NULL, r_texture *texture = NULL);
void r_2d_immediate_rectangle_outline(Rect r, v4 color, f32 thickness = 1.0f);
void r_2d_immediate_rounded_rectangle_outline(Rect r, f32 radius, v4 color, f32 thickness = 1.0f);
// Draw functions: usual interface (create objects / send to gpu, draw call, remove from gpu)
void r_2d_draw_mesh(r_2d_mesh *mesh, r_texture *texture);
// @Feature: @Performance: something for text rendering (a lot of quads/rects)
// Maybe we could send to the gpu the following: texture of the characters, array of uvs for indexing the texture, character position + index of its uv.
#endif