官术网_书友最值得收藏!

Orthographic

An orthographic projection has no perspective to it. An orthographic projection maps linearly to NDC space. Orthographic projections are often used for two-dimensional games. It's often used to achieve an isometric perspective.

Implement the ortho function in mat4.cpp. Don't forget to add the function declaration to mat4.h:

mat4 ortho(float l, float r, float b, float t,

           float n, float f) {

    if (l == r || t == b || n == f) {

        return mat4(); // Error

    }

    return mat4(

        2.0f / (r - l), 0, 0, 0,

        0, 2.0f / (t - b), 0, 0,

        0, 0, -2.0f / (f - n), 0,

        -((r+l)/(r-l)),-((t+b)/(t-b)),-((f+n)/(f-n)), 1

    );

}

Orthographic view projections are generally useful for displaying UI or other two-dimensional elements.

主站蜘蛛池模板: 阿尔山市| 灌阳县| 定陶县| 沐川县| 峨眉山市| 微山县| 红桥区| 天峨县| 泰宁县| 枣强县| 阆中市| 扬中市| 鹤山市| 阳高县| 高州市| 黄龙县| 舞阳县| 卢龙县| 鹤峰县| 西安市| 甘孜| 依安县| 漳平市| 崇州市| 安顺市| 会宁县| 巨野县| 右玉县| 辽中县| 庄河市| 西贡区| 阿勒泰市| 富民县| 双桥区| 神农架林区| 资兴市| 无锡市| 余江县| 丰台区| 汕头市| 海伦市|