babylon.cubeTexture.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. var __extends = this.__extends || function (d, b) {
  2. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3. function __() { this.constructor = d; }
  4. __.prototype = b.prototype;
  5. d.prototype = new __();
  6. };
  7. var BABYLON;
  8. (function (BABYLON) {
  9. var CubeTexture = (function (_super) {
  10. __extends(CubeTexture, _super);
  11. function CubeTexture(rootUrl, scene, extensions, noMipmap) {
  12. _super.call(this, scene);
  13. this.coordinatesMode = BABYLON.Texture.CUBIC_MODE;
  14. this.name = rootUrl;
  15. this.url = rootUrl;
  16. this._noMipmap = noMipmap;
  17. this.hasAlpha = false;
  18. this._texture = this._getFromCache(rootUrl, noMipmap);
  19. if (!extensions) {
  20. extensions = ["_px.jpg", "_py.jpg", "_pz.jpg", "_nx.jpg", "_ny.jpg", "_nz.jpg"];
  21. }
  22. this._extensions = extensions;
  23. if (!this._texture) {
  24. if (!scene.useDelayedTextureLoading) {
  25. this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, extensions, noMipmap);
  26. } else {
  27. this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
  28. }
  29. }
  30. this.isCube = true;
  31. this._textureMatrix = BABYLON.Matrix.Identity();
  32. }
  33. CubeTexture.prototype.clone = function () {
  34. var newTexture = new BABYLON.CubeTexture(this.url, this.getScene(), this._extensions, this._noMipmap);
  35. // Base texture
  36. newTexture.level = this.level;
  37. newTexture.wrapU = this.wrapU;
  38. newTexture.wrapV = this.wrapV;
  39. newTexture.coordinatesIndex = this.coordinatesIndex;
  40. newTexture.coordinatesMode = this.coordinatesMode;
  41. return newTexture;
  42. };
  43. // Methods
  44. CubeTexture.prototype.delayLoad = function () {
  45. if (this.delayLoadState != BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
  46. return;
  47. }
  48. this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
  49. this._texture = this._getFromCache(this.url, this._noMipmap);
  50. if (!this._texture) {
  51. this._texture = this.getScene().getEngine().createCubeTexture(this.url, this.getScene(), this._extensions);
  52. }
  53. };
  54. CubeTexture.prototype.getReflectionTextureMatrix = function () {
  55. return this._textureMatrix;
  56. };
  57. return CubeTexture;
  58. })(BABYLON.BaseTexture);
  59. BABYLON.CubeTexture = CubeTexture;
  60. })(BABYLON || (BABYLON = {}));
  61. //# sourceMappingURL=babylon.cubeTexture.js.map