istereo
view libs/vmath/ray_c.c @ 36:834503dcb486
fixed the rotated gui problem
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 09 Sep 2011 10:25:03 +0300 |
parents | |
children | ff055bff6a15 |
line source
1 #include "ray.h"
2 #include "vector.h"
4 ray_t ray_transform(ray_t r, mat4_t xform)
5 {
6 mat4_t upper;
7 vec3_t dir;
9 m4_copy(upper, xform);
10 upper[0][3] = upper[1][3] = upper[2][3] = upper[3][0] = upper[3][1] = upper[3][2] = 0.0;
11 upper[3][3] = 1.0;
13 dir = v3_sub(r.dir, r.origin);
14 dir = v3_transform(dir, upper);
15 r.origin = v3_transform(r.origin, xform);
16 r.dir = v3_add(dir, r.origin);
17 return r;
18 }