babylon.cubeTexture.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. // Methods
  34. CubeTexture.prototype.delayLoad = function () {
  35. if (this.delayLoadState != BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
  36. return;
  37. }
  38. this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
  39. this._texture = this._getFromCache(this.url, this._noMipmap);
  40. if (!this._texture) {
  41. this._texture = this.getScene().getEngine().createCubeTexture(this.url, this.getScene(), this._extensions);
  42. }
  43. };
  44. CubeTexture.prototype._computeReflectionTextureMatrix = function () {
  45. return this._textureMatrix;
  46. };
  47. return CubeTexture;
  48. })(BABYLON.BaseTexture);
  49. BABYLON.CubeTexture = CubeTexture;
  50. })(BABYLON || (BABYLON = {}));
  51. //# sourceMappingURL=babylon.cubeTexture.js.map