HammeriteDynamicLight3D
Core: entities. Inherits HammeritePointEntityNode3D < Node3D
A baked light that can be switched and dimmed at run time: what HammeriteDynamicPointLight3D and HammeriteDynamicDirectionalLight3D are.
Baked into one of a face's four light slots rather than into the static layer, and switched by modulating that slot (HammeritePointEntityNode3D.set_light_modulation()) - every face and prop it lights follows at no cost beyond a uniform. Named or not, it runs and can be switched; a name is how something else finds it (HammeriteMap3D.trigger_named()).
Extend one and override _get_lit_modulation() for a flicker or a pulse. Register the subclass as the classname of a light type, or of a type derived from one (HammeriteEntityTypeRegistry.extend_point() with a light as its base): the bake picks its lights by type (HammeriteEntityTypeRegistry.is_light()), and under a type of its own the light is never baked and switching it does nothing.
Its frame runs after a script's own _process, so a subclass counting time there has counted it before the light asks get_lit_modulation().
Properties
| Type | Name | Default |
|---|---|---|
float | writes_per_second |
Methods
| Returns | Method |
|---|---|
float | _get_lit_modulation() virtual |
void | _set_seen(seen: bool) virtual |
float | get_lit_modulation() |
bool | is_enabled() const |
void | set_enabled(on: bool) |
void | set_seen(seen: bool) |
Property descriptions
writes_per_second
var writes_per_second: float
How many times a second this light writes its brightness to what it lights while it is seen, at most; zero is every frame. A write reaches every face and prop on the light's lightmaps - on a Thief mission, a dozen flickering lamps in view were 162 materials and three-quarters of a millisecond a frame - and a flame does not flicker faster than this.
Method descriptions
_get_lit_modulation()
func _get_lit_modulation() -> float
How bright this light is while it is on, from 0 to 1, as get_lit_modulation() answers it. Override it for a light that moves - a flicker, a pulse - rather than setting the modulation after this has: the two would disagree every frame, and every surface and probe the light reaches would be told both.
_set_seen()
func _set_seen(seen: bool) -> void
Told after the light itself, whenever set_seen() is called.
get_lit_modulation()
func get_lit_modulation() -> float
How bright this light is while it is on, from 0 to 1: a script's _get_lit_modulation(), or 1.
is_enabled()
func is_enabled() -> bool
Whether the light is on: lit at get_lit_modulation(), rather than at nothing.
set_enabled()
func set_enabled(on: bool) -> void
Switches the light on or off, at once, simulating or not. What HammeritePointEntityNode3D.trigger() does with a bool.
set_seen()
func set_seen(seen: bool) -> void
Whether the view this light is drawn in can see a room it lights; HammeriteMap3D says, when the rooms in view change. Unseen, it runs no frame at all, and seen again it writes on the next.