aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-collada/src
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2014-09-24 23:27:40 +0200
committerJulien Gouesse <[email protected]>2014-09-24 23:27:40 +0200
commitf38dd328528849161455361c0ed0b2214634f98f (patch)
treed4496008e054ee3eec0b320f6a1251eb2fb05c75 /ardor3d-collada/src
parentfd1fca3240bca358b2f4e18fbcb6f4393318727d (diff)
Stops using Guava to create the lists, the sets and the maps except when it is really necessary
Diffstat (limited to 'ardor3d-collada/src')
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java29
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java7
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java9
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java3
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java6
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java50
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java4
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java8
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java3
9 files changed, 58 insertions, 61 deletions
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java
index 03173d8..e3f39fd 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java
@@ -19,6 +19,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumMap;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
@@ -65,8 +66,6 @@ import com.ardor3d.util.export.binary.BinaryImporter;
import com.ardor3d.util.geom.BufferUtils;
import com.ardor3d.util.geom.VertMap;
import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
/**
@@ -196,7 +195,7 @@ public class ColladaAnimUtils {
final Node meshNode = _colladaMeshUtils.buildMesh(geometry);
if (meshNode != null) {
// Look for skeleton entries in the original <instance_controller> element
- final List<Element> skeletonRoots = Lists.newArrayList();
+ final List<Element> skeletonRoots = new ArrayList<Element>();
for (final Element sk : instanceController.getChildren("skeleton")) {
final Element skroot = _colladaDOMUtil.findTargetWithId(sk.getText());
if (skroot != null) {
@@ -215,9 +214,9 @@ public class ColladaAnimUtils {
}
// Pull out our joint names and bind matrices
- final List<String> jointNames = Lists.newArrayList();
- final List<Transform> bindMatrices = Lists.newArrayList();
- final List<ColladaInputPipe.ParamType> paramTypes = Lists.newArrayList();
+ final List<String> jointNames = new ArrayList<String>();
+ final List<Transform> bindMatrices = new ArrayList<Transform>();
+ final List<ColladaInputPipe.ParamType> paramTypes = new ArrayList<ColladaInputPipe.ParamType>();
for (final Element inputEL : jointsEL.getChildren("input")) {
final ColladaInputPipe pipe = new ColladaInputPipe(_colladaDOMUtil, inputEL);
@@ -324,8 +323,8 @@ public class ColladaAnimUtils {
}
// Pull out our per vertex joint indices and weights
- final List<Short> jointIndices = Lists.newArrayList();
- final List<Float> jointWeights = Lists.newArrayList();
+ final List<Short> jointIndices = new ArrayList<Short>();
+ final List<Float> jointWeights = new ArrayList<Float>();
int indOff = 0, weightOff = 0;
int maxOffset = 0;
@@ -670,7 +669,7 @@ public class ColladaAnimUtils {
+ targetNode.getName() + "(" + targetIndex + ")");
}
- final EnumMap<Type, ColladaInputPipe> pipes = Maps.newEnumMap(Type.class);
+ final EnumMap<Type, ColladaInputPipe> pipes = new EnumMap<Type, ColladaInputPipe>(Type.class);
final Element samplerElement = _colladaDOMUtil.findTargetWithId(source);
for (final Element inputElement : samplerElement.getChildren("input")) {
@@ -709,9 +708,9 @@ public class ColladaAnimUtils {
targetChannel.currentPos = 0;
}
- final List<Float> finalTimeList = Lists.newArrayList();
- final List<Transform> finalTransformList = Lists.newArrayList();
- final List<TargetChannel> workingChannels = Lists.newArrayList();
+ final List<Float> finalTimeList = new ArrayList<Float>();
+ final List<Transform> finalTransformList = new ArrayList<Transform>();
+ final List<TargetChannel> workingChannels = new ArrayList<TargetChannel>();
for (;;) {
float lowestTime = Float.MAX_VALUE;
boolean found = false;
@@ -926,7 +925,7 @@ public class ColladaAnimUtils {
return currentElement;
}
- private static final Map<String, Integer> symbolMap = Maps.newHashMap();
+ private static final Map<String, Integer> symbolMap = new HashMap<String, Integer>();
static {
symbolMap.put("ANGLE", 3);
symbolMap.put("TIME", 0);
@@ -1024,7 +1023,7 @@ public class ColladaAnimUtils {
* @return
*/
private List<TransformElement> getNodeTransformList(final List<Element> transforms) {
- final List<TransformElement> transformList = Lists.newArrayList();
+ final List<TransformElement> transformList = new ArrayList<TransformElement>();
for (final Element transform : transforms) {
final double[] array = _colladaDOMUtil.parseDoubleArray(transform);
@@ -1173,7 +1172,7 @@ public class ColladaAnimUtils {
private static class Target {
public String id;
- public List<String> sids = Lists.newArrayList();
+ public List<String> sids = new ArrayList<String>();
public AccessorType accessorType = AccessorType.None;
public int accessorIndexX = -1, accessorIndexY = -1;
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 b1e885e..cf0e4b5 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
@@ -50,7 +50,6 @@ import com.ardor3d.util.resource.ResourceLocatorTool;
import com.ardor3d.util.resource.ResourceSource;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
/**
@@ -72,7 +71,7 @@ public class ColladaImporter {
private final EnumSet<MatchCondition> _optimizeSettings = EnumSet.of(MatchCondition.UVs, MatchCondition.Normal,
MatchCondition.Color);
private Map<String, Joint> _externalJointMapping;
- private final List<ColladaExtraPlugin> _extraPlugins = Lists.newArrayList();
+ private final List<ColladaExtraPlugin> _extraPlugins = new ArrayList<ColladaExtraPlugin>();
public boolean isLoadTextures() {
return _loadTextures;
@@ -246,8 +245,8 @@ public class ColladaImporter {
_optimizeMeshes, _optimizeSettings, geometryTool);
final ColladaAnimUtils colladaAnimUtils = new ColladaAnimUtils(colladaStorage, dataCache, colladaDOMUtil,
colladaMeshUtils);
- final ColladaNodeUtils colladaNodeUtils = new ColladaNodeUtils(this, dataCache, colladaDOMUtil, colladaMaterialUtils,
- colladaMeshUtils, colladaAnimUtils);
+ final ColladaNodeUtils colladaNodeUtils = new ColladaNodeUtils(this, dataCache, colladaDOMUtil,
+ colladaMaterialUtils, colladaMeshUtils, colladaAnimUtils);
try {
// Pull in the DOM tree of the Collada resource.
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java
index b51515f..d67347f 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java
@@ -33,7 +33,6 @@ import com.ardor3d.math.Vector3;
import com.ardor3d.math.Vector4;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.Spatial;
-import com.google.common.collect.Lists;
/**
* Methods for parsing Collada data related to scenes and node hierarchy.
@@ -48,9 +47,9 @@ public class ColladaNodeUtils {
private final ColladaMeshUtils _colladaMeshUtils;
private final ColladaAnimUtils _colladaAnimUtils;
- public ColladaNodeUtils(final ColladaImporter importer, final DataCache dataCache, final ColladaDOMUtil colladaDOMUtil,
- final ColladaMaterialUtils colladaMaterialUtils, final ColladaMeshUtils colladaMeshUtils,
- final ColladaAnimUtils colladaAnimUtils) {
+ public ColladaNodeUtils(final ColladaImporter importer, final DataCache dataCache,
+ final ColladaDOMUtil colladaDOMUtil, final ColladaMaterialUtils colladaMaterialUtils,
+ final ColladaMeshUtils colladaMeshUtils, final ColladaAnimUtils colladaAnimUtils) {
_importer = importer;
_dataCache = dataCache;
_colladaDOMUtil = colladaDOMUtil;
@@ -97,7 +96,7 @@ public class ColladaNodeUtils {
// build a list of joints - one list per skeleton - and build a skeleton for each joint list.
for (final JointNode jointChildNode : _dataCache.getRootJointNode().getChildren()) {
- final List<Joint> jointList = Lists.newArrayList();
+ final List<Joint> jointList = new ArrayList<Joint>();
buildJointLists(jointChildNode, jointList);
final Joint[] joints = jointList.toArray(new Joint[jointList.size()]);
final Skeleton skeleton = new Skeleton(joints[0].getName() + "_skeleton", joints);
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java
index 400384c..2829e0e 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java
@@ -20,12 +20,11 @@ import com.ardor3d.extension.animation.skeletal.clip.AnimationClip;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.export.Savable;
-import com.google.common.collect.Lists;
@SavableFactory(factoryMethod = "initSavable")
public class AnimationItem implements Savable {
private final String _name;
- private final List<AnimationItem> _children = Lists.newArrayList();
+ private final List<AnimationItem> _children = new ArrayList<AnimationItem>();
private AnimationClip _animationClip;
public AnimationItem(final String name) {
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java
index 8eafa20..2d430b6 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java
@@ -12,6 +12,7 @@ package com.ardor3d.extension.model.collada.jdom.data;
import java.io.IOException;
import java.nio.FloatBuffer;
+import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -25,7 +26,6 @@ import com.ardor3d.scenegraph.Node;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.export.Savable;
-import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
/**
@@ -34,10 +34,10 @@ import com.google.common.collect.Multimap;
public class ColladaStorage implements Savable {
private Node _scene;
- private final List<SkinData> _skins = Lists.newArrayList();
+ private final List<SkinData> _skins = new ArrayList<SkinData>();
private AssetData _assetData;
- private final List<AbstractAnimationChannel> _transformChannels = Lists.newArrayList();
+ private final List<AbstractAnimationChannel> _transformChannels = new ArrayList<AbstractAnimationChannel>();
private AnimationItem _animationItemRoot;
// List of parsed color buffers, useful if collada includes multiple color channels per meshdata object
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java
index 0288777..5674e8f 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java
@@ -11,7 +11,11 @@
package com.ardor3d.extension.model.collada.jdom.data;
import java.nio.FloatBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
@@ -29,8 +33,6 @@ import com.ardor3d.scenegraph.MeshData;
import com.ardor3d.scenegraph.Spatial;
import com.ardor3d.util.geom.VertMap;
import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
/**
@@ -68,35 +70,35 @@ public class DataCache {
private final Multimap<Joint, AttachmentPoint> _attachmentPoints = ArrayListMultimap.create();
public DataCache() {
- _boundMaterials = Maps.newHashMap();
- _textures = Maps.newHashMap();
- _idCache = Maps.newHashMap();
- _sidCache = Maps.newHashMap();
- _xPathExpressions = Maps.newHashMap();
+ _boundMaterials = new HashMap<String, Element>();
+ _textures = new HashMap<String, Texture>();
+ _idCache = new HashMap<String, Element>();
+ _sidCache = new HashMap<String, Element>();
+ _xPathExpressions = new HashMap<String, XPath>();
_pattern = Pattern.compile("\\s");
- _transformTypes = Collections.unmodifiableList(Lists.newArrayList("lookat", "matrix", "rotate", "scale",
- "scew", "translate"));
+ _transformTypes = Collections.unmodifiableList(Arrays.asList(new String[] { "lookat", "matrix", "rotate",
+ "scale", "scew", "translate" }));
- _floatArrays = Maps.newHashMap();
- _doubleArrays = Maps.newHashMap();
- _booleanArrays = Maps.newHashMap();
- _intArrays = Maps.newHashMap();
- _stringArrays = Maps.newHashMap();
+ _floatArrays = new HashMap<Element, float[]>();
+ _doubleArrays = new HashMap<Element, double[]>();
+ _booleanArrays = new HashMap<Element, boolean[]>();
+ _intArrays = new HashMap<Element, int[]>();
+ _stringArrays = new HashMap<Element, String[]>();
_vertMappings = ArrayListMultimap.create();
- _meshVertMap = Maps.newIdentityHashMap();
+ _meshVertMap = new IdentityHashMap<Mesh, VertMap>();
_parsedVertexColors = ArrayListMultimap.create();
- _materialInfoMap = Maps.newHashMap();
- _meshMaterialMap = Maps.newIdentityHashMap();
+ _materialInfoMap = new HashMap<String, MaterialInfo>();
+ _meshMaterialMap = new IdentityHashMap<Mesh, String>();
- _elementSpatialMapping = Maps.newHashMap();
+ _elementSpatialMapping = new HashMap<Element, Spatial>();
- _elementJointMapping = Maps.newHashMap();
- _externalJointMapping = Maps.newHashMap();
- _skeletons = Lists.newArrayList();
- _jointSkeletonMapping = Maps.newHashMap();
- _skeletonPoseMapping = Maps.newHashMap();
- _controllers = Lists.newArrayList();
+ _elementJointMapping = new HashMap<Element, Joint>();
+ _externalJointMapping = new HashMap<String, Joint>();
+ _skeletons = new ArrayList<Skeleton>();
+ _jointSkeletonMapping = new HashMap<Joint, Skeleton>();
+ _skeletonPoseMapping = new HashMap<Skeleton, SkeletonPose>();
+ _controllers = new ArrayList<ControllerStore>();
}
public void bindMaterial(final String ref, final Element material) {
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java
index 66a8c75..892f206 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java
@@ -10,15 +10,15 @@
package com.ardor3d.extension.model.collada.jdom.data;
+import java.util.ArrayList;
import java.util.List;
import com.ardor3d.extension.animation.skeletal.Joint;
import com.ardor3d.scenegraph.Node;
-import com.google.common.collect.Lists;
public class JointNode {
private JointNode parent;
- private final List<JointNode> children = Lists.newArrayList();
+ private final List<JointNode> children = new ArrayList<JointNode>();
private final Joint joint;
/** Scene node associated with the Joint. */
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java
index 91c918d..05c29ba 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java
@@ -10,20 +10,20 @@
package com.ardor3d.extension.model.collada.jdom.data;
+import java.util.HashMap;
import java.util.Map;
import com.ardor3d.image.Texture;
import com.ardor3d.renderer.state.MaterialState;
-import com.google.common.collect.Maps;
public class MaterialInfo {
private String _materialName;
private String _profile;
private String _technique;
- private final Map<String, String> _textureReferences = Maps.newHashMap();
- private final Map<String, Texture> _textures = Maps.newHashMap();
- private final Map<String, String> _textureFileNames = Maps.newHashMap();
+ private final Map<String, String> _textureReferences = new HashMap<String, String>();
+ private final Map<String, Texture> _textures = new HashMap<String, Texture>();
+ private final Map<String, String> _textureFileNames = new HashMap<String, String>();
private boolean _useTransparency;
private float _transparency = 1.0f;
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java
index 7fea027..c583e96 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java
@@ -22,7 +22,6 @@ import com.ardor3d.scenegraph.Node;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.export.Savable;
-import com.google.common.collect.Lists;
/**
* Data class used to hold references to useful objects created during parsing of a single Collada <skin> tag.
@@ -32,7 +31,7 @@ public class SkinData implements Savable {
private SkeletonPose _pose;
private Node _skinBaseNode;
- private final List<SkinnedMesh> _skins = Lists.newArrayList();
+ private final List<SkinnedMesh> _skins = new ArrayList<SkinnedMesh>();
private final String _name;
/**