提交 f8854672 编写于 作者: M Mr.doob

THREE.Cache now global. See #5650.

上级 d2c225aa
......@@ -2,15 +2,9 @@
* @author mrdoob / http://mrdoob.com/
*/
THREE.Cache = function () {
THREE.Cache = {
this.files = {};
};
THREE.Cache.prototype = {
constructor: THREE.Cache,
files: {},
add: function ( key, file ) {
......
......@@ -4,7 +4,6 @@
THREE.ImageLoader = function ( manager ) {
this.cache = new THREE.Cache();
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
};
......@@ -17,7 +16,7 @@ THREE.ImageLoader.prototype = {
var scope = this;
var cached = scope.cache.get( url );
var cached = THREE.Cache.get( url );
if ( cached !== undefined ) {
......@@ -28,18 +27,15 @@ THREE.ImageLoader.prototype = {
var image = document.createElement( 'img' );
if ( onLoad !== undefined ) {
image.addEventListener( 'load', function ( event ) {
image.addEventListener( 'load', function ( event ) {
THREE.Cache.add( url, this );
scope.cache.add( url, this );
if ( onLoad ) onLoad( this );
scope.manager.itemEnd( url );
onLoad( this );
scope.manager.itemEnd( url );
}, false );
}
}, false );
if ( onProgress !== undefined ) {
......
......@@ -4,7 +4,6 @@
THREE.XHRLoader = function ( manager ) {
this.cache = new THREE.Cache();
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
};
......@@ -17,7 +16,7 @@ THREE.XHRLoader.prototype = {
var scope = this;
var cached = scope.cache.get( url );
var cached = THREE.Cache.get( url );
if ( cached !== undefined ) {
......@@ -31,7 +30,7 @@ THREE.XHRLoader.prototype = {
request.addEventListener( 'load', function ( event ) {
scope.cache.add( url, this.response );
THREE.Cache.add( url, this.response );
if ( onLoad ) onLoad( this.response );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册