"L. Spiro Engine"
|
00001 00016 #ifndef __LSG_POSTPROCESSLUMINANCE_H__ 00017 #define __LSG_POSTPROCESSLUMINANCE_H__ 00018 00019 #include "../LSGGraphicsLib.h" 00020 #include "../RenderTarget/LSGColorRenderTarget.h" 00021 #include "../ShaderLanguage/LSGShader.h" 00022 #include "CriticalSection/LSHCriticalSection.h" 00023 #include "Vector/LSTLVector.h" 00024 00025 namespace lsg { 00026 00033 class CPostProcessLuminance { 00034 public : 00035 // == Various constructors. 00036 LSE_CALLCTOR CPostProcessLuminance(); 00037 LSE_CALLCTOR ~CPostProcessLuminance(); 00038 00039 00040 // == Functions. 00049 LSBOOL LSE_CALL GetLuminance( CColorRenderTarget &_crtSrc ); 00050 00057 LSBOOL LSE_CALL GetAdaptedLuminance( LSFLOAT _fTime ); 00058 00064 LSE_INLINE CColorRenderTarget & LSE_CALL GetCurLumTarget(); 00065 00071 LSE_INLINE CColorRenderTarget & LSE_CALL GetPrevLumTarget(); 00072 00078 LSE_INLINE CColorRenderTarget & LSE_CALL GetAdaptedTarget(); 00079 00085 LSE_INLINE CVector<CColorRenderTarget, LSUINT8> & 00086 MiddleTargets(); 00087 00093 LSE_INLINE CShader * LSE_CALL LumDisplayShader(); 00094 00095 00096 protected : 00097 // == Members. 00104 CVector<CColorRenderTarget, LSUINT8> m_vRenderTargets; 00105 00110 CColorRenderTarget m_crtFinal[2]; 00111 00115 CColorRenderTarget m_crtAdapted; 00116 00120 LSUINT32 m_ui32CurFinal; 00121 00125 LSUINT32 m_ui32LastWidth; 00126 00130 LSUINT32 m_ui32LastHeight; 00131 00135 static CShader * m_psFirstPass; 00136 00140 static CShader * m_psOtherPasses; 00141 00145 static CShader * m_psAdapt; 00146 00150 static CShader * m_psDisplayLum; 00151 00155 static CCriticalSection m_csCrit; 00156 00160 static LSUINT32 m_ui32RefCount; 00161 00165 static CShaderBase::LSG_HANDLE m_hTexCoords; 00166 00170 static CShaderBase::LSG_HANDLE m_hOtherTexCoords; 00171 00172 00173 // == Functions. 00181 LSBOOL LSE_CALL Init( LSUINT32 _ui32Width, LSUINT32 _ui32Height ); 00182 }; 00183 00184 00185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00186 // DEFINITIONS 00187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00188 // == Functions. 00194 LSE_INLINE CColorRenderTarget & LSE_CALL CPostProcessLuminance::GetCurLumTarget() { 00195 return m_crtFinal[m_ui32CurFinal]; 00196 } 00197 00203 LSE_INLINE CColorRenderTarget & LSE_CALL CPostProcessLuminance::GetPrevLumTarget() { 00204 return m_crtFinal[m_ui32CurFinal^1UL]; 00205 } 00206 00212 LSE_INLINE CColorRenderTarget & LSE_CALL CPostProcessLuminance::GetAdaptedTarget() { 00213 return m_crtAdapted; 00214 } 00215 00221 LSE_INLINE CVector<CColorRenderTarget, LSUINT8> & CPostProcessLuminance::MiddleTargets() { 00222 return m_vRenderTargets; 00223 } 00224 00230 LSE_INLINE CShader * LSE_CALL CPostProcessLuminance::LumDisplayShader() { 00231 return m_psDisplayLum; 00232 } 00233 00234 } // namespace lsg 00235 00236 #endif // __LSG_POSTPROCESSLUMINANCE_H__