Improved the set up of static build, added freetype plugin to plugins that support static usage
This commit is contained in:
@@ -222,32 +222,32 @@ int main( int argc, char **argv )
|
||||
while (arguments.read("--write-config", configfile)) { osgDB::writeObjectFile(viewer, configfile); }
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
ModelHandler* modelHandler = new ModelHandler;
|
||||
for(int i=1; i<arguments.argc();++i)
|
||||
if (arguments.read("-m"))
|
||||
{
|
||||
modelHandler->add(arguments[i]);
|
||||
ModelHandler* modelHandler = new ModelHandler;
|
||||
for(int i=1; i<arguments.argc();++i)
|
||||
{
|
||||
modelHandler->add(arguments[i]);
|
||||
}
|
||||
|
||||
viewer.addEventHandler(modelHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
// load the scene.
|
||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
||||
|
||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osg");
|
||||
|
||||
if (!loadedModel)
|
||||
{
|
||||
std::cout << argv[0] <<": No data loaded." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
viewer.setSceneData(loadedModel.get());
|
||||
}
|
||||
|
||||
viewer.addEventHandler(modelHandler);
|
||||
|
||||
#else
|
||||
|
||||
// load the scene.
|
||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
||||
|
||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osg");
|
||||
|
||||
if (!loadedModel)
|
||||
{
|
||||
std::cout << argv[0] <<": No data loaded." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
viewer.setSceneData(loadedModel.get());
|
||||
#endif
|
||||
|
||||
viewer.realize();
|
||||
|
||||
unsigned int numFrames = 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#this file is automatically generated
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgdb_ive )
|
||||
SET(TARGET_ADDED_LIBRARIES osgdb_ive osgdb_freetype )
|
||||
|
||||
SET(TARGET_SRC osgstaticviewer.cpp )
|
||||
#### end var setup ###
|
||||
|
||||
@@ -29,15 +29,15 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// include the plugins we need
|
||||
USE_OSGPLUGIN(ive);
|
||||
USE_OSGPLUGIN(freetype);
|
||||
|
||||
// extern "C" void graphicswindow_X11(void);
|
||||
// include the platform specific GraphicsWindow implementation.
|
||||
USE_GRAPHICSWINDOW();
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
// graphicswindow_X11();
|
||||
|
||||
// use an ArgumentParser object to manage the program arguments.
|
||||
osg::ArgumentParser arguments(&argc,argv);
|
||||
|
||||
|
||||
@@ -573,14 +573,9 @@ class RegisterReaderWriterProxy
|
||||
};
|
||||
|
||||
|
||||
class PluginFunctionProxy
|
||||
struct PluginFunctionProxy
|
||||
{
|
||||
public:
|
||||
|
||||
PluginFunctionProxy(CPluginFunction function)
|
||||
{
|
||||
(function)();
|
||||
}
|
||||
PluginFunctionProxy(CPluginFunction function) { (function)(); }
|
||||
};
|
||||
|
||||
#define USE_OSGPLUGIN(ext) \
|
||||
@@ -589,7 +584,7 @@ public:
|
||||
|
||||
#define REGISTER_OSGPLUGIN(ext, classname) \
|
||||
extern "C" void osgdb_##ext(void) {} \
|
||||
static RegisterReaderWriterProxy<classname> g_proxy_##classname;
|
||||
static osgDB::RegisterReaderWriterProxy<classname> g_proxy_##classname;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,11 @@
|
||||
|
||||
#include <osgViewer/Export>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
typedef void (* CGraphicsWindowFunction) (void);
|
||||
}
|
||||
|
||||
namespace osgViewer {
|
||||
|
||||
/** Base class for providing Windowing API agnostic access to creating and managing graphisc window and events.
|
||||
@@ -204,6 +209,23 @@ class GraphicsWindowEmbedded : public GraphicsWindow
|
||||
virtual void grabFocusIfPointerInWindow() {}
|
||||
};
|
||||
|
||||
struct GrapicsWindowFunctionProxy
|
||||
{
|
||||
GrapicsWindowFunctionProxy(CGraphicsWindowFunction function) { (function)(); }
|
||||
};
|
||||
|
||||
#define USE_GRAPICSWINDOW_IMPLEMENTATION(ext) \
|
||||
extern "C" void graphicswindow_##ext(void); \
|
||||
static osgViewer::GrapicsWindowFunctionProxy graphicswindowproxy_##ext(graphicswindow_##ext);
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Win32)
|
||||
#elif defined(__APPLE__)
|
||||
#define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Carbon)
|
||||
#else
|
||||
#define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(X11)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -56,4 +56,4 @@ class ReaderWriterFreeType : public osgDB::ReaderWriter
|
||||
|
||||
// now register with Registry to instantiate the above
|
||||
// reader/writer.
|
||||
osgDB::RegisterReaderWriterProxy<ReaderWriterFreeType> g_readerWriter_FreeType_Proxy;
|
||||
REGISTER_OSGPLUGIN(freetype, ReaderWriterFreeType)
|
||||
|
||||
Reference in New Issue
Block a user