|
@@ -28554,11 +28554,14 @@ _scene__WEBPACK_IMPORTED_MODULE_4__["Scene"].prototype._internalPick = function
|
|
|
else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {
|
|
else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
+ var world = mesh.skeleton && mesh.skeleton.overrideMesh ? mesh.skeleton.overrideMesh.getWorldMatrix() : mesh.getWorldMatrix();
|
|
|
if (mesh.hasThinInstances && mesh.thinInstanceEnablePicking) {
|
|
if (mesh.hasThinInstances && mesh.thinInstanceEnablePicking) {
|
|
|
|
|
+ var tmpMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["TmpVectors"].Matrix[0];
|
|
|
var thinMatrices = mesh.thinInstanceGetWorldMatrices();
|
|
var thinMatrices = mesh.thinInstanceGetWorldMatrices();
|
|
|
for (var index = 0; index < thinMatrices.length; index++) {
|
|
for (var index = 0; index < thinMatrices.length; index++) {
|
|
|
- var world = thinMatrices[index];
|
|
|
|
|
- var result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, world, fastCheck, onlyBoundingInfo, trianglePredicate);
|
|
|
|
|
|
|
+ var thinMatrix = thinMatrices[index];
|
|
|
|
|
+ thinMatrix.multiplyToRef(world, tmpMatrix);
|
|
|
|
|
+ var result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, tmpMatrix, fastCheck, onlyBoundingInfo, trianglePredicate);
|
|
|
if (result) {
|
|
if (result) {
|
|
|
pickingInfo = result;
|
|
pickingInfo = result;
|
|
|
pickingInfo.thinInstanceIndex = index;
|
|
pickingInfo.thinInstanceIndex = index;
|
|
@@ -28569,7 +28572,6 @@ _scene__WEBPACK_IMPORTED_MODULE_4__["Scene"].prototype._internalPick = function
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- var world = mesh.skeleton && mesh.skeleton.overrideMesh ? mesh.skeleton.overrideMesh.getWorldMatrix() : mesh.getWorldMatrix();
|
|
|
|
|
var result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, world, fastCheck, onlyBoundingInfo, trianglePredicate);
|
|
var result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, world, fastCheck, onlyBoundingInfo, trianglePredicate);
|
|
|
if (result) {
|
|
if (result) {
|
|
|
pickingInfo = result;
|
|
pickingInfo = result;
|
|
@@ -28596,11 +28598,14 @@ _scene__WEBPACK_IMPORTED_MODULE_4__["Scene"].prototype._internalMultiPick = func
|
|
|
else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {
|
|
else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
+ var world = mesh.skeleton && mesh.skeleton.overrideMesh ? mesh.skeleton.overrideMesh.getWorldMatrix() : mesh.getWorldMatrix();
|
|
|
if (mesh.hasThinInstances && mesh.thinInstanceEnablePicking) {
|
|
if (mesh.hasThinInstances && mesh.thinInstanceEnablePicking) {
|
|
|
|
|
+ var tmpMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["TmpVectors"].Matrix[0];
|
|
|
var thinMatrices = mesh.thinInstanceGetWorldMatrices();
|
|
var thinMatrices = mesh.thinInstanceGetWorldMatrices();
|
|
|
for (var index = 0; index < thinMatrices.length; index++) {
|
|
for (var index = 0; index < thinMatrices.length; index++) {
|
|
|
- var world = thinMatrices[index];
|
|
|
|
|
- var result = this._internalPickForMesh(null, rayFunction, mesh, world, false, false, trianglePredicate);
|
|
|
|
|
|
|
+ var thinMatrix = thinMatrices[index];
|
|
|
|
|
+ thinMatrix.multiplyToRef(world, tmpMatrix);
|
|
|
|
|
+ var result = this._internalPickForMesh(null, rayFunction, mesh, tmpMatrix, false, false, trianglePredicate);
|
|
|
if (result) {
|
|
if (result) {
|
|
|
result.thinInstanceIndex = index;
|
|
result.thinInstanceIndex = index;
|
|
|
pickingInfos.push(result);
|
|
pickingInfos.push(result);
|
|
@@ -28608,7 +28613,6 @@ _scene__WEBPACK_IMPORTED_MODULE_4__["Scene"].prototype._internalMultiPick = func
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- var world = mesh.skeleton && mesh.skeleton.overrideMesh ? mesh.skeleton.overrideMesh.getWorldMatrix() : mesh.getWorldMatrix();
|
|
|
|
|
var result = this._internalPickForMesh(null, rayFunction, mesh, world, false, false, trianglePredicate);
|
|
var result = this._internalPickForMesh(null, rayFunction, mesh, world, false, false, trianglePredicate);
|
|
|
if (result) {
|
|
if (result) {
|
|
|
pickingInfos.push(result);
|
|
pickingInfos.push(result);
|
|
@@ -50422,18 +50426,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PhotoDome", function() { return PhotoDome; });
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PhotoDome", function() { return PhotoDome; });
|
|
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../node_modules/tslib/tslib.es6.js");
|
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../node_modules/tslib/tslib.es6.js");
|
|
|
-/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Misc/observable */ "./Misc/observable.ts");
|
|
|
|
|
-/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/transformNode */ "./Meshes/transformNode.ts");
|
|
|
|
|
-/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Meshes/mesh */ "./Meshes/mesh.ts");
|
|
|
|
|
-/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/texture */ "./Materials/Textures/texture.ts");
|
|
|
|
|
-/* harmony import */ var _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Background/backgroundMaterial */ "./Materials/Background/backgroundMaterial.ts");
|
|
|
|
|
-/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ "./Meshes/Builders/sphereBuilder.ts");
|
|
|
|
|
-/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Maths/math.vector */ "./Maths/math.vector.ts");
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ "./Materials/Textures/texture.ts");
|
|
|
|
|
+/* harmony import */ var _textureDome__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./textureDome */ "./Helpers/textureDome.ts");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -50445,188 +50439,70 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
*/
|
|
*/
|
|
|
var PhotoDome = /** @class */ (function (_super) {
|
|
var PhotoDome = /** @class */ (function (_super) {
|
|
|
Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(PhotoDome, _super);
|
|
Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(PhotoDome, _super);
|
|
|
- /**
|
|
|
|
|
- * Create an instance of this class and pass through the parameters to the relevant classes, Texture, StandardMaterial, and Mesh.
|
|
|
|
|
- * @param name Element's name, child elements will append suffixes for their own names.
|
|
|
|
|
- * @param urlsOfPhoto defines the url of the photo to display
|
|
|
|
|
- * @param options defines an object containing optional or exposed sub element properties
|
|
|
|
|
- * @param onError defines a callback called when an error occured while loading the texture
|
|
|
|
|
- */
|
|
|
|
|
- function PhotoDome(name, urlOfPhoto, options, scene, onError) {
|
|
|
|
|
- if (onError === void 0) { onError = null; }
|
|
|
|
|
- var _this = _super.call(this, name, scene) || this;
|
|
|
|
|
- _this._useDirectMapping = false;
|
|
|
|
|
- /**
|
|
|
|
|
- * Observable raised when an error occured while loading the 360 image
|
|
|
|
|
- */
|
|
|
|
|
- _this.onLoadErrorObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
|
|
|
|
|
- _this._imageMode = PhotoDome.MODE_MONOSCOPIC;
|
|
|
|
|
- _this._onBeforeCameraRenderObserver = null;
|
|
|
|
|
- // set defaults and manage values
|
|
|
|
|
- name = name || "photoDome";
|
|
|
|
|
- options.resolution = (Math.abs(options.resolution) | 0) || 32;
|
|
|
|
|
- options.size = Math.abs(options.size) || (scene.activeCamera ? scene.activeCamera.maxZ * 0.48 : 1000);
|
|
|
|
|
- if (options.useDirectMapping === undefined) {
|
|
|
|
|
- _this._useDirectMapping = true;
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- _this._useDirectMapping = options.useDirectMapping;
|
|
|
|
|
- }
|
|
|
|
|
- if (options.faceForward === undefined) {
|
|
|
|
|
- options.faceForward = true;
|
|
|
|
|
- }
|
|
|
|
|
- _this._setReady(false);
|
|
|
|
|
- // create
|
|
|
|
|
- var material = _this._material = new _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_5__["BackgroundMaterial"](name + "_material", scene);
|
|
|
|
|
- _this._mesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__["Mesh"].CreateSphere(name + "_mesh", options.resolution, options.size, scene, false, _Meshes_mesh__WEBPACK_IMPORTED_MODULE_3__["Mesh"].BACKSIDE);
|
|
|
|
|
- // configure material
|
|
|
|
|
- material.opacityFresnel = false;
|
|
|
|
|
- material.useEquirectangularFOV = true;
|
|
|
|
|
- material.fovMultiplier = 1.0;
|
|
|
|
|
- _this.photoTexture = new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__["Texture"](urlOfPhoto, scene, true, !_this._useDirectMapping, undefined, undefined, function (message, exception) {
|
|
|
|
|
- _this.onLoadErrorObservable.notifyObservers(message || "Unknown error occured");
|
|
|
|
|
- if (onError) {
|
|
|
|
|
- onError(message, exception);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- _this.photoTexture.anisotropicFilteringLevel = 1;
|
|
|
|
|
- _this.photoTexture.onLoadObservable.addOnce(function () {
|
|
|
|
|
- _this._setReady(true);
|
|
|
|
|
- });
|
|
|
|
|
- // configure mesh
|
|
|
|
|
- _this._mesh.material = material;
|
|
|
|
|
- _this._mesh.parent = _this;
|
|
|
|
|
- // Initial rotation
|
|
|
|
|
- if (options.faceForward && scene.activeCamera) {
|
|
|
|
|
- var camera = scene.activeCamera;
|
|
|
|
|
- var forward = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__["Vector3"].Forward();
|
|
|
|
|
- var direction = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__["Vector3"].TransformNormal(forward, camera.getViewMatrix());
|
|
|
|
|
- direction.normalize();
|
|
|
|
|
- _this.rotation.y = Math.acos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__["Vector3"].Dot(forward, direction));
|
|
|
|
|
- }
|
|
|
|
|
- return _this;
|
|
|
|
|
|
|
+ function PhotoDome() {
|
|
|
|
|
+ return _super !== null && _super.apply(this, arguments) || this;
|
|
|
}
|
|
}
|
|
|
Object.defineProperty(PhotoDome.prototype, "photoTexture", {
|
|
Object.defineProperty(PhotoDome.prototype, "photoTexture", {
|
|
|
/**
|
|
/**
|
|
|
* Gets or sets the texture being displayed on the sphere
|
|
* Gets or sets the texture being displayed on the sphere
|
|
|
*/
|
|
*/
|
|
|
get: function () {
|
|
get: function () {
|
|
|
- return this._photoTexture;
|
|
|
|
|
- },
|
|
|
|
|
- set: function (value) {
|
|
|
|
|
- if (this._photoTexture === value) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- this._photoTexture = value;
|
|
|
|
|
- if (this._useDirectMapping) {
|
|
|
|
|
- this._photoTexture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__["Texture"].CLAMP_ADDRESSMODE;
|
|
|
|
|
- this._photoTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__["Texture"].CLAMP_ADDRESSMODE;
|
|
|
|
|
- this._material.diffuseTexture = this._photoTexture;
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- this._photoTexture.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__["Texture"].FIXED_EQUIRECTANGULAR_MIRRORED_MODE; // matches orientation
|
|
|
|
|
- this._photoTexture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__["Texture"].CLAMP_ADDRESSMODE;
|
|
|
|
|
- this._material.reflectionTexture = this._photoTexture;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- enumerable: false,
|
|
|
|
|
- configurable: true
|
|
|
|
|
- });
|
|
|
|
|
- Object.defineProperty(PhotoDome.prototype, "mesh", {
|
|
|
|
|
- /**
|
|
|
|
|
- * Gets the mesh used for the skybox.
|
|
|
|
|
- */
|
|
|
|
|
- get: function () {
|
|
|
|
|
- return this._mesh;
|
|
|
|
|
|
|
+ return this.texture;
|
|
|
},
|
|
},
|
|
|
- enumerable: false,
|
|
|
|
|
- configurable: true
|
|
|
|
|
- });
|
|
|
|
|
- Object.defineProperty(PhotoDome.prototype, "fovMultiplier", {
|
|
|
|
|
/**
|
|
/**
|
|
|
- * The current fov(field of view) multiplier, 0.0 - 2.0. Defaults to 1.0. Lower values "zoom in" and higher values "zoom out".
|
|
|
|
|
- * Also see the options.resolution property.
|
|
|
|
|
|
|
+ * sets the texture being displayed on the sphere
|
|
|
*/
|
|
*/
|
|
|
- get: function () {
|
|
|
|
|
- return this._material.fovMultiplier;
|
|
|
|
|
- },
|
|
|
|
|
set: function (value) {
|
|
set: function (value) {
|
|
|
- this._material.fovMultiplier = value;
|
|
|
|
|
|
|
+ this.texture = value;
|
|
|
},
|
|
},
|
|
|
enumerable: false,
|
|
enumerable: false,
|
|
|
configurable: true
|
|
configurable: true
|
|
|
});
|
|
});
|
|
|
Object.defineProperty(PhotoDome.prototype, "imageMode", {
|
|
Object.defineProperty(PhotoDome.prototype, "imageMode", {
|
|
|
/**
|
|
/**
|
|
|
- * Gets or set the current video mode for the video. It can be:
|
|
|
|
|
- * * PhotoDome.MODE_MONOSCOPIC : Define the image as a Monoscopic panoramic 360 image.
|
|
|
|
|
- * * PhotoDome.MODE_TOPBOTTOM : Define the image as a Stereoscopic TopBottom/OverUnder panoramic 360 image.
|
|
|
|
|
- * * PhotoDome.MODE_SIDEBYSIDE : Define the image as a Stereoscopic Side by Side panoramic 360 image.
|
|
|
|
|
|
|
+ * Gets the current video mode for the video. It can be:
|
|
|
|
|
+ * * TextureDome.MODE_MONOSCOPIC : Define the texture source as a Monoscopic panoramic 360.
|
|
|
|
|
+ * * TextureDome.MODE_TOPBOTTOM : Define the texture source as a Stereoscopic TopBottom/OverUnder panoramic 360.
|
|
|
|
|
+ * * TextureDome.MODE_SIDEBYSIDE : Define the texture source as a Stereoscopic Side by Side panoramic 360.
|
|
|
*/
|
|
*/
|
|
|
get: function () {
|
|
get: function () {
|
|
|
- return this._imageMode;
|
|
|
|
|
|
|
+ return this.textureMode;
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Sets the current video mode for the video. It can be:
|
|
|
|
|
+ * * TextureDome.MODE_MONOSCOPIC : Define the texture source as a Monoscopic panoramic 360.
|
|
|
|
|
+ * * TextureDome.MODE_TOPBOTTOM : Define the texture source as a Stereoscopic TopBottom/OverUnder panoramic 360.
|
|
|
|
|
+ * * TextureDome.MODE_SIDEBYSIDE : Define the texture source as a Stereoscopic Side by Side panoramic 360.
|
|
|
|
|
+ */
|
|
|
set: function (value) {
|
|
set: function (value) {
|
|
|
- if (this._imageMode === value) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- this._changeImageMode(value);
|
|
|
|
|
|
|
+ this.textureMode = value;
|
|
|
},
|
|
},
|
|
|
enumerable: false,
|
|
enumerable: false,
|
|
|
configurable: true
|
|
configurable: true
|
|
|
});
|
|
});
|
|
|
- PhotoDome.prototype._changeImageMode = function (value) {
|
|
|
|
|
|
|
+ PhotoDome.prototype._initTexture = function (urlsOrElement, scene, options) {
|
|
|
var _this = this;
|
|
var _this = this;
|
|
|
- this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);
|
|
|
|
|
- this._imageMode = value;
|
|
|
|
|
- // Default Setup and Reset.
|
|
|
|
|
- this._photoTexture.uScale = 1;
|
|
|
|
|
- this._photoTexture.vScale = 1;
|
|
|
|
|
- this._photoTexture.uOffset = 0;
|
|
|
|
|
- this._photoTexture.vOffset = 0;
|
|
|
|
|
- switch (value) {
|
|
|
|
|
- case PhotoDome.MODE_SIDEBYSIDE:
|
|
|
|
|
- this._photoTexture.uScale = 0.5;
|
|
|
|
|
- this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {
|
|
|
|
|
- _this._photoTexture.uOffset = camera.isRightCamera ? 0.5 : 0.0;
|
|
|
|
|
- });
|
|
|
|
|
- break;
|
|
|
|
|
- case PhotoDome.MODE_TOPBOTTOM:
|
|
|
|
|
- this._photoTexture.vScale = 0.5;
|
|
|
|
|
- this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {
|
|
|
|
|
- _this._photoTexture.vOffset = camera.isRightCamera ? 0.5 : 0.0;
|
|
|
|
|
- });
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
- /**
|
|
|
|
|
- * Releases resources associated with this node.
|
|
|
|
|
- * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
|
|
|
|
|
- * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)
|
|
|
|
|
- */
|
|
|
|
|
- PhotoDome.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {
|
|
|
|
|
- if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }
|
|
|
|
|
- this._photoTexture.dispose();
|
|
|
|
|
- this._mesh.dispose();
|
|
|
|
|
- this._material.dispose();
|
|
|
|
|
- this.onLoadErrorObservable.clear();
|
|
|
|
|
- this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);
|
|
|
|
|
- _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);
|
|
|
|
|
|
|
+ return new _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__["Texture"](urlsOrElement, scene, true, !this._useDirectMapping, undefined, undefined, function (message, exception) {
|
|
|
|
|
+ _this.onLoadErrorObservable.notifyObservers(message || "Unknown error occured");
|
|
|
|
|
+ if (_this.onError) {
|
|
|
|
|
+ _this.onError(message, exception);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
};
|
|
};
|
|
|
/**
|
|
/**
|
|
|
* Define the image as a Monoscopic panoramic 360 image.
|
|
* Define the image as a Monoscopic panoramic 360 image.
|
|
|
*/
|
|
*/
|
|
|
- PhotoDome.MODE_MONOSCOPIC = 0;
|
|
|
|
|
|
|
+ PhotoDome.MODE_MONOSCOPIC = _textureDome__WEBPACK_IMPORTED_MODULE_2__["TextureDome"].MODE_MONOSCOPIC;
|
|
|
/**
|
|
/**
|
|
|
* Define the image as a Stereoscopic TopBottom/OverUnder panoramic 360 image.
|
|
* Define the image as a Stereoscopic TopBottom/OverUnder panoramic 360 image.
|
|
|
*/
|
|
*/
|
|
|
- PhotoDome.MODE_TOPBOTTOM = 1;
|
|
|
|
|
|
|
+ PhotoDome.MODE_TOPBOTTOM = _textureDome__WEBPACK_IMPORTED_MODULE_2__["TextureDome"].MODE_TOPBOTTOM;
|
|
|
/**
|
|
/**
|
|
|
* Define the image as a Stereoscopic Side by Side panoramic 360 image.
|
|
* Define the image as a Stereoscopic Side by Side panoramic 360 image.
|
|
|
*/
|
|
*/
|
|
|
- PhotoDome.MODE_SIDEBYSIDE = 2;
|
|
|
|
|
|
|
+ PhotoDome.MODE_SIDEBYSIDE = _textureDome__WEBPACK_IMPORTED_MODULE_2__["TextureDome"].MODE_SIDEBYSIDE;
|
|
|
return PhotoDome;
|
|
return PhotoDome;
|
|
|
-}(_Meshes_transformNode__WEBPACK_IMPORTED_MODULE_2__["TransformNode"]));
|
|
|
|
|
|
|
+}(_textureDome__WEBPACK_IMPORTED_MODULE_2__["TextureDome"]));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -50807,23 +50683,23 @@ _scene__WEBPACK_IMPORTED_MODULE_1__["Scene"].prototype.createDefaultXRExperience
|
|
|
|
|
|
|
|
/***/ }),
|
|
/***/ }),
|
|
|
|
|
|
|
|
-/***/ "./Helpers/videoDome.ts":
|
|
|
|
|
-/*!******************************!*\
|
|
|
|
|
- !*** ./Helpers/videoDome.ts ***!
|
|
|
|
|
- \******************************/
|
|
|
|
|
-/*! exports provided: VideoDome */
|
|
|
|
|
|
|
+/***/ "./Helpers/textureDome.ts":
|
|
|
|
|
+/*!********************************!*\
|
|
|
|
|
+ !*** ./Helpers/textureDome.ts ***!
|
|
|
|
|
+ \********************************/
|
|
|
|
|
+/*! exports provided: TextureDome */
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
"use strict";
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VideoDome", function() { return VideoDome; });
|
|
|
|
|
|
|
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextureDome", function() { return TextureDome; });
|
|
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../node_modules/tslib/tslib.es6.js");
|
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../node_modules/tslib/tslib.es6.js");
|
|
|
/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/transformNode */ "./Meshes/transformNode.ts");
|
|
/* harmony import */ var _Meshes_transformNode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Meshes/transformNode */ "./Meshes/transformNode.ts");
|
|
|
/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/mesh */ "./Meshes/mesh.ts");
|
|
/* harmony import */ var _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Meshes/mesh */ "./Meshes/mesh.ts");
|
|
|
/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/texture */ "./Materials/Textures/texture.ts");
|
|
/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Materials/Textures/texture */ "./Materials/Textures/texture.ts");
|
|
|
-/* harmony import */ var _Materials_Textures_videoTexture__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Textures/videoTexture */ "./Materials/Textures/videoTexture.ts");
|
|
|
|
|
-/* harmony import */ var _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Materials/Background/backgroundMaterial */ "./Materials/Background/backgroundMaterial.ts");
|
|
|
|
|
-/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ "./Meshes/Builders/sphereBuilder.ts");
|
|
|
|
|
|
|
+/* harmony import */ var _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Materials/Background/backgroundMaterial */ "./Materials/Background/backgroundMaterial.ts");
|
|
|
|
|
+/* harmony import */ var _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Meshes/Builders/sphereBuilder */ "./Meshes/Builders/sphereBuilder.ts");
|
|
|
|
|
+/* harmony import */ var _Misc_observable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Misc/observable */ "./Misc/observable.ts");
|
|
|
/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Maths/math.vector */ "./Maths/math.vector.ts");
|
|
/* harmony import */ var _Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Maths/math.vector */ "./Maths/math.vector.ts");
|
|
|
/* harmony import */ var _Maths_math__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Maths/math */ "./Maths/math.ts");
|
|
/* harmony import */ var _Maths_math__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Maths/math */ "./Maths/math.ts");
|
|
|
|
|
|
|
@@ -50837,31 +50713,37 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Display a 360/180 degree video on an approximately spherical surface, useful for VR applications or skyboxes.
|
|
|
|
|
- * As a subclass of TransformNode, this allow parenting to the camera or multiple videos with different locations in the scene.
|
|
|
|
|
- * This class achieves its effect with a VideoTexture and a correctly configured BackgroundMaterial on an inverted sphere.
|
|
|
|
|
|
|
+ * Display a 360/180 degree texture on an approximately spherical surface, useful for VR applications or skyboxes.
|
|
|
|
|
+ * As a subclass of TransformNode, this allow parenting to the camera or multiple textures with different locations in the scene.
|
|
|
|
|
+ * This class achieves its effect with a Texture and a correctly configured BackgroundMaterial on an inverted sphere.
|
|
|
* Potential additions to this helper include zoom and and non-infinite distance rendering effects.
|
|
* Potential additions to this helper include zoom and and non-infinite distance rendering effects.
|
|
|
*/
|
|
*/
|
|
|
-var VideoDome = /** @class */ (function (_super) {
|
|
|
|
|
- Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(VideoDome, _super);
|
|
|
|
|
|
|
+var TextureDome = /** @class */ (function (_super) {
|
|
|
|
|
+ Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(TextureDome, _super);
|
|
|
/**
|
|
/**
|
|
|
- * Create an instance of this class and pass through the parameters to the relevant classes, VideoTexture, StandardMaterial, and Mesh.
|
|
|
|
|
|
|
+ * Create an instance of this class and pass through the parameters to the relevant classes- Texture, StandardMaterial, and Mesh.
|
|
|
* @param name Element's name, child elements will append suffixes for their own names.
|
|
* @param name Element's name, child elements will append suffixes for their own names.
|
|
|
- * @param urlsOrVideo defines the url(s) or the video element to use
|
|
|
|
|
|
|
+ * @param textureUrlOrElement defines the url(s) or the (video) HTML element to use
|
|
|
* @param options An object containing optional or exposed sub element properties
|
|
* @param options An object containing optional or exposed sub element properties
|
|
|
*/
|
|
*/
|
|
|
- function VideoDome(name, urlsOrVideo, options, scene) {
|
|
|
|
|
|
|
+ function TextureDome(name, textureUrlOrElement, options, scene, onError) {
|
|
|
|
|
+ if (onError === void 0) { onError = null; }
|
|
|
var _this = _super.call(this, name, scene) || this;
|
|
var _this = _super.call(this, name, scene) || this;
|
|
|
|
|
+ _this.onError = onError;
|
|
|
_this._halfDome = false;
|
|
_this._halfDome = false;
|
|
|
_this._useDirectMapping = false;
|
|
_this._useDirectMapping = false;
|
|
|
- _this._videoMode = VideoDome.MODE_MONOSCOPIC;
|
|
|
|
|
|
|
+ _this._textureMode = TextureDome.MODE_MONOSCOPIC;
|
|
|
/**
|
|
/**
|
|
|
* Oberserver used in Stereoscopic VR Mode.
|
|
* Oberserver used in Stereoscopic VR Mode.
|
|
|
*/
|
|
*/
|
|
|
_this._onBeforeCameraRenderObserver = null;
|
|
_this._onBeforeCameraRenderObserver = null;
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Observable raised when an error occured while loading the 360 image
|
|
|
|
|
+ */
|
|
|
|
|
+ _this.onLoadErrorObservable = new _Misc_observable__WEBPACK_IMPORTED_MODULE_6__["Observable"]();
|
|
|
scene = _this.getScene();
|
|
scene = _this.getScene();
|
|
|
// set defaults and manage values
|
|
// set defaults and manage values
|
|
|
- name = name || "videoDome";
|
|
|
|
|
|
|
+ name = name || "textureDome";
|
|
|
options.resolution = Math.abs(options.resolution) | 0 || 32;
|
|
options.resolution = Math.abs(options.resolution) | 0 || 32;
|
|
|
options.clickToPlay = Boolean(options.clickToPlay);
|
|
options.clickToPlay = Boolean(options.clickToPlay);
|
|
|
options.autoPlay = options.autoPlay === undefined ? true : Boolean(options.autoPlay);
|
|
options.autoPlay = options.autoPlay === undefined ? true : Boolean(options.autoPlay);
|
|
@@ -50877,46 +50759,30 @@ var VideoDome = /** @class */ (function (_super) {
|
|
|
options.faceForward = true;
|
|
options.faceForward = true;
|
|
|
}
|
|
}
|
|
|
_this._setReady(false);
|
|
_this._setReady(false);
|
|
|
- // create
|
|
|
|
|
- var tempOptions = { loop: options.loop, autoPlay: options.autoPlay, autoUpdateTexture: true, poster: options.poster };
|
|
|
|
|
- var material = (_this._material = new _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_5__["BackgroundMaterial"](name + "_material", scene));
|
|
|
|
|
- var texture = (_this._videoTexture = new _Materials_Textures_videoTexture__WEBPACK_IMPORTED_MODULE_4__["VideoTexture"](name + "_texture", urlsOrVideo, scene, false, _this._useDirectMapping, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__["Texture"].TRILINEAR_SAMPLINGMODE, tempOptions));
|
|
|
|
|
_this._mesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__["Mesh"].CreateSphere(name + "_mesh", options.resolution, options.size, scene, false, _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__["Mesh"].BACKSIDE);
|
|
_this._mesh = _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__["Mesh"].CreateSphere(name + "_mesh", options.resolution, options.size, scene, false, _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__["Mesh"].BACKSIDE);
|
|
|
- texture.anisotropicFilteringLevel = 1;
|
|
|
|
|
- texture.onLoadObservable.addOnce(function () {
|
|
|
|
|
- _this._setReady(true);
|
|
|
|
|
- });
|
|
|
|
|
// configure material
|
|
// configure material
|
|
|
|
|
+ var material = (_this._material = new _Materials_Background_backgroundMaterial__WEBPACK_IMPORTED_MODULE_4__["BackgroundMaterial"](name + "_material", scene));
|
|
|
material.useEquirectangularFOV = true;
|
|
material.useEquirectangularFOV = true;
|
|
|
material.fovMultiplier = 1.0;
|
|
material.fovMultiplier = 1.0;
|
|
|
material.opacityFresnel = false;
|
|
material.opacityFresnel = false;
|
|
|
- if (_this._useDirectMapping) {
|
|
|
|
|
- texture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__["Texture"].CLAMP_ADDRESSMODE;
|
|
|
|
|
- texture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__["Texture"].CLAMP_ADDRESSMODE;
|
|
|
|
|
- material.diffuseTexture = texture;
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- texture.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__["Texture"].FIXED_EQUIRECTANGULAR_MIRRORED_MODE; // matches orientation
|
|
|
|
|
- texture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__["Texture"].CLAMP_ADDRESSMODE;
|
|
|
|
|
- material.reflectionTexture = texture;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ var texture = _this._initTexture(textureUrlOrElement, scene, options);
|
|
|
|
|
+ _this.texture = texture;
|
|
|
// configure mesh
|
|
// configure mesh
|
|
|
_this._mesh.material = material;
|
|
_this._mesh.material = material;
|
|
|
_this._mesh.parent = _this;
|
|
_this._mesh.parent = _this;
|
|
|
- // create a (disabled until needed) mask to cover unneeded segments of 180 videos.
|
|
|
|
|
- _this._halfDomeMask = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_6__["SphereBuilder"].CreateSphere("", { slice: 0.5, diameter: options.size * 0.99, segments: options.resolution, sideOrientation: _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__["Mesh"].BACKSIDE }, scene);
|
|
|
|
|
|
|
+ // create a (disabled until needed) mask to cover unneeded segments of 180 texture.
|
|
|
|
|
+ _this._halfDomeMask = _Meshes_Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_5__["SphereBuilder"].CreateSphere("", { slice: 0.5, diameter: options.size * 0.98, segments: options.resolution * 2, sideOrientation: _Meshes_mesh__WEBPACK_IMPORTED_MODULE_2__["Mesh"].BACKSIDE }, scene);
|
|
|
_this._halfDomeMask.rotate(_Maths_math__WEBPACK_IMPORTED_MODULE_8__["Axis"].X, -Math.PI / 2);
|
|
_this._halfDomeMask.rotate(_Maths_math__WEBPACK_IMPORTED_MODULE_8__["Axis"].X, -Math.PI / 2);
|
|
|
// set the parent, so it will always be positioned correctly AND will be disposed when the main sphere is disposed
|
|
// set the parent, so it will always be positioned correctly AND will be disposed when the main sphere is disposed
|
|
|
_this._halfDomeMask.parent = _this._mesh;
|
|
_this._halfDomeMask.parent = _this._mesh;
|
|
|
_this._halfDome = !!options.halfDomeMode;
|
|
_this._halfDome = !!options.halfDomeMode;
|
|
|
// enable or disable according to the settings
|
|
// enable or disable according to the settings
|
|
|
_this._halfDomeMask.setEnabled(_this._halfDome);
|
|
_this._halfDomeMask.setEnabled(_this._halfDome);
|
|
|
- // optional configuration
|
|
|
|
|
- if (options.clickToPlay) {
|
|
|
|
|
- scene.onPointerUp = function () {
|
|
|
|
|
- _this._videoTexture.video.play();
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // create
|
|
|
|
|
+ _this._texture.anisotropicFilteringLevel = 1;
|
|
|
|
|
+ _this._texture.onLoadObservable.addOnce(function () {
|
|
|
|
|
+ _this._setReady(true);
|
|
|
|
|
+ });
|
|
|
// Initial rotation
|
|
// Initial rotation
|
|
|
if (options.faceForward && scene.activeCamera) {
|
|
if (options.faceForward && scene.activeCamera) {
|
|
|
var camera = scene.activeCamera;
|
|
var camera = scene.activeCamera;
|
|
@@ -50925,22 +50791,41 @@ var VideoDome = /** @class */ (function (_super) {
|
|
|
direction.normalize();
|
|
direction.normalize();
|
|
|
_this.rotation.y = Math.acos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__["Vector3"].Dot(forward, direction));
|
|
_this.rotation.y = Math.acos(_Maths_math_vector__WEBPACK_IMPORTED_MODULE_7__["Vector3"].Dot(forward, direction));
|
|
|
}
|
|
}
|
|
|
- _this._changeVideoMode(_this._videoMode);
|
|
|
|
|
|
|
+ _this._changeTextureMode(_this._textureMode);
|
|
|
return _this;
|
|
return _this;
|
|
|
}
|
|
}
|
|
|
- Object.defineProperty(VideoDome.prototype, "videoTexture", {
|
|
|
|
|
|
|
+ Object.defineProperty(TextureDome.prototype, "texture", {
|
|
|
/**
|
|
/**
|
|
|
- * Gets the video texture being displayed on the sphere
|
|
|
|
|
|
|
+ * Gets the texture being displayed on the sphere
|
|
|
*/
|
|
*/
|
|
|
get: function () {
|
|
get: function () {
|
|
|
- return this._videoTexture;
|
|
|
|
|
|
|
+ return this._texture;
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Sets the texture being displayed on the sphere
|
|
|
|
|
+ */
|
|
|
|
|
+ set: function (newTexture) {
|
|
|
|
|
+ if (this._texture === newTexture) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this._texture = newTexture;
|
|
|
|
|
+ if (this._useDirectMapping) {
|
|
|
|
|
+ this._texture.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__["Texture"].CLAMP_ADDRESSMODE;
|
|
|
|
|
+ this._texture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__["Texture"].CLAMP_ADDRESSMODE;
|
|
|
|
|
+ this._material.diffuseTexture = this._texture;
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ this._texture.coordinatesMode = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__["Texture"].FIXED_EQUIRECTANGULAR_MIRRORED_MODE; // matches orientation
|
|
|
|
|
+ this._texture.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_3__["Texture"].CLAMP_ADDRESSMODE;
|
|
|
|
|
+ this._material.reflectionTexture = this._texture;
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
enumerable: false,
|
|
enumerable: false,
|
|
|
configurable: true
|
|
configurable: true
|
|
|
});
|
|
});
|
|
|
- Object.defineProperty(VideoDome.prototype, "mesh", {
|
|
|
|
|
|
|
+ Object.defineProperty(TextureDome.prototype, "mesh", {
|
|
|
/**
|
|
/**
|
|
|
- * Gets the mesh used for the video dome.
|
|
|
|
|
|
|
+ * Gets the mesh used for the dome.
|
|
|
*/
|
|
*/
|
|
|
get: function () {
|
|
get: function () {
|
|
|
return this._mesh;
|
|
return this._mesh;
|
|
@@ -50948,7 +50833,7 @@ var VideoDome = /** @class */ (function (_super) {
|
|
|
enumerable: false,
|
|
enumerable: false,
|
|
|
configurable: true
|
|
configurable: true
|
|
|
});
|
|
});
|
|
|
- Object.defineProperty(VideoDome.prototype, "fovMultiplier", {
|
|
|
|
|
|
|
+ Object.defineProperty(TextureDome.prototype, "fovMultiplier", {
|
|
|
/**
|
|
/**
|
|
|
* The current fov(field of view) multiplier, 0.0 - 2.0. Defaults to 1.0. Lower values "zoom in" and higher values "zoom out".
|
|
* The current fov(field of view) multiplier, 0.0 - 2.0. Defaults to 1.0. Lower values "zoom in" and higher values "zoom out".
|
|
|
* Also see the options.resolution property.
|
|
* Also see the options.resolution property.
|
|
@@ -50962,29 +50847,34 @@ var VideoDome = /** @class */ (function (_super) {
|
|
|
enumerable: false,
|
|
enumerable: false,
|
|
|
configurable: true
|
|
configurable: true
|
|
|
});
|
|
});
|
|
|
- Object.defineProperty(VideoDome.prototype, "videoMode", {
|
|
|
|
|
|
|
+ Object.defineProperty(TextureDome.prototype, "textureMode", {
|
|
|
/**
|
|
/**
|
|
|
- * Gets or set the current video mode for the video. It can be:
|
|
|
|
|
- * * VideoDome.MODE_MONOSCOPIC : Define the video source as a Monoscopic panoramic 360 video.
|
|
|
|
|
- * * VideoDome.MODE_TOPBOTTOM : Define the video source as a Stereoscopic TopBottom/OverUnder panoramic 360 video.
|
|
|
|
|
- * * VideoDome.MODE_SIDEBYSIDE : Define the video source as a Stereoscopic Side by Side panoramic 360 video.
|
|
|
|
|
|
|
+ * Gets or set the current texture mode for the texture. It can be:
|
|
|
|
|
+ * * TextureDome.MODE_MONOSCOPIC : Define the texture source as a Monoscopic panoramic 360.
|
|
|
|
|
+ * * TextureDome.MODE_TOPBOTTOM : Define the texture source as a Stereoscopic TopBottom/OverUnder panoramic 360.
|
|
|
|
|
+ * * TextureDome.MODE_SIDEBYSIDE : Define the texture source as a Stereoscopic Side by Side panoramic 360.
|
|
|
*/
|
|
*/
|
|
|
get: function () {
|
|
get: function () {
|
|
|
- return this._videoMode;
|
|
|
|
|
|
|
+ return this._textureMode;
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Sets the current texture mode for the texture. It can be:
|
|
|
|
|
+ * * TextureDome.MODE_MONOSCOPIC : Define the texture source as a Monoscopic panoramic 360.
|
|
|
|
|
+ * * TextureDome.MODE_TOPBOTTOM : Define the texture source as a Stereoscopic TopBottom/OverUnder panoramic 360.
|
|
|
|
|
+ * * TextureDome.MODE_SIDEBYSIDE : Define the texture source as a Stereoscopic Side by Side panoramic 360.
|
|
|
|
|
+ */
|
|
|
set: function (value) {
|
|
set: function (value) {
|
|
|
- if (this._videoMode === value) {
|
|
|
|
|
|
|
+ if (this._textureMode === value) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- this._changeVideoMode(value);
|
|
|
|
|
|
|
+ this._changeTextureMode(value);
|
|
|
},
|
|
},
|
|
|
enumerable: false,
|
|
enumerable: false,
|
|
|
configurable: true
|
|
configurable: true
|
|
|
});
|
|
});
|
|
|
- Object.defineProperty(VideoDome.prototype, "halfDome", {
|
|
|
|
|
|
|
+ Object.defineProperty(TextureDome.prototype, "halfDome", {
|
|
|
/**
|
|
/**
|
|
|
- * Is the video a 180 degrees video (half dome) or 360 video (full dome)
|
|
|
|
|
- *
|
|
|
|
|
|
|
+ * Is it a 180 degrees dome (half dome) or 360 texture (full dome)
|
|
|
*/
|
|
*/
|
|
|
get: function () {
|
|
get: function () {
|
|
|
return this._halfDome;
|
|
return this._halfDome;
|
|
@@ -50999,37 +50889,38 @@ var VideoDome = /** @class */ (function (_super) {
|
|
|
enumerable: false,
|
|
enumerable: false,
|
|
|
configurable: true
|
|
configurable: true
|
|
|
});
|
|
});
|
|
|
- VideoDome.prototype._changeVideoMode = function (value) {
|
|
|
|
|
|
|
+ TextureDome.prototype._changeTextureMode = function (value) {
|
|
|
var _this = this;
|
|
var _this = this;
|
|
|
this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);
|
|
this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);
|
|
|
- this._videoMode = value;
|
|
|
|
|
|
|
+ this._textureMode = value;
|
|
|
// Default Setup and Reset.
|
|
// Default Setup and Reset.
|
|
|
- this._videoTexture.uScale = 1;
|
|
|
|
|
- this._videoTexture.vScale = 1;
|
|
|
|
|
- this._videoTexture.uOffset = 0;
|
|
|
|
|
- this._videoTexture.vOffset = 0;
|
|
|
|
|
|
|
+ this._texture.uScale = 1;
|
|
|
|
|
+ this._texture.vScale = 1;
|
|
|
|
|
+ this._texture.uOffset = 0;
|
|
|
|
|
+ this._texture.vOffset = 0;
|
|
|
switch (value) {
|
|
switch (value) {
|
|
|
- case VideoDome.MODE_MONOSCOPIC:
|
|
|
|
|
|
|
+ case TextureDome.MODE_MONOSCOPIC:
|
|
|
if (this._halfDome) {
|
|
if (this._halfDome) {
|
|
|
- this._videoTexture.uScale = 2;
|
|
|
|
|
|
|
+ this._texture.uScale = 2;
|
|
|
|
|
+ this._texture.uOffset = -1;
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
- case VideoDome.MODE_SIDEBYSIDE:
|
|
|
|
|
- // in half-dome mode the uScale should be double of 360 videos
|
|
|
|
|
|
|
+ case TextureDome.MODE_SIDEBYSIDE:
|
|
|
|
|
+ // in half-dome mode the uScale should be double of 360 texture
|
|
|
// Use 0.99999 to boost perf by not switching program
|
|
// Use 0.99999 to boost perf by not switching program
|
|
|
- this._videoTexture.uScale = this._halfDome ? 0.99999 : 0.5;
|
|
|
|
|
|
|
+ this._texture.uScale = this._halfDome ? 0.99999 : 0.5;
|
|
|
var rightOffset_1 = this._halfDome ? 0.0 : 0.5;
|
|
var rightOffset_1 = this._halfDome ? 0.0 : 0.5;
|
|
|
var leftOffset_1 = this._halfDome ? 0.5 : 0.0;
|
|
var leftOffset_1 = this._halfDome ? 0.5 : 0.0;
|
|
|
this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {
|
|
this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {
|
|
|
- _this._videoTexture.uOffset = camera.isRightCamera ? rightOffset_1 : leftOffset_1;
|
|
|
|
|
|
|
+ _this._texture.uOffset = camera.isRightCamera ? rightOffset_1 : leftOffset_1;
|
|
|
});
|
|
});
|
|
|
break;
|
|
break;
|
|
|
- case VideoDome.MODE_TOPBOTTOM:
|
|
|
|
|
- // in half-dome mode the vScale should be double of 360 videos
|
|
|
|
|
|
|
+ case TextureDome.MODE_TOPBOTTOM:
|
|
|
|
|
+ // in half-dome mode the vScale should be double of 360 texture
|
|
|
// Use 0.99999 to boost perf by not switching program
|
|
// Use 0.99999 to boost perf by not switching program
|
|
|
- this._videoTexture.vScale = this._halfDome ? 0.99999 : 0.5;
|
|
|
|
|
|
|
+ this._texture.vScale = this._halfDome ? 0.99999 : 0.5;
|
|
|
this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {
|
|
this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add(function (camera) {
|
|
|
- _this._videoTexture.vOffset = camera.isRightCamera ? 0.5 : 0.0;
|
|
|
|
|
|
|
+ _this._texture.vOffset = camera.isRightCamera ? 0.5 : 0.0;
|
|
|
});
|
|
});
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -51039,28 +50930,116 @@ var VideoDome = /** @class */ (function (_super) {
|
|
|
* @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
|
|
* @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
|
|
|
* @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)
|
|
* @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)
|
|
|
*/
|
|
*/
|
|
|
- VideoDome.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {
|
|
|
|
|
|
|
+ TextureDome.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {
|
|
|
if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }
|
|
if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }
|
|
|
- this._videoTexture.dispose();
|
|
|
|
|
|
|
+ this._texture.dispose();
|
|
|
this._mesh.dispose();
|
|
this._mesh.dispose();
|
|
|
this._material.dispose();
|
|
this._material.dispose();
|
|
|
this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);
|
|
this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);
|
|
|
|
|
+ this.onLoadErrorObservable.clear();
|
|
|
_super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);
|
|
_super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);
|
|
|
};
|
|
};
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Define the source as a Monoscopic panoramic 360/180.
|
|
|
|
|
+ */
|
|
|
|
|
+ TextureDome.MODE_MONOSCOPIC = 0;
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Define the source as a Stereoscopic TopBottom/OverUnder panoramic 360/180.
|
|
|
|
|
+ */
|
|
|
|
|
+ TextureDome.MODE_TOPBOTTOM = 1;
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Define the source as a Stereoscopic Side by Side panoramic 360/180.
|
|
|
|
|
+ */
|
|
|
|
|
+ TextureDome.MODE_SIDEBYSIDE = 2;
|
|
|
|
|
+ return TextureDome;
|
|
|
|
|
+}(_Meshes_transformNode__WEBPACK_IMPORTED_MODULE_1__["TransformNode"]));
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+/***/ }),
|
|
|
|
|
+
|
|
|
|
|
+/***/ "./Helpers/videoDome.ts":
|
|
|
|
|
+/*!******************************!*\
|
|
|
|
|
+ !*** ./Helpers/videoDome.ts ***!
|
|
|
|
|
+ \******************************/
|
|
|
|
|
+/*! exports provided: VideoDome */
|
|
|
|
|
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
+
|
|
|
|
|
+"use strict";
|
|
|
|
|
+__webpack_require__.r(__webpack_exports__);
|
|
|
|
|
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VideoDome", function() { return VideoDome; });
|
|
|
|
|
+/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../node_modules/tslib/tslib.es6.js");
|
|
|
|
|
+/* harmony import */ var _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Materials/Textures/texture */ "./Materials/Textures/texture.ts");
|
|
|
|
|
+/* harmony import */ var _Materials_Textures_videoTexture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Materials/Textures/videoTexture */ "./Materials/Textures/videoTexture.ts");
|
|
|
|
|
+/* harmony import */ var _textureDome__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./textureDome */ "./Helpers/textureDome.ts");
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * Display a 360/180 degree video on an approximately spherical surface, useful for VR applications or skyboxes.
|
|
|
|
|
+ * As a subclass of TransformNode, this allow parenting to the camera or multiple videos with different locations in the scene.
|
|
|
|
|
+ * This class achieves its effect with a VideoTexture and a correctly configured BackgroundMaterial on an inverted sphere.
|
|
|
|
|
+ * Potential additions to this helper include zoom and and non-infinite distance rendering effects.
|
|
|
|
|
+ */
|
|
|
|
|
+var VideoDome = /** @class */ (function (_super) {
|
|
|
|
|
+ Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(VideoDome, _super);
|
|
|
|
|
+ function VideoDome() {
|
|
|
|
|
+ return _super !== null && _super.apply(this, arguments) || this;
|
|
|
|
|
+ }
|
|
|
|
|
+ Object.defineProperty(VideoDome.prototype, "videoTexture", {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Get the video texture associated with this video dome
|
|
|
|
|
+ */
|
|
|
|
|
+ get: function () {
|
|
|
|
|
+ return this._texture;
|
|
|
|
|
+ },
|
|
|
|
|
+ enumerable: false,
|
|
|
|
|
+ configurable: true
|
|
|
|
|
+ });
|
|
|
|
|
+ Object.defineProperty(VideoDome.prototype, "videoMode", {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Get the video mode of this dome
|
|
|
|
|
+ */
|
|
|
|
|
+ get: function () {
|
|
|
|
|
+ return this.textureMode;
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Set the video mode of this dome.
|
|
|
|
|
+ * @see textureMode
|
|
|
|
|
+ */
|
|
|
|
|
+ set: function (value) {
|
|
|
|
|
+ this.textureMode = value;
|
|
|
|
|
+ },
|
|
|
|
|
+ enumerable: false,
|
|
|
|
|
+ configurable: true
|
|
|
|
|
+ });
|
|
|
|
|
+ VideoDome.prototype._initTexture = function (urlsOrElement, scene, options) {
|
|
|
|
|
+ var _this = this;
|
|
|
|
|
+ var tempOptions = { loop: options.loop, autoPlay: options.autoPlay, autoUpdateTexture: true, poster: options.poster };
|
|
|
|
|
+ var texture = new _Materials_Textures_videoTexture__WEBPACK_IMPORTED_MODULE_2__["VideoTexture"]((this.name || "videoDome") + "_texture", urlsOrElement, scene, false, this._useDirectMapping, _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_1__["Texture"].TRILINEAR_SAMPLINGMODE, tempOptions);
|
|
|
|
|
+ // optional configuration
|
|
|
|
|
+ if (options.clickToPlay) {
|
|
|
|
|
+ scene.onPointerUp = function () {
|
|
|
|
|
+ _this._texture.video.play();
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ return texture;
|
|
|
|
|
+ };
|
|
|
|
|
+ /**
|
|
|
* Define the video source as a Monoscopic panoramic 360 video.
|
|
* Define the video source as a Monoscopic panoramic 360 video.
|
|
|
*/
|
|
*/
|
|
|
- VideoDome.MODE_MONOSCOPIC = 0;
|
|
|
|
|
|
|
+ VideoDome.MODE_MONOSCOPIC = _textureDome__WEBPACK_IMPORTED_MODULE_3__["TextureDome"].MODE_MONOSCOPIC;
|
|
|
/**
|
|
/**
|
|
|
* Define the video source as a Stereoscopic TopBottom/OverUnder panoramic 360 video.
|
|
* Define the video source as a Stereoscopic TopBottom/OverUnder panoramic 360 video.
|
|
|
*/
|
|
*/
|
|
|
- VideoDome.MODE_TOPBOTTOM = 1;
|
|
|
|
|
|
|
+ VideoDome.MODE_TOPBOTTOM = _textureDome__WEBPACK_IMPORTED_MODULE_3__["TextureDome"].MODE_TOPBOTTOM;
|
|
|
/**
|
|
/**
|
|
|
* Define the video source as a Stereoscopic Side by Side panoramic 360 video.
|
|
* Define the video source as a Stereoscopic Side by Side panoramic 360 video.
|
|
|
*/
|
|
*/
|
|
|
- VideoDome.MODE_SIDEBYSIDE = 2;
|
|
|
|
|
|
|
+ VideoDome.MODE_SIDEBYSIDE = _textureDome__WEBPACK_IMPORTED_MODULE_3__["TextureDome"].MODE_SIDEBYSIDE;
|
|
|
return VideoDome;
|
|
return VideoDome;
|
|
|
-}(_Meshes_transformNode__WEBPACK_IMPORTED_MODULE_1__["TransformNode"]));
|
|
|
|
|
|
|
+}(_textureDome__WEBPACK_IMPORTED_MODULE_3__["TextureDome"]));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -177163,7 +177142,7 @@ var UtilityLayerRenderer = /** @class */ (function () {
|
|
|
// allow every non pointer down event to flow to the utility layer
|
|
// allow every non pointer down event to flow to the utility layer
|
|
|
if (_this.onlyCheckPointerDownEvents && prePointerInfo.type != _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__["PointerEventTypes"].POINTERDOWN) {
|
|
if (_this.onlyCheckPointerDownEvents && prePointerInfo.type != _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__["PointerEventTypes"].POINTERDOWN) {
|
|
|
if (!prePointerInfo.skipOnPointerObservable) {
|
|
if (!prePointerInfo.skipOnPointerObservable) {
|
|
|
- _this.utilityLayerScene.onPointerObservable.notifyObservers(new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__["PointerInfo"](prePointerInfo.type, prePointerInfo.event, utilityScenePick));
|
|
|
|
|
|
|
+ _this.utilityLayerScene.onPointerObservable.notifyObservers(new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__["PointerInfo"](prePointerInfo.type, prePointerInfo.event, utilityScenePick), prePointerInfo.type);
|
|
|
}
|
|
}
|
|
|
if (prePointerInfo.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__["PointerEventTypes"].POINTERUP && _this._pointerCaptures[pointerEvent.pointerId]) {
|
|
if (prePointerInfo.type === _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__["PointerEventTypes"].POINTERUP && _this._pointerCaptures[pointerEvent.pointerId]) {
|
|
|
_this._pointerCaptures[pointerEvent.pointerId] = false;
|
|
_this._pointerCaptures[pointerEvent.pointerId] = false;
|
|
@@ -177174,7 +177153,7 @@ var UtilityLayerRenderer = /** @class */ (function () {
|
|
|
// If this layer is an overlay, check if this layer was hit and if so, skip pointer events for the main scene
|
|
// If this layer is an overlay, check if this layer was hit and if so, skip pointer events for the main scene
|
|
|
if (utilityScenePick && utilityScenePick.hit) {
|
|
if (utilityScenePick && utilityScenePick.hit) {
|
|
|
if (!prePointerInfo.skipOnPointerObservable) {
|
|
if (!prePointerInfo.skipOnPointerObservable) {
|
|
|
- _this.utilityLayerScene.onPointerObservable.notifyObservers(new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__["PointerInfo"](prePointerInfo.type, prePointerInfo.event, utilityScenePick));
|
|
|
|
|
|
|
+ _this.utilityLayerScene.onPointerObservable.notifyObservers(new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__["PointerInfo"](prePointerInfo.type, prePointerInfo.event, utilityScenePick), prePointerInfo.type);
|
|
|
}
|
|
}
|
|
|
prePointerInfo.skipOnPointerObservable = true;
|
|
prePointerInfo.skipOnPointerObservable = true;
|
|
|
}
|
|
}
|
|
@@ -177322,7 +177301,7 @@ var UtilityLayerRenderer = /** @class */ (function () {
|
|
|
});
|
|
});
|
|
|
UtilityLayerRenderer.prototype._notifyObservers = function (prePointerInfo, pickInfo, pointerEvent) {
|
|
UtilityLayerRenderer.prototype._notifyObservers = function (prePointerInfo, pickInfo, pointerEvent) {
|
|
|
if (!prePointerInfo.skipOnPointerObservable) {
|
|
if (!prePointerInfo.skipOnPointerObservable) {
|
|
|
- this.utilityLayerScene.onPointerObservable.notifyObservers(new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__["PointerInfo"](prePointerInfo.type, prePointerInfo.event, pickInfo));
|
|
|
|
|
|
|
+ this.utilityLayerScene.onPointerObservable.notifyObservers(new _Events_pointerEvents__WEBPACK_IMPORTED_MODULE_2__["PointerInfo"](prePointerInfo.type, prePointerInfo.event, pickInfo), prePointerInfo.type);
|
|
|
this._lastPointerEvents[pointerEvent.pointerId] = true;
|
|
this._lastPointerEvents[pointerEvent.pointerId] = true;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|