diff options
| author | aura <nw@moneybot.cc> | 2026-03-10 02:08:32 +0100 |
|---|---|---|
| committer | aura <nw@moneybot.cc> | 2026-03-10 02:08:32 +0100 |
| commit | 31b77ed2e0c037e5718b9ecd06d3941600cc8815 (patch) | |
| tree | b15e8a098b772de1be54a1bb90a31992f2a78975 /src/render/gl_2d.h | |
| parent | 8329d42d3e592f4cd42cdfa586e2325ddc76c898 (diff) | |
wip on 2d batching
Diffstat (limited to 'src/render/gl_2d.h')
| -rw-r--r-- | src/render/gl_2d.h | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/src/render/gl_2d.h b/src/render/gl_2d.h index 9830516..25dbd4d 100644 --- a/src/render/gl_2d.h +++ b/src/render/gl_2d.h @@ -1,21 +1,24 @@ #pragma once #include "gl.h" +#include "gl_batch.h" +using GL_BATCH2D = GL_BATCH<VERTEX>; extern GL_SHADER_PROGRAM* gl_2d_init( GL_DATA* gl, VEC2 screensize, const char* shadername ); -void gl_polygon( GL_SHADER_PROGRAM* gl2d, VERTEX* vertices, U32 vertices_count ); -void gl_textured_polygon( - GL_SHADER_PROGRAM* gl2d, - VERTEX* vertices, - U32 vertices_count, - GL_TEX2D* tex -); +extern void gl_2d_batch_setup( GL_BATCH2D* batch ); extern void gl_2d_line( GL_SHADER_PROGRAM* gl2d, VEC2 start, VEC2 end, CLR col ); extern void gl_2d_rect( GL_SHADER_PROGRAM* gl2d, VEC2 origin, VEC2 dimensions, CLR col ); extern void gl_2d_frect( GL_SHADER_PROGRAM* gl2d, VEC2 origin, VEC2 dimensions, CLR col ); extern void gl_2d_circle( GL_SHADER_PROGRAM* gl2d, VEC2 origin, F32 radius, CLR col, U32 res = 48 ); extern void gl_2d_fcircle( GL_SHADER_PROGRAM* gl2d, VEC2 origin, F32 radius, CLR col, U32 res = 48 ); +extern void gl_2d_polygon( GL_SHADER_PROGRAM* gl2d, VERTEX* vertices, U32 vertices_count ); +extern void gl_2d_textured_polygon( + GL_SHADER_PROGRAM* gl2d, + VERTEX* vertices, + U32 vertices_count, + GL_TEX2D* tex +); extern void gl_2d_textured_frect( GL_SHADER_PROGRAM* gl2d, VEC2 origin, @@ -25,3 +28,25 @@ extern void gl_2d_textured_frect( VEC2* uv = 0, F32 rotation = 0.F ); + +extern void gl_2d_line( GL_BATCH2D* batch, VEC2 start, VEC2 end, CLR col ); +extern void gl_2d_rect( GL_BATCH2D* batch, VEC2 origin, VEC2 dimensions, CLR col ); +extern void gl_2d_frect( GL_BATCH2D* batch, VEC2 origin, VEC2 dimensions, CLR col ); +extern void gl_2d_circle( GL_BATCH2D* batch, VEC2 origin, F32 radius, CLR col, U32 res = 48 ); +extern void gl_2d_fcircle( GL_BATCH2D* batch, VEC2 origin, F32 radius, CLR col, U32 res = 48 ); +extern void gl_2d_polygon( GL_BATCH2D* batch, VERTEX* vertices, U32 vertices_count ); +extern void gl_2d_textured_polygon( + GL_BATCH2D* batch, + VERTEX* vertices, + U32 vertices_count, + GL_TEX2D* tex +); +extern void gl_2d_textured_frect( + GL_BATCH2D* batch, + VEC2 origin, + VEC2 dim, + GL_TEX2D* texture, + CLR col = { 1.f, 1.f, 1.f, 1.f }, + VEC2* uv = 0, + F32 rotation = 0.F +); |
