m4x3_expand_aabb_point( m, box, (v3f){ b[0], b[1], b[2] } );
}
+static inline void m4x3_lookat( m4x3f m, v3f pos, v3f target, v3f up )
+{
+ v3f dir;
+ v3_sub( target, pos, dir );
+ v3_normalize( dir );
+
+ v3_negate( dir, m[2] );
+
+ v3_cross( up, m[2], m[0] );
+ v3_normalize( m[0] );
+
+ v3_cross( m[2], m[0], m[1] );
+ v3_copy( pos, m[3] );
+}
+
/*
* Matrix 4x4
*/
v4_copy( t, d );
}
+static inline void q_normalize( v4f q )
+{
+ float s = 1.0f/ sqrtf(v4_dot(q,q));
+ q[0] *= s;
+ q[1] *= s;
+ q[2] *= s;
+ q[3] *= s;
+}
+
static inline void q_inv( v4f q, v4f d )
{
float s = 1.0f / v4_dot(q,q);
l = v4_length(q),
s = l > 0.0f? 2.0f/l: 0.0f,
- xx = s*q[0]*q[0], xy = s*q[0]*q[2], wx = s*q[3]*q[0],
+ xx = s*q[0]*q[0], xy = s*q[0]*q[1], wx = s*q[3]*q[0],
yy = s*q[1]*q[1], yz = s*q[1]*q[2], wy = s*q[3]*q[1],
- zz = s*q[2]*q[2], xz = s*q[2]*q[2], wz = s*q[3]*q[2];
+ zz = s*q[2]*q[2], xz = s*q[0]*q[2], wz = s*q[3]*q[2];
d[0][0] = 1.0f - yy - zz;
d[1][1] = 1.0f - xx - zz;
target_platform_include=""
if [ $opt_release = true ]; then
- target_opts="-O3"
+ target_opts="-O3 -DVG_RELEASE"
else
target_opts="-ggdb3"
fi
target_os_linux(){
target_ext=""
- target_compiler="gcc"
+ target_compiler="clang"
target_libs="-lGL -lglfw3 -lX11 -lXxf86vm -lXrandr -lm -pthread -lXi -ldl"
target_libs_steam="-lsteam_api"
#target_platform_include="-include $vg_root/platformutils/force_link_glibc_2.23.h"
target_steam_api="libsteam_api.so"
target_miniaudio="$vg_root/dep/dr_soft/miniaudio_linux.o"
if [ $opt_release = true ]; then
- target_opts="-O3"
+ target_opts="-O3 -DVG_RELEASE"
else
- target_opts="-O1 -fsanitize=address -ggdb3 -fno-omit-frame-pointer"
+ target_opts="-O0 -fsanitize=address -ggdb3 -fno-omit-frame-pointer"
fi
}
fi
sources="$1"
output="-o $2"
- cmd="$target_compiler -D_REENTRANT $target_standard $target_opts $target_platform_include
+ cmd="$target_compiler $target_standard $target_opts $target_platform_include
-c $sources
$output"
steam_part="$opt_steam $target_libs_steam"
fi
- warnings="-Wall -Wstrict-aliasing=3 -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable"
+ warnings="-Wall -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable"
sources="$1 $vg_root/dep/glad/glad.c $target_miniaudio"
output="-o $2$target_ext"