diff options
author | rodgersgb <[email protected]> | 2008-04-29 19:48:18 +0000 |
---|---|---|
committer | rodgersgb <[email protected]> | 2008-04-29 19:48:18 +0000 |
commit | 5be04fcb829dc61a5dd8f874df499684c29580c6 (patch) | |
tree | 1d398b8b20d06222f40ebf205da5e2b2cfb30829 | |
parent | f80713130dffb66fac29922cf05cd2a5ed5fcf72 (diff) |
Added a file remotely
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/joglutils/trunk@84 83d24430-9974-4f80-8418-2cc3294053b9
-rw-r--r-- | src/net/java/joglutils/model/ModelFactory.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/net/java/joglutils/model/ModelFactory.java b/src/net/java/joglutils/model/ModelFactory.java new file mode 100644 index 0000000..778f319 --- /dev/null +++ b/src/net/java/joglutils/model/ModelFactory.java @@ -0,0 +1,38 @@ +/*
+ * Model3DFactory.java
+ *
+ * Created on February 27, 2008, 10:00 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package net.java.joglutils.model;
+
+
+import java.util.HashMap;
+import net.java.joglutils.model.geometry.Model;
+import net.java.joglutils.model.loader.LoaderFactory;
+
+/**
+ *
+ * @author Brian Wood
+ * modifications made by Greg Rodgers
+ */
+public class ModelFactory {
+
+ private static HashMap<Object, Model> modelCache = new HashMap<Object, Model>();
+
+ public static Model createModel(String source) throws ModelLoadException {
+ Model model = modelCache.get(source);
+ if (model == null) {
+ model = LoaderFactory.load(source);
+ modelCache.put(source, model);
+ }
+
+ if (model == null)
+ throw new ModelLoadException();
+
+ return model;
+ }
+}
|