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