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();
|
TempVars tempv = TempVars.get();
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
BoundingVolume vol = list.get(i).getWorldBound();
|
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
|
//Nehon : prevent NaN and infinity values to screw the final bounding box
|
||||||
if (!Float.isNaN(store.getCenter().x) && !Float.isInfinite(store.getCenter().x)) {
|
if (!Float.isNaN(store.getCenter().x) && !Float.isInfinite(store.getCenter().x)) {
|
||||||
bbox.mergeLocal(store);
|
bbox.mergeLocal(store);
|
||||||
@ -386,8 +386,11 @@ public class ShadowUtil {
|
|||||||
BoundingVolume recvBox = bv.transform(viewProjMatrix, vars.bbox);
|
BoundingVolume recvBox = bv.transform(viewProjMatrix, vars.bbox);
|
||||||
|
|
||||||
if (splitBB.intersects(recvBox)) {
|
if (splitBB.intersects(recvBox)) {
|
||||||
receiverBB.mergeLocal(recvBox);
|
//Nehon : prevent NaN and infinity values to screw the final bounding box
|
||||||
receiverCount++;
|
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.setZExtent(occBB.getZExtent() + 50);
|
||||||
occBB.setCenter(occBB.getCenter().addLocal(0, 0, 25));
|
occBB.setCenter(occBB.getCenter().addLocal(0, 0, 25));
|
||||||
if (splitBB.intersects(occBB)) {
|
if (splitBB.intersects(occBB)) {
|
||||||
// To prevent extending the depth range too much
|
//Nehon : prevent NaN and infinity values to screw the final bounding box
|
||||||
// We return the bound to its former shape
|
if (!Float.isNaN(occBox.getCenter().x) && !Float.isInfinite(occBox.getCenter().x)) {
|
||||||
// Before adding it
|
// To prevent extending the depth range too much
|
||||||
occBB.setZExtent(occBB.getZExtent() - 50);
|
// We return the bound to its former shape
|
||||||
occBB.setCenter(occBB.getCenter().subtractLocal(0, 0, 25));
|
// Before adding it
|
||||||
casterBB.mergeLocal(occBox);
|
occBB.setZExtent(occBB.getZExtent() - 50);
|
||||||
casterCount++;
|
occBB.setCenter(occBB.getCenter().subtractLocal(0, 0, 25));
|
||||||
|
casterBB.mergeLocal(occBox);
|
||||||
|
casterCount++;
|
||||||
|
}
|
||||||
if (splitOccluders != null) {
|
if (splitOccluders != null) {
|
||||||
splitOccluders.add(occluder);
|
splitOccluders.add(occluder);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if (intersects) {
|
} else if (intersects) {
|
||||||
casterBB.mergeLocal(occBox);
|
casterBB.mergeLocal(occBox);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user