00001 // Filename: directionalLight.I 00002 // Created by: mike (04eb99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: DirectionalLight::CData::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE DirectionalLight::CData:: 00022 CData() : 00023 _specular_color(1.0f, 1.0f, 1.0f, 1.0f), 00024 _point(0.0f, 0.0f, 0.0f), 00025 _direction(LVector3::forward()) 00026 { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: DirectionalLight::CData::Copy Constructor 00031 // Access: Public 00032 // Description: 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE DirectionalLight::CData:: 00035 CData(const DirectionalLight::CData ©) : 00036 _specular_color(copy._specular_color), 00037 _point(copy._point), 00038 _direction(copy._direction) 00039 { 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: DirectionalLight::get_specular_color 00044 // Access: Public 00045 // Description: Returns the color of specular highlights generated by 00046 // the light. 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE const LColor &DirectionalLight:: 00049 get_specular_color() const { 00050 CDReader cdata(_cycler); 00051 return cdata->_specular_color; 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: DirectionalLight::set_specular_color 00056 // Access: Public 00057 // Description: Sets the color of specular highlights generated by 00058 // the light. 00059 //////////////////////////////////////////////////////////////////// 00060 INLINE void DirectionalLight:: 00061 set_specular_color(const LColor &color) { 00062 CDWriter cdata(_cycler); 00063 cdata->_specular_color = color; 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: DirectionalLight::get_point 00068 // Access: Public 00069 // Description: Returns the point in space at which the light is 00070 // located. This is local to the coordinate space in 00071 // which the light is assigned. 00072 // 00073 // This actually has no bearing on the visual effect of 00074 // the light, since the light is rendered as if it were 00075 // infinitely far away. This is only used to create a 00076 // visible representation of the light. 00077 //////////////////////////////////////////////////////////////////// 00078 INLINE const LPoint3 &DirectionalLight:: 00079 get_point() const { 00080 CDReader cdata(_cycler); 00081 return cdata->_point; 00082 } 00083 00084 //////////////////////////////////////////////////////////////////// 00085 // Function: DirectionalLight::set_point 00086 // Access: Public 00087 // Description: Sets the point in space at which the light is located. 00088 //////////////////////////////////////////////////////////////////// 00089 INLINE void DirectionalLight:: 00090 set_point(const LPoint3 &point) { 00091 CDWriter cdata(_cycler); 00092 cdata->_point = point; 00093 mark_viz_stale(); 00094 } 00095 00096 //////////////////////////////////////////////////////////////////// 00097 // Function: DirectionalLight::get_direction 00098 // Access: Public 00099 // Description: Returns the direction in which the light is aimed. 00100 // This is local to the coordinate space in which the 00101 // light is assigned. 00102 //////////////////////////////////////////////////////////////////// 00103 INLINE const LVector3 &DirectionalLight:: 00104 get_direction() const { 00105 CDReader cdata(_cycler); 00106 return cdata->_direction; 00107 } 00108 00109 //////////////////////////////////////////////////////////////////// 00110 // Function: DirectionalLight::set_direction 00111 // Access: Public 00112 // Description: Sets the direction in which the light is aimed. 00113 //////////////////////////////////////////////////////////////////// 00114 INLINE void DirectionalLight:: 00115 set_direction(const LVector3 &direction) { 00116 CDWriter cdata(_cycler); 00117 cdata->_direction = direction; 00118 mark_viz_stale(); 00119 }