X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_glide.c;h=5df05e3db61bd7047738ab7a109530851c82475f;hb=238a3a4ef19bb137e2a878ee38f99d253eddb51c;hp=dd820fb7b1c8d58421c2d17d3813ce8321ce075b;hpb=ad9ece78cdcf550c34d28af276567d7d18b67668;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_glide.c b/player_glide.c index dd820fb..5df05e3 100644 --- a/player_glide.c +++ b/player_glide.c @@ -125,7 +125,7 @@ static void calculate_lift( v3f vl, f32 aoa_bias, f32 windv2 = v3_length2(wind), aoa = atan2f( v3_dot( up, wind ), v3_dot( back, wind ) ) + aoa_bias, - cl = aoa / VG_PIf, /* TODO: make it a curve */ + cl = aoa / VG_PIf, L = windv2 * cl * power; v3f lift_dir; @@ -273,11 +273,15 @@ void player_glide_update(void) v2f steer; joystick_state( k_srjoystick_steer, steer ); - if( glider_physics( steer ) ){ + if( glider_physics( steer ) ) + { vg_info( "player fell off due to glider hitting ground\n" ); player__dead_transition( k_player_die_type_generic ); localplayer.glider_orphan = 1; } + + if( !world_water_player_safe( world_current_instance(), 1.0f ) ) + return; } void player_glide_post_update(void) @@ -343,18 +347,17 @@ void player_glide_remote_animator_exchange( bitpack_ctx *ctx, void *data ) bitpack_qquat( ctx, animator->root_q ); } -void player_glide_im_gui(void) +void player_glide_im_gui( ui_context *ctx ) { - player__debugtext( 1, "Nothing here" ); - player__debugtext( 1, " lift: %.2f %.2f %.2f", + player__debugtext( ctx, 1, " lift: %.2f %.2f %.2f", player_glide.info_lift[0], player_glide.info_lift[1], player_glide.info_lift[2] ); - player__debugtext( 1, " slip: %.2f %.2f %.2f", + player__debugtext( ctx, 1, " slip: %.2f %.2f %.2f", player_glide.info_slip[0], player_glide.info_slip[1], player_glide.info_slip[2] ); - player__debugtext( 1, " drag: %.2f %.2f %.2f", + player__debugtext( ctx, 1, " drag: %.2f %.2f %.2f", player_glide.info_drag[0], player_glide.info_drag[1], player_glide.info_drag[2] ); @@ -515,7 +518,7 @@ void player_glide_transition(void) void render_glider_model( vg_camera *cam, world_instance *world, m4x3f mmdl, enum board_shader shader ) { - u32 current_tex = 0xffffffff; + u32 current_mat = 0xffffffff; glActiveTexture( GL_TEXTURE0 ); mdl_context *mdl = &player_glide.glider; @@ -550,20 +553,22 @@ void render_glider_model( vg_camera *cam, world_instance *world, continue; } - mdl_material *mat = mdl_arritm( &mdl->materials, sm->material_id-1 ); - if( mat->tex_diffuse != current_tex ) + if( sm->material_id != current_mat ) { + mdl_material *mat = mdl_arritm( &mdl->materials,sm->material_id-1 ); GLuint tex = vg.tex_missing; - if( mat->tex_diffuse ) + if( mat->shader == k_shader_standard ) { - u32 index = mat->tex_diffuse-1; + struct shader_props_standard *props = mat->props.compiled; + + u32 index = props->tex_diffuse-1; mdl_texture *ptex = mdl_arritm( &mdl->textures, index ); tex = ptex->glname; } glBindTexture( GL_TEXTURE_2D, tex ); - current_tex = mat->tex_diffuse; + current_mat = sm->material_id; } mdl_draw_submesh( sm );