Blender V4.3
NodeLight.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2012-2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10#include "NodeLight.h"
11
12namespace Freestyle {
13
14int NodeLight::numberOfLights = 0;
15
17{
18 if (numberOfLights > 7) {
19 _number = 7;
20 }
21 else {
22 _number = numberOfLights;
23 numberOfLights++;
24 }
25
26 Ambient[0] = Ambient[1] = Ambient[2] = 0.0f;
27 Ambient[3] = 1.0f;
28
29 for (int i = 0; i < 4; i++) {
30 Diffuse[i] = 1.0f;
31 Specular[i] = 1.0f;
32 }
33
34 Position[0] = Position[1] = Position[3] = 0.0f;
35 Position[2] = 1.0f;
36
37 on = true;
38}
39
40NodeLight::NodeLight(NodeLight &iBrother) : Node(iBrother)
41{
42 if (numberOfLights > 7) {
43 _number = 7;
44 }
45 else {
46 _number = numberOfLights;
47 numberOfLights++;
48 }
49
50 for (int i = 0; i < 4; i++) {
51 Ambient[i] = iBrother.ambient()[i];
52 Diffuse[i] = iBrother.diffuse()[i];
53 Specular[i] = iBrother.specular()[i];
54 Position[i] = iBrother.position()[i];
55 }
56
57 on = iBrother.isOn();
58}
59
61{
62 v.visitNodeLight(*this);
63}
64
65} /* namespace Freestyle */
Class to represent a light node.
ATTR_WARN_UNUSED_RESULT const BMVert * v
const float * specular() const
Definition NodeLight.h:43
const float * ambient() const
Definition NodeLight.h:33
virtual void accept(SceneVisitor &v)
Definition NodeLight.cpp:60
const float * diffuse() const
Definition NodeLight.h:38
const float * position() const
Definition NodeLight.h:48
bool isOn() const
Definition NodeLight.h:53
inherits from class Rep
Definition AppCanvas.cpp:20