diff --git a/engine/src/core/com/jme3/renderer/Camera.java b/engine/src/core/com/jme3/renderer/Camera.java
index e7aa296ab..010648f10 100644
--- a/engine/src/core/com/jme3/renderer/Camera.java
+++ b/engine/src/core/com/jme3/renderer/Camera.java
@@ -1219,9 +1219,11 @@ public class Camera implements Savable, Cloneable {
* onFrameChange
updates the view frame of the camera.
*/
public void onFrameChange() {
- Vector3f left = getLeft();
- Vector3f direction = getDirection();
- Vector3f up = getUp();
+ TempVars vars = TempVars.get();
+
+ Vector3f left = getLeft(vars.vect1);
+ Vector3f direction = getDirection(vars.vect2);
+ Vector3f up = getUp(vars.vect3);
float dirDotLocation = direction.dot(location);
@@ -1278,6 +1280,9 @@ public class Camera implements Savable, Cloneable {
worldPlane[NEAR_PLANE].setConstant(dirDotLocation + frustumNear);
viewMatrix.fromFrame(location, direction, up, left);
+
+ vars.release();
+
// viewMatrix.transposeLocal();
updateViewProjection();
}
diff --git a/engine/src/core/com/jme3/util/IntMap.java b/engine/src/core/com/jme3/util/IntMap.java
index 969ccbe75..edf659bab 100644
--- a/engine/src/core/com/jme3/util/IntMap.java
+++ b/engine/src/core/com/jme3/util/IntMap.java
@@ -45,6 +45,8 @@ import java.util.Map;
*/
public final class IntMap implements Iterable>, Cloneable {
+ private final IntMapIterator iterator = new IntMapIterator();
+
private Entry[] table;
private final float loadFactor;
private int size, mask, capacity, threshold;
@@ -198,7 +200,8 @@ public final class IntMap implements Iterable>, Cloneable {
}
public Iterator> iterator() {
- return (Iterator>) new IntMapIterator();
+ iterator.beginUse();
+ return iterator;
}
final class IntMapIterator implements Iterator> {
@@ -219,9 +222,14 @@ public final class IntMap implements Iterable>, Cloneable {
private int el = 0;
public IntMapIterator() {
- cur = table[0];
}
+ public void beginUse(){
+ cur = table[0];
+ idx = 0;
+ el = 0;
+ }
+
public boolean hasNext() {
return el < size;
}
@@ -248,9 +256,11 @@ public final class IntMap implements Iterable>, Cloneable {
// the entry was null. find another non-null entry.
cur = table[++idx];
} while (cur == null);
+
Entry e = cur;
cur = cur.next;
el ++;
+
return e;
}