Class Light
- java.lang.Object
-
- com.google.ar.sceneform.rendering.Light
-
@RequiresApi(api=24) public class Light extends java.lang.Object
Light property store.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Light.Builder
Factory class forLight
static class
Light.Type
Type of Light Source
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Light.Builder
builder(Light.Type type)
Constructs a default light, if nothing else is setLightInstance
createInstance(TransformProvider transformProvider)
Color
getColor()
Get the RGBColor
of the light.float
getFalloffRadius()
Get the falloff radius of the light.float
getInnerConeAngle()
Get the inner cone angle for spotlights.float
getIntensity()
Get the intensity of the light.Vector3
getLocalDirection()
Vector3
getLocalPosition()
float
getOuterConeAngle()
Get the outer cone angle for spotlights.Light.Type
getType()
Get the lightLight.Type
.boolean
isShadowCastingEnabled()
Returns true if the light has shadow casting enabled.void
setColor(Color color)
Sets the "RGB" color of the light.void
setColorTemperature(float temperature)
Sets the "RGB" color of the light based on the desired "color temperature."void
setFalloffRadius(float falloffRadius)
Sets the range that the light intensity falls off to zero.void
setInnerConeAngle(float coneInner)
Spotlights shine light in a cone, this value determines the size of the inner part of the cone.void
setIntensity(float intensity)
Sets the light intensity which determines how bright the light is in Lux (lx) or Lumens (lm) (depending on the light type).void
setOuterConeAngle(float coneOuter)
Spotlights shine light in a cone, this value determines the size of the outer part of the cone.
-
-
-
Method Detail
-
builder
public static Light.Builder builder(Light.Type type)
Constructs a default light, if nothing else is set
-
setColor
public void setColor(Color color)
Sets the "RGB" color of the light. Note that intensity is a separate parameter, so you should set the pure color (i.e. each channel is in the [0,1] range). However setting values outside that range is valid.- Parameters:
color
- "RGB" color, the default is 0xffffffff
-
setColorTemperature
public void setColorTemperature(float temperature)
Sets the "RGB" color of the light based on the desired "color temperature."- Parameters:
temperature
- color temperature in Kelvin on a scale from 1,000 to 10,000K. Typical commercial and residential lighting falls somewhere in the 2000K to 6500K range.
-
setIntensity
public void setIntensity(float intensity)
Sets the light intensity which determines how bright the light is in Lux (lx) or Lumens (lm) (depending on the light type). Larger values produce brighter lights and near zero values generate very little light. A household light bulb will generally have an intensity between 800 - 2500 lm whereas sunlight will be around 120,000 lx. There is no absolute upper bound but values larger than sunlight (120,000 lx) are generally not needed.- Parameters:
intensity
- the intensity of the light, values greater than one are valid. The intensity will be clamped and cannot be zero or negative. For directional lights the default is 420 lx. For other other lights the default is 2500 lm.
-
setFalloffRadius
public void setFalloffRadius(float falloffRadius)
Sets the range that the light intensity falls off to zero. This has no affect on theLight.Type.DIRECTIONAL
type.- Parameters:
falloffRadius
- the light radius in world units, default is 10.0
-
setInnerConeAngle
public void setInnerConeAngle(float coneInner)
Spotlights shine light in a cone, this value determines the size of the inner part of the cone. The intensity is interpolated between the inner and outer cone angles - meaning if they are the same than the cone is perfectly sharp. Generally you will want the inner cone to be smaller than the outer cone to avoid aliasing.- Parameters:
coneInner
- inner cone angle in radians, default 0.5
-
setOuterConeAngle
public void setOuterConeAngle(float coneOuter)
Spotlights shine light in a cone, this value determines the size of the outer part of the cone. The intensity is interpolated between the inner and outer cone angles - meaning if they are the same than the cone is perfectly sharp. Generally you will want the inner cone to be smaller than the outer cone to avoid aliasing.- Parameters:
coneOuter
- outer cone angle in radians, default is 0.6
-
getType
public Light.Type getType()
Get the lightLight.Type
.
-
isShadowCastingEnabled
public boolean isShadowCastingEnabled()
Returns true if the light has shadow casting enabled.
-
getLocalPosition
public Vector3 getLocalPosition()
-
getLocalDirection
public Vector3 getLocalDirection()
-
getIntensity
public float getIntensity()
Get the intensity of the light.
-
getFalloffRadius
public float getFalloffRadius()
Get the falloff radius of the light.
-
getInnerConeAngle
public float getInnerConeAngle()
Get the inner cone angle for spotlights.
-
getOuterConeAngle
public float getOuterConeAngle()
Get the outer cone angle for spotlights.
-
createInstance
public LightInstance createInstance(TransformProvider transformProvider)
-
-