annotate libs/vmath/basis_c.c @ 35:23e5d274b2a2
added options panel, also added the xib files to the repository as they're needed
author |
John Tsiombikas <nuclear@member.fsf.org> |
date |
Fri, 09 Sep 2011 10:03:42 +0300 |
parents |
|
children |
ff055bff6a15 |
rev |
line source |
nuclear@28
|
1 #include "basis.h"
|
nuclear@28
|
2 #include "matrix.h"
|
nuclear@28
|
3
|
nuclear@28
|
4 void basis_matrix(mat4_t res, vec3_t i, vec3_t j, vec3_t k)
|
nuclear@28
|
5 {
|
nuclear@28
|
6 m4_identity(res);
|
nuclear@28
|
7 m4_set_column(res, v4_cons(i.x, i.y, i.z, 1.0), 0);
|
nuclear@28
|
8 m4_set_column(res, v4_cons(j.x, j.y, j.z, 1.0), 1);
|
nuclear@28
|
9 m4_set_column(res, v4_cons(k.x, k.y, k.z, 1.0), 2);
|
nuclear@28
|
10 }
|
nuclear@28
|
11
|
nuclear@28
|
12 void basis_matrix_dir(mat4_t res, vec3_t dir)
|
nuclear@28
|
13 {
|
nuclear@28
|
14 vec3_t k = v3_normalize(dir);
|
nuclear@28
|
15 vec3_t j = {0, 1, 0};
|
nuclear@28
|
16 vec3_t i = v3_cross(j, k);
|
nuclear@28
|
17 j = v3_cross(k, i);
|
nuclear@28
|
18 basis_matrix(res, i, j, k);
|
nuclear@28
|
19 }
|