00001 // Filename: pointLight.I 00002 // Created by: mike (04Feb99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: PointLight::CData::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE PointLight::CData:: 00026 CData() : 00027 _specular_color(1.0f, 1.0f, 1.0f, 1.0f), 00028 _attenuation(1.0f, 0.0f, 0.0f), 00029 _point(0.0f, 0.0f, 0.0f) 00030 { 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: PointLight::CData::Copy Constructor 00035 // Access: Public 00036 // Description: 00037 //////////////////////////////////////////////////////////////////// 00038 INLINE PointLight::CData:: 00039 CData(const PointLight::CData ©) : 00040 _specular_color(copy._specular_color), 00041 _attenuation(copy._attenuation), 00042 _point(copy._point) 00043 { 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: PointLight::get_specular_color 00048 // Access: Public 00049 // Description: Returns the color of specular highlights generated by 00050 // the light. 00051 //////////////////////////////////////////////////////////////////// 00052 INLINE const Colorf &PointLight:: 00053 get_specular_color() const { 00054 CDReader cdata(_cycler); 00055 return cdata->_specular_color; 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function: PointLight::set_specular_color 00060 // Access: Public 00061 // Description: Sets the color of specular highlights generated by 00062 // the light. 00063 //////////////////////////////////////////////////////////////////// 00064 INLINE void PointLight:: 00065 set_specular_color(const Colorf &color) { 00066 CDWriter cdata(_cycler); 00067 cdata->_specular_color = color; 00068 } 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: PointLight::get_attenuation 00072 // Access: Public 00073 // Description: Returns the terms of the attenuation equation for the 00074 // light. These are, in order, the constant, linear, 00075 // and quadratic terms based on the distance from the 00076 // point to the vertex. 00077 //////////////////////////////////////////////////////////////////// 00078 INLINE const LVecBase3f &PointLight:: 00079 get_attenuation() const { 00080 CDReader cdata(_cycler); 00081 return cdata->_attenuation; 00082 } 00083 00084 //////////////////////////////////////////////////////////////////// 00085 // Function: PointLight::set_attenuation 00086 // Access: Public 00087 // Description: Sets the terms of the attenuation equation for the 00088 // light. These are, in order, the constant, linear, 00089 // and quadratic terms based on the distance from the 00090 // point to the vertex. 00091 //////////////////////////////////////////////////////////////////// 00092 INLINE void PointLight:: 00093 set_attenuation(const LVecBase3f &attenuation) { 00094 CDWriter cdata(_cycler); 00095 cdata->_attenuation = attenuation; 00096 } 00097 00098 //////////////////////////////////////////////////////////////////// 00099 // Function: PointLight::get_point 00100 // Access: Public 00101 // Description: Returns the point in space at which the light is 00102 // located. This is local to the coordinate space in 00103 // which the light is assigned. 00104 //////////////////////////////////////////////////////////////////// 00105 INLINE const LPoint3f &PointLight:: 00106 get_point() const { 00107 CDReader cdata(_cycler); 00108 return cdata->_point; 00109 } 00110 00111 //////////////////////////////////////////////////////////////////// 00112 // Function: PointLight::set_point 00113 // Access: Public 00114 // Description: Sets the point in space at which the light is located. 00115 //////////////////////////////////////////////////////////////////// 00116 INLINE void PointLight:: 00117 set_point(const LPoint3f &point) { 00118 CDWriter cdata(_cycler); 00119 cdata->_point = point; 00120 mark_viz_stale(); 00121 }