From Stephan Huber, RestHttpDevice plugin for support of remote application control via Rest http.
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
#include <osgGA/TerrainManipulator>
|
||||
#include <osgGA/SphericalManipulator>
|
||||
|
||||
#include <osgGA/Device>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <osg/GLExtensions>
|
||||
@@ -147,6 +149,7 @@ int main(int argc, char** argv)
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--image <filename>","Load an image and render it on a quad");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--dem <filename>","Load an image/DEM and render it on a HeightField");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--login <url> <username> <password>","Provide authentication information for http file access.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--device <device-name>","add named device to the viewer");
|
||||
|
||||
osgViewer::Viewer viewer(arguments);
|
||||
|
||||
@@ -182,6 +185,16 @@ int main(int argc, char** argv)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
// set up the camera manipulators.
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user