lingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
77 lines • 2.24 kB
JavaScript
import { RectAreaLight } from "three";
import { areaLightDefaults, areaLightSchema } from "../../interface/IAreaLight";
import { lazy } from "@lincode/utils";
import Plane from "../primitives/Plane";
import { addAreaLightTransformEditSystem } from "../../systems/eventSystems/areaLightTransformEditSystem";
import { areaLightIntensitySystem } from "../../systems/areaLightIntensitySystem";
import { configAreaLightSystem } from "../../systems/configSystems/configAreaLightSystem";
const lazyInit = lazy(async () => {
const { RectAreaLightUniformsLib } = await import("three/examples/jsm/lights/RectAreaLightUniformsLib");
RectAreaLightUniformsLib.init();
});
class AreaLight extends Plane {
static componentName = "areaLight";
static defaults = areaLightDefaults;
static schema = areaLightSchema;
$light;
constructor() {
super();
this.emissive = true;
lazyInit().then(() => {
if (this.done)
return;
const light = (this.$light = new RectAreaLight());
this.outerObject3d.add(light);
this.then(() => light.dispose());
configAreaLightSystem.add(this);
});
addAreaLightTransformEditSystem(this);
areaLightIntensitySystem.add(this);
}
get color() {
return super.color;
}
set color(val) {
super.color = val;
configAreaLightSystem.add(this);
}
intensity = 1;
get width() {
return super.width;
}
set width(val) {
super.width = val;
configAreaLightSystem.add(this);
}
get height() {
return super.height;
}
set height(val) {
super.height = val;
configAreaLightSystem.add(this);
}
get scaleX() {
return super.scaleX;
}
set scaleX(val) {
super.scaleX = val;
configAreaLightSystem.add(this);
}
get scaleY() {
return super.scaleY;
}
set scaleY(val) {
super.scaleY = val;
configAreaLightSystem.add(this);
}
get depth() {
return 0;
}
set depth(_) { }
get scaleZ() {
return 0;
}
set scaleZ(_) { }
}
export default AreaLight;
//# sourceMappingURL=AreaLight.js.map