var Class = require('../../utils/Class'); var Utils = require('../../renderer/webgl/Utils'); var Light = new Class({ initialize: function Light(x, y, radius, r, g, b, intensity){ this._x = x; this._y = y; this._radius = radius; this._r = r; this._g = g; this._b = b; this._intensity = intensity; this._scrollFactorX = 1; this._scrollFactorY = 1; this.dirty = true ; } , set: function (x, y, radius, r, g, b, intensity){ this._x = x; this._y = y; this._radius = radius; this._r = r; this._g = g; this._b = b; this._intensity = intensity; this._scrollFactorX = 1; this._scrollFactorY = 1; this.dirty = true ; return this; } , setScrollFactor: function (x, y){ if (x === undefined) { x = 1; } if (y === undefined) { y = x; } this._scrollFactorX = x; this._scrollFactorY = y; this.dirty = true ; return this; } , setColor: function (rgb){ var color = Utils.getFloatsFromUintRGB(rgb); this._r = color[0]; this._g = color[1]; this._b = color[2]; this.dirty = true ; return this; } , setIntensity: function (intensity){ this._intensity = intensity; this.dirty = true ; return this; } , setPosition: function (x, y){ this._x = x; this._y = y; this.dirty = true ; return this; } , setRadius: function (radius){ this._radius = radius; this.dirty = true ; return this; } , x: { get: function (){ return this._x; } , set: function (value){ this._x = value; this.dirty = true ; } } , y: { get: function (){ return this._y; } , set: function (value){ this._y = value; this.dirty = true ; } } , radius: { get: function (){ return this._radius; } , set: function (value){ this._radius = value; this.dirty = true ; } } , r: { get: function (){ return this._r; } , set: function (value){ this._r = value; this.dirty = true ; } } , g: { get: function (){ return this._g; } , set: function (value){ this._g = value; this.dirty = true ; } } , b: { get: function (){ return this._b; } , set: function (value){ this._b = value; this.dirty = true ; } } , intensity: { get: function (){ return this._intensity; } , set: function (value){ this._intensity = value; this.dirty = true ; } } , scrollFactorX: { get: function (){ return this._scrollFactorX; } , set: function (value){ this._scrollFactorX = value; this.dirty = true ; } } , scrollFactorY: { get: function (){ return this._scrollFactorY; } , set: function (value){ this._scrollFactorY = value; this.dirty = true ; } } } ); module.exports = Light;