|
@@ -53,7 +53,7 @@ import java.io.IOException;
|
|
* In addition to a position, point lights also have a radius which
|
|
* In addition to a position, point lights also have a radius which
|
|
* can be used to attenuate the influence of the light depending on the
|
|
* can be used to attenuate the influence of the light depending on the
|
|
* distance between the light and the effected object.
|
|
* distance between the light and the effected object.
|
|
- *
|
|
|
|
|
|
+ *
|
|
*/
|
|
*/
|
|
public class PointLight extends Light {
|
|
public class PointLight extends Light {
|
|
|
|
|
|
@@ -84,7 +84,7 @@ public class PointLight extends Light {
|
|
super(color);
|
|
super(color);
|
|
setPosition(position);
|
|
setPosition(position);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Creates a PointLight at the given position, with the given color and the
|
|
* Creates a PointLight at the given position, with the given color and the
|
|
* given radius
|
|
* given radius
|
|
@@ -96,7 +96,7 @@ public class PointLight extends Light {
|
|
this(position, color);
|
|
this(position, color);
|
|
setRadius(radius);
|
|
setRadius(radius);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Creates a PointLight at the given position, with the given radius
|
|
* Creates a PointLight at the given position, with the given radius
|
|
* @param position the position in world space
|
|
* @param position the position in world space
|
|
@@ -119,10 +119,10 @@ public class PointLight extends Light {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Returns the world space position of the light.
|
|
* Returns the world space position of the light.
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @return the world space position of the light.
|
|
* @return the world space position of the light.
|
|
- *
|
|
|
|
- * @see PointLight#setPosition(com.jme3.math.Vector3f)
|
|
|
|
|
|
+ *
|
|
|
|
+ * @see PointLight#setPosition(com.jme3.math.Vector3f)
|
|
*/
|
|
*/
|
|
public Vector3f getPosition() {
|
|
public Vector3f getPosition() {
|
|
return position;
|
|
return position;
|
|
@@ -130,7 +130,7 @@ public class PointLight extends Light {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Set the world space position of the light.
|
|
* Set the world space position of the light.
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @param position the world space position of the light.
|
|
* @param position the world space position of the light.
|
|
*/
|
|
*/
|
|
public final void setPosition(Vector3f position) {
|
|
public final void setPosition(Vector3f position) {
|
|
@@ -140,7 +140,7 @@ public class PointLight extends Light {
|
|
/**
|
|
/**
|
|
* Returns the radius of the light influence. A radius of 0 means
|
|
* Returns the radius of the light influence. A radius of 0 means
|
|
* the light has no attenuation.
|
|
* the light has no attenuation.
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @return the radius of the light
|
|
* @return the radius of the light
|
|
*/
|
|
*/
|
|
public float getRadius() {
|
|
public float getRadius() {
|
|
@@ -155,9 +155,9 @@ public class PointLight extends Light {
|
|
* is greater than the light's radius, then the pixel will not be
|
|
* is greater than the light's radius, then the pixel will not be
|
|
* effected by this light, if the distance is less than the radius, then
|
|
* effected by this light, if the distance is less than the radius, then
|
|
* the magnitude of the influence is equal to distance / radius.
|
|
* the magnitude of the influence is equal to distance / radius.
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @param radius the radius of the light influence.
|
|
* @param radius the radius of the light influence.
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @throws IllegalArgumentException If radius is negative
|
|
* @throws IllegalArgumentException If radius is negative
|
|
*/
|
|
*/
|
|
public final void setRadius(float radius) {
|
|
public final void setRadius(float radius) {
|
|
@@ -192,11 +192,11 @@ public class PointLight extends Light {
|
|
} else {
|
|
} else {
|
|
// Sphere v. box collision
|
|
// Sphere v. box collision
|
|
return FastMath.abs(box.getCenter().x - position.x) < radius + box.getXExtent()
|
|
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();
|
|
|
|
|
|
+ && FastMath.abs(box.getCenter().y - position.y) < radius + box.getYExtent()
|
|
|
|
+ && FastMath.abs(box.getCenter().z - position.z) < radius + box.getZExtent();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public boolean intersectsFrustum(Camera camera, TempVars vars) {
|
|
public boolean intersectsFrustum(Camera camera, TempVars vars) {
|
|
if (this.radius == 0) {
|
|
if (this.radius == 0) {
|
|
@@ -210,7 +210,7 @@ public class PointLight extends Light {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void write(JmeExporter ex) throws IOException {
|
|
public void write(JmeExporter ex) throws IOException {
|
|
super.write(ex);
|
|
super.write(ex);
|