1 /**
  2  * potree.js 
  3  * http://potree.org
  4  *
  5  * Copyright 2012, Markus Sch�tz
  6  * Licensed under the GPL Version 2 or later.
  7  * - http://potree.org/wp/?page_id=7
  8  * - http://www.gnu.org/licenses/gpl-3.0.html
  9  *
 10  */
 11 
 12 
 13 /**
 14  * @class
 15  */
 16 function LightType() {
 17 }
 18 
 19 /**
 20  * @constant
 21  */
 22 LightType.OMNI = 0;
 23 
 24 /**
 25  * @constant
 26  */
 27 LightType.SPOT = 1;
 28 
 29 /**
 30  * @constant
 31  */
 32 LightType.DIRECTIONAL = 2;
 33 
 34 /**
 35  * 
 36  * @param name
 37  * @param parent
 38  * @class
 39  * @augments SceneNode
 40  */
 41 function Light(name, parent) {
 42 	SceneNode.call(this, name, parent);
 43 	this.type = LightType.OMNI;
 44 	this.colour = [1, 1, 1];
 45 	this.castShadows = false;
 46 }
 47 
 48 Light.prototype = new SceneNode(inheriting);
 49 
 50 Light.prototype.notifyChildAttachedToParent = function() {
 51 	this.scene.lights[this.name] = this;
 52 };
 53 
 54 Object.defineProperty(Light.prototype, "red", {
 55 	get: function(){
 56 		return this.colour[0];
 57 	},
 58 	set: function(value){
 59 		this.colour[0] = value;
 60 	}
 61 });
 62 
 63 Object.defineProperty(Light.prototype, "green", {
 64 	get: function(){
 65 		return this.colour[1];
 66 	},
 67 	set: function(value){
 68 		this.colour[1] = value;
 69 	}
 70 });
 71 
 72 Object.defineProperty(Light.prototype, "blue", {
 73 	get: function(){
 74 		return this.colour[2];
 75 	},
 76 	set: function(value){
 77 		this.colour[2] = value;
 78 	}
 79 });