import { Utils } from '../common/Utils';
import { BaseLight } from './BaseLight';
/**
* AmbientLight - 环境光
*
* 提供基础环境光照,均匀照亮场景中所有物体。
*
* @class AmbientLight
* @memberof THING
* @extends THING.BaseLight
* @public
*
* @example
const light = new THING.AmbientLight({
color: '#ffffff',
intensity: 0.5,
});
*/
class AmbientLight extends BaseLight {
/**
* 环境光 一个场景中通常只能有一个
* @param {object} param The initial parameters.
* @param {number|string|Array<number>} param.color 光的颜色
* @param {number} param.intensity 光的强度
* @constructor
* @public
*/
constructor(param = {}) {
super(param);
}
onBeforeSetup(param) {
param['renderableNode'] = param['renderableNode'] || Utils.createObject('AmbientLight', { app: this.app });
super.onBeforeSetup(param);
}
onBeforeDestroy() {
if (this.app.objectManager.keepAliveObjects.includes(this)) {
return false;
}
if (!super.onBeforeDestroy()) {
return false;
}
return true;
}
// #region Accessor
// #endregion
/**
* Check whether it's AmbientLight type or inherit from it.
* @type {boolean}
* @example
* let point = new THING.AttachedPoint();
* let ret = point.isAttachedPoint;
* // @expect(ret == true);
*/
get isAmbientLight() {
return true;
}
}
export { AmbientLight }