summaryrefslogtreecommitdiffstats
path: root/src/render/lights/environmentlight.cpp
blob: c35bd21fd30a3babb233e4068d73adf09f45ae5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include "environmentlight_p.h"
#include "qenvironmentlight.h"
#include "qenvironmentlight_p.h"

QT_BEGIN_NAMESPACE

namespace Qt3DRender {
namespace Render {

using namespace Qt3DCore;

QNodeId EnvironmentLight::shaderData() const
{
    return m_shaderDataId;
}

void EnvironmentLight::syncFromFrontEnd(const QNode *frontEnd, bool firstTime)
{
    BackendNode::syncFromFrontEnd(frontEnd, firstTime);
    const QEnvironmentLight *node = qobject_cast<const QEnvironmentLight *>(frontEnd);
    if (!node)
        return;

    if (firstTime) {
        QEnvironmentLightPrivate *d = static_cast<QEnvironmentLightPrivate *>(QEnvironmentLightPrivate::get(const_cast<Qt3DCore::QNode *>(frontEnd)));
        m_shaderDataId = d->m_shaderData ? d->m_shaderData->id() : QNodeId{};
    }
}

} // namespace Render
} // namespace Qt3DRender

QT_END_NAMESPACE