# Code coverage report for src/light/Sphere.js

# all files / src/light/ Sphere.js

14.29% Statements 1/7
100% Branches 0/0
0% Functions 0/4
14.29% Lines 1/7

    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

    1×

     import Light from '../Light';

    /**
     * @constructor clay.light.Sphere
     * @extends {clay.Light}
     */
    var SphereLight = Light.extend(
    /** @lends clay.light.Sphere# */
    {
        /**
         * @type {number}
         */
        range: 100,

        /**
         * @type {number}
         */
        radius: 5
    }, {

        type: 'SPHERE_LIGHT',

        uniformTemplates: {
            sphereLightPosition: {
                type: '3f',
                value: function(instance) {
                    return instance.getWorldPosition().array;
                }
            },
            sphereLightRange: {
                type: '1f',
                value: function(instance) {
                    return instance.range;
                }
            },
            sphereLightRadius: {
                type: '1f',
                value: function(instance) {
                    return instance.radius;
                }
            },
            sphereLightColor: {
                type: '3f',
                value: function(instance) {
                    var color = instance.color;
                    var intensity = instance.intensity;
                    return [color[0]*intensity, color[1]*intensity, color[2]*intensity];
                }
            }
        }
    });

    export default SphereLight;