فهرست منبع

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

Mr.doob 13 سال پیش
والد
کامیت
89d49d8f92
1فایلهای تغییر یافته به همراه28 افزوده شده و 0 حذف شده
  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();
+
+};