00001 // Filename: directionalLight.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: DirectionalLight::CData::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE DirectionalLight::CData:: 00026 CData() : 00027 _specular_color(1.0f, 1.0f, 1.0f, 1.0f), 00028 _point(0.0f, 0.0f, 0.0f), 00029 _direction(LVector3f::forward()) 00030 { 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: DirectionalLight::CData::Copy Constructor 00035 // Access: Public 00036 // Description: 00037 //////////////////////////////////////////////////////////////////// 00038 INLINE DirectionalLight::CData:: 00039 CData(const DirectionalLight::CData ©) : 00040 _specular_color(copy._specular_color), 00041 _point(copy._point), 00042 _direction(copy._direction) 00043 { 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: DirectionalLight::get_specular_color 00048 // Access: Public 00049 // Description: Returns the color of specular highlights generated by 00050 // the light. 00051 //////////////////////////////////////////////////////////////////// 00052 INLINE const Colorf &DirectionalLight:: 00053 get_specular_color() const { 00054 CDReader cdata(_cycler); 00055 return cdata->_specular_color; 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function: DirectionalLight::set_specular_color 00060 // Access: Public 00061 // Description: Sets the color of specular highlights generated by 00062 // the light. 00063 //////////////////////////////////////////////////////////////////// 00064 INLINE void DirectionalLight:: 00065 set_specular_color(const Colorf &color) { 00066 CDWriter cdata(_cycler); 00067 cdata->_specular_color = color; 00068 } 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: DirectionalLight::get_point 00072 // Access: Public 00073 // Description: Returns the point in space at which the light is 00074 // located. This is local to the coordinate space in 00075 // which the light is assigned. 00076 // 00077 // This actually has no bearing on the visual effect of 00078 // the light, since the light is rendered as if it were 00079 // infinitely far away. This is only used to create a 00080 // visible representation of the light. 00081 //////////////////////////////////////////////////////////////////// 00082 INLINE const LPoint3f &DirectionalLight:: 00083 get_point() const { 00084 CDReader cdata(_cycler); 00085 return cdata->_point; 00086 } 00087 00088 //////////////////////////////////////////////////////////////////// 00089 // Function: DirectionalLight::set_point 00090 // Access: Public 00091 // Description: Sets the point in space at which the light is located. 00092 //////////////////////////////////////////////////////////////////// 00093 INLINE void DirectionalLight:: 00094 set_point(const LPoint3f &point) { 00095 CDWriter cdata(_cycler); 00096 cdata->_point = point; 00097 mark_viz_stale(); 00098 } 00099 00100 //////////////////////////////////////////////////////////////////// 00101 // Function: DirectionalLight::get_direction 00102 // Access: Public 00103 // Description: Returns the direction in which the light is aimed. 00104 // This is local to the coordinate space in which the 00105 // light is assigned. 00106 //////////////////////////////////////////////////////////////////// 00107 INLINE const LVector3f &DirectionalLight:: 00108 get_direction() const { 00109 CDReader cdata(_cycler); 00110 return cdata->_direction; 00111 } 00112 00113 //////////////////////////////////////////////////////////////////// 00114 // Function: DirectionalLight::set_direction 00115 // Access: Public 00116 // Description: Sets the direction in which the light is aimed. 00117 //////////////////////////////////////////////////////////////////// 00118 INLINE void DirectionalLight:: 00119 set_direction(const LVector3f &direction) { 00120 CDWriter cdata(_cycler); 00121 cdata->_direction = direction; 00122 mark_viz_stale(); 00123 }