freecam
authorhgn <hgodden00@gmail.com>
Sat, 3 Dec 2022 14:11:34 +0000 (14:11 +0000)
committerhgn <hgodden00@gmail.com>
Sat, 3 Dec 2022 14:11:34 +0000 (14:11 +0000)
player.h
player_physics.h
world_render.h

index 95517725e435a2a895874d94321d74b15233b944..0ed16b6f3a5f89af72d8b714ce1476da0e80840a 100644 (file)
--- a/player.h
+++ b/player.h
@@ -584,7 +584,6 @@ VG_STATIC void player_update_post(void)
    if( freecam )
       player_freecam();
 
-
    /* CAMERA POSITIONING: LAYER 0 */
    v2_copy( player.angles, main_camera.angles );
    v3_copy( player.camera_pos, main_camera.pos );
index 997b69d1b657fa696eec2ab8fac0d0c286b43ad5..db7105d1ed246bbfe95947a7612243dee5ca7541 100644 (file)
@@ -197,6 +197,9 @@ VG_STATIC void player_physics_control_passive(void)
       v2_muladds( phys->grab_mouse_delta, vg.mouse_delta, 0.02f, 
                   phys->grab_mouse_delta );
       v2_normalize_clamp( phys->grab_mouse_delta );
+
+      if( freecam )
+         v2_zero( phys->grab_mouse_delta );
    }
    else
       v2_zero( phys->grab_mouse_delta );
@@ -502,6 +505,9 @@ VG_STATIC void player_walk_physics(void)
 
    v2f walk = { player.input_walkh->axis.value,
                 player.input_walkv->axis.value };
+
+   if( freecam )
+      v2_zero( walk );
    
    if( v2_length2(walk) > 0.001f )
       v2_normalize_clamp( walk );
@@ -1158,7 +1164,7 @@ VG_STATIC void player_freecam(void)
 {
    player_mouseview();
 
-   float movespeed = fc_speed;
+   float movespeed = fc_speed * VG_TIMESTEP_FIXED;
    v3f lookdir = { 0.0f, 0.0f, -1.0f },
        sidedir = { 1.0f, 0.0f,  0.0f };
    
@@ -1167,17 +1173,11 @@ VG_STATIC void player_freecam(void)
    
    static v3f move_vel = { 0.0f, 0.0f, 0.0f };
 
-   /* TODO */
-#if 0
-   if( vg_get_button( "forward" ) )
-      v3_muladds( move_vel, lookdir, VG_TIMESTEP_FIXED * movespeed, move_vel );
-   if( vg_get_button( "back" ) )
-      v3_muladds( move_vel, lookdir, VG_TIMESTEP_FIXED *-movespeed, move_vel );
-   if( vg_get_button( "left" ) )
-      v3_muladds( move_vel, sidedir, VG_TIMESTEP_FIXED *-movespeed, move_vel );
-   if( vg_get_button( "right" ) )
-      v3_muladds( move_vel, sidedir, VG_TIMESTEP_FIXED * movespeed, move_vel );
-#endif
+   v2f steer = { player.input_js1h->axis.value,
+                 player.input_js1v->axis.value };
+
+   v3_muladds( move_vel, sidedir,  movespeed*steer[0], move_vel );
+   v3_muladds( move_vel, lookdir, -movespeed*steer[1], move_vel );
 
    v3_muls( move_vel, 0.7f, move_vel );
    v3_add( move_vel, player.camera_pos, player.camera_pos );
index 68c0ceb91a88efe8cd22635d158fc7d00a6118c3..af20830cd0f6d388ca7abcdb58bba139769d5bf9 100644 (file)
@@ -65,8 +65,11 @@ VG_STATIC void world_render_both_stages( enum mdl_shader shader,
 {
    mesh_bind( &world.mesh_geo );
    world_render_if( shader, k_geo_type_solid, bind_point );
+
+   glDisable( GL_CULL_FACE );
    mesh_bind( &world.mesh_no_collide );
    world_render_if( shader, k_geo_type_nonsolid, bind_point );
+   glEnable( GL_CULL_FACE );
 }
 
 VG_STATIC void bindpoint_diffuse_texture1( struct world_material *mat )