template <typename type>
inline mat4<type> mat4<type>::perspectiveProjection(type fovy, type aspect, type zNear, type zFar)
{
type f = (type) / tan(radians(fovy) / );
return mat4<type>(f / aspect, , , ,
, f, , ,
, , (zFar + zNear) / (zNear - zFar), (*zFar*zNear) / (zNear - zFar),
, , -, );
} template <typename type>
inline mat4<type> mat4<type>::orthoProjection(type xRight, type xLeft, type yTop, type yBottom, type zNear, type zFar)
{
type tx, ty, tz;
tx = - (xRight + xLeft) / (xRight - xLeft);
ty = - (yTop + yBottom) / (yTop - yBottom);
tz = - (zFar + zNear) / (zFar - zNear);
return mat4<type>( / (xRight - xLeft), , , tx,
, / (yTop - yBottom), , ty,
, , - / (zFar - zNear), tz,
, , , );
}
05-11 10:54