2024-07-08 00:44:20 +00:00
|
|
|
#ifndef PRIVATE_RENDERING_H
|
|
|
|
#define PRIVATE_RENDERING_H
|
|
|
|
|
|
|
|
#include "../rendering.h"
|
|
|
|
#include "../util.h"
|
|
|
|
|
|
|
|
#include <SDL2/SDL.h>
|
2024-07-10 16:15:28 +00:00
|
|
|
#include <glad/glad.h>
|
2024-07-08 00:44:20 +00:00
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
struct sprite_primitive {
|
|
|
|
t_frect rect;
|
|
|
|
t_color color;
|
|
|
|
double rotation;
|
|
|
|
char *path;
|
|
|
|
SDL_BlendMode blend_mode;
|
|
|
|
int atlas_index;
|
|
|
|
int layer;
|
|
|
|
bool flip_x;
|
|
|
|
bool flip_y;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rect_primitive {
|
|
|
|
t_frect rect;
|
|
|
|
t_color color;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct circle_primitive {
|
|
|
|
float radius;
|
|
|
|
t_color color;
|
|
|
|
t_fvec2 position;
|
|
|
|
};
|
|
|
|
|
2024-07-10 16:15:28 +00:00
|
|
|
/* batch of primitives with overlapping properties */
|
|
|
|
struct mesh_batch {
|
|
|
|
GLuint buffer; /* server side storage */
|
|
|
|
uint8_t *data; /* client side storage */
|
|
|
|
// size_t buffer_len; /* element count */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mesh_batch_item {
|
|
|
|
char *key;
|
|
|
|
struct mesh_batch value;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* is structure that is in opengl vertex array */
|
|
|
|
struct uncolored_space_triangle {
|
|
|
|
t_fvec3 v0;
|
|
|
|
t_shvec2 uv0;
|
|
|
|
t_fvec3 v1;
|
|
|
|
t_shvec2 uv1;
|
|
|
|
t_fvec3 v2;
|
|
|
|
t_shvec2 uv2;
|
|
|
|
};
|
|
|
|
|
2024-07-08 00:44:20 +00:00
|
|
|
#endif
|