mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-31 16:52:10 +01:00
LP-29 improve OSGViewport update mode handling
This commit is contained in:
parent
2e0f10d982
commit
c89d8f4ff4
@ -114,7 +114,7 @@ public:
|
|||||||
frameTimer(-1),
|
frameTimer(-1),
|
||||||
sceneData(NULL),
|
sceneData(NULL),
|
||||||
camera(NULL),
|
camera(NULL),
|
||||||
updateMode(UpdateMode::Discrete),
|
updateMode(UpdateMode::OnDemand),
|
||||||
busy(false)
|
busy(false)
|
||||||
{
|
{
|
||||||
OsgEarth::initialize();
|
OsgEarth::initialize();
|
||||||
@ -428,7 +428,7 @@ private:
|
|||||||
|
|
||||||
void start()
|
void start()
|
||||||
{
|
{
|
||||||
if (updateMode == UpdateMode::Discrete && (frameTimer < 0)) {
|
if (updateMode != UpdateMode::Continuous && (frameTimer < 0)) {
|
||||||
qDebug() << "OSGViewport::start - starting timer";
|
qDebug() << "OSGViewport::start - starting timer";
|
||||||
frameTimer = startTimer(33, Qt::PreciseTimer);
|
frameTimer = startTimer(33, Qt::PreciseTimer);
|
||||||
}
|
}
|
||||||
@ -505,6 +505,11 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
needToDoFrame = firstFrame;
|
||||||
|
if (h->updateMode != UpdateMode::OnDemand) {
|
||||||
|
needToDoFrame = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (firstFrame) {
|
if (firstFrame) {
|
||||||
h->view->init();
|
h->view->init();
|
||||||
if (!h->viewer->isRealized()) {
|
if (!h->viewer->isRealized()) {
|
||||||
@ -513,7 +518,7 @@ public:
|
|||||||
firstFrame = false;
|
firstFrame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
needToDoFrame = false;
|
|
||||||
osg::Viewport *viewport = h->view->getCamera()->getViewport();
|
osg::Viewport *viewport = h->view->getCamera()->getViewport();
|
||||||
if ((viewport->width() != item->width()) || (viewport->height() != item->height())) {
|
if ((viewport->width() != item->width()) || (viewport->height() != item->height())) {
|
||||||
needToDoFrame = true;
|
needToDoFrame = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user