1
0
Fork 0

VRManager: Handle removal of prop getValue<const char *>()

Handle removal of SGPropertyNode::getValue<const char *>() in
VRManager::Listener<const char *>::valueChanged() by switching the
string listeners and VRManager setter handlers to std::string.

This fixes the following link error when VR is enabled:
ld: VRManager.cxx.o: in function `flightgear::VRManager::Listener<char const*>::valueChanged(SGPropertyNode*)':
src/Viewer/VRManager.hxx:147: undefined reference to `char const* SGPropertyNode::getValue<char const*>(std::enable_if<simgear::props::PropertyTraits<char const*>::Internal, void>::type*) const'
This commit is contained in:
James Hogan 2022-01-05 22:57:15 +00:00
parent cfe5ed0ef4
commit 89b7f8139f
No known key found for this signature in database
GPG key ID: 35CEE4862B1023F2
2 changed files with 20 additions and 20 deletions

View file

@ -144,15 +144,15 @@ void VRManager::setVisibilityMask(bool visibilityMask)
syncSettings();
}
void VRManager::setVRMode(const char * mode)
void VRManager::setVRMode(const std::string& mode)
{
osgXR::Settings::VRMode vrMode = osgXR::Settings::VRMODE_AUTOMATIC;
if (strcmp(mode, "AUTOMATIC") == 0) {
if (mode == "AUTOMATIC") {
vrMode = osgXR::Settings::VRMODE_AUTOMATIC;
} else if (strcmp(mode, "SLAVE_CAMERAS") == 0) {
} else if (mode == "SLAVE_CAMERAS") {
vrMode = osgXR::Settings::VRMODE_SLAVE_CAMERAS;
} else if (strcmp(mode, "SCENE_VIEW") == 0) {
} else if (mode == "SCENE_VIEW") {
vrMode = osgXR::Settings::VRMODE_SCENE_VIEW;
}
@ -160,15 +160,15 @@ void VRManager::setVRMode(const char * mode)
syncSettings();
}
void VRManager::setSwapchainMode(const char * mode)
void VRManager::setSwapchainMode(const std::string& mode)
{
osgXR::Settings::SwapchainMode swapchainMode = osgXR::Settings::SWAPCHAIN_AUTOMATIC;
if (strcmp(mode, "AUTOMATIC") == 0) {
if (mode == "AUTOMATIC") {
swapchainMode = osgXR::Settings::SWAPCHAIN_AUTOMATIC;
} else if (strcmp(mode,"MULTIPLE") == 0) {
} else if (mode == "MULTIPLE") {
swapchainMode = osgXR::Settings::SWAPCHAIN_MULTIPLE;
} else if (strcmp(mode,"SINGLE") == 0) {
} else if (mode == "SINGLE") {
swapchainMode = osgXR::Settings::SWAPCHAIN_SINGLE;
}
@ -176,22 +176,22 @@ void VRManager::setSwapchainMode(const char * mode)
syncSettings();
}
void VRManager::setMirrorMode(const char * mode)
void VRManager::setMirrorMode(const std::string& mode)
{
osgXR::MirrorSettings::MirrorMode mirrorMode = osgXR::MirrorSettings::MIRROR_AUTOMATIC;
int viewIndex = -1;
if (strcmp(mode, "AUTOMATIC") == 0) {
if (mode == "AUTOMATIC") {
mirrorMode = osgXR::MirrorSettings::MIRROR_AUTOMATIC;
} else if (strcmp(mode, "NONE") == 0) {
} else if (mode == "NONE") {
mirrorMode = osgXR::MirrorSettings::MIRROR_NONE;
} else if (strcmp(mode, "LEFT") == 0) {
} else if (mode == "LEFT") {
mirrorMode = osgXR::MirrorSettings::MIRROR_SINGLE;
viewIndex = 0;
} else if (strcmp(mode, "RIGHT") == 0) {
} else if (mode == "RIGHT") {
mirrorMode = osgXR::MirrorSettings::MIRROR_SINGLE;
viewIndex = 1;
} else if (strcmp(mode, "LEFT_RIGHT") == 0) {
} else if (mode == "LEFT_RIGHT") {
mirrorMode = osgXR::MirrorSettings::MIRROR_LEFT_RIGHT;
}

View file

@ -80,9 +80,9 @@ class VRManager : public osgXR::Manager
void setDepthInfo(bool depthInfo);
void setVisibilityMask(bool visibilityMask);
void setVRMode(const char * mode);
void setSwapchainMode(const char * mode);
void setMirrorMode(const char * mode);
void setVRMode(const std::string& mode);
void setSwapchainMode(const std::string& mode);
void setMirrorMode(const std::string& mode);
// osgXR::Manager overrides
@ -130,11 +130,11 @@ class VRManager : public osgXR::Manager
// Property listeners
template <typename T>
template <typename T, typename R = T>
class Listener : public SGPropertyChangeListener
{
public:
typedef void (VRManager::*SetterFn)(T v);
typedef void (VRManager::*SetterFn)(R v);
Listener(VRManager *manager, SetterFn setter) :
_manager(manager),
@ -153,7 +153,7 @@ class VRManager : public osgXR::Manager
SetterFn _setter;
};
typedef Listener<bool> ListenerBool;
typedef Listener<const char *> ListenerString;
typedef Listener<std::string, const std::string&> ListenerString;
ListenerBool _listenerEnabled;
ListenerBool _listenerDepthInfo;