From 79ec0e863d4696f16cf36f5cd366fcc662b91104 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 16 May 2013 10:28:01 +0000 Subject: [PATCH] Cleaned up the WoWVxDisplay command line parsing --- src/osgViewer/Viewer.cpp | 44 ++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/src/osgViewer/Viewer.cpp b/src/osgViewer/Viewer.cpp index 75bfe2266..21fa1ba37 100644 --- a/src/osgViewer/Viewer.cpp +++ b/src/osgViewer/Viewer.cpp @@ -27,6 +27,10 @@ #include #include +#include +#include +#include + #include #include @@ -129,32 +133,23 @@ Viewer::Viewer(osg::ArgumentParser& arguments) bool wowvx42 = false; if ((wowvx20=arguments.read("--wowvx-20")) || (wowvx42=arguments.read("--wowvx-42")) || arguments.read("--wowvx")) { - int wow_content=0x02, wow_factor=0x40, wow_offset=0x80; - float wow_Zd, wow_vz, wow_M, wow_C; - if (wowvx20){ - wow_Zd = 0.459813f; - wow_vz = 6.180772f; - wow_M = -1586.34f; - wow_C = 127.5f; - } - else if (wowvx42){ - wow_Zd = 0.467481f; - wow_vz = 7.655192f; - wow_M = -1960.37f; - wow_C = 127.5f; - } + osg::ref_ptr wow = new WoWVxDisplay; - while (arguments.read("--wow-content",wow_content)) {} - while (arguments.read("--wow-factor",wow_factor)) {} - while (arguments.read("--wow-offset",wow_offset)) {} - while (arguments.read("--wow-zd",wow_Zd)) {} - while (arguments.read("--wow-vz",wow_vz)) {} - while (arguments.read("--wow-M",wow_M)) {} - while (arguments.read("--wow-C",wow_C)) {} + if (screenNum>=0) wow->setScreenNum(screenNum); + if (wowvx20) wow->WoWVx20(); + if (wowvx42) wow->WoWVx42(); - if (screenNum<0) screenNum = 0; + unsigned int c; + float v; + while (arguments.read("--wow-content",c)) { wow->setContent(c); } + while (arguments.read("--wow-factor",c)) { wow->setFactor(c); } + while (arguments.read("--wow-offset",c)) { wow->setOffset(c); } + while (arguments.read("--wow-zd",v)) { wow->setDisparityZD(v); } + while (arguments.read("--wow-vz",v)) { wow->setDisparityVZ(v); } + while (arguments.read("--wow-M",v)) { wow->setDisparityM(v); } + while (arguments.read("--wow-C",v)) { wow->setDisparityC(v); } - setUpViewForWoWVxDisplay( screenNum, wow_content, wow_factor, wow_offset, wow_Zd, wow_vz, wow_M, wow_C ); + apply(wow.get()); } else if ((ss3d=arguments.read("--3d-sd")) || arguments.read("--panoramic-sd")) { @@ -303,7 +298,8 @@ bool Viewer::readConfiguration(const std::string& filename) ViewConfig* config = dynamic_cast(object.get()); if (config) { - apply(config); + OSG_NOTICE<<"Using osgViewer::Config : "<className()<configure(*this); return true; }