point light: more accurate sphere vs box filter

experimental
Kirill Vainer 9 years ago
parent 6238088688
commit 22dde7f718
  1. 6
      jme3-core/src/main/java/com/jme3/light/PointLight.java

@ -33,12 +33,12 @@ package com.jme3.light;
import com.jme3.bounding.BoundingBox;
import com.jme3.bounding.BoundingVolume;
import com.jme3.bounding.Intersection;
import com.jme3.export.InputCapsule;
import com.jme3.export.JmeExporter;
import com.jme3.export.JmeImporter;
import com.jme3.export.OutputCapsule;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.scene.Spatial;
@ -191,9 +191,7 @@ public class PointLight extends Light {
return true;
} else {
// Sphere v. box collision
return FastMath.abs(box.getCenter().x - position.x) < radius + box.getXExtent()
&& FastMath.abs(box.getCenter().y - position.y) < radius + box.getYExtent()
&& FastMath.abs(box.getCenter().z - position.z) < radius + box.getZExtent();
return Intersection.intersect(box, position, radius);
}
}

Loading…
Cancel
Save