float z_range = clip_far-clip_near;
float eye_x = matrix[0]*p.x+matrix[4]*p.y+matrix[8]*p.z+matrix[12]*p.w;
float eye_y = matrix[1]*p.x+matrix[5]*p.y+matrix[9]*p.z+matrix[13]*p.w;
float eye_z = matrix[2]*p.x+matrix[6]*p.y+matrix[10]*p.z+matrix[14]*p.w;
float z_range = clip_far-clip_near;
float eye_x = matrix[0]*p.x+matrix[4]*p.y+matrix[8]*p.z+matrix[12]*p.w;
float eye_y = matrix[1]*p.x+matrix[5]*p.y+matrix[9]*p.z+matrix[13]*p.w;
float eye_z = matrix[2]*p.x+matrix[6]*p.y+matrix[10]*p.z+matrix[14]*p.w;
(clip_far+clip_near)/z_range+2*clip_far*clip_near/(eye_z*z_range));
}
Vector4 Camera::unproject(const Vector4 &p) const
{
(clip_far+clip_near)/z_range+2*clip_far*clip_near/(eye_z*z_range));
}
Vector4 Camera::unproject(const Vector4 &p) const
{
float z_range = clip_far-clip_near;
float z = (2*clip_far*clip_near)/(p.z*z_range-(clip_far+clip_near))-matrix[14]*p.w;
float z_range = clip_far-clip_near;
float z = (2*clip_far*clip_near)/(p.z*z_range-(clip_far+clip_near))-matrix[14]*p.w;
return Vector4(matrix[0]*x+matrix[1]*y+matrix[2]*z,
matrix[4]*x+matrix[5]*y+matrix[6]*z,
return Vector4(matrix[0]*x+matrix[1]*y+matrix[2]*z,
matrix[4]*x+matrix[5]*y+matrix[6]*z,