18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-21 08:35:01 +01:00
Files
maszyna/model/AnimModel.h
maj00r 8794c80c58 fix(models): a scenery light that is off no longer shows lit for a moment the first time it comes into view (#407)
* fix(models): a scenery light that is off no longer shows lit for a moment the first time it comes into view

Since d13c27a7 (the light blinking rework) the opacity of a light changes step
by step from its last value, and the opacities start at 1. RaAnimate runs only
for the instances that are drawn, so a model with "lights 0" (a W24 LED
indicator, for one) was drawn lit when it first came into range and faded out
over 0.45 s. Before d13c27a7 the opacity of a plain on/off light was worked out
anew from a timer starting at 0, so a light that is off was off from the first
frame.

Now the first time an instance is animated its lights take their current
state at once, whether it came from the definition or from an event since.
Every later change fades as before. The light threshold modes (ls_Dark,
ls_Home) are untouched. The only other difference from before d13c27a7: a
light that is on no longer fades in the first time it is drawn.

* fix(models): the light opacity step written without an implicit double to float conversion (Sonar S5276)

The sum is still worked out in double and rounded to float once, as the
compound assignment did, so the result is the same to the bit.

---------

Co-authored-by: maj00r <maj00r@host>
2026-11-20 03:39:52 +01:00

11 KiB