00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #pragma once
00013
00015 #include "nvsgcommon.h"
00016
00017 #include "nvsg/LightSource.h"
00018
00019 namespace nvsg
00020 {
00021
00022
00023
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 }