point light: more accurate sphere vs box filter
This commit is contained in:
parent
6238088688
commit
22dde7f718
@ -33,12 +33,12 @@ package com.jme3.light;
|
|||||||
|
|
||||||
import com.jme3.bounding.BoundingBox;
|
import com.jme3.bounding.BoundingBox;
|
||||||
import com.jme3.bounding.BoundingVolume;
|
import com.jme3.bounding.BoundingVolume;
|
||||||
|
import com.jme3.bounding.Intersection;
|
||||||
import com.jme3.export.InputCapsule;
|
import com.jme3.export.InputCapsule;
|
||||||
import com.jme3.export.JmeExporter;
|
import com.jme3.export.JmeExporter;
|
||||||
import com.jme3.export.JmeImporter;
|
import com.jme3.export.JmeImporter;
|
||||||
import com.jme3.export.OutputCapsule;
|
import com.jme3.export.OutputCapsule;
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.FastMath;
|
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.renderer.Camera;
|
import com.jme3.renderer.Camera;
|
||||||
import com.jme3.scene.Spatial;
|
import com.jme3.scene.Spatial;
|
||||||
@ -191,9 +191,7 @@ public class PointLight extends Light {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// Sphere v. box collision
|
// Sphere v. box collision
|
||||||
return FastMath.abs(box.getCenter().x - position.x) < radius + box.getXExtent()
|
return Intersection.intersect(box, position, radius);
|
||||||
&& FastMath.abs(box.getCenter().y - position.y) < radius + box.getYExtent()
|
|
||||||
&& FastMath.abs(box.getCenter().z - position.z) < radius + box.getZExtent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user