00001 // Filename: pointLight.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: PointLight::CData::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE PointLight::CData:: 00022 CData() : 00023 _specular_color(1.0f, 1.0f, 1.0f, 1.0f), 00024 _attenuation(1.0f, 0.0f, 0.0f), 00025 _point(0.0f, 0.0f, 0.0f) 00026 { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: PointLight::CData::Copy Constructor 00031 // Access: Public 00032 // Description: 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE PointLight::CData:: 00035 CData(const PointLight::CData ©) : 00036 _specular_color(copy._specular_color), 00037 _attenuation(copy._attenuation), 00038 _point(copy._point) 00039 { 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: PointLight::get_specular_color 00044 // Access: Public 00045 // Description: Returns the color of specular highlights generated by 00046 // the light. 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE const LColor &PointLight:: 00049 get_specular_color() const { 00050 CDReader cdata(_cycler); 00051 return cdata->_specular_color; 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: PointLight::set_specular_color 00056 // Access: Public 00057 // Description: Sets the color of specular highlights generated by 00058 // the light. 00059 //////////////////////////////////////////////////////////////////// 00060 INLINE void PointLight:: 00061 set_specular_color(const LColor &color) { 00062 CDWriter cdata(_cycler); 00063 cdata->_specular_color = color; 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: PointLight::get_attenuation 00068 // Access: Public 00069 // Description: Returns the terms of the attenuation equation for the 00070 // light. These are, in order, the constant, linear, 00071 // and quadratic terms based on the distance from the 00072 // point to the vertex. 00073 //////////////////////////////////////////////////////////////////// 00074 INLINE const LVecBase3 &PointLight:: 00075 get_attenuation() const { 00076 CDReader cdata(_cycler); 00077 return cdata->_attenuation; 00078 } 00079 00080 //////////////////////////////////////////////////////////////////// 00081 // Function: PointLight::set_attenuation 00082 // Access: Public 00083 // Description: Sets the terms of the attenuation equation for the 00084 // light. These are, in order, the constant, linear, 00085 // and quadratic terms based on the distance from the 00086 // point to the vertex. 00087 //////////////////////////////////////////////////////////////////// 00088 INLINE void PointLight:: 00089 set_attenuation(const LVecBase3 &attenuation) { 00090 CDWriter cdata(_cycler); 00091 cdata->_attenuation = attenuation; 00092 } 00093 00094 //////////////////////////////////////////////////////////////////// 00095 // Function: PointLight::get_point 00096 // Access: Public 00097 // Description: Returns the point in space at which the light is 00098 // located. This is local to the coordinate space in 00099 // which the light is assigned. 00100 //////////////////////////////////////////////////////////////////// 00101 INLINE const LPoint3 &PointLight:: 00102 get_point() const { 00103 CDReader cdata(_cycler); 00104 return cdata->_point; 00105 } 00106 00107 //////////////////////////////////////////////////////////////////// 00108 // Function: PointLight::set_point 00109 // Access: Public 00110 // Description: Sets the point in space at which the light is located. 00111 //////////////////////////////////////////////////////////////////// 00112 INLINE void PointLight:: 00113 set_point(const LPoint3 &point) { 00114 CDWriter cdata(_cycler); 00115 cdata->_point = point; 00116 mark_viz_stale(); 00117 }