Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/pgraph/spotlight.I

Go to the documentation of this file.
00001 // Filename: spotlight.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: Spotlight::CData::Constructor
00022 //       Access: Public
00023 //  Description:
00024 ////////////////////////////////////////////////////////////////////
00025 INLINE Spotlight::CData::
00026 CData() :
00027   _exponent(0.0f),
00028   _specular_color(1.0f, 1.0f, 1.0f, 1.0f),
00029   _attenuation(1.0f, 0.0f, 0.0f)
00030 {
00031 }
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //     Function: Spotlight::CData::Copy Constructor
00035 //       Access: Public
00036 //  Description:
00037 ////////////////////////////////////////////////////////////////////
00038 INLINE Spotlight::CData::
00039 CData(const Spotlight::CData &copy) :
00040   _exponent(copy._exponent),
00041   _specular_color(copy._specular_color),
00042   _attenuation(copy._attenuation)
00043 {
00044 }
00045 
00046 ////////////////////////////////////////////////////////////////////
00047 //     Function: Spotlight::get_exponent
00048 //       Access: Public
00049 //  Description: Returns the exponent that controls the amount of
00050 //               light falloff from the center of the spotlight.  See
00051 //               set_exponent().
00052 ////////////////////////////////////////////////////////////////////
00053 INLINE float Spotlight::
00054 get_exponent() const {
00055   CDReader cdata(_cycler);
00056   return cdata->_exponent;
00057 }
00058 
00059 ////////////////////////////////////////////////////////////////////
00060 //     Function: Spotlight::set_exponent
00061 //       Access: Public
00062 //  Description: Sets the exponent that controls the amount of light
00063 //               falloff from the center of the spotlight.  The light
00064 //               is attenuated by the cosine of the angle between the
00065 //               direction of the light and the direction of the point
00066 //               being lighted, raised to the power of this exponent.
00067 //               Thus, higher exponents result in a more focused light
00068 //               source, regardless of the field-of-view of the lens.
00069 ////////////////////////////////////////////////////////////////////
00070 INLINE void Spotlight::
00071 set_exponent(float exponent) {
00072   CDWriter cdata(_cycler);
00073   cdata->_exponent = exponent;
00074 }
00075 
00076 ////////////////////////////////////////////////////////////////////
00077 //     Function: Spotlight::get_specular_color
00078 //       Access: Public
00079 //  Description: Returns the color of specular highlights generated by
00080 //               the light.
00081 ////////////////////////////////////////////////////////////////////
00082 INLINE const Colorf &Spotlight::
00083 get_specular_color() const {
00084   CDReader cdata(_cycler);
00085   return cdata->_specular_color;
00086 }
00087 
00088 ////////////////////////////////////////////////////////////////////
00089 //     Function: Spotlight::set_specular_color
00090 //       Access: Public
00091 //  Description: Sets the color of specular highlights generated by
00092 //               the light.
00093 ////////////////////////////////////////////////////////////////////
00094 INLINE void Spotlight::
00095 set_specular_color(const Colorf &color) {
00096   CDWriter cdata(_cycler);
00097   cdata->_specular_color = color;
00098 }
00099 
00100 ////////////////////////////////////////////////////////////////////
00101 //     Function: Spotlight::get_attenuation
00102 //       Access: Public
00103 //  Description: Returns the terms of the attenuation equation for the
00104 //               light.  These are, in order, the constant, linear,
00105 //               and quadratic terms based on the distance from the
00106 //               point to the vertex.
00107 ////////////////////////////////////////////////////////////////////
00108 INLINE const LVecBase3f &Spotlight::
00109 get_attenuation() const {
00110   CDReader cdata(_cycler);
00111   return cdata->_attenuation;
00112 }
00113 
00114 ////////////////////////////////////////////////////////////////////
00115 //     Function: Spotlight::set_attenuation
00116 //       Access: Public
00117 //  Description: Sets the terms of the attenuation equation for the
00118 //               light.  These are, in order, the constant, linear,
00119 //               and quadratic terms based on the distance from the
00120 //               point to the vertex.
00121 ////////////////////////////////////////////////////////////////////
00122 INLINE void Spotlight::
00123 set_attenuation(const LVecBase3f &attenuation) {
00124   CDWriter cdata(_cycler);
00125   cdata->_attenuation = attenuation;
00126 }

Generated on Fri May 2 00:42:25 2003 for Panda by doxygen1.3