# all files / src/light/ Point.js

66.67% Statements 6/9
100% Branches 0/0
75% Functions 3/4
66.67% Lines 6/9

    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

    1×

    9×

    9×

    9×
    9×
    9×

     import Light from '../Light';

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

        /**
         * @type {number}
         */
        castShadow: false
    }, {

        type: 'POINT_LIGHT',

        uniformTemplates: {
            pointLightPosition: {
                type: '3f',
                value: function(instance) {
                    return instance.getWorldPosition().array;
                }
            },
            pointLightRange: {
                type: '1f',
                value: function(instance) {
                    return instance.range;
                }
            },
            pointLightColor: {
                type: '3f',
                value: function(instance) {
                    var color = instance.color;
                    var intensity = instance.intensity;
                    return [color[0] * intensity, color[1] * intensity, color[2] * intensity];
                }
            }
        },
        /**
         * @return {clay.light.Point}
         * @memberOf clay.light.Point.prototype
         */
        clone: function() {
            var light = Light.prototype.clone.call(this);
            light.range = this.range;
            return light;
        }
    });

    export default PointLight;