babylon.cubeTexture.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. }
  27. else {
  28. this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
  29. }
  30. }
  31. this.isCube = true;
  32. this._textureMatrix = BABYLON.Matrix.Identity();
  33. }
  34. CubeTexture.prototype.clone = function () {
  35. var newTexture = new CubeTexture(this.url, this.getScene(), this._extensions, this._noMipmap);
  36. // Base texture
  37. newTexture.level = this.level;
  38. newTexture.wrapU = this.wrapU;
  39. newTexture.wrapV = this.wrapV;
  40. newTexture.coordinatesIndex = this.coordinatesIndex;
  41. newTexture.coordinatesMode = this.coordinatesMode;
  42. return newTexture;
  43. };
  44. // Methods
  45. CubeTexture.prototype.delayLoad = function () {
  46. if (this.delayLoadState !== BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
  47. return;
  48. }
  49. this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
  50. this._texture = this._getFromCache(this.url, this._noMipmap);
  51. if (!this._texture) {
  52. this._texture = this.getScene().getEngine().createCubeTexture(this.url, this.getScene(), this._extensions);
  53. }
  54. };
  55. CubeTexture.prototype.getReflectionTextureMatrix = function () {
  56. return this._textureMatrix;
  57. };
  58. return CubeTexture;
  59. })(BABYLON.BaseTexture);
  60. BABYLON.CubeTexture = CubeTexture;
  61. })(BABYLON || (BABYLON = {}));
  62. //# sourceMappingURL=babylon.cubeTexture.js.map