1
0
Fork 0

Add a compile time flag to disable the default HUD

The default HUD still relies on legacy OpenGL features, which makes it
incompatible with the GL core profile. A replacement involving Canvas
has been discussed before, but for now a toggle switch is enough to test
the core profile.
This commit is contained in:
Fernando García Liñán 2023-09-28 23:26:27 +02:00
parent d86425c8a2
commit f679764da2
6 changed files with 40 additions and 15 deletions

View file

@ -203,6 +203,7 @@ option(ENABLE_HID_INPUT "Set to ON to build HID-based input code" ${EVENT_INPUT
option(ENABLE_PLIB_JOYSTICK "Set to ON to enable legacy joystick code (default)" ON)
option(ENABLE_SWIFT "Set to ON to build the swift module" ON)
option(ENABLE_SENTRY "Set to ON to build the Sentry.io crash reporting" ON)
option(ENABLE_HUD "Set to ON to build the default head-up display" ON)
# Test-suite options.
option(ENABLE_AUTOTESTING "Set to ON to execute the test suite after building the test_suite target (default)" ON)

View file

@ -78,3 +78,5 @@
#define SENTRY_API_KEY "@sentry_api_key@"
#cmakedefine ENABLE_OSGXR
#cmakedefine ENABLE_HUD

View file

@ -34,17 +34,6 @@ set(SOURCES
transponder.cxx
turn_indicator.cxx
vertical_speed_indicator.cxx
HUD/HUD.cxx
HUD/HUD_dial.cxx
HUD/HUD_gauge.cxx
HUD/HUD_instrument.cxx
HUD/HUD_label.cxx
HUD/HUD_ladder.cxx
HUD/HUD_misc.cxx
HUD/HUD_runway.cxx
HUD/HUD_scale.cxx
HUD/HUD_tape.cxx
HUD/HUD_tbi.cxx
KLN89/kln89.cxx
KLN89/kln89_page.cxx
KLN89/kln89_page_act.cxx
@ -97,8 +86,6 @@ set(HEADERS
transponder.hxx
turn_indicator.hxx
vertical_speed_indicator.hxx
HUD/HUD.hxx
HUD/HUD_private.hxx
KLN89/kln89.hxx
KLN89/kln89_page.hxx
KLN89/kln89_page_act.hxx
@ -115,6 +102,26 @@ set(HEADERS
KLN89/kln89_page_usr.hxx
KLN89/kln89_page_vor.hxx
KLN89/kln89_page_alt.hxx
)
if (ENABLE_HUD)
list(APPEND SOURCES
HUD/HUD.cxx
HUD/HUD_dial.cxx
HUD/HUD_gauge.cxx
HUD/HUD_instrument.cxx
HUD/HUD_label.cxx
HUD/HUD_ladder.cxx
HUD/HUD_misc.cxx
HUD/HUD_runway.cxx
HUD/HUD_scale.cxx
HUD/HUD_tape.cxx
HUD/HUD_tbi.cxx
)
list(APPEND HEADERS
HUD/HUD.hxx
HUD/HUD_private.hxx
)
endif()
flightgear_component(Instruments "${SOURCES}" "${HEADERS}")

View file

@ -114,7 +114,9 @@
#include <Environment/environment_mgr.hxx>
#include <Environment/ephemeris.hxx>
#include <FDM/fdm_shell.hxx>
#ifdef ENABLE_HUD
#include <Instrumentation/HUD/HUD.hxx>
#endif
#include <Navaids/NavDataCache.hxx>
#include <Network/DNSClient.hxx>
#include <Network/HTTPClient.hxx>
@ -1081,7 +1083,9 @@ void fgCreateSubsystems(bool duringReset) {
// SGSubsystemMgr::DISPLAY
{
#ifdef ENABLE_HUD
mgr->add<HUD>();
#endif
mgr->add<flightgear::CockpitDisplayManager>();
simgear::canvas::Canvas::setSystemAdapter(

View file

@ -41,7 +41,9 @@
#include <Environment/environment_mgr.hxx>
#include <Environment/ephemeris.hxx>
#include <Instrumentation/instrument_mgr.hxx>
#include <Instrumentation/HUD/HUD.hxx>
#ifdef ENABLE_HUD
# include <Instrumentation/HUD/HUD.hxx>
#endif
#include <Systems/system_mgr.hxx>
#include <Autopilot/route_mgr.hxx>
#include <Autopilot/autopilotgroup.hxx>
@ -88,7 +90,9 @@ SGSubsystem* createSubsystemByName(const std::string& name)
MAKE_SUB(Ephemeris, "ephemeris");
MAKE_SUB(FGSystemMgr, "systems");
MAKE_SUB(FGInstrumentMgr, "instrumentation");
#ifdef ENABLE_HUD
MAKE_SUB(HUD, "hud");
#endif
MAKE_SUB(flightgear::CockpitDisplayManager, "cockpit-displays");
MAKE_SUB(FGRouteMgr, "route-manager");
MAKE_SUB(FGIO, "io");

View file

@ -96,7 +96,9 @@
#include <GUI/gui.h>
#include <GUI/Highlight.hxx>
#include <Instrumentation/HUD/HUD.hxx>
#ifdef ENABLE_HUD
# include <Instrumentation/HUD/HUD.hxx>
#endif
#include <Environment/precipitation_mgr.hxx>
#include <Environment/environment_mgr.hxx>
#include <Environment/ephemeris.hxx>
@ -146,6 +148,7 @@ private:
SGPropertyNode_ptr mConfigNode;
};
#ifdef ENABLE_HUD
class SGHUDDrawable : public osg::Drawable {
public:
@ -194,6 +197,8 @@ public:
private:
};
#endif
class FGLightSourceUpdateCallback : public osg::NodeCallback {
public:
@ -726,9 +731,11 @@ FGRenderer::setupView( void )
osg::Camera* guiCamera = getGUICamera(CameraGroup::getDefault());
if (guiCamera) {
#ifdef ENABLE_HUD
osg::Geode* hudGeode = new osg::Geode;
hudGeode->addDrawable(new SGHUDDrawable);
guiCamera->addChild(hudGeode);
#endif
#if defined(HAVE_PUI)
_puiCamera = new flightgear::PUICamera;