|
@@ -102397,29 +102397,48 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
function VideoDome(name, urlsOrVideo, options, scene) {
|
|
function VideoDome(name, urlsOrVideo, options, scene) {
|
|
var _this = _super.call(this, name, scene) || this;
|
|
var _this = _super.call(this, name, scene) || this;
|
|
|
|
+ _this._useDirectMapping = false;
|
|
// set defaults and manage values
|
|
// set defaults and manage values
|
|
name = name || "videoDome";
|
|
name = name || "videoDome";
|
|
- options.resolution = (Math.abs(options.resolution) | 0) || 12;
|
|
|
|
|
|
+ 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);
|
|
options.loop = options.loop === undefined ? true : Boolean(options.loop);
|
|
options.loop = options.loop === undefined ? true : Boolean(options.loop);
|
|
options.size = Math.abs(options.size) || (scene.activeCamera ? scene.activeCamera.maxZ * 0.48 : 1000);
|
|
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;
|
|
|
|
+ }
|
|
// create
|
|
// create
|
|
var tempOptions = { loop: options.loop, autoPlay: options.autoPlay, autoUpdateTexture: true, poster: options.poster };
|
|
var tempOptions = { loop: options.loop, autoPlay: options.autoPlay, autoUpdateTexture: true, poster: options.poster };
|
|
var material = _this._material = new BABYLON.BackgroundMaterial(name + "_material", scene);
|
|
var material = _this._material = new BABYLON.BackgroundMaterial(name + "_material", scene);
|
|
- var texture = _this._videoTexture = new BABYLON.VideoTexture(name + "_texture", urlsOrVideo, scene, false, false, BABYLON.Texture.TRILINEAR_SAMPLINGMODE, tempOptions);
|
|
|
|
- _this._mesh = BABYLON.MeshBuilder.CreateIcoSphere(name + "_mesh", {
|
|
|
|
- flat: false,
|
|
|
|
- radius: options.size,
|
|
|
|
- subdivisions: options.resolution,
|
|
|
|
- sideOrientation: BABYLON.Mesh.BACKSIDE // needs to be inside out
|
|
|
|
- }, scene);
|
|
|
|
|
|
+ var texture = _this._videoTexture = new BABYLON.VideoTexture(name + "_texture", urlsOrVideo, scene, false, _this._useDirectMapping, BABYLON.Texture.TRILINEAR_SAMPLINGMODE, tempOptions);
|
|
|
|
+ if (_this._useDirectMapping) {
|
|
|
|
+ _this._mesh = BABYLON.Mesh.CreateSphere("sphere1", options.resolution, options.size, scene, false, BABYLON.Mesh.BACKSIDE);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ _this._mesh = BABYLON.MeshBuilder.CreateIcoSphere(name + "_mesh", {
|
|
|
|
+ flat: false,
|
|
|
|
+ radius: options.size,
|
|
|
|
+ subdivisions: options.resolution,
|
|
|
|
+ sideOrientation: BABYLON.Mesh.BACKSIDE // needs to be inside out
|
|
|
|
+ }, scene);
|
|
|
|
+ }
|
|
// configure material
|
|
// configure material
|
|
- texture.coordinatesMode = BABYLON.Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE; // matches orientation
|
|
|
|
- texture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE; // always clamp the up/down
|
|
|
|
- material.reflectionTexture = _this._videoTexture;
|
|
|
|
material.useEquirectangularFOV = true;
|
|
material.useEquirectangularFOV = true;
|
|
material.fovMultiplier = 1.0;
|
|
material.fovMultiplier = 1.0;
|
|
|
|
+ if (_this._useDirectMapping) {
|
|
|
|
+ texture.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
|
|
+ texture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
|
|
+ material.diffuseTexture = texture;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ texture.coordinatesMode = BABYLON.Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE; // matches orientation
|
|
|
|
+ texture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
|
|
+ material.reflectionTexture = texture;
|
|
|
|
+ }
|
|
// configure mesh
|
|
// configure mesh
|
|
_this._mesh.material = material;
|
|
_this._mesh.material = material;
|
|
_this._mesh.parent = _this;
|
|
_this._mesh.parent = _this;
|
|
@@ -102493,22 +102512,35 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
function PhotoDome(name, urlOfPhoto, options, scene) {
|
|
function PhotoDome(name, urlOfPhoto, options, scene) {
|
|
var _this = _super.call(this, name, scene) || this;
|
|
var _this = _super.call(this, name, scene) || this;
|
|
|
|
+ _this._useDirectMapping = false;
|
|
// set defaults and manage values
|
|
// set defaults and manage values
|
|
name = name || "photoDome";
|
|
name = name || "photoDome";
|
|
- options.resolution = (Math.abs(options.resolution) | 0) || 12;
|
|
|
|
|
|
+ options.resolution = (Math.abs(options.resolution) | 0) || 32;
|
|
options.size = Math.abs(options.size) || (scene.activeCamera ? scene.activeCamera.maxZ * 0.48 : 1000);
|
|
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;
|
|
|
|
+ }
|
|
// create
|
|
// create
|
|
var material = _this._material = new BABYLON.BackgroundMaterial(name + "_material", scene);
|
|
var material = _this._material = new BABYLON.BackgroundMaterial(name + "_material", scene);
|
|
- _this._mesh = BABYLON.MeshBuilder.CreateIcoSphere(name + "_mesh", {
|
|
|
|
- flat: false,
|
|
|
|
- radius: options.size,
|
|
|
|
- subdivisions: options.resolution,
|
|
|
|
- sideOrientation: BABYLON.Mesh.BACKSIDE // needs to be inside out
|
|
|
|
- }, scene);
|
|
|
|
|
|
+ if (_this._useDirectMapping) {
|
|
|
|
+ _this._mesh = BABYLON.Mesh.CreateSphere("sphere1", options.resolution, options.size, scene, false, BABYLON.Mesh.BACKSIDE);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ _this._mesh = BABYLON.MeshBuilder.CreateIcoSphere(name + "_mesh", {
|
|
|
|
+ flat: false,
|
|
|
|
+ radius: options.size,
|
|
|
|
+ subdivisions: options.resolution,
|
|
|
|
+ sideOrientation: BABYLON.Mesh.BACKSIDE // needs to be inside out
|
|
|
|
+ }, scene);
|
|
|
|
+ }
|
|
// configure material
|
|
// configure material
|
|
|
|
+ material.opacityFresnel = false;
|
|
material.useEquirectangularFOV = true;
|
|
material.useEquirectangularFOV = true;
|
|
material.fovMultiplier = 1.0;
|
|
material.fovMultiplier = 1.0;
|
|
- _this.photoTexture = new BABYLON.Texture(urlOfPhoto, scene);
|
|
|
|
|
|
+ _this.photoTexture = new BABYLON.Texture(urlOfPhoto, scene, false, !_this._useDirectMapping);
|
|
// configure mesh
|
|
// configure mesh
|
|
_this._mesh.material = material;
|
|
_this._mesh.material = material;
|
|
_this._mesh.parent = _this;
|
|
_this._mesh.parent = _this;
|
|
@@ -102526,9 +102558,16 @@ var BABYLON;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this._photoTexture = value;
|
|
this._photoTexture = value;
|
|
- this._photoTexture.coordinatesMode = BABYLON.Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE; // matches orientation
|
|
|
|
- this._photoTexture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE; // always clamp the up/down
|
|
|
|
- this._material.reflectionTexture = this._photoTexture;
|
|
|
|
|
|
+ if (this._useDirectMapping) {
|
|
|
|
+ this._photoTexture.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
|
|
+ this._photoTexture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
|
|
+ this._material.diffuseTexture = this._photoTexture;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this._photoTexture.coordinatesMode = BABYLON.Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE; // matches orientation
|
|
|
|
+ this._photoTexture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
|
|
+ this._material.reflectionTexture = this._photoTexture;
|
|
|
|
+ }
|
|
},
|
|
},
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|