First attempt at adding John Tsiombikas' spaceball support for X11. It compiles...
[freeglut] / progs / demos / spaceball / vmath.c
diff --git a/progs/demos/spaceball/vmath.c b/progs/demos/spaceball/vmath.c
new file mode 100644 (file)
index 0000000..f4eb50f
--- /dev/null
@@ -0,0 +1,16 @@
+#include <math.h>\r
+#include "vmath.h"\r
+\r
+quat_t quat_rotate(quat_t q, float angle, float x, float y, float z)\r
+{\r
+       quat_t rq;\r
+       float half_angle = angle * 0.5;\r
+       float sin_half = sin(half_angle);\r
+\r
+       rq.w = cos(half_angle);\r
+       rq.x = x * sin_half;\r
+       rq.y = y * sin_half;\r
+       rq.z = z * sin_half;\r
+\r
+       return quat_mul(q, rq);\r
+}\r