UNPKG

arx-level-generator

Version:
56 lines 1.67 kB
import { ArxLightFlags } from 'arx-convert/types'; import { Color } from './Color.js'; import { Vector3 } from './Vector3.js'; import { clone } from './faux-ramda.js'; export class Light { position; color; flags; fallStart; fallEnd; intensity; lightData; constructor(props) { this.position = props.position; this.color = props.color ?? Color.white; this.flags = props.flags ?? ArxLightFlags.None; this.fallStart = props.fallStart ?? 0; this.fallEnd = props.fallEnd ?? 100; this.intensity = props.intensity ?? 1; this.lightData = props.lightData; } clone() { return new Light({ position: this.position.clone(), color: this.color.clone(), flags: this.flags, fallStart: this.fallStart, fallEnd: this.fallEnd, intensity: this.intensity, lightData: clone(this.lightData), }); } static fromArxLight({ pos, color, flags, fallStart, fallEnd, intensity, ...lightData }) { return new Light({ position: Vector3.fromArxVector3(pos), color: Color.fromArxColor(color), flags, fallStart, fallEnd, intensity, lightData, }); } toArxLight() { return { ...this.lightData, pos: this.position.toArxVector3(), color: this.color.toArxColor(), flags: this.flags, fallStart: this.fallStart, fallEnd: this.fallEnd, intensity: this.intensity, }; } } //# sourceMappingURL=Light.js.map