+ double sky_time, sky_rate, sky_target_rate;
+
+ /* water rendering */
+ struct
+ {
+ struct framebuffer fbreflect, fbdepth;
+
+ boxf depthbounds;
+ int depth_computed;
+
+ float height;
+ int enabled;
+ v4f plane;
+ }
+ water;
+
+ /* split flap display */
+ struct
+ {
+ mdl_submesh *sm_module, *sm_card;
+ glmesh mesh_base, mesh_display;
+
+ u32 w, h;
+ float *buffer;
+ }
+ sfd;
+
+ /* timing bars, fixed maximum amount */
+ struct route_ui_bar
+ {
+ GLuint vao, vbo, ebo;
+
+ u32 indices_head;
+ u32 vertex_head;
+
+ struct route_ui_segment
+ {
+ float length;
+ u32 vertex_start, vertex_count,
+ index_start, index_count, notches;
+ }
+ segments[k_max_ui_segments];
+
+ u32 segment_start, segment_count, fade_start, fade_count;
+ double fade_timer_start;
+ float xpos;
+ }
+ ui_bars[16];
+
+ v3f render_gate_pos;
+ int active_route_board;
+ int in_trigger;
+
+ /* This is a small flag we use to changelevel.
+ * It will not be cleared until all sounds stop playing
+ */
+ int switching_to_new_world;
+ char world_name[ 64 ];
+
+ /*
+ * Dynamically allocated when world_load is called.
+ *
+ * the following arrays index somewhere into this linear
+ * allocator
+ *
+ * (world_gen.h)
+ * --------------------------------------------------------------------------
+ */
+ void *dynamic_vgl,
+ *audio_vgl; /* sub buffer of the audio buffer */
+
+ /*
+ * Main world .mdl
+ */
+ mdl_context *meta;
+
+ /*
+ * Materials / textures
+ */
+
+ GLuint *textures;
+ u32 texture_count;
+
+ struct world_material
+ {
+ mdl_material info;
+ mdl_submesh sm_geo,
+ sm_no_collide;
+ }
+ * materials;
+ u32 material_count;
+
+ /*
+ * Named safe places to respawn
+ */
+ struct respawn_point
+ {
+ v3f co;
+ v4f q;
+ const char *name;
+ }
+ * spawns;
+ u32 spawn_count;
+
+ /*
+ * Audio player entities
+ */
+ struct world_audio_thing
+ {
+ v3f pos;
+ float volume;
+ u32 flags;
+
+ audio_player player;
+ audio_clip temp_embedded_clip;
+ }
+ * audio_things;
+ u32 audio_things_count;
+
+ /*
+ * Relays
+ */
+ struct logic_relay
+ {
+ v3f pos;
+
+ struct relay_target
+ {
+ u32 sub_id;
+ enum classtype classtype;
+ }
+ targets[4];
+ u32 target_count;
+ }
+ * logic_relays;
+ u32 relay_count;
+
+ /*
+ * Box trigger entities
+ */
+ struct trigger_zone
+ {
+ m4x3f transform, inv_transform;
+
+ struct relay_target target;
+ }
+ * triggers;
+ u32 trigger_count;
+
+ /*
+ * Achievements
+ */
+ struct logic_achievement
+ {
+ v3f pos;
+ const char *achievement_id;
+ u32 achieved;
+ }
+ * logic_achievements;
+ u32 achievement_count;
+
+
+ /*
+ * Routes (world_routes.h)
+ * --------------------------------------------------------------------------
+ */
+ struct route_node
+ {
+ v3f co, right, up, h;
+ u32 next[2];
+
+ u32 special_type, special_id, current_refs, ref_count;
+ u32 route_ids[4]; /* Gates can be linked into up to four routes */
+ }
+ *nodes;
+ u32 node_count;
+
+ struct route
+ {
+ u32 track_id;
+ v4f colour;
+
+ u32 start;
+ mdl_submesh sm;
+
+ int active;
+ float factive;
+
+ double best_lap, latest_pass; /* Session */
+
+ m4x3f scoreboard_transform;
+ }
+ *routes;
+ u32 route_count;
+
+ struct route_gate
+ {
+ struct teleport_gate
+ {
+ v3f co[2];
+ v4f q[2];
+ v2f dims;
+
+ m4x3f to_world, recv_to_world, transport;
+ }
+ gate;
+
+ u32 node_id;
+
+ struct route_timing
+ {
+ u32 version; /* Incremented on every teleport */
+ double time;
+ }
+ timing;
+ }
+ *gates;