@openhps/core
Version:
Open Hybrid Positioning System - Core component
59 lines (56 loc) • 1.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.HemisphereLight = void 0;
var _Light = require("./Light.js");
var _Color = require("../math/Color.js");
var _Object3D = require("../core/Object3D.js");
/**
* A light source positioned directly above the scene, with color fading from
* the sky color to the ground color.
*
* This light cannot be used to cast shadows.
*
* ```js
* const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 );
* scene.add( light );
* ```
*
* @augments Light
*/
class HemisphereLight extends _Light.Light {
/**
* Constructs a new hemisphere light.
*
* @param {(number|Color|string)} [skyColor=0xffffff] - The light's sky color.
* @param {(number|Color|string)} [groundColor=0xffffff] - The light's ground color.
* @param {number} [intensity=1] - The light's strength/intensity.
*/
constructor(skyColor, groundColor, intensity) {
super(skyColor, intensity);
/**
* This flag can be used for type testing.
*
* @type {boolean}
* @readonly
* @default true
*/
this.isHemisphereLight = true;
this.type = 'HemisphereLight';
this.position.copy(_Object3D.Object3D.DEFAULT_UP);
this.updateMatrix();
/**
* The light's ground color.
*
* @type {Color}
*/
this.groundColor = new _Color.Color(groundColor);
}
copy(source, recursive) {
super.copy(source, recursive);
this.groundColor.copy(source.groundColor);
return this;
}
}
exports.HemisphereLight = HemisphereLight;