You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a problem in vmath.h:1060.
template
static inline Tmat4 lookat(const vecN<T,3>& eye, const vecN<T,3>& center, const vecN<T,3>& up)
{
const Tvec3 f = normalize(center - eye);
const Tvec3 upN = normalize(up);
const Tvec3 s = cross(f, upN);
const Tvec3 u = cross(s, f);
const Tmat4 M = Tmat4(Tvec4(s[0], u[0], -f[0], T(0)),
Tvec4(s[1], u[1], -f[1], T(0)),
Tvec4(s[2], u[2], -f[2], T(0)),
Tvec4(T(0), T(0), T(0), T(1)));
return M * translate<T>(-eye);
}
I think we must guarantee that vector s and vector u are normalized, otherwise we cannot ensure matrix M is correct.(And in fact in some cases, M is incorrect).
So I changed them into:
const Tvec3 s = normalize(cross(f, upN));
const Tvec3 u = normalize(cross(s, f));
The text was updated successfully, but these errors were encountered:
There is a problem in vmath.h:1060.
template
static inline Tmat4 lookat(const vecN<T,3>& eye, const vecN<T,3>& center, const vecN<T,3>& up)
{
const Tvec3 f = normalize(center - eye);
const Tvec3 upN = normalize(up);
const Tvec3 s = cross(f, upN);
const Tvec3 u = cross(s, f);
const Tmat4 M = Tmat4(Tvec4(s[0], u[0], -f[0], T(0)),
Tvec4(s[1], u[1], -f[1], T(0)),
Tvec4(s[2], u[2], -f[2], T(0)),
Tvec4(T(0), T(0), T(0), T(1)));
}
I think we must guarantee that vector s and vector u are normalized, otherwise we cannot ensure matrix M is correct.(And in fact in some cases, M is incorrect).
So I changed them into:
const Tvec3 s = normalize(cross(f, upN));
const Tvec3 u = normalize(cross(s, f));
The text was updated successfully, but these errors were encountered: