Browse Source

Added THREE.Cache.
This may create memory leaks in the future, depending on the usage...

Mr.doob 11 years ago
parent
commit
a489c3061c
2 changed files with 38 additions and 0 deletions
  1. 37 0
      src/loaders/Cache.js
  2. 1 0
      utils/build/includes/common.json

+ 37 - 0
src/loaders/Cache.js

@@ -0,0 +1,37 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
+THREE.Cache = {
+
+	files: {},
+
+	add: function ( key, file ) {
+
+		// console.log( 'THREE.Cache', 'Adding key:', key );
+
+		this.files[ key ] = file;
+
+	},
+
+	get: function ( key ) {
+
+		// console.log( 'THREE.Cache', 'Checking key:', key );
+
+		return this.files[ key ];
+
+	},
+
+	remove: function ( key ) {
+
+		delete this.files[ key ];
+
+	},
+
+	clear: function () {
+
+		this.files = {}
+
+	}
+
+};

+ 1 - 0
utils/build/includes/common.json

@@ -41,6 +41,7 @@
 	"src/lights/HemisphereLight.js",
 	"src/lights/PointLight.js",
 	"src/lights/SpotLight.js",
+	"src/loaders/Cache.js",
 	"src/loaders/Loader.js",
 	"src/loaders/XHRLoader.js",
 	"src/loaders/ImageLoader.js",