diff options
author | Kevin Ottens <kevin.ottens@kdab.com> | 2017-02-23 16:10:41 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-02-24 16:59:05 +0000 |
commit | e40572b9bcbf85c0c978c6234ecfd33354748525 (patch) | |
tree | 8f0113dd90b10fd64d4fe6812df2a08f4b84fc00 /src/render/jobs/lightgatherer.cpp | |
parent | c10fa3bf20f5ac000a0ba67f2ec8e101af040d6f (diff) |
The LightGatherer job also collects the EnvironmentLight
Change-Id: Idf8a6d03bce309c27ef1ae0c47549f02a21c3eba
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/jobs/lightgatherer.cpp')
-rw-r--r-- | src/render/jobs/lightgatherer.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/render/jobs/lightgatherer.cpp b/src/render/jobs/lightgatherer.cpp index 39023bc35..e62544f15 100644 --- a/src/render/jobs/lightgatherer.cpp +++ b/src/render/jobs/lightgatherer.cpp @@ -51,6 +51,7 @@ namespace Render { LightGatherer::LightGatherer() : Qt3DCore::QAspectJob() , m_manager(nullptr) + , m_environmentLight(nullptr) { SET_JOB_RUN_STAT_TYPE(this, JobTypes::LightGathering, 0); } @@ -58,13 +59,21 @@ LightGatherer::LightGatherer() void LightGatherer::run() { const QVector<HEntity> handles = m_manager->activeHandles(); + int envLightCount = 0; for (const HEntity handle : handles) { Entity *node = m_manager->data(handle); const QVector<Light *> lights = node->renderComponents<Light>(); if (!lights.isEmpty()) m_lights.push_back(LightSource(node, lights)); + const QVector<EnvironmentLight *> envLights = node->renderComponents<EnvironmentLight>(); + envLightCount += envLights.size(); + if (!envLights.isEmpty() && !m_environmentLight) + m_environmentLight = envLights.first(); } + + if (envLightCount > 1) + qWarning() << "More than one environment light found, extra instances are ignored"; } } // Render |