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;
}
* 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;
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