babylon.cubeTexture.js 1.5 KB

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