public class PointLight(
override val color: Color,
override val position: LightPosition,
public val elevation: Dp,
public val falloffRadius: Dp,
@FloatRange(from = 0.0) override val intensity: Float,
) : Light()
A light that radiates equally in every direction from a single point in front of the surface, like a bare bulb.
elevation is measured from the plane the surface rests on. A surface with a thickness (see SurfaceGeometrySpec) rises towards the light, so the light's height above it is elevation - thickness. Keep elevation larger than the thickness so the light stays in front of the surface.
Brightness falls away with distance and reaches zero at falloffRadius. The distance is measured in three dimensions, so it includes the light's height above the surface: a light raised falloffRadius or more above the surface cannot reach it at all, and lights nothing. Keep falloffRadius comfortably larger than elevation - thickness.
Parameters
| color | color emitted by this light. |
| position | where the light sits in the plane of the surface. |
| elevation | distance of the light in front of the plane the surface rests on, towards the viewer. The light's height above the surface itself is elevation - thickness. |
| falloffRadius | distance at which the light has fully faded out. A radius of zero or less disables falloff entirely, so the light reaches the whole surface at full strength. |
| intensity | multiplier applied to color. A light with an intensity of 0 contributes nothing. |
Throws: IllegalArgumentException
if elevation or falloffRadius is Dp.Unspecified.
Functions
equals
override fun equals(other: Any?): Boolean
hashCode
override fun hashCode(): Int
toString
override fun toString(): String
copy
override fun copy(position: LightPosition): Light
packUniforms
override fun Density.packUniforms(
index: Int,
lightTypes: IntArray,
lightColors: FloatArray,
lightPositions: FloatArray,
lightDirections: FloatArray,
lightFalloffRadii: FloatArray,
lightCutoffCosines: FloatArray,
lightIntensities: FloatArray,
)