Nothing
authorhgn <hgodden00@gmail.com>
Thu, 1 May 2025 17:32:45 +0000 (18:32 +0100)
committerhgn <hgodden00@gmail.com>
Thu, 1 May 2025 17:32:45 +0000 (18:32 +0100)
vg_input.c
vg_m.h

index 3a1aa2774a9bce1a8085d1586d22663c621edf19..581ea3a1d2a46ff0783feef30e80e8dd2b4aec7d 100644 (file)
@@ -317,15 +317,17 @@ f32 vg_controller_axis( SDL_GameControllerAxis axis )
    else return 0;
 }
 
-static void vg_input_apply_to_u8( vg_input_op mode, u8 data, u8 *inout_result ){
+static void vg_input_apply_to_u8( vg_input_op mode, u8 data, u8 *inout_result )
+{
    if     ( mode == vg_mode_absmax )  *inout_result |= data;
    else if( mode == vg_mode_mul )     *inout_result &= data;
    else vg_fatal_error( "mode not supported for destination type (%d)", mode );
 }
 
-static void vg_input_apply_to_f32( vg_input_op mode, f32 data, 
-                                   f32 *inout_result ){
-   if     ( mode == vg_mode_absmax ){
+static void vg_input_apply_to_f32( vg_input_op mode, f32 data, f32 *inout_result )
+{
+   if( mode == vg_mode_absmax )
+   {
       if( fabsf(data) > fabsf(*inout_result) )
          *inout_result = data;
    }
@@ -340,20 +342,23 @@ static void vg_input_apply_to_f32( vg_input_op mode, f32 data,
  * Run an input program. out_result must point to memory with sufficient
  * storage respective to the size set by type.
  */
-void vg_exec_input_program( enum vg_input_type type, vg_input_op *ops, 
-                            void *out_result ){
+void vg_exec_input_program( enum vg_input_type type, vg_input_op *ops, void *out_result )
+{
    u8 *out_button = NULL;
    f32 *out_joy = NULL;
 
-   if( type == k_vg_input_type_button_u8 ){
+   if( type == k_vg_input_type_button_u8 )
+   {
       out_button = out_result;
       *out_button = 0;
    }
-   else if( type == k_vg_input_type_axis_f32 ){
+   else if( type == k_vg_input_type_axis_f32 )
+   {
       out_joy = out_result;
       out_joy[0] = 0.0f;
    }
-   else if( type == k_vg_input_type_joy_v2f ){
+   else if( type == k_vg_input_type_joy_v2f )
+   {
       out_joy = out_result;
       out_joy[0] = 0.0f;
       out_joy[1] = 0.0f;
diff --git a/vg_m.h b/vg_m.h
index d7454019193ac9efdd172f757815557758db8287..d582bf0fd0b805e0c657b20aa6f2b783da6ac1a2 100644 (file)
--- a/vg_m.h
+++ b/vg_m.h
@@ -753,6 +753,11 @@ static f32 q_dist( v4f q0, v4f q1 ){
    return acosf( 2.0f * v4_dot(q0,q1) -1.0f );
 }
 
+static inline void q_copy( v4f a, v4f b )
+{
+   b[0] = a[0]; b[1] = a[1]; b[2] = a[2]; b[3] = a[3];
+}
+
 /*
  * -----------------------------------------------------------------------------
  * Section 4.a                  2x2 matrices