mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
LP-29 osgearth: minor code cleanups
This commit is contained in:
parent
05d806f6f1
commit
ed225b1935
@ -59,7 +59,7 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
Hidden(OSGModelNode *parent) : QObject(parent), self(parent), modelData(NULL), sceneData(NULL), offset(-1.0), clampToTerrain(false), dirty(false)
|
||||
Hidden(OSGModelNode *parent) : QObject(parent), self(parent), modelData(NULL), sceneData(NULL), offset(-1.0), clampToTerrain(false), intoTerrain(false), dirty(false)
|
||||
{}
|
||||
|
||||
~Hidden()
|
||||
|
@ -91,8 +91,6 @@ public:
|
||||
updateMode(UpdateMode::Discrete),
|
||||
frameTimer(-1)
|
||||
{
|
||||
qDebug() << "OSGViewport::Hidden";
|
||||
|
||||
OsgEarth::initialize();
|
||||
|
||||
createViewer();
|
||||
@ -102,9 +100,6 @@ public:
|
||||
|
||||
~Hidden()
|
||||
{
|
||||
qDebug() << "OSGViewport::~Hidden";
|
||||
// osgQtQuick::openGLContextInfo(QOpenGLContext::currentContext(), "OSGViewport::~Hidden");
|
||||
|
||||
stop();
|
||||
|
||||
destroyViewer();
|
||||
@ -127,6 +122,7 @@ public slots:
|
||||
}
|
||||
this->window = window;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
bool acceptSceneData(OSGNode *node)
|
||||
@ -161,15 +157,17 @@ public:
|
||||
qWarning() << "OSGViewport::attach - invalid scene!";
|
||||
return false;
|
||||
}
|
||||
if (!attach(view, sceneData->node())) {
|
||||
qWarning() << "OSGViewport::attach - failed to attach node!";
|
||||
return false;
|
||||
}
|
||||
// attach camera
|
||||
if (camera) {
|
||||
camera->attach(view);
|
||||
} else {
|
||||
qWarning() << "OSGViewport::attach - no camera!";
|
||||
}
|
||||
// attach scene
|
||||
if (!attach(view, sceneData->node())) {
|
||||
qWarning() << "OSGViewport::attach - failed to attach node!";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -198,6 +196,7 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
qDebug() << "OSGViewport::attach - set scene" << node;
|
||||
view->setSceneData(node);
|
||||
|
||||
return true;
|
||||
@ -233,14 +232,14 @@ public:
|
||||
void initializeResources()
|
||||
{
|
||||
qDebug() << "OSGViewport::initializeResources";
|
||||
if (!view.valid()) {
|
||||
qDebug() << "OSGViewport::initializeResources - creating view";
|
||||
view = createView();
|
||||
self->attach(view.get());
|
||||
viewer->addView(view);
|
||||
start();
|
||||
// osgDB::writeNodeFile(*(h->self->sceneData()->node()), "saved.osg");
|
||||
if (view.valid()) {
|
||||
qWarning() << "OSGViewport::initializeResources - view already created!";
|
||||
return;
|
||||
}
|
||||
view = createView();
|
||||
self->attach(view.get());
|
||||
viewer->addView(view);
|
||||
start();
|
||||
}
|
||||
|
||||
void releaseResources()
|
||||
@ -259,7 +258,6 @@ public:
|
||||
|
||||
bool acceptUpdateMode(UpdateMode::Enum mode)
|
||||
{
|
||||
// qDebug() << "OSGViewport::acceptUpdateMode" << mode;
|
||||
if (updateMode == mode) {
|
||||
return true;
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ void OsgEarth::registerQmlTypes()
|
||||
registered = true;
|
||||
|
||||
// redirect osg logging to Qt (and export OSG_NOTIFY_LEVEL=DEBUG to enable osg logging)
|
||||
// Note : enabling the notify handler seems to cause crashes (the notifier is probably not thread safe)
|
||||
// osg::setNotifyHandler(new QtNotifyHandler());
|
||||
|
||||
// initialize();
|
||||
@ -106,11 +107,6 @@ void OsgEarth::initialize()
|
||||
|
||||
initializeCache();
|
||||
|
||||
// force early initialization of osgEarth capabilities
|
||||
// Doing this too early (before main window is displayed) causes rendering glitches (black holes)
|
||||
// Not sure why... See OSGViewport for when it is called (late...)
|
||||
// osgEarth::Registry::capabilities();
|
||||
|
||||
displayInfo();
|
||||
}
|
||||
|
||||
@ -151,7 +147,7 @@ void OsgEarth::initializeCache()
|
||||
} else {
|
||||
qWarning() << "OsgEarth::initializeCache - Failed to initialize cache";
|
||||
}
|
||||
#endif // ifdef USE_OSGEARTH
|
||||
#endif
|
||||
}
|
||||
|
||||
void OsgEarth::displayInfo()
|
||||
|
@ -297,7 +297,6 @@ bool GraphicsWindowQt::makeCurrentImplementation()
|
||||
return false;
|
||||
}
|
||||
if (_owned && _glContext) {
|
||||
// qDebug() << "GraphicsWindowQt::makeCurrentImplementation : " << _surface;
|
||||
if (!_glContext->makeCurrent(_surface)) {
|
||||
qWarning() << "GraphicsWindowQt::makeCurrentImplementation : failed to make context current";
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user