mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 20:23:06 +02:00
recover the Good Parts from first attempt to fix bugz-512
This commit is contained in:
parent
a66bd04810
commit
87d7a0a72f
2 changed files with 27 additions and 17 deletions
|
@ -256,18 +256,28 @@ void EntityTreeRenderer::clear() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset the engine
|
// reset the engine
|
||||||
if (_wantScripts && !_shuttingDown) {
|
auto scene = _viewState->getMain3DScene();
|
||||||
|
if (_shuttingDown) {
|
||||||
|
if (scene) {
|
||||||
|
render::Transaction transaction;
|
||||||
|
for (const auto& entry : _entitiesInScene) {
|
||||||
|
const auto& renderer = entry.second;
|
||||||
|
renderer->removeFromScene(scene, transaction);
|
||||||
|
}
|
||||||
|
scene->enqueueTransaction(transaction);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (_wantScripts) {
|
||||||
resetEntitiesScriptEngine();
|
resetEntitiesScriptEngine();
|
||||||
}
|
}
|
||||||
// remove all entities from the scene
|
|
||||||
auto scene = _viewState->getMain3DScene();
|
|
||||||
if (scene) {
|
if (scene) {
|
||||||
for (const auto& entry : _entitiesInScene) {
|
for (const auto& entry : _entitiesInScene) {
|
||||||
const auto& renderer = entry.second;
|
const auto& renderer = entry.second;
|
||||||
fadeOutRenderable(renderer);
|
fadeOutRenderable(renderer);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCWarning(entitiesrenderer) << "EntitityTreeRenderer::clear(), Unexpected null scene, possibly during application shutdown";
|
qCWarning(entitiesrenderer) << "EntitityTreeRenderer::clear(), Unexpected null scene";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_entitiesInScene.clear();
|
_entitiesInScene.clear();
|
||||||
_renderablesToUpdate.clear();
|
_renderablesToUpdate.clear();
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "RenderableWebEntityItem.h"
|
#include "RenderableWebEntityItem.h"
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <QtGui/QOpenGLContext>
|
#include <QtGui/QOpenGLContext>
|
||||||
|
@ -46,7 +47,7 @@ static uint64_t MAX_NO_RENDER_INTERVAL = 30 * USECS_PER_SECOND;
|
||||||
static uint8_t YOUTUBE_MAX_FPS = 30;
|
static uint8_t YOUTUBE_MAX_FPS = 30;
|
||||||
|
|
||||||
// Don't allow more than 20 concurrent web views
|
// Don't allow more than 20 concurrent web views
|
||||||
static uint32_t _currentWebCount { 0 };
|
static std::atomic<uint32_t> _currentWebCount(0);
|
||||||
static const uint32_t MAX_CONCURRENT_WEB_VIEWS = 20;
|
static const uint32_t MAX_CONCURRENT_WEB_VIEWS = 20;
|
||||||
|
|
||||||
static QTouchDevice _touchDevice;
|
static QTouchDevice _touchDevice;
|
||||||
|
@ -356,16 +357,15 @@ void WebEntityRenderer::buildWebSurface(const EntityItemPointer& entity, const Q
|
||||||
|
|
||||||
void WebEntityRenderer::destroyWebSurface() {
|
void WebEntityRenderer::destroyWebSurface() {
|
||||||
QSharedPointer<OffscreenQmlSurface> webSurface;
|
QSharedPointer<OffscreenQmlSurface> webSurface;
|
||||||
ContentType contentType = ContentType::NoContent;
|
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
webSurface.swap(_webSurface);
|
webSurface.swap(_webSurface);
|
||||||
_contentType = contentType;
|
_contentType = ContentType::NoContent;
|
||||||
});
|
|
||||||
|
|
||||||
if (webSurface) {
|
if (webSurface) {
|
||||||
--_currentWebCount;
|
--_currentWebCount;
|
||||||
WebEntityRenderer::releaseWebSurface(webSurface, _cachedWebSurface, _connections);
|
WebEntityRenderer::releaseWebSurface(webSurface, _cachedWebSurface, _connections);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 WebEntityRenderer::getWindowSize(const TypedEntityPointer& entity) const {
|
glm::vec2 WebEntityRenderer::getWindowSize(const TypedEntityPointer& entity) const {
|
||||||
|
|
Loading…
Reference in a new issue