|
|
发表于 2005-11-23 13:34:00
|
显示全部楼层
Re:请教gluLookAt的变换矩阵构造方法
// vec3_type: 三元组
// 右手坐标系
void makeLookAt(const vec3_type& vEye, const vec3_type& vCenter, vec3_type u)
{
u.normalize3();
vec3_type n = (vCenter-vEye).normalize3();
vec3_type r = n ^ u; u = r ^ n;
set(r.x, r.y, r.z, -(vEye * r),
u.x, u.y, u.z, -(vEye * u),
-n.x, -n.y, -n.z, vEye * n,
0, 0, 0, 1);
}
|
|