X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=vg_lines.h;fp=vg_lines.h;h=a16f5020481a35a7ce3b76048859c144b89d3238;hb=233cb25785a3179dd041aededd679f4670f4e138;hp=02d7a07d9c465f0bdb59946af9f7acc115d7afe4;hpb=023a4d9f534bbdfc2ff4d85df93c19a29ea4d724;p=vg.git diff --git a/vg_lines.h b/vg_lines.h index 02d7a07..a16f502 100644 --- a/vg_lines.h +++ b/vg_lines.h @@ -19,12 +19,10 @@ typedef v3f line_co; #define VG__CYAN 0xffffff00 #define VG__NONE 0x00000000 -static struct vg_shader _shader_lines = -{ +static struct vg_shader _shader_lines = { .name = "[vg] lines", .link = NULL, - .vs = - { + .vs = { .orig_file = NULL, .static_src = @@ -41,8 +39,7 @@ static struct vg_shader _shader_lines = " gl_Position = vert_pos;" "}" }, - .fs = - { + .fs = { .orig_file = NULL, .static_src = @@ -57,14 +54,11 @@ static struct vg_shader _shader_lines = } }; - -struct -{ +struct{ u32 draw, allow_input; - struct vg_lines_vert - { + struct vg_lines_vert{ v3f co; u32 colour; } @@ -78,14 +72,8 @@ VG_STATIC void vg_lines_init(void) { vg_info( "vg_lines_init\n" ); - vg_var_push( (struct vg_var){ - .name = "vg_lines", - .data = &vg_lines.draw, - .data_type = k_var_dtype_i32, - .opt_i32 = { .min=0, .max=1, .clamp=1 }, - .persistent = 1 - }); - + vg_console_reg_var( "vg_lines", &vg_lines.draw, k_var_dtype_i32, + VG_VAR_CHEAT ); vg_shader_register( &_shader_lines ); vg_acquire_thread_sync(); @@ -181,14 +169,12 @@ VG_STATIC void vg_line( line_co from, line_co to, u32 colour ) VG_STATIC void line_tangent_basis( v3f n, v3f tx, v3f ty ) { /* Compute tangent basis (box2d) */ - if( fabsf( n[0] ) >= 0.57735027f ) - { + if( fabsf( n[0] ) >= 0.57735027f ){ tx[0] = n[1]; tx[1] = -n[0]; tx[2] = 0.0f; } - else - { + else{ tx[0] = 0.0f; tx[1] = n[2]; tx[2] = -n[1];