UNPKG

threepipe

Version:

A 3D viewer framework built on top of three.js in TypeScript with a focus on quality rendering, modularity and extensibility.

84 lines 3.27 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { SpotLight } from 'three'; import { iLightCommons } from '../object/iLightCommons'; import { uiColor, uiInput, uiPanelContainer, uiSlider, uiToggle, uiVector } from 'uiconfig.js'; import { onChange3 } from 'ts-browser-helpers'; let SpotLight2 = class SpotLight2 extends SpotLight { constructor(color, intensity, distance, angle, penumbra, decay) { super(color, intensity, distance, angle, penumbra, decay); this.assetType = 'light'; this.setDirty = iLightCommons.setDirty; this.refreshUi = iLightCommons.refreshUi; this.isSpotLight2 = true; this.target.position.set(0, 0, -1); // because of GLTF spec: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_lights_punctual this.add(this.target); // todo: make sure the child isn't exported in gltf iLightCommons.upgradeLight.call(this); } autoScale() { console.warn('AutoScale not supported on Lights'); return this; } autoCenter() { console.warn('AutoCenter not supported on Lights'); return this; } /** * @deprecated use `this` instead */ get lightObject() { return this; } /** * @deprecated use `this` instead */ get modelObject() { return this; } }; __decorate([ uiToggle('Enabled'), onChange3('setDirty') ], SpotLight2.prototype, "visible", void 0); __decorate([ uiColor('Color', (that) => ({ onChange: () => that.setDirty() })) ], SpotLight2.prototype, "color", void 0); __decorate([ uiSlider('Intensity', [0, 30], 0.01), onChange3('setDirty') ], SpotLight2.prototype, "intensity", void 0); __decorate([ uiSlider('Angle', [0, 2], 0.01), onChange3('setDirty') ], SpotLight2.prototype, "angle", void 0); __decorate([ uiSlider('Penumbra', [0, 0.9999], 0.01), onChange3('setDirty') ], SpotLight2.prototype, "penumbra", void 0); __decorate([ uiInput('Distance'), onChange3('setDirty') ], SpotLight2.prototype, "distance", void 0); __decorate([ uiInput('Decay'), onChange3('setDirty') ], SpotLight2.prototype, "decay", void 0); __decorate([ uiVector('Position', undefined, undefined, (that) => ({ onChange: () => that.setDirty() })) ], SpotLight2.prototype, "position", void 0); __decorate([ uiVector('Rotation', undefined, undefined, (that) => ({ onChange: () => that.setDirty() })) ], SpotLight2.prototype, "rotation", void 0); __decorate([ uiToggle('Cast Shadow'), onChange3('setDirty') ], SpotLight2.prototype, "castShadow", void 0); SpotLight2 = __decorate([ uiPanelContainer('Spot Light') ], SpotLight2); export { SpotLight2 }; //# sourceMappingURL=SpotLight2.js.map