/** * Creates a SpotLight. */ public SpotLight() { super(); computeAngleParameters(); }
/** * Sets the inner angle of the cone of influence. * <p> * Must be between 0 and pi/2. * <p> * This angle is the angle between the spot direction axis and the inner border of the cone of influence. * @param spotInnerAngle */ public void setSpotInnerAngle(float spotInnerAngle) { if (spotInnerAngle < 0f || spotInnerAngle >= FastMath.HALF_PI) { throw new IllegalArgumentException("spot angle must be between 0 and pi/2"); } this.spotInnerAngle = spotInnerAngle; computeAngleParameters(); }
/** * Sets the outer angle of the cone of influence. * <p> * Must be between 0 and pi/2. * <p> * This angle is the angle between the spot direction axis and the outer border of the cone of influence. * this should be greater than the inner angle or the result will be unexpected. * @param spotOuterAngle */ public void setSpotOuterAngle(float spotOuterAngle) { if (spotOuterAngle < 0f || spotOuterAngle >= FastMath.HALF_PI) { throw new IllegalArgumentException("spot angle must be between 0 and pi/2"); } this.spotOuterAngle = spotOuterAngle; computeAngleParameters(); }
/** * Creates a SpotLight at the given position, with the given direction and * the given color. * @param position the position in world space. * @param direction the direction of the light. * @param color the light's color. */ public SpotLight(Vector3f position, Vector3f direction, ColorRGBA color) { super(color); computeAngleParameters(); setPosition(position); setDirection(direction); }
/** * Creates a SpotLight at the given position, with the given direction, * the given range and the given color. * @param position the position in world space. * @param direction the direction of the light. * @param range the spot light range * @param color the light's color. */ public SpotLight(Vector3f position, Vector3f direction, float range, ColorRGBA color) { super(color); computeAngleParameters(); setPosition(position); setDirection(direction); setSpotRange(range); }
/** * Creates a SpotLight at the given position, with the given direction, * the given color and the given inner and outer angles * (controls the falloff of the light) * * @param position the position in world space. * @param direction the direction of the light. * @param range the spot light range * @param color the light's color. * @param innerAngle the inner angle of the spot light. * @param outerAngle the outer angle of the spot light. * * @see SpotLight#setSpotInnerAngle(float) * @see SpotLight#setSpotOuterAngle(float) */ public SpotLight(Vector3f position, Vector3f direction, float range, ColorRGBA color, float innerAngle, float outerAngle) { super(color); this.spotInnerAngle = innerAngle; this.spotOuterAngle = outerAngle; computeAngleParameters(); setPosition(position); setDirection(direction); setSpotRange(range); }
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); spotInnerAngle = ic.readFloat("spotInnerAngle", FastMath.QUARTER_PI / 8); spotOuterAngle = ic.readFloat("spotOuterAngle", FastMath.QUARTER_PI / 6); computeAngleParameters(); direction = (Vector3f) ic.readSavable("direction", new Vector3f()); position = (Vector3f) ic.readSavable("position", new Vector3f()); spotRange = ic.readFloat("spotRange", 100); if (spotRange != 0) { this.invSpotRange = 1 / spotRange; } else { this.invSpotRange = 0; } }
/** * Creates a SpotLight. */ public SpotLight() { super(); computeAngleParameters(); }
/** * Sets the inner angle of the cone of influence. * <p> * Must be between 0 and pi/2. * <p> * This angle is the angle between the spot direction axis and the inner border of the cone of influence. * @param spotInnerAngle */ public void setSpotInnerAngle(float spotInnerAngle) { if (spotInnerAngle < 0f || spotInnerAngle >= FastMath.HALF_PI) { throw new IllegalArgumentException("spot angle must be between 0 and pi/2"); } this.spotInnerAngle = spotInnerAngle; computeAngleParameters(); }
/** * Sets the outer angle of the cone of influence. * <p> * Must be between 0 and pi/2. * <p> * This angle is the angle between the spot direction axis and the outer border of the cone of influence. * this should be greater than the inner angle or the result will be unexpected. * @param spotOuterAngle */ public void setSpotOuterAngle(float spotOuterAngle) { if (spotOuterAngle < 0f || spotOuterAngle >= FastMath.HALF_PI) { throw new IllegalArgumentException("spot angle must be between 0 and pi/2"); } this.spotOuterAngle = spotOuterAngle; computeAngleParameters(); }
/** * Creates a SpotLight at the given position, with the given direction and * the given color. * @param position the position in world space. * @param direction the direction of the light. * @param color the light's color. */ public SpotLight(Vector3f position, Vector3f direction, ColorRGBA color) { super(color); computeAngleParameters(); setPosition(position); setDirection(direction); }
/** * Creates a SpotLight at the given position, with the given direction, * the given range and the given color. * @param position the position in world space. * @param direction the direction of the light. * @param range the spot light range * @param color the light's color. */ public SpotLight(Vector3f position, Vector3f direction, float range, ColorRGBA color) { super(color); computeAngleParameters(); setPosition(position); setDirection(direction); setSpotRange(range); }
/** * Creates a SpotLight at the given position, with the given direction, * the given color and the given inner and outer angles * (controls the falloff of the light) * * @param position the position in world space. * @param direction the direction of the light. * @param range the spot light range * @param color the light's color. * @param innerAngle the inner angle of the spot light. * @param outerAngle the outer angle of the spot light. * * @see SpotLight#setSpotInnerAngle(float) * @see SpotLight#setSpotOuterAngle(float) */ public SpotLight(Vector3f position, Vector3f direction, float range, ColorRGBA color, float innerAngle, float outerAngle) { super(color); this.spotInnerAngle = innerAngle; this.spotOuterAngle = outerAngle; computeAngleParameters(); setPosition(position); setDirection(direction); setSpotRange(range); }
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); spotInnerAngle = ic.readFloat("spotInnerAngle", FastMath.QUARTER_PI / 8); spotOuterAngle = ic.readFloat("spotOuterAngle", FastMath.QUARTER_PI / 6); computeAngleParameters(); direction = (Vector3f) ic.readSavable("direction", new Vector3f()); position = (Vector3f) ic.readSavable("position", new Vector3f()); spotRange = ic.readFloat("spotRange", 100); if (spotRange != 0) { this.invSpotRange = 1 / spotRange; } else { this.invSpotRange = 0; } }