# Code coverage report for src/camera/Orthographic.js

# all files / src/camera/ Orthographic.js

100% Statements 17/17
100% Branches 0/0
100% Functions 3/3
100% Lines 17/17

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67

    1×

    10×

    1×
    1×
    1×
    1×
    1×
    1×
    1×

    1×
    1×
    1×
    1×
    1×
    1×
    1×

    1×

     import Camera from '../Camera';
    /**
     * @constructor clay.camera.Orthographic
     * @extends clay.Camera
     */
    var Orthographic = Camera.extend(
    /** @lends clay.camera.Orthographic# */
    {
        /**
         * @type {number}
         */
        left: -1,
        /**
         * @type {number}
         */
        right: 1,
        /**
         * @type {number}
         */
        near: -1,
        /**
         * @type {number}
         */
        far: 1,
        /**
         * @type {number}
         */
        top: 1,
        /**
         * @type {number}
         */
        bottom: -1
    },
    /** @lends clay.camera.Orthographic.prototype */
    {

        updateProjectionMatrix: function() {
            this.projectionMatrix.ortho(this.left, this.right, this.bottom, this.top, this.near, this.far);
        },

        decomposeProjectionMatrix: function () {
            var m = this.projectionMatrix.array;
            this.left = (-1 - m[12]) / m[0];
            this.right = (1 - m[12]) / m[0];
            this.top = (1 - m[13]) / m[5];
            this.bottom = (-1 - m[13]) / m[5];
            this.near = -(-1 - m[14]) / m[10];
            this.far = -(1 - m[14]) / m[10];
        },
        /**
         * @return {clay.camera.Orthographic}
         */
        clone: function() {
            var camera = Camera.prototype.clone.call(this);
            camera.left = this.left;
            camera.right = this.right;
            camera.near = this.near;
            camera.far = this.far;
            camera.top = this.top;
            camera.bottom = this.bottom;

            return camera;
        }
    });

    export default Orthographic;