Unifying the 2D rendering backend via canvas: Difference between revisions

Jump to navigation Jump to search
m
→‎HUD: restructure
No edit summary
m (→‎HUD: restructure)
Line 57: Line 57:


== HUD ==
== HUD ==
For the HUD, the question is if the Canvas-HUD could gain a Nasal glue layer, to replicate the C++ HUD?


if we are to move beyond the legacy C++ code, we need a layer (in Nasal or C++) that parses the existing HUID XML, and looks/works close-to-identical to the current version.  
This would then allow the C++ HUD code to be removed entirely, which would be a GoodThing(TM) since it does archaic OpenGL rendering. If Nasal is more your thing than C++, that might be another way to help hasten the death of PLIB <ref>https://sourceforge.net/p/flightgear/mailman/message/36289586/</ref>


There is no conceptual limitation in the Canvas that prevents us doing everything the built-in HUD does.<ref>https://sourceforge.net/p/flightgear/mailman/message/36401872/</ref>  
There is no conceptual limitation in the Canvas that prevents us doing everything the built-in HUD does.<ref>https://sourceforge.net/p/flightgear/mailman/message/36401872/</ref>  


For the HUD, I wonder if the Canvas-HUD could gain a Nasal glue layer, to replicate the C++ HUD? This would then allow the C++ HUD code to be removed entirely, which would be a GoodThing(TM) since it does archaic OpenGL rendering. If Nasal is more your thing than C++, that might be another way to help hasten the death of PLIB <ref>https://sourceforge.net/p/flightgear/mailman/message/36289586/</ref>
 
If we are to move beyond the legacy C++ code, we need a layer (in Nasal or C++) that parses the existing HUID XML, and looks/works close-to-identical to the current version.  


We could for example just add some more parseXXX functions (like parsesvg) which parse a dialog/hud/whathever file and create a canvas from it. So we would just have to modify eg. the show-dialog command to create a canvas and call the parser.<ref>https://sourceforge.net/p/flightgear/mailman/message/29589689/</ref>
We could for example just add some more parseXXX functions (like parsesvg) which parse a dialog/hud/whathever file and create a canvas from it. So we would just have to modify eg. the show-dialog command to create a canvas and call the parser.<ref>https://sourceforge.net/p/flightgear/mailman/message/29589689/</ref>


replace the HUD (HUD.cxx and related code) with a Canvas implementation. This is a confusing scheme, since we have ‘old’ and ‘new’ C++ HUDs (but I recall I unified their rendering some years ago), and some aircraft already using ‘custom Canvas HUDs’, i.e totally independent of the ‘built-in’ HUD.
Replace the HUD (HUD.cxx and related code) with a Canvas implementation. This is a confusing scheme, since we have ‘old’ and ‘new’ C++ HUDs (but I recall I unified their rendering some years ago), and some aircraft already using ‘custom Canvas HUDs’, i.e totally independent of the ‘built-in’ HUD.


To be clear, this is the HUD you get by pressing ‘h’ key in the sim. It’s configured by an XML file: FG_DATA/Huds/default.xml - and you can see in that directory, other configs are possible - the ‘new C++ HUD’ layer allows arbitrary placement of HUD elements defined by these XML.
To be clear, this is the HUD you get by pressing ‘h’ key in the sim. It’s configured by an XML file: FG_DATA/Huds/default.xml - and you can see in that directory, other configs are possible - the ‘new C++ HUD’ layer allows arbitrary placement of HUD elements defined by these XML.


*Some* aircraft, but I don’t know how many, use the C++ HUD system, but replace the default HUD with their own - see the F16 example file also in FG_DATA/Huds for example.
Some aircraft, but I don’t know how many, use the C++ HUD system, but replace the default HUD with their own - see the F16 example file also in FG_DATA/Huds for example.


The aim would be to replace the C++ code with a Nasal HUD layer, likely in FG_DATA/Canvas/Hud - with one Canvas HUD item per each of the current C++ HUD items (ladder, tape, dial etc). Each one should be fairly easy to build with some path, text and group commands.  
The aim would be to replace the C++ code with a Nasal HUD layer, likely in FG_DATA/Canvas/Hud - with one Canvas HUD item per each of the current C++ HUD items (ladder, tape, dial etc). Each one should be fairly easy to build with some path, text and group commands.  
Line 92: Line 94:


Canvas-HUD-that-replaces-the-C++-one would appear the same way Canvas tooltips / popups do. (or Canvas dialogs, or…)<ref>https://sourceforge.net/p/flightgear/mailman/message/36401971/</ref>
Canvas-HUD-that-replaces-the-C++-one would appear the same way Canvas tooltips / popups do. (or Canvas dialogs, or…)<ref>https://sourceforge.net/p/flightgear/mailman/message/36401971/</ref>
== 2D Panels ==
== osgText ==


== Planning ==
== Planning ==

Navigation menu