babylon.lensFlare.ts 822 B

1234567891011121314151617181920212223242526
  1. module BABYLON {
  2. export class LensFlare {
  3. public color: Color3;
  4. public texture: Texture;
  5. private _system: LensFlareSystem;
  6. constructor(public size: number, public position: number, color, imgUrl: string, system: LensFlareSystem) {
  7. this.color = color || new BABYLON.Color3(1, 1, 1);
  8. this.texture = imgUrl ? new BABYLON.Texture(imgUrl, system.getScene(), true) : null;
  9. this._system = system;
  10. system.lensFlares.push(this);
  11. }
  12. public dispose = function (): void {
  13. if (this.texture) {
  14. this.texture.dispose();
  15. }
  16. // Remove from scene
  17. var index = this._system.lensFlares.indexOf(this);
  18. this._system.lensFlares.splice(index, 1);
  19. };
  20. }
  21. }