photoDome.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { Texture } from "../Materials/Textures/texture.js";
  2. import { TextureDome } from "./textureDome.js";
  3. /**
  4. * Display a 360 degree photo on an approximately spherical surface, useful for VR applications or skyboxes.
  5. * As a subclass of TransformNode, this allow parenting to the camera with different locations in the scene.
  6. * This class achieves its effect with a Texture and a correctly configured BackgroundMaterial on an inverted sphere.
  7. * Potential additions to this helper include zoom and and non-infinite distance rendering effects.
  8. */
  9. export class PhotoDome extends TextureDome {
  10. /**
  11. * Gets or sets the texture being displayed on the sphere
  12. */
  13. get photoTexture() {
  14. return this.texture;
  15. }
  16. /**
  17. * sets the texture being displayed on the sphere
  18. */
  19. set photoTexture(value) {
  20. this.texture = value;
  21. }
  22. /**
  23. * Gets the current video mode for the video. It can be:
  24. * * TextureDome.MODE_MONOSCOPIC : Define the texture source as a Monoscopic panoramic 360.
  25. * * TextureDome.MODE_TOPBOTTOM : Define the texture source as a Stereoscopic TopBottom/OverUnder panoramic 360.
  26. * * TextureDome.MODE_SIDEBYSIDE : Define the texture source as a Stereoscopic Side by Side panoramic 360.
  27. */
  28. get imageMode() {
  29. return this.textureMode;
  30. }
  31. /**
  32. * Sets the current video mode for the video. It can be:
  33. * * TextureDome.MODE_MONOSCOPIC : Define the texture source as a Monoscopic panoramic 360.
  34. * * TextureDome.MODE_TOPBOTTOM : Define the texture source as a Stereoscopic TopBottom/OverUnder panoramic 360.
  35. * * TextureDome.MODE_SIDEBYSIDE : Define the texture source as a Stereoscopic Side by Side panoramic 360.
  36. */
  37. set imageMode(value) {
  38. this.textureMode = value;
  39. }
  40. _initTexture(urlsOrElement, scene, options) {
  41. return new Texture(urlsOrElement, scene, !options.generateMipMaps, !this._useDirectMapping, undefined, () => {
  42. this.onLoadObservable.notifyObservers();
  43. }, (message, exception) => {
  44. this.onLoadErrorObservable.notifyObservers(message || "Unknown error occured");
  45. if (this.onError) {
  46. this.onError(message, exception);
  47. }
  48. });
  49. }
  50. }
  51. /**
  52. * Define the image as a Monoscopic panoramic 360 image.
  53. */
  54. PhotoDome.MODE_MONOSCOPIC = TextureDome.MODE_MONOSCOPIC;
  55. /**
  56. * Define the image as a Stereoscopic TopBottom/OverUnder panoramic 360 image.
  57. */
  58. PhotoDome.MODE_TOPBOTTOM = TextureDome.MODE_TOPBOTTOM;
  59. /**
  60. * Define the image as a Stereoscopic Side by Side panoramic 360 image.
  61. */
  62. PhotoDome.MODE_SIDEBYSIDE = TextureDome.MODE_SIDEBYSIDE;
  63. //# sourceMappingURL=photoDome.js.map