1 |
- {"ast":null,"code":"import { Texture } from \"../Materials/Textures/texture.js\";\nimport { VideoTexture } from \"../Materials/Textures/videoTexture.js\";\nimport { TextureDome } from \"./textureDome.js\";\nimport { PointerEventTypes } from \"../Events/pointerEvents.js\";\n/**\n * Display a 360/180 degree video on an approximately spherical surface, useful for VR applications or skyboxes.\n * As a subclass of TransformNode, this allow parenting to the camera or multiple videos with different locations in the scene.\n * This class achieves its effect with a VideoTexture and a correctly configured BackgroundMaterial on an inverted sphere.\n * Potential additions to this helper include zoom and and non-infinite distance rendering effects.\n */\nexport class VideoDome extends TextureDome {\n /**\n * Get the video texture associated with this video dome\n */\n get videoTexture() {\n return this._texture;\n }\n /**\n * Get the video mode of this dome\n */\n get videoMode() {\n return this.textureMode;\n }\n /**\n * Set the video mode of this dome.\n * @see textureMode\n */\n set videoMode(value) {\n this.textureMode = value;\n }\n _initTexture(urlsOrElement, scene, options) {\n const tempOptions = {\n loop: options.loop,\n autoPlay: options.autoPlay,\n autoUpdateTexture: true,\n poster: options.poster\n };\n const texture = new VideoTexture((this.name || \"videoDome\") + \"_texture\", urlsOrElement, scene, options.generateMipMaps, this._useDirectMapping, Texture.TRILINEAR_SAMPLINGMODE, tempOptions);\n // optional configuration\n if (options.clickToPlay) {\n this._pointerObserver = scene.onPointerObservable.add(data => {\n var _data$pickInfo;\n ((_data$pickInfo = data.pickInfo) === null || _data$pickInfo === void 0 ? void 0 : _data$pickInfo.pickedMesh) === this.mesh && this._texture.video.play();\n }, PointerEventTypes.POINTERDOWN);\n }\n this._textureObserver = texture.onLoadObservable.add(() => {\n this.onLoadObservable.notifyObservers();\n });\n return texture;\n }\n /**\n * Releases resources associated with this node.\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\n */\n dispose(doNotRecurse, disposeMaterialAndTextures = false) {\n this._texture.onLoadObservable.remove(this._textureObserver);\n this._scene.onPointerObservable.remove(this._pointerObserver);\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n}\n/**\n * Define the video source as a Monoscopic panoramic 360 video.\n */\nVideoDome.MODE_MONOSCOPIC = TextureDome.MODE_MONOSCOPIC;\n/**\n * Define the video source as a Stereoscopic TopBottom/OverUnder panoramic 360 video.\n */\nVideoDome.MODE_TOPBOTTOM = TextureDome.MODE_TOPBOTTOM;\n/**\n * Define the video source as a Stereoscopic Side by Side panoramic 360 video.\n */\nVideoDome.MODE_SIDEBYSIDE = TextureDome.MODE_SIDEBYSIDE;","map":{"version":3,"names":["Texture","VideoTexture","TextureDome","PointerEventTypes","VideoDome","videoTexture","_texture","videoMode","textureMode","value","_initTexture","urlsOrElement","scene","options","tempOptions","loop","autoPlay","autoUpdateTexture","poster","texture","name","generateMipMaps","_useDirectMapping","TRILINEAR_SAMPLINGMODE","clickToPlay","_pointerObserver","onPointerObservable","add","data","_data$pickInfo","pickInfo","pickedMesh","mesh","video","play","POINTERDOWN","_textureObserver","onLoadObservable","notifyObservers","dispose","doNotRecurse","disposeMaterialAndTextures","remove","_scene","MODE_MONOSCOPIC","MODE_TOPBOTTOM","MODE_SIDEBYSIDE"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Helpers/videoDome.js"],"sourcesContent":["import { Texture } from \"../Materials/Textures/texture.js\";\nimport { VideoTexture } from \"../Materials/Textures/videoTexture.js\";\nimport { TextureDome } from \"./textureDome.js\";\nimport { PointerEventTypes } from \"../Events/pointerEvents.js\";\n/**\n * Display a 360/180 degree video on an approximately spherical surface, useful for VR applications or skyboxes.\n * As a subclass of TransformNode, this allow parenting to the camera or multiple videos with different locations in the scene.\n * This class achieves its effect with a VideoTexture and a correctly configured BackgroundMaterial on an inverted sphere.\n * Potential additions to this helper include zoom and and non-infinite distance rendering effects.\n */\nexport class VideoDome extends TextureDome {\n /**\n * Get the video texture associated with this video dome\n */\n get videoTexture() {\n return this._texture;\n }\n /**\n * Get the video mode of this dome\n */\n get videoMode() {\n return this.textureMode;\n }\n /**\n * Set the video mode of this dome.\n * @see textureMode\n */\n set videoMode(value) {\n this.textureMode = value;\n }\n _initTexture(urlsOrElement, scene, options) {\n const tempOptions = { loop: options.loop, autoPlay: options.autoPlay, autoUpdateTexture: true, poster: options.poster };\n const texture = new VideoTexture((this.name || \"videoDome\") + \"_texture\", urlsOrElement, scene, options.generateMipMaps, this._useDirectMapping, Texture.TRILINEAR_SAMPLINGMODE, tempOptions);\n // optional configuration\n if (options.clickToPlay) {\n this._pointerObserver = scene.onPointerObservable.add((data) => {\n data.pickInfo?.pickedMesh === this.mesh && this._texture.video.play();\n }, PointerEventTypes.POINTERDOWN);\n }\n this._textureObserver = texture.onLoadObservable.add(() => {\n this.onLoadObservable.notifyObservers();\n });\n return texture;\n }\n /**\n * Releases resources associated with this node.\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\n */\n dispose(doNotRecurse, disposeMaterialAndTextures = false) {\n this._texture.onLoadObservable.remove(this._textureObserver);\n this._scene.onPointerObservable.remove(this._pointerObserver);\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n}\n/**\n * Define the video source as a Monoscopic panoramic 360 video.\n */\nVideoDome.MODE_MONOSCOPIC = TextureDome.MODE_MONOSCOPIC;\n/**\n * Define the video source as a Stereoscopic TopBottom/OverUnder panoramic 360 video.\n */\nVideoDome.MODE_TOPBOTTOM = TextureDome.MODE_TOPBOTTOM;\n/**\n * Define the video source as a Stereoscopic Side by Side panoramic 360 video.\n */\nVideoDome.MODE_SIDEBYSIDE = TextureDome.MODE_SIDEBYSIDE;\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,YAAY,QAAQ,uCAAuC;AACpE,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,SAASF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