diff --git a/src/main/java/cactusServer/models/CharacterModelManager.java b/src/main/java/cactusServer/models/CharacterModelManager.java index ba0f2fe..4cec571 100644 --- a/src/main/java/cactusServer/models/CharacterModelManager.java +++ b/src/main/java/cactusServer/models/CharacterModelManager.java @@ -1,15 +1,55 @@ package cactusServer.models; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URL; +import java.net.URLDecoder; 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; +import org.ntlab.radishforandroidstudio.framework.model3D.Object3D; +import org.ntlab.radishforandroidstudio.framework.physics.Ground; + +import cactusServer.entities.Instance; public class CharacterModelManager { private static CharacterModelManager theInstance = null; private HashMap characterModels = new HashMap<>(); private CharacterModelManager() { + initCharacterModels(); + } + private void initCharacterModels() { + +// String path = Battles.getInstance().getClass().getResource("pocha.stl").getPath(); +// try { +// path = URLDecoder.decode(path, "utf-8"); +// } catch (Exception e) { +// +// } +// +// String path = Instances.class.getResource("pocha.stl").getPath(); +// try { +// path = URLDecoder.decode(path, "utf-8"); +// } catch (UnsupportedEncodingException e) { +// e.printStackTrace(); +// } +// System.out.println((path == null) ? "null����!" : path); + //characterModels.put(characterModels.size(), loadModel(path)); + //characterModels.put(characterModels.size(), loadModel("src\\main\\assets\\Head4.obj")); + } + + private Model3D loadModel(String fileName) { + try { + return ModelFactory.loadModel(fileName, null, false, true); + } catch (IOException | ModelFileFormatException e) { + e.printStackTrace(); + } + return null; } public static CharacterModelManager getInstance() {