From Stephan Huber, RestHttpDevice plugin for support of remote application control via Rest http.

This commit is contained in:
Robert Osfield
2012-10-30 12:31:27 +00:00
parent d879cd7715
commit fa2fb07609
25 changed files with 2289 additions and 0 deletions

View File

@@ -401,6 +401,36 @@ int main( int argc, char **argv )
viewer.readConfiguration(configurationFile);
doSetViewer = false;
}
std::string device;
while (arguments.read("--device", device))
{
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device);
if (dev.valid())
{
viewer.addDevice(dev.get());
}
}
if (arguments.read("--http-control"))
{
std::string server_address = "localhost";
std::string server_port = "8080";
std::string document_root = "htdocs";
while (arguments.read("--http-server-address", server_address)) {}
while (arguments.read("--http-server-port", server_port)) {}
while (arguments.read("--http-document-root", document_root)) {}
osg::ref_ptr<osgDB::Options> device_options = new osgDB::Options("documentRegisteredHandlers");
osg::ref_ptr<osgGA::Device> rest_http_device = osgDB::readFile<osgGA::Device>(server_address+":"+server_port+"/"+document_root+".resthttp", device_options);
if (rest_http_device.valid())
{
viewer.addDevice(rest_http_device.get());
}
}
// set up stereo masks
viewer.getCamera()->setCullMask(0xffffffff);