+#if 0
+ u32 size = vg_linear_remaining( vg_audio.audio_pool )
+ - sizeof(vg_linear_allocator);
+
+ world_global.audio_heap = vg_create_linear_allocator( vg_audio.audio_pool,
+ size,
+ VG_MEMORY_SYSTEM );
+#endif
+}
+
+VG_STATIC void world_trigger_achievement( world_instance *world, u32 uid )
+{
+ struct logic_achievement *ach = &world->logic_achievements[ uid ];
+
+ if( ach->achieved )
+ return;
+
+ steam_set_achievement( ach->achievement_id );
+ steam_store_achievements();
+
+ ach->achieved = 1;
+}
+
+VG_STATIC void world_run_relay( world_instance *world,
+ struct relay_target *rt );
+
+VG_STATIC void world_trigger_relay( world_instance *world, u32 uid )
+{
+ struct logic_relay *relay = &world->logic_relays[ uid ];
+
+ for( int i=0; i<relay->target_count; i++ )
+ {
+ world_run_relay( world, &relay->targets[i] );
+ }
+}
+
+VG_STATIC void world_trigger_audio( world_instance *world, u32 uid )
+{
+ struct world_audio_thing *wat = &world->audio_things[ uid ];
+
+ audio_lock();
+ audio_player_playclip( &wat->player,
+ &wat->temp_embedded_clip );
+ audio_unlock();
+}
+
+VG_STATIC void world_run_relay( world_instance *world,
+ struct relay_target *rt )
+{
+ struct entity_instruction
+ {
+ enum classtype classtype;
+ void (*p_trigger)( world_instance *world, u32 uid );
+ }
+ entity_instructions[] =
+ {
+ { k_classtype_logic_achievement, world_trigger_achievement },
+ { k_classtype_logic_relay, world_trigger_relay },
+ { k_classtype_audio, world_trigger_audio }
+ };
+
+ for( int i=0; i<vg_list_size(entity_instructions); i++ )
+ {
+ struct entity_instruction *instr = &entity_instructions[i];
+
+ if( instr->classtype == rt->classtype )
+ {
+ instr->p_trigger( world, rt->sub_id );
+ return;
+ }
+ }
+
+ vg_error( "Don't know how to trigger classtype %d\n", rt->classtype );
+}
+
+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_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 );
+
+
+
+ glBindBuffer( GL_UNIFORM_BUFFER, world->ubo_lighting );
+ glBufferSubData( GL_UNIFORM_BUFFER, 0,
+ sizeof(struct ub_world_lighting), &world->ub_lighting );
+ /* TEMP!!!!!! */
+
+
+#if 0