X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=vg_lines.h;h=d7f277ad70347703de64f1804b1597ebb74ae61d;hb=fac9f6fff674421f27fa4f4c1d2844998f0003d6;hp=c44f0713cd9eab045fd92736b5bf96b742f693eb;hpb=5e457ededb92af6948a2a7a0d09f09eab2bb697c;p=vg.git diff --git a/vg_lines.h b/vg_lines.h index c44f071..d7f277a 100644 --- a/vg_lines.h +++ b/vg_lines.h @@ -6,6 +6,10 @@ #define VG_GAME #include "vg/vg.h" +/* + * FIXME: The line buffer sometimes overflows. Low priority + */ + typedef v3f line_co; #define VG__RED 0xff0000ff @@ -68,7 +72,7 @@ struct{ } static vg_lines; -VG_STATIC void async_vg_lines_init( void *payload, u32 payload_size ){ +static void async_vg_lines_init( void *payload, u32 payload_size ){ glGenVertexArrays( 1, &vg_lines.vao ); glGenBuffers( 1, &vg_lines.vbo ); glBindVertexArray( vg_lines.vao ); @@ -108,7 +112,7 @@ VG_STATIC void async_vg_lines_init( void *payload, u32 payload_size ){ vg_lines.allow_input = 1; } -VG_STATIC void vg_lines_init(void){ +static void vg_lines_init(void){ vg_async_call( async_vg_lines_init, NULL, 0 ); vg_console_reg_var( "vg_lines", &vg_lines.draw, k_var_dtype_i32, @@ -117,7 +121,7 @@ VG_STATIC void vg_lines_init(void){ } -VG_STATIC void vg_lines_drawall( void ){ +static void vg_lines_drawall( void ){ glUseProgram( _shader_lines.id ); glUniformMatrix4fv( glGetUniformLocation( _shader_lines.id, "uPv" ), @@ -141,7 +145,7 @@ VG_STATIC void vg_lines_drawall( void ){ vg_linear_clear( vg_lines.vertex_buffer ); } -VG_STATIC void vg_line2( line_co from, line_co to, u32 fc, u32 tc ){ +static void vg_line2( line_co from, line_co to, u32 fc, u32 tc ){ if( !vg_lines.allow_input ) return; if( !vg_lines.draw ) return; @@ -155,11 +159,11 @@ VG_STATIC void vg_line2( line_co from, line_co to, u32 fc, u32 tc ){ v[1].colour = tc; } -VG_STATIC void vg_line( line_co from, line_co to, u32 colour ){ +static void vg_line( line_co from, line_co to, u32 colour ){ vg_line2( from, to, colour, colour ); } -VG_STATIC void vg_line_arrow( line_co co, line_co dir, float size, u32 colour ){ +static void vg_line_arrow( line_co co, line_co dir, float size, u32 colour ){ v3f p1, tx, ty, p2, p3; v3_muladds( co, dir, size, p1 ); v3_tangent_basis( dir, tx, ty ); @@ -173,7 +177,7 @@ VG_STATIC void vg_line_arrow( line_co co, line_co dir, float size, u32 colour ){ vg_line( p1, p3, colour ); } -VG_STATIC void vg_line_box_verts( boxf box, v3f verts[8] ){ +static void vg_line_box_verts( boxf box, v3f verts[8] ){ for( u32 i=0; i<8; i++ ){ for( u32 j=0; j<3; j++ ){ verts[i][j] = i&(0x1<