r3-legacy/src/game-lib-light.js

92 lines
1.8 KiB
JavaScript
Raw Normal View History

2016-10-14 12:32:53 +02:00
/**
* Light Superset
* @param id
* @param lightType
* @param name
* @param color
* @param intensity
* @param position
* @param targetPosition
* @param quaternion
* @param rotation
* @param scale
* @param distance
* @param decay
* @param power
* @param angle
* @param penumbra
* @constructor
*/
GameLib.D3.Light = function(
id,
lightType,
name,
color,
intensity,
position,
targetPosition,
quaternion,
rotation,
scale,
distance,
decay,
power,
angle,
penumbra
) {
2016-11-14 14:48:37 +01:00
this.id = GameLib.D3.Tools.RandomId();
2016-10-14 12:32:53 +02:00
this.lightType = lightType;
this.name = name;
this.color = color;
this.intensity = intensity;
if (typeof position == 'undefined') {
position = new GameLib.D3.Vector3(0,0,0);
}
this.position = position;
if (typeof targetPosition == 'undefined') {
targetPosition = new GameLib.D3.Vector3(0,0,0);
}
this.targetPosition = targetPosition;
if (typeof quaternion == 'undefined'){
quaternion = new GameLib.D3.Vector4();
}
this.quaternion = quaternion;
if (typeof rotation == 'undefined'){
rotation = new GameLib.D3.Vector3(0,0,0);
}
this.rotation = rotation;
if (typeof scale == 'undefined'){
scale = new GameLib.D3.Vector3(1,1,1);
}
this.scale = scale;
if (typeof distance == 'undefined'){
distance = 0;
}
this.distance = distance;
if (typeof decay == 'undefined'){
decay = 1;
}
this.decay = decay;
if (typeof power == 'undefined'){
power = 4 * Math.PI;
}
this.power = power;
if (typeof angle == 'undefined'){
angle = Math.PI / 3;
}
this.angle = angle;
if (typeof penumbra == 'undefined'){
penumbra = 0;
}
this.penumbra = penumbra;
};