Browse Source

Adding ImageLoader.
Tinkering with the problem of images loading async...
Maybe this should be TextureLoader instead...

Mr.doob 13 năm trước cách đây
mục cha
commit
89d49d8f92
1 tập tin đã thay đổi với 28 bổ sung0 xóa
  1. 28 0
      src/loaders/ImageLoader.js

+ 28 - 0
src/loaders/ImageLoader.js

@@ -0,0 +1,28 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
+THREE.ImageLoader = function () {};
+
+THREE.ImageLoader.prototype = new THREE.Loader();
+THREE.ImageLoader.prototype.constructor = THREE.ImageLoader;
+
+THREE.ImageLoader.prototype.load = function ( url, callback ) {
+
+	var that = this;
+	var image = new Image();
+
+	image.onload = function () {
+
+		callback( image );
+
+		that.onLoadComplete();
+
+	};
+
+	image.crossOrigin = this.crossOrigin;
+	image.src = path;
+
+	that.onLoadStart();
+
+};