1// Copyright (C) 2008-2012 NVIDIA Corporation.
2// Copyright (C) 2019 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
5#include <QtQuick3DRuntimeRender/private/qssgrenderlight_p.h>
6
7QT_BEGIN_NAMESPACE
8
9QSSGRenderLight::QSSGRenderLight(QSSGRenderGraphObject::Type type)
10 : QSSGRenderNode(type)
11 , m_scope(nullptr)
12 , m_diffuseColor(1, 1, 1)
13 , m_specularColor(1, 1, 1)
14 , m_ambientColor(0, 0, 0)
15 , m_brightness(1)
16 , m_constantFade(1)
17 , m_linearFade(0)
18 , m_quadraticFade(1)
19 , m_coneAngle(40.0f)
20 , m_innerConeAngle(30.0f)
21 , m_castShadow(false)
22 , m_shadowBias(0.0f)
23 , m_shadowFactor(5.0f)
24 , m_shadowMapRes(9)
25 , m_shadowMapFar(5000.0f)
26 , m_shadowFilter(35.0f)
27{
28 Q_ASSERT(QSSGRenderGraphObject::isLight(type));
29 markDirty(dirtyFlag: DirtyFlag::LightDirty);
30}
31
32void QSSGRenderLight::markDirty(DirtyFlag dirtyFlag)
33{
34 m_lightDirtyFlags |= FlagT(dirtyFlag);
35 QSSGRenderNode::markDirty(dirtyFlag: QSSGRenderNode::DirtyFlag::SubNodeDirty);
36}
37
38void QSSGRenderLight::clearDirty(DirtyFlag dirtyFlag)
39{
40 m_lightDirtyFlags &= ~FlagT(dirtyFlag);
41 QSSGRenderNode::clearDirty(dirtyFlag: QSSGRenderNode::DirtyFlag::SubNodeDirty);
42}
43
44QT_END_NAMESPACE
45

source code of qtquick3d/src/runtimerender/graphobjects/qssgrenderlight.cpp