VG_VAR_I32( k_debug_light_indices );
VG_VAR_I32( k_debug_light_complexity );
VG_VAR_I32( k_light_preview );
+ VG_VAR_I32( k_light_editor );
vg_console_reg_cmd( "set_time", ccmd_set_time, NULL );
world_render.sky_rate = 1.0;
mesh_draw( &world->mesh_geo );
}
+struct ui_enum_opt skybox_setting_options[] = {
+ { 0, "g_daysky_colour" },
+ { 1, "g_nightsky_colour" },
+ { 2, "g_sunset_colour" },
+ { 3, "g_ambient_colour" },
+ { 4, "g_sun_colour" },
+};
+
+static f32 *skybox_prop_location( world_instance *world, i32 index ){
+ switch( index ){
+ case 0: return world->ub_lighting.g_daysky_colour; break;
+ case 1: return world->ub_lighting.g_nightsky_colour; break;
+ case 2: return world->ub_lighting.g_sunset_colour; break;
+ case 3: return world->ub_lighting.g_ambient_colour; break;
+ case 4: return world->ub_lighting.g_sun_colour; break;
+ default: return NULL;
+ }
+}
+
+static void imgui_world_light_edit( world_instance *world ){
+ ui_rect panel = { vg.window_x-400, 0, 400, vg.window_y };
+ ui_fill( panel, ui_colour( k_ui_bg+1 ) );
+ ui_outline( panel, 1, ui_colour( k_ui_bg+7 ), 0 );
+ ui_rect_pad( panel, (ui_px[2]){ 8, 8 } );
+ vg_ui.wants_mouse = 1;
+
+ static i32 option_to_edit = 0;
+ ui_enum( panel, "option", skybox_setting_options, 5, &option_to_edit );
+ ui_colourpicker( panel, "colour",
+ skybox_prop_location( world, option_to_edit ) );
+
+ if( ui_button( panel, "save tweaker file ('/tmp/tweaker.txt')\n" ) == 1 ){
+ FILE *fp = fopen( "/tmp/tweaker.txt", "w" );
+
+ for( i32 i=0; i<5; i ++ ){
+ struct ui_enum_opt *opt = &skybox_setting_options[i];
+ f32 *val = skybox_prop_location( world, i );
+ fprintf( fp, "%s = {%.3ff, %.3ff, %.3ff, %.3ff},\n",
+ opt->alias, val[0], val[1], val[2], val[3] );
+ }
+ fclose( fp );
+ }
+}
+
#endif