Added --keystone <filename> command line support into DisplaySettings, and added OSG_KEYSTONE_FILES env var support into osg::DisplaySettings.

This commit is contained in:
Robert Osfield 2013-05-10 11:56:09 +00:00
parent 9c1c34d765
commit 9eb5465ff5
2 changed files with 52 additions and 0 deletions

View File

@ -65,6 +65,19 @@ int main( int argc, char **argv )
// add camera manipulator // add camera manipulator
viewer.setCameraManipulator(new osgGA::TrackballManipulator()); viewer.setCameraManipulator(new osgGA::TrackballManipulator());
OSG_NOTICE<<"KeystoneFileNames.size()="<<osg::DisplaySettings::instance()->getKeystoneFileNames().size()<<std::endl;
for(osg::DisplaySettings::FileNames::iterator itr = osg::DisplaySettings::instance()->getKeystoneFileNames().begin();
itr != osg::DisplaySettings::instance()->getKeystoneFileNames().end();
++itr)
{
OSG_NOTICE<<" keystone ="<<*itr<<std::endl;
}
if (ds->getStereo()) if (ds->getStereo())
{ {
viewer.setUpViewForStereo(ds); viewer.setUpViewForStereo(ds);

View File

@ -292,6 +292,9 @@ static ApplicationUsageProxy DisplaySetting_e26(ApplicationUsage::ENVIRONMENTAL_
static ApplicationUsageProxy DisplaySetting_e27(ApplicationUsage::ENVIRONMENTAL_VARIABLE, static ApplicationUsageProxy DisplaySetting_e27(ApplicationUsage::ENVIRONMENTAL_VARIABLE,
"OSG_SWAP_METHOD <method>", "OSG_SWAP_METHOD <method>",
"DEFAULT | EXCHANGE | COPY | UNDEFINED. Select preferred swap method."); "DEFAULT | EXCHANGE | COPY | UNDEFINED. Select preferred swap method.");
static ApplicationUsageProxy DisplaySetting_e28(ApplicationUsage::ENVIRONMENTAL_VARIABLE,
"OSG_KEYSTONE_FILES <filename>[:filename]..",
"Specify filenames of keystone parameter files. Under Windows use ; to deliminate files, otherwise use :");
void DisplaySettings::readEnvironmentalVariables() void DisplaySettings::readEnvironmentalVariables()
@ -585,6 +588,31 @@ void DisplaySettings::readEnvironmentalVariables()
} }
} }
if ((ptr = getenv("OSG_KEYSTONE_FILES")) != 0)
{
#if defined(WIN32) && !defined(__CYGWIN__)
char delimitor = ';';
#else
char delimitor = ':';
#endif
std::string paths(ptr);
if (!paths.empty())
{
std::string::size_type start = 0;
std::string::size_type end;
while ((end = paths.find_first_of(delimitor,start))!=std::string::npos)
{
_keystoneFileNames.push_back(std::string(paths,start,end-start));
start = end+1;
}
std::string lastPath(paths,start,std::string::npos);
if (!lastPath.empty())
_keystoneFileNames.push_back(lastPath);
}
}
} }
void DisplaySettings::readCommandLine(ArgumentParser& arguments) void DisplaySettings::readCommandLine(ArgumentParser& arguments)
@ -664,6 +692,17 @@ void DisplaySettings::readCommandLine(ArgumentParser& arguments)
_numMultiSamples = atoi(str.c_str()); _numMultiSamples = atoi(str.c_str());
} }
if (arguments.read("--keystone",str))
{
if (!_keystoneFileNames.empty()) _keystoneFileNames.clear();
_keystoneFileNames.push_back(str);
while(arguments.read("--keystone",str))
{
_keystoneFileNames.push_back(str);
}
}
while(arguments.read("--cc")) while(arguments.read("--cc"))
{ {
_compileContextsHint = true; _compileContextsHint = true;