- *collectors;
-
- u32 gate_count,
- gate_cap,
- collector_count,
- collector_cap;
-
- u32 active_gate,
- current_run_version;
-
- scene scene_lines;
-}
-static world_routes;
-
-
-/*
- * API
- */
-
-static int ray_hit_is_ramp( ray_hit *hit );
-static int ray_hit_is_terrain( ray_hit *hit );
-static void ray_world_get_tri( ray_hit *hit, v3f tri[3] );
-static int ray_world( v3f pos, v3f dir, ray_hit *hit );
-
-/*
- * Submodules
- */
-
-#include "world_routes.h"
-#include "world_sfd.h"
-#include "world_render.h"
-#include "world_water.h"
-#include "world_gen.h"
-#include "world_gate.h"
-
-/*
- * -----------------------------------------------------------------------------
- * Events
- * -----------------------------------------------------------------------------
- */
-
-static void world_init(void)
-{
- world.sky_rate = 1.0;
- world.sky_target_rate = 1.0;
-
- shader_terrain_register();
- shader_sky_register();
- shader_planeinf_register();
- shader_gpos_register();
- shader_fscolour_register();
- shader_alphatest_register();
-
- vg_info( "Loading world resources\n" );
-
- VG_REQUIRED_ASSET( mdl_header*, mcars, mdl_load, "models/rs_cars.mdl" );
- VG_REQUIRED_ASSET( mdl_header*, msky, mdl_load, "models/rs_skydome.mdl" );
-
- mdl_node *nholden = mdl_node_from_name( mcars, "holden" );
- world.car_holden = *mdl_node_submesh( mcars, nholden, 0 );
-
- mdl_node *nlower = mdl_node_from_name( msky, "dome_lower" ),
- *nupper = mdl_node_from_name( msky, "dome_upper" );
-
- world.dome_lower = *mdl_node_submesh( msky, nlower, 0 );
- world.dome_upper = *mdl_node_submesh( msky, nupper, 0 );
-
- vg_acquire_thread_sync();
- {
- mdl_unpack_glmesh( mcars, &world.cars );
- mdl_unpack_glmesh( msky, &world.skydome );
+ ub_lighting;
+ GLuint ubo_lighting;
+ int ubo_bind_point;
+
+ GLuint tbo_light_entities,
+ tex_light_entities,
+ tex_light_cubes;
+
+ float probabilities[3];
+
+ v3i light_cubes;
+ struct framebuffer heightmap;
+
+ /*
+ * Dynamically allocated when world_load is called.
+ *
+ * the following arrays index somewhere into this linear
+ * allocator
+ * --------------------------------------------------------------------------
+ */
+
+ /*
+ * Main world .mdl
+ */
+ mdl_context meta;
+
+ GLuint *textures;
+ u32 texture_count;
+
+ struct world_surface{
+ mdl_material info;
+ mdl_submesh sm_geo,
+ sm_no_collide;
+ u32 flags;