FlightGear Newsletter January 2014: Difference between revisions

Jump to navigation Jump to search
Line 31: Line 31:


Continue reading at [[Soaring instrumentation sdk]]...
Continue reading at [[Soaring instrumentation sdk]]...
=== Random Buildings ===
=== Behind the Scenes of: Nasal Loops ===
Nasal has several ways to implement an iteration.
A polling loop is akin to somebody permanently running to a room to check if the lights are on - a listener is like somebody being INSIDE the room SLEEPING and only WAKING up once the lights are turned on.
The setlistener API is intended to catch rare events. Avoid complex loops if you don't have to.
In general, "loops" are not bad or expensive, it really depends on what you're doing inside the loop. A loop will be executed within a single frame normally - so a long-running loop will add up to the frame spacing. There's nothing magic about timers or listeners - they can just as well inflate your frame spacing. It doesn't matter if the code/callback is run inside a loop, timer or a listener - what matter is the complexity of the code that runs. timers or listeners are only really preferable over loops when it comes to checking for some condition, because polling is called "busy-waiting", i.e. more expensive, see my previous analogy. A listener or timer "waiting" is not resource-hungry, it's not even busy - it's not doing anything until it is "fired". Regarding setprop/getprop - they're not as bad as we used to think - in fact, Thorsten has shown that they're preferable over most props.nas APIs, this may however change once the whole thing is replaced with cppbind bindings.
Well loops aren't bad necessarily: they can be used in a less-than-optimal manner, but there are often times where they make a lot of sense.


Continue reading at [[Nasal Loops]]...


=== Atmospheric Light Scattering ===
=== Atmospheric Light Scattering ===

Navigation menu