70 lines
1.8 KiB
JavaScript
70 lines
1.8 KiB
JavaScript
/**
|
|
* R3.D3.API.Light.Point
|
|
* @param apiComponent
|
|
*
|
|
* @property position
|
|
* @property decay - in physically correct mode, decay is 2
|
|
* @property distance
|
|
* @property power
|
|
* @property castShadow
|
|
* @property shadow
|
|
*
|
|
* @constructor
|
|
*/
|
|
R3.D3.API.Light.Point = function(
|
|
apiComponent
|
|
) {
|
|
|
|
R3.D3.API.Light.call(
|
|
this,
|
|
apiComponent
|
|
);
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.position)) {
|
|
apiComponent.position = new R3.API.Vector3(
|
|
{
|
|
parent : this,
|
|
register : true,
|
|
x : 0,
|
|
y : 1,
|
|
z : 0
|
|
}
|
|
);
|
|
}
|
|
this.position = apiComponent.position;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.decay)) {
|
|
apiComponent.decay = 1;
|
|
}
|
|
this.decay = apiComponent.decay;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.distance)) {
|
|
apiComponent.distance = 0;
|
|
}
|
|
this.distance = apiComponent.distance;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.power)) {
|
|
apiComponent.power = 4 * Math.PI;
|
|
}
|
|
this.power = apiComponent.power;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.castShadow)) {
|
|
apiComponent.castShadow = false;
|
|
}
|
|
this.castShadow = apiComponent.castShadow;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.shadow)) {
|
|
/**
|
|
* Do not create shadow components until runtime - at runtime we also
|
|
* need to know whether or not the shadow info came from API or, in
|
|
* this case, was created during runtime (by setting it to null)
|
|
*/
|
|
apiComponent.shadow = null;
|
|
}
|
|
this.shadow = apiComponent.shadow;
|
|
|
|
};
|
|
|
|
R3.D3.API.Light.Point.prototype = Object.create(R3.D3.API.Light.prototype);
|
|
R3.D3.API.Light.Point.prototype.constructor = R3.D3.API.Light.Point;
|