fluff
authorhgn <hgodden00@gmail.com>
Sun, 9 Jul 2023 01:50:59 +0000 (02:50 +0100)
committerhgn <hgodden00@gmail.com>
Sun, 9 Jul 2023 01:50:59 +0000 (02:50 +0100)
vg.h
vg_m.h

diff --git a/vg.h b/vg.h
index 5cae23e045981fc934f9083a3e6018c4cd4655fc..132f338275933833d2a0545e6c1dfd3cb5376b9f 100644 (file)
--- a/vg.h
+++ b/vg.h
 |IMP| |        |.------------- vg_start(void) ---------------'
 |   | |        |
 |   | |        v
-|IMP| |   vg_update(void)
+|IMP| |   vg_pre_update(void)
 |   | |        |                                     
 |   | |  .-----+. 
-|   | | |        |
+|   | | |        |   called 0x to 8x
 |   | | |        v
-|IMP| |  '- vg_update_fixed(void)
+|IMP| |  '- vg_fixed_update(void)
 |   | |          |
 |   | |       .-'
 |   | |      |
 |   | |      v
-|IMP| |   vg_update_post(void)
+|IMP| |   vg_post_update(void)
 |   | |      |
 |   | |      v
 |IMP| |   vg_render(void)
@@ -89,9 +89,9 @@ VG_STATIC void vg_launch_opt(void);
 VG_STATIC void vg_start(void);
 
 VG_STATIC void vg_framebuffer_resize(int w, int h);
-VG_STATIC void vg_update(void);
-VG_STATIC void vg_update_fixed(void);
-VG_STATIC void vg_update_post(void);
+VG_STATIC void vg_pre_update(void);
+VG_STATIC void vg_fixed_update(void);
+VG_STATIC void vg_post_update(void);
 
 VG_STATIC void vg_render(void);
 VG_STATIC void vg_gui(void);
@@ -391,7 +391,7 @@ VG_STATIC void _vg_gameloop_update(void)
    vg_profile_begin( &vg_prof_update );
 
    vg.engine_stage = k_engine_stage_update;
-   vg_update();
+   vg_pre_update();
 
    /* Fixed update loop */
    vg.engine_stage = k_engine_stage_update_fixed;
@@ -401,11 +401,9 @@ VG_STATIC void _vg_gameloop_update(void)
    vg.time_fixed_accumulator += vg.time_delta;
 
    while( vg.time_fixed_accumulator >= VG_TIMESTEP_FIXED ){
-      vg_update_fixed();
+      vg_fixed_update();
       vg_lines.allow_input = 0;
-
       vg.time_fixed_accumulator -= VG_TIMESTEP_FIXED;
-      //vg.accumulator  = VG_MAX( 0.0, vg.accumulator );
 
       vg.fixed_iterations ++;
       if( vg.fixed_iterations == 8 ){
@@ -416,7 +414,7 @@ VG_STATIC void _vg_gameloop_update(void)
    vg.time_fixed_extrapolate = vg.time_fixed_accumulator / VG_TIMESTEP_FIXED;
 
    vg.engine_stage = k_engine_stage_update;
-   vg_update_post();
+   vg_post_update();
    vg_profile_end( &vg_prof_update );
 }
 
diff --git a/vg_m.h b/vg_m.h
index c48f13e40ee510399008ae9cfb168b61258db45b..0ded4e127302bfd0d396f14416c12710eeb3fb84 100644 (file)
--- a/vg_m.h
+++ b/vg_m.h
@@ -403,17 +403,22 @@ static inline f32 vg_lerpf( f32 a, f32 b, f32 t ){
    return a + t*(b-a);
 }
 
+static inline f64 vg_lerp( f64 a, f64 b, f64 t )
+{
+   return a + t*(b-a);
+}
+
 static inline void vg_slewf( f32 *a, f32 b, f32 speed ){
    f32 d = vg_signf( b-*a ),
        c = *a + d*speed;
    *a = vg_minf( b*d, c*d ) * d;
 }
 
-static inline f64 vg_lerp( f64 a, f64 b, f64 t )
-{
-   return a + t*(b-a);
+static inline f32 vg_smoothstepf( f32 x ){
+   return x*x*(3.0f - 2.0f*x);
 }
 
+
 /* correctly lerp around circular period -pi -> pi */
 static f32 vg_alerpf( f32 a, f32 b, f32 t )
 {