#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" },
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 );
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;
#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,
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 */
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 */
PLAYER_API
void player__bind( player_instance *player )
{
- player__skate_bind( player );
- player__walk_bind( player );
- player__drive_bind( player );
+ for( u32 i=0; i<vg_list_size(_player_bind); i++ ){
+ if( _player_bind[i] )
+ _player_bind[i]( player );
+ }
}
/*
v3f vp0 = {0.0f,0.1f, 0.55f},
vp1 = {0.0f,0.1f,-0.55f};
- m4x3_mulv( av->sk.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 ){
#include "player_drive.h"
#define PLAYER_REWIND_FRAMES 60*4
+#define RESET_MAX_TIME 45.0
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 ) =
{
NULL
};
+VG_STATIC void player_init(void)
+{
+ for( u32 i=0; i<vg_list_size(_player_system_register); i++ ){
+ if( _player_system_register[i] )
+ _player_system_register[i]();
+ }
+}
+
/* implementation */
#include "player.c"
+++ /dev/null
-/*
- * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved
- */
-
-#ifndef PLAYER_ANIMATION_H
-#define PLAYER_ANIMATION_H
-
-#include "player.h"
-#include "player_physics_walk.h"
-
-VG_STATIC void player_animate_offboard(void)
-{
- player_walk_animate( &player_walky, &player.mdl.sk, NULL );
-}
-
-VG_STATIC void player_animate(void)
-{
-#if 0
- struct player_phys *phys = &player.phys;
- rb_extrapolate_transform( &player.phys.rb, player.visual_transform );
- v3_muladds( player.visual_transform[3], phys->rb.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; i<vg_list_size(apply_to); i ++ )
- {
- apose[apply_to[i]-1].co[0] += offset[0]*add_grab_mod;
- apose[apply_to[i]-1].co[2] += offset[2]*add_grab_mod;
- }
-
- v3f bo;
- v3_muls( player.board_offset, add_grab_mod, bo );
-
- v3_add( bo, apose[ player.mdl.id_board-1 ].co,
- apose[ player.mdl.id_board-1 ].co );
- v3_add( bo, apose[ player.mdl.id_ik_foot_l-1 ].co,
- apose[ player.mdl.id_ik_foot_l-1 ].co );
- v3_add( bo, apose[ player.mdl.id_ik_foot_r-1 ].co,
- apose[ player.mdl.id_ik_foot_r-1 ].co );
-
- m3x3f c;
- q_m3x3( player.board_rotation, c );
-
- v3f d;
- v3_sub( apose[ player.mdl.id_ik_foot_l-1 ].co, bo, d );
- m3x3_mulv( c, d, d );
- v3_add( bo, d, apose[ player.mdl.id_ik_foot_l-1 ].co );
-
- v3_sub( apose[ player.mdl.id_ik_foot_r-1 ].co, bo, d );
- m3x3_mulv( c, d, d );
- v3_add( bo, d, apose[ player.mdl.id_ik_foot_r-1 ].co );
-
- q_mul( player.board_rotation, apose[ player.mdl.id_board-1 ].q ,
- apose[ player.mdl.id_board-1 ].q );
- q_normalize( apose[ player.mdl.id_board-1 ].q );
- }
-
- skeleton_apply_pose( &player.mdl.sk, apose, k_anim_apply_defer_ik );
- skeleton_apply_ik_pass( &player.mdl.sk );
- skeleton_apply_pose( &player.mdl.sk, apose, k_anim_apply_deffered_only );
-
- v3_copy( player.mdl.sk.final_mtx[player.mdl.id_head-1][3],
- player.mdl.cam_pos );
- skeleton_apply_inverses( &player.mdl.sk );
-
- skeleton_apply_transform( &player.mdl.sk, player.visual_transform );
- skeleton_debug( &player.mdl.sk );
-#endif
-}
-
-VG_STATIC void player_animate_death_cam(void)
-{
- v3f delta;
- v3f head_pos;
- v3_copy( player.mdl.ragdoll[0].rb.co, head_pos );
-
- v3_sub( head_pos, player.camera_pos, delta );
- v3_normalize( delta );
-
- v3f follow_pos;
- v3_muladds( head_pos, delta, -2.5f, follow_pos );
- v3_lerp( player.camera_pos, follow_pos, 0.1f, player.camera_pos );
-
- /*
- * Make sure the camera stays above the ground
- */
- v3f min_height = {0.0f,1.0f,0.0f};
-
- v3f sample;
- v3_add( player.camera_pos, min_height, sample );
- ray_hit hit;
- hit.dist = min_height[1]*2.0f;
-
- if( ray_world( sample, (v3f){0.0f,-1.0f,0.0f}, &hit ))
- v3_add( hit.pos, min_height, player.camera_pos );
-
- if( world.water.enabled )
- {
- player.camera_pos[1] =
- vg_maxf( world.water.height + 2.0f, player.camera_pos[1] );
- }
-
- player.angles[0] = atan2f( delta[0], -delta[2] );
- player.angles[1] = -asinf( delta[1] );
-}
-
-VG_STATIC void player_animate_follow_cam( v3f target, float dist, float speed )
-{
- v3f delta;
-
- v3_sub( target, player.camera_pos, delta );
- v3_normalize( delta );
-
- v3f follow_pos;
- v3_muladds( target, delta, -dist, follow_pos );
- v3_lerp( player.camera_pos, follow_pos,
- speed * vg.time_delta, player.camera_pos );
-
- /*
- * Make sure the camera stays above the ground
- */
- v3f min_height = {0.0f,1.0f,0.0f};
-
- v3f sample;
- v3_add( player.camera_pos, min_height, sample );
- ray_hit hit;
- hit.dist = min_height[1]*2.0f;
-
- if( ray_world( sample, (v3f){0.0f,-1.0f,0.0f}, &hit ))
- v3_add( hit.pos, min_height, player.camera_pos );
-
-#if 0
- if( world.water.enabled )
- {
- player.camera_pos[1] =
- vg_maxf( world.water.height + 2.0f, player.camera_pos[1] );
- }
-#endif
-
- player.angles[0] = atan2f( delta[0], -delta[2] );
- player.angles[1] = -asinf( delta[1] );
-}
-
-VG_STATIC void player_animate_camera_thirdperson(void)
-{
- static v3f lerp_cam = { 0.0f, 0.0f, 0.0f };
- v3f target;
-
- v3_muladds( player.rb.co, player.rb.up, 1.2f, target );
-
- player_animate_follow_cam( target, 1.5f, 20.0f );
-}
-
-VG_STATIC void player_animate_camera(void)
-{
- static v3f lerp_cam = {0.0f,0.0f,0.0f};
- v3f cam_pos;
-
- int _on_board = player.controller == k_player_controller_skate;
- player.fonboard = vg_lerpf( player.fonboard, _on_board, vg.time_delta );
-
- if( _on_board )
- {
-#if 0
- v3f offs = { -0.4f, 0.15f, 0.0f };
- v3_lerp( lerp_cam, player.mdl.cam_pos, 0.8f, lerp_cam );
- v3_add( lerp_cam, offs, cam_pos );
-
- /* Look angles */
- v3_lerp( phys->vl, 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 */
#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] ),
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 )
{
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,
float substep,
substep_delta;
- struct jump_info
- {
+ struct jump_info{
v3f log[50];
v3f n;
v3f apex;
float score,
land_dist;
- enum prediction_type
- {
+ enum prediction_type{
k_prediction_none,
k_prediction_unset,
k_prediction_land,
float grind_strength;
- struct grind_limit
- {
+ struct grind_limit{
v3f ra, n;
float p;
}
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 );
#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,
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,
}
activity;
- enum walk_outro
- {
+ enum walk_outro{
k_walk_outro_none,
k_walk_outro_jump_to_air,
k_walk_outro_drop_in,
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 );
/*
* All standard buffers used in rendering
*/
-VG_STATIC struct pipeline
-{
+VG_STATIC struct pipeline{
glmesh fsquad;
framebuffer *fb_main,
}
gpipeline = { .view_render_scale = 1.0f };
-struct framebuffer
-{
+struct framebuffer{
const char *display_name;
int resolution_div, /* definition */
fixed_w,
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
}
{
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" );
}
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 );
GLenum colour_attachments[4];
u32 colour_count = 0;
- for( int j=0; j<vg_list_size(fb->attachments); j++ )
- {
+ for( int j=0; j<vg_list_size(fb->attachments); j++ ){
struct framebuffer_attachment *attachment = &fb->attachments[j];
if( attachment->purpose == k_framebuffer_attachment_type_none )
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 );
*/
GLenum result = glCheckFramebufferStatus( GL_FRAMEBUFFER );
- if( result == GL_FRAMEBUFFER_COMPLETE )
- {
+ if( result == GL_FRAMEBUFFER_COMPLETE ){
/*
* Attatch to gpipeline
*/
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 )
if( !gpipeline.ready )
return;
- for( int i=0; i<vg_list_size(framebuffers); i++ )
- {
+ for( int i=0; i<vg_list_size(framebuffers); i++ ){
struct framebuffer *fb = &framebuffers[i];
- for( int j=0; j<vg_list_size(fb->attachments); j++ )
- {
+ for( int j=0; j<vg_list_size(fb->attachments); j++ ){
struct framebuffer_attachment *attachment = &fb->attachments[j];
render_fb_allocate_texture( fb, attachment );
}
{
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,
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 );
/*
* Complete Framebuffers
*/
- for( int i=0; i<vg_list_size(framebuffers); i++ )
- {
+ for( int i=0; i<vg_list_size(framebuffers); i++ ){
struct framebuffer *fb = &framebuffers[i];
render_fb_allocate( fb );
}
*/
VG_STATIC int render_framebuffer_control( int argc, char const *argv[] )
{
- if( argc < 2 )
- {
+ if( argc < 2 ){
vg_error( "Usage: fb \"show/hide\" <name>/\"all\" <name>/none\n" );
return 0;
}
operation = 1;
else if( !strcmp( argv[0], "hide" ) )
operation = 0;
- else
- {
+ else{
vg_error( "Unknown framebuffer operation: '%s'\n", argv[0] );
return 0;
}
if( !strcmp( argv[1], "all" ) )
modify_all = 1;
- for( int i=0; i<vg_list_size(framebuffers); i++ )
- {
+ for( int i=0; i<vg_list_size(framebuffers); i++ ){
struct framebuffer *fb = &framebuffers[i];
- for( int j=0; j<vg_list_size(fb->attachments); j++ )
- {
+ for( int j=0; j<vg_list_size(fb->attachments); 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] ) )
{
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; i<vg_list_size(framebuffers); i++ )
- {
+ for( int i=0; i<vg_list_size(framebuffers); i++ ){
struct framebuffer *fb = &framebuffers[i];
console_suggest_score_text( fb->display_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; i<vg_list_size(framebuffers); i++ )
- {
+ for( int i=0; i<vg_list_size(framebuffers); i++ ){
struct framebuffer *fb = &framebuffers[i];
- for( int j=0; j<vg_list_size(fb->attachments); j++ )
- {
+ for( int j=0; j<vg_list_size(fb->attachments); 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 );
}
}
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 );
}
/*
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;
};
/* simple objects */
-struct rb_object
-{
+struct rb_object{
rigidbody rb;
enum rb_shape{
k_rb_shape_box = 0,
}
type;
- union
- {
+ union{
struct rb_sphere sphere;
struct rb_capsule capsule;
struct rb_scene scene;
inf;
};
-VG_STATIC struct contact
-{
+VG_STATIC struct contact{
rigidbody *rba, *rbb;
v3f co, n;
v3f t[2];
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 */
float tangent_mass, axis_mass;
};
-struct rb_constr_spring
-{
+struct rb_constr_spring{
int nothing;
};
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];
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 );
}
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);
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;
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 );
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;
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;
" 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"
" 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"
" 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"
" 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"
" 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"
" 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"
"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"
" 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"
" 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"
"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"
uniform sampler2D uTexGradients;
uniform vec3 uCamera;
uniform vec4 uColour;
-uniform vec3 uBoard0;
-uniform vec3 uBoard1;
#include "common_scene.glsl"
#include "motion_vectors_fs.glsl"
"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"
" 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"
" 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"
"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"
" 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"
" 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"
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;
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);
}
_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" );
"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"
" 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"
" 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"
"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"
" 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"
" 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"
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;
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);
}
_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" );
uniform sampler2D uTexMain;
uniform vec3 uCamera;
uniform vec4 uPlane;
-uniform vec3 uBoard0;
-uniform vec3 uBoard1;
#include "common_scene.glsl"
#include "motion_vectors_fs.glsl"
"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"
" 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"
" 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"
"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"
" 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"
" 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"
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;
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);
}
_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" );
uniform sampler2D uTexGarbage;
uniform sampler2D uTexMain;
-uniform vec3 uBoard0;
-uniform vec3 uBoard1;
uniform vec3 uCamera;
uniform vec4 uPlane;
.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"
" 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"
" 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"
"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"
" 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"
" 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"
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;
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);
}
_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" );
uniform vec3 uCamera;
uniform vec3 uSandColour;
uniform vec2 uBlendOffset;
-uniform vec3 uBoard0;
-uniform vec3 uBoard1;
#include "common_scene.glsl"
#include "motion_vectors_fs.glsl"
"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"
" 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"
" 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"
"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"
" 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"
" 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"
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;
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);
}
_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" );
uniform sampler2D uTexGarbage;
uniform sampler2D uTexGradients;
uniform vec3 uCamera;
-uniform vec3 uBoard0;
-uniform vec3 uBoard1;
#include "common_scene.glsl"
#include "motion_vectors_fs.glsl"
"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"
" 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"
" 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"
"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"
" 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"
" 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"
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;
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);
}
_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" );
" 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"
" 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"
"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"
" 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"
" 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"
"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"
#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];
#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={
{
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" );
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 );
return;
}
+ world_prerender( view_world );
render_world( view_world, &main_camera, 0 );
render_water_texture( view_world, &main_camera, 0 );
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 );
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] );
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;
* 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"
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;
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,
}
}
sfd_update();
-
-
static float random_accum = 0.0f;
random_accum += vg.time_delta;
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 );
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 );
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);
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 );
}
}
}
+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 )
{
for( u32 i=0; i<mdl_arrcount(&world->ent_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 );
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();
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 );
{
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 );