diff --git a/vtm-gdx/src/org/oscim/gdx/GdxAssets.java b/vtm-gdx/src/org/oscim/gdx/GdxAssets.java
index ce8146d5..80116140 100644
--- a/vtm-gdx/src/org/oscim/gdx/GdxAssets.java
+++ b/vtm-gdx/src/org/oscim/gdx/GdxAssets.java
@@ -1,6 +1,7 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2016 devemux86
+ * Copyright 2018 Gustl22
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -50,6 +51,13 @@ public class GdxAssets extends AssetAdapter {
}
}
+ /**
+ * Get file path in GDX assets.
+ */
+ public static String getAssetPath(String fileName) {
+ return Gdx.files.internal(pathPrefix + fileName).path();
+ }
+
public static void init(String path) {
AssetAdapter.init(new GdxAssets(path));
}
diff --git a/vtm-playground/src/org/oscim/test/gdx/poi3d/Poi3DLayer.java b/vtm-playground/src/org/oscim/test/gdx/poi3d/Poi3DLayer.java
index 319cb768..cfa01c7c 100644
--- a/vtm-playground/src/org/oscim/test/gdx/poi3d/Poi3DLayer.java
+++ b/vtm-playground/src/org/oscim/test/gdx/poi3d/Poi3DLayer.java
@@ -12,6 +12,7 @@ import org.oscim.core.PointF;
import org.oscim.core.Tag;
import org.oscim.core.Tile;
import org.oscim.event.Event;
+import org.oscim.gdx.GdxAssets;
import org.oscim.layers.Layer;
import org.oscim.layers.tile.MapTile;
import org.oscim.layers.tile.MapTile.TileData;
@@ -21,6 +22,7 @@ import org.oscim.layers.tile.vector.VectorTileLayer.TileLoaderProcessHook;
import org.oscim.map.Map;
import org.oscim.renderer.bucket.RenderBuckets;
import org.oscim.renderer.bucket.SymbolItem;
+import org.oscim.theme.VtmModels;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -92,8 +94,10 @@ public class Poi3DLayer extends Layer implements Map.UpdateListener {
// mModel = modelBuilder.createSphere(10f, 10f, 10f, 12, 12,
// mat, attributes);
+ pathToTree = GdxAssets.getAssetPath(VtmModels.TREE.getPath());
+
assets = new AssetManager();
- assets.load("data/g3d/treeA.g3dj", Model.class);
+ assets.load(pathToTree, Model.class);
loading = true;
}
@@ -107,8 +111,10 @@ public class Poi3DLayer extends Layer implements Map.UpdateListener {
Model mModel;
AssetManager assets;
+ private final String pathToTree;
+
private void doneLoading() {
- Model model = assets.get("data/g3d/treeA.g3dj", Model.class);
+ Model model = assets.get(pathToTree, Model.class);
for (int i = 0; i < model.nodes.size; i++) {
Node node = model.nodes.get(i);
diff --git a/vtm-playground/data/g3d/tree.png b/vtm-themes/resources/assets/models/natural/tree.png
similarity index 100%
rename from vtm-playground/data/g3d/tree.png
rename to vtm-themes/resources/assets/models/natural/tree.png
diff --git a/vtm-playground/data/g3d/treeA.g3dj b/vtm-themes/resources/assets/models/natural/treeA.g3dj
similarity index 100%
rename from vtm-playground/data/g3d/treeA.g3dj
rename to vtm-themes/resources/assets/models/natural/treeA.g3dj
diff --git a/vtm-themes/src/org/oscim/theme/VtmModels.java b/vtm-themes/src/org/oscim/theme/VtmModels.java
new file mode 100644
index 00000000..3de3055b
--- /dev/null
+++ b/vtm-themes/src/org/oscim/theme/VtmModels.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2018 Gustl22
+ *
+ * This program is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with
+ * this program. If not, see
+ * Generate own models: + * If using Blender for new models, start fresh project delete camera and light source, keep blender render engine. + * Export as .obj/fbx + * Use Fbx converter [https://github.com/libgdx/fbx-conv] and Java GUI [https://github.com/ASneakyFox/libgdx-fbxconv-gui] + * to convert to g3d. + * .obj is supported, too, but has troubles with textures and materials. + * More: [https://github.com/libgdx/libgdx/wiki/Importing-Blender-models-in-LibGDX] + */ +public enum VtmModels { + + TREE("models/natural/treeA.g3dj"); + + private final String mPath; + + VtmModels(String path) { + mPath = path; + } + + /** + * Get relative path to models. Assets path isn't included! + */ + public String getPath() { + return mPath; + } + + public InputStream getModelAsStream() { + return AssetAdapter.readFileAsStream(mPath); + } +}