Jean-Yves Didier

Finalisation OpenSceneGraph

#ifndef OSGDB_ASCIISTREAMOPERATOR
#define OSGDB_ASCIISTREAMOPERATOR
#include <ostream>
#include <osgDB/StreamOperator>
#include <osgDB/Registry>
class AsciiOutputIterator : public osgDB::OutputIterator
{
public:
AsciiOutputIterator( std::ostream* ostream )
: _readyForIndent(false), _indent(0) { _out = ostream; }
virtual ~AsciiOutputIterator() {}
virtual bool isBinary() const { return false; }
virtual void writeBool( bool b )
{
indentIfRequired();
if ( b ) *_out << "TRUE ";
else *_out << "FALSE ";
}
virtual void writeChar( char c )
{ indentIfRequired(); *_out << (short)c << ' '; }
virtual void writeUChar( unsigned char c )
{ indentIfRequired(); *_out << (unsigned short)c << ' '; }
virtual void writeShort( short s )
{ indentIfRequired(); *_out << s << ' '; }
virtual void writeUShort( unsigned short s )
{ indentIfRequired(); *_out << s << ' '; }
virtual void writeInt( int i )
{ indentIfRequired(); *_out << i << ' '; }
virtual void writeUInt( unsigned int i )
{ indentIfRequired(); *_out << i << ' '; }
virtual void writeLong( long l )
{ indentIfRequired(); *_out << l << ' '; }
virtual void writeULong( unsigned long l )
{ indentIfRequired(); *_out << l << ' '; }
virtual void writeFloat( float f )
{ indentIfRequired(); *_out << f << ' '; }
virtual void writeDouble( double d )
{ indentIfRequired(); *_out << d << ' '; }
virtual void writeString( const std::string& s )
{ indentIfRequired(); *_out << s << ' '; }
virtual void writeStream( std::ostream& (*fn)(std::ostream&) )
{
indentIfRequired(); *_out << fn;
if ( isEndl( fn ) )
{
_readyForIndent = true;
}
}
virtual void writeBase( std::ios_base& (*fn)(std::ios_base&) )
{
indentIfRequired(); *_out << fn;
}
virtual void writeGLenum( const osgDB::ObjectGLenum& value )
{
GLenum e = value.get();
const std::string& enumString = osgDB::Registry::instance()->getObjectWrapperManager()->getString("GL", e);
indentIfRequired(); *_out << enumString << ' ';
}
virtual void writeProperty( const osgDB::ObjectProperty& prop )
{
std::string enumString = prop._name;
if ( prop._mapProperty )
{
enumString = osgDB::Registry::instance()->getObjectWrapperManager()->getString(prop._name, prop._value);
}
indentIfRequired(); *_out << enumString << ' ';
}
virtual void writeMark( const osgDB::ObjectMark& mark )
{
_indent += mark._indentDelta;
indentIfRequired(); *_out << mark._name;
}
virtual void writeCharArray( const char* /*s*/, unsigned int /*size*/ ) {}
virtual void writeWrappedString( const std::string& str )
{
std::string wrappedStr;
unsigned int size = str.size();
for ( unsigned int i=0; i<size; ++i )
{
char ch = str[i];
if ( ch=='\"' ) wrappedStr += '\\';
else if ( ch=='\\' ) wrappedStr += '\\';
wrappedStr += ch;
}
wrappedStr.insert( std::string::size_type(0), 1, '\"' );
wrappedStr += '\"';
indentIfRequired();
writeString( wrappedStr );
}
protected:
inline void indentIfRequired()
{
if ( _readyForIndent )
{
for (int i=0; i<_indent; ++i)
*_out << ' ';
_readyForIndent = false;
}
}
bool _readyForIndent;
int _indent;
};
class AsciiInputIterator : public osgDB::InputIterator
{
public:
AsciiInputIterator( std::istream* istream ) { _in = istream; }
virtual ~AsciiInputIterator() {}
virtual bool isBinary() const { return false; }
virtual void readBool( bool& b )
{
std::string boolString;
readString( boolString );
if ( boolString=="TRUE" ) b = true;
else b = false;
}
virtual void readChar( char& c )
{
short s = 0;
readShort( s );
c = (char)s;
}
virtual void readSChar( signed char& c )
{
short s = 0;
readShort( s );
c = (signed char)s;
}
virtual void readUChar( unsigned char& c )
{
short s = 0;
readShort( s );
c = (unsigned char)s;
}
virtual void readShort( short& s )
{ std::string str; readString(str); s = static_cast<short>(strtol(str.c_str(), NULL, 0)); }
virtual void readUShort( unsigned short& s )
{ std::string str; readString(str); s = static_cast<unsigned short>(strtoul(str.c_str(), NULL, 0)); }
virtual void readInt( int& i )
{ std::string str; readString(str); i = static_cast<int>(strtol(str.c_str(), NULL, 0)); }
virtual void readUInt( unsigned int& i )
{ std::string str; readString(str); i = static_cast<unsigned int>(strtoul(str.c_str(), NULL, 0)); }
virtual void readLong( long& l )
{ std::string str; readString(str); l = strtol(str.c_str(), NULL, 0); }
virtual void readULong( unsigned long& l )
{ std::string str; readString(str); l = strtoul(str.c_str(), NULL, 0); }
virtual void readFloat( float& f )
{ std::string str; readString(str); f = osg::asciiToFloat(str.c_str()); }
virtual void readDouble( double& d )
{ std::string str; readString(str); d = osg::asciiToDouble(str.c_str()); }
virtual void readString( std::string& s )
{
if ( _preReadString.empty() )
*_in >> s;
else
{
s = _preReadString;
_preReadString.clear();
}
}
virtual void readStream( std::istream& (*fn)(std::istream&) )
{ *_in >> fn; }
virtual void readBase( std::ios_base& (*fn)(std::ios_base&) )
{ *_in >> fn; }
virtual void readGLenum( osgDB::ObjectGLenum& value )
{
GLenum e = 0;
std::string enumString;
readString( enumString );
e = osgDB::Registry::instance()->getObjectWrapperManager()->getValue("GL", enumString);
value.set( e );
}
virtual void readProperty( osgDB::ObjectProperty& prop )
{
int value = 0;
std::string enumString;
readString( enumString );
if ( prop._mapProperty )
{
value = osgDB::Registry::instance()->getObjectWrapperManager()->getValue(prop._name, enumString);
}
else
{
if ( prop._name!=enumString )
{
OSG_WARN << "AsciiInputIterator::readProperty(): Unmatched property "
<< enumString << ", expecting " << prop._name << std::endl;
}
prop._name = enumString;
}
prop.set( value );
}
virtual void readMark( osgDB::ObjectMark& /*mark*/ )
{
std::string markString;
readString( markString );
}
virtual void readCharArray( char* /*s*/, unsigned int /*size*/ ) {}
virtual void readWrappedString( std::string& str )
{
char ch;
getCharacter( ch );
// skip white space
while ( ch==' ' || (ch=='\n') || (ch=='\r'))
{
getCharacter( ch );
}
if (ch=='"')
{
// we have an "wrapped string"
getCharacter( ch );
while ( ch!='"' )
{
if (ch=='\\')
{
getCharacter( ch );
str += ch;
}
else str += ch;
getCharacter( ch );
}
}
else
{
// we have an unwrapped string, read to first space or end of line
while ( (ch!=' ') && (ch!=0) && (ch!='\n') )
{
str += ch;
getCharacter( ch );
}
}
}
virtual bool matchString( const std::string& str )
{
if ( _preReadString.empty() )
*_in >> _preReadString;
if ( _preReadString==str )
{
_preReadString.clear();
return true;
}
return false;
}
virtual void advanceToCurrentEndBracket()
{
std::string passString;
unsigned int blocks = 0;
while ( !_in->eof() )
{
passString.clear();
readString( passString );
if ( passString=="}" )
{
if ( blocks<=0 ) return;
else blocks--;
}
else if ( passString=="{" )
blocks++;
}
}
protected:
void getCharacter( char& ch )
{
if ( !_preReadString.empty() )
{
ch = _preReadString[0];
_preReadString.erase( _preReadString.begin() );
}
else
{
_in->get( ch );
checkStream();
}
}
std::string _preReadString;
};
#endif
#include "osgfamily.h"
#include "osgcomponent.h"
#include <osgDB/Registry>
#include <iostream>
QStringList OSGFamily::blackList;
QHash<QString,osgDB::ObjectWrapper* > OSGFamily::osgObjects;
OSGFamily::OSGFamily()
{
if (!blackList.count())
{
blackList << "osg::AudioSink" << "osg::AudioStream" << "osg::Drawable"
<< "osg::Object" << "osg::Shape" << "osg::StateAttribute"
<< "osg::Texture" << "osg::UserDataContainer"
<< "osgAnimation::AnimationManagerBase" << "osgFX::Effect"
<< "osgAnimation::StackedTransformElement" << "osgSim::Sector"
<< "osgManipulator::CompositeDragger"
<< "osgManipulator::Dragger" << "osgText::TextBase" ;
}
if (!osgObjects.count())
{
// récupération du wrapper manager
osgDB::ObjectWrapperManager* wrapperMan = osgDB::Registry::instance()->getObjectWrapperManager();
// force le chargement des wrappers par bibliothèque.
// nécessaire car mécanisme de lazy instanciation caché
wrapperMan->findWrapper("osg::");
wrapperMan->findWrapper("osgShadow::");
wrapperMan->findWrapper("osgManipulator::");
wrapperMan->findWrapper("osgText::");
wrapperMan->findWrapper("osgTerrain::");
wrapperMan->findWrapper("osgVolume::");
wrapperMan->findWrapper("osgAnimation::");
wrapperMan->findWrapper("osgSim::");
wrapperMan->findWrapper("osgFX::");
// récupération des wrappers
const osgDB::ObjectWrapperManager::WrapperMap& map = wrapperMan->getWrapperMap();
// listing des informations
osgDB::ObjectWrapperManager::WrapperMap::const_iterator it;
for (it = map.begin() ; it!=map.end(); ++it) {
if (!blackList.contains(it->first.data()))
{
osgObjects[it->first.data()] = it->second ;
}
}
}
}
OSGFamily::~OSGFamily()
{
}
ARCSAbstractComponent *OSGFamily::instanciate(QString type)
{
if (!osgObjects.contains(type))
return 0;
return new OSGComponent(osgObjects[type]);
}
void OSGFamily::destroy(ARCSAbstractComponent * component)
{
OSGComponent* osgC = dynamic_cast<OSGComponent*>(component);
if (osgC)
osgC->destroy();
}
#ifndef __OSGFAMILY_H__
#define __OSGFAMILY_H__
#include <arcs/arcsabstractfamily.h>
#include <osgDB/ObjectWrapper>
#include <QHash>
class OSGFamily : public ARCSAbstractFamily
{
public:
OSGFamily();
virtual ~OSGFamily();
virtual QStringList factoryList() { return osgObjects.keys(); }
virtual bool addFactory(QString, ARCSAbstractComponent*) { return true;}
virtual void removeFactory(QString) { }
virtual ARCSAbstractComponent* instanciate(QString type);
virtual void destroy(ARCSAbstractComponent *component);
virtual QString name() const { return "OSGFamily"; }
static osgDB::ObjectWrapper* getWrapper(QString name) {
if (osgObjects.contains(name))
return osgObjects[name];
return 0;
}
private:
static QHash<QString,osgDB::ObjectWrapper*> osgObjects;
//QStringList osgNodes;
static QStringList blackList;
};
#endif //__OSGFAMILY_H__
#include "osgnamedobjectvisitor.h"
#include <osg/Geode>
OSGNamedObjectVisitor::OSGNamedObjectVisitor() :
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
{
}
void OSGNamedObjectVisitor::apply(osg::Node &node)
{
if (!node.getName().empty())
nodeList.push_back(&node);
traverse(node);
}
void OSGNamedObjectVisitor::apply(osg::Geode &geode)
{
for (unsigned int i=0; i< geode.getNumDrawables(); i++)
{
osg::Drawable* drw = geode.getDrawable(i);
if (!drw->getName().empty())
nodeList.push_back(drw);
osg::Shape* shape = drw->getShape();
if (shape)
{
if (!shape->getName().empty())
nodeList.push_back(shape);
}
}
traverse(geode);
}
#ifndef __OSGNAMEDOBJECTVISITOR_H__
#define __OSGNAMEDOBJECTVISITOR_H__
#include <osg/NodeVisitor>
#include <vector>
class OSGNamedObjectVisitor : public osg::NodeVisitor
{
public:
OSGNamedObjectVisitor();
virtual void apply(osg::Node & node);
virtual void apply(osg::Geode & geode);
void clearNodeList() { nodeList.clear(); }
std::vector<osg::Object*>& getNodeList() { return nodeList; }
private:
std::vector<osg::Object*> nodeList;
};
#endif // __OSGNAMEDOBJECTVISITOR_H__
......@@ -18,16 +18,32 @@
#include <osgDB/ObjectWrapper>
#include <string>
#include <iostream>
#include <osg/Group>
#include <osg/Node>
#include <osg/Drawable>
#include <osg/Geode>
#include "osgstringserializer.h"
struct OSGSlotWrapperData {
OSGSlotWrapperData() {}
OSGSlotWrapperData(osg::Object* obj, osgDB::ObjectWrapper* wrap, QString s)
: container(obj),wrapper(wrap),slotName(s) {}
osg::Object* container;
osg::ref_ptr<osgDB::ObjectWrapper> wrapper;
QString slotName;
};
class OSGSlotWrapper : public QObject
{
Q_OBJECT
public:
explicit OSGSlotWrapper(QString s,osgDB::ObjectWrapper* wrapper,osg::Object* osgObject, QObject *parent = 0)
: QObject(parent), container(osgObject), osgWrapper(wrapper), slotName(s) {}
explicit OSGSlotWrapper(OSGSlotWrapperData d, QObject *parent = 0)
: QObject(parent), data(d)
{
}
public slots:
void call(osg::Object* data) { call<osg::Object*>(data); }
......@@ -55,19 +71,44 @@ public slots:
//void call(GLenum data);
void call(std::string data) { call<std::string>(data); }
void addChild(osg::Object* obj)
{
osg::Group* grp = dynamic_cast<osg::Group*>(data.container);
osg::Node* node = dynamic_cast<osg::Node*>(obj);
if (grp && node) grp->addChild(node);
}
void removeChildren()
{
osg::Group* grp = dynamic_cast<osg::Group*>(data.container);
if (grp) grp->removeChildren(0,grp->getNumChildren());
}
void addDrawable(osg::Object* obj)
{
osg::Geode* geode = dynamic_cast<osg::Geode*>(data.container);
osg::Drawable* drw = dynamic_cast<osg::Drawable*>(obj);
if (geode && drw) geode->addDrawable(drw);
}
void removeDrawables()
{
osg::Geode* geode = dynamic_cast<osg::Geode*>(data.container);
if (geode) geode->removeDrawables(0,geode->getNumDrawables());
}
private:
template<typename T> void call(T&);
osg::Object* container;
osgDB::ObjectWrapper* osgWrapper;
QString slotName;
OSGSlotWrapperData data;
};
template<typename T> void OSGSlotWrapper::call(T& value)
{
OSGStringSerializer::getInstance()->updateObject<T>(container,osgWrapper->getSerializer(qPrintable(slotName)),value );
QString name = data.slotName.section('.',-1).section('(',0,0);
if (!data.wrapper) return;
if (data.wrapper->getSerializer(qPrintable(name)))
OSGStringSerializer::getInstance()->updateObject<T>(data.container,data.wrapper->getSerializer(qPrintable(name)),value );
}
......
......@@ -19,9 +19,9 @@ osg::ref_ptr<osg::Object> OSGStringSerializer::parseString(QString s)
source.str(qPrintable(s));
osgDB::ReaderWriter::ReadResult res = osgRW->readObject(source);
source.clear();
if (res.error())
if (res.error()&& !s.isEmpty())
{
std::cout << res.message() << std::endl;
std::cout << res.message() << " with string " << qPrintable(s) << std::endl;
return osg::ref_ptr<osg::Object>();
}
return res.getObject();
......@@ -40,13 +40,20 @@ QString OSGStringSerializer::toString(osg::ref_ptr<osg::Object> target)
OSGStringSerializer::OSGStringSerializer() :
binaryInputStream(0),binaryOutputStream(0)
binaryInputStream(0),binaryOutputStream(0),
asciiInputStream(0),asciiOutputStream(0)
{
bip = new BinaryInputIterator(&source);
bop = new BinaryOutputIterator(&source);
binaryInputStream.setInputIterator(bip);
binaryOutputStream.setOutputIterator(bop);
aip = new AsciiInputIterator(&source);
aop = new AsciiOutputIterator(&source);
asciiInputStream.setInputIterator(aip);
asciiOutputStream.setOutputIterator(aop);
osgRW = osgDB::Registry::instance()->getReaderWriterForExtension("osg");
}
......
......@@ -12,6 +12,7 @@
#include <osgDB/OutputStream>
#include <osgDB/ReaderWriter>
#include "BinaryStreamOperator.h"
#include "AsciiStreamOperator.h"
#include <QMutex>
......@@ -22,6 +23,8 @@ public:
osg::ref_ptr<osg::Object> parseString(QString s);
QString toString(osg::ref_ptr<osg::Object> target);
template<typename T> bool updateObject(osg::ref_ptr<osg::Object> target, osgDB::BaseSerializer* serializer, T& value);
template<typename T> T parseString(QString s);
template<typename T> QString toString(T obj);
// QString
......@@ -36,12 +39,38 @@ private:
osgDB::OutputStream binaryOutputStream;
BinaryInputIterator* bip;
BinaryOutputIterator* bop;
osgDB::InputStream asciiInputStream;
osgDB::OutputStream asciiOutputStream;
AsciiInputIterator* aip;
AsciiOutputIterator* aop;
osgDB::ReaderWriter* osgRW;
QMutex mutex;
};
template <typename T> T OSGStringSerializer::parseString(QString s)
{
QMutexLocker locker(&mutex);
T res;
source.str(qPrintable(s));
asciiInputStream >> res;
source.clear();
return res;
}
template <typename T> QString OSGStringSerializer::toString(T obj)
{
QMutexLocker locker(&mutex);
source.str("");
asciiOutputStream << obj;
QString res(source.str().data());
source.clear();
return res;
}
template <typename T> bool OSGStringSerializer::updateObject(osg::ref_ptr<osg::Object> target,
osgDB::BaseSerializer *serializer, T& value)
{
......
......@@ -21,6 +21,7 @@
#include "osgstringserializer.h"
#include <typeinfo>
#include <iostream>
template<typename T> class OSGType : public ARCSTypeFactoryTemplate<T>
{
......@@ -36,28 +37,34 @@ protected:
template<typename T> QString OSGType<T>::getTypeName() const
{
return QString(typeid(T).name());
osg::TemplateValueObject<T> val;
return QString("osg::") + QString(val.className()).replace("ValueObject","");
}
template<typename T> T OSGType<T>::parse(QString s)
{
osg::ref_ptr<osg::Object> object =
OSGStringSerializer::getInstance()->parseString(s);
return OSGStringSerializer::getInstance()->parseString<T>(s);
osg::TemplateValueObject<T>* value;
/* if (object.valid())
{
osg::ref_ptr<osg::TemplateValueObject<T> > value;
if ((value = dynamic_cast<osg::TemplateValueObject<T>* >(object.get())))
return value->getValue();
if ((value = dynamic_cast<osg::TemplateValueObject<T>* >(object.get())))
{
T val = value->getValue();
return val;
}
}
return T();
return T();*/
}
template<typename T> QString OSGType<T>::serialize(T obj)
{
osg::TemplateValueObject<T> value;
value.setValue(obj);
/*osg::ref_ptr<osg::TemplateValueObject<T> > value;
value->setValue(obj);*/
return OSGStringSerializer::getInstance()->toString(&value);
return OSGStringSerializer::getInstance()->toString<T>(/*value.get()*/obj);
}
......@@ -66,54 +73,44 @@ template<typename T> QString OSGType<T>::serialize(T obj)
///////////////////////////////////////////////////////////////////////////
// Here are declarations of types
//////////////////////////////////////////////////////////////////////////
typedef osg::Vec2f osgVec2f;
Q_DECLARE_METATYPE(osgVec2f)
template class OSGType<osgVec2f>;
typedef OSGType<osgVec2f> ARCSTypeFactoryTemplate_osgVec2f;
typedef osg::Vec2d osgVec2d;
Q_DECLARE_METATYPE(osgVec2d)
template class OSGType<osgVec2d>;
typedef OSGType<osgVec2d> ARCSTypeFactoryTemplate_osgVec2d;
typedef osg::Vec3f osgVec3f;
Q_DECLARE_METATYPE(osgVec3f)
template class OSGType<osgVec3f>;
typedef OSGType<osgVec3f> ARCSTypeFactoryTemplate_osgVec3f;
typedef osg::Vec3d osgVec3d;
Q_DECLARE_METATYPE(osgVec3d)
template class OSGType<osgVec3d>;
typedef OSGType<osgVec3d> ARCSTypeFactoryTemplate_osgVec3d;
typedef osg::Vec4f osgVec4f;
Q_DECLARE_METATYPE(osgVec4f)
template class OSGType<osgVec4f>;
typedef OSGType<osgVec4f> ARCSTypeFactoryTemplate_osgVec4f;
typedef osg::Vec4d osgVec4d;
Q_DECLARE_METATYPE(osgVec4d)
template class OSGType<osgVec4d>;
typedef OSGType<osgVec4d> ARCSTypeFactoryTemplate_osgVec4d;
typedef osg::Quat osgQuat;
Q_DECLARE_METATYPE(osgQuat)
template class OSGType<osgQuat>;
typedef OSGType<osgQuat> ARCSTypeFactoryTemplate_osgQuat;
typedef osg::Plane osgPlane;
Q_DECLARE_METATYPE(osgPlane)
template class OSGType<osgPlane>;
typedef OSGType<osgPlane> ARCSTypeFactoryTemplate_osgPlane;
typedef osg::Matrixf osgMatrixf;
Q_DECLARE_METATYPE(osgMatrixf)
template class OSGType<osgMatrixf>;
typedef OSGType<osgMatrixf> ARCSTypeFactoryTemplate_osgMatrixf;
typedef osg::Matrixd osgMatrixd;
Q_DECLARE_METATYPE(osgMatrixd)
template class OSGType<osgMatrixd>;
typedef OSGType<osgMatrixd> ARCSTypeFactoryTemplate_osgMatrixd;
Q_DECLARE_METATYPE(osg::Vec2f)
template class OSGType<osg::Vec2f>;
typedef OSGType<osg::Vec2f> ARCSTypeFactoryTemplate_osgVec2f;
Q_DECLARE_METATYPE(osg::Vec2d)
template class OSGType<osg::Vec2d>;
typedef OSGType<osg::Vec2d> ARCSTypeFactoryTemplate_osgVec2d;
Q_DECLARE_METATYPE(osg::Vec3f)
template class OSGType<osg::Vec3f>;
typedef OSGType<osg::Vec3f> ARCSTypeFactoryTemplate_osgVec3f;
Q_DECLARE_METATYPE(osg::Vec3d)
template class OSGType<osg::Vec3d>;
typedef OSGType<osg::Vec3d> ARCSTypeFactoryTemplate_osgVec3d;
Q_DECLARE_METATYPE(osg::Vec4f)
template class OSGType<osg::Vec4f>;
typedef OSGType<osg::Vec4f> ARCSTypeFactoryTemplate_osgVec4f;
Q_DECLARE_METATYPE(osg::Vec4d)
template class OSGType<osg::Vec4d>;
typedef OSGType<osg::Vec4d> ARCSTypeFactoryTemplate_osgVec4d;
Q_DECLARE_METATYPE(osg::Quat)
template class OSGType<osg::Quat>;
typedef OSGType<osg::Quat> ARCSTypeFactoryTemplate_osgQuat;
Q_DECLARE_METATYPE(osg::Plane)
template class OSGType<osg::Plane>;
typedef OSGType<osg::Plane> ARCSTypeFactoryTemplate_osgPlane;
Q_DECLARE_METATYPE(osg::Matrixf)
template class OSGType<osg::Matrixf>;
typedef OSGType<osg::Matrixf> ARCSTypeFactoryTemplate_osgMatrixf;
Q_DECLARE_METATYPE(osg::Matrixd)
template class OSGType<osg::Matrixd>;
typedef OSGType<osg::Matrixd> ARCSTypeFactoryTemplate_osgMatrixd;
#endif // __OSGTYPES_H__
......
......@@ -14,7 +14,7 @@ OSGViewer::OSGViewer(QObject *parent) :
viewer = new osgViewer::Viewer();
osgQt::GraphicsWindowQt* graphicsWindow = new osgQt::GraphicsWindowQt(this);
viewer->setThreadingModel(osgViewer::Viewer::AutomaticSelection);
viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);// AutomaticSelection);
resize(640,480);
viewer->getCamera()->setGraphicsContext(graphicsWindow);
......
......@@ -28,7 +28,7 @@ public slots:
private slots:
void redrawScene() { viewer->frame(); QTimer::singleShot(25,this,SLOT(redrawScene())); }
void redrawScene() { viewer->frame(); QTimer::singleShot(10,this,SLOT(redrawScene()));}
private:
osgViewer::Viewer* viewer;
......