Contents

layers

The layers this light illuminates.

Declaration

var layers: RenderLayer.Set { get set }

Discussion

A directional light illuminates an entity when the layers of the entity’s RenderLayerComponent intersect with this set. Entities without a RenderLayerComponent belong to defaultLayer, which is the only member of layers by default.

Define your custom layers in an extension to RenderLayer and assign them to lights and entities to control which lights affect which entities:

extension RenderLayer {
    static let hero = RenderLayer("com.myapp.hero")
}

var light = DirectionalLightComponent(color: .white, intensity: 10_000)
light.layers = [.hero]

Lights can be restricted by layer on devices with Apple6 GPU family feature support.