babylon.cubeTexture.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. "use strict";
  2. var BABYLON = BABYLON || {};
  3. (function () {
  4. BABYLON.CubeTexture = function (rootUrl, scene) {
  5. this._scene = scene;
  6. this._scene.textures.push(this);
  7. this.name = rootUrl;
  8. this.url = rootUrl;
  9. this.hasAlpha = false;
  10. this.coordinatesMode = BABYLON.Texture.CUBIC_MODE;
  11. this._texture = this._getFromCache(rootUrl);
  12. if (!this._texture) {
  13. if (!scene.useDelayedTextureLoading) {
  14. this._texture = scene.getEngine().createCubeTexture(rootUrl, scene);
  15. } else {
  16. this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
  17. }
  18. }
  19. this.isCube = true;
  20. this._textureMatrix = BABYLON.Matrix.Identity();
  21. };
  22. BABYLON.CubeTexture.prototype = Object.create(BABYLON.BaseTexture.prototype);
  23. // Methods
  24. BABYLON.CubeTexture.prototype.delayLoad = function () {
  25. if (this.delayLoadState != BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
  26. return;
  27. }
  28. this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
  29. this._texture = this._getFromCache(this.url);
  30. if (!this._texture) {
  31. this._texture = this._scene.getEngine().createCubeTexture(this.url, this._scene);
  32. }
  33. };
  34. BABYLON.CubeTexture.prototype._computeReflectionTextureMatrix = function() {
  35. return this._textureMatrix;
  36. };
  37. })();