소스 검색

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();
+
+};