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

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.

主站蜘蛛池模板: 兰考县| 长白| 五常市| 上蔡县| 内丘县| 黄平县| 门源| 温州市| 周宁县| 济宁市| 从江县| 建德市| 乡宁县| 当涂县| 奉新县| 永胜县| 含山县| 封丘县| 仪陇县| 当雄县| 娱乐| 鸡东县| 沂南县| 江陵县| 子长县| 英吉沙县| 弥勒县| 逊克县| 宁安市| 巴彦县| 屯留县| 垣曲县| 彭山县| 桐柏县| 寿阳县| 霍城县| 白银市| 永善县| 栾川县| 霸州市| 凤凰县|