diff options
author | Renanse <[email protected]> | 2012-11-29 11:16:30 -0600 |
---|---|---|
committer | Renanse <[email protected]> | 2012-11-29 11:16:30 -0600 |
commit | 05c4b3c313d280ce4020ed183d63f2aaf791f4f5 (patch) | |
tree | d977d620a4c802e14a6cac7a78a652a5d45c8c27 | |
parent | e3f28b6bd920c3c77653c5b9e4adedcdc0e285a9 (diff) |
Small tweak to improve camera setting order.
-rw-r--r-- | trunk/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/trunk/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java b/trunk/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java index 68242c6..cf07f8a 100644 --- a/trunk/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java +++ b/trunk/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java @@ -589,12 +589,13 @@ public class ParallelSplitShadowMapPass extends Pass { direction = direction.set(dl.getDirection());
final double distance = Math.max(radius, _minimumLightDistance);
- final Vector3 tmpVec = new Vector3();
+ final Vector3 tmpVec = Vector3.fetchTempInstance();
tmpVec.set(direction);
tmpVec.negateLocal();
tmpVec.multiplyLocal(distance);
tmpVec.addLocal(center);
+ // temporary location
shadowCam.setLocation(tmpVec);
shadowCam.lookAt(center, Vector3.UNIT_Y);
@@ -621,12 +622,16 @@ public class ParallelSplitShadowMapPass extends Pass { Quaternion.releaseTempInstance(q);
}
- shadowCam.setLocation(tmpVec);
-
- final double farZ = tmpVec.set(tmpVec).subtractLocal(center).length() + radius;
+ // updated location
+ final double x = tmpVec.getX();
+ final double y = tmpVec.getY();
+ final double z = tmpVec.getZ();
+ final double farZ = tmpVec.subtractLocal(center).length() + radius;
+ Vector3.releaseTempInstance(tmpVec);
+ // set frustum, then location
shadowCam.setFrustum(1, farZ, -radius, radius, radius, -radius);
- shadowCam.update();
+ shadowCam.setLocation(x, y, z);
}
/**
|