babylon.lensFlare.js 894 B

123456789101112131415161718192021222324252627282930
  1. var BABYLON = BABYLON || {};
  2. (function () {
  3. BABYLON.LensFlare = function (size, position, color, imgUrl, system) {
  4. this.color = color || new BABYLON.Color3(1, 1, 1);
  5. this.position = position;
  6. this.size = size;
  7. this.texture = imgUrl ? new BABYLON.Texture(imgUrl, system.getScene(), true) : null;
  8. this._system = system;
  9. system.lensFlares.push(this);
  10. };
  11. // Properties
  12. BABYLON.LensFlare.prototype.position = 0;
  13. BABYLON.LensFlare.prototype.size = 1.0;
  14. BABYLON.LensFlare.prototype.texture = null;
  15. // Methods
  16. BABYLON.LensFlare.prototype.dispose = function() {
  17. if (this.texture) {
  18. this.texture.dispose();
  19. }
  20. // Remove from scene
  21. var index = this._system.lensFlares.indexOf(this);
  22. this._system.lensFlares.splice(index, 1);
  23. };
  24. })();