| 94 | } |
| 95 | |
| 96 | Matrix4f lookAt( |
| 97 | const Vector3f& eye, |
| 98 | const Vector3f& center, |
| 99 | const Vector3f& up ) |
| 100 | { |
| 101 | const sibr::Vector3f f = (center - eye).normalized(); |
| 102 | sibr::Vector3f u = up.normalized(); |
| 103 | const sibr::Vector3f s = f.cross(u).normalized(); |
| 104 | u = s.cross(f); |
| 105 | |
| 106 | Eigen::Matrix<float, 4, 4, 0, 4, 4> res; |
| 107 | res << s.x(),s.y(),s.z(),-s.dot(eye), |
| 108 | u.x(),u.y(),u.z(),-u.dot(eye), |
| 109 | -f.x(),-f.y(),-f.z(),f.dot(eye), |
| 110 | 0,0,0,1; |
| 111 | |
| 112 | return res; |
| 113 | } |
| 114 | |
| 115 | void operator<< (std::ofstream& outfile, const Matrix4f& m) |
| 116 | { |
no outgoing calls
no test coverage detected