diff options
author | Julien Gouesse <[email protected]> | 2014-02-05 22:24:57 +0100 |
---|---|---|
committer | Julien Gouesse <[email protected]> | 2014-02-05 22:24:57 +0100 |
commit | a6b0283809187413e7f0294d2d57ad153b70f64c (patch) | |
tree | 04825bb3df177c8f80b472270a541c3c13207505 | |
parent | 443d79e798aa33aee79add21181e5b889e01be33 (diff) |
Allows to override the geometry tool when a string is passed to the loader
-rw-r--r-- | ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java | 18 | ||||
-rw-r--r-- | ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java | 15 |
2 files changed, 31 insertions, 2 deletions
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java index 4464a0b..c8bf84f 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java @@ -180,6 +180,22 @@ public class ColladaImporter { * if the resource can not be located or loaded for some reason. */ public ColladaStorage load(final String resource) throws IOException { + return load(resource, new GeometryTool()); + } + + /** + * Reads a Collada file from the given resource and returns it as a ColladaStorage object. + * + * @param resource + * the name of the resource to find. ResourceLocatorTool will be used with TYPE_MODEL to find the + * resource. + * @param geometryTool + * the geometry tool used to minimize the vertex count. + * @return a ColladaStorage data object containing the Collada scene and other useful elements. + * @throws IOException + * if the resource can not be located or loaded for some reason. + */ + public ColladaStorage load(final String resource, final GeometryTool geometryTool) throws IOException { final ResourceSource source; if (_modelLocator == null) { source = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_MODEL, resource); @@ -191,7 +207,7 @@ public class ColladaImporter { throw new IOException("Unable to locate '" + resource + "'"); } - return load(source); + return load(source, geometryTool); } /** diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java index f7b7c28..c42564a 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java @@ -109,6 +109,19 @@ public class ObjImporter { * @return an ObjGeometryStore data object containing the scene and other useful elements. */ public ObjGeometryStore load(final String resource) { + return load(resource, new GeometryTool()); + } + + /** + * Reads a Wavefront OBJ file from the given resource + * + * @param resource + * the name of the resource to find. + * @param geometryTool + * the geometry tool used to minimize the vertex count. + * @return an ObjGeometryStore data object containing the scene and other useful elements. + */ + public ObjGeometryStore load(final String resource, final GeometryTool geometryTool) { final ResourceSource source; if (_modelLocator == null) { source = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_MODEL, resource); @@ -120,7 +133,7 @@ public class ObjImporter { throw new Error("Unable to locate '" + resource + "'"); } - return load(source); + return load(source, geometryTool); } /** |