diff --git a/src/main/java/cactusServer/models/ObjectModelManager.java b/src/main/java/cactusServer/models/ObjectModelManager.java new file mode 100644 index 0000000..6e21f03 --- /dev/null +++ b/src/main/java/cactusServer/models/ObjectModelManager.java @@ -0,0 +1,41 @@ +package cactusServer.models; + +import java.io.IOException; +import java.util.HashMap; + +import org.ntlab.radishforandroidstudio.framework.model3D.Model3D; +import org.ntlab.radishforandroidstudio.framework.model3D.ModelFactory; +import org.ntlab.radishforandroidstudio.framework.model3D.ModelFileFormatException; + +public class ObjectModelManager { + private static ObjectModelManager theInstance = null; + private HashMap model = new HashMap<>(); + + private ObjectModelManager() { + try { + setObject(0, ModelFactory.loadModel(getClass().getResource("../../konan/konan.stl").getPath())); + setObject(1, ModelFactory.loadModel(getClass().getResource("../../konan/konan.stl").getPath())); + } catch (IOException | ModelFileFormatException e) { + e.printStackTrace(); + } + } + + public static ObjectModelManager getInstance() { + if (theInstance == null) { + theInstance = new ObjectModelManager(); + } + return theInstance; + } + + public void setObject(int key, Model3D loadModel) { + model.put(key, loadModel); + } + + public Model3D getObject(int objectID) { + return model.get(objectID); + } + + public int getObjectModelCount() { + return model.size(); + } +}