Mercurial > hg > Game > Cerium
diff Renderer/Engine/sys.cc @ 677:24054155368c draft
add Load light info for some spe
author | yutaka@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Sun, 06 Dec 2009 07:40:26 +0900 |
parents | 3bc98f6d31ff |
children | f87218eed9fc |
line wrap: on
line diff
--- a/Renderer/Engine/sys.cc Sun Dec 06 01:48:18 2009 +0900 +++ b/Renderer/Engine/sys.cc Sun Dec 06 07:40:26 2009 +0900 @@ -241,3 +241,24 @@ xyz[1] += y; xyz[2] += z; } + +/** + * ベクトルに行列を乗算する + * @param[out] v vector (float[4]) + * @param[in] m matrix (float[16]) + */ +void +ApplyMatrix(float *v, float *m) +{ + float t[4]; + + t[0] = v[0]; + t[1] = v[1]; + t[2] = v[2]; + t[3] = v[3]; + + for (int i = 0; i < 4; i++) { + v[i] = t[0]*m[i] + t[1]*m[i+4] + t[2]*m[i+8] + t[3]*m[i+12]; + } +} +