diff options
10 files changed, 315 insertions, 317 deletions
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationManager.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationManager.java index 6a69e91..76fd763 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationManager.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationManager.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>. */ @@ -13,6 +13,7 @@ package com.ardor3d.extension.animation.skeletal; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.WeakHashMap; import com.ardor3d.extension.animation.skeletal.clip.AnimationClip; import com.ardor3d.extension.animation.skeletal.clip.AnimationClipInstance; @@ -22,7 +23,6 @@ import com.ardor3d.extension.animation.skeletal.util.LoggingMap; import com.ardor3d.scenegraph.Spatial; import com.ardor3d.util.ReadOnlyTimer; import com.ardor3d.util.Timer; -import com.google.common.collect.MapMaker; /** * <p> @@ -55,7 +55,7 @@ public class AnimationManager { protected final Spatial _sceneRoot; /** Local instance information for any clips referenced by the layers/blend trees in this manager. */ - protected final Map<AnimationClip, AnimationClipInstance> _clipInstances = new MapMaker().weakKeys().makeMap(); + protected final Map<AnimationClip, AnimationClipInstance> _clipInstances = new WeakHashMap<AnimationClip, AnimationClipInstance>(); /** A logic object responsible for taking animation data and applying it to skeleton poses. */ protected AnimationApplier _applier; @@ -101,7 +101,7 @@ public class AnimationManager { /** * Construct a new AnimationManager. - * + * * @param globalTimer * the timer to use for global time keeping. * @param pose @@ -113,7 +113,7 @@ public class AnimationManager { /** * Construct a new AnimationManager. - * + * * @param globalTimer * the timer to use for global time keeping. * @param pose @@ -162,7 +162,7 @@ public class AnimationManager { } /** - * + * * @return True if clips will reset if the currentUpdateState is Stop. */ public boolean isResetClipsOnStop() { @@ -172,8 +172,8 @@ public class AnimationManager { /** * @param resetClipsOnStop * True if clips are to be reset when currentUpdateState is Stop, false otherwise. - * - * + * + * */ public void setResetClipsOnStop(final boolean resetClipsOnStop) { _resetClipsOnStop = resetClipsOnStop; @@ -258,7 +258,7 @@ public class AnimationManager { /** * Notify any listeners of the state change - * + * * @param oldState * previous state */ @@ -270,7 +270,7 @@ public class AnimationManager { /** * Add an AnimationUpdateStateListener to this manager. - * + * * @param listener * the listener to add. */ @@ -280,7 +280,7 @@ public class AnimationManager { /** * Remove an AnimationUpdateStateListener from this manager. - * + * * @param listener * the listener to remove. * @return true if the listener was found @@ -426,7 +426,7 @@ public class AnimationManager { /** * Retrieve and track an instance of an animation clip to be used with this manager. - * + * * @param clip * the clip to instance. * @return our new clip instance. @@ -444,7 +444,7 @@ public class AnimationManager { /** * Retrieve an existing clip instance being tracked by this manager. - * + * * @param clipName * the name of the clip to find an existing instance of. Case sensitive. * @return our existing clip instance, or null if we were not tracking a clip of the given name. @@ -461,7 +461,7 @@ public class AnimationManager { /** * Retrieve an existing clip tracked by this manager. - * + * * @param clipName * the name of the clip to find. Case sensitive. * @return our existing clip, or null if we were not tracking a clip of the given name. @@ -478,7 +478,7 @@ public class AnimationManager { /** * Rewind and reactivate the clip instance associated with the given clip. - * + * * @param clip * the clip to pull the instance for. * @param globalStartTime @@ -520,7 +520,7 @@ public class AnimationManager { /** * Add a new layer to our list of animation layers. - * + * * @param layer * the layer to add. * @return the index of our added layer in our list of animation layers. @@ -533,7 +533,7 @@ public class AnimationManager { /** * Insert a given animation layer into our list of layers. - * + * * @param layer * the layer to insert. * @param index diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/SimpleAnimationApplier.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/SimpleAnimationApplier.java index 31fef67..4d050ad 100644 --- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/SimpleAnimationApplier.java +++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/SimpleAnimationApplier.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>. */ @@ -11,6 +11,7 @@ package com.ardor3d.extension.animation.skeletal.blendtree; import java.util.Map; +import java.util.WeakHashMap; import com.ardor3d.extension.animation.skeletal.AnimationApplier; import com.ardor3d.extension.animation.skeletal.AnimationManager; @@ -22,7 +23,6 @@ import com.ardor3d.extension.animation.skeletal.clip.TriggerData; import com.ardor3d.scenegraph.Node; import com.ardor3d.scenegraph.Spatial; import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.MapMaker; import com.google.common.collect.Multimap; /** @@ -32,7 +32,7 @@ public class SimpleAnimationApplier implements AnimationApplier { private final Multimap<String, TriggerCallback> _triggerCallbacks = ArrayListMultimap.create(0, 0); - private final Map<String, Spatial> _spatialCache = new MapMaker().weakValues().makeMap(); + private final Map<String, Spatial> _spatialCache = new WeakHashMap<String, Spatial>(); @Override public void apply(final Spatial root, final AnimationManager manager) { diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java index bfe0c1d..cbdfcca 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java +++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.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>. */ @@ -14,12 +14,12 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.WeakHashMap; import com.ardor3d.scenegraph.Mesh; import com.ardor3d.scenegraph.Node; import com.ardor3d.scenegraph.Spatial; import com.google.common.collect.ImmutableList; -import com.google.common.collect.MapMaker; /** * CollisionTreeManager is an automated system for handling the creation and deletion of CollisionTrees. The manager @@ -46,7 +46,7 @@ import com.google.common.collect.MapMaker; * default, the manager will use the UsageTreeController for removing trees, but any other CollisionTreeController is * acceptable. You can create protected tree manually. These are collision trees that you request the manager to create * and not allow them to be removed by the CollisionTreeController. - * + * * @see com.ardor3d.bounding.CollisionTree * @see com.ardor3d.bounding.CollisionTreeController */ @@ -80,14 +80,14 @@ public enum CollisionTreeManager { * private constructor for the Singleton. Initializes the cache. */ private CollisionTreeManager() { - _cache = new MapMaker().weakKeys().makeMap(); + _cache = new WeakHashMap<Mesh, CollisionTree>(); _protectedList = Collections.synchronizedList(new ArrayList<Mesh>(1)); setCollisionTreeController(new UsageTreeController()); } /** * retrieves the singleton instance of the CollisionTreeManager. - * + * * @return the singleton instance of the manager. */ public static CollisionTreeManager getInstance() { @@ -108,7 +108,7 @@ public enum CollisionTreeManager { /** * sets the CollisionTreeController used for cleaning the cache when the maximum number of elements is reached. - * + * * @param treeRemover * the controller used to clean the cache. */ @@ -119,7 +119,7 @@ public enum CollisionTreeManager { /** * getCollisionTree obtains a collision tree that is assigned to a supplied Mesh. The cache is checked for a * pre-existing tree, if none is available and generateTrees is true, a new tree is created and returned. - * + * * @param mesh * the mesh to use as the key for the tree to obtain. * @return the tree associated with a given mesh @@ -148,7 +148,7 @@ public enum CollisionTreeManager { * creates a new collision tree for the provided spatial. If the spatial is a node, it recursively calls * generateCollisionTree for each child. If it is a Mesh, a call to generateCollisionTree is made for each mesh. If * this tree(s) is to be protected, i.e. not deleted by the CollisionTreeController, set protect to true. - * + * * @param type * the type of collision tree to generate. * @param object @@ -174,7 +174,7 @@ public enum CollisionTreeManager { * The tree is placed in the cache. If the cache's size then becomes too large, the cache is sent to the * CollisionTreeController for clean-up. If this tree is to be protected, i.e. protected from the * CollisionTreeController, set protect to true. - * + * * @param type * the type of collision tree to generate. * @param mesh @@ -200,7 +200,7 @@ public enum CollisionTreeManager { * placed in the cache. If the cache's size then becomes too large, the cache is sent to the CollisionTreeController * for clean-up. If this tree is to be protected, i.e. protected from the CollisionTreeController, set protect to * true. - * + * * @param tree * the tree to use for generation * @param mesh @@ -226,7 +226,7 @@ public enum CollisionTreeManager { /** * removes a collision tree from the manager based on the mesh supplied. - * + * * @param mesh * the mesh to remove the corresponding collision tree. */ @@ -237,7 +237,7 @@ public enum CollisionTreeManager { /** * removes all collision trees associated with a Spatial object. - * + * * @param object * the spatial to remove all collision trees from. */ @@ -255,7 +255,7 @@ public enum CollisionTreeManager { /** * updates the existing tree for a supplied mesh. If this tree does not exist, the tree is not updated. If the tree * is not in the cache, no further operations are handled. - * + * * @param mesh * the mesh key for the tree to update. */ @@ -269,7 +269,7 @@ public enum CollisionTreeManager { /** * updates the existing tree(s) for a supplied spatial. If this tree does not exist, the tree is not updated. If the * tree is not in the cache, no further operations are handled. - * + * * @param object * the object on which to update the tree. */ @@ -286,7 +286,7 @@ public enum CollisionTreeManager { /** * returns true if the manager is set to sort new generated trees. False otherwise. - * + * * @return true to sort tree, false otherwise. */ public boolean isDoSort() { @@ -295,7 +295,7 @@ public enum CollisionTreeManager { /** * set if this manager should have newly generated trees sort primitives. - * + * * @param doSort * true to sort trees, false otherwise. */ @@ -305,7 +305,7 @@ public enum CollisionTreeManager { /** * returns true if the manager will automatically generate new trees as needed, false otherwise. - * + * * @return true if this manager is generating trees, false otherwise. */ public boolean isGenerateTrees() { @@ -314,7 +314,7 @@ public enum CollisionTreeManager { /** * set if this manager should generate new trees as needed. - * + * * @param generateTrees * true to generate trees, false otherwise. */ @@ -341,7 +341,7 @@ public enum CollisionTreeManager { /** * returns the maximum number of primitives a leaf of the collision tree may contain. - * + * * @return the maximum number of primitives a leaf may contain. */ public int getMaxPrimitivesPerLeaf() { @@ -350,7 +350,7 @@ public enum CollisionTreeManager { /** * set the maximum number of primitives a leaf of the collision tree may contain. - * + * * @param maxPrimitivesPerLeaf * the maximum number of primitives a leaf may contain. */ @@ -360,7 +360,7 @@ public enum CollisionTreeManager { /** * returns the maximum number of CollisionTree elements this manager will hold on to before starting to clear some. - * + * * @return the maximum number of CollisionTree elements. */ public int getMaxElements() { @@ -369,7 +369,7 @@ public enum CollisionTreeManager { /** * set the maximum number of CollisionTree elements this manager will hold on to before starting to clear some. - * + * * @param maxElements * the maximum number of CollisionTree elements. */ @@ -381,7 +381,7 @@ public enum CollisionTreeManager { * Add the given mesh to our "protected" list. This will signal to our cleanup operation that when deciding which * trees to trim in an effort to keep our cache size to a certain desired size, do not trim the tree associated with * this mesh. - * + * * @param meshToProtect * the mesh whose CollisionTree we want to protect. */ @@ -393,7 +393,7 @@ public enum CollisionTreeManager { /** * Removes the supplied mesh from the "protected" list. - * + * * @param mesh */ public void removeProtected(final Mesh mesh) { @@ -401,7 +401,7 @@ public enum CollisionTreeManager { } /** - * + * * @return an immutable copy of the list of protected meshes. */ public List<Mesh> getProtectedMeshes() { diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java index efcd33a..ed46ec9 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.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>. */ @@ -13,8 +13,7 @@ package com.ardor3d.renderer; import java.util.ArrayList; import java.util.List; import java.util.Map; - -import com.google.common.collect.MapMaker; +import java.util.WeakHashMap; public class ContextManager { @@ -22,7 +21,7 @@ public class ContextManager { private static List<ContextCleanListener> _cleanListeners = new ArrayList<ContextCleanListener>(); - protected static final Map<Object, RenderContext> contextStore = new MapMaker().weakKeys().makeMap(); + protected static final Map<Object, RenderContext> contextStore = new WeakHashMap<Object, RenderContext>(); /** * @return a RenderContext object representing the current OpenGL context. @@ -53,7 +52,7 @@ public class ContextManager { /** * Find the first context we manage that uses the given shared opengl context. - * + * * @param glref * @return */ diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java index 6eb0b3d..2581a89 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.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>. */ @@ -15,6 +15,7 @@ import java.lang.ref.ReferenceQueue; import java.nio.Buffer; import java.util.Map; import java.util.Set; +import java.util.WeakHashMap; import com.ardor3d.renderer.ContextCleanListener; import com.ardor3d.renderer.ContextManager; @@ -27,12 +28,11 @@ import com.ardor3d.util.GameTaskQueueManager; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.MapMaker; import com.google.common.collect.Multimap; public abstract class AbstractBufferData<T extends Buffer> { - private static Map<AbstractBufferData<?>, Object> _identityCache = new MapMaker().weakKeys().makeMap(); + private static Map<AbstractBufferData<?>, Object> _identityCache = new WeakHashMap<AbstractBufferData<?>, Object>(); private static final Object STATIC_REF = new Object(); private static ReferenceQueue<AbstractBufferData<?>> _vboRefQueue = new ReferenceQueue<AbstractBufferData<?>>(); @@ -73,7 +73,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Gets the count. - * + * * @return the count */ public int getBufferLimit() { @@ -86,7 +86,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Gets the count. - * + * * @return the count */ public int getBufferCapacity() { @@ -99,7 +99,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Get the buffer holding the data. - * + * * @return the buffer */ public T getBuffer() { @@ -108,7 +108,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Set the buffer holding the data. - * + * * @param buffer * the buffer to set */ @@ -134,7 +134,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Removes any vbo id from this buffer's data for the given OpenGL context. - * + * * @param glContext * the object representing the OpenGL context a vbo would belong to. See * {@link RenderContext#getGlContextRep()} @@ -150,7 +150,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Sets the id for a vbo based on this buffer's data in regards to the given OpenGL context. - * + * * @param glContextRep * the object representing the OpenGL context a vbo belongs to. See * {@link RenderContext#getGlContextRep()} @@ -235,7 +235,7 @@ public abstract class AbstractBufferData<T extends Buffer> { /** * Clean any VBO ids from the hardware, using the given Renderer object to do the work immediately, if given. If * not, we will delete in the next execution of the appropriate context's game task render queue. - * + * * @param deleter * the Renderer to use. If null, execution will not occur immediately. */ diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java index 9b13518..911e69d 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.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>. */ @@ -19,6 +19,7 @@ import java.nio.ShortBuffer; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.WeakHashMap; import java.util.logging.Logger; import com.ardor3d.math.MathUtils; @@ -32,7 +33,6 @@ import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; import com.ardor3d.util.geom.BufferUtils; -import com.google.common.collect.MapMaker; /** * MeshData contains all the commonly used buffers for rendering a mesh. @@ -71,7 +71,7 @@ public class MeshData implements Savable { /** * Gets the vertex count. - * + * * @return the vertex count */ public int getVertexCount() { @@ -80,7 +80,7 @@ public class MeshData implements Savable { /** * Gets the vertex buffer. - * + * * @return the vertex buffer */ public FloatBuffer getVertexBuffer() { @@ -92,7 +92,7 @@ public class MeshData implements Savable { /** * Sets the vertex buffer. - * + * * @param vertexBuffer * the new vertex buffer */ @@ -107,7 +107,7 @@ public class MeshData implements Savable { /** * Gets the vertex coords. - * + * * @return the vertex coords */ public FloatBufferData getVertexCoords() { @@ -122,7 +122,7 @@ public class MeshData implements Savable { /** * Sets the vertex coords. - * + * * @param bufferData * the new vertex coords */ @@ -134,7 +134,7 @@ public class MeshData implements Savable { /** * Gets the normal buffer. - * + * * @return the normal buffer */ public FloatBuffer getNormalBuffer() { @@ -146,7 +146,7 @@ public class MeshData implements Savable { /** * Sets the normal buffer. - * + * * @param normalBuffer * the new normal buffer */ @@ -161,7 +161,7 @@ public class MeshData implements Savable { /** * Gets the normal coords. - * + * * @return the normal coords */ public FloatBufferData getNormalCoords() { @@ -170,7 +170,7 @@ public class MeshData implements Savable { /** * Sets the normal coords. - * + * * @param bufferData * the new normal coords */ @@ -181,7 +181,7 @@ public class MeshData implements Savable { /** * Gets the color buffer. - * + * * @return the color buffer */ public FloatBuffer getColorBuffer() { @@ -193,7 +193,7 @@ public class MeshData implements Savable { /** * Sets the color buffer. - * + * * @param colorBuffer * the new color buffer */ @@ -208,7 +208,7 @@ public class MeshData implements Savable { /** * Gets the color coords. - * + * * @return the color coords */ public FloatBufferData getColorCoords() { @@ -217,7 +217,7 @@ public class MeshData implements Savable { /** * Sets the color coords. - * + * * @param bufferData * the new color coords */ @@ -228,7 +228,7 @@ public class MeshData implements Savable { /** * Gets the fog buffer. - * + * * @return the fog buffer */ public FloatBuffer getFogBuffer() { @@ -240,7 +240,7 @@ public class MeshData implements Savable { /** * Sets the fog buffer. - * + * * @param fogBuffer * the new fog buffer */ @@ -254,7 +254,7 @@ public class MeshData implements Savable { /** * Gets the fog coords. - * + * * @return the fog coords */ public FloatBufferData getFogCoords() { @@ -263,7 +263,7 @@ public class MeshData implements Savable { /** * Sets the fog coords. - * + * * @param bufferData * the new fog coords */ @@ -273,7 +273,7 @@ public class MeshData implements Savable { /** * Gets the tangent buffer. - * + * * @return the tangent buffer */ public FloatBuffer getTangentBuffer() { @@ -285,7 +285,7 @@ public class MeshData implements Savable { /** * Sets the tangent buffer. - * + * * @param tangentBuffer * the new tangent buffer */ @@ -299,7 +299,7 @@ public class MeshData implements Savable { /** * Gets the tangent coords. - * + * * @return the tangent coords */ public FloatBufferData getTangentCoords() { @@ -308,7 +308,7 @@ public class MeshData implements Savable { /** * Sets the tangent coords. - * + * * @param bufferData * the new tangent coords */ @@ -318,10 +318,10 @@ public class MeshData implements Savable { /** * Gets the FloatBuffer of the FloatBufferData set on a given texture unit. - * + * * @param index * the unit index - * + * * @return the texture buffer for the given index, or null if none was set. */ public FloatBuffer getTextureBuffer(final int index) { @@ -338,7 +338,7 @@ public class MeshData implements Savable { /** * Sets the texture buffer for a given texture unit index. Interprets it as a 2 component float buffer data. If you * need other sizes, use setTextureCoords instead. - * + * * @param textureBuffer * the texture buffer * @param index @@ -359,7 +359,7 @@ public class MeshData implements Savable { /** * Gets the texture coords. - * + * * @return the texture coords */ public List<FloatBufferData> getTextureCoords() { @@ -368,10 +368,10 @@ public class MeshData implements Savable { /** * Gets the texture coords assigned to a specific texture unit index of this MeshData. - * + * * @param index * the texture unit index - * + * * @return the texture coords */ public FloatBufferData getTextureCoords(final int index) { @@ -383,7 +383,7 @@ public class MeshData implements Savable { /** * Sets all texture coords on this MeshData. - * + * * @param textureCoords * the new texture coords */ @@ -394,7 +394,7 @@ public class MeshData implements Savable { /** * Sets the texture coords of a specific texture unit index to the given FloatBufferData. - * + * * @param textureCoords * the texture coords * @param index @@ -410,7 +410,7 @@ public class MeshData implements Savable { /** * Retrieves the interleaved buffer, if set or created through packInterleaved. - * + * * @return the interleaved buffer */ public FloatBuffer getInterleavedBuffer() { @@ -422,7 +422,7 @@ public class MeshData implements Savable { /** * Gets the interleaved data. - * + * * @return the interleaved data */ public FloatBufferData getInterleavedData() { @@ -431,7 +431,7 @@ public class MeshData implements Savable { /** * Sets the interleaved data. - * + * * @param interleavedData * the interleaved data */ @@ -458,7 +458,7 @@ public class MeshData implements Savable { /** * <code>copyTextureCoords</code> copies the texture coordinates of a given texture unit to another location. If the * texture unit is not valid, then the coordinates are ignored. Coords are multiplied by the given factor. - * + * * @param fromIndex * the coordinates to copy. * @param toIndex @@ -504,7 +504,7 @@ public class MeshData implements Savable { /** * <code>copyTextureCoords</code> copies the texture coordinates of a given texture unit to another location. If the * texture unit is not valid, then the coordinates are ignored. Coords are multiplied by the given S and T factors. - * + * * @param fromIndex * the coordinates to copy. * @param toIndex @@ -555,7 +555,7 @@ public class MeshData implements Savable { /** * <code>getNumberOfUnits</code> returns the number of texture units this geometry is currently using. - * + * * @return the number of texture units in use. */ public int getNumberOfUnits() { @@ -567,7 +567,7 @@ public class MeshData implements Savable { /** * Gets the index buffer. - * + * * @return the index buffer */ public Buffer getIndexBuffer() { @@ -579,7 +579,7 @@ public class MeshData implements Savable { /** * Sets the index buffer. - * + * * @param indices * the new index buffer */ @@ -595,7 +595,7 @@ public class MeshData implements Savable { /** * Sets the index buffer. - * + * * @param indices * the new index buffer */ @@ -611,7 +611,7 @@ public class MeshData implements Savable { /** * Sets the index buffer. - * + * * @param indices * the new index buffer */ @@ -627,7 +627,7 @@ public class MeshData implements Savable { /** * Gets the indices. - * + * * @return the indices */ public IndexBufferData<?> getIndices() { @@ -636,7 +636,7 @@ public class MeshData implements Savable { /** * Sets the indices - * + * * @param bufferData * the new indices */ @@ -648,7 +648,7 @@ public class MeshData implements Savable { /** * Gets the index mode. - * + * * @return the IndexMode of the first section of this MeshData. * @deprecated Please switch to {@link #getIndexMode(int)} */ @@ -659,7 +659,7 @@ public class MeshData implements Savable { /** * Sets the index mode. - * + * * @param indexMode * the new IndexMode to use for the first section of this MeshData. */ @@ -671,7 +671,7 @@ public class MeshData implements Savable { /** * Gets the index lengths. - * + * * @return the index lengths */ public int[] getIndexLengths() { @@ -680,7 +680,7 @@ public class MeshData implements Savable { /** * Sets the index lengths. - * + * * @param indexLengths * the new index lengths */ @@ -692,7 +692,7 @@ public class MeshData implements Savable { /** * Gets the index modes. - * + * * @return the index modes */ public IndexMode[] getIndexModes() { @@ -701,10 +701,10 @@ public class MeshData implements Savable { /** * Gets the index mode. - * + * * @param sectionIndex * the section index - * + * * @return the index mode */ public IndexMode getIndexMode(final int sectionIndex) { @@ -716,7 +716,7 @@ public class MeshData implements Savable { /** * Note: Also updates primitive counts. - * + * * @param indexModes * the index modes to use for this MeshData. */ @@ -728,7 +728,7 @@ public class MeshData implements Savable { /** * Gets the section count. - * + * * @return the number of sections (lengths, indexModes, etc.) this MeshData contains. */ public int getSectionCount() { @@ -737,7 +737,7 @@ public class MeshData implements Savable { /** * Gets the total primitive count. - * + * * @return the sum of the primitive counts on all sections of this mesh data. */ public int getTotalPrimitiveCount() { @@ -750,10 +750,10 @@ public class MeshData implements Savable { /** * Gets the primitive count. - * + * * @param section * the section - * + * * @return the number of primitives (triangles, quads, lines, points, etc.) on a given section of this mesh data. */ public int getPrimitiveCount(final int section) { @@ -762,7 +762,7 @@ public class MeshData implements Savable { /** * Returns the vertex indices of a specified primitive. - * + * * @param primitiveIndex * which triangle, quad, etc * @param section @@ -770,9 +770,9 @@ public class MeshData implements Savable { * @param store * an int array to store the results in. if null, or the length < the size of the primitive, a new array * is created and returned. - * + * * @return the primitive's vertex indices as an array - * + * * @throws IndexOutOfBoundsException * if primitiveIndex is outside of range [0, count-1] where count is the number of primitives in the * given section. @@ -806,14 +806,14 @@ public class MeshData implements Savable { /** * Gets the vertices that make up the given primitive. - * + * * @param primitiveIndex * the primitive index * @param section * the section * @param store * the store. If null or the wrong size, we'll make a new array and return that instead. - * + * * @return the primitive */ public Vector3[] getPrimitiveVertices(final int primitiveIndex, final int section, final Vector3[] store) { @@ -840,7 +840,7 @@ public class MeshData implements Savable { } else { // non-indexed geometry BufferUtils - .populateFromBuffer(result[i], getVertexBuffer(), getVertexIndex(primitiveIndex, i, section)); + .populateFromBuffer(result[i], getVertexBuffer(), getVertexIndex(primitiveIndex, i, section)); } } @@ -849,7 +849,7 @@ public class MeshData implements Savable { /** * Gets the texture coordinates of the primitive. - * + * * @param primitiveIndex * the primitive index * @param section @@ -858,7 +858,7 @@ public class MeshData implements Savable { * the texture index * @param store * the store - * + * * @return the texture coordinates of the primitive */ public Vector2[] getPrimitiveTextureCoords(final int primitiveIndex, final int section, final int textureIndex, @@ -894,14 +894,14 @@ public class MeshData implements Savable { /** * Gets the vertex index. - * + * * @param primitiveIndex * which triangle, quad, etc. * @param point * which point on the triangle, quad, etc. (triangle has three points, so this would be 0-2, etc.) * @param section * which section to pull from (corresponds to array position in indexmodes and lengths) - * + * * @return the position you would expect to find the given point in the index buffer */ public int getVertexIndex(final int primitiveIndex, final int point, final int section) { @@ -956,10 +956,10 @@ public class MeshData implements Savable { /** * Random vertex. - * + * * @param store * the vector object to store the result in. if null, a new one is created. - * + * * @return a random vertex from the vertices stored in this MeshData. null is returned if there are no vertices. */ public Vector3 randomVertex(final Vector3 store) { @@ -980,10 +980,10 @@ public class MeshData implements Savable { /** * Random point on primitives. - * + * * @param store * the vector object to store the result in. if null, a new one is created. - * + * * @return a random point from the surface of a primitive stored in this MeshData. null is returned if there are no * vertices or indices. */ @@ -1082,7 +1082,7 @@ public class MeshData implements Savable { /** * Translate points. - * + * * @param x * the x * @param y @@ -1096,7 +1096,7 @@ public class MeshData implements Savable { /** * Translate points. - * + * * @param amount * the amount */ @@ -1129,7 +1129,7 @@ public class MeshData implements Savable { /** * Rotate points. - * + * * @param rotate * the rotate */ @@ -1144,7 +1144,7 @@ public class MeshData implements Savable { /** * Rotate normals. - * + * * @param rotate * the rotate */ @@ -1189,7 +1189,7 @@ public class MeshData implements Savable { /** * Sets the id for a vbo based on interleaving this MeshData's buffer, in regards to the given OpenGL context. - * + * * @param glContext * the object representing the OpenGL context a vbo belongs to. See * {@link RenderContext#getGlContextRep()} @@ -1204,7 +1204,7 @@ public class MeshData implements Savable { } if (_vboIdCache == null) { - _vboIdCache = new MapMaker().initialCapacity(1).weakKeys().makeMap(); + _vboIdCache = new WeakHashMap<Object, Integer>(1); } _vboIdCache.put(glContext, vboId); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java index dc837f3..c657032 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.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>. */ @@ -17,6 +17,7 @@ import java.util.EnumMap; import java.util.EnumSet; import java.util.List; import java.util.Map; +import java.util.WeakHashMap; import java.util.logging.Level; import java.util.logging.Logger; @@ -52,7 +53,6 @@ import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.export.Savable; import com.ardor3d.util.scenegraph.RenderDelegate; -import com.google.common.collect.MapMaker; /** * Base class for all scenegraph objects. @@ -123,7 +123,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Constructs a new <code>Spatial</code> with a given name. - * + * * @param name * the name of the spatial. This is required for identification purposes. */ @@ -134,7 +134,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Returns the name of this spatial. - * + * * @return This spatial's name. */ public String getName() { @@ -143,7 +143,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the name of this Spatial. - * + * * @param name * new name */ @@ -153,7 +153,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the render delegate. - * + * * @param delegate * the new delegate, or null for default behavior * @param glContextRef @@ -165,7 +165,7 @@ public abstract class Spatial implements Savable, Hintable { if (delegate == null) { return; } else { - _delegateMap = new MapMaker().weakKeys().makeMap(); + _delegateMap = new WeakHashMap<Object, RenderDelegate>(); } } if (delegate != null) { @@ -188,7 +188,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the render delegate. - * + * * @param glContextRef * if null, retrieve the default render delegate for this spatial. Otherwise, retrieve the delegate used * when this Spatial is rendered in a RenderContext tied to the given glContextRef. @@ -207,7 +207,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>getParent</code> retrieve's this node's parent. If the parent is null this is the root node. - * + * * @return the parent of this node. */ public Node getParent() { @@ -217,7 +217,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Called by {@link Node#attachChild(Spatial)} and {@link Node#detachChild(Spatial)} - don't call directly. * <code>setParent</code> sets the parent of this node. - * + * * @param parent * the parent of this node. */ @@ -227,7 +227,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>removeFromParent</code> removes this Spatial from it's parent. - * + * * @return true if it has a parent and performed the remove. */ public boolean removeFromParent() { @@ -240,7 +240,7 @@ public abstract class Spatial implements Savable, Hintable { /** * determines if the provided Node is the parent, or parent's parent, etc. of this Spatial. - * + * * @param ancestor * the ancestor object to look for. * @return true if the ancestor is found, false otherwise. @@ -265,7 +265,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the scene hints. - * + * * @return the scene hints set on this Spatial */ @Override @@ -275,7 +275,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Returns the listener for dirty events on this node, if set. - * + * * @return the listener */ public DirtyEventListener getListener() { @@ -284,7 +284,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the listener for dirty events on this node. - * + * * @param listener * listener to use. */ @@ -294,7 +294,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Mark this node as dirty. Can be marked as Transform, Bounding, Attached, Detached, Destroyed or RenderState - * + * * @param dirtyType * the dirty type */ @@ -304,7 +304,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Mark this node as dirty. Can be marked as Transform, Bounding, Attached, Detached, Destroyed or RenderState - * + * * @param caller * the spatial where the marking was initiated * @param dirtyType @@ -346,7 +346,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Test if this spatial is marked as dirty in respect to the supplied DirtyType. - * + * * @param dirtyType * dirty type to test against * @return true if spatial marked dirty against the supplied dirty type @@ -357,7 +357,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Clears the dirty flag set at this spatial for the supplied dirty type. - * + * * @param dirtyType * dirty type to clear flag for */ @@ -367,7 +367,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Clears the dirty flag set at this spatial for the supplied dirty type. - * + * * @param caller * the spatial where the clearing was initiated * @param dirtyType @@ -381,7 +381,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Propagate the dirty mark up the tree hierarchy. - * + * * @param dirtyTypes * the dirty types */ @@ -395,7 +395,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Propagate the dirty mark down the tree hierarchy. - * + * * @param dirtyTypes * the dirty types */ @@ -406,7 +406,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Propagate the dirty event up the hierarchy. If a listener is found on the spatial the event is fired and the * propagation is stopped. - * + * * @param spatial * the spatial * @param dirtyType @@ -431,7 +431,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the local rotation matrix. - * + * * @return the rotation */ public ReadOnlyMatrix3 getRotation() { @@ -440,7 +440,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the local scale vector. - * + * * @return the scale */ public ReadOnlyVector3 getScale() { @@ -449,7 +449,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the local translation vector. - * + * * @return the translation */ public ReadOnlyVector3 getTranslation() { @@ -458,7 +458,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the local transform. - * + * * @return the transform */ public ReadOnlyTransform getTransform() { @@ -467,7 +467,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the local transform. - * + * * @param transform * the new transform */ @@ -478,7 +478,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world rotation matrix. - * + * * @param rotation * the new world rotation */ @@ -488,7 +488,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world rotation quaternion. - * + * * @param rotation * the new world rotation */ @@ -498,7 +498,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world scale. - * + * * @param scale * the new world scale vector */ @@ -508,7 +508,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world scale. - * + * * @param x * the x coordinate * @param y @@ -522,7 +522,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world scale. - * + * * @param scale * the new world scale */ @@ -532,7 +532,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world translation vector. - * + * * @param translation * the new world translation */ @@ -542,7 +542,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world translation. - * + * * @param x * the x coordinate * @param y @@ -556,7 +556,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the world transform. - * + * * @param transform * the new world transform */ @@ -566,7 +566,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the rotation of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param rotation * the new rotation of this spatial * @see Transform#setRotation(Matrix3) @@ -578,7 +578,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the rotation of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param rotation * the new rotation of this spatial * @see Transform#setRotation(Quaternion) @@ -590,7 +590,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>setScale</code> sets the scale of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param scale * the new scale of this spatial */ @@ -601,7 +601,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>setScale</code> sets the scale of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param scale * the new scale of this spatial */ @@ -612,7 +612,7 @@ public abstract class Spatial implements Savable, Hintable { /** * sets the scale of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param x * the x scale factor * @param y @@ -627,7 +627,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>setTranslation</code> sets the translation of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param translation * the new translation of this spatial */ @@ -638,7 +638,7 @@ public abstract class Spatial implements Savable, Hintable { /** * sets the translation of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param x * the x coordinate * @param y @@ -654,7 +654,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>addTranslation</code> adds the given translation to the translation of this spatial. This marks the spatial * as DirtyType.Transform. - * + * * @param translation * the translation vector */ @@ -664,7 +664,7 @@ public abstract class Spatial implements Savable, Hintable { /** * adds to the current translation of this spatial. This marks the spatial as DirtyType.Transform. - * + * * @param x * the x amount * @param y @@ -679,7 +679,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the world rotation matrix. - * + * * @return the world rotation */ public ReadOnlyMatrix3 getWorldRotation() { @@ -688,7 +688,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the world scale vector. - * + * * @return the world scale */ public ReadOnlyVector3 getWorldScale() { @@ -697,7 +697,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the world translation vector. - * + * * @return the world translation */ public ReadOnlyVector3 getWorldTranslation() { @@ -706,7 +706,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the world transform. - * + * * @return the world transform */ public ReadOnlyTransform getWorldTransform() { @@ -715,7 +715,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>getWorldBound</code> retrieves the world bound at this level. - * + * * @return the world bound at this level. */ public BoundingVolume getWorldBound() { @@ -727,7 +727,7 @@ public abstract class Spatial implements Savable, Hintable { * method is called. * <p> * This method is called by the renderer. Usually it should not be called directly. - * + * * @param r * the renderer used for display. */ @@ -762,7 +762,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>draw</code> abstract method that handles drawing data to the renderer if it is geometry and passing the * call to it's children if it is a node. - * + * * @param renderer * the renderer used for display. */ @@ -770,7 +770,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Grab the render delegate for this spatial based on the currently set RenderContext. - * + * * @return the delegate or null if a delegate was not found. */ protected RenderDelegate getCurrentRenderDelegate() { @@ -794,7 +794,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Update geometric state. - * + * * @param time * The time in seconds between the last two consecutive frames (time per frame). See * {@link ReadOnlyTimer#getTimePerFrame()} @@ -806,7 +806,7 @@ public abstract class Spatial implements Savable, Hintable { /** * <code>updateGeometricState</code> updates all the geometry information for the node. - * + * * @param time * The time in seconds between the last two consecutive frames (time per frame). See * {@link ReadOnlyTimer#getTimePerFrame()} @@ -841,7 +841,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Override to allow objects like Node to update their children. - * + * * @param time * The time in seconds between the last two consecutive frames (time per frame). See * {@link ReadOnlyTimer#getTimePerFrame()} @@ -850,7 +850,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Update all controllers set on this spatial. - * + * * @param time * The time in seconds between the last two consecutive frames (time per frame). See * {@link ReadOnlyTimer#getTimePerFrame()} @@ -875,7 +875,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Updates the worldTransform. - * + * * @param recurse * usually false when updating the tree. Set to true when you just want to update the world transforms * for a branch without updating geometric state. @@ -891,7 +891,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Convert a vector (in) from this spatial's local coordinate space to world coordinate space. - * + * * @param in * vector to read from * @param store @@ -908,7 +908,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Convert a vector (in) from world coordinate space to this spatial's local coordinate space. - * + * * @param in * vector to read from * @param store @@ -926,7 +926,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Updates the render state values of this Spatial and and children it has. Should be called whenever render states * change. - * + * * @param recurse * true to recurse down the scenegraph tree */ @@ -936,7 +936,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Called internally. Updates the render states of this Spatial. The stack contains parent render states. - * + * * @param recurse * true to recurse down the scenegraph tree * @param stateStack @@ -967,7 +967,7 @@ public abstract class Spatial implements Savable, Hintable { /** * The method actually implements how the render states are applied to this spatial and (if recurse is true) any * children it may have. By default, this function does nothing. - * + * * @param recurse * true to recurse down the scenegraph tree * @param stack @@ -982,7 +982,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Retrieves the complete renderstate list. - * + * * @return the list of renderstates */ public EnumMap<StateType, RenderState> getLocalRenderStates() { @@ -993,7 +993,7 @@ public abstract class Spatial implements Savable, Hintable { * <code>setRenderState</code> sets a render state for this node. Note, there can only be one render state per type * per node. That is, there can only be a single BlendState a single TextureState, etc. If there is already a render * state for a type set the old render state will be returned. Otherwise, null is returned. - * + * * @param rs * the render state to add. * @return the old render state. @@ -1014,7 +1014,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Returns the requested RenderState that this Spatial currently has set or null if none is set. - * + * * @param type * the state type to retrieve * @return a render state at the given position or null @@ -1025,7 +1025,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Clears a given render state index by setting it to null. - * + * * @param type * The type of RenderState to clear */ @@ -1037,7 +1037,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Called during updateRenderState(Stack[]), this function goes up the scene graph tree until the parent is null and * pushes RenderStates onto the states Stack array. - * + * * @param stack * The stack to push any parent states onto. */ @@ -1057,7 +1057,7 @@ public abstract class Spatial implements Savable, Hintable { * updates the bounding volume of the world. Abstract, geometry transforms the bound while node merges the * children's bound. In most cases, users will want to call updateModelBound() and let this function be called * automatically during updateGeometricState(). - * + * * @param recurse * true to recurse down the scenegraph tree */ @@ -1075,7 +1075,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the Spatial specific user data. - * + * * @return the user data */ public Object getUserData() { @@ -1084,7 +1084,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Sets the Spatial specific user data. - * + * * @param userData * Some Spatial specific user data. Note: If this object is not explicitly of type Savable, it will be * ignored during read/write. @@ -1095,7 +1095,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Adds a SpatialController to this Spatial's list of controllers. - * + * * @param controller * The SpatialController to add * @see com.ardor3d.scenegraph.controller.SpatialController @@ -1109,7 +1109,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Removes a SpatialController from this Spatial's list of controllers, if it exist. - * + * * @param controller * The SpatialController to remove * @return True if the SpatialController was in the list to remove. @@ -1124,7 +1124,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Removes a SpatialController from this Spatial's list of controllers by index. - * + * * @param index * The index of the controller to remove * @return The SpatialController removed or null if nothing was removed. @@ -1139,7 +1139,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Removes all Controllers from this Spatial's list of controllers. - * + * * @see com.ardor3d.scenegraph.controller.SpatialController */ public void clearControllers() { @@ -1150,7 +1150,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Returns the controller in this list of controllers at index i. - * + * * @param i * The index to get a controller from. * @return The controller at index i. @@ -1165,7 +1165,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Returns the ArrayList that contains this spatial's SpatialControllers. - * + * * @return This spatial's _controllers. */ public List<SpatialController<?>> getControllers() { @@ -1177,7 +1177,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Gets the controller count. - * + * * @return the number of controllers set on this Spatial. */ public int getControllerCount() { @@ -1191,7 +1191,7 @@ public abstract class Spatial implements Savable, Hintable { * Returns this spatial's last frustum intersection result. This int is set when a check is made to determine if the * bounds of the object fall inside a camera's frustum. If a parent is found to fall outside the frustum, the value * for this spatial will not be updated. - * + * * @return The spatial's last frustum intersection result. */ public Camera.FrustumIntersect getLocalLastFrustumIntersection() { @@ -1201,7 +1201,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Tries to find the most accurate last frustum intersection for this spatial by checking the parent for possible * Outside value. - * + * * @return Outside, if this, or any ancestor was Outside, otherwise the local intersect value. */ public Camera.FrustumIntersect getLastFrustumIntersection() { @@ -1218,7 +1218,7 @@ public abstract class Spatial implements Savable, Hintable { * Overrides the last intersection result. This is useful for operations that want to start rendering at the middle * of a scene tree and don't want the parent of that node to influence culling. (See texture renderer code for * example.) - * + * * @param frustumIntersects * the new frustum intersection value */ @@ -1228,7 +1228,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Execute the given Visitor on this Spatial, and any Spatials managed by this Spatial as appropriate. - * + * * @param visitor * the Visitor object to use. * @param preexecute @@ -1242,7 +1242,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Returns the Spatial's name followed by the class of the spatial <br> * Example: "MyNode (com.ardor3d.scene.Spatial) - * + * * @return Spatial's name followed by the class of the Spatial */ @Override @@ -1252,7 +1252,7 @@ public abstract class Spatial implements Savable, Hintable { /** * Create a copy of this spatial. - * + * * @param shareGeometricData * if true, reuse any data fields describing the geometric shape of the spatial, as applicable. * @return the copy as described. @@ -1319,7 +1319,7 @@ public abstract class Spatial implements Savable, Hintable { * Creates and returns a new instance of this spatial. Used for instanced rendering. All instances visible on the * screen will be drawn in one draw call. The new instance will share all data (meshData and renderStates) with the * current mesh and all other instances created from this spatial. - * + * * @return an instanced copy of this node */ public Spatial makeInstanced() { diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java b/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java index e2517fb..7ae05a6 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.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>. */ @@ -16,8 +16,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; - -import com.google.common.collect.MapMaker; +import java.util.WeakHashMap; public class ContextIdReference<T> extends PhantomReference<T> { @@ -32,7 +31,7 @@ public class ContextIdReference<T> extends PhantomReference<T> { public ContextIdReference(final T reference, final ReferenceQueue<? super T> queue) { super(reference, queue); if (Constants.useMultipleContexts) { - _idCache = new MapMaker().initialCapacity(2).weakKeys().makeMap(); + _idCache = new WeakHashMap<Object, Integer>(2); } else { _idCache = null; } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java index a0a3478..025f38c 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.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>. */ @@ -20,6 +20,7 @@ import java.nio.ShortBuffer; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.WeakHashMap; import com.ardor3d.math.ColorRGBA; import com.ardor3d.math.Vector2; @@ -36,7 +37,6 @@ import com.ardor3d.scenegraph.IntBufferData; import com.ardor3d.scenegraph.ShortBufferData; import com.ardor3d.util.Ardor3dException; import com.ardor3d.util.Constants; -import com.google.common.collect.MapMaker; /** * <code>BufferUtils</code> is a helper class for generating nio buffers from ardor3d data classes such as Vectors and @@ -45,7 +45,7 @@ import com.google.common.collect.MapMaker; public final class BufferUtils { // // -- TRACKER HASH -- //// - private static final Map<Buffer, Object> trackingHash = new MapMaker().weakKeys().makeMap(); + private static final Map<Buffer, Object> trackingHash = new WeakHashMap<Buffer, Object>(); private static final Object ref = new Object(); // // -- COLORRGBA METHODS -- //// @@ -53,7 +53,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of ColorRGBA objects. The FloatBuffer will be 4 * data.length * long and contain the color data as data[0].r, data[0].g, data[0].b, data[0].a, data[1].r... etc. - * + * * @param data * array of ColorRGBA objects to place into a new FloatBuffer */ @@ -67,7 +67,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of ColorRGBA objects. The FloatBuffer will be 4 * data.length * long and contain the color data as data[0].r, data[0].g, data[0].b, data[0].a, data[1].r... etc. - * + * * @param offset * the starting index to read from in our data array * @param length @@ -93,7 +93,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of ColorRGBA object data. - * + * * @param colors * number of colors that need to be held by the newly created buffer * @return the requested new FloatBuffer @@ -105,7 +105,7 @@ public final class BufferUtils { /** * Sets the data contained in the given color into the FloatBuffer at the specified index. - * + * * @param color * the data to insert * @param buf @@ -123,7 +123,7 @@ public final class BufferUtils { /** * Updates the values of the given color from the specified buffer at the index provided. - * + * * @param store * the color to set data on * @param buf @@ -140,7 +140,7 @@ public final class BufferUtils { /** * Generates a ColorRGBA array from the given FloatBuffer. - * + * * @param buff * the FloatBuffer to read from * @return a newly generated array of ColorRGBA objects @@ -157,7 +157,7 @@ public final class BufferUtils { /** * Generates a ColorRGBA array from the given FloatBufferData. - * + * * @param buff * the FloatBufferData to read from * @param defaults @@ -193,7 +193,7 @@ public final class BufferUtils { /** * Copies a ColorRGBA from one position in the buffer to another. The index values are in terms of color number (eg, * color number 0 is positions 0-3 in the FloatBuffer.) - * + * * @param buf * the buffer to copy from/to * @param fromPos @@ -207,7 +207,7 @@ public final class BufferUtils { /** * Checks to see if the given ColorRGBA is equals to the data stored in the buffer at the given data index. - * + * * @param check * the color to check against - null will return false. * @param buf @@ -227,7 +227,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of Vector4 objects. The FloatBuffer will be 4 * data.length long * and contain the vector data as data[0].x, data[0].y, data[0].z, data[0].w, data[1].x... etc. - * + * * @param offset * the starting index to read from in our data array * @param length @@ -245,7 +245,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of Vector4 objects. The FloatBuffer will be 4 * data.length long * and contain the vector data as data[0].x, data[0].y, data[0].z, data[0].w, data[1].x... etc. - * + * * @param data * array of Vector4 objects to place into a new FloatBuffer */ @@ -267,7 +267,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of Vector4 object data. - * + * * @param vertices * number of vertices that need to be held by the newly created buffer * @return the requested new FloatBuffer @@ -280,7 +280,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of Vector4 object data only if the * given buffer if not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param vertices @@ -298,7 +298,7 @@ public final class BufferUtils { /** * Sets the data contained in the given Vector4 into the FloatBuffer at the specified index. - * + * * @param vector * the data to insert * @param buf @@ -325,7 +325,7 @@ public final class BufferUtils { /** * Updates the values of the given vector from the specified buffer at the index provided. - * + * * @param vector * the vector to set data on * @param buf @@ -342,7 +342,7 @@ public final class BufferUtils { /** * Generates a Vector4 array from the given FloatBuffer. - * + * * @param buff * the FloatBuffer to read from * @return a newly generated array of Vector3 objects @@ -359,7 +359,7 @@ public final class BufferUtils { /** * Generates a Vector4 array from the given FloatBufferData. - * + * * @param buff * the FloatBufferData to read from * @param defaults @@ -395,7 +395,7 @@ public final class BufferUtils { /** * Copies a Vector3 from one position in the buffer to another. The index values are in terms of vector number (eg, * vector number 0 is positions 0-2 in the FloatBuffer.) - * + * * @param buf * the buffer to copy from/to * @param fromPos @@ -409,7 +409,7 @@ public final class BufferUtils { /** * Normalize a Vector4 in-buffer. - * + * * @param buf * the buffer to find the Vector4 within * @param index @@ -425,7 +425,7 @@ public final class BufferUtils { /** * Add to a Vector4 in-buffer. - * + * * @param toAdd * the vector to add from * @param buf @@ -443,7 +443,7 @@ public final class BufferUtils { /** * Multiply and store a Vector3 in-buffer. - * + * * @param toMult * the vector to multiply against * @param buf @@ -461,7 +461,7 @@ public final class BufferUtils { /** * Checks to see if the given Vector3 is equals to the data stored in the buffer at the given data index. - * + * * @param check * the vector to check against - null will return false. * @param buf @@ -483,7 +483,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of Vector3 objects. The FloatBuffer will be 3 * data.length long * and contain the vector data as data[0].x, data[0].y, data[0].z, data[1].x... etc. - * + * * @param data * array of Vector3 objects to place into a new FloatBuffer */ @@ -497,7 +497,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of Vector3 objects. The FloatBuffer will be 3 * data.length long * and contain the vector data as data[0].x, data[0].y, data[0].z, data[1].x... etc. - * + * * @param offset * the starting index to read from in our data array * @param length @@ -523,7 +523,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of Vector3 object data. - * + * * @param vertices * number of vertices that need to be held by the newly created buffer * @return the requested new FloatBuffer @@ -536,7 +536,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of Vector3 object data only if the * given buffer is not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param vertices @@ -554,7 +554,7 @@ public final class BufferUtils { /** * Sets the data contained in the given Vector3 into the FloatBuffer at the specified index. - * + * * @param vector * the data to insert * @param buf @@ -579,7 +579,7 @@ public final class BufferUtils { /** * Updates the values of the given vector from the specified buffer at the index provided. - * + * * @param vector * the vector to set data on * @param buf @@ -595,7 +595,7 @@ public final class BufferUtils { /** * Generates a Vector3 array from the given FloatBuffer. - * + * * @param buff * the FloatBuffer to read from * @return a newly generated array of Vector3 objects @@ -612,7 +612,7 @@ public final class BufferUtils { /** * Generates a Vector3 array from the given FloatBufferData. - * + * * @param buff * the FloatBufferData to read from * @param defaults @@ -645,7 +645,7 @@ public final class BufferUtils { /** * Copies a Vector3 from one position in the buffer to another. The index values are in terms of vector number (eg, * vector number 0 is positions 0-2 in the FloatBuffer.) - * + * * @param buf * the buffer to copy from/to * @param fromPos @@ -659,7 +659,7 @@ public final class BufferUtils { /** * Normalize a Vector3 in-buffer. - * + * * @param buf * the buffer to find the Vector3 within * @param index @@ -675,7 +675,7 @@ public final class BufferUtils { /** * Add to a Vector3 in-buffer. - * + * * @param toAdd * the vector to add from * @param buf @@ -693,7 +693,7 @@ public final class BufferUtils { /** * Multiply and store a Vector3 in-buffer. - * + * * @param toMult * the vector to multiply against * @param buf @@ -711,7 +711,7 @@ public final class BufferUtils { /** * Checks to see if the given Vector3 is equals to the data stored in the buffer at the given data index. - * + * * @param check * the vector to check against - null will return false. * @param buf @@ -733,7 +733,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of Vector2 objects. The FloatBuffer will be 2 * data.length long * and contain the vector data as data[0].x, data[0].y, data[1].x... etc. - * + * * @param data * array of Vector2 objects to place into a new FloatBuffer */ @@ -747,7 +747,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of Vector2 objects. The FloatBuffer will be 2 * data.length long * and contain the vector data as data[0].x, data[0].y, data[1].x... etc. - * + * * @param offset * the starting index to read from in our data array * @param length @@ -773,7 +773,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of Vector2 object data. - * + * * @param vertices * number of vertices that need to be held by the newly created buffer * @return the requested new FloatBuffer @@ -786,7 +786,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of an appropriate size to hold the specified number of Vector2 object data only if the * given buffer if not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param vertices @@ -804,7 +804,7 @@ public final class BufferUtils { /** * Sets the data contained in the given Vector2 into the FloatBuffer at the specified index. - * + * * @param vector * the data to insert * @param buf @@ -819,7 +819,7 @@ public final class BufferUtils { /** * Updates the values of the given vector from the specified buffer at the index provided. - * + * * @param vector * the vector to set data on * @param buf @@ -834,7 +834,7 @@ public final class BufferUtils { /** * Generates a Vector2 array from the given FloatBuffer. - * + * * @param buff * the FloatBuffer to read from * @return a newly generated array of Vector2 objects @@ -851,7 +851,7 @@ public final class BufferUtils { /** * Generates a Vector2 array from the given FloatBufferData. - * + * * @param buff * the FloatBufferData to read from * @param defaults @@ -881,7 +881,7 @@ public final class BufferUtils { /** * Copies a Vector2 from one position in the buffer to another. The index values are in terms of vector number (eg, * vector number 0 is positions 0-1 in the FloatBuffer.) - * + * * @param buf * the buffer to copy from/to * @param fromPos @@ -895,7 +895,7 @@ public final class BufferUtils { /** * Normalize a Vector2 in-buffer. - * + * * @param buf * the buffer to find the Vector2 within * @param index @@ -911,7 +911,7 @@ public final class BufferUtils { /** * Add to a Vector2 in-buffer. - * + * * @param toAdd * the vector to add from * @param buf @@ -929,7 +929,7 @@ public final class BufferUtils { /** * Multiply and store a Vector2 in-buffer. - * + * * @param toMult * the vector to multiply against * @param buf @@ -947,7 +947,7 @@ public final class BufferUtils { /** * Checks to see if the given Vector2 is equals to the data stored in the buffer at the given data index. - * + * * @param check * the vector to check against - null will return false. * @param buf @@ -969,7 +969,7 @@ public final class BufferUtils { /** * Generate a new IntBuffer using the given array of ints. The IntBuffer will be data.length long and contain the * int data as data[0], data[1]... etc. - * + * * @param data * array of ints to place into a new IntBuffer */ @@ -986,7 +986,7 @@ public final class BufferUtils { /** * Create a new int[] array and populate it with the given IntBuffer's contents. - * + * * @param buff * the IntBuffer to read from * @return a new int array populated from the IntBuffer @@ -1005,7 +1005,7 @@ public final class BufferUtils { /** * Create a new int[] array and populate it with the given IndexBufferData's contents. - * + * * @param buff * the IndexBufferData to read from * @return a new int array populated from the IndexBufferData @@ -1024,7 +1024,7 @@ public final class BufferUtils { /** * Create a new float[] array and populate it with the given FloatBuffer's contents. - * + * * @param buff * the FloatBuffer to read from * @return a new float array populated from the FloatBuffer @@ -1045,7 +1045,7 @@ public final class BufferUtils { /** * Create a new DoubleBuffer of the specified size. - * + * * @param size * required number of double to store. * @return the new DoubleBuffer @@ -1058,7 +1058,7 @@ public final class BufferUtils { /** * Create a new DoubleBuffer of the specified size. - * + * * @param size * required number of double to store. * @return the new DoubleBuffer @@ -1075,7 +1075,7 @@ public final class BufferUtils { /** * Create a new DoubleBuffer of an appropriate size to hold the specified number of doubles only if the given buffer * if not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param size @@ -1096,7 +1096,7 @@ public final class BufferUtils { * Creates a new DoubleBuffer with the same contents as the given DoubleBuffer. The new DoubleBuffer is seperate * from the old one and changes are not reflected across. If you want to reflect changes, consider using * Buffer.duplicate(). - * + * * @param buf * the DoubleBuffer to copy * @return the copy @@ -1122,7 +1122,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of the specified size. - * + * * @param size * required number of floats to store. * @return the new FloatBuffer @@ -1138,7 +1138,7 @@ public final class BufferUtils { /** * Create a new FloatBuffer of the specified size. - * + * * @param size * required number of floats to store. * @return the new FloatBuffer @@ -1151,7 +1151,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of float primitives. - * + * * @param data * array of float primitives to place into a new FloatBuffer */ @@ -1161,7 +1161,7 @@ public final class BufferUtils { /** * Generate a new FloatBuffer using the given array of float primitives. - * + * * @param data * array of float primitives to place into a new FloatBuffer */ @@ -1201,7 +1201,7 @@ public final class BufferUtils { /** * Copies floats from one buffer to another. - * + * * @param source * the buffer to copy from * @param fromPos @@ -1225,7 +1225,7 @@ public final class BufferUtils { /** * Copies floats from one position in the buffer to another. - * + * * @param buf * the buffer to copy from/to * @param fromPos @@ -1247,7 +1247,7 @@ public final class BufferUtils { * Creates a new FloatBuffer with the same contents as the given FloatBuffer. The new FloatBuffer is seperate from * the old one and changes are not reflected across. If you want to reflect changes, consider using * Buffer.duplicate(). - * + * * @param buf * the FloatBuffer to copy * @return the copy @@ -1273,7 +1273,7 @@ public final class BufferUtils { /** * Create a new IntBuffer of the specified size. - * + * * @param size * required number of ints to store. * @return the new IntBuffer @@ -1286,7 +1286,7 @@ public final class BufferUtils { /** * Create a new IntBuffer of the specified size. - * + * * @param size * required number of ints to store. * @return the new IntBuffer @@ -1303,7 +1303,7 @@ public final class BufferUtils { /** * Create a new IntBuffer of an appropriate size to hold the specified number of ints only if the given buffer if * not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param size @@ -1323,7 +1323,7 @@ public final class BufferUtils { /** * Creates a new IntBuffer with the same contents as the given IntBuffer. The new IntBuffer is seperate from the old * one and changes are not reflected across. If you want to reflect changes, consider using Buffer.duplicate(). - * + * * @param buf * the IntBuffer to copy * @return the copy @@ -1349,7 +1349,7 @@ public final class BufferUtils { /** * Create a new ByteBuffer of the specified size. - * + * * @param size * required number of ints to store. * @return the new IntBuffer @@ -1366,7 +1366,7 @@ public final class BufferUtils { /** * Create a new ByteBuffer of an appropriate size to hold the specified number of ints only if the given buffer if * not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param size @@ -1386,7 +1386,7 @@ public final class BufferUtils { /** * Creates a new ByteBuffer with the same contents as the given ByteBuffer. The new ByteBuffer is seperate from the * old one and changes are not reflected across. If you want to reflect changes, consider using Buffer.duplicate(). - * + * * @param buf * the ByteBuffer to copy * @return the copy @@ -1412,7 +1412,7 @@ public final class BufferUtils { /** * Create a new ShortBuffer of the specified size. - * + * * @param size * required number of shorts to store. * @return the new ShortBuffer @@ -1425,7 +1425,7 @@ public final class BufferUtils { /** * Create a new ShortBuffer of the specified size. - * + * * @param size * required number of shorts to store. * @return the new ShortBuffer @@ -1441,7 +1441,7 @@ public final class BufferUtils { /** * Generate a new ShortBuffer using the given array of short primitives. - * + * * @param data * array of short primitives to place into a new ShortBuffer */ @@ -1459,7 +1459,7 @@ public final class BufferUtils { /** * Create a new ShortBuffer of an appropriate size to hold the specified number of shorts only if the given buffer * if not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param size @@ -1480,7 +1480,7 @@ public final class BufferUtils { * Creates a new ShortBuffer with the same contents as the given ShortBuffer. The new ShortBuffer is seperate from * the old one and changes are not reflected across. If you want to reflect changes, consider using * Buffer.duplicate(). - * + * * @param buf * the ShortBuffer to copy * @return the copy @@ -1505,7 +1505,7 @@ public final class BufferUtils { /** * Ensures there is at least the <code>required</code> number of entries left after the current position of the * buffer. If the buffer is too small a larger one is created and the old one copied to the new buffer. - * + * * @param buffer * buffer that should be checked/copied (may be null) * @param required @@ -1533,7 +1533,7 @@ public final class BufferUtils { * Create a new IndexBufferData of the specified size. The specific implementation will be chosen based on the max * value you need to store in your buffer. If that value is less than 2^8, a ByteBufferData is used. If it is less * than 2^16, a ShortBufferData is used. Otherwise an IntBufferData is used. - * + * * @param size * required number of values to store. * @param maxValue @@ -1555,7 +1555,7 @@ public final class BufferUtils { * Create a new IndexBufferData large enough to fit the contents of the given array. The specific implementation * will be chosen based on the max value you need to store in your buffer. If that value is less than 2^8, a * ByteBufferData is used. If it is less than 2^16, a ShortBufferData is used. Otherwise an IntBufferData is used. - * + * * @param contents * an array of index values to store in your newly created IndexBufferData. * @param maxValue @@ -1578,7 +1578,7 @@ public final class BufferUtils { /** * Create a new IndexBufferData of the specified size and class. - * + * * @param size * required number of values to store. * @param clazz @@ -1597,7 +1597,7 @@ public final class BufferUtils { /** * Creates a new IndexBufferData with the same contents as the given IndexBufferData. The new IndexBufferData is * separate from the old one and changes are not reflected across. - * + * * @param buf * the IndexBufferData to copy * @return the copy @@ -1624,7 +1624,7 @@ public final class BufferUtils { /** * Create a new ByteBuffer of the specified size. - * + * * @param size * required number of ints to store. * @return the new IntBuffer @@ -1638,7 +1638,7 @@ public final class BufferUtils { /** * Create a new ByteBuffer of an appropriate size to hold the specified number of ints only if the given buffer if * not already the right size. - * + * * @param buf * the buffer to first check and rewind * @param size @@ -1658,7 +1658,7 @@ public final class BufferUtils { /** * Creates a new ByteBuffer with the same contents as the given ByteBuffer. The new ByteBuffer is seperate from the * old one and changes are not reflected across. If you want to reflect changes, consider using Buffer.duplicate(). - * + * * @param buf * the ByteBuffer to copy * @return the copy @@ -1710,11 +1710,11 @@ public final class BufferUtils { } store.append("Existing buffers: ").append(bufs.size()).append('\n'); store.append("(b: ").append(bBufs).append(" f: ").append(fBufs).append(" i: ").append(iBufs).append(" s: ") - .append(sBufs).append(" d: ").append(dBufs).append(')').append('\n'); + .append(sBufs).append(" d: ").append(dBufs).append(')').append('\n'); store.append("Total direct memory held: ").append(totalHeld / 1024).append("kb\n"); store.append("(b: ").append(bBufsM / 1024).append("kb f: ").append(fBufsM / 1024).append("kb i: ") - .append(iBufsM / 1024).append("kb s: ").append(sBufsM / 1024).append("kb d: ").append(dBufsM / 1024) - .append("kb)").append('\n'); + .append(iBufsM / 1024).append("kb s: ").append(sBufsM / 1024).append("kb d: ").append(dBufsM / 1024) + .append("kb)").append('\n'); if (printStout) { System.out.println(store.toString()); } diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java index 0df947a..57471ff 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java +++ b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.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>. */ @@ -12,6 +12,7 @@ package com.ardor3d.util.scenegraph; import java.lang.ref.ReferenceQueue; import java.util.Map; +import java.util.WeakHashMap; import com.ardor3d.renderer.ContextCleanListener; import com.ardor3d.renderer.ContextManager; @@ -22,12 +23,11 @@ import com.ardor3d.scenegraph.Spatial; import com.ardor3d.util.GameTaskQueueManager; import com.ardor3d.util.SimpleContextIdReference; import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.MapMaker; import com.google.common.collect.Multimap; public class DisplayListDelegate implements RenderDelegate { - private static Map<DisplayListDelegate, Object> _identityCache = new MapMaker().weakKeys().makeMap(); + private static Map<DisplayListDelegate, Object> _identityCache = new WeakHashMap<DisplayListDelegate, Object>(); private static final Object STATIC_REF = new Object(); private static ReferenceQueue<DisplayListDelegate> _refQueue = new ReferenceQueue<DisplayListDelegate>(); @@ -36,7 +36,7 @@ public class DisplayListDelegate implements RenderDelegate { ContextManager.addContextCleanListener(new ContextCleanListener() { @Override public void cleanForContext(final RenderContext renderContext) { - // TODO: Need a way to call back to the creator of the display list? + // TODO: Need a way to call back to the creator of the display list? } }); } |