Light2D
Casts light in a 2D environment.
Light2D.swift:17class Light2D
Casts light in a 2D environment. A light is defined as a color, an energy value, a mode (see constants), and various other parameters (range and shadows-related).
Superclasses
class Node2D
A 2D game object, inherited by all 2D-related nodes. Has a position, rotation, scale, and Z index.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
Instance members
var blendMode: Light2D.BlendMode
The Light2D’s blend mode. See
BlendMode
constants for values.var color: Color
The Light2D’s
Color
.var editorOnly: Bool
If
true
, Light2D will only appear when editing the scene.var enabled: Bool
If
true
, Light2D will emit light.var energy: Double
The Light2D’s energy value. The larger the value, the stronger the light.
var rangeItemCullMask: Int32
The layer mask. Only objects with a matching
lightMask
will be affected by the Light2D. See alsoshadowItemCullMask
, which affects which objects can cast shadows.var rangeLayerMax: Int32
Maximum layer value of objects that are affected by the Light2D.
var rangeLayerMin: Int32
Minimum layer value of objects that are affected by the Light2D.
var rangeZMax: Int32
Maximum
z
value of objects that are affected by the Light2D.var rangeZMin: Int32
Minimum
z
value of objects that are affected by the Light2D.var shadowColor: Color
Color
of shadows cast by the Light2D.var shadowEnabled: Bool
If
true
, the Light2D will cast shadows.var shadowFilter: Light2D.ShadowFilter
Shadow filter type. See
ShadowFilter
for possible values.var shadowFilterSmooth: Double
Smoothing value for shadows. Higher values will result in softer shadows, at the cost of visible streaks that can appear in shadow rendering.
shadowFilterSmooth
only has an effect ifshadowFilter
is .pcf5 or .pcf13.var shadowItemCullMask: Int32
The shadow mask. Used with
LightOccluder2D
to cast shadows. Only occluders with a matchinglightMask
will cast shadows. See alsorangeItemCullMask
, which affects which objects can receive the light.func getHeight(
) -> Double Returns the light’s height, which is used in 2D normal mapping. See
height
andheight
.func setHeight(Double
) Sets the light’s height, which is used in 2D normal mapping. See
height
andheight
.
Subclasses
class DirectionalLight2D
Directional 2D light from a distance.
class PointLight2D
Positional 2D light source.