mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:58:27 +02:00
Change _graphicsEngine to a shared_ptr
This commit is contained in:
parent
3dabf23ff4
commit
a22b06c3e7
2 changed files with 23 additions and 23 deletions
|
@ -1048,7 +1048,7 @@ void Application::initialize(const QCommandLineParser &parser) {
|
||||||
_entityClipboard = std::make_shared<EntityTree>();
|
_entityClipboard = std::make_shared<EntityTree>();
|
||||||
_octreeProcessor = std::make_shared<OctreePacketProcessor>();
|
_octreeProcessor = std::make_shared<OctreePacketProcessor>();
|
||||||
_entityEditSender = std::make_shared<EntityEditPacketSender>();
|
_entityEditSender = std::make_shared<EntityEditPacketSender>();
|
||||||
|
_graphicsEngine = std::make_shared<GraphicsEngine>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2589,7 +2589,7 @@ void Application::initialize(const QCommandLineParser &parser) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_pendingIdleEvent = false;
|
_pendingIdleEvent = false;
|
||||||
_graphicsEngine.startup();
|
_graphicsEngine->startup();
|
||||||
|
|
||||||
qCDebug(interfaceapp) << "Directory Service session ID is" << uuidStringWithoutCurlyBraces(accountManager->getSessionID());
|
qCDebug(interfaceapp) << "Directory Service session ID is" << uuidStringWithoutCurlyBraces(accountManager->getSessionID());
|
||||||
|
|
||||||
|
@ -2914,7 +2914,7 @@ Application::~Application() {
|
||||||
assert(_shapeManager.getNumShapes() == 0);
|
assert(_shapeManager.getNumShapes() == 0);
|
||||||
|
|
||||||
// shutdown graphics engine
|
// shutdown graphics engine
|
||||||
_graphicsEngine.shutdown();
|
_graphicsEngine->shutdown();
|
||||||
|
|
||||||
_gameWorkload.shutdown();
|
_gameWorkload.shutdown();
|
||||||
|
|
||||||
|
@ -3120,7 +3120,7 @@ void Application::initializeGL() {
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
_glWidget->swapBuffers();
|
_glWidget->swapBuffers();
|
||||||
|
|
||||||
_graphicsEngine.initializeGPU(_glWidget);
|
_graphicsEngine->initializeGPU(_glWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::initializeDisplayPlugins() {
|
void Application::initializeDisplayPlugins() {
|
||||||
|
@ -3132,7 +3132,7 @@ void Application::initializeDisplayPlugins() {
|
||||||
// Once time initialization code
|
// Once time initialization code
|
||||||
DisplayPluginPointer targetDisplayPlugin;
|
DisplayPluginPointer targetDisplayPlugin;
|
||||||
for(const auto& displayPlugin : displayPlugins) {
|
for(const auto& displayPlugin : displayPlugins) {
|
||||||
displayPlugin->setContext(_graphicsEngine.getGPUContext());
|
displayPlugin->setContext(_graphicsEngine->getGPUContext());
|
||||||
if (displayPlugin->getName() == lastActiveDisplayPluginName) {
|
if (displayPlugin->getName() == lastActiveDisplayPluginName) {
|
||||||
targetDisplayPlugin = displayPlugin;
|
targetDisplayPlugin = displayPlugin;
|
||||||
}
|
}
|
||||||
|
@ -3184,7 +3184,7 @@ void Application::initializeDisplayPlugins() {
|
||||||
void Application::initializeRenderEngine() {
|
void Application::initializeRenderEngine() {
|
||||||
// FIXME: on low end systems os the shaders take up to 1 minute to compile, so we pause the deadlock watchdog thread.
|
// FIXME: on low end systems os the shaders take up to 1 minute to compile, so we pause the deadlock watchdog thread.
|
||||||
DeadlockWatchdogThread::withPause([&] {
|
DeadlockWatchdogThread::withPause([&] {
|
||||||
_graphicsEngine.initializeRender();
|
_graphicsEngine->initializeRender();
|
||||||
DependencyManager::get<Keyboard>()->registerKeyboardHighlighting();
|
DependencyManager::get<Keyboard>()->registerKeyboardHighlighting();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -3441,7 +3441,7 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) {
|
||||||
surfaceContext->setContextProperty("Recording", DependencyManager::get<RecordingScriptingInterface>().data());
|
surfaceContext->setContextProperty("Recording", DependencyManager::get<RecordingScriptingInterface>().data());
|
||||||
surfaceContext->setContextProperty("Preferences", DependencyManager::get<Preferences>().data());
|
surfaceContext->setContextProperty("Preferences", DependencyManager::get<Preferences>().data());
|
||||||
surfaceContext->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data());
|
surfaceContext->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data());
|
||||||
surfaceContext->setContextProperty("FrameTimings", &_graphicsEngine._frameTimingsScriptingInterface);
|
surfaceContext->setContextProperty("FrameTimings", &_graphicsEngine->_frameTimingsScriptingInterface);
|
||||||
surfaceContext->setContextProperty("Rates", new RatesScriptingInterface(this));
|
surfaceContext->setContextProperty("Rates", new RatesScriptingInterface(this));
|
||||||
|
|
||||||
surfaceContext->setContextProperty("TREE_SCALE", TREE_SCALE);
|
surfaceContext->setContextProperty("TREE_SCALE", TREE_SCALE);
|
||||||
|
@ -4147,8 +4147,8 @@ void Application::onPresent(quint32 frameCount) {
|
||||||
postEvent(this, new QEvent((QEvent::Type)ApplicationEvent::Idle), Qt::HighEventPriority);
|
postEvent(this, new QEvent((QEvent::Type)ApplicationEvent::Idle), Qt::HighEventPriority);
|
||||||
}
|
}
|
||||||
expected = false;
|
expected = false;
|
||||||
if (_graphicsEngine.checkPendingRenderEvent() && !isAboutToQuit()) {
|
if (_graphicsEngine->checkPendingRenderEvent() && !isAboutToQuit()) {
|
||||||
postEvent(_graphicsEngine._renderEventHandler, new QEvent((QEvent::Type)ApplicationEvent::Render));
|
postEvent(_graphicsEngine->_renderEventHandler, new QEvent((QEvent::Type)ApplicationEvent::Render));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5265,8 +5265,8 @@ void Application::idle() {
|
||||||
PROFILE_COUNTER_IF_CHANGED(app, "pendingDownloads", uint32_t, ResourceCache::getPendingRequestCount());
|
PROFILE_COUNTER_IF_CHANGED(app, "pendingDownloads", uint32_t, ResourceCache::getPendingRequestCount());
|
||||||
PROFILE_COUNTER_IF_CHANGED(app, "currentProcessing", int, DependencyManager::get<StatTracker>()->getStat("Processing").toInt());
|
PROFILE_COUNTER_IF_CHANGED(app, "currentProcessing", int, DependencyManager::get<StatTracker>()->getStat("Processing").toInt());
|
||||||
PROFILE_COUNTER_IF_CHANGED(app, "pendingProcessing", int, DependencyManager::get<StatTracker>()->getStat("PendingProcessing").toInt());
|
PROFILE_COUNTER_IF_CHANGED(app, "pendingProcessing", int, DependencyManager::get<StatTracker>()->getStat("PendingProcessing").toInt());
|
||||||
auto renderConfig = _graphicsEngine.getRenderEngine()->getConfiguration();
|
auto renderConfig = _graphicsEngine->getRenderEngine()->getConfiguration();
|
||||||
PROFILE_COUNTER_IF_CHANGED(render, "gpuTime", float, (float)_graphicsEngine.getGPUContext()->getFrameTimerGPUAverage());
|
PROFILE_COUNTER_IF_CHANGED(render, "gpuTime", float, (float)_graphicsEngine->getGPUContext()->getFrameTimerGPUAverage());
|
||||||
|
|
||||||
PROFILE_RANGE(app, __FUNCTION__);
|
PROFILE_RANGE(app, __FUNCTION__);
|
||||||
|
|
||||||
|
@ -5707,7 +5707,7 @@ void Application::init() {
|
||||||
}
|
}
|
||||||
}, Qt::QueuedConnection);
|
}, Qt::QueuedConnection);
|
||||||
|
|
||||||
_gameWorkload.startup(getEntities()->getWorkloadSpace(), _graphicsEngine.getRenderScene(), _entitySimulation);
|
_gameWorkload.startup(getEntities()->getWorkloadSpace(), _graphicsEngine->getRenderScene(), _entitySimulation);
|
||||||
_entitySimulation->setWorkloadSpace(getEntities()->getWorkloadSpace());
|
_entitySimulation->setWorkloadSpace(getEntities()->getWorkloadSpace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5879,7 +5879,7 @@ void Application::updateLOD(float deltaTime) const {
|
||||||
// adjust it unless we were asked to disable this feature, or if we're currently in throttleRendering mode
|
// adjust it unless we were asked to disable this feature, or if we're currently in throttleRendering mode
|
||||||
if (!isThrottleRendering()) {
|
if (!isThrottleRendering()) {
|
||||||
float presentTime = getActiveDisplayPlugin()->getAveragePresentTime();
|
float presentTime = getActiveDisplayPlugin()->getAveragePresentTime();
|
||||||
float engineRunTime = (float)(_graphicsEngine.getRenderEngine()->getConfiguration().get()->getCPURunTime());
|
float engineRunTime = (float)(_graphicsEngine->getRenderEngine()->getConfiguration().get()->getCPURunTime());
|
||||||
float gpuTime = getGPUContext()->getFrameTimerGPUAverage();
|
float gpuTime = getGPUContext()->getFrameTimerGPUAverage();
|
||||||
float batchTime = getGPUContext()->getFrameTimerBatchAverage();
|
float batchTime = getGPUContext()->getFrameTimerBatchAverage();
|
||||||
auto lodManager = DependencyManager::get<LODManager>();
|
auto lodManager = DependencyManager::get<LODManager>();
|
||||||
|
@ -6184,7 +6184,7 @@ void Application::updateSecondaryCameraViewFrustum() {
|
||||||
// camera should be.
|
// camera should be.
|
||||||
|
|
||||||
// Code based on SecondaryCameraJob
|
// Code based on SecondaryCameraJob
|
||||||
auto renderConfig = _graphicsEngine.getRenderEngine()->getConfiguration();
|
auto renderConfig = _graphicsEngine->getRenderEngine()->getConfiguration();
|
||||||
assert(renderConfig);
|
assert(renderConfig);
|
||||||
auto camera = dynamic_cast<SecondaryCameraJobConfig*>(renderConfig->getConfig("SecondaryCamera"));
|
auto camera = dynamic_cast<SecondaryCameraJobConfig*>(renderConfig->getConfig("SecondaryCamera"));
|
||||||
|
|
||||||
|
@ -6311,7 +6311,7 @@ void Application::tryToEnablePhysics() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::update(float deltaTime) {
|
void Application::update(float deltaTime) {
|
||||||
PROFILE_RANGE_EX(app, __FUNCTION__, 0xffff0000, (uint64_t)_graphicsEngine._renderFrameCount + 1);
|
PROFILE_RANGE_EX(app, __FUNCTION__, 0xffff0000, (uint64_t)_graphicsEngine->_renderFrameCount + 1);
|
||||||
|
|
||||||
if (_aboutToQuit) {
|
if (_aboutToQuit) {
|
||||||
return;
|
return;
|
||||||
|
@ -6820,7 +6820,7 @@ void Application::update(float deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::updateRenderArgs(float deltaTime) {
|
void Application::updateRenderArgs(float deltaTime) {
|
||||||
_graphicsEngine.editRenderArgs([this, deltaTime](AppRenderArgs& appRenderArgs) {
|
_graphicsEngine->editRenderArgs([this, deltaTime](AppRenderArgs& appRenderArgs) {
|
||||||
PerformanceTimer perfTimer("editRenderArgs");
|
PerformanceTimer perfTimer("editRenderArgs");
|
||||||
appRenderArgs._headPose = getHMDSensorPose();
|
appRenderArgs._headPose = getHMDSensorPose();
|
||||||
|
|
||||||
|
@ -6849,7 +6849,7 @@ void Application::updateRenderArgs(float deltaTime) {
|
||||||
_viewFrustum.setProjection(adjustedProjection);
|
_viewFrustum.setProjection(adjustedProjection);
|
||||||
_viewFrustum.calculate();
|
_viewFrustum.calculate();
|
||||||
}
|
}
|
||||||
appRenderArgs._renderArgs = RenderArgs(_graphicsEngine.getGPUContext(), lodManager->getVisibilityDistance(),
|
appRenderArgs._renderArgs = RenderArgs(_graphicsEngine->getGPUContext(), lodManager->getVisibilityDistance(),
|
||||||
lodManager->getBoundaryLevelAdjust(), lodManager->getLODFarHalfAngleTan(), lodManager->getLODNearHalfAngleTan(),
|
lodManager->getBoundaryLevelAdjust(), lodManager->getLODFarHalfAngleTan(), lodManager->getLODNearHalfAngleTan(),
|
||||||
lodManager->getLODFarDistance(), lodManager->getLODNearDistance(), RenderArgs::DEFAULT_RENDER_MODE,
|
lodManager->getLODFarDistance(), lodManager->getLODNearDistance(), RenderArgs::DEFAULT_RENDER_MODE,
|
||||||
RenderArgs::MONO, RenderArgs::DEFERRED, RenderArgs::RENDER_DEBUG_NONE);
|
RenderArgs::MONO, RenderArgs::DEFERRED, RenderArgs::RENDER_DEBUG_NONE);
|
||||||
|
|
|
@ -226,8 +226,8 @@ public:
|
||||||
PerformanceManager& getPerformanceManager() { return _performanceManager; }
|
PerformanceManager& getPerformanceManager() { return _performanceManager; }
|
||||||
RefreshRateManager& getRefreshRateManager() { return _refreshRateManager; }
|
RefreshRateManager& getRefreshRateManager() { return _refreshRateManager; }
|
||||||
|
|
||||||
size_t getRenderFrameCount() const { return _graphicsEngine.getRenderFrameCount(); }
|
size_t getRenderFrameCount() const { return _graphicsEngine->getRenderFrameCount(); }
|
||||||
float getRenderLoopRate() const { return _graphicsEngine.getRenderLoopRate(); }
|
float getRenderLoopRate() const { return _graphicsEngine->getRenderLoopRate(); }
|
||||||
float getNumCollisionObjects() const;
|
float getNumCollisionObjects() const;
|
||||||
float getTargetRenderFrameRate() const; // frames/second
|
float getTargetRenderFrameRate() const; // frames/second
|
||||||
|
|
||||||
|
@ -305,9 +305,9 @@ public:
|
||||||
void setMaxOctreePacketsPerSecond(int maxOctreePPS);
|
void setMaxOctreePacketsPerSecond(int maxOctreePPS);
|
||||||
int getMaxOctreePacketsPerSecond() const;
|
int getMaxOctreePacketsPerSecond() const;
|
||||||
|
|
||||||
render::ScenePointer getMain3DScene() override { return _graphicsEngine.getRenderScene(); }
|
render::ScenePointer getMain3DScene() override { return _graphicsEngine->getRenderScene(); }
|
||||||
render::EnginePointer getRenderEngine() override { return _graphicsEngine.getRenderEngine(); }
|
render::EnginePointer getRenderEngine() override { return _graphicsEngine->getRenderEngine(); }
|
||||||
gpu::ContextPointer getGPUContext() const { return _graphicsEngine.getGPUContext(); }
|
gpu::ContextPointer getGPUContext() const { return _graphicsEngine->getGPUContext(); }
|
||||||
|
|
||||||
const GameWorkload& getGameWorkload() const { return _gameWorkload; }
|
const GameWorkload& getGameWorkload() const { return _gameWorkload; }
|
||||||
|
|
||||||
|
@ -769,7 +769,7 @@ private:
|
||||||
|
|
||||||
GameWorkload _gameWorkload;
|
GameWorkload _gameWorkload;
|
||||||
|
|
||||||
GraphicsEngine _graphicsEngine;
|
std::shared_ptr<GraphicsEngine> _graphicsEngine;
|
||||||
void updateRenderArgs(float deltaTime);
|
void updateRenderArgs(float deltaTime);
|
||||||
|
|
||||||
bool _disableLoginScreen { true };
|
bool _disableLoginScreen { true };
|
||||||
|
|
Loading…
Reference in a new issue