download
raw
926 Bytes
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 };

Xet Storage Details

Size:
926 Bytes
·
Xet hash:
74050924a42a5d9e1f46487cd7bbee58bd0d3fd355fb21f24e15e3567fb5b542

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.