Updated wrappers
This commit is contained in:
parent
ef47733ea1
commit
75bd8e9a1e
@ -16,7 +16,7 @@
|
||||
#include <osg/Switch>
|
||||
#include <osgText/Text>
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgViewer/CompositeViewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
|
||||
#include <osgGA/TrackballManipulator>
|
||||
@ -29,6 +29,76 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
void addEventHandlers(osgViewer::View* view)
|
||||
{
|
||||
// set up the camera manipulators.
|
||||
view->setCameraManipulator( new osgGA::TrackballManipulator() );
|
||||
|
||||
// add the state manipulator
|
||||
view->addEventHandler( new osgGA::StateSetManipulator(view->getCamera()->getOrCreateStateSet()) );
|
||||
|
||||
// add the thread model handler
|
||||
view->addEventHandler(new osgViewer::ThreadingHandler);
|
||||
|
||||
// add the window size toggle handler
|
||||
view->addEventHandler(new osgViewer::WindowSizeHandler);
|
||||
|
||||
// add the stats handler
|
||||
view->addEventHandler(new osgViewer::StatsHandler);
|
||||
|
||||
// add the record camera path handler
|
||||
view->addEventHandler(new osgViewer::RecordCameraPathHandler);
|
||||
|
||||
// add the LOD Scale handler
|
||||
view->addEventHandler(new osgViewer::LODScaleHandler);
|
||||
|
||||
// add the screen capture handler
|
||||
view->addEventHandler(new osgViewer::ScreenCaptureHandler);
|
||||
}
|
||||
|
||||
|
||||
class AddViewHandler : public osgGA::GUIEventHandler
|
||||
{
|
||||
public:
|
||||
AddViewHandler(osgViewer::CompositeViewer* viewer, osg::Node* sceneRoot)
|
||||
: _viewer(viewer), _sceneRoot(sceneRoot) {}
|
||||
|
||||
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
|
||||
{
|
||||
if (ea.getEventType() == osgGA::GUIEventAdapter::KEYDOWN && ea.getKey()== 'a')
|
||||
{
|
||||
osgViewer::View* view = new osgViewer::View;
|
||||
|
||||
view->setUpViewInWindow(50, 50, 800, 600);
|
||||
view->getCamera()->getGraphicsContext()->realize();
|
||||
|
||||
view->setSceneData(_sceneRoot.get());
|
||||
addEventHandlers(view);
|
||||
|
||||
_viewer->stopThreading();
|
||||
|
||||
_viewer->addView(view);
|
||||
|
||||
osg::notify(osg::NOTICE)<<"osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts()="<< osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts()<<std::endl;
|
||||
|
||||
view->getSceneData()->setThreadSafeRefUnref(true);
|
||||
view->getSceneData()->resizeGLObjectBuffers(osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts());
|
||||
|
||||
_viewer->startThreading();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
osg::observer_ptr<osgViewer::CompositeViewer> _viewer;
|
||||
osg::ref_ptr<osg::Node> _sceneRoot;
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// use an ArgumentParser object to manage the program arguments.
|
||||
@ -41,7 +111,7 @@ int main(int argc, char** argv)
|
||||
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.");
|
||||
|
||||
osgViewer::Viewer viewer(arguments);
|
||||
osgViewer::CompositeViewer viewer(arguments);
|
||||
|
||||
unsigned int helpType = 0;
|
||||
if ((helpType = arguments.readHelpType()))
|
||||
@ -76,55 +146,9 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
// set up the camera manipulators.
|
||||
{
|
||||
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
|
||||
|
||||
keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
|
||||
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
|
||||
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
|
||||
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
|
||||
|
||||
std::string pathfile;
|
||||
char keyForAnimationPath = '5';
|
||||
while (arguments.read("-p",pathfile))
|
||||
{
|
||||
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||
if (apm || !apm->valid())
|
||||
{
|
||||
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
||||
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
||||
keyswitchManipulator->selectMatrixManipulator(num);
|
||||
++keyForAnimationPath;
|
||||
}
|
||||
}
|
||||
|
||||
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
||||
}
|
||||
|
||||
// add the state manipulator
|
||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||
|
||||
// add the thread model handler
|
||||
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
||||
|
||||
// add the window size toggle handler
|
||||
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
||||
|
||||
// add the stats handler
|
||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||
|
||||
// add the help handler
|
||||
viewer.addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage()));
|
||||
|
||||
// add the record camera path handler
|
||||
viewer.addEventHandler(new osgViewer::RecordCameraPathHandler);
|
||||
|
||||
// add the LOD Scale handler
|
||||
viewer.addEventHandler(new osgViewer::LODScaleHandler);
|
||||
|
||||
// add the screen capture handler
|
||||
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
|
||||
osg::ref_ptr<osgViewer::View> defaultView = new osgViewer::View;
|
||||
viewer.addView(defaultView.get());
|
||||
addEventHandlers(defaultView.get());
|
||||
|
||||
// load the data
|
||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
||||
@ -146,13 +170,15 @@ int main(int argc, char** argv)
|
||||
|
||||
|
||||
// optimize the scene graph, remove redundant nodes and state etc.
|
||||
osgUtil::Optimizer optimizer;
|
||||
optimizer.optimize(loadedModel.get());
|
||||
//osgUtil::Optimizer optimizer;
|
||||
//optimizer.optimize(loadedModel.get());
|
||||
|
||||
viewer.setSceneData( loadedModel.get() );
|
||||
defaultView->setSceneData( loadedModel.get() );
|
||||
|
||||
defaultView->setUpViewInWindow(50, 50, 800, 600);
|
||||
defaultView->addEventHandler(new AddViewHandler(&viewer, loadedModel.get()));
|
||||
|
||||
viewer.realize();
|
||||
|
||||
return viewer.run();
|
||||
|
||||
}
|
||||
|
@ -323,6 +323,39 @@ suppress reflector "osg::ref_ptr< const osgFX::Effect >"
|
||||
|
||||
# Doxygen incorrectly parses function typedefs as methods
|
||||
|
||||
configure reflector "osg::VertexProgram::Extensions"
|
||||
configure method "__typedef__void__APIENTRY_P1"
|
||||
replace with ""
|
||||
end
|
||||
configure method "__typedef__GLboolean__APIENTRY_P1"
|
||||
replace with ""
|
||||
end
|
||||
end
|
||||
|
||||
configure reflector "osg::StencilTwoSided::Extensions"
|
||||
configure method "__typedef__void__APIENTRY_P1"
|
||||
replace with ""
|
||||
end
|
||||
end
|
||||
|
||||
configure reflector "osg::Texture3D::Extensions"
|
||||
configure method "__typedef__void__APIENTRY_P1"
|
||||
replace with ""
|
||||
end
|
||||
end
|
||||
|
||||
configure reflector "osg::GL2Extensions"
|
||||
configure method "__typedef__void__APIENTRY_P1"
|
||||
replace with ""
|
||||
end
|
||||
configure method "__typedef__GLboolean__APIENTRY_P1"
|
||||
replace with ""
|
||||
end
|
||||
configure method "__typedef__GLuint__APIENTRY_P1"
|
||||
replace with ""
|
||||
end
|
||||
end
|
||||
|
||||
configure reflector "osg::BufferObject::Extensions"
|
||||
configure method "__typedef__void__APIENTRY_P1"
|
||||
replace with ""
|
||||
|
@ -721,12 +721,7 @@ BEGIN_OBJECT_REFLECTOR(osg::GL2Extensions)
|
||||
__void__Set__unsigned_int__GL2Extensions_P1_S,
|
||||
"allows users to override the extensions across graphics contexts. ",
|
||||
"typically used when you have different extensions supported across graphics pipes but need to ensure that they all use the same low common denominator extensions. ");
|
||||
I_ProtectedMethod1(typedef, GLuint, IN, APIENTRY *, GetHandleProc,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__typedef__GLuint__APIENTRY_P1,
|
||||
"",
|
||||
"");
|
||||
|
||||
I_SimpleProperty(GLuint, CurrentProgram,
|
||||
__GLuint__getCurrentProgram,
|
||||
0);
|
||||
|
@ -268,12 +268,7 @@ BEGIN_OBJECT_REFLECTOR(osg::StencilTwoSided::Extensions)
|
||||
__void__glActiveStencilFace__GLenum,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(typedef, void, IN, APIENTRY *, ActiveStencilFaceProc,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__typedef__void__APIENTRY_P1,
|
||||
"",
|
||||
"");
|
||||
|
||||
I_SimpleProperty(bool, StencilTwoSidedSupported,
|
||||
0,
|
||||
__void__setStencilTwoSidedSupported__bool);
|
||||
|
@ -346,42 +346,12 @@ BEGIN_OBJECT_REFLECTOR(osg::Texture3D::Extensions)
|
||||
__void__gluBuild3DMipmaps__GLenum__GLint__GLsizei__GLsizei__GLsizei__GLenum__GLenum__C5_GLvoid_P1,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(typedef, void, IN, APIENTRY *, GLTexImage3DProc,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__typedef__void__APIENTRY_P1,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(typedef, void, IN, APIENTRY *, GLTexSubImage3DProc,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__typedef__void__APIENTRY_P1,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(typedef, void, IN, APIENTRY *, CompressedTexImage3DArbProc,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__typedef__void__APIENTRY_P1,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(typedef, void, IN, APIENTRY *, CompressedTexSubImage3DArbProc,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__typedef__void__APIENTRY_P1,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(typedef, void, IN, APIENTRY *, GLCopyTexSubImageProc,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__typedef__void__APIENTRY_P1,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(typedef, void, IN, APIENTRY *, GLUBuild3DMipMapsProc,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__typedef__void__APIENTRY_P1,
|
||||
"",
|
||||
"");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
I_SimpleProperty(GLint, MaxTexture3DSize,
|
||||
0,
|
||||
__void__setMaxTexture3DSize__GLint);
|
||||
|
@ -257,36 +257,11 @@ BEGIN_OBJECT_REFLECTOR(osg::VertexProgram::Extensions)
|
||||
__void__glProgramLocalParameter4fv__GLenum__GLuint__C5_GLfloat_P1,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(typedef, void, IN, APIENTRY *, BindProgramProc,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__typedef__void__APIENTRY_P1,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(typedef, void, IN, APIENTRY *, GenProgramsProc,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__typedef__void__APIENTRY_P1,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(typedef, void, IN, APIENTRY *, DeleteProgramsProc,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__typedef__void__APIENTRY_P1,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(typedef, void, IN, APIENTRY *, ProgramStringProc,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__typedef__void__APIENTRY_P1,
|
||||
"",
|
||||
"");
|
||||
I_ProtectedMethod1(typedef, void, IN, APIENTRY *, ProgramLocalParameter4fvProc,
|
||||
Properties::NON_VIRTUAL,
|
||||
Properties::NON_CONST,
|
||||
__typedef__void__APIENTRY_P1,
|
||||
"",
|
||||
"");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
I_SimpleProperty(bool, VertexProgramSupported,
|
||||
0,
|
||||
__void__setVertexProgramSupported__bool);
|
||||
|
@ -1,3 +0,0 @@
|
||||
Bone.cpp
|
||||
LinkVisitor.cpp
|
||||
RigGeometry.cpp
|
Loading…
Reference in New Issue
Block a user