first commit

This commit is contained in:
2026-06-24 09:48:54 +02:00
commit 41e62ddcad
33739 changed files with 4266226 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
import { Light } from './Light.js';
class RectAreaLight extends Light {
constructor( color, intensity, width = 10, height = 10 ) {
super( color, intensity );
this.isRectAreaLight = true;
this.type = 'RectAreaLight';
this.width = width;
this.height = height;
}
get power() {
// compute the light's luminous power (in lumens) from its intensity (in nits)
return this.intensity * this.width * this.height * Math.PI;
}
set power( power ) {
// set the light's intensity (in nits) from the desired luminous power (in lumens)
this.intensity = power / ( this.width * this.height * Math.PI );
}
copy( source ) {
super.copy( source );
this.width = source.width;
this.height = source.height;
return this;
}
toJSON( meta ) {
const data = super.toJSON( meta );
data.object.width = this.width;
data.object.height = this.height;
return data;
}
}
export { RectAreaLight };