- v3f pos;
- v3_mul( volume, (v3f){ vg_randf(), 1000.0f, vg_randf() }, pos );
- v3_add( pos, world.geo.bbx[0], pos );
-
- ray_hit hit;
- hit.dist = INFINITY;
+ mdl_unpack_glmesh( mcars, &world.cars );
+ mdl_unpack_glmesh( msky, &world.skydome );
+ }
+ vg_release_thread_sync();
+
+ vg_free(mcars);
+ vg_free(msky);
+
+ /* Other systems */
+ vg_info( "Loading other world systems\n" );
+
+ vg_loader_highwater( world_render_init, world_render_free, NULL );
+ vg_loader_highwater( world_sfd_init, world_sfd_free, NULL );
+ vg_loader_highwater( world_water_init, world_water_free, NULL );
+ vg_loader_highwater( world_gates_init, world_gates_free, NULL );
+ vg_loader_highwater( world_routes_init, world_routes_free, NULL );
+}
+
+static void world_free( void *_ )
+{
+ mesh_free( &world.cars );
+ mesh_free( &world.skydome );
+}
+
+static void world_update( v3f pos )
+{
+ world_routes_update();
+#if 0
+ world_routes_debug();
+#endif
+
+ int closest = 0;
+ float min_dist = INFINITY;
+
+ for( int i=0; i<world.routes.route_count; i++ )
+ {
+ float d = v3_dist2( world.routes.routes[i].scoreboard_transform[3], pos );