Panda3D
 All Classes Functions Variables Enumerations
directionalLight.I
1 // Filename: directionalLight.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: DirectionalLight::CData::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE DirectionalLight::CData::
22 CData() :
23  _specular_color(1.0f, 1.0f, 1.0f, 1.0f),
24  _point(0.0f, 0.0f, 0.0f),
25  _direction(LVector3::forward())
26 {
27 }
28 
29 ////////////////////////////////////////////////////////////////////
30 // Function: DirectionalLight::CData::Copy Constructor
31 // Access: Public
32 // Description:
33 ////////////////////////////////////////////////////////////////////
34 INLINE DirectionalLight::CData::
35 CData(const DirectionalLight::CData &copy) :
36  _specular_color(copy._specular_color),
37  _point(copy._point),
38  _direction(copy._direction)
39 {
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: DirectionalLight::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 &DirectionalLight::
50  CDReader cdata(_cycler);
51  return cdata->_specular_color;
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: DirectionalLight::set_specular_color
56 // Access: Public
57 // Description: Sets the color of specular highlights generated by
58 // the light.
59 ////////////////////////////////////////////////////////////////////
60 INLINE void DirectionalLight::
62  CDWriter cdata(_cycler);
63  cdata->_specular_color = color;
64 }
65 
66 ////////////////////////////////////////////////////////////////////
67 // Function: DirectionalLight::get_point
68 // Access: Public
69 // Description: Returns the point in space at which the light is
70 // located. This is local to the coordinate space in
71 // which the light is assigned.
72 //
73 // This actually has no bearing on the visual effect of
74 // the light, since the light is rendered as if it were
75 // infinitely far away. This is only used to create a
76 // visible representation of the light.
77 ////////////////////////////////////////////////////////////////////
78 INLINE const LPoint3 &DirectionalLight::
79 get_point() const {
80  CDReader cdata(_cycler);
81  return cdata->_point;
82 }
83 
84 ////////////////////////////////////////////////////////////////////
85 // Function: DirectionalLight::set_point
86 // Access: Public
87 // Description: Sets the point in space at which the light is located.
88 ////////////////////////////////////////////////////////////////////
89 INLINE void DirectionalLight::
90 set_point(const LPoint3 &point) {
91  CDWriter cdata(_cycler);
92  cdata->_point = point;
93  mark_viz_stale();
94 }
95 
96 ////////////////////////////////////////////////////////////////////
97 // Function: DirectionalLight::get_direction
98 // Access: Public
99 // Description: Returns the direction in which the light is aimed.
100 // This is local to the coordinate space in which the
101 // light is assigned.
102 ////////////////////////////////////////////////////////////////////
103 INLINE const LVector3 &DirectionalLight::
104 get_direction() const {
105  CDReader cdata(_cycler);
106  return cdata->_direction;
107 }
108 
109 ////////////////////////////////////////////////////////////////////
110 // Function: DirectionalLight::set_direction
111 // Access: Public
112 // Description: Sets the direction in which the light is aimed.
113 ////////////////////////////////////////////////////////////////////
114 INLINE void DirectionalLight::
115 set_direction(const LVector3 &direction) {
116  CDWriter cdata(_cycler);
117  cdata->_direction = direction;
118  mark_viz_stale();
119 }
void set_point(const LPoint3 &point)
Sets the point in space at which the light is located.
const LPoint3 & get_point() const
Returns the point in space at which the light is located.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
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 LColor & get_specular_color() const FINAL
Returns the color of specular highlights generated by the light.
void set_specular_color(const LColor &color)
Sets the color of specular highlights generated by the light.
void set_direction(const LVector3 &direction)
Sets the direction in which the light is aimed.
const LVector3 & get_direction() const
Returns the direction in which the light is aimed.
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111