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.
Properties
| Type | Name | Default |
|---|---|---|
float | writes_per_second | 30.0 |
Methods
| Returns | Method |
|---|---|
void | set_entity(new_entity: HammeriteEntity) |
void | set_enabled(on: bool) |
bool | is_enabled() |
float | get_lit_modulation() |
void | set_editor_active(active: bool) |
bool | draws_editor_gizmos_only_when_picked() |
void | draw_editor_gizmos(gizmos: HammeriteGizmoBuffer) |
bool | can_simulate() |
void | start_simulation() |
void | stop_simulation() |
void | set_seen(seen: bool) |
void | reset_simulation() |
Dictionary[StringName, Variant] | get_runtime_properties() |
void | set_runtime_property(key: StringName, value) |
void | reset_runtime_properties() |
bool | can_trigger() |
void | trigger(impulse = null) |
void | apply_entity_property(prop_name: StringName, value) |
Property descriptions
writes_per_second
var writes_per_second: float = 30.0
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
set_entity()
func set_entity(new_entity: HammeriteEntity) -> void
As HammeritePointEntityNode3D.set_entity(), and takes the authored enabled (default true) as the state it starts in and resets to.
set_enabled()
func set_enabled(on: bool) -> void
Switches the light on or off, at once, simulating or not. What trigger() does with a bool.
is_enabled()
func is_enabled() -> bool
Whether the light is on: lit at get_lit_modulation(), rather than at nothing.
get_lit_modulation()
func get_lit_modulation() -> float
How bright this light is while it is on, from 0 to 1. 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_editor_active()
func set_editor_active(active: bool) -> void
Overrides
HammeritePointEntityNode3D.set_editor_active()
draws_editor_gizmos_only_when_picked()
func draws_editor_gizmos_only_when_picked() -> bool
Overrides
HammeritePointEntityNode3D.draws_editor_gizmos_only_when_picked()
draw_editor_gizmos()
func draw_editor_gizmos(gizmos: HammeriteGizmoBuffer) -> void
Overrides
HammeritePointEntityNode3D.draw_editor_gizmos()
can_simulate()
func can_simulate() -> bool
Named or not. Its slot is baked either way, and an unnamed one may still flicker - see get_lit_modulation() - so it runs and is switched by its node like any other; a name is only how something else finds it.
start_simulation()
func start_simulation() -> void
Overrides
HammeritePointEntityNode3D.start_simulation()
stop_simulation()
func stop_simulation() -> void
Overrides
HammeritePointEntityNode3D.stop_simulation()
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.
Experimental: HammeriteMap3D's to call.
reset_simulation()
func reset_simulation() -> void
Overrides
HammeritePointEntityNode3D.reset_simulation()
get_runtime_properties()
func get_runtime_properties() -> Dictionary[StringName, Variant]
The runtime enabled and position (in the map's space), as a copy.
set_runtime_property()
func set_runtime_property(key: StringName, value) -> void
Setting enabled switches the light at once, simulating or not; position moves the node, in the map's space, which does not move its baked light.
reset_runtime_properties()
func reset_runtime_properties() -> void
Overrides
HammeritePointEntityNode3D.reset_runtime_properties()
can_trigger()
func can_trigger() -> bool
Always: named or not, it can be switched. A name is only how something else finds it.
trigger()
func trigger(impulse = null) -> void
A bool switches it on or off (set_enabled()); anything else switches it over.
apply_entity_property()
func apply_entity_property(prop_name: StringName, value) -> void
Overrides
.