From f99902f513b0ad606437bf32de47405dd4ea5f98 Mon Sep 17 00:00:00 2001 From: hgn Date: Thu, 13 Apr 2023 05:51:16 +0100 Subject: [PATCH] dusting --- audio.h | 21 -- bvh.h | 7 + common.h | 157 +---------- conf.h | 44 +-- player.c | 12 +- player.h | 18 ++ player_animation.h | 415 ---------------------------- player_common.c | 4 + player_ragdoll.h | 17 ++ player_skate.h | 98 ++++++- player_walk.h | 31 ++- render.h | 104 +++---- rigidbody.h | 77 ++---- shaders/common_scene.glsl | 3 +- shaders/common_world.glsl | 2 + shaders/model_character_view.h | 4 +- shaders/model_sky.h | 4 +- shaders/scene_depth.h | 7 +- shaders/scene_position.h | 7 +- shaders/scene_route.fs | 2 - shaders/scene_route.h | 23 +- shaders/scene_scoretext.h | 23 +- shaders/scene_standard.fs | 2 - shaders/scene_standard.h | 23 +- shaders/scene_standard_alphatest.fs | 2 - shaders/scene_standard_alphatest.h | 23 +- shaders/scene_terrain.fs | 2 - shaders/scene_terrain.h | 23 +- shaders/scene_vertex_blend.fs | 2 - shaders/scene_vertex_blend.h | 23 +- shaders/scene_water.h | 7 +- shaders/scene_water_fast.h | 7 +- skaterift.c | 45 +-- steam.h | 20 +- vehicle.h | 23 +- world.h | 58 +--- world_render.h | 51 +++- world_routes.h | 9 +- world_sfd.h | 6 +- 39 files changed, 375 insertions(+), 1031 deletions(-) delete mode 100644 player_animation.h diff --git a/audio.h b/audio.h index 0970933..d1fd1cc 100644 --- a/audio.h +++ b/audio.h @@ -9,11 +9,6 @@ #include "world.h" -VG_STATIC float audio_occlusion_current = 0.0f, - k_audio_occlusion_rate = 1.0f; - -VG_STATIC int k_audio_debug_soundscape = 0; - audio_clip audio_board[] = { { .path="sound/skate_hpf.ogg" }, @@ -156,22 +151,6 @@ VG_STATIC void audio_init(void) audio_clip_loadn( audio_rewind, vg_list_size(audio_rewind), NULL ); audio_clip_loadn( audio_ui, vg_list_size(audio_ui), NULL ); - vg_var_push( (struct vg_var){ - .name = "aud_debug_soundscape", - .data = &k_audio_debug_soundscape, - .data_type = k_var_dtype_i32, - .opt_i32 = { .min=0, .max=1, .clamp=0 }, - .persistent = 1 - }); - - vg_var_push( (struct vg_var){ - .name = "aud_occlusion_rate", - .data = &k_audio_occlusion_rate, - .data_type = k_var_dtype_f32, - .opt_f32 = { .clamp = 0 }, - .persistent = 1 - }); - audio_lock(); audio_set_lfo_wave( 0, k_lfo_polynomial_bipolar, 80.0f ); audio_set_lfo_frequency( 0, 20.0f ); diff --git a/bvh.h b/bvh.h index b054741..ddc81ca 100644 --- a/bvh.h +++ b/bvh.h @@ -26,6 +26,13 @@ typedef struct bh_node bh_node; typedef struct bh_tree bh_tree; typedef struct bh_system bh_system; +typedef struct ray_hit ray_hit; +struct ray_hit{ + float dist; + u32 *tri; + v3f pos, normal; +}; + struct bh_tree { u32 node_count; diff --git a/common.h b/common.h index 9eda6f6..4c04de7 100644 --- a/common.h +++ b/common.h @@ -14,11 +14,8 @@ #include "vg/vg.h" #include "submodules/anyascii/impl/c/anyascii.c" -#define RESET_MAX_TIME 45.0 -VG_STATIC v3f TEMP_BOARD_0, TEMP_BOARD_1; -enum menu_controller_type -{ +enum menu_controller_type{ k_menu_controller_type_keyboard, k_menu_controller_type_xbox, k_menu_controller_type_playstation, @@ -28,156 +25,4 @@ enum menu_controller_type VG_STATIC enum menu_controller_type menu_display_controller; -typedef struct ray_hit ray_hit; -struct ray_hit -{ - float dist; - u32 *tri; - v3f pos, normal; -}; - -VG_STATIC float - k_friction_lat = 12.0f, - k_friction_resistance = 0.01f, - - k_max_push_speed = 16.0f, - k_push_accel = 10.0f, - k_push_cycle_rate = 8.0f, - - k_steer_ground = 2.5f, - k_steer_air = 3.6f, - - k_jump_charge_speed = (1.0f/0.4f), - k_jump_force = 5.0f, - - k_pitch_limit = 1.5f, - k_look_speed = 2.0f, - - k_cog_spring = 0.2f, - k_cog_damp = 0.02f, - k_cog_mass_ratio = 0.9f, - - k_mmthrow_scale = 6.0f, - k_mmcollect_lat = 2.0f, - k_mmcollect_vert = 0.0f, - k_mmdecay = 12.0f, - k_spring_angular = 1.0f, - - k_spring_force = 300.0f, - k_spring_dampener = 5.0f, - - k_grind_spring = 50.0f, - k_grind_aligment = 10.0f, - k_grind_dampener = 5.0f, - - k_surface_spring = 100.0f, - k_surface_dampener = 40.0f, - k_manul_spring = 200.0f, - k_manul_dampener = 30.0f, - k_board_interia = 8.0f, - - k_grind_decayxy = 30.0f, - k_grind_axel_min_vel = 1.0f, - k_grind_axel_max_angle = 0.95f, /* cosine(|a|) */ - k_grind_axel_max_vangle = 0.4f, - k_grind_max_friction = 3.0f, - k_grind_max_edge_angle = 0.97f, - - k_board_length = 0.45f, - k_board_width = 0.13f, - k_board_end_radius = 0.1f, - k_board_radius = 0.14f, /* 0.07 */ - - k_grind_balance = -40.0f; - -VG_STATIC float - k_walkspeed = 10.0f, - k_airspeed = 1.2f, - k_stopspeed = 4.0f, - k_walk_accel = 10.0f, - k_walk_air_accel = 7.0f, - k_walk_friction = 10.0f, - k_walk_step_height = 0.2f; - -VG_STATIC float - k_cam_punch = -0.1f, - k_cam_spring = 20.0f, - k_cam_damp = 6.7f; - -VG_STATIC float - k_day_length = 30.0f; /* minutes */ - -VG_STATIC float k_ragdoll_floatyiness = 20.0f, - k_ragdoll_floatydrag = 1.0f, - k_ragdoll_limit_scale = 1.0f; - -VG_STATIC int k_ragdoll_div = 1, - ragdoll_frame = 0, - k_ragdoll_debug_collider = 1, - k_ragdoll_debug_constraints = 0; - -VG_STATIC int k_debug_light_indices = 0, - k_debug_light_complexity = 0, - k_light_preview = 0; - -VG_STATIC int freecam = 0; -VG_STATIC int walk_grid_iterations = 1; -VG_STATIC float fc_speed = 10.0f; -VG_STATIC int cl_thirdperson = 0; - -VG_STATIC void common_var_temp(void) -{ - VG_VAR_F32( k_day_length ); - - VG_VAR_F32( k_cam_punch ); - VG_VAR_F32( k_cam_damp ); - VG_VAR_F32( k_cam_spring ); - - VG_VAR_F32( k_grind_dampener ); - VG_VAR_F32( k_grind_spring ); - VG_VAR_F32( k_grind_aligment ); - VG_VAR_F32( k_surface_spring ); - VG_VAR_F32( k_surface_dampener ); - VG_VAR_F32( k_board_interia ); - VG_VAR_F32( k_grind_decayxy ); - VG_VAR_F32( k_grind_axel_min_vel ); - VG_VAR_F32( k_grind_axel_max_angle ); - VG_VAR_F32( k_grind_max_friction ); - VG_VAR_F32( k_grind_balance ); - - VG_VAR_F32( k_walkspeed ); - VG_VAR_F32( k_stopspeed ); - VG_VAR_F32( k_airspeed ); - VG_VAR_F32( k_walk_friction ); - VG_VAR_F32( k_walk_air_accel ); - VG_VAR_F32( k_walk_accel ); - - VG_VAR_I32( freecam ); - VG_VAR_I32( cl_thirdperson ); - VG_VAR_F32_PERSISTENT( fc_speed ); - - VG_VAR_F32( k_ragdoll_limit_scale ); - VG_VAR_I32( k_ragdoll_div ); - VG_VAR_I32( k_ragdoll_debug_collider ); - VG_VAR_I32( k_ragdoll_debug_constraints ); - VG_VAR_I32( k_debug_light_indices ); - VG_VAR_I32( k_debug_light_complexity ); - VG_VAR_I32( k_light_preview ); - - VG_VAR_F32( k_friction_lat ); - - VG_VAR_F32( k_cog_spring ); - VG_VAR_F32( k_cog_damp ); - VG_VAR_F32( k_cog_mass_ratio ); - - VG_VAR_F32( k_spring_force ); - VG_VAR_F32( k_spring_dampener ); - VG_VAR_F32( k_spring_angular ); - - VG_VAR_F32( k_mmthrow_scale ); - VG_VAR_F32( k_mmcollect_lat ); - VG_VAR_F32( k_mmcollect_vert ); - VG_VAR_F32( k_mmdecay ); -} - #endif /* COMMON_H */ diff --git a/conf.h b/conf.h index 33cc44e..387ed21 100644 --- a/conf.h +++ b/conf.h @@ -12,45 +12,11 @@ VG_STATIC int cl_blur = 1, VG_STATIC void g_conf_init(void) { - vg_var_push( (struct vg_var){ - .name = "cl_fov", - .data = &cl_fov, - .data_type = k_var_dtype_f32, - .opt_f32 = { .clamp = 0 }, - .persistent = 1 - }); - - vg_var_push( (struct vg_var){ - .name = "cl_invert_y", - .data = &cl_invert_y, - .data_type = k_var_dtype_i32, - .opt_i32 = { .min=0, .max=1, .clamp=1 }, - .persistent = 1 - }); - - vg_var_push( (struct vg_var){ - .name = "cl_blur_strength", - .data = &cl_blur_strength, - .data_type = k_var_dtype_f32, - .opt_f32 = { .clamp = 0 }, - .persistent = 1 - }); - - vg_var_push( (struct vg_var){ - .name = "cl_blur", - .data = &cl_blur, - .data_type = k_var_dtype_i32, - .opt_i32 = { .min=0, .max=1, .clamp=1 }, - .persistent = 1 - }); - - vg_var_push( (struct vg_var){ - .name = "cl_playermdl_id", - .data = &cl_playermdl_id, - .data_type = k_var_dtype_i32, - .opt_i32 = { .min=0, .max=2, .clamp=1 }, - .persistent = 1 - }); + VG_VAR_F32( cl_fov, flags=VG_VAR_PERSISTENT ); + VG_VAR_I32( cl_invert_y, flags=VG_VAR_PERSISTENT ); + VG_VAR_I32( cl_blur, flags=VG_VAR_PERSISTENT ); + VG_VAR_F32( cl_blur_strength, flags=VG_VAR_PERSISTENT ); + VG_VAR_I32( cl_playermdl_id, flags=VG_VAR_PERSISTENT ); } #endif /* CONF_H */ diff --git a/player.c b/player.c index 28adfd0..a73122c 100644 --- a/player.c +++ b/player.c @@ -134,9 +134,10 @@ void player__use_texture( player_instance *player, vg_tex2d *tex ) PLAYER_API void player__bind( player_instance *player ) { - player__skate_bind( player ); - player__walk_bind( player ); - player__drive_bind( player ); + for( u32 i=0; isk.final_mtx[ av->id_board ], vp0, TEMP_BOARD_0 ); - m4x3_mulv( av->sk.final_mtx[ av->id_board ], vp1, TEMP_BOARD_1 ); + struct ub_world_lighting *ubo = &get_active_world()->ub_lighting; + m4x3_mulv( av->sk.final_mtx[ av->id_board ], vp0, ubo->g_board_0 ); + m4x3_mulv( av->sk.final_mtx[ av->id_board ], vp1, ubo->g_board_1 ); if( player->rewinding ){ if( player->rewind_time <= 0.0f ){ diff --git a/player.h b/player.h index 3e23d17..38e01ad 100644 --- a/player.h +++ b/player.h @@ -10,6 +10,7 @@ #include "player_drive.h" #define PLAYER_REWIND_FRAMES 60*4 +#define RESET_MAX_TIME 45.0 struct player_instance { @@ -136,6 +137,15 @@ struct player_instance * --------------------------------------------------------- */ +VG_STATIC +void (*_player_system_register[])(void) = +{ + player__walk_register, + player__skate_register, + NULL, + NULL +}; + VG_STATIC void (*_player_bind[])( player_instance *player ) = { @@ -217,6 +227,14 @@ void( *_player_restore[] )( player_instance *player ) = NULL }; +VG_STATIC void player_init(void) +{ + for( u32 i=0; irb.up, -0.2f, - player.visual_transform[3] ); - - v4f qfake_rot; - m3x3f fake_rot; - float substep = vg_clampf( vg.accumulator / VG_TIMESTEP_FIXED, 0.0f, 1.0f ); - q_axis_angle( qfake_rot, phys->rb.up, phys->siY*substep ); - q_m3x3( qfake_rot, fake_rot ); - m3x3_mul( fake_rot, player.visual_transform, player.visual_transform ); - - m4x3_invert_affine( player.visual_transform, player.inv_visual_transform ); - - if( phys->controller == k_player_controller_walk ) - { - player_animate_offboard(); - return; - } - - /* Camera position */ - v3_muladds( phys->m, phys->a, VG_TIMESTEP_FIXED, phys->m ); - v3_lerp( phys->m, (v3f){0.0f,0.0f,0.0f}, 0.1f, phys->m ); - - phys->m[0] = vg_clampf( phys->m[0], -2.0f, 2.0f ); - phys->m[1] = vg_clampf( phys->m[1], -2.0f, 2.0f ); - phys->m[2] = vg_clampf( phys->m[2], -2.0f, 2.0f ); - v3_lerp( phys->bob, phys->m, 0.2f, phys->bob ); - - /* Head */ - float lslip = fabsf(phys->slip); - - float kheight = 2.0f, - kleg = 0.6f; - - v3f offset; - v3_zero( offset ); - m3x3_mulv( player.inv_visual_transform, phys->bob, offset ); - - static float speed_wobble = 0.0f, speed_wobble_2 = 0.0f; - - float kickspeed = vg_clampf(v3_length(phys->rb.v)*(1.0f/40.0f), 0.0f, 1.0f); - float kicks = (vg_randf()-0.5f)*2.0f*kickspeed; - float sign = vg_signf( kicks ); - speed_wobble = vg_lerpf( speed_wobble, kicks*kicks*sign, 6.0f*vg.time_delta); - speed_wobble_2 = vg_lerpf( speed_wobble_2, speed_wobble, 2.4f*vg.time_delta); - - offset[0] *= 0.26f; - offset[0] += speed_wobble_2*3.0f; - - offset[1] *= -0.3f; - offset[2] *= 0.01f; - - offset[0]=vg_clampf(offset[0],-0.8f,0.8f)*(1.0f-fabsf(player.fslide)*0.9f); - offset[1]=vg_clampf(offset[1],-0.5f,0.0f); - - /* - * Animation blending - * =========================================== - */ - - /* scalar blending information */ - float speed = v3_length( phys->rb.v ); - - /* sliding */ - { - float desired = vg_clampf( lslip, 0.0f, 1.0f ); - player.fslide = vg_lerpf( player.fslide, desired, 2.4f*vg.time_delta); - } - - /* movement information */ - { - int iair = (player_skate.activity == k_skate_activity_air) || - (player_skate.activity == k_skate_activity_grind ); - - float dirz = phys->reverse > 0.0f? 0.0f: 1.0f, - dirx = phys->slip < 0.0f? 0.0f: 1.0f, - fly = iair? 1.0f: 0.0f; - - player.fdirz = vg_lerpf( player.fdirz, dirz, 2.4f*vg.time_delta ); - player.fdirx = vg_lerpf( player.fdirx, dirx, 0.6f*vg.time_delta ); - player.ffly = vg_lerpf( player.ffly, fly, 2.4f*vg.time_delta ); - } - - struct skeleton *sk = &player.mdl.sk; - - mdl_keyframe apose[32], bpose[32]; - mdl_keyframe ground_pose[32]; - { - /* when the player is moving fast he will crouch down a little bit */ - float stand = 1.0f - vg_clampf( speed * 0.03f, 0.0f, 1.0f ); - player.fstand = vg_lerpf( player.fstand, stand, 6.0f*vg.time_delta ); - - /* stand/crouch */ - float dir_frame = player.fdirz * (15.0f/30.0f), - stand_blend = offset[1]*-2.0f; - - v3f local_cog; - m4x3_mulv( player.phys.rb.to_local, player.phys.cog, local_cog ); - - stand_blend = vg_clampf( 1.0f-local_cog[1], 0, 1 ); - - skeleton_sample_anim( sk, player.mdl.anim_stand, dir_frame, apose ); - skeleton_sample_anim( sk, player.mdl.anim_highg, dir_frame, bpose ); - skeleton_lerp_pose( sk, apose, bpose, stand_blend, apose ); - - /* sliding */ - float slide_frame = player.fdirx * (15.0f/30.0f); - skeleton_sample_anim( sk, player.mdl.anim_slide, slide_frame, bpose ); - skeleton_lerp_pose( sk, apose, bpose, player.fslide, apose ); - - /* pushing */ - double push_time = vg.time - player.phys.start_push; - - player.fpush = vg_lerpf( player.fpush, - (vg.time - player.phys.cur_push) < 0.125, - 6.0f*vg.time_delta ); - - float pt = push_time + vg.accumulator; - if( phys->reverse > 0.0f ) - skeleton_sample_anim( sk, player.mdl.anim_push, pt, bpose ); - else - skeleton_sample_anim( sk, player.mdl.anim_push_reverse, pt, bpose ); - - skeleton_lerp_pose( sk, apose, bpose, player.fpush, apose ); - - /* trick setup */ - float jump_start_frame = 14.0f/30.0f; - - player.fjump = vg_lerpf( player.fjump, phys->jump, 8.4f*vg.time_delta ); - - float setup_frame = phys->jump * jump_start_frame, - setup_blend = vg_minf( player.fjump, 1.0f ); - - float jump_frame = (vg.time - player.jump_time) + jump_start_frame; - if( jump_frame >= jump_start_frame && jump_frame <= (40.0f/30.0f) ) - setup_frame = jump_frame; - - struct skeleton_anim *jump_anim = phys->jump_dir? - player.mdl.anim_ollie: - player.mdl.anim_ollie_reverse; - - skeleton_sample_anim_clamped( sk, jump_anim, setup_frame, bpose ); - skeleton_lerp_pose( sk, apose, bpose, setup_blend, ground_pose ); - } - - mdl_keyframe air_pose[32]; - { - float target = -player.input_js1h->axis.value; - player.fairdir = vg_lerpf( player.fairdir, target, 2.4f*vg.time_delta ); - - float air_frame = (player.fairdir*0.5f+0.5f) * (15.0f/30.0f); - - skeleton_sample_anim( sk, player.mdl.anim_air, air_frame, apose ); - - static v2f grab_choice; - - v2f grab_input = { player.input_js2h->axis.value, - player.input_js2v->axis.value }; - v2_add( player.phys.grab_mouse_delta, grab_input, grab_input ); - if( v2_length2( grab_input ) <= 0.001f ) - grab_input[0] = -1.0f; - else - v2_normalize_clamp( grab_input ); - v2_lerp( grab_choice, grab_input, 2.4f*vg.time_delta, grab_choice ); - - float ang = atan2f( grab_choice[0], grab_choice[1] ), - ang_unit = (ang+VG_PIf) * (1.0f/VG_TAUf), - grab_frame = ang_unit * (15.0f/30.0f); - - skeleton_sample_anim( sk, player.mdl.anim_grabs, grab_frame, bpose ); - skeleton_lerp_pose( sk, apose, bpose, phys->grab, air_pose ); - } - - skeleton_lerp_pose( sk, ground_pose, air_pose, player.ffly, apose ); - - float add_grab_mod = 1.0f - player.ffly;//*phys->grab; - - /* additive effects */ - { - u32 apply_to[] = { player.mdl.id_hip, - player.mdl.id_ik_hand_l, - player.mdl.id_ik_hand_r, - player.mdl.id_ik_elbow_l, - player.mdl.id_ik_elbow_r }; - - for( int i=0; ivl, phys->rb.v, 0.05f, phys->vl ); - - int _grind = player_skate.activity == k_skate_activity_grind; - - player.fgrind = vg_lerpf( player.fgrind, _grind, vg.time_delta ); - - float yaw = atan2f( phys->vl[0], -phys->vl[2] ), - pitch = atan2f - ( - -phys->vl[1], - sqrtf - ( - phys->vl[0]*phys->vl[0] + phys->vl[2]*phys->vl[2] - ) - ) - * 0.7f + vg_lerpf( 0.30f, 0.90f, player.fgrind ); - - player.angles[0] = yaw; - player.angles[1] = vg_lerpf( player.angles[1], pitch, player.fonboard ); - - /* Camera shake */ - static v2f shake_damp = {0.0f,0.0f}; - v2f shake = { vg_randf()-0.5f, vg_randf()-0.5f }; - v2_muls( shake, v3_length(phys->rb.v)*0.3f - * (1.0f+fabsf(phys->slip)), shake); - - v2_lerp( shake_damp, shake, 0.01f, shake_damp ); - shake_damp[0] *= 0.2f; - - v2_muladds( player.angles, shake_damp, 0.1f, player.angles ); - m4x3_mulv( player.visual_transform, cam_pos, player.camera_pos ); -#endif - } - else - { -#if 0 - float speed = vg.time_delta * k_look_speed; - player.angles[0] += vg_get_axis( "lookh" ) * speed; - player.angles[1] += vg_get_axis( "lookv" ) * speed; - - player.angles[1] = vg_clampf( player.angles[1], - -k_pitch_limit, k_pitch_limit ); -#endif - - float s = sinf(player.angles[0]) * 0.2f, - c = -cosf(player.angles[0]) * 0.2f; - v3f forward_dir = { s,0.15f,c }; - - - m4x3f mtx; - v4f rot; - q_axis_angle( rot, (v3f){0.0f,1.0f,0.0f}, - -player.angles[0] -VG_PIf*0.5f ); - q_m3x3( rot, mtx ); - v3_copy( player.visual_transform[3], mtx[3] ); - - m4x3_mulv( mtx, player.mdl.cam_pos, cam_pos ); - v3_add( cam_pos, forward_dir, player.camera_pos ); - -#if 0 - v3_lerp( phys->vl, phys->rb.v, 18.0f*vg.time_delta, phys->vl ); -#endif - } -} - -#endif /* PLAYER_ANIMATION_H */ diff --git a/player_common.c b/player_common.c index 4cb1a0b..f058b56 100644 --- a/player_common.c +++ b/player_common.c @@ -4,6 +4,10 @@ #include "player.h" #include "conf.h" +VG_STATIC float + k_cam_spring = 20.0f, + k_cam_damp = 6.7f; + VG_STATIC void player_vector_angles( v3f angles, v3f v, float C, float k ) { float yaw = atan2f( v[0], -v[2] ), diff --git a/player_ragdoll.h b/player_ragdoll.h index 101d8f9..d6607ae 100644 --- a/player_ragdoll.h +++ b/player_ragdoll.h @@ -36,6 +36,23 @@ struct player_ragdoll{ int shoes[2]; }; +VG_STATIC float k_ragdoll_floatyiness = 20.0f, + k_ragdoll_floatydrag = 1.0f, + k_ragdoll_limit_scale = 1.0f; + +VG_STATIC int k_ragdoll_div = 1, + ragdoll_frame = 0, + k_ragdoll_debug_collider = 1, + k_ragdoll_debug_constraints = 0; + +VG_STATIC void player_ragdoll_init(void) +{ + VG_VAR_F32( k_ragdoll_limit_scale ); + VG_VAR_I32( k_ragdoll_div ); + VG_VAR_I32( k_ragdoll_debug_collider ); + VG_VAR_I32( k_ragdoll_debug_constraints ); +} + VG_STATIC void player_init_ragdoll_bone_collider( struct skeleton_bone *bone, struct ragdoll_part *rp ) { diff --git a/player_skate.h b/player_skate.h index 69be37e..464ef50 100644 --- a/player_skate.h +++ b/player_skate.h @@ -7,12 +7,9 @@ typedef struct jump_info jump_info; -struct player_skate -{ - struct - { - enum skate_activity - { +struct player_skate{ + struct{ + enum skate_activity{ k_skate_activity_air, k_skate_activity_air_to_grind, k_skate_activity_ground, @@ -123,8 +120,7 @@ struct player_skate float substep, substep_delta; - struct jump_info - { + struct jump_info{ v3f log[50]; v3f n; v3f apex; @@ -136,8 +132,7 @@ struct player_skate float score, land_dist; - enum prediction_type - { + enum prediction_type{ k_prediction_none, k_prediction_unset, k_prediction_land, @@ -163,8 +158,7 @@ struct player_skate float grind_strength; - struct grind_limit - { + struct grind_limit{ v3f ra, n; float p; } @@ -172,6 +166,86 @@ struct player_skate u32 limit_count; }; +VG_STATIC float + k_friction_lat = 12.0f, + k_friction_resistance = 0.01f, + + k_max_push_speed = 16.0f, + k_push_accel = 10.0f, + k_push_cycle_rate = 8.0f, + + k_steer_ground = 2.5f, + k_steer_air = 3.6f, + + k_jump_charge_speed = (1.0f/0.4f), + k_jump_force = 5.0f, + + k_cog_spring = 0.2f, + k_cog_damp = 0.02f, + k_cog_mass_ratio = 0.9f, + + k_mmthrow_scale = 6.0f, + k_mmcollect_lat = 2.0f, + k_mmcollect_vert = 0.0f, + k_mmdecay = 12.0f, + k_spring_angular = 1.0f, + + k_spring_force = 300.0f, + k_spring_dampener = 5.0f, + + k_grind_spring = 50.0f, + k_grind_aligment = 10.0f, + k_grind_dampener = 5.0f, + + k_surface_spring = 100.0f, + k_surface_dampener = 40.0f, + k_manul_spring = 200.0f, + k_manul_dampener = 30.0f, + k_board_interia = 8.0f, + + k_grind_decayxy = 30.0f, + k_grind_axel_min_vel = 1.0f, + k_grind_axel_max_angle = 0.95f, /* cosine(|a|) */ + k_grind_axel_max_vangle = 0.4f, + k_grind_max_friction = 3.0f, + k_grind_max_edge_angle = 0.97f, + + k_board_length = 0.45f, + k_board_width = 0.13f, + k_board_end_radius = 0.1f, + k_board_radius = 0.14f, /* 0.07 */ + + k_grind_balance = -40.0f; + +VG_STATIC void player__skate_register(void) +{ + VG_VAR_F32( k_grind_dampener, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_grind_spring, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_grind_aligment, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_surface_spring, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_surface_dampener, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_board_interia, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_grind_decayxy, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_grind_axel_min_vel, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_grind_axel_max_angle, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_grind_max_friction, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_grind_balance, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_friction_lat, flags=VG_VAR_CHEAT ); + + VG_VAR_F32( k_cog_spring, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_cog_damp, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_cog_mass_ratio, flags=VG_VAR_CHEAT ); + + VG_VAR_F32( k_spring_force, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_spring_dampener, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_spring_angular, flags=VG_VAR_CHEAT ); + + VG_VAR_F32( k_mmthrow_scale, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_mmcollect_lat, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_mmcollect_vert, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_mmdecay, flags=VG_VAR_CHEAT ); +} + VG_STATIC void player__skate_bind ( player_instance *player ); VG_STATIC void player__skate_pre_update ( player_instance *player ); VG_STATIC void player__skate_update ( player_instance *player ); diff --git a/player_walk.h b/player_walk.h index 29c210d..4c6b7a3 100644 --- a/player_walk.h +++ b/player_walk.h @@ -3,12 +3,10 @@ #include "player_api.h" -struct player_walk -{ +struct player_walk{ rb_capsule collider; - struct - { + struct{ v3f prev_pos; v3f drop_in_target, drop_in_foot_anchor, @@ -18,8 +16,7 @@ struct player_walk float drop_in_start_angle, drop_in_angle; - enum walk_activity - { + enum walk_activity{ k_walk_activity_air, k_walk_activity_ground, k_walk_activity_sleep, @@ -28,8 +25,7 @@ struct player_walk } activity; - enum walk_outro - { + enum walk_outro{ k_walk_outro_none, k_walk_outro_jump_to_air, k_walk_outro_drop_in, @@ -57,6 +53,25 @@ struct player_walk int step_phase; }; +VG_STATIC float + k_walkspeed = 10.0f, + k_airspeed = 1.2f, + k_stopspeed = 4.0f, + k_walk_accel = 10.0f, + k_walk_air_accel = 7.0f, + k_walk_friction = 10.0f, + k_walk_step_height = 0.2f; + +VG_STATIC void player__walk_register(void) +{ + VG_VAR_F32( k_walkspeed, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_stopspeed, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_airspeed, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_walk_friction, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_walk_air_accel, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_walk_accel, flags=VG_VAR_CHEAT ); +} + VG_STATIC void player__walk_pre_update ( player_instance *player ); VG_STATIC void player__walk_update ( player_instance *player ); VG_STATIC void player__walk_post_update ( player_instance *player ); diff --git a/render.h b/render.h index 712961e..64cf8f1 100644 --- a/render.h +++ b/render.h @@ -31,8 +31,7 @@ typedef struct framebuffer framebuffer; /* * All standard buffers used in rendering */ -VG_STATIC struct pipeline -{ +VG_STATIC struct pipeline{ glmesh fsquad; framebuffer *fb_main, @@ -45,8 +44,7 @@ VG_STATIC struct pipeline } gpipeline = { .view_render_scale = 1.0f }; -struct framebuffer -{ +struct framebuffer{ const char *display_name; int resolution_div, /* definition */ fixed_w, @@ -55,20 +53,17 @@ struct framebuffer render_w, /* runtime */ render_h; - struct framebuffer_attachment - { + struct framebuffer_attachment{ const char *display_name; - enum framebuffer_attachment_type - { + enum framebuffer_attachment_type{ k_framebuffer_attachment_type_none, k_framebuffer_attachment_type_colour, k_framebuffer_attachment_type_renderbuffer } purpose; - enum framebuffer_quality_profile - { + enum framebuffer_quality_profile{ k_framebuffer_quality_all, k_framebuffer_quality_high_only } @@ -233,8 +228,7 @@ VG_STATIC void render_fb_bind_texture( framebuffer *fb, { struct framebuffer_attachment *at = &fb->attachments[attachment]; - if( at->purpose != k_framebuffer_attachment_type_colour ) - { + if( at->purpose != k_framebuffer_attachment_type_colour ){ vg_fatal_exit_loop( "illegal operation: bind non-colour framebuffer" " attachment to texture slot" ); } @@ -378,13 +372,11 @@ VG_STATIC void render_fb_allocate_texture( struct framebuffer *fb, int rx, ry; render_fb_get_current_res( fb, &rx, &ry ); - if( a->purpose == k_framebuffer_attachment_type_renderbuffer ) - { + if( a->purpose == k_framebuffer_attachment_type_renderbuffer ){ glBindRenderbuffer( GL_RENDERBUFFER, a->id ); glRenderbufferStorage( GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, rx, ry ); } - else if( a->purpose == k_framebuffer_attachment_type_colour ) - { + else if( a->purpose == k_framebuffer_attachment_type_colour ){ glBindTexture( GL_TEXTURE_2D, a->id ); glTexImage2D( GL_TEXTURE_2D, 0, a->internalformat, rx, ry, 0, a->format, a->type, NULL ); @@ -408,8 +400,7 @@ VG_STATIC void render_fb_allocate( struct framebuffer *fb ) GLenum colour_attachments[4]; u32 colour_count = 0; - for( int j=0; jattachments); j++ ) - { + for( int j=0; jattachments); j++ ){ struct framebuffer_attachment *attachment = &fb->attachments[j]; if( attachment->purpose == k_framebuffer_attachment_type_none ) @@ -419,16 +410,14 @@ VG_STATIC void render_fb_allocate( struct framebuffer *fb ) render_fb_attachment_str( attachment->attachment ), render_fb_format_str( attachment->internalformat ) ); - if( attachment->purpose == k_framebuffer_attachment_type_renderbuffer ) - { + if( attachment->purpose == k_framebuffer_attachment_type_renderbuffer ){ glGenRenderbuffers( 1, &attachment->id ); render_fb_allocate_texture( fb, attachment ); glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, attachment->id ); } - else if( attachment->purpose == k_framebuffer_attachment_type_colour ) - { + else if( attachment->purpose == k_framebuffer_attachment_type_colour ){ glGenTextures( 1, &attachment->id ); render_fb_allocate_texture( fb, attachment ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); @@ -450,8 +439,7 @@ VG_STATIC void render_fb_allocate( struct framebuffer *fb ) */ GLenum result = glCheckFramebufferStatus( GL_FRAMEBUFFER ); - if( result == GL_FRAMEBUFFER_COMPLETE ) - { + if( result == GL_FRAMEBUFFER_COMPLETE ){ /* * Attatch to gpipeline */ @@ -461,8 +449,7 @@ VG_STATIC void render_fb_allocate( struct framebuffer *fb ) vg_success( " status: complete\n" ); vg_info( "}\n" ); } - else - { + else{ if( result == GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT ) vg_error( " status: Incomplete attachment" ); else if( result == GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT ) @@ -485,11 +472,9 @@ VG_STATIC void render_fb_resize(void) if( !gpipeline.ready ) return; - for( int i=0; iattachments); j++ ) - { + for( int j=0; jattachments); j++ ){ struct framebuffer_attachment *attachment = &fb->attachments[j]; render_fb_allocate_texture( fb, attachment ); } @@ -502,8 +487,7 @@ VG_STATIC void render_init_fs_quad(void) { vg_info( "[render] Allocate quad\n" ); - float quad[] = - { + float quad[] = { 0.00f,0.00f, 1.00f,1.00f, 0.00f,1.00f, 0.00f,0.00f, 1.00f,0.00f, 1.00f,1.00f, @@ -534,12 +518,8 @@ VG_STATIC void render_init_fs_quad(void) 0.60f,0.60f, 0.90f,0.60f, 0.90f,0.90f, }; - vg_function_push( (struct vg_cmd) - { - .name = "fb", - .function = render_framebuffer_control, - .poll_suggest = render_framebuffer_poll - }); + vg_console_reg_cmd( "fb", render_framebuffer_control, + render_framebuffer_poll ); glGenVertexArrays( 1, &gpipeline.fsquad.vao ); glGenBuffers( 1, &gpipeline.fsquad.vbo ); @@ -565,8 +545,7 @@ VG_STATIC void render_init(void) /* * Complete Framebuffers */ - for( int i=0; i/\"all\" /none\n" ); return 0; } @@ -681,8 +659,7 @@ VG_STATIC int render_framebuffer_control( int argc, char const *argv[] ) operation = 1; else if( !strcmp( argv[0], "hide" ) ) operation = 0; - else - { + else{ vg_error( "Unknown framebuffer operation: '%s'\n", argv[0] ); return 0; } @@ -690,25 +667,20 @@ VG_STATIC int render_framebuffer_control( int argc, char const *argv[] ) if( !strcmp( argv[1], "all" ) ) modify_all = 1; - for( int i=0; iattachments); j++ ) - { + for( int j=0; jattachments); j++ ){ struct framebuffer_attachment *at = &fb->attachments[j]; if( at->purpose == k_framebuffer_attachment_type_none ) continue; - if( modify_all ) - { + if( modify_all ){ render_framebuffer_show( fb, at, operation ); } - else - { - if( !strcmp( fb->display_name, argv[1] ) ) - { + else{ + if( !strcmp( fb->display_name, argv[1] ) ){ if( argc == 2 ) render_framebuffer_show( fb, at, operation ); else if( !strcmp( at->display_name, argv[2] ) ) @@ -725,45 +697,37 @@ VG_STATIC void render_framebuffer_poll( int argc, char const *argv[] ) { const char *term = argv[argc-1]; - if( argc == 1 ) - { + if( argc == 1 ){ console_suggest_score_text( "show", term, 0 ); console_suggest_score_text( "hide", term, 0 ); } - else if( argc == 2 ) - { + else if( argc == 2 ){ console_suggest_score_text( "all", term, 0 ); - for( int i=0; idisplay_name, term, 0 ); } } - else if( argc == 3 ) - { + else if( argc == 3 ){ int modify_all = 0; if( !strcmp( argv[1], "all" ) ) modify_all = 1; - for( int i=0; iattachments); j++ ) - { + for( int j=0; jattachments); j++ ){ struct framebuffer_attachment *at = &fb->attachments[j]; if( at->purpose == k_framebuffer_attachment_type_none ) continue; - if( modify_all ) - { + if( modify_all ){ console_suggest_score_text( at->display_name, term, 0 ); } - else if( !strcmp( fb->display_name, argv[1] ) ) - { + else if( !strcmp( fb->display_name, argv[1] ) ){ console_suggest_score_text( at->display_name, term, 0 ); } } diff --git a/rigidbody.h b/rigidbody.h index c10f4f8..5796c7a 100644 --- a/rigidbody.h +++ b/rigidbody.h @@ -44,25 +44,10 @@ VG_STATIC float VG_STATIC void rb_register_cvar(void) { - vg_var_push( (struct vg_var){ - .name = "k_limit_bias", .data = &k_limit_bias, - .data_type = k_var_dtype_f32, .opt_f32 = {.clamp = 0}, .persistent = 1 - }); - - vg_var_push( (struct vg_var){ - .name = "k_joint_bias", .data = &k_joint_bias, - .data_type = k_var_dtype_f32, .opt_f32 = {.clamp = 0}, .persistent = 1 - }); - - vg_var_push( (struct vg_var){ - .name = "k_joint_correction", .data = &k_joint_correction, - .data_type = k_var_dtype_f32, .opt_f32 = {.clamp = 0}, .persistent = 1 - }); - - vg_var_push( (struct vg_var){ - .name = "k_joint_impulse", .data = &k_joint_impulse, - .data_type = k_var_dtype_f32, .opt_f32 = {.clamp = 0}, .persistent = 1 - }); + VG_VAR_F32( k_limit_bias, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_joint_bias, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_joint_correction, flags=VG_VAR_CHEAT ); + VG_VAR_F32( k_joint_impulse, flags=VG_VAR_CHEAT ); } /* @@ -78,23 +63,19 @@ typedef struct rb_sphere rb_sphere; typedef struct rb_capsule rb_capsule; typedef struct rb_scene rb_scene; -struct rb_sphere -{ +struct rb_sphere{ float radius; }; -struct rb_capsule -{ +struct rb_capsule{ float height, radius; }; -struct rb_scene -{ +struct rb_scene{ bh_tree *bh_scene; }; -struct rigidbody -{ +struct rigidbody{ v3f co, v, w; v4f q; @@ -108,8 +89,7 @@ struct rigidbody }; /* simple objects */ -struct rb_object -{ +struct rb_object{ rigidbody rb; enum rb_shape{ k_rb_shape_box = 0, @@ -119,8 +99,7 @@ struct rb_object } type; - union - { + union{ struct rb_sphere sphere; struct rb_capsule capsule; struct rb_scene scene; @@ -128,8 +107,7 @@ struct rb_object inf; }; -VG_STATIC struct contact -{ +VG_STATIC struct contact{ rigidbody *rba, *rbb; v3f co, n; v3f t[2]; @@ -146,14 +124,12 @@ VG_STATIC int rb_contact_count = 0; typedef struct rb_constr_pos rb_constr_pos; typedef struct rb_constr_swingtwist rb_constr_swingtwist; -struct rb_constr_pos -{ +struct rb_constr_pos{ rigidbody *rba, *rbb; v3f lca, lcb; }; -struct rb_constr_swingtwist -{ +struct rb_constr_swingtwist{ rigidbody *rba, *rbb; v4f conevx, conevy; /* relative to rba */ @@ -167,8 +143,7 @@ struct rb_constr_swingtwist float tangent_mass, axis_mass; }; -struct rb_constr_spring -{ +struct rb_constr_spring{ int nothing; }; @@ -187,14 +162,12 @@ VG_STATIC float sphere_volume( float radius ) VG_STATIC void rb_tangent_basis( v3f n, v3f tx, v3f ty ) { /* Compute tangent basis (box2d) */ - if( fabsf( n[0] ) >= 0.57735027f ) - { + if( fabsf( n[0] ) >= 0.57735027f ){ tx[0] = n[1]; tx[1] = -n[0]; tx[2] = 0.0f; } - else - { + else{ tx[0] = 0.0f; tx[1] = n[2]; tx[2] = -n[1]; @@ -215,13 +188,11 @@ VG_STATIC void rb_debug_contact( rb_ct *ct ) v3f p1; v3_muladds( ct->co, ct->n, 0.05f, p1 ); - if( ct->type == k_contact_type_default ) - { + if( ct->type == k_contact_type_default ){ vg_line_pt3( ct->co, 0.0125f, 0xff0000ff ); vg_line( ct->co, p1, 0xffffffff ); } - else if( ct->type == k_contact_type_edge ) - { + else if( ct->type == k_contact_type_edge ){ vg_line_pt3( ct->co, 0.0125f, 0xff00ffc0 ); vg_line( ct->co, p1, 0xffffffff ); } @@ -233,8 +204,7 @@ VG_STATIC void debug_sphere( m4x3f m, float radius, u32 colour ) lx = { 0.0f, radius, 0.0f }, lz = { 0.0f, 0.0f, radius }; - for( int i=0; i<16; i++ ) - { + for( int i=0; i<16; i++ ){ float t = ((float)(i+1) * (1.0f/16.0f)) * VG_PIf * 2.0f, s = sinf(t), c = cosf(t); @@ -292,8 +262,7 @@ VG_STATIC void debug_capsule( m4x3f m, float radius, float h, u32 colour ) vg_line( a0, a1, colour ); vg_line( b0, b1, colour ); - for( int i=0; i<16; i++ ) - { + for( int i=0; i<16; i++ ){ float t = ((float)(i+1) * (1.0f/16.0f)) * VG_PIf * 2.0f, s1 = sinf(t)*radius, c1 = cosf(t)*radius; @@ -320,15 +289,13 @@ VG_STATIC void debug_capsule( m4x3f m, float radius, float h, u32 colour ) vg_line( a0, a1, colour ); vg_line( b0, b1, colour ); - if( c0 < 0.0f ) - { + if( c0 < 0.0f ){ v3_add( p0, e2, a0 ); v3_add( p0, e3, a1 ); v3_add( p0, e4, b0 ); v3_add( p0, e5, b1 ); } - else - { + else{ v3_add( p1, e2, a0 ); v3_add( p1, e3, a1 ); v3_add( p1, e4, b0 ); diff --git a/shaders/common_scene.glsl b/shaders/common_scene.glsl index 6678dea..76658f2 100644 --- a/shaders/common_scene.glsl +++ b/shaders/common_scene.glsl @@ -19,7 +19,8 @@ float sdLine( vec3 p, vec3 a, vec3 b ) float compute_board_shadow() { // player shadow - float dist_to_player = max( 0.0, sdLine( aWorldCo, uBoard0, uBoard1 )-0.1 ); + float dist_to_player = max( 0.0, sdLine( aWorldCo, g_board_0.xyz, + g_board_1.xyz )-0.1 ); float player_shadow = max( 1.0-dist_to_player*2.7, 0.0 ); player_shadow *= player_shadow*player_shadow*player_shadow; diff --git a/shaders/common_world.glsl b/shaders/common_world.glsl index 2b70885..8926c21 100644 --- a/shaders/common_world.glsl +++ b/shaders/common_world.glsl @@ -16,6 +16,8 @@ layout (std140) uniform ub_world_lighting vec4 g_sunset_ambient; vec4 g_sun_colour; vec4 g_sun_dir; + vec4 g_board_0; + vec4 g_board_1; float g_water_fog; float g_time; diff --git a/shaders/model_character_view.h b/shaders/model_character_view.h index bae097d..327a7a8 100644 --- a/shaders/model_character_view.h +++ b/shaders/model_character_view.h @@ -102,6 +102,8 @@ static struct vg_shader _shader_model_character_view = { " vec4 g_sunset_ambient;\n" " vec4 g_sun_colour;\n" " vec4 g_sun_dir;\n" +" vec4 g_board_0;\n" +" vec4 g_board_1;\n" "\n" " float g_water_fog;\n" " float g_time;\n" @@ -202,7 +204,7 @@ static struct vg_shader _shader_model_character_view = { " return ambient + (light_sun + sky_reflection) * shadow;\n" "}\n" "\n" -"#line 42 0 \n" +"#line 44 0 \n" "\n" "float world_depth_sample( vec3 pos )\n" "{\n" diff --git a/shaders/model_sky.h b/shaders/model_sky.h index b5b58e5..6c0ba2a 100644 --- a/shaders/model_sky.h +++ b/shaders/model_sky.h @@ -96,6 +96,8 @@ static struct vg_shader _shader_model_sky = { " vec4 g_sunset_ambient;\n" " vec4 g_sun_colour;\n" " vec4 g_sun_dir;\n" +" vec4 g_board_0;\n" +" vec4 g_board_1;\n" "\n" " float g_water_fog;\n" " float g_time;\n" @@ -196,7 +198,7 @@ static struct vg_shader _shader_model_sky = { " return ambient + (light_sun + sky_reflection) * shadow;\n" "}\n" "\n" -"#line 42 0 \n" +"#line 44 0 \n" "\n" "float world_depth_sample( vec3 pos )\n" "{\n" diff --git a/shaders/scene_depth.h b/shaders/scene_depth.h index f1c5af3..e2a8e01 100644 --- a/shaders/scene_depth.h +++ b/shaders/scene_depth.h @@ -95,6 +95,8 @@ static struct vg_shader _shader_scene_depth = { " vec4 g_sunset_ambient;\n" " vec4 g_sun_colour;\n" " vec4 g_sun_dir;\n" +" vec4 g_board_0;\n" +" vec4 g_board_1;\n" "\n" " float g_water_fog;\n" " float g_time;\n" @@ -195,7 +197,7 @@ static struct vg_shader _shader_scene_depth = { " return ambient + (light_sun + sky_reflection) * shadow;\n" "}\n" "\n" -"#line 42 0 \n" +"#line 44 0 \n" "\n" "float world_depth_sample( vec3 pos )\n" "{\n" @@ -390,7 +392,8 @@ static struct vg_shader _shader_scene_depth = { "float compute_board_shadow()\n" "{\n" " // player shadow\n" -" float dist_to_player = max( 0.0, sdLine( aWorldCo, uBoard0, uBoard1 )-0.1 );\n" +" float dist_to_player = max( 0.0, sdLine( aWorldCo, g_board_0.xyz,\n" +" g_board_1.xyz )-0.1 );\n" " float player_shadow = max( 1.0-dist_to_player*2.7, 0.0 );\n" " player_shadow *= player_shadow*player_shadow*player_shadow;\n" "\n" diff --git a/shaders/scene_position.h b/shaders/scene_position.h index 029b8aa..e0b9982 100644 --- a/shaders/scene_position.h +++ b/shaders/scene_position.h @@ -95,6 +95,8 @@ static struct vg_shader _shader_scene_position = { " vec4 g_sunset_ambient;\n" " vec4 g_sun_colour;\n" " vec4 g_sun_dir;\n" +" vec4 g_board_0;\n" +" vec4 g_board_1;\n" "\n" " float g_water_fog;\n" " float g_time;\n" @@ -195,7 +197,7 @@ static struct vg_shader _shader_scene_position = { " return ambient + (light_sun + sky_reflection) * shadow;\n" "}\n" "\n" -"#line 42 0 \n" +"#line 44 0 \n" "\n" "float world_depth_sample( vec3 pos )\n" "{\n" @@ -390,7 +392,8 @@ static struct vg_shader _shader_scene_position = { "float compute_board_shadow()\n" "{\n" " // player shadow\n" -" float dist_to_player = max( 0.0, sdLine( aWorldCo, uBoard0, uBoard1 )-0.1 );\n" +" float dist_to_player = max( 0.0, sdLine( aWorldCo, g_board_0.xyz,\n" +" g_board_1.xyz )-0.1 );\n" " float player_shadow = max( 1.0-dist_to_player*2.7, 0.0 );\n" " player_shadow *= player_shadow*player_shadow*player_shadow;\n" "\n" diff --git a/shaders/scene_route.fs b/shaders/scene_route.fs index 93ed9b1..a4a3b13 100644 --- a/shaders/scene_route.fs +++ b/shaders/scene_route.fs @@ -2,8 +2,6 @@ uniform sampler2D uTexGarbage; uniform sampler2D uTexGradients; uniform vec3 uCamera; uniform vec4 uColour; -uniform vec3 uBoard0; -uniform vec3 uBoard1; #include "common_scene.glsl" #include "motion_vectors_fs.glsl" diff --git a/shaders/scene_route.h b/shaders/scene_route.h index a381ee0..9961075 100644 --- a/shaders/scene_route.h +++ b/shaders/scene_route.h @@ -66,8 +66,6 @@ static struct vg_shader _shader_scene_route = { "uniform sampler2D uTexGradients;\n" "uniform vec3 uCamera;\n" "uniform vec4 uColour;\n" -"uniform vec3 uBoard0;\n" -"uniform vec3 uBoard1;\n" "\n" "#line 1 1 \n" "// :D\n" @@ -96,6 +94,8 @@ static struct vg_shader _shader_scene_route = { " vec4 g_sunset_ambient;\n" " vec4 g_sun_colour;\n" " vec4 g_sun_dir;\n" +" vec4 g_board_0;\n" +" vec4 g_board_1;\n" "\n" " float g_water_fog;\n" " float g_time;\n" @@ -196,7 +196,7 @@ static struct vg_shader _shader_scene_route = { " return ambient + (light_sun + sky_reflection) * shadow;\n" "}\n" "\n" -"#line 42 0 \n" +"#line 44 0 \n" "\n" "float world_depth_sample( vec3 pos )\n" "{\n" @@ -391,7 +391,8 @@ static struct vg_shader _shader_scene_route = { "float compute_board_shadow()\n" "{\n" " // player shadow\n" -" float dist_to_player = max( 0.0, sdLine( aWorldCo, uBoard0, uBoard1 )-0.1 );\n" +" float dist_to_player = max( 0.0, sdLine( aWorldCo, g_board_0.xyz,\n" +" g_board_1.xyz )-0.1 );\n" " float player_shadow = max( 1.0-dist_to_player*2.7, 0.0 );\n" " player_shadow *= player_shadow*player_shadow*player_shadow;\n" "\n" @@ -403,7 +404,7 @@ static struct vg_shader _shader_scene_route = { " return world_compute_lighting( diffuse, normal, co, compute_board_shadow() );\n" "}\n" "\n" -"#line 9 0 \n" +"#line 7 0 \n" "#line 1 2 \n" "const float k_motion_lerp_amount = 0.01;\n" "\n" @@ -423,7 +424,7 @@ static struct vg_shader _shader_scene_route = { " oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n" "}\n" "\n" -"#line 10 0 \n" +"#line 8 0 \n" "\n" "float filtered_stripe( in float p, in float ddx, in float ddy )\n" "{\n" @@ -482,8 +483,6 @@ static GLuint _uniform_scene_route_uTexGarbage; static GLuint _uniform_scene_route_uTexGradients; static GLuint _uniform_scene_route_uCamera; static GLuint _uniform_scene_route_uColour; -static GLuint _uniform_scene_route_uBoard0; -static GLuint _uniform_scene_route_uBoard1; static GLuint _uniform_scene_route_g_world_depth; static GLuint _uniform_scene_route_uLightsArray; static GLuint _uniform_scene_route_uLightsIndex; @@ -508,12 +507,6 @@ static void shader_scene_route_uCamera(v3f v){ static void shader_scene_route_uColour(v4f v){ glUniform4fv(_uniform_scene_route_uColour,1,v); } -static void shader_scene_route_uBoard0(v3f v){ - glUniform3fv(_uniform_scene_route_uBoard0,1,v); -} -static void shader_scene_route_uBoard1(v3f v){ - glUniform3fv(_uniform_scene_route_uBoard1,1,v); -} static void shader_scene_route_g_world_depth(int i){ glUniform1i(_uniform_scene_route_g_world_depth,i); } @@ -529,8 +522,6 @@ static void shader_scene_route_link(void){ _uniform_scene_route_uTexGradients = glGetUniformLocation( _shader_scene_route.id, "uTexGradients" ); _uniform_scene_route_uCamera = glGetUniformLocation( _shader_scene_route.id, "uCamera" ); _uniform_scene_route_uColour = glGetUniformLocation( _shader_scene_route.id, "uColour" ); - _uniform_scene_route_uBoard0 = glGetUniformLocation( _shader_scene_route.id, "uBoard0" ); - _uniform_scene_route_uBoard1 = glGetUniformLocation( _shader_scene_route.id, "uBoard1" ); _uniform_scene_route_g_world_depth = glGetUniformLocation( _shader_scene_route.id, "g_world_depth" ); _uniform_scene_route_uLightsArray = glGetUniformLocation( _shader_scene_route.id, "uLightsArray" ); _uniform_scene_route_uLightsIndex = glGetUniformLocation( _shader_scene_route.id, "uLightsIndex" ); diff --git a/shaders/scene_scoretext.h b/shaders/scene_scoretext.h index 16792a6..37b24fc 100644 --- a/shaders/scene_scoretext.h +++ b/shaders/scene_scoretext.h @@ -86,8 +86,6 @@ static struct vg_shader _shader_scene_scoretext = { "uniform sampler2D uTexMain;\n" "uniform vec3 uCamera;\n" "uniform vec4 uPlane;\n" -"uniform vec3 uBoard0;\n" -"uniform vec3 uBoard1;\n" "\n" "#line 1 1 \n" "// :D\n" @@ -116,6 +114,8 @@ static struct vg_shader _shader_scene_scoretext = { " vec4 g_sunset_ambient;\n" " vec4 g_sun_colour;\n" " vec4 g_sun_dir;\n" +" vec4 g_board_0;\n" +" vec4 g_board_1;\n" "\n" " float g_water_fog;\n" " float g_time;\n" @@ -216,7 +216,7 @@ static struct vg_shader _shader_scene_scoretext = { " return ambient + (light_sun + sky_reflection) * shadow;\n" "}\n" "\n" -"#line 42 0 \n" +"#line 44 0 \n" "\n" "float world_depth_sample( vec3 pos )\n" "{\n" @@ -411,7 +411,8 @@ static struct vg_shader _shader_scene_scoretext = { "float compute_board_shadow()\n" "{\n" " // player shadow\n" -" float dist_to_player = max( 0.0, sdLine( aWorldCo, uBoard0, uBoard1 )-0.1 );\n" +" float dist_to_player = max( 0.0, sdLine( aWorldCo, g_board_0.xyz,\n" +" g_board_1.xyz )-0.1 );\n" " float player_shadow = max( 1.0-dist_to_player*2.7, 0.0 );\n" " player_shadow *= player_shadow*player_shadow*player_shadow;\n" "\n" @@ -423,7 +424,7 @@ static struct vg_shader _shader_scene_scoretext = { " return world_compute_lighting( diffuse, normal, co, compute_board_shadow() );\n" "}\n" "\n" -"#line 9 0 \n" +"#line 7 0 \n" "#line 1 2 \n" "const float k_motion_lerp_amount = 0.01;\n" "\n" @@ -443,7 +444,7 @@ static struct vg_shader _shader_scene_scoretext = { " oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n" "}\n" "\n" -"#line 10 0 \n" +"#line 8 0 \n" "\n" "void main()\n" "{\n" @@ -474,8 +475,6 @@ static GLuint _uniform_scene_scoretext_uTexGarbage; static GLuint _uniform_scene_scoretext_uTexMain; static GLuint _uniform_scene_scoretext_uCamera; static GLuint _uniform_scene_scoretext_uPlane; -static GLuint _uniform_scene_scoretext_uBoard0; -static GLuint _uniform_scene_scoretext_uBoard1; static GLuint _uniform_scene_scoretext_g_world_depth; static GLuint _uniform_scene_scoretext_uLightsArray; static GLuint _uniform_scene_scoretext_uLightsIndex; @@ -503,12 +502,6 @@ static void shader_scene_scoretext_uCamera(v3f v){ static void shader_scene_scoretext_uPlane(v4f v){ glUniform4fv(_uniform_scene_scoretext_uPlane,1,v); } -static void shader_scene_scoretext_uBoard0(v3f v){ - glUniform3fv(_uniform_scene_scoretext_uBoard0,1,v); -} -static void shader_scene_scoretext_uBoard1(v3f v){ - glUniform3fv(_uniform_scene_scoretext_uBoard1,1,v); -} static void shader_scene_scoretext_g_world_depth(int i){ glUniform1i(_uniform_scene_scoretext_g_world_depth,i); } @@ -525,8 +518,6 @@ static void shader_scene_scoretext_link(void){ _uniform_scene_scoretext_uTexMain = glGetUniformLocation( _shader_scene_scoretext.id, "uTexMain" ); _uniform_scene_scoretext_uCamera = glGetUniformLocation( _shader_scene_scoretext.id, "uCamera" ); _uniform_scene_scoretext_uPlane = glGetUniformLocation( _shader_scene_scoretext.id, "uPlane" ); - _uniform_scene_scoretext_uBoard0 = glGetUniformLocation( _shader_scene_scoretext.id, "uBoard0" ); - _uniform_scene_scoretext_uBoard1 = glGetUniformLocation( _shader_scene_scoretext.id, "uBoard1" ); _uniform_scene_scoretext_g_world_depth = glGetUniformLocation( _shader_scene_scoretext.id, "g_world_depth" ); _uniform_scene_scoretext_uLightsArray = glGetUniformLocation( _shader_scene_scoretext.id, "uLightsArray" ); _uniform_scene_scoretext_uLightsIndex = glGetUniformLocation( _shader_scene_scoretext.id, "uLightsIndex" ); diff --git a/shaders/scene_standard.fs b/shaders/scene_standard.fs index 7fcf1d5..58a472d 100644 --- a/shaders/scene_standard.fs +++ b/shaders/scene_standard.fs @@ -2,8 +2,6 @@ uniform sampler2D uTexGarbage; uniform sampler2D uTexMain; uniform vec3 uCamera; uniform vec4 uPlane; -uniform vec3 uBoard0; -uniform vec3 uBoard1; #include "common_scene.glsl" #include "motion_vectors_fs.glsl" diff --git a/shaders/scene_standard.h b/shaders/scene_standard.h index e6d6e6f..bacef09 100644 --- a/shaders/scene_standard.h +++ b/shaders/scene_standard.h @@ -66,8 +66,6 @@ static struct vg_shader _shader_scene_standard = { "uniform sampler2D uTexMain;\n" "uniform vec3 uCamera;\n" "uniform vec4 uPlane;\n" -"uniform vec3 uBoard0;\n" -"uniform vec3 uBoard1;\n" "\n" "#line 1 1 \n" "// :D\n" @@ -96,6 +94,8 @@ static struct vg_shader _shader_scene_standard = { " vec4 g_sunset_ambient;\n" " vec4 g_sun_colour;\n" " vec4 g_sun_dir;\n" +" vec4 g_board_0;\n" +" vec4 g_board_1;\n" "\n" " float g_water_fog;\n" " float g_time;\n" @@ -196,7 +196,7 @@ static struct vg_shader _shader_scene_standard = { " return ambient + (light_sun + sky_reflection) * shadow;\n" "}\n" "\n" -"#line 42 0 \n" +"#line 44 0 \n" "\n" "float world_depth_sample( vec3 pos )\n" "{\n" @@ -391,7 +391,8 @@ static struct vg_shader _shader_scene_standard = { "float compute_board_shadow()\n" "{\n" " // player shadow\n" -" float dist_to_player = max( 0.0, sdLine( aWorldCo, uBoard0, uBoard1 )-0.1 );\n" +" float dist_to_player = max( 0.0, sdLine( aWorldCo, g_board_0.xyz,\n" +" g_board_1.xyz )-0.1 );\n" " float player_shadow = max( 1.0-dist_to_player*2.7, 0.0 );\n" " player_shadow *= player_shadow*player_shadow*player_shadow;\n" "\n" @@ -403,7 +404,7 @@ static struct vg_shader _shader_scene_standard = { " return world_compute_lighting( diffuse, normal, co, compute_board_shadow() );\n" "}\n" "\n" -"#line 9 0 \n" +"#line 7 0 \n" "#line 1 2 \n" "const float k_motion_lerp_amount = 0.01;\n" "\n" @@ -423,7 +424,7 @@ static struct vg_shader _shader_scene_standard = { " oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n" "}\n" "\n" -"#line 10 0 \n" +"#line 8 0 \n" "\n" "void main()\n" "{\n" @@ -453,8 +454,6 @@ static GLuint _uniform_scene_standard_uTexGarbage; static GLuint _uniform_scene_standard_uTexMain; static GLuint _uniform_scene_standard_uCamera; static GLuint _uniform_scene_standard_uPlane; -static GLuint _uniform_scene_standard_uBoard0; -static GLuint _uniform_scene_standard_uBoard1; static GLuint _uniform_scene_standard_g_world_depth; static GLuint _uniform_scene_standard_uLightsArray; static GLuint _uniform_scene_standard_uLightsIndex; @@ -479,12 +478,6 @@ static void shader_scene_standard_uCamera(v3f v){ static void shader_scene_standard_uPlane(v4f v){ glUniform4fv(_uniform_scene_standard_uPlane,1,v); } -static void shader_scene_standard_uBoard0(v3f v){ - glUniform3fv(_uniform_scene_standard_uBoard0,1,v); -} -static void shader_scene_standard_uBoard1(v3f v){ - glUniform3fv(_uniform_scene_standard_uBoard1,1,v); -} static void shader_scene_standard_g_world_depth(int i){ glUniform1i(_uniform_scene_standard_g_world_depth,i); } @@ -500,8 +493,6 @@ static void shader_scene_standard_link(void){ _uniform_scene_standard_uTexMain = glGetUniformLocation( _shader_scene_standard.id, "uTexMain" ); _uniform_scene_standard_uCamera = glGetUniformLocation( _shader_scene_standard.id, "uCamera" ); _uniform_scene_standard_uPlane = glGetUniformLocation( _shader_scene_standard.id, "uPlane" ); - _uniform_scene_standard_uBoard0 = glGetUniformLocation( _shader_scene_standard.id, "uBoard0" ); - _uniform_scene_standard_uBoard1 = glGetUniformLocation( _shader_scene_standard.id, "uBoard1" ); _uniform_scene_standard_g_world_depth = glGetUniformLocation( _shader_scene_standard.id, "g_world_depth" ); _uniform_scene_standard_uLightsArray = glGetUniformLocation( _shader_scene_standard.id, "uLightsArray" ); _uniform_scene_standard_uLightsIndex = glGetUniformLocation( _shader_scene_standard.id, "uLightsIndex" ); diff --git a/shaders/scene_standard_alphatest.fs b/shaders/scene_standard_alphatest.fs index fe8f10c..d7127a7 100644 --- a/shaders/scene_standard_alphatest.fs +++ b/shaders/scene_standard_alphatest.fs @@ -1,7 +1,5 @@ uniform sampler2D uTexGarbage; uniform sampler2D uTexMain; -uniform vec3 uBoard0; -uniform vec3 uBoard1; uniform vec3 uCamera; uniform vec4 uPlane; diff --git a/shaders/scene_standard_alphatest.h b/shaders/scene_standard_alphatest.h index f14bd6c..c512d36 100644 --- a/shaders/scene_standard_alphatest.h +++ b/shaders/scene_standard_alphatest.h @@ -64,8 +64,6 @@ static struct vg_shader _shader_scene_standard_alphatest = { .static_src = "uniform sampler2D uTexGarbage;\n" "uniform sampler2D uTexMain;\n" -"uniform vec3 uBoard0;\n" -"uniform vec3 uBoard1;\n" "uniform vec3 uCamera;\n" "uniform vec4 uPlane;\n" "\n" @@ -96,6 +94,8 @@ static struct vg_shader _shader_scene_standard_alphatest = { " vec4 g_sunset_ambient;\n" " vec4 g_sun_colour;\n" " vec4 g_sun_dir;\n" +" vec4 g_board_0;\n" +" vec4 g_board_1;\n" "\n" " float g_water_fog;\n" " float g_time;\n" @@ -196,7 +196,7 @@ static struct vg_shader _shader_scene_standard_alphatest = { " return ambient + (light_sun + sky_reflection) * shadow;\n" "}\n" "\n" -"#line 42 0 \n" +"#line 44 0 \n" "\n" "float world_depth_sample( vec3 pos )\n" "{\n" @@ -391,7 +391,8 @@ static struct vg_shader _shader_scene_standard_alphatest = { "float compute_board_shadow()\n" "{\n" " // player shadow\n" -" float dist_to_player = max( 0.0, sdLine( aWorldCo, uBoard0, uBoard1 )-0.1 );\n" +" float dist_to_player = max( 0.0, sdLine( aWorldCo, g_board_0.xyz,\n" +" g_board_1.xyz )-0.1 );\n" " float player_shadow = max( 1.0-dist_to_player*2.7, 0.0 );\n" " player_shadow *= player_shadow*player_shadow*player_shadow;\n" "\n" @@ -403,7 +404,7 @@ static struct vg_shader _shader_scene_standard_alphatest = { " return world_compute_lighting( diffuse, normal, co, compute_board_shadow() );\n" "}\n" "\n" -"#line 9 0 \n" +"#line 7 0 \n" "#line 1 2 \n" "const float k_motion_lerp_amount = 0.01;\n" "\n" @@ -423,7 +424,7 @@ static struct vg_shader _shader_scene_standard_alphatest = { " oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n" "}\n" "\n" -"#line 10 0 \n" +"#line 8 0 \n" "\n" "void main()\n" "{\n" @@ -454,8 +455,6 @@ static GLuint _uniform_scene_standard_alphatest_uPv; static GLuint _uniform_scene_standard_alphatest_uPvmPrev; static GLuint _uniform_scene_standard_alphatest_uTexGarbage; static GLuint _uniform_scene_standard_alphatest_uTexMain; -static GLuint _uniform_scene_standard_alphatest_uBoard0; -static GLuint _uniform_scene_standard_alphatest_uBoard1; static GLuint _uniform_scene_standard_alphatest_uCamera; static GLuint _uniform_scene_standard_alphatest_uPlane; static GLuint _uniform_scene_standard_alphatest_g_world_depth; @@ -476,12 +475,6 @@ static void shader_scene_standard_alphatest_uTexGarbage(int i){ static void shader_scene_standard_alphatest_uTexMain(int i){ glUniform1i(_uniform_scene_standard_alphatest_uTexMain,i); } -static void shader_scene_standard_alphatest_uBoard0(v3f v){ - glUniform3fv(_uniform_scene_standard_alphatest_uBoard0,1,v); -} -static void shader_scene_standard_alphatest_uBoard1(v3f v){ - glUniform3fv(_uniform_scene_standard_alphatest_uBoard1,1,v); -} static void shader_scene_standard_alphatest_uCamera(v3f v){ glUniform3fv(_uniform_scene_standard_alphatest_uCamera,1,v); } @@ -501,8 +494,6 @@ static void shader_scene_standard_alphatest_link(void){ _uniform_scene_standard_alphatest_uPvmPrev = glGetUniformLocation( _shader_scene_standard_alphatest.id, "uPvmPrev" ); _uniform_scene_standard_alphatest_uTexGarbage = glGetUniformLocation( _shader_scene_standard_alphatest.id, "uTexGarbage" ); _uniform_scene_standard_alphatest_uTexMain = glGetUniformLocation( _shader_scene_standard_alphatest.id, "uTexMain" ); - _uniform_scene_standard_alphatest_uBoard0 = glGetUniformLocation( _shader_scene_standard_alphatest.id, "uBoard0" ); - _uniform_scene_standard_alphatest_uBoard1 = glGetUniformLocation( _shader_scene_standard_alphatest.id, "uBoard1" ); _uniform_scene_standard_alphatest_uCamera = glGetUniformLocation( _shader_scene_standard_alphatest.id, "uCamera" ); _uniform_scene_standard_alphatest_uPlane = glGetUniformLocation( _shader_scene_standard_alphatest.id, "uPlane" ); _uniform_scene_standard_alphatest_g_world_depth = glGetUniformLocation( _shader_scene_standard_alphatest.id, "g_world_depth" ); diff --git a/shaders/scene_terrain.fs b/shaders/scene_terrain.fs index d9d0bf1..a1feb1a 100644 --- a/shaders/scene_terrain.fs +++ b/shaders/scene_terrain.fs @@ -3,8 +3,6 @@ uniform sampler2D uTexGradients; uniform vec3 uCamera; uniform vec3 uSandColour; uniform vec2 uBlendOffset; -uniform vec3 uBoard0; -uniform vec3 uBoard1; #include "common_scene.glsl" #include "motion_vectors_fs.glsl" diff --git a/shaders/scene_terrain.h b/shaders/scene_terrain.h index 00e9399..9886809 100644 --- a/shaders/scene_terrain.h +++ b/shaders/scene_terrain.h @@ -67,8 +67,6 @@ static struct vg_shader _shader_scene_terrain = { "uniform vec3 uCamera;\n" "uniform vec3 uSandColour;\n" "uniform vec2 uBlendOffset;\n" -"uniform vec3 uBoard0;\n" -"uniform vec3 uBoard1;\n" "\n" "#line 1 1 \n" "// :D\n" @@ -97,6 +95,8 @@ static struct vg_shader _shader_scene_terrain = { " vec4 g_sunset_ambient;\n" " vec4 g_sun_colour;\n" " vec4 g_sun_dir;\n" +" vec4 g_board_0;\n" +" vec4 g_board_1;\n" "\n" " float g_water_fog;\n" " float g_time;\n" @@ -197,7 +197,7 @@ static struct vg_shader _shader_scene_terrain = { " return ambient + (light_sun + sky_reflection) * shadow;\n" "}\n" "\n" -"#line 42 0 \n" +"#line 44 0 \n" "\n" "float world_depth_sample( vec3 pos )\n" "{\n" @@ -392,7 +392,8 @@ static struct vg_shader _shader_scene_terrain = { "float compute_board_shadow()\n" "{\n" " // player shadow\n" -" float dist_to_player = max( 0.0, sdLine( aWorldCo, uBoard0, uBoard1 )-0.1 );\n" +" float dist_to_player = max( 0.0, sdLine( aWorldCo, g_board_0.xyz,\n" +" g_board_1.xyz )-0.1 );\n" " float player_shadow = max( 1.0-dist_to_player*2.7, 0.0 );\n" " player_shadow *= player_shadow*player_shadow*player_shadow;\n" "\n" @@ -404,7 +405,7 @@ static struct vg_shader _shader_scene_terrain = { " return world_compute_lighting( diffuse, normal, co, compute_board_shadow() );\n" "}\n" "\n" -"#line 10 0 \n" +"#line 8 0 \n" "#line 1 2 \n" "const float k_motion_lerp_amount = 0.01;\n" "\n" @@ -424,7 +425,7 @@ static struct vg_shader _shader_scene_terrain = { " oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n" "}\n" "\n" -"#line 11 0 \n" +"#line 9 0 \n" "\n" "void main()\n" "{\n" @@ -477,8 +478,6 @@ static GLuint _uniform_scene_terrain_uTexGradients; static GLuint _uniform_scene_terrain_uCamera; static GLuint _uniform_scene_terrain_uSandColour; static GLuint _uniform_scene_terrain_uBlendOffset; -static GLuint _uniform_scene_terrain_uBoard0; -static GLuint _uniform_scene_terrain_uBoard1; static GLuint _uniform_scene_terrain_g_world_depth; static GLuint _uniform_scene_terrain_uLightsArray; static GLuint _uniform_scene_terrain_uLightsIndex; @@ -506,12 +505,6 @@ static void shader_scene_terrain_uSandColour(v3f v){ static void shader_scene_terrain_uBlendOffset(v2f v){ glUniform2fv(_uniform_scene_terrain_uBlendOffset,1,v); } -static void shader_scene_terrain_uBoard0(v3f v){ - glUniform3fv(_uniform_scene_terrain_uBoard0,1,v); -} -static void shader_scene_terrain_uBoard1(v3f v){ - glUniform3fv(_uniform_scene_terrain_uBoard1,1,v); -} static void shader_scene_terrain_g_world_depth(int i){ glUniform1i(_uniform_scene_terrain_g_world_depth,i); } @@ -528,8 +521,6 @@ static void shader_scene_terrain_link(void){ _uniform_scene_terrain_uCamera = glGetUniformLocation( _shader_scene_terrain.id, "uCamera" ); _uniform_scene_terrain_uSandColour = glGetUniformLocation( _shader_scene_terrain.id, "uSandColour" ); _uniform_scene_terrain_uBlendOffset = glGetUniformLocation( _shader_scene_terrain.id, "uBlendOffset" ); - _uniform_scene_terrain_uBoard0 = glGetUniformLocation( _shader_scene_terrain.id, "uBoard0" ); - _uniform_scene_terrain_uBoard1 = glGetUniformLocation( _shader_scene_terrain.id, "uBoard1" ); _uniform_scene_terrain_g_world_depth = glGetUniformLocation( _shader_scene_terrain.id, "g_world_depth" ); _uniform_scene_terrain_uLightsArray = glGetUniformLocation( _shader_scene_terrain.id, "uLightsArray" ); _uniform_scene_terrain_uLightsIndex = glGetUniformLocation( _shader_scene_terrain.id, "uLightsIndex" ); diff --git a/shaders/scene_vertex_blend.fs b/shaders/scene_vertex_blend.fs index e9c5c15..0368b20 100644 --- a/shaders/scene_vertex_blend.fs +++ b/shaders/scene_vertex_blend.fs @@ -1,8 +1,6 @@ uniform sampler2D uTexGarbage; uniform sampler2D uTexGradients; uniform vec3 uCamera; -uniform vec3 uBoard0; -uniform vec3 uBoard1; #include "common_scene.glsl" #include "motion_vectors_fs.glsl" diff --git a/shaders/scene_vertex_blend.h b/shaders/scene_vertex_blend.h index 17c6f91..5a2afe2 100644 --- a/shaders/scene_vertex_blend.h +++ b/shaders/scene_vertex_blend.h @@ -65,8 +65,6 @@ static struct vg_shader _shader_scene_vertex_blend = { "uniform sampler2D uTexGarbage;\n" "uniform sampler2D uTexGradients;\n" "uniform vec3 uCamera;\n" -"uniform vec3 uBoard0;\n" -"uniform vec3 uBoard1;\n" "\n" "#line 1 1 \n" "// :D\n" @@ -95,6 +93,8 @@ static struct vg_shader _shader_scene_vertex_blend = { " vec4 g_sunset_ambient;\n" " vec4 g_sun_colour;\n" " vec4 g_sun_dir;\n" +" vec4 g_board_0;\n" +" vec4 g_board_1;\n" "\n" " float g_water_fog;\n" " float g_time;\n" @@ -195,7 +195,7 @@ static struct vg_shader _shader_scene_vertex_blend = { " return ambient + (light_sun + sky_reflection) * shadow;\n" "}\n" "\n" -"#line 42 0 \n" +"#line 44 0 \n" "\n" "float world_depth_sample( vec3 pos )\n" "{\n" @@ -390,7 +390,8 @@ static struct vg_shader _shader_scene_vertex_blend = { "float compute_board_shadow()\n" "{\n" " // player shadow\n" -" float dist_to_player = max( 0.0, sdLine( aWorldCo, uBoard0, uBoard1 )-0.1 );\n" +" float dist_to_player = max( 0.0, sdLine( aWorldCo, g_board_0.xyz,\n" +" g_board_1.xyz )-0.1 );\n" " float player_shadow = max( 1.0-dist_to_player*2.7, 0.0 );\n" " player_shadow *= player_shadow*player_shadow*player_shadow;\n" "\n" @@ -402,7 +403,7 @@ static struct vg_shader _shader_scene_vertex_blend = { " return world_compute_lighting( diffuse, normal, co, compute_board_shadow() );\n" "}\n" "\n" -"#line 8 0 \n" +"#line 6 0 \n" "#line 1 2 \n" "const float k_motion_lerp_amount = 0.01;\n" "\n" @@ -422,7 +423,7 @@ static struct vg_shader _shader_scene_vertex_blend = { " oMotionVec = (vmotion1-vmotion0) * (1.0/k_motion_lerp_amount);\n" "}\n" "\n" -"#line 9 0 \n" +"#line 7 0 \n" "\n" "void main()\n" "{\n" @@ -469,8 +470,6 @@ static GLuint _uniform_scene_vertex_blend_uPvmPrev; static GLuint _uniform_scene_vertex_blend_uTexGarbage; static GLuint _uniform_scene_vertex_blend_uTexGradients; static GLuint _uniform_scene_vertex_blend_uCamera; -static GLuint _uniform_scene_vertex_blend_uBoard0; -static GLuint _uniform_scene_vertex_blend_uBoard1; static GLuint _uniform_scene_vertex_blend_g_world_depth; static GLuint _uniform_scene_vertex_blend_uLightsArray; static GLuint _uniform_scene_vertex_blend_uLightsIndex; @@ -492,12 +491,6 @@ static void shader_scene_vertex_blend_uTexGradients(int i){ static void shader_scene_vertex_blend_uCamera(v3f v){ glUniform3fv(_uniform_scene_vertex_blend_uCamera,1,v); } -static void shader_scene_vertex_blend_uBoard0(v3f v){ - glUniform3fv(_uniform_scene_vertex_blend_uBoard0,1,v); -} -static void shader_scene_vertex_blend_uBoard1(v3f v){ - glUniform3fv(_uniform_scene_vertex_blend_uBoard1,1,v); -} static void shader_scene_vertex_blend_g_world_depth(int i){ glUniform1i(_uniform_scene_vertex_blend_g_world_depth,i); } @@ -512,8 +505,6 @@ static void shader_scene_vertex_blend_link(void){ _uniform_scene_vertex_blend_uTexGarbage = glGetUniformLocation( _shader_scene_vertex_blend.id, "uTexGarbage" ); _uniform_scene_vertex_blend_uTexGradients = glGetUniformLocation( _shader_scene_vertex_blend.id, "uTexGradients" ); _uniform_scene_vertex_blend_uCamera = glGetUniformLocation( _shader_scene_vertex_blend.id, "uCamera" ); - _uniform_scene_vertex_blend_uBoard0 = glGetUniformLocation( _shader_scene_vertex_blend.id, "uBoard0" ); - _uniform_scene_vertex_blend_uBoard1 = glGetUniformLocation( _shader_scene_vertex_blend.id, "uBoard1" ); _uniform_scene_vertex_blend_g_world_depth = glGetUniformLocation( _shader_scene_vertex_blend.id, "g_world_depth" ); _uniform_scene_vertex_blend_uLightsArray = glGetUniformLocation( _shader_scene_vertex_blend.id, "uLightsArray" ); _uniform_scene_vertex_blend_uLightsIndex = glGetUniformLocation( _shader_scene_vertex_blend.id, "uLightsIndex" ); diff --git a/shaders/scene_water.h b/shaders/scene_water.h index a62842a..cd59ac1 100644 --- a/shaders/scene_water.h +++ b/shaders/scene_water.h @@ -103,6 +103,8 @@ static struct vg_shader _shader_scene_water = { " vec4 g_sunset_ambient;\n" " vec4 g_sun_colour;\n" " vec4 g_sun_dir;\n" +" vec4 g_board_0;\n" +" vec4 g_board_1;\n" "\n" " float g_water_fog;\n" " float g_time;\n" @@ -203,7 +205,7 @@ static struct vg_shader _shader_scene_water = { " return ambient + (light_sun + sky_reflection) * shadow;\n" "}\n" "\n" -"#line 42 0 \n" +"#line 44 0 \n" "\n" "float world_depth_sample( vec3 pos )\n" "{\n" @@ -398,7 +400,8 @@ static struct vg_shader _shader_scene_water = { "float compute_board_shadow()\n" "{\n" " // player shadow\n" -" float dist_to_player = max( 0.0, sdLine( aWorldCo, uBoard0, uBoard1 )-0.1 );\n" +" float dist_to_player = max( 0.0, sdLine( aWorldCo, g_board_0.xyz,\n" +" g_board_1.xyz )-0.1 );\n" " float player_shadow = max( 1.0-dist_to_player*2.7, 0.0 );\n" " player_shadow *= player_shadow*player_shadow*player_shadow;\n" "\n" diff --git a/shaders/scene_water_fast.h b/shaders/scene_water_fast.h index b4510c7..84fc918 100644 --- a/shaders/scene_water_fast.h +++ b/shaders/scene_water_fast.h @@ -100,6 +100,8 @@ static struct vg_shader _shader_scene_water_fast = { " vec4 g_sunset_ambient;\n" " vec4 g_sun_colour;\n" " vec4 g_sun_dir;\n" +" vec4 g_board_0;\n" +" vec4 g_board_1;\n" "\n" " float g_water_fog;\n" " float g_time;\n" @@ -200,7 +202,7 @@ static struct vg_shader _shader_scene_water_fast = { " return ambient + (light_sun + sky_reflection) * shadow;\n" "}\n" "\n" -"#line 42 0 \n" +"#line 44 0 \n" "\n" "float world_depth_sample( vec3 pos )\n" "{\n" @@ -395,7 +397,8 @@ static struct vg_shader _shader_scene_water_fast = { "float compute_board_shadow()\n" "{\n" " // player shadow\n" -" float dist_to_player = max( 0.0, sdLine( aWorldCo, uBoard0, uBoard1 )-0.1 );\n" +" float dist_to_player = max( 0.0, sdLine( aWorldCo, g_board_0.xyz,\n" +" g_board_1.xyz )-0.1 );\n" " float player_shadow = max( 1.0-dist_to_player*2.7, 0.0 );\n" " player_shadow *= player_shadow*player_shadow*player_shadow;\n" "\n" diff --git a/skaterift.c b/skaterift.c index 7b1d1d1..df5c147 100644 --- a/skaterift.c +++ b/skaterift.c @@ -20,9 +20,8 @@ #include "audio.h" #include "world.h" #include "font.h" - - #include "player.h" + static player_instance localplayer; VG_STATIC struct player_avatar localplayer_avatar; VG_STATIC glmesh localplayer_meshes[3]; @@ -37,9 +36,6 @@ player_instance *tmp_localplayer(void) #include "menu.h" #include "vehicle.h" -static int cl_ui = 1, - cl_light_edit = 0; - #define DEV_AARON #ifdef DEV_AARON static rb_object aaron={ @@ -123,35 +119,8 @@ VG_STATIC void vg_preload(void) { g_conf_init(); - common_var_temp(); - - vg_var_push( (struct vg_var){ - .name = "cl_ui", - .data = &cl_ui, - .data_type = k_var_dtype_i32, - .opt_i32 = { .min=0, .max=1, .clamp=1 }, - .persistent = 0 - }); - - vg_var_push( (struct vg_var){ - .name = "ledit", - .data = &cl_light_edit, - .data_type = k_var_dtype_i32, - .opt_i32 = { .min=0, .max=1, .clamp=1 }, - .persistent = 0 - }); - - vg_function_push( (struct vg_cmd) { - .name = "respawn", - .function = __respawn, - //.poll_suggest = reset_player_poll - }); - - vg_function_push( (struct vg_cmd) { - .name = "ded", - .function = __kill, - //.poll_suggest = reset_player_poll - }); + vg_console_reg_cmd( "respawn", __respawn, NULL ); + vg_console_reg_cmd( "ded", __kill, NULL ); vg_info(" Copyright . . . -----, ,----- ,---. .---. \n" ); vg_info(" 2021-2022 |\\ /| | / | | | | /| \n" ); @@ -233,14 +202,13 @@ VG_STATIC void vg_load(void) vg_loader_step( render_init, NULL ); vg_loader_step( menu_init, NULL ); vg_loader_step( world_init, NULL ); + vg_loader_step( vehicle_init, NULL ); vg_loader_step( font3d_init, NULL ); font3d_load( &world_global.font, "models/rs_font.mdl", vg_mem.rtmemory ); - //vg_loader_step( player_init, NULL ); - vg_loader_step( vehicle_init, NULL ); - // - //vg_loader_step( player_model_init, NULL ); + vg_loader_step( player_init, NULL ); + vg_loader_step( player_ragdoll_init, NULL ); /* ----------------- */ vg_loader_step( load_playermodels, NULL ); @@ -522,6 +490,7 @@ VG_STATIC void render_scene(void) return; } + world_prerender( view_world ); render_world( view_world, &main_camera, 0 ); render_water_texture( view_world, &main_camera, 0 ); diff --git a/steam.h b/steam.h index f6eadcd..7bd0ab8 100644 --- a/steam.h +++ b/steam.h @@ -257,23 +257,9 @@ VG_STATIC int steam_init(void) vg_warn( "No Steam Logon: Cannot request stats\n" ); - vg_function_push( (struct vg_cmd) - { - .name = "ach_list", - .function = steam_list_achievements - }); - - vg_function_push( (struct vg_cmd) - { - .name = "ach_clear_all", - .function = steam_clear_all_achievements - }); - - vg_function_push( (struct vg_cmd) - { - .name = "ach_set", - .function = steam_set_achievemnt_test - }); + vg_console_reg_cmd( "ach_list", steam_list_achievements, NULL ); + vg_console_reg_cmd( "ach_clear_all", steam_clear_all_achievements, NULL ); + vg_console_reg_cmd( "ach_set", steam_set_achievemnt_test, NULL ); steam_hInput = SteamAPI_SteamInput(); SteamAPI_ISteamInput_Init( steam_hInput, 0 ); diff --git a/vehicle.h b/vehicle.h index 54a2591..02ceb04 100644 --- a/vehicle.h +++ b/vehicle.h @@ -76,22 +76,19 @@ VG_STATIC void vehicle_init(void) v3_zero( gzoomer.obj.rb.co ); rb_init_object( &gzoomer.obj ); - VG_VAR_F32_PERSISTENT( k_car_spring ); - VG_VAR_F32_PERSISTENT( k_car_spring_damp ); - VG_VAR_F32_PERSISTENT( k_car_spring_length ); - VG_VAR_F32_PERSISTENT( k_car_wheel_radius ); - VG_VAR_F32_PERSISTENT( k_car_friction_lat ); - VG_VAR_F32_PERSISTENT( k_car_friction_roll ); - VG_VAR_F32_PERSISTENT( k_car_drive_force ); - VG_VAR_F32_PERSISTENT( k_car_air_resistance ); - VG_VAR_F32_PERSISTENT( k_car_downforce ); + VG_VAR_F32( k_car_spring, flags=VG_VAR_PERSISTENT ); + VG_VAR_F32( k_car_spring_damp, flags=VG_VAR_PERSISTENT ); + VG_VAR_F32( k_car_spring_length, flags=VG_VAR_PERSISTENT ); + VG_VAR_F32( k_car_wheel_radius, flags=VG_VAR_PERSISTENT ); + VG_VAR_F32( k_car_friction_lat, flags=VG_VAR_PERSISTENT ); + VG_VAR_F32( k_car_friction_roll, flags=VG_VAR_PERSISTENT ); + VG_VAR_F32( k_car_drive_force, flags=VG_VAR_PERSISTENT ); + VG_VAR_F32( k_car_air_resistance,flags=VG_VAR_PERSISTENT ); + VG_VAR_F32( k_car_downforce, flags=VG_VAR_PERSISTENT ); VG_VAR_I32( gzoomer.inside ); - vg_function_push( (struct vg_cmd){ - .name = "spawn_car", - .function = spawn_car - }); + vg_console_reg_cmd( "spawn_car", spawn_car, NULL ); v3_copy((v3f){ -1.0f, -0.25f, -1.5f }, gzoomer.wheels_local[0] ); v3_copy((v3f){ 1.0f, -0.25f, -1.5f }, gzoomer.wheels_local[1] ); diff --git a/world.h b/world.h index ab663d0..c782ae0 100644 --- 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; diff --git a/world_render.h b/world_render.h index e04a6bb..ad0d5c4 100644 --- a/world_render.h +++ b/world_render.h @@ -183,8 +183,6 @@ VG_STATIC void render_world_vb( world_instance *world, camera *cam ) shader_scene_vertex_blend_uPvmPrev( cam->mtx_prev.pv ); shader_scene_vertex_blend_uMdl( identity_matrix ); shader_scene_vertex_blend_uCamera( cam->transform[3] ); - shader_scene_vertex_blend_uBoard0( TEMP_BOARD_0 ); - shader_scene_vertex_blend_uBoard1( TEMP_BOARD_1 ); world_render_both_stages( world, k_shader_standard_vertex_blend, bindpoint_diffuse_texture1 ); @@ -213,8 +211,6 @@ VG_STATIC void render_world_standard( world_instance *world, camera *cam ) shader_scene_standard_uMdl( identity_matrix ); shader_scene_standard_uCamera( cam->transform[3] ); - shader_scene_standard_uBoard0( TEMP_BOARD_0 ); - shader_scene_standard_uBoard1( TEMP_BOARD_1 ); world_render_both_stages( world, k_shader_standard, bindpoint_diffuse_texture1 ); @@ -244,8 +240,6 @@ VG_STATIC void render_world_alphatest( world_instance *world, camera *cam ) shader_scene_standard_alphatest_uMdl( identity_matrix ); shader_scene_standard_alphatest_uCamera( cam->transform[3] ); - shader_scene_standard_alphatest_uBoard0( TEMP_BOARD_0 ); - shader_scene_standard_alphatest_uBoard1( TEMP_BOARD_1 ); glDisable(GL_CULL_FACE); @@ -289,8 +283,6 @@ VG_STATIC void render_terrain( world_instance *world, camera *cam ) shader_scene_terrain_uMdl( identity_matrix ); shader_scene_terrain_uCamera( cam->transform[3] ); - shader_scene_terrain_uBoard0( TEMP_BOARD_0 ); - shader_scene_terrain_uBoard1( TEMP_BOARD_1 ); world_render_both_stages( world, k_shader_terrain_blend, bindpoint_terrain ); } @@ -380,6 +372,49 @@ VG_STATIC void render_world_gates( world_instance *world, camera *cam, } } +VG_STATIC void world_prerender( world_instance *world ) +{ + 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 ); +} + VG_STATIC void render_world( world_instance *world, camera *cam, int layer_depth ) { diff --git a/world_routes.h b/world_routes.h index df758da..acb5813 100644 --- a/world_routes.h +++ b/world_routes.h @@ -565,11 +565,6 @@ VG_STATIC void world_routes_ent_init( world_instance *world ) for( u32 i=0; ient_gate); i++ ){ ent_gate *gate = mdl_arritm( &world->ent_gate, i ); - - vg_info( "ROUTES :: %hu %hu %hu %hu\n", gate->routes[0], - gate->routes[1], - gate->routes[2], - gate->routes[3] ); } world_routes_clear( world ); @@ -584,7 +579,7 @@ VG_STATIC void world_routes_ent_init( world_instance *world ) VG_STATIC void world_routes_init(void) { world_global.current_run_version = 200; - world_global.time = RESET_MAX_TIME*2.0; + world_global.time = 300.0; world_global.last_use = 0.0; shader_scene_route_register(); @@ -855,8 +850,6 @@ VG_STATIC void render_world_routes( world_instance *world, camera *cam, shader_scene_route_uPvmPrev( cam->mtx_prev.pv ); shader_scene_route_uMdl( identity_matrix ); shader_scene_route_uCamera( cam->transform[3] ); - shader_scene_route_uBoard0( TEMP_BOARD_0 ); - shader_scene_route_uBoard1( TEMP_BOARD_1 ); mesh_bind( &world->mesh_route_lines ); diff --git a/world_sfd.h b/world_sfd.h index 69501e2..98d34b2 100644 --- a/world_sfd.h +++ b/world_sfd.h @@ -156,11 +156,7 @@ VG_STATIC void world_sfd_init(void) { vg_info( "world_sfd_init\n" ); shader_scene_scoretext_register(); - - vg_function_push( (struct vg_cmd){ - .name = "sfd", - .function = world_sfd_test - }); + vg_console_reg_cmd( "sfd", world_sfd_test, NULL ); vg_linear_clear( vg_mem.scratch ); -- 2.25.1