Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

PointLight.h

Go to the documentation of this file.
00001 // Copyright NVIDIA Corporation 2002-2004
00002 // TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
00003 // *AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
00004 // OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
00005 // AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS
00006 // BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
00007 // WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
00008 // BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS)
00009 // ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS
00010 // BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 
00011 
00012 #pragma once
00013 
00015 #include "nvsgcommon.h"
00016 
00017 #include  "nvsg/LightSource.h"
00018 
00019 namespace nvsg
00020 {
00021   /*  NOTE: A PointLight does NOT contain a position !
00022       It is assumed to be in the origin.
00023       Any changes to this must be performed by a Transform node.
00024   */
00025 
00027 
00033   class PointLight : public LightSource
00034   {
00035     public:
00037 
00038       NVSG_API static const PointLight * create( void );
00039 
00041 
00042       NVSG_API static const PointLight * createFromBase( const LightSource &rhs  
00043                                                        );
00044 
00046 
00047       NVSG_API virtual const PointLight * clone( void ) const;
00048 
00050 
00051       NVSG_API virtual bool isDataShared( void ) const;
00052 
00054 
00055       NVSG_API virtual DataID getDataID( void )  const;
00056 
00058 
00061       NVSG_API void getAttenuation( float &c    
00062                                   , float &l    
00063                                   , float &q    
00064                                   ) const;
00065 
00067 
00070       NVSG_API const nvmath::Vec3f& getAttenuation( void ) const;
00071 
00073 
00076       NVSG_API bool isAttenuated( void ) const;
00077 
00079 
00082       NVSG_API void  setAttenuation( float c    
00083                                    , float l    
00084                                    , float q    
00085                                    );
00086 
00087     protected:
00089       NVSG_API PointLight( void );
00090 
00092       NVSG_API PointLight( const LightSource &rhs );
00093 
00095       NVSG_API PointLight( const PointLight &rhs );
00096 
00098       NVSG_API virtual ~PointLight( void );
00099 
00100     private:
00101       nvmath::Vec3f m_attenuation;
00102   };
00103 
00104   inline void PointLight::getAttenuation( float &c, float &l, float &q ) const
00105   {
00106     __TRACE();
00107     c = m_attenuation[0];
00108     l = m_attenuation[1];
00109     q = m_attenuation[2];
00110   }
00111 
00112   inline const nvmath::Vec3f& PointLight::getAttenuation( void ) const
00113   {
00114     __TRACE();
00115     return m_attenuation;
00116   }
00117 
00118   inline bool PointLight::isAttenuated( void ) const
00119   {
00120     __TRACE();
00121     return(   ( m_attenuation[0] != 1.0f )
00122           ||  ( m_attenuation[1] != 0.0f )
00123           ||  ( m_attenuation[2] != 0.0f )
00124           );
00125   }
00126 
00127   inline void PointLight::setAttenuation( float c, float l, float q )
00128   {
00129     __TRACE();
00130     m_attenuation[0] = c;
00131     m_attenuation[1] = l;
00132     m_attenuation[2] = q;
00133   }
00134 
00135 } //  namespace nvsg

Generated on Tue Mar 1 13:19:20 2005 for NVSGSDK by NVIDIA