-#include "water.h"
-
-#include "shaders/standard.h"
-
-static struct gworld
-{
- scene geo, foliage;
- submodel sm_road, sm_terrain;
- glmesh skybox;
-
- v3f tutorial;
-}
-world;
-
-static void render_world( m4x4f projection, m4x3f camera )
-{
- render_sky( camera );
-
- m4x3f identity_matrix;
- m4x3_identity( identity_matrix );
-
- render_terrain( projection, camera[3] );
- scene_bind( &world.geo );
- scene_draw( &world.geo );
-
- glDisable(GL_CULL_FACE);
- scene_bind( &world.foliage );
- scene_draw( &world.foliage );
- glEnable(GL_CULL_FACE);
-}
-
-static void ray_world_get_tri( ray_hit *hit, v3f tri[3] )
-{
- for( int i=0; i<3; i++ )
- v3_copy( world.geo.verts[ hit->tri[i] ].co, tri[i] );
-}
-
-static int ray_world( v3f pos, v3f dir, ray_hit *hit )
-{
- return bvh_raycast( &world.geo, pos, dir, hit );
-}
-
-static int ray_hit_is_ramp( ray_hit *hit )
-{
- return hit->tri[0] < world.sm_road.vertex_count;
-}
-
-static void world_load(void)
-{
- /* Setup scene */
- scene_init( &world.geo );
- model *mworld = vg_asset_read( "models/mp_dev.mdl" );
-
- scene_add_model( &world.geo, mworld, submodel_get( mworld, "mp_dev" ),
- (v3f){0.0f,0.0f,0.0f}, 0.0f, 1.0f );
- scene_copy_slice( &world.geo, &world.sm_road );
-
- scene_add_model( &world.geo, mworld, submodel_get( mworld, "terrain" ),
- (v3f){0.0f,0.0f,0.0f}, 0.0f, 1.0f );
- scene_copy_slice( &world.geo, &world.sm_terrain );
-
- v3_copy( model_marker_get( mworld, "mp_dev_tutorial" )->co, world.tutorial );
-
-
- /* GATE DEV */
-#if 0
- {
- model_marker *ga = model_marker_get(mworld,"gate_a"),
- *gb = model_marker_get(mworld,"gate_a_recv");
-
- v3_copy( ga->co, gate_a.co );
- v3_copy( gb->co, gate_b.co );
- v4_copy( ga->q, gate_a.q );
- v4_copy( gb->q, gate_b.q );
- v2_copy( ga->s, gate_a.dims );
- v2_copy( gb->s, gate_b.dims );
+#include "network_msg.h"
+
+/* types
+ */
+
+enum world_geo_type{
+ k_world_geo_type_solid = 0,
+ k_world_geo_type_nonsolid = 1,
+ k_world_geo_type_water = 2
+};
+
+enum world_purpose{
+ k_world_purpose_invalid = -1,
+ k_world_purpose_hub = 0,
+ k_world_purpose_client = 1,
+ k_world_max
+};
+
+struct leaderboard_cache {
+ enum request_status status;
+ f64 cache_time;
+ u8 *data;
+ u32 data_len;
+};
+
+typedef struct world_instance world_instance;
+
+static void skaterift_world_get_save_path( enum world_purpose which,
+ char buf[128] );
+
+/* submodule headers */
+#include "world_entity.h"
+#include "world_gate.h"
+#include "world_gen.h"
+#include "world_info.h"
+#include "world_load.h"
+#include "world_physics.h"
+#include "world_render.h"
+#include "world_sfd.h"
+#include "world_volumes.h"
+#include "world_water.h"
+#include "world_audio.h"
+#include "world_routes.h"
+
+/* console variables */
+
+static f32 k_day_length = 30.0f; /* minutes */
+static i32 k_debug_light_indices = 0,
+ k_debug_light_complexity= 0,
+ k_light_preview = 0;
+
+
+struct world_instance {
+ /* Fixed items
+ * -------------------------------------------------------
+ */
+
+ v4f player_co;
+
+ void *heap;
+ enum world_status{
+ k_world_status_unloaded = 0,
+ k_world_status_loading = 1,
+ k_world_status_loaded = 2,
+ k_world_status_unloading = 3 /* dont spawn sounds and stuff */
+ }
+ status;