move explicit bezier to vg
authorhgn <hgodden00@gmail.com>
Fri, 13 Dec 2024 02:37:30 +0000 (02:37 +0000)
committerhgn <hgodden00@gmail.com>
Fri, 13 Dec 2024 02:37:30 +0000 (02:37 +0000)
src/metascene.c

index 40eed04a28c6f7dac84309bde1b9278bd800103b..d8213ed7d1ff95f9a76617dc14e3e5e4edd6d014 100644 (file)
@@ -451,55 +451,6 @@ static bool link_internal_datapath( struct cs_asoc *asoc, const char *datapath,
    return 0;
 }
 
-f32 explicit_bezier( f32 A[2], f32 B[2], f32 C[2], f32 D[2], f32 x )
-{
-   f32 dAxDx = D[0]-A[0],
-       unitBx = (B[0] - A[0]) / dAxDx,
-       unitCx = (C[0] - A[0]) / dAxDx,
-
-       /* cubic coefficients */
-       a =  3.0f*unitBx - 3.0f*unitCx + 1.0f,
-       b = -6.0f*unitBx + 3.0f*unitCx,
-       c =  3.0f*unitBx,
-       d = -(x - A[0]) / dAxDx,
-
-        t0 = 0.0f,
-       Ft0 = d,
-        t1 = 1.0f,
-       Ft1 = a+b+c+d,
-        tc, Ftcx;
-
-   /* Illinois method to find root */
-   for( u32 j=0; j<8; j ++ )
-   {
-      tc = t1 - Ft1*(t1-t0)/(Ft1-Ft0);
-      Ftcx = tc*tc*tc*a + tc*tc*b + tc*c + d;
-
-      if( fabsf(Ftcx) < 0.00001f )
-         break;
-      
-      if( Ft1*Ftcx < 0.0f )
-      {
-         t0 = t1;
-         Ft0 = Ft1;
-      }
-      else
-         Ft0 *= 0.5f;
-
-      t1 = tc;
-      Ft1 = Ftcx;
-   }
-
-   /* Evaluate parametric bezier */
-   f32 t2 = tc*tc,
-       t3 = tc*tc*tc;
-   
-   return  D[1] * t3
-         + C[1] * (-3.0f*t3 + 3.0f*t2)
-         + B[1] * ( 3.0f*t3 - 6.0f*t2 + 3.0f*tc)
-         + A[1] * (-1.0f*t3 + 3.0f*t2 - 3.0f*tc + 1.0f);
-}
-
 ent_camera *_cutscene_active_camera(void)
 {
    return _cutscene.active_camera;