X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=main.c;h=9bfa794c51a1e0b1ad55668aa8ca29b1877fc366;hb=47941822dae18a018c985847b052e70214a3ccc6;hp=024b15e1d305e01c70ece3b0782f198361ff0edb;hpb=3ee65e6e24bfc39db7c7dd8c1f4cec3d5c42d0f8;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/main.c b/main.c index 024b15e..9bfa794 100644 --- a/main.c +++ b/main.c @@ -1,297 +1,199 @@ /* - * Copyright (C) Mount0 Software, Harry Godden - All Rights Reserved + * ============================================================================= + * + * Copyright . . . -----, ,----- ,---. .---. + * 2021-2022 |\ /| | / | | | | /| + * | \ / | +-- / +----- +---' | / | + * | \ / | | / | | \ | / | + * | \/ | | / | | \ | / | + * ' ' '--' [] '----- '----- ' ' '---' SOFTWARE + * + * ============================================================================= + * + * register: shader register & init scheduling + * init: initialization + * update: logic + * render: graphics + * free: resource free + * */ -#include "common.h" - -/* Resources */ -vg_tex2d tex_norwey = { .path = "textures/norway_foliage.qoi" }; -vg_tex2d tex_grid = { .path = "textures/grid.qoi" }; -vg_tex2d tex_sky = { .path = "textures/sky.qoi" }; -vg_tex2d tex_gradients = { .path = "textures/gradients.qoi", - .flags = VG_TEXTURE_CLAMP }; -vg_tex2d tex_cement = { .path = "textures/cement512.qoi" }; -vg_tex2d tex_water = { .path = "textures/water.qoi" }; +#define VG_3D +#define VG_STATIC static -/* Convars */ -static int debugview = 0; -static int sv_debugcam = 0; -static int lightedit = 0; -static int sv_scene = 0; +//#define VG_MINIMAL_TEST +#ifndef VG_MINIMAL_TEST -/* Components */ -//#define SR_NETWORKED - -/* uncomment this to run the game without any graphics being drawn */ -//#define SR_NETWORK_TEST +#define SR_NETWORKED +#include "common.h" #include "steam.h" -#include "network.h" - -#include "model.h" -//#include "road.h" -#include "scene.h" -//#include "ik.h" -#include "audio.h" -//#include "terrain.h" -//#include "character.h" -#include "ragdoll.h" -#include "rigidbody.h" #include "render.h" +#include "audio.h" #include "world.h" #include "player.h" +#include "network.h" +#include "menu.h" -#include "shaders/blit.h" -#include "shaders/standard.h" -#include "shaders/unlit.h" - -#include "physics_test.h" -#include "anim_test.h" - -#include "gate.h" -#include "water.h" - -void vg_register(void) -{ - shader_blit_register(); - shader_standard_register(); - shader_vblend_register(); - shader_unlit_register(); - - world_register(); - character_register(); - water_register(); - gate_register(); -} - -static void init_other(void) -{ - player_init(); - render_init(); - gate_init(); - world_init(); - character_init(); - audio_init(); -} - -vg_tex2d *texture_list[] = -{ - &tex_norwey, - &tex_gradients, - &tex_grid, - &tex_sky, - &tex_cement, - &tex_water, - &tex_water_surf -}; +static int cl_ui = 1; int main( int argc, char *argv[] ) -{ - vg_init( argc, argv, "Voyager Game Engine" ); +{ + vg_prealloc_quota( 128*1024*1024 ); + vg_enter( argc, argv, "Voyager Game Engine" ); } -static int playermodel( int argc, char const *argv[] ) +VG_STATIC void highscores_save_at_exit(void*_) { - if( argc < 1 ) return 0; - - glmesh old_mesh = player.mdl.mesh; - - if( character_load( &player.mdl, argv[0] ) ) - mesh_free( &old_mesh ); - - return 1; + highscores_serialize_all(); } -void vg_start(void) +VG_STATIC void vg_preload(void) { - steam_init(); - vg_convar_push( (struct vg_convar){ - .name = "fc", - .data = &freecam, + .name = "cl_ui", + .data = &cl_ui, .data_type = k_convar_dtype_i32, .opt_i32 = { .min=0, .max=1, .clamp=1 }, .persistent = 1 }); - vg_convar_push( (struct vg_convar){ - .name = "grid", - .data = &walk_grid_iterations, - .data_type = k_convar_dtype_i32, - .opt_i32 = { .min=0, .max=1, .clamp=0 }, - .persistent = 1 - }); - - vg_convar_push( (struct vg_convar){ - .name = "fcs", - .data = &fc_speed, - .data_type = k_convar_dtype_f32, - .opt_f32 = { .clamp = 0 }, - .persistent = 1 - }); - - vg_convar_push( (struct vg_convar){ - .name = "ledit", - .data = &lightedit, - .data_type = k_convar_dtype_i32, - .opt_i32 = { .min=0, .max=1, .clamp=1 }, - .persistent = 1 - }); +vg_info(" Copyright . . . -----, ,----- ,---. .---. \n" ); +vg_info(" 2021-2022 |\\ /| | / | | | | /| \n" ); +vg_info(" | \\ / | +-- / +----- +---' | / | \n" ); +vg_info(" | \\ / | | / | | \\ | / | \n" ); +vg_info(" | \\/ | | / | | \\ | / | \n" ); +vg_info(" ' ' '--' [] '----- '----- ' ' '---' " + "SOFTWARE\n" ); - vg_convar_push( (struct vg_convar){ - .name = "walk_speed", - .data = &k_walkspeed, - .data_type = k_convar_dtype_f32, - .opt_f32 = { .clamp = 0 }, - .persistent = 1 - }); - - vg_convar_push( (struct vg_convar){ - .name = "dt", - .data = &ktimestep, - .data_type = k_convar_dtype_f32, - .opt_f32 = { .clamp = 0 }, - .persistent = 0 - }); - - vg_convar_push( (struct vg_convar){ - .name = "debugcam", - .data = &sv_debugcam, - .data_type = k_convar_dtype_i32, - .opt_i32 = { .min=0, .max=1, .clamp=0 }, - .persistent = 1 - }); - - vg_convar_push( (struct vg_convar){ - .name = "debugview", - .data = &debugview, - .data_type = k_convar_dtype_i32, - .opt_i32 = { .min=0, .max=1, .clamp=0 }, - .persistent = 1 - }); + highscores_init( 2000, 50 ); + if( !highscores_read() ) + highscores_create_db(); - vg_function_push( (struct vg_cmd){ - .name = "reset", - .function = reset_player - }); + vg_loader_highwater( NULL, highscores_save_at_exit, NULL ); - vg_tex2d_init( texture_list, vg_list_size( texture_list ) ); - - init_other(); + vg_sleep_ms(200); - /* - * If we're in physics test mode we dont need to load anything else, this - * parameter is dev only. TODO: dev only cvars that don't ship with the game - * when building in release mode. - */ + steam_init(); + vg_loader_highwater( NULL, steam_end, NULL ); + vg_loader_highwater( network_init, network_end, NULL ); +} - if( sv_scene == 0 ) - { - character_load( &player.mdl, "ch_new" ); - character_init_ragdoll( &player.mdl ); +VG_STATIC void vg_load(void) +{ + vg_loader_highwater( render_init, NULL, NULL ); + vg_loader_highwater( menu_init, NULL, NULL ); + vg_loader_highwater( world_init, NULL, NULL ); + vg_loader_highwater( player_init, NULL, NULL ); - world_load(); + vg_bake_shaders(); + vg_loader_highwater( audio_init, audio_free, NULL ); - reset_player( 1, (const char *[]){ "start" } ); - rb_init( &player.rb ); + /* 'systems' are completely loaded now */ + world_load( "models/mp_dev.mdl" ); + vg_console_load_autos(); +} - network_init(); - } - else if( sv_scene == 1 ) - { - physics_test_start(); - } - else if( sv_scene == 2 ) - { - anim_test_start(); - } +VG_STATIC void vg_start(void) +{ + reset_player( 1, (const char *[]){ "start" } ); } -void vg_free(void) +VG_STATIC void draw_origin_axis(void) { - network_end(); - vg_tex2d_free( texture_list, vg_list_size(texture_list) ); - /* TODO: THE REST OF THE GOD DAMN FREEING STUFF */ - steam_end(); + vg_line( (v3f){ 0.0f, 0.0f, 0.0f }, (v3f){ 1.0f, 0.0f, 0.0f }, 0xffff0000 ); + vg_line( (v3f){ 0.0f, 0.0f, 0.0f }, (v3f){ 0.0f, 1.0f, 0.0f }, 0xff00ff00 ); + vg_line( (v3f){ 0.0f, 0.0f, 0.0f }, (v3f){ 0.0f, 0.0f, 1.0f }, 0xff0000ff ); } -void vg_update(void) +VG_STATIC void vg_update( int loaded ) { steam_update(); - if( sv_scene == 0 ) + if( loaded ) { + draw_origin_axis(); network_update(); - player_update(); - world_update(); - //traffic_visualize( world.traffic, world.traffic_count ); - // - /* TEMP */ - if( glfwGetKey( vg_window, GLFW_KEY_J )) - { - v3_copy( player.camera_pos, world.mr_ball.co ); - } + + player_update_pre(); + world_update( player.phys.rb.co ); } - else if( sv_scene == 1 ) +} + +VG_STATIC void vg_update_fixed( int loaded ) +{ + if( loaded ) { - physics_test_update(); + player_update_fixed(); } - else if( sv_scene == 2 ) +} + +VG_STATIC void vg_update_post( int loaded ) +{ + if( loaded ) { - anim_test_update(); + player_update_post(); + menu_update(); } } -static void vg_framebuffer_resize( int w, int h ) +VG_STATIC void vg_framebuffer_resize( int w, int h ) { render_fb_resize(); - gate_fb_resize(); water_fb_resize(); } -static void draw_origin_axis(void) +VG_STATIC void render_main_game(void) { - vg_line( (v3f){ 0.0f, 0.0f, 0.0f }, (v3f){ 1.0f, 0.0f, 0.0f }, 0xffff0000 ); - vg_line( (v3f){ 0.0f, 0.0f, 0.0f }, (v3f){ 0.0f, 1.0f, 0.0f }, 0xff00ff00 ); - vg_line( (v3f){ 0.0f, 0.0f, 0.0f }, (v3f){ 0.0f, 0.0f, 1.0f }, 0xff0000ff ); -} + m4x4f world_4x4; + m4x3_expand( camera_mtx_inverse, world_4x4 ); -static void render_main_game(void) -{ - float speed = freecam? 0.0f: v3_length( player.rb.v ); - v3f shake = { vg_randf()-0.5f, vg_randf()-0.5f, vg_randf()-0.5f }; - v3_muls( shake, speed*0.01f, shake ); + static float fov = 97.0f; - m4x4f world_4x4; - m4x3_expand( player.camera_inverse, world_4x4 ); + float fov_target = 108.0f; + if( player.phys.on_board ) + fov_target = 125.0f; + + if( cl_menu ) + fov_target = menu_fov_target; - gpipeline.fov = freecam? 60.0f: 125.0f; /* 120 */ - m4x4_projection( vg_pv, gpipeline.fov, - (float)vg_window_x / (float)vg_window_y, - 0.02f, 2100.0f ); + fov = vg_lerpf( fov, fov_target, vg.frame_delta * 2.0f ); - m4x4_mul( vg_pv, world_4x4, vg_pv ); + gpipeline.fov = freecam? 60.0f: fov; /* 120 */ + m4x4_projection( vg.pv, gpipeline.fov, + (float)vg.window_x / (float)vg.window_y, + 0.1f, 2100.0f ); + m4x4_mul( vg.pv, world_4x4, vg.pv ); glEnable( GL_DEPTH_TEST ); /* * Draw world */ + + int draw_solid = player.is_dead | freecam; - render_world( vg_pv, player.camera ); - render_water_texture( player.camera ); + render_world( vg.pv, camera_mtx ); + if( draw_solid ) + draw_player( camera_mtx ); + + render_water_texture( camera_mtx ); glBindFramebuffer( GL_FRAMEBUFFER, 0 ); - render_water_surface( vg_pv, player.camera ); + render_water_surface( vg.pv, camera_mtx ); + render_world_gates( vg.pv, player.phys.rb.co, camera_mtx ); - vg_tex2d_bind( &tex_water, 1 ); /*TODO: ?*/ - render_world_gates( vg_pv, player.camera ); + if( cl_menu ) + { + glClear( GL_DEPTH_BUFFER_BIT ); + menu_render( vg.pv ); + } /* Copy the RGB of what we have into the background buffer */ glBindFramebuffer( GL_READ_FRAMEBUFFER, 0 ); glBindFramebuffer( GL_DRAW_FRAMEBUFFER, gpipeline.fb_background ); - glBlitFramebuffer( 0,0, vg_window_x, vg_window_y, - 0,0, vg_window_x, vg_window_y, + glBlitFramebuffer( 0,0, vg.window_x, vg.window_y, + 0,0, vg.window_x, vg.window_y, GL_COLOR_BUFFER_BIT, GL_LINEAR ); @@ -304,14 +206,14 @@ static void render_main_game(void) else glClear( GL_COLOR_BUFFER_BIT ); - if( !player.is_dead ) + if( !draw_solid ) { - m4x4_projection( vg_pv, gpipeline.fov, - (float)vg_window_x / (float)vg_window_y, - 0.01f, 600.0f ); - m4x4_mul( vg_pv, world_4x4, vg_pv ); + m4x4_projection( vg.pv, gpipeline.fov, + (float)vg.window_x / (float)vg.window_y, + 0.05f, 60.0f ); + m4x4_mul( vg.pv, world_4x4, vg.pv ); + draw_player( camera_mtx ); } - draw_player(); /* Draw back in the background * @@ -329,42 +231,111 @@ static void render_main_game(void) glBindTexture( GL_TEXTURE_2D, gpipeline.rgb_background ); render_fsquad(); - glDisable(GL_BLEND); - - /* Other shite */ - glDisable( GL_DEPTH_TEST ); - vg_lines_drawall( (float *)vg_pv ); - glViewport( 0,0, vg_window_x, vg_window_y ); } -void vg_render(void) +VG_STATIC void vg_render(void) { glBindFramebuffer( GL_FRAMEBUFFER, 0 ); - glViewport( 0,0, vg_window_x, vg_window_y ); - + glViewport( 0,0, vg.window_x, vg.window_y ); glDisable( GL_DEPTH_TEST ); + glClearColor( 0.11f, 0.35f, 0.37f, 1.0f ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ); -#ifndef SR_NETWORK_TEST - draw_origin_axis(); + render_main_game(); + + + /* Other shite */ + glDisable(GL_BLEND); + glDisable( GL_DEPTH_TEST ); + vg_lines_drawall( (float *)vg.pv ); + glViewport( 0,0, vg.window_x, vg.window_y ); +} - if( sv_scene == 0 ) +VG_STATIC void vg_ui(void) +{ +#if 0 + if( cl_menu ) { - render_main_game(); + ui_rect menu = + { + vg.window_x / 2 - 150, + vg.window_y / 2 - 50, + 300, + 130 + }; + + ui_fill_rect( &ui_global_ctx, menu, 0xa0000000 ); + + ui_text( &ui_global_ctx, (ui_rect){ menu[0]+menu[2]/2,menu[1]+6, 0, 0 }, + steam_username_at_startup, + 1, k_text_align_center ); + menu[1] += 24; + menu[3] -= 30; + + ui_rect_pad( menu, 8 ); + ui_fill_rect( &ui_global_ctx, menu, 0x90ffffff ); + ui_rect_pad( menu, 2 ); + ui_fill_rect( &ui_global_ctx, menu, 0xa0000000 ); + + menu[1] += 32; + ui_text( &ui_global_ctx, (ui_rect){ menu[0]+menu[2]/2,menu[1], 0, 0 }, + "Exit", 2, k_text_align_center ); + + if( vg_get_button_down( "jump" ) ) + { + glfwSetWindowShouldClose( vg.window, 1 ); + } } - else if( sv_scene == 1 ) + + if( lightedit ) { - physics_test_render(); + ui_global_ctx.cursor[0] = 10; + ui_global_ctx.cursor[1] = 10; + ui_global_ctx.cursor[2] = 200; + ui_global_ctx.cursor[3] = 20; + + struct ub_world_lighting *wl = &gpipeline.ub_world_lighting; + struct ui_slider_vector + s5 = { .min=0.0f, .max=2.0f, .len=3, .data=wl->g_ambient_colour }; + + struct ui_slider + s8 = { .min=0.0f, .max=2.0f, .data = &gpipeline.shadow_spread }, + s9 = { .min=0.0f, .max=25.0f, .data = &gpipeline.shadow_length }; + + 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; + struct ui_checkbox c1 = {.data = &wl->g_light_preview}; + ui_checkbox( &ui_global_ctx, &c1 ); + + render_update_lighting_ub(); } - else if( sv_scene == 2 ) +#endif + + //glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); + if( cl_ui ) { - anim_test_render( &tex_characters ); + render_world_routes_ui(); } -#endif + //glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); + + audio_debug_soundscapes(); } -static void run_light_widget( struct light_widget *lw ) +#if 0 +VG_STATIC void run_light_widget( struct light_widget *lw ) { struct ui_checkbox c1 = { .data=&lw->enabled }; @@ -381,107 +352,106 @@ static void run_light_widget( struct light_widget *lw ) ui_slider_vector( &ui_global_ctx, &dir ); } } +#endif -static void run_debug_info(void) +VG_STATIC void run_debug_info(void) { char buf[40]; - snprintf( buf, 40, "%.2fm/s", v3_length( player.rb.v ) ); - gui_text( (ui_px [2]){ 0, 0 }, buf, 1, k_text_align_left ); + snprintf( buf, 40, "%.2fm/s", v3_length( player.phys.rb.v ) ); + ui_text( (ui_px [2]){ 0, 0 }, buf, 1, k_text_align_left ); snprintf( buf, 40, "%.2f %.2f %.2f m/s", - player.a[0], player.a[1], player.a[2] ); - gui_text( (ui_px [2]){ 0, 20 }, buf, 1, k_text_align_left ); + player.phys.a[0], player.phys.a[1], player.phys.a[2] ); + ui_text( (ui_px [2]){ 0, 20 }, buf, 1, k_text_align_left ); snprintf( buf, 40, "pos %.2f %.2f %.2f", - player.rb.co[0], player.rb.co[1], player.rb.co[2] ); - gui_text( (ui_px [2]){ 0, 40 }, buf, 1, k_text_align_left ); + player.phys.rb.co[0], player.phys.rb.co[1], player.phys.rb.co[2] ); + ui_text( (ui_px [2]){ 0, 40 }, buf, 1, k_text_align_left ); - if( vg_gamepad_ready ) + if( vg.gamepad_ready ) { for( int i=0; i<6; i++ ) { - snprintf( buf, 40, "%.2f", vg_gamepad.axes[i] ); - gui_text( (ui_px [2]){ 0, (i+3)*20 }, buf, 1, k_text_align_left ); + snprintf( buf, 40, "%.2f", vg.gamepad.axes[i] ); + ui_text( (ui_px [2]){ 0, (i+3)*20 }, buf, 1, k_text_align_left ); } } else { - gui_text( (ui_px [2]){ 0, 60 }, + ui_text( (ui_px [2]){ 0, 60 }, "Gamepad not ready", 1, k_text_align_left ); } } -void vg_ui(void) -{ - if( lightedit ) - { - ui_global_ctx.cursor[0] = 10; - ui_global_ctx.cursor[1] = 10; - ui_global_ctx.cursor[2] = 200; - ui_global_ctx.cursor[3] = 20; - - struct ub_world_lighting *wl = &gpipeline.ub_world_lighting; - struct ui_slider_vector - s5 = { .min=0.0f, .max=2.0f, .len=3, .data=wl->g_ambient_colour }; - - struct ui_slider - s8 = { .min=0.0f, .max=2.0f, .data = &gpipeline.shadow_spread }, - s9 = { .min=0.0f, .max=25.0f, .data = &gpipeline.shadow_length }; +#else - for( int i=0; i<3; i++ ) - run_light_widget( &gpipeline.widgets[i] ); +#define VG_TIMESTEP_FIXED (1.0/60.0) +#define VG_3D +#define VG_FRAMEBUFFER_RESIZE 1 +#include "vg/vg.h" - gui_text( ui_global_ctx.cursor, "Ambient", 1, 0 ); - ui_global_ctx.cursor[1] += 16; - ui_slider_vector( &ui_global_ctx, &s5 ); +int main( int argc, char *argv[] ) +{ + vg_prealloc_quota( 512*1024*1024 ); + vg_enter( argc, argv, "Voyager Game Engine" ); +} - 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 ); +VG_STATIC void vg_preload(void) +{ +vg_info(" Copyright . . . -----, ,----- ,---. .---. \n" ); +vg_info(" 2021-2022 |\\ /| | / | | | | /| \n" ); +vg_info(" | \\ / | +-- / +----- +---' | / | \n" ); +vg_info(" | \\ / | | / | | \\ | / | \n" ); +vg_info(" | \\/ | | / | | \\ | / | \n" ); +vg_info(" ' ' '--' [] '----- '----- ' ' '---' " + "SOFTWARE\n" ); +} - gui_text( ui_global_ctx.cursor, "Misc", 1, 0 ); - ui_global_ctx.cursor[1] += 16; - struct ui_checkbox c1 = {.data = &wl->g_light_preview}; - ui_checkbox( &ui_global_ctx, &c1 ); +VG_STATIC void vg_load(void) +{ + vg_bake_shaders(); + vg_console_load_autos(); +} - render_update_lighting_ub(); - } - - //glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); - render_world_routes_ui(); - //glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); +VG_STATIC void vg_start(void) +{ +} -#if 0 - static double last_b_press = 0.0; +VG_STATIC void vg_update( int loaded ) +{ +} - double localtime = vg_time - last_b_press; +VG_STATIC void vg_update_fixed( int loaded ) +{ +} - world_routes_ui_updatetime( 0, localtime ); - world_routes_ui_draw( 0, (v4f){ 1.0f,0.0f,1.0f,1.0f}, 9.0f ); +VG_STATIC void vg_update_post( int loaded ) +{ +} - if( glfwGetKey(vg_window,GLFW_KEY_B) ) - world_routes_ui_notch( 0, localtime ); +VG_STATIC void vg_framebuffer_resize( int w, int h ) +{ +} - if( vg_time-last_b_press > 1.0 ) - if( glfwGetKey(vg_window,GLFW_KEY_N) ) - { - last_b_press = vg_time; - world_routes_ui_newseg( 0 ); - } +VG_STATIC void vg_render(void) +{ + glBindFramebuffer( GL_FRAMEBUFFER, 0 ); + glViewport( 0,0, vg.window_x, vg.window_y ); + glDisable( GL_DEPTH_TEST ); - static double last_m_press; - if( vg_time-last_m_press > 1.0 ) - if( glfwGetKey( vg_window, GLFW_KEY_M) ) - { - last_m_press = vg_time; + glClearColor( 0.11f, 0.35f, 0.37f, 1.0f ); + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ); + + /* Other shite */ + glDisable(GL_BLEND); + glDisable( GL_DEPTH_TEST ); + vg_lines_drawall( (float *)vg.pv ); + glViewport( 0,0, vg.window_x, vg.window_y ); +} - vg_info( "start: %u\n",world.routes.routes[0].ui.segment_count ); - for( int i=0; i