(function(){
'use strict';
PANOLENS.ImagePanorama = function ( image, radius ) {
radius = radius || 5000;
var geometry = new THREE.SphereGeometry( radius, 60, 40 ),
material = new THREE.MeshBasicMaterial( { opacity: 0, transparent: true } );
PANOLENS.Panorama.call( this, geometry, material );
this.src = image;
}
PANOLENS.ImagePanorama.prototype = Object.create( PANOLENS.Panorama.prototype );
PANOLENS.ImagePanorama.prototype.constructor = PANOLENS.ImagePanorama;
PANOLENS.ImagePanorama.prototype.load = function ( src ) {
src = src || this.src;
if ( !src ) {
console.warn( 'Image source undefined' );
return;
} else if ( typeof src === 'string' ) {
PANOLENS.Utils.TextureLoader.load( src, this.onLoad.bind( this ), this.onProgress.bind( this ), this.onError.bind( this ) );
} else if ( src instanceof HTMLImageElement ) {
this.onLoad( new THREE.Texture( src ) );
}
};
PANOLENS.ImagePanorama.prototype.onLoad = function ( texture ) {
texture.minFilter = texture.magFilter = THREE.LinearFilter;
texture.needsUpdate = true;
this.updateTexture( texture );
window.requestAnimationFrame(function(){
window.requestAnimationFrame(function(){
PANOLENS.Panorama.prototype.onLoad.call( this );
}.bind(this));
}.bind(this));
};
PANOLENS.ImagePanorama.prototype.reset = function () {
PANOLENS.Panorama.prototype.reset.call( this );
};
})();