+ world->textures = NULL;
+ world->texture_count = 0;
+ world->materials = NULL;
+ world->material_count = 0;
+
+ world->scene_geo = NULL;
+ world->scene_no_collide = NULL;
+ world->scene_lines = NULL;
+
+ world->geo_bh = NULL;
+ world->trigger_bh = NULL;
+ world->audio_bh = NULL;
+
+ world->spawns = NULL;
+ world->spawn_count = 0;
+
+ world->audio_things = NULL;
+ world->audio_things_count = 0;
+
+ world->triggers = NULL;
+ world->trigger_count = 0;
+
+ world->lights = NULL;
+ world->light_count = 0;
+
+#if 0
+ world->logic_relays = NULL;
+ world->relay_count = 0;
+#endif
+
+ world->logic_achievements = NULL;
+ world->achievement_count = 0;
+
+ world->nodes = NULL;
+ world->node_count = 0;
+
+ world->routes = NULL;
+ world->route_count = 0;
+
+ world->gates = NULL;
+ world->gate_count = 0;
+
+ world->collectors = NULL;
+ world->collector_count = 0;
+
+ world->soundscapes = NULL;
+ world->soundscape_count = 0;
+
+ world->logic_bricks = NULL;
+ world->logic_brick_count = 0;
+
+ world->nonlocal_gates = NULL;
+ world->nonlocalgate_count = 0;
+
+ world->water.enabled = 0;
+
+
+ /* default lighting conditions
+ * -------------------------------------------------------------*/
+ struct ub_world_lighting *state = &world->ub_lighting;
+
+ state->g_light_preview = 0;
+ state->g_shadow_samples = 8;
+ state->g_water_fog = 0.04f;
+
+ v4_zero( state->g_water_plane );
+ v4_zero( state->g_depth_bounds );
+
+ state->g_shadow_length = 9.50f;
+ state->g_shadow_spread = 0.65f;
+
+ v3_copy( (v3f){0.37f, 0.54f, 0.97f}, state->g_daysky_colour );
+ v3_copy( (v3f){0.03f, 0.05f, 0.20f}, state->g_nightsky_colour );
+ v3_copy( (v3f){1.00f, 0.32f, 0.01f}, state->g_sunset_colour );
+ v3_copy( (v3f){0.13f, 0.17f, 0.35f}, state->g_ambient_colour );
+ v3_copy( (v3f){0.25f, 0.17f, 0.51f}, state->g_sunset_ambient );
+ v3_copy( (v3f){1.10f, 0.89f, 0.35f}, state->g_sun_colour );
+}
+
+VG_STATIC void world_load( world_instance *world, const char *path )
+{
+ world_unload( world );
+ world_clean( world );
+
+ world->meta = mdl_load_full( world_global.generic_heap, path );
+ vg_info( "Loading world: %s\n", path );
+
+ /* process resources from pack */
+ world_process_resources( world );
+
+ /* dynamic allocations */
+ world_ents_allocate( world );
+ world_routes_allocate( world );
+
+ /* meta processing */
+ world_routes_process( world );
+ world_entities_process( world );
+
+ /* main bulk */
+ world_generate( world );
+ world_routes_generate( world );
+ world_post_process( world );