light : fixed pointLight v. bounding sphere unit test

experimental
Dokthar 9 years ago
parent 4be09e3505
commit 071ad5c618
  1. 19
      jme3-core/src/test/java/com/jme3/light/LightFilterTest.java

@ -139,25 +139,26 @@ public class LightFilterTest {
// ================================== // ==================================
// Tests for bounding Sphere // Tests for bounding Sphere
geom.setLocalTranslation(0, 0, 0); geom.setModelBound(new BoundingSphere(1f, Vector3f.ZERO));
geom.setLocalTranslation(0, 0, 2);
pl.setPosition(new Vector3f(0, 0, 2f));
// Infinite point lights must never be filtered // Infinite point lights must never be filtered
pl.setRadius(0); pl.setRadius(0);
checkFilteredLights(1); checkFilteredLights(1);
pl.setRadius(1f); pl.setRadius(1f);
geom.setModelBound(new BoundingSphere(1f, Vector3f.ZERO));
// Put the light at the very close to the geom, // Put the light at the very close to the geom,
// the very edge of the sphere touches the other bounding sphere // the very edge of the sphere touches the other bounding sphere
// Still not considered an intersection though. // Still not considered an intersection though.
pl.setPosition(new Vector3f(0, 0, -2f)); pl.setPosition(new Vector3f(0, 0, 0));
checkFilteredLights(0); checkFilteredLights(0);
// And more close - now its an intersection. // And more close - now its an intersection.
pl.setPosition(new Vector3f(0, 0, 0f)); pl.setPosition(new Vector3f(0, 0, 0f + FastMath.ZERO_TOLERANCE));
checkFilteredLights(0); checkFilteredLights(1);
geom.setLocalTranslation(0, 0, 0);
// In this case its an intersection for pointLight v. box // In this case its an intersection for pointLight v. box
// But not for pointLight v. sphere // But not for pointLight v. sphere
// Vector3f(0, 0.5f, 0.5f).normalize().mult(2) ~ >= (0.0, 1.4142135, 1.4142135) // Vector3f(0, 0.5f, 0.5f).normalize().mult(2) ~ >= (0.0, 1.4142135, 1.4142135)

Loading…
Cancel
Save