rayzor

annotate src/vmath.cc @ 11:fe94d9e986ae

optimized 16bpp swap_buffers
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 10 Apr 2014 08:42:33 +0300
parents 2a5340a6eee4
children d94a69933a71
rev   line source
nuclear@1 1 #include "vmathmat.h"
nuclear@1 2 #include "vmath.h"
nuclear@1 3
nuclear@1 4 void Matrix4x4::lookat(const Vector3 &pos, const Vector3 &targ, const Vector3 &up)
nuclear@1 5 {
nuclear@1 6 Vector3 vk = normalize(targ - pos);
nuclear@1 7 Vector3 vj = normalize(up);
nuclear@1 8 Vector3 vi = normalize(cross(vk, vj));
nuclear@1 9 vj = cross(vi, vk);
nuclear@1 10
nuclear@1 11 Matrix4x4 m(
nuclear@1 12 vi.x, vi.y, vi.z, 0,
nuclear@1 13 vj.x, vj.y, vj.z, 0,
nuclear@1 14 -vk.x, -vk.y, -vk.z, 0,
nuclear@1 15 0, 0, 0, 1);
nuclear@1 16 translate(-pos.x, -pos.y, -pos.z);
nuclear@1 17 *this = *this * m;
nuclear@1 18 }