dusting
[carveJwlIkooP6JGAAIwe30JlM.git] / world.h
diff --git a/world.h b/world.h
index ab663d005e4ffadacb32956e34c3e503c9287679..c782ae09d7369cd90ddb51c3b25ef774166feced 100644 (file)
--- a/world.h
+++ b/world.h
@@ -87,6 +87,8 @@ struct world_instance {
       v4f g_sunset_ambient;
       v4f g_sun_colour;
       v4f g_sun_dir;
+      v4f g_board_0;
+      v4f g_board_1;
 
       float g_water_fog;
       float g_time;
@@ -277,6 +279,13 @@ int ray_world( world_instance *world, v3f pos, v3f dir, ray_hit *hit );
  * Submodules
  */
 
+VG_STATIC float
+   k_day_length            = 30.0f; /* minutes */
+
+VG_STATIC int   k_debug_light_indices = 0,
+                k_debug_light_complexity = 0,
+                k_light_preview = 0;
+
 #include "world_routes.h"
 #include "world_sfd.h"
 #include "world_render.h"
@@ -299,6 +308,11 @@ VG_STATIC int world_stop_sound( int argc, const char *argv[] )
 
 VG_STATIC void world_init(void)
 {
+   VG_VAR_F32( k_day_length );
+   VG_VAR_I32( k_debug_light_indices );
+   VG_VAR_I32( k_debug_light_complexity );
+   VG_VAR_I32( k_light_preview );
+
    world_global.sky_rate = 1.0;
    world_global.sky_target_rate = 1.0;
 
@@ -473,48 +487,6 @@ VG_STATIC void entity_call( world_instance *world, ent_call *call )
 
 VG_STATIC void world_update( world_instance *world, v3f pos )
 {
-   /* TEMP!!!!!! */
-   static double g_time = 0.0;
-   g_time += vg.time_delta * (1.0/(k_day_length*60.0));
-
-
-   struct ub_world_lighting *state = &world->ub_lighting;
-
-   state->g_time = g_time;
-   state->g_realtime = vg.time;
-   state->g_debug_indices = k_debug_light_indices;
-   state->g_light_preview = k_light_preview;
-   state->g_debug_complexity = k_debug_light_complexity;
-
-   state->g_time_of_day = vg_fractf( g_time );
-   state->g_day_phase   = cosf( state->g_time_of_day * VG_PIf * 2.0f );
-   state->g_sunset_phase= cosf( state->g_time_of_day * VG_PIf * 4.0f + VG_PIf );
-
-   state->g_day_phase    =       state->g_day_phase    * 0.5f + 0.5f;
-   state->g_sunset_phase = powf( state->g_sunset_phase * 0.5f + 0.5f, 6.0f );
-
-   float a = state->g_time_of_day * VG_PIf * 2.0f;
-   state->g_sun_dir[0] = sinf( a );
-   state->g_sun_dir[1] = cosf( a );
-   state->g_sun_dir[2] = 0.2f;
-   v3_normalize( state->g_sun_dir );
-
-
-   world->probabilities[ k_probability_curve_constant ] = 1.0f;
-
-   float dp = state->g_day_phase;
-
-   world->probabilities[ k_probability_curve_wildlife_day ] =
-      (dp*dp*0.8f+state->g_sunset_phase)*0.8f;
-   world->probabilities[ k_probability_curve_wildlife_night ] = 
-      1.0f-powf(fabsf((state->g_time_of_day-0.5f)*5.0f),5.0f);
-      
-
-   glBindBuffer( GL_UNIFORM_BUFFER, world->ubo_lighting );
-   glBufferSubData( GL_UNIFORM_BUFFER, 0, 
-                    sizeof(struct ub_world_lighting), &world->ub_lighting );
-   /* TEMP!!!!!! */
-
    world_global.sky_time += world_global.sky_rate * vg.time_delta;
    world_global.sky_rate = vg_lerp( world_global.sky_rate, 
                                     world_global.sky_target_rate, 
@@ -563,8 +535,6 @@ VG_STATIC void world_update( world_instance *world, v3f pos )
       }
    }
    sfd_update();
-   
-
 
    static float random_accum = 0.0f;
    random_accum += vg.time_delta;