"L. Spiro Engine"

F:/My Projects/LSEngine/Modules/LSModelLib/Src/Models/LSDPhongMaterial.h

00001 
00016 #ifndef __LSD_PHONGMATERIAL_H__
00017 #define __LSD_PHONGMATERIAL_H__
00018 
00019 #include "../LSDModelLib.h"
00020 #include "LSDLambertMaterial.h"
00021 
00022 namespace lsd {
00023 
00030         class CPhongMaterial : public CLambertMaterial {
00031         public :
00032                 // == Various constructors.
00033                 LSE_CALLCTOR                                                    CPhongMaterial();
00034 
00035 
00036                 // == Functions.
00045                 virtual LSSTD_ERRORS LSE_CALL                   LoadFromStream( const lsstd::IStream &_sStream, CAllocator * _paAllocator, LSUINT32 _ui32Version );
00046 
00053                 virtual CMaterial & LSE_CALL                    Copy( const CMaterial &_mOther );
00054 
00060                 virtual LSD_MATERIAL_TYPE LSE_CALL              GetType() const;
00061 
00065                 virtual LSVOID LSE_CALL                                 Trash();
00066 
00072                 LSE_INLINE CVector4 LSE_CALL                    GetSpecularColor() const;
00073 
00079                 LSE_INLINE const CString & LSE_CALL             GetSpecularTexture() const;
00080 
00086                 LSE_INLINE LSREAL LSE_CALL                              GetPower() const;
00087 
00093                 LSE_INLINE CVector4 LSE_CALL                    GetReflectiveColor() const;
00094 
00100                 LSE_INLINE LSREAL LSE_CALL                              GetReflectivity() const;
00101 
00102         protected :
00103                 // == Members.
00107                 CString                                                                 m_sShininess;
00108 
00112                 LSD_COLOR                                                               m_cSpecularColor;
00113 
00117                 LSD_COLOR                                                               m_cReflectiveColor;
00118 
00122                 LSREAL                                                                  m_fPower;
00123 
00124 
00125         private :
00126                 typedef CLambertMaterial                                Parent;
00127         };
00128 
00129 
00130         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00131         // DEFINITIONS
00132         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00138         LSE_INLINE CVector4 LSE_CALL CPhongMaterial::GetSpecularColor() const {
00139                 return CVector4( static_cast<LSREAL>(m_cSpecularColor.u.rRgb.fR),
00140                         static_cast<LSREAL>(m_cSpecularColor.u.rRgb.fG),
00141                         static_cast<LSREAL>(m_cSpecularColor.u.rRgb.fB),
00142                         LSM_ONE );
00143         }
00144 
00150         LSE_INLINE const CString & LSE_CALL CPhongMaterial::GetSpecularTexture() const {
00151                 return m_cSpecularColor.sTexture;
00152         }
00153 
00159         LSE_INLINE LSREAL LSE_CALL CPhongMaterial::GetPower() const {
00160                 return m_fPower;
00161         }
00162 
00168         LSE_INLINE CVector4 LSE_CALL CPhongMaterial::GetReflectiveColor() const {
00169                 return CVector4( static_cast<LSREAL>(m_cSpecularColor.u.rRgb.fR),
00170                         static_cast<LSREAL>(m_cSpecularColor.u.rRgb.fG),
00171                         static_cast<LSREAL>(m_cSpecularColor.u.rRgb.fB),
00172                         LSM_ONE );
00173         }
00174 
00180         LSE_INLINE LSREAL LSE_CALL CPhongMaterial::GetReflectivity() const {
00181                 return GetReflectiveColor() * CVector4( static_cast<LSREAL>(LSI_R_WEIGHT), static_cast<LSREAL>(LSI_G_WEIGHT),
00182                         static_cast<LSREAL>(LSI_B_WEIGHT), LSM_ZERO );
00183         }
00184 
00185 }       // namespace lsd
00186 
00187 #endif  // __LSD_PHONGMATERIAL_H__
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator