- Reduced the number of instantiated variable on a collision check
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8373 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
73d192ea3f
commit
cf89d515ef
@ -66,6 +66,7 @@ public final class BIHNode implements Savable {
|
||||
private float leftPlane;
|
||||
private float rightPlane;
|
||||
private int axis;
|
||||
private Triangle tmpTriangle = new Triangle();
|
||||
|
||||
public BIHNode(int l, int r) {
|
||||
leftIndex = l;
|
||||
@ -166,7 +167,7 @@ public final class BIHNode implements Savable {
|
||||
|
||||
stack.add(new BIHStackData(this, 0, 0));
|
||||
|
||||
Triangle t = new Triangle();
|
||||
Triangle t = tmpTriangle;
|
||||
int cols = 0;
|
||||
|
||||
stackloop:
|
||||
@ -242,13 +243,14 @@ public final class BIHNode implements Savable {
|
||||
CollisionResults results) {
|
||||
float tHit = Float.POSITIVE_INFINITY;
|
||||
|
||||
Vector3f v1 = new Vector3f(),
|
||||
v2 = new Vector3f(),
|
||||
v3 = new Vector3f();
|
||||
TempVars vars = TempVars.get();
|
||||
|
||||
Vector3f v1 = vars.vect1,
|
||||
v2 = vars.vect2,
|
||||
v3 = vars.vect3;
|
||||
|
||||
int cols = 0;
|
||||
|
||||
TempVars vars = TempVars.get();
|
||||
ArrayList<BIHStackData> stack = vars.bihStack;
|
||||
stack.clear();
|
||||
stack.add(new BIHStackData(this, 0, 0));
|
||||
@ -306,10 +308,10 @@ public final class BIHNode implements Savable {
|
||||
|
||||
// float tHit = Float.POSITIVE_INFINITY;
|
||||
|
||||
Vector3f o = r.getOrigin().clone();
|
||||
Vector3f d = r.getDirection().clone();
|
||||
Vector3f o = vars.vect1.set(r.getOrigin());
|
||||
Vector3f d = vars.vect2.set(r.getDirection());
|
||||
|
||||
Matrix4f inv = worldMatrix.invert();
|
||||
Matrix4f inv =vars.tempMat4.set(worldMatrix).invertLocal();
|
||||
|
||||
inv.mult(r.getOrigin(), r.getOrigin());
|
||||
|
||||
@ -327,9 +329,9 @@ public final class BIHNode implements Savable {
|
||||
|
||||
r.getDirection().normalizeLocal();
|
||||
|
||||
Vector3f v1 = new Vector3f(),
|
||||
v2 = new Vector3f(),
|
||||
v3 = new Vector3f();
|
||||
Vector3f v1 = vars.vect3,
|
||||
v2 = vars.vect4,
|
||||
v3 = vars.vect5;
|
||||
int cols = 0;
|
||||
|
||||
stack.add(new BIHStackData(this, sceneMin, sceneMax));
|
||||
|
Loading…
x
Reference in New Issue
Block a user