-
public class LightManager.BuilderUse Builder to construct a Light object instance
-
-
Constructor Summary
Constructors Constructor Description LightManager.Builder(LightManager.Type type)Creates a light builder and set the light's Type.
-
Method Summary
Modifier and Type Method Description LightManager.BuilderlightChannel(@IntRange(from = 0, to = 7) int channel, boolean enable)Enables or disables a light channel. LightManager.BuildercastShadows(boolean enable)Whether this Light casts shadows (disabled by default) LightManager.BuildershadowOptions(@NonNull() LightManager.ShadowOptions options)Sets the shadow map options for this light. LightManager.BuildercastLight(boolean enabled)Whether this light casts light (enabled by default)In some situations it can be useful to have a light in the scene that doesn'tactually emit light, but does cast shadows. LightManager.Builderposition(float x, float y, float z)Sets the initial position of the light in world space. LightManager.Builderdirection(float x, float y, float z)Sets the initial direction of a light in world space. LightManager.Buildercolor(float linearR, float linearG, float linearB)Sets the initial color of a light. LightManager.Builderintensity(float intensity)Sets the initial intensity of a light.This method overrides any prior calls to #intensity or #intensityCandela. LightManager.Builderintensity(float watts, float efficiency)Sets the initial intensity of a light in watts. LightManager.BuilderintensityCandela(float intensity)Sets the initial intensity of a spot or point light in candela. LightManager.Builderfalloff(float radius)Set the falloff distance for point lights and spot lights. LightManager.BuilderspotLightCone(float inner, float outer)Defines a spot light's angular falloff attenuation. LightManager.BuildersunAngularRadius(float angularRadius)Defines the angular radius of the sun, in degrees, between 0.25° and 20.0°The Sun as seen from Earth has an angular size of 0.526° to 0. LightManager.BuildersunHaloSize(float haloSize)Defines the halo radius of the sun. LightManager.BuildersunHaloFalloff(float haloFalloff)Defines the halo falloff of the sun. voidbuild(@NonNull() Engine engine, int entity)Adds the Light component to an entity. -
-
Constructor Detail
-
LightManager.Builder
LightManager.Builder(LightManager.Type type)
Creates a light builder and set the light's Type.- Parameters:
type- Type of Light object to create.
-
-
Method Detail
-
lightChannel
@NonNull() LightManager.Builder lightChannel(@IntRange(from = 0, to = 7) int channel, boolean enable)
Enables or disables a light channel. Light channel 0 is enabled by default.
- Parameters:
channel- Light channel to enable or disable, between 0 and 7.enable- Whether to enable or disable the light channel.
-
castShadows
@NonNull() LightManager.Builder castShadows(boolean enable)
Whether this Light casts shadows (disabled by default)
- Parameters:
enable- Enables or disables casting shadows from this Light.
-
shadowOptions
@NonNull() LightManager.Builder shadowOptions(@NonNull() LightManager.ShadowOptions options)
Sets the shadow map options for this light.
- Parameters:
options- A ShadowOptions instance
-
castLight
@NonNull() LightManager.Builder castLight(boolean enabled)
Whether this light casts light (enabled by default)
In some situations it can be useful to have a light in the scene that doesn'tactually emit light, but does cast shadows.
- Parameters:
enabled- Enables or disables lighting from this Light.
-
position
@NonNull() LightManager.Builder position(float x, float y, float z)
Sets the initial position of the light in world space.
note: The Light's position is ignored for directional lights(DIRECTIONAL or SUN)
- Parameters:
x- Light's position x coordinate in world space.y- Light's position y coordinate in world space.z- Light's position z coordinate in world space.
-
direction
@NonNull() LightManager.Builder direction(float x, float y, float z)
Sets the initial direction of a light in world space.
The light direction is specified in world space and should be a unit vector.
note: The Light's direction is ignored for POINT lights.
- Parameters:
x- light's direction x coordinate (default is 0)y- light's direction y coordinate (default is -1)z- light's direction z coordinate (default is 0)
-
color
@NonNull() LightManager.Builder color(float linearR, float linearG, float linearB)
Sets the initial color of a light.
The light color is specified in the linear sRGB color-space. The default is white.
- Parameters:
linearR- red component of the color (default is 1)linearG- green component of the color (default is 1)linearB- blue component of the color (default is 1)
-
intensity
@NonNull() LightManager.Builder intensity(float intensity)
Sets the initial intensity of a light.This method overrides any prior calls to #intensity or #intensityCandela.
- Parameters:
intensity- This parameter depends on the Type, for directional lights,it specifies the illuminance in lux (or lumen/m^2).
-
intensity
@NonNull() LightManager.Builder intensity(float watts, float efficiency)
Sets the initial intensity of a light in watts.
This call is equivalent to:Lightbulb type | Efficiency -----------------+------------ Incandescent | 2.2% Halogen | 7.0% LED | 8.7% Fluorescent | 10.7%
This method overrides any prior calls to #intensity or #intensityCandela.Builder.intensity(efficiency * 683 * watts);- Parameters:
watts- Energy consumed by a lightbulb.efficiency- Efficiency in percent.
-
intensityCandela
@NonNull() LightManager.Builder intensityCandela(float intensity)
Sets the initial intensity of a spot or point light in candela.
- Parameters:
intensity- Luminous intensity in candela.This method is equivalent to calling the plain intensity method for directional lights(Type.DIRECTIONAL or Type.SUN).This method overrides any prior calls to #intensity or #intensityCandela.
-
falloff
@NonNull() LightManager.Builder falloff(float radius)
Set the falloff distance for point lights and spot lights.
At the falloff distance, the light has no more effect on objects.
The falloff distance essentially defines a sphere of influence around the light,and therefore has an impact on performance. Larger falloffs might reduce performancesignificantly, especially when many lights are used.
Try to avoid having a large number of light's spheres of influence overlap.
The Light's falloff is ignored for directional lights(DIRECTIONAL or SUN)- Parameters:
radius- Falloff distance in world units.
-
spotLightCone
@NonNull() LightManager.Builder spotLightCone(float inner, float outer)
Defines a spot light's angular falloff attenuation.
A spot light is defined by a position, a direction and two cones, inner and outer.These two cones are used to define the angular falloff attenuation of the spot lightand are defined by the angle from the center axis to where the falloff begins (i.e.cones are defined by their half-angle).
note: The spot light cone is ignored for directional and point lights.
- Parameters:
inner- inner cone angle in radian between 0 and pi/2outer- outer cone angle in radian between inner and pi/2
-
sunAngularRadius
@NonNull() LightManager.Builder sunAngularRadius(float angularRadius)
Defines the angular radius of the sun, in degrees, between 0.25° and 20.0°The Sun as seen from Earth has an angular size of 0.526° to 0.545°
- Parameters:
angularRadius- sun's radius in degree.
-
sunHaloSize
@NonNull() LightManager.Builder sunHaloSize(float haloSize)
Defines the halo radius of the sun. The radius of the halo is defined as amultiplier of the sun angular radius.
- Parameters:
haloSize- radius multiplier.
-
sunHaloFalloff
@NonNull() LightManager.Builder sunHaloFalloff(float haloFalloff)
Defines the halo falloff of the sun. The falloff is a dimensionless numberused as an exponent.
- Parameters:
haloFalloff- halo falloff.
-
build
void build(@NonNull() Engine engine, int entity)
Adds the Light component to an entity.
If this component already exists on the given entity, it is first destroyed as if destroy was called.
warning:Currently, only 2048 lights can be created on a given Engine.- Parameters:
engine- Reference to the Engine to associate this light with.entity- Entity to add the light component to.
-
-
-
-