work towards DeferredCommandDraw being universal, support for DeferredCommandDepthRange, rework of cirlce mesh (has a bug still), get_quad_element_buffer() now more general, as it should be with gl_any

This commit is contained in:
2024-10-17 21:01:35 +03:00
parent aa3cab87d2
commit 7e409fc14a
5 changed files with 174 additions and 146 deletions

View File

@ -20,7 +20,10 @@
extern Matrix4 camera_projection_matrix;
extern Matrix4 camera_look_at_matrix;
#define QUAD_ELEMENT_BUFFER_LENGTH (65536 / 6)
#define CIRCLE_VERTICES_MAX 2048
#define CIRCLE_ELEMENT_BUFFER_LENGTH (CIRCLE_VERTICES_MAX * 3)
typedef GLuint VertexBuffer;
@ -129,11 +132,9 @@ void render_queue_clear(void);
/* fills two existing arrays with the geometry data of a circle */
/* the size of indices must be at least 3 times the number of vertices */
void create_circle_geometry(Vec2 position,
Color color,
float radius,
size_t num_vertices,
SDL_Vertex vertices[],
int indices[]);
Vec2 vertices[]);
struct QuadBatch {
size_t size; /* how many primitives are in current batch */
@ -191,6 +192,8 @@ void set_depth_range(double low, double high);
VertexBuffer get_quad_element_buffer(void);
VertexBuffer get_circle_element_buffer(void);
void render_circle(const CirclePrimitive *circle);
void render_rectangle(const RectPrimitive *rectangle);