diff options
author | Joshua Slack <[email protected]> | 2017-04-27 13:50:25 -0500 |
---|---|---|
committer | Joshua Slack <[email protected]> | 2017-04-27 13:50:25 -0500 |
commit | 33060d6cafbb84f19efa99e2ad3cea73cc1fd8ed (patch) | |
tree | 4816e40d06dfd47136b38454196882fdd004c875 /ardor3d-collada | |
parent | ec637d5a3fffe01ed4346c73fab91d8447a7192d (diff) |
Made GeometryTool effectively into a static class
Diffstat (limited to 'ardor3d-collada')
2 files changed, 17 insertions, 41 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..f448ea0 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 @@ -3,7 +3,7 @@ * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -42,7 +42,6 @@ import com.ardor3d.extension.model.collada.jdom.data.DataCache; import com.ardor3d.extension.model.collada.jdom.plugin.ColladaExtraPlugin; import com.ardor3d.scenegraph.MeshData; import com.ardor3d.scenegraph.Node; -import com.ardor3d.util.geom.GeometryTool; import com.ardor3d.util.geom.GeometryTool.MatchCondition; import com.ardor3d.util.resource.RelativeResourceLocator; import com.ardor3d.util.resource.ResourceLocator; @@ -171,7 +170,7 @@ public class ColladaImporter { /** * 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. @@ -196,7 +195,7 @@ public class ColladaImporter { /** * Reads a Collada file from the given resource and returns it as a ColladaStorage object. - * + * * @param resource * the name of the resource to find. * @return a ColladaStorage data object containing the Collada scene and other useful elements. @@ -204,21 +203,6 @@ public class ColladaImporter { * if the resource can not be loaded for some reason. */ public ColladaStorage load(final ResourceSource 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. - * @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 loaded for some reason. - */ - public ColladaStorage load(final ResourceSource resource, final GeometryTool geometryTool) throws IOException { final ColladaStorage colladaStorage = new ColladaStorage(); final DataCache dataCache = new DataCache(); if (_externalJointMapping != null) { @@ -227,7 +211,7 @@ public class ColladaImporter { final ColladaDOMUtil colladaDOMUtil = new ColladaDOMUtil(dataCache); final ColladaMaterialUtils colladaMaterialUtils = new ColladaMaterialUtils(this, dataCache, colladaDOMUtil); final ColladaMeshUtils colladaMeshUtils = new ColladaMeshUtils(dataCache, colladaDOMUtil, colladaMaterialUtils, - _optimizeMeshes, _optimizeSettings, geometryTool); + _optimizeMeshes, _optimizeSettings); final ColladaAnimUtils colladaAnimUtils = new ColladaAnimUtils(colladaStorage, dataCache, colladaDOMUtil, colladaMeshUtils); final ColladaNodeUtils colladaNodeUtils = new ColladaNodeUtils(dataCache, colladaDOMUtil, colladaMaterialUtils, @@ -300,7 +284,7 @@ public class ColladaImporter { /** * Reads the whole Collada DOM tree from the given resource and returns its root element. Exceptions may be thrown * by underlying tools; these will be wrapped in a RuntimeException and rethrown. - * + * * @param resource * the ResourceSource to read the resource from * @return the Collada root element @@ -497,7 +481,7 @@ public class ColladaImporter { /** * Parse a numeric value. Commas are replaced by dot automaticly. Also handle special values : INF, -INF, NaN - * + * * @param number * string * @return float diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMeshUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMeshUtils.java index 4c40b0a..6fe3de6 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMeshUtils.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMeshUtils.java @@ -3,7 +3,7 @@ * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -43,28 +43,20 @@ public class ColladaMeshUtils { private final ColladaMaterialUtils _colladaMaterialUtils; private final boolean _optimizeMeshes; private final EnumSet<MatchCondition> _optimizeSettings; - private final GeometryTool _geometryTool; public ColladaMeshUtils(final DataCache dataCache, final ColladaDOMUtil colladaDOMUtil, final ColladaMaterialUtils colladaMaterialUtils, final boolean optimizeMeshes, final EnumSet<MatchCondition> optimizeSettings) { - this(dataCache, colladaDOMUtil, colladaMaterialUtils, optimizeMeshes, optimizeSettings, new GeometryTool()); - } - - public ColladaMeshUtils(final DataCache dataCache, final ColladaDOMUtil colladaDOMUtil, - final ColladaMaterialUtils colladaMaterialUtils, final boolean optimizeMeshes, - final EnumSet<MatchCondition> optimizeSettings, final GeometryTool geometryTool) { _dataCache = dataCache; _colladaDOMUtil = colladaDOMUtil; _colladaMaterialUtils = colladaMaterialUtils; _optimizeMeshes = optimizeMeshes; _optimizeSettings = EnumSet.copyOf(optimizeSettings); - _geometryTool = geometryTool; } /** * Builds geometry from an instance_geometry element. - * + * * @param instanceGeometry * @return our Spatial */ @@ -81,7 +73,7 @@ public class ColladaMeshUtils { * Builds a mesh from a Collada geometry element. Currently supported mesh types: mesh, polygons, polylist, * triangles, lines. Not supported yet: linestrips, trifans, tristrips. If no meshtype is found, a pointcloud is * built. - * + * * @param colladaGeometry * @return a Node containing all of the Ardor3D meshes we've parsed from this geometry element. */ @@ -220,7 +212,7 @@ public class ColladaMeshUtils { _dataCache.getVertMappings().put(colladaGeometry, mvp); if (_optimizeMeshes) { - final VertMap map = _geometryTool.minimizeVerts(points, _optimizeSettings); + final VertMap map = GeometryTool.minimizeVerts(points, _optimizeSettings); _dataCache.setMeshVertMap(points, map); } @@ -315,7 +307,7 @@ public class ColladaMeshUtils { } if (_optimizeMeshes) { - final VertMap map = _geometryTool.minimizeVerts(polyMesh, _optimizeSettings); + final VertMap map = GeometryTool.minimizeVerts(polyMesh, _optimizeSettings); _dataCache.setMeshVertMap(polyMesh, map); } @@ -407,7 +399,7 @@ public class ColladaMeshUtils { } if (_optimizeMeshes) { - final VertMap map = _geometryTool.minimizeVerts(polyMesh, _optimizeSettings); + final VertMap map = GeometryTool.minimizeVerts(polyMesh, _optimizeSettings); _dataCache.setMeshVertMap(polyMesh, map); } @@ -461,7 +453,7 @@ public class ColladaMeshUtils { } if (_optimizeMeshes) { - final VertMap map = _geometryTool.minimizeVerts(triMesh, _optimizeSettings); + final VertMap map = GeometryTool.minimizeVerts(triMesh, _optimizeSettings); _dataCache.setMeshVertMap(triMesh, map); } @@ -512,7 +504,7 @@ public class ColladaMeshUtils { } if (_optimizeMeshes) { - final VertMap map = _geometryTool.minimizeVerts(lineMesh, _optimizeSettings); + final VertMap map = GeometryTool.minimizeVerts(lineMesh, _optimizeSettings); _dataCache.setMeshVertMap(lineMesh, map); } @@ -523,7 +515,7 @@ public class ColladaMeshUtils { /** * Extract our pipes from the given parent element. - * + * * @param inputsParent * @param pipesStore * the store for our pipes @@ -564,7 +556,7 @@ public class ColladaMeshUtils { /** * Push the values at the given indices of currentVal onto the buffers defined in pipes. - * + * * @param pipes * @param currentVal * @return the vertex index referenced in the given indices based on the pipes. Integer.MIN_VALUE is returned if no @@ -586,7 +578,7 @@ public class ColladaMeshUtils { /** * Extract name from xml element, some exporters don't support 'name' attribute, so we better use the material * instead of a generic name. - * + * * @param element * @return value from 'name' or 'material' attribute */ |