From: hgn Date: Tue, 27 Dec 2022 14:35:01 +0000 (+0000) Subject: .. X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=e60af4143b9157e582e28c9dd8580681b3d07ea9;p=carveJwlIkooP6JGAAIwe30JlM.git .. --- diff --git a/skaterift.c b/skaterift.c index 6d402bf..f31e1f6 100644 --- a/skaterift.c +++ b/skaterift.c @@ -23,7 +23,8 @@ #include "menu.h" static int cl_ui = 1, - cl_view_id = 0; + cl_view_id = 0, + cl_light_edit = 0; int main( int argc, char *argv[] ) { @@ -64,6 +65,14 @@ VG_STATIC void vg_preload(void) .persistent = 0 }); + vg_convar_push( (struct vg_convar){ + .name = "ledit", + .data = &cl_light_edit, + .data_type = k_convar_dtype_i32, + .opt_i32 = { .min=0, .max=1, .clamp=1 }, + .persistent = 0 + }); + vg_info(" Copyright . . . -----, ,----- ,---. .---. \n" ); vg_info(" 2021-2022 |\\ /| | / | | | | /| \n" ); vg_info(" | \\ / | +-- / +----- +---' | / | \n" ); @@ -96,9 +105,7 @@ VG_STATIC void vg_load(void) /* 'systems' are completely loaded now */ strcpy( world.world_name, "maps/mp_mtzero.mdl" ); -#if 0 strcpy( world.world_name, "maps/mp_gridmap.mdl" ); -#endif world_load(); vg_console_load_autos(); } @@ -295,17 +302,17 @@ VG_STATIC void vg_render(void) glViewport( 0,0, vg.window_x, vg.window_y ); } +VG_STATIC void run_light_widget( struct light_widget *lw ); VG_STATIC void vg_ui(void) { menu_crap_ui(); -#if 0 - if( lightedit ) + if( cl_light_edit ) { - ui_global_ctx.cursor[0] = 10; - ui_global_ctx.cursor[1] = 10; - ui_global_ctx.cursor[2] = 200; - ui_global_ctx.cursor[3] = 20; + vg_uictx.cursor[0] = 10; + vg_uictx.cursor[1] = 10; + vg_uictx.cursor[2] = 200; + vg_uictx.cursor[3] = 20; struct ub_world_lighting *wl = &gpipeline.ub_world_lighting; struct ui_slider_vector @@ -317,24 +324,23 @@ VG_STATIC void vg_ui(void) for( int i=0; i<3; i++ ) run_light_widget( &gpipeline.widgets[i] ); - - gui_text( ui_global_ctx.cursor, "Ambient", 1, 0 ); - ui_global_ctx.cursor[1] += 16; - ui_slider_vector( &ui_global_ctx, &s5 ); - - gui_text( ui_global_ctx.cursor, "Shadows", 1, 0 ); - ui_global_ctx.cursor[1] += 16; - ui_slider( &ui_global_ctx, &s8 ); - ui_slider( &ui_global_ctx, &s9 ); - - gui_text( ui_global_ctx.cursor, "Misc", 1, 0 ); - ui_global_ctx.cursor[1] += 16; + + ui_text( vg_uictx.cursor, "Ambient", 1, 0 ); + vg_uictx.cursor[1] += 16; + ui_slider_vector( &s5 ); + + ui_text( vg_uictx.cursor, "Shadows", 1, 0 ); + vg_uictx.cursor[1] += 16; + ui_slider( &s8 ); + ui_slider( &s9 ); + + ui_text( vg_uictx.cursor, "Misc", 1, 0 ); + vg_uictx.cursor[1] += 16; struct ui_checkbox c1 = {.data = &wl->g_light_preview}; - ui_checkbox( &ui_global_ctx, &c1 ); + ui_checkbox( &c1 ); render_update_lighting_ub(); } -#endif //glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); if( cl_ui ) @@ -347,12 +353,11 @@ VG_STATIC void vg_ui(void) render_view_framebuffer_ui(); } -#if 0 VG_STATIC void run_light_widget( struct light_widget *lw ) { struct ui_checkbox c1 = { .data=&lw->enabled }; - ui_checkbox( &ui_global_ctx, &c1 ); + ui_checkbox( &c1 ); if( lw->enabled ) { @@ -360,12 +365,11 @@ VG_STATIC void run_light_widget( struct light_widget *lw ) colour = { .min=0.0f, .max=2.0f, .len=3, .data=lw->colour }, dir = { .min=-VG_PIf, .max=VG_PIf, .len=2, .data=lw->dir }; - ui_slider_vector( &ui_global_ctx, &colour ); - ui_global_ctx.cursor[1] += 4; - ui_slider_vector( &ui_global_ctx, &dir ); + ui_slider_vector( &colour ); + vg_uictx.cursor[1] += 4; + ui_slider_vector( &dir ); } } -#endif VG_STATIC void run_debug_info(void) {