Panda3D
pointLight.I
1 // Filename: pointLight.I
2 // Created by: mike (04eb99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: PointLight::CData::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE PointLight::CData::
22 CData() :
23  _specular_color(1.0f, 1.0f, 1.0f, 1.0f),
24  _attenuation(1.0f, 0.0f, 0.0f),
25  _point(0.0f, 0.0f, 0.0f)
26 {
27 }
28 
29 ////////////////////////////////////////////////////////////////////
30 // Function: PointLight::CData::Copy Constructor
31 // Access: Public
32 // Description:
33 ////////////////////////////////////////////////////////////////////
34 INLINE PointLight::CData::
35 CData(const PointLight::CData &copy) :
36  _specular_color(copy._specular_color),
37  _attenuation(copy._attenuation),
38  _point(copy._point)
39 {
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: PointLight::get_specular_color
44 // Access: Public, Final
45 // Description: Returns the color of specular highlights generated by
46 // the light.
47 ////////////////////////////////////////////////////////////////////
48 INLINE const LColor &PointLight::
50  CDReader cdata(_cycler);
51  return cdata->_specular_color;
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: PointLight::set_specular_color
56 // Access: Public
57 // Description: Sets the color of specular highlights generated by
58 // the light.
59 ////////////////////////////////////////////////////////////////////
60 INLINE void PointLight::
62  CDWriter cdata(_cycler);
63  cdata->_specular_color = color;
64 }
65 
66 ////////////////////////////////////////////////////////////////////
67 // Function: PointLight::get_attenuation
68 // Access: Public, Final
69 // Description: Returns the terms of the attenuation equation for the
70 // light. These are, in order, the constant, linear,
71 // and quadratic terms based on the distance from the
72 // point to the vertex.
73 ////////////////////////////////////////////////////////////////////
74 INLINE const LVecBase3 &PointLight::
75 get_attenuation() const {
76  CDReader cdata(_cycler);
77  return cdata->_attenuation;
78 }
79 
80 ////////////////////////////////////////////////////////////////////
81 // Function: PointLight::set_attenuation
82 // Access: Public
83 // Description: Sets the terms of the attenuation equation for the
84 // light. These are, in order, the constant, linear,
85 // and quadratic terms based on the distance from the
86 // point to the vertex.
87 ////////////////////////////////////////////////////////////////////
88 INLINE void PointLight::
89 set_attenuation(const LVecBase3 &attenuation) {
90  CDWriter cdata(_cycler);
91  cdata->_attenuation = attenuation;
92 }
93 
94 ////////////////////////////////////////////////////////////////////
95 // Function: PointLight::get_point
96 // Access: Public
97 // Description: Returns the point in space at which the light is
98 // located. This is local to the coordinate space in
99 // which the light is assigned.
100 ////////////////////////////////////////////////////////////////////
101 INLINE const LPoint3 &PointLight::
102 get_point() const {
103  CDReader cdata(_cycler);
104  return cdata->_point;
105 }
106 
107 ////////////////////////////////////////////////////////////////////
108 // Function: PointLight::set_point
109 // Access: Public
110 // Description: Sets the point in space at which the light is located.
111 ////////////////////////////////////////////////////////////////////
112 INLINE void PointLight::
113 set_point(const LPoint3 &point) {
114  CDWriter cdata(_cycler);
115  cdata->_point = point;
116  mark_viz_stale();
117 }
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
void set_specular_color(const LColor &color)
Sets the color of specular highlights generated by the light.
Definition: pointLight.I:61
void set_attenuation(const LVecBase3 &attenuation)
Sets the terms of the attenuation equation for the light.
Definition: pointLight.I:89
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
const LPoint3 & get_point() const
Returns the point in space at which the light is located.
Definition: pointLight.I:102
const LColor & get_specular_color() const FINAL
Returns the color of specular highlights generated by the light.
Definition: pointLight.I:49
void set_point(const LPoint3 &point)
Sets the point in space at which the light is located.
Definition: pointLight.I:113
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
const LVecBase3 & get_attenuation() const FINAL
Returns the terms of the attenuation equation for the light.
Definition: pointLight.I:75
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111