Fix some corner cases in ShadowUtil after last commit
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@11028 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
31b9c41e8a
commit
5b7b7b0c8f
@ -195,7 +195,7 @@ public class ShadowUtil {
|
||||
TempVars tempv = TempVars.get();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
BoundingVolume vol = list.get(i).getWorldBound();
|
||||
BoundingVolume store = vol.clone().transform(mat, tempv.bbox);
|
||||
BoundingVolume store = vol.transform(mat, tempv.bbox);
|
||||
//Nehon : prevent NaN and infinity values to screw the final bounding box
|
||||
if (!Float.isNaN(store.getCenter().x) && !Float.isInfinite(store.getCenter().x)) {
|
||||
bbox.mergeLocal(store);
|
||||
@ -386,8 +386,11 @@ public class ShadowUtil {
|
||||
BoundingVolume recvBox = bv.transform(viewProjMatrix, vars.bbox);
|
||||
|
||||
if (splitBB.intersects(recvBox)) {
|
||||
receiverBB.mergeLocal(recvBox);
|
||||
receiverCount++;
|
||||
//Nehon : prevent NaN and infinity values to screw the final bounding box
|
||||
if (!Float.isNaN(recvBox.getCenter().x) && !Float.isInfinite(recvBox.getCenter().x)) {
|
||||
receiverBB.mergeLocal(recvBox);
|
||||
receiverCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -409,16 +412,20 @@ public class ShadowUtil {
|
||||
occBB.setZExtent(occBB.getZExtent() + 50);
|
||||
occBB.setCenter(occBB.getCenter().addLocal(0, 0, 25));
|
||||
if (splitBB.intersects(occBB)) {
|
||||
// To prevent extending the depth range too much
|
||||
// We return the bound to its former shape
|
||||
// Before adding it
|
||||
occBB.setZExtent(occBB.getZExtent() - 50);
|
||||
occBB.setCenter(occBB.getCenter().subtractLocal(0, 0, 25));
|
||||
casterBB.mergeLocal(occBox);
|
||||
casterCount++;
|
||||
//Nehon : prevent NaN and infinity values to screw the final bounding box
|
||||
if (!Float.isNaN(occBox.getCenter().x) && !Float.isInfinite(occBox.getCenter().x)) {
|
||||
// To prevent extending the depth range too much
|
||||
// We return the bound to its former shape
|
||||
// Before adding it
|
||||
occBB.setZExtent(occBB.getZExtent() - 50);
|
||||
occBB.setCenter(occBB.getCenter().subtractLocal(0, 0, 25));
|
||||
casterBB.mergeLocal(occBox);
|
||||
casterCount++;
|
||||
}
|
||||
if (splitOccluders != null) {
|
||||
splitOccluders.add(occluder);
|
||||
}
|
||||
|
||||
}
|
||||
} else if (intersects) {
|
||||
casterBB.mergeLocal(occBox);
|
||||
|
Loading…
x
Reference in New Issue
Block a user