"L. Spiro Engine"
|
00001 00016 #ifndef __LSG_FND_H__ 00017 #define __LSG_FND_H__ 00018 00019 #include "../LSGGraphicsLib.h" 00020 #include "LSGFndBase.h" 00021 00022 namespace lsg { 00023 00028 #ifdef LSG_OGL 00029 typedef COpenGl CBaseApi; 00030 #elif defined( LSG_OGLES ) 00031 typedef COpenGlEs CBaseApi; 00032 #elif defined( LSG_DX9 ) 00033 typedef CDirectX9 CBaseApi; 00034 #elif defined( LSG_DX10 ) 00035 typedef CDirectX10 CBaseApi; 00036 #elif defined( LSG_DX11 ) 00037 typedef CDirectX11 CBaseApi; 00038 #endif // #ifdef LSG_OGL 00039 00040 class CIndexBuffer; 00041 class CPostProcessor; 00042 class CRenderTargetManager; 00043 class CShader; 00044 class CVertexBuffer; 00045 00052 class CFnd { 00053 public : 00054 // == Functions. 00055 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00056 // SCREEN 00057 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00062 static LSE_INLINE LSVOID LSE_FCALL AssertError(); 00063 00067 static LSVOID LSE_CALL ApplyDefaultStates(); 00068 00072 static LSE_INLINE LSVOID LSE_FCALL Present(); 00073 00079 static LSE_INLINE const CFndBase::LSG_METRICS LSE_CALL GetMetrics(); 00080 00086 static LSE_INLINE CRenderTargetManager * LSE_CALL RenderTargetMan(); 00087 00093 static LSE_INLINE CPostProcessor * LSE_CALL PostProcessor(); 00094 00100 static LSE_INLINE LSVOID LSE_FCALL Clear( LSUINT32 _ui32Mask ); 00101 00105 static LSE_INLINE LSVOID LSE_FCALL ClearAll(); 00106 00115 static LSE_INLINE LSVOID LSE_CALL SetClearColor( LSREAL _fR, LSREAL _fG, LSREAL _fB, LSREAL _fA ); 00116 00122 static LSE_INLINE LSVOID LSE_FCALL SetClearDepth( LSREAL _fValue ); 00123 00132 static LSE_INLINE LSVOID LSE_FCALL SetViewport( LSINT32 _i32X, LSINT32 _i32Y, LSINT32 _i32Width, LSINT32 _i32Height ); 00133 00137 static LSE_INLINE LSVOID LSE_CALL SaveViewPort(); 00138 00142 static LSE_INLINE LSVOID LSE_CALL RestoreViewPort(); 00143 00149 static LSE_INLINE LSVOID LSE_CALL SetFlipVertical( LSBOOL _bVal ); 00150 00156 static LSE_INLINE LSVOID LSE_FCALL SetDepthTest( LSBOOL _bVal ); 00157 00163 static LSE_INLINE LSVOID LSE_FCALL SetDepthFunc( LSG_DEPTH_TEST _dtFunc ); 00164 00170 static LSE_INLINE LSVOID LSE_FCALL SetDepthWrite( LSBOOL _bVal ); 00171 00177 static LSE_INLINE LSVOID LSE_FCALL SetCulling( LSBOOL _bVal ); 00178 00184 static LSE_INLINE LSVOID LSE_FCALL SetCullMode( LSG_CULL_MODES _cmMode ); 00185 00191 static LSE_INLINE LSG_CULL_MODES LSE_CALL GetCullMode(); 00192 00199 static LSE_INLINE LSG_CULL_MODES LSE_CALL GetReverseCullMode( LSG_CULL_MODES _cmMode ); 00200 00206 static LSE_INLINE LSVOID LSE_FCALL SetBlendEnabled( LSBOOL _bVal ); 00207 00214 static LSE_INLINE LSVOID LSE_FCALL SetBlendFunc( LSG_BLEND_MODES _bmSrc, LSG_BLEND_MODES _bmDst ); 00215 00221 static LSE_INLINE LSVOID LSE_FCALL SetFillMode( LSG_FILL_MODES _fmMode ); 00222 00228 static LSE_INLINE LSBOOL LSE_FCALL BeginRender(); 00229 00233 static LSE_INLINE LSVOID LSE_FCALL EndRender(); 00234 00241 static LSE_INLINE LSVOID LSE_FCALL SetScreenSize( LSUINT32 _ui32Width, LSUINT32 _ui32Height ); 00242 00248 static LSE_INLINE LSUINT32 LSE_CALL GetScreenWidth(); 00249 00255 static LSE_INLINE LSUINT32 LSE_CALL GetScreenHeight(); 00256 00257 00258 00259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00260 // MATRICES 00261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00267 static LSE_INLINE LSVOID LSE_FCALL SetWorldMatrix( const CMatrix4x4 &_mMat ); 00268 00274 static LSE_INLINE const CMatrix4x4 & LSE_FCALL GetWorldMatrix(); 00275 00281 static LSE_INLINE LSVOID LSE_FCALL SetViewMatrix( const CMatrix4x4 &_mMat ); 00282 00288 static LSE_INLINE const CMatrix4x4 & LSE_FCALL GetViewMatrix(); 00289 00295 static LSE_INLINE LSVOID LSE_FCALL SetProjMatrix( const CMatrix4x4 &_mMat ); 00296 00302 static LSE_INLINE const CMatrix4x4 & LSE_FCALL GetProjMatrix(); 00303 00317 static LSE_INLINE CMatrix4x4 LSE_CALL OffsetOrtho( LSREAL _fLeft, LSREAL _fRight, 00318 LSREAL _fBottom, LSREAL _fTop, LSREAL _fNear, LSREAL _fFar ); 00319 00320 00321 00322 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00323 // MATERIALS 00324 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00330 static LSE_INLINE LSVOID LSE_FCALL SetDiffuseMaterial( const CVector4 &_vColor ); 00331 00337 static LSE_INLINE LSVOID LSE_FCALL SetAmbientMaterial( const CVector4 &_vColor ); 00338 00344 static LSE_INLINE LSVOID LSE_FCALL SetEmissiveMaterial( const CVector4 &_vColor ); 00345 00351 static LSE_INLINE LSVOID LSE_FCALL SetSpecularMaterial( const CVector4 &_vColor ); 00352 00358 static LSE_INLINE LSVOID LSE_FCALL SetMaterialPower( LSREAL _fPower ); 00359 00365 static LSE_INLINE LSVOID LSE_FCALL SetRoughness( LSREAL _fValue ); 00366 00372 static LSE_INLINE LSVOID LSE_FCALL SetReflectivity( LSREAL _fValue ); 00373 00380 static LSE_INLINE LSVOID LSE_FCALL SetAnisotropy( LSREAL _fX, LSREAL _fY ); 00381 00382 00383 00384 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00385 // LIGHTS 00386 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00392 static LSE_INLINE LSVOID LSE_FCALL DisableLight( LSUINT32 _ui32Slot ); 00393 00403 static LSE_INLINE LSVOID LSE_FCALL SetDirectionalLight( LSUINT32 _ui32Slot, 00404 const CVector3 &_vDir, const CVector3 &_vDiffuse = CVector3( LSM_ONE, LSM_ONE, LSM_ONE ), const CVector3 &_vAmbient = CVector3( LSM_ZERO, LSM_ZERO, LSM_ZERO ), const CVector3 &_vSpecular = CVector3( LSM_ONE, LSM_ONE, LSM_ONE ) ); 00405 00411 static LSE_INLINE LSVOID LSE_FCALL SetHemisphereGroundColor( const CVector3 &_vColor ); 00412 00418 static LSE_INLINE LSVOID LSE_FCALL SetHemisphereSkyColor( const CVector3 &_vColor ); 00419 00425 static LSE_INLINE LSVOID LSE_FCALL SetHemisphereLighting( LSBOOL _bVal ); 00426 00432 static LSE_INLINE LSBOOL LSE_FCALL GetHemisphereLighting(); 00433 00439 static LSE_INLINE LSBOOL LSE_FCALL AnyLightsActive(); 00440 00446 static LSE_INLINE LSVOID LSE_FCALL SetShadowMapActive( LSBOOL _bVal ); 00447 00453 static LSE_INLINE LSBOOL LSE_CALL GetShadowMapActive(); 00454 00460 static LSE_INLINE const CMatrix4x4 & LSE_CALL GetShadowMapMatrix(); 00461 00467 static LSE_INLINE LSVOID LSE_CALL SetShadowMapMatrix( const CMatrix4x4 &_mMat ); 00468 00478 static LSE_INLINE LSVOID LSE_CALL SetShadowMapUVDepthFactors( LSREAL _fU, LSREAL _fV, LSREAL _fDepth ); 00479 00485 static LSE_INLINE LSVOID LSE_CALL SetShadowMapCasterSize( LSREAL _fSize ); 00486 00492 static LSE_INLINE LSVOID LSE_CALL SetGaussian( LSFLOAT _fVal ); 00493 00499 static LSE_INLINE LSFLOAT LSE_CALL GetGaussian(); 00500 00506 static LSE_INLINE LSVOID LSE_CALL SetExposure( LSFLOAT _fVal ); 00507 00513 static LSE_INLINE LSFLOAT LSE_CALL GetExposure(); 00514 00520 static LSE_INLINE LSVOID LSE_CALL SetBrightCutoff( LSFLOAT _fVal ); 00521 00527 static LSE_INLINE LSFLOAT LSE_CALL GetBrightCutoff(); 00528 00534 static LSE_INLINE LSVOID LSE_CALL SetTimeSinceLastRender( LSFLOAT _fVal ); 00535 00541 static LSE_INLINE LSFLOAT LSE_CALL GetTimeSinceLastRender(); 00542 00543 00544 00545 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00546 // SHADERS 00547 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00554 static LSE_INLINE LSVOID LSE_FCALL SetShader( CShader * _psShader ); 00555 00561 static LSE_INLINE CShader * LSE_FCALL GetShader(); 00562 00569 static LSVOID LSE_FCALL Render( LSUINT32 _ui32TotalPrimitives, const CIndexBuffer * _pibIndexBuffer = NULL ); 00570 00576 static LSE_INLINE LSVOID LSE_FCALL SetMakeDepthCopy( LSBOOL _bVal ); 00577 00583 static LSE_INLINE LSBOOL LSE_CALL GetMakeDepthCopy(); 00584 00590 static LSE_INLINE LSVOID LSE_FCALL SetMakeNormalCopy( LSBOOL _bVal ); 00591 00597 static LSE_INLINE LSBOOL LSE_CALL GetMakeNormalCopy(); 00598 00599 00600 00601 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00602 // METRICS 00603 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00609 static LSE_INLINE LSBOOL LSE_CALL NonPo2(); 00610 00611 00612 00613 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00614 // STATISTICS 00615 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00621 static LSE_INLINE LSUINT64 LSE_CALL GetTrianglesDrawn(); 00622 00626 static LSE_INLINE LSVOID LSE_CALL ClearTriangles(); 00627 00628 00629 00630 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00631 // POST PROCESSING 00632 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00639 static LSE_INLINE CVertexBuffer * LSE_CALL GetPostProcVertBuf(); 00640 00650 static LSBOOL LSE_CALL PreparePostProcess( LSUINT32 _ui32Width, LSUINT32 _ui32Height ); 00651 00652 00653 protected : 00654 // == Members. 00658 static LSUINT64 m_ui64TrianglesDrawn; 00659 00660 00661 // == Functions. 00665 static LSVOID LSE_CALL ApplyLightsToCurrentShader(); 00666 00667 }; 00668 00669 00670 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00671 // DEFINITIONS 00672 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00673 // == Functions. 00678 LSE_INLINE LSVOID LSE_FCALL CFnd::AssertError() { 00679 CBaseApi::AssertError(); 00680 } 00681 00685 LSE_INLINE LSVOID LSE_FCALL CFnd::Present() { 00686 CBaseApi::Present(); 00687 } 00688 00694 LSE_INLINE const CFndBase::LSG_METRICS LSE_CALL CFnd::GetMetrics() { 00695 return CFndBase::m_mMetrics; 00696 } 00697 00703 LSE_INLINE CRenderTargetManager * LSE_CALL CFnd::RenderTargetMan() { 00704 return CFndBase::m_prtmRenderTargetMan; 00705 } 00706 00712 LSE_INLINE CPostProcessor * LSE_CALL CFnd::PostProcessor() { 00713 return CFndBase::m_pppPostProcessor; 00714 } 00715 00721 LSE_INLINE LSVOID LSE_FCALL CFnd::Clear( LSUINT32 _ui32Mask ) { 00722 CBaseApi::Clear( _ui32Mask ); 00723 } 00724 00728 LSE_INLINE LSVOID LSE_FCALL CFnd::ClearAll() { 00729 CBaseApi::ClearAll(); 00730 } 00731 00740 LSE_INLINE LSVOID LSE_CALL CFnd::SetClearColor( LSREAL _fR, LSREAL _fG, LSREAL _fB, LSREAL _fA ) { 00741 CBaseApi::SetClearColor( _fR, _fG, _fB, _fA ); 00742 } 00743 00749 LSE_INLINE LSVOID LSE_FCALL CFnd::SetClearDepth( LSREAL _fValue ) { 00750 CBaseApi::SetClearDepth( _fValue ); 00751 } 00752 00761 LSE_INLINE LSVOID LSE_FCALL CFnd::SetViewport( LSINT32 _i32X, LSINT32 _i32Y, LSINT32 _i32Width, LSINT32 _i32Height ) { 00762 CFndBase::m_i32ViewportX = _i32X; 00763 CFndBase::m_i32ViewportY = _i32Y; 00764 CFndBase::m_i32ViewportWidth = _i32Width; 00765 CFndBase::m_i32ViewportHeight = _i32Height; 00766 CBaseApi::SetViewport( _i32X, _i32Y, _i32Width, _i32Height ); 00767 } 00768 00772 LSE_INLINE LSVOID LSE_CALL CFnd::SaveViewPort() { 00773 if ( CFndBase::m_ui32ViewStoreCount++ == 0UL ) { 00774 CFndBase::m_i32LastViewportX = CFndBase::m_i32ViewportX; 00775 CFndBase::m_i32LastViewportY = CFndBase::m_i32ViewportY; 00776 CFndBase::m_i32LastViewportWidth = CFndBase::m_i32ViewportWidth; 00777 CFndBase::m_i32LastViewportHeight = CFndBase::m_i32ViewportHeight; 00778 } 00779 } 00780 00784 LSE_INLINE LSVOID LSE_CALL CFnd::RestoreViewPort() { 00785 CFndBase::m_ui32ViewStoreCount = 0UL; 00786 SetViewport( CFndBase::m_i32LastViewportX, CFndBase::m_i32LastViewportY, CFndBase::m_i32LastViewportWidth, CFndBase::m_i32LastViewportHeight ); 00787 } 00788 00794 LSE_INLINE LSVOID LSE_CALL CFnd::SetFlipVertical( LSBOOL _bVal ) { 00795 if ( CFndBase::m_bFlipRender == !_bVal ) { 00796 CFndBase::m_bProjDirty = true; 00797 CFndBase::m_bFlipRender = _bVal != false; 00798 } 00799 } 00800 00806 LSE_INLINE LSVOID LSE_FCALL CFnd::SetDepthTest( LSBOOL _bVal ) { 00807 CBaseApi::SetDepthTest( _bVal ); 00808 } 00809 00815 LSE_INLINE LSVOID LSE_FCALL CFnd::SetDepthFunc( LSG_DEPTH_TEST _dtFunc ) { 00816 CBaseApi::SetDepthFunc( _dtFunc ); 00817 } 00818 00824 LSE_INLINE LSVOID LSE_FCALL CFnd::SetDepthWrite( LSBOOL _bVal ) { 00825 CBaseApi::SetDepthWrite( _bVal ); 00826 } 00827 00833 LSE_INLINE LSVOID LSE_FCALL CFnd::SetCulling( LSBOOL _bVal ) { 00834 CBaseApi::SetCulling( _bVal ); 00835 } 00836 00842 LSE_INLINE LSG_CULL_MODES LSE_CALL CFnd::GetCullMode() { 00843 return CBaseApi::GetCullMode(); 00844 } 00845 00851 LSE_INLINE LSVOID LSE_FCALL CFnd::SetCullMode( LSG_CULL_MODES _cmMode ) { 00852 CBaseApi::SetCullMode( _cmMode ); 00853 } 00854 00861 LSE_INLINE LSG_CULL_MODES LSE_CALL CFnd::GetReverseCullMode( LSG_CULL_MODES _cmMode ) { 00862 static const LSG_CULL_MODES cmModes[] = { 00863 LSG_CM_CCW, 00864 LSG_CM_CW 00865 }; 00866 return cmModes[_cmMode]; 00867 } 00868 00874 LSE_INLINE LSVOID LSE_FCALL CFnd::SetBlendEnabled( LSBOOL _bVal ) { 00875 CBaseApi::SetBlendEnabled( _bVal ); 00876 } 00877 00884 LSE_INLINE LSVOID LSE_FCALL CFnd::SetBlendFunc( LSG_BLEND_MODES _bmSrc, LSG_BLEND_MODES _bmDst ) { 00885 CBaseApi::SetBlendFunc( _bmSrc, _bmDst ); 00886 } 00887 00893 LSE_INLINE LSVOID LSE_FCALL CFnd::SetFillMode( LSG_FILL_MODES _fmMode ) { 00894 if ( CFndBase::m_fmFillMode != _fmMode ) { 00895 CFndBase::m_fmFillMode = _fmMode; 00896 CBaseApi::SetFillMode( _fmMode ); 00897 } 00898 } 00899 00905 LSE_INLINE LSBOOL LSE_FCALL CFnd::BeginRender() { 00906 return CBaseApi::BeginRender(); 00907 } 00908 00912 LSE_INLINE LSVOID LSE_FCALL CFnd::EndRender() { 00913 CBaseApi::EndRender(); 00914 } 00915 00922 LSE_INLINE LSVOID LSE_FCALL CFnd::SetScreenSize( LSUINT32 _ui32Width, LSUINT32 _ui32Height ) { 00923 CFndBase::m_ui32ScreenWidth = _ui32Width; 00924 CFndBase::m_ui32ScreenHeight = _ui32Height; 00925 #ifdef LSG_DX9 00926 CDirectX9::SetScreenSize( _ui32Width, _ui32Height ); 00927 #endif // #ifdef LSG_DX9 00928 } 00929 00935 LSE_INLINE LSUINT32 LSE_CALL CFnd::GetScreenWidth() { 00936 return CFndBase::m_ui32ScreenWidth; 00937 } 00938 00944 LSE_INLINE LSUINT32 LSE_CALL CFnd::GetScreenHeight() { 00945 return CFndBase::m_ui32ScreenHeight; 00946 } 00947 00953 LSE_INLINE LSVOID LSE_FCALL CFnd::SetWorldMatrix( const CMatrix4x4 &_mMat ) { 00954 CFndBase::m_mWorldMatrix = _mMat; 00955 CFndBase::m_bWorldDirty = true; 00956 } 00957 00963 LSE_INLINE const CMatrix4x4 & LSE_FCALL CFnd::GetWorldMatrix() { 00964 return CFndBase::m_mWorldMatrix; 00965 } 00966 00972 LSE_INLINE LSVOID LSE_FCALL CFnd::SetViewMatrix( const CMatrix4x4 &_mMat ) { 00973 CFndBase::m_mViewMatrix = _mMat; 00974 CFndBase::m_bViewDirty = true; 00975 } 00976 00982 LSE_INLINE const CMatrix4x4 & LSE_FCALL CFnd::GetViewMatrix() { 00983 return CFndBase::m_mViewMatrix; 00984 } 00985 00991 LSE_INLINE LSVOID LSE_FCALL CFnd::SetProjMatrix( const CMatrix4x4 &_mMat ) { 00992 CFndBase::m_mProjMatrix = _mMat; 00993 CFndBase::m_bProjDirty = true; 00994 } 00995 01001 LSE_INLINE const CMatrix4x4 & LSE_FCALL CFnd::GetProjMatrix() { 01002 return CFndBase::m_mProjMatrix; 01003 } 01004 01018 LSE_INLINE CMatrix4x4 LSE_CALL CFnd::OffsetOrtho( LSREAL _fLeft, LSREAL _fRight, 01019 LSREAL _fBottom, LSREAL _fTop, LSREAL _fNear, LSREAL _fFar ) { 01020 return CBaseApi::OffsetOrtho( _fLeft, _fRight, 01021 _fBottom, _fTop, _fNear, _fFar ); 01022 } 01023 01029 LSE_INLINE LSVOID LSE_FCALL CFnd::SetDiffuseMaterial( const CVector4 &_vColor ) { 01030 CFndBase::m_vDiffuseMaterial = _vColor; 01031 } 01032 01038 LSE_INLINE LSVOID LSE_FCALL CFnd::SetAmbientMaterial( const CVector4 &_vColor ) { 01039 CFndBase::m_vAmbientMaterial = _vColor; 01040 } 01041 01047 LSE_INLINE LSVOID LSE_FCALL CFnd::SetEmissiveMaterial( const CVector4 &_vColor ) { 01048 CFndBase::m_vEmissiveMaterial = _vColor; 01049 } 01050 01056 LSE_INLINE LSVOID LSE_FCALL CFnd::SetSpecularMaterial( const CVector4 &_vColor ) { 01057 CFndBase::m_vSpecularMaterial = _vColor; 01058 } 01059 01065 LSE_INLINE LSVOID LSE_FCALL CFnd::SetMaterialPower( LSREAL _fPower ) { 01066 CFndBase::m_fPower = _fPower; 01067 } 01068 01074 LSE_INLINE LSVOID LSE_FCALL CFnd::SetRoughness( LSREAL _fValue ) { 01075 CFndBase::m_vRoughness.x = CStd::Max( _fValue, LSM_FLT_EPSILON ); 01076 } 01077 01083 LSE_INLINE LSVOID LSE_FCALL CFnd::SetReflectivity( LSREAL _fValue ) { 01084 CFndBase::m_vRoughness.y = _fValue; 01085 } 01086 01093 LSE_INLINE LSVOID LSE_FCALL CFnd::SetAnisotropy( LSREAL _fX, LSREAL _fY ) { 01094 CFndBase::m_vAnisotropic.x = _fX; 01095 CFndBase::m_vAnisotropic.y = _fY; 01096 } 01097 01103 LSE_INLINE LSVOID LSE_FCALL CFnd::DisableLight( LSUINT32 _ui32Slot ) { 01104 assert( _ui32Slot < LSG_MAX_LIGHTS ); 01105 CFndBase::m_lLights[_ui32Slot].ltType = LSG_LT_NONE; 01106 if ( _ui32Slot + 1UL == CFndBase::m_ui32MaxLight ) { 01107 for ( LSUINT32 I = _ui32Slot; I--; ) { 01108 if ( CFndBase::m_lLights[_ui32Slot].ltType != LSG_LT_NONE ) { 01109 CFndBase::m_ui32MaxLight = I + 1UL; 01110 return; 01111 } 01112 } 01113 CFndBase::m_ui32MaxLight = 0UL; 01114 } 01115 } 01116 01126 LSE_INLINE LSVOID LSE_FCALL CFnd::SetDirectionalLight( LSUINT32 _ui32Slot, 01127 const CVector3 &_vDir, const CVector3 &_vDiffuse, const CVector3 &_vAmbient, const CVector3 &_vSpecular ) { 01128 assert( _ui32Slot < LSG_MAX_LIGHTS ); 01129 CFndBase::m_lLights[_ui32Slot].ltType = LSG_LT_DIR; 01130 CFndBase::m_lLights[_ui32Slot].vDir = _vDir; 01131 CFndBase::m_lLights[_ui32Slot].vDir.Normalize(); 01132 CFndBase::m_lLights[_ui32Slot].vDiffuse = _vDiffuse; 01133 CFndBase::m_lLights[_ui32Slot].vAmbient = _vAmbient; 01134 CFndBase::m_lLights[_ui32Slot].vSpecular = _vSpecular; 01135 CFndBase::m_ui32MaxLight = CStd::Max<LSUINT32>( CFndBase::m_ui32MaxLight, _ui32Slot + 1UL ); 01136 } 01137 01143 LSE_INLINE LSVOID LSE_FCALL CFnd::SetHemisphereGroundColor( const CVector3 &_vColor ) { 01144 CFndBase::m_vGroundColor = _vColor; 01145 } 01146 01152 LSE_INLINE LSVOID LSE_FCALL CFnd::SetHemisphereSkyColor( const CVector3 &_vColor ) { 01153 CFndBase::m_vSkyColor = _vColor; 01154 } 01155 01161 LSE_INLINE LSVOID LSE_FCALL CFnd::SetHemisphereLighting( LSBOOL _bVal ) { 01162 CFndBase::m_bHemisphere = _bVal; 01163 } 01164 01170 LSE_INLINE LSBOOL LSE_FCALL CFnd::GetHemisphereLighting() { 01171 return CFndBase::m_bHemisphere; 01172 } 01173 01179 LSE_INLINE LSBOOL LSE_FCALL CFnd::AnyLightsActive() { 01180 return CFndBase::m_ui32MaxLight != 0UL; 01181 } 01182 01188 LSE_INLINE LSVOID LSE_FCALL CFnd::SetShadowMapActive( LSBOOL _bVal ) { 01189 CFndBase::m_bShadowMapActive = _bVal; 01190 } 01191 01197 LSE_INLINE LSBOOL LSE_CALL CFnd::GetShadowMapActive() { 01198 return CFndBase::m_bShadowMapActive; 01199 } 01200 01206 LSE_INLINE const CMatrix4x4 & LSE_CALL CFnd::GetShadowMapMatrix() { 01207 return CFndBase::m_mShadowMapMatrix; 01208 } 01209 01215 LSE_INLINE LSVOID LSE_CALL CFnd::SetShadowMapMatrix( const CMatrix4x4 &_mMat ) { 01216 CFndBase::m_mShadowMapMatrix = _mMat; 01217 } 01218 01228 LSE_INLINE LSVOID LSE_CALL CFnd::SetShadowMapUVDepthFactors( LSREAL _fU, LSREAL _fV, LSREAL _fDepth ) { 01229 CFndBase::m_vShadowMapUVDepth = CVector3( _fU, _fV, _fDepth ); 01230 } 01231 01237 LSE_INLINE LSVOID LSE_CALL CFnd::SetShadowMapCasterSize( LSREAL _fSize ) { 01238 CFndBase::m_fShadowMapCasterSize = _fSize; 01239 } 01240 01246 LSE_INLINE LSVOID LSE_CALL CFnd::SetGaussian( LSFLOAT _fVal ) { 01247 CFndBase::m_fGaussian = _fVal; 01248 } 01249 01255 LSE_INLINE LSFLOAT LSE_CALL CFnd::GetGaussian() { 01256 return CFndBase::m_fGaussian; 01257 } 01258 01264 LSE_INLINE LSVOID LSE_CALL CFnd::SetExposure( LSFLOAT _fVal ) { 01265 CFndBase::m_fExposure = _fVal; 01266 } 01267 01273 LSE_INLINE LSFLOAT LSE_CALL CFnd::GetExposure() { 01274 return CFndBase::m_fExposure; 01275 } 01276 01282 LSE_INLINE LSVOID LSE_CALL CFnd::SetBrightCutoff( LSFLOAT _fVal ) { 01283 CFndBase::m_fBrightCutoff = _fVal; 01284 } 01285 01291 LSE_INLINE LSFLOAT LSE_CALL CFnd::GetBrightCutoff() { 01292 return CFndBase::m_fBrightCutoff; 01293 } 01294 01300 LSE_INLINE LSVOID LSE_CALL CFnd::SetTimeSinceLastRender( LSFLOAT _fVal ) { 01301 CFndBase::m_fTimeSinceLastFrame = _fVal; 01302 } 01303 01309 LSE_INLINE LSFLOAT LSE_CALL CFnd::GetTimeSinceLastRender() { 01310 return CFndBase::m_fTimeSinceLastFrame; 01311 } 01312 01319 LSE_INLINE LSVOID LSE_FCALL CFnd::SetShader( CShader * _psShader ) { 01320 CBaseApi::SetShader( _psShader ); 01321 } 01322 01328 LSE_INLINE CShader * LSE_FCALL CFnd::GetShader() { 01329 return CBaseApi::GetShader(); 01330 } 01331 01337 LSE_INLINE LSVOID LSE_FCALL CFnd::SetMakeDepthCopy( LSBOOL _bVal ) { 01338 if ( GetMetrics().ui32MaxRenderTargets > 1UL ) { 01339 CFndBase::m_bMakeDepthCopy = _bVal; 01340 } 01341 } 01342 01348 LSE_INLINE LSBOOL LSE_CALL CFnd::GetMakeDepthCopy() { 01349 return CFndBase::m_bMakeDepthCopy; 01350 } 01351 01357 LSE_INLINE LSVOID LSE_FCALL CFnd::SetMakeNormalCopy( LSBOOL _bVal ) { 01358 if ( GetMetrics().ui32MaxRenderTargets > 1UL ) { 01359 CFndBase::m_bMakeNormalCopy = _bVal; 01360 } 01361 } 01362 01368 LSE_INLINE LSBOOL LSE_CALL CFnd::GetMakeNormalCopy() { 01369 return CFndBase::m_bMakeNormalCopy; 01370 } 01371 01377 LSE_INLINE LSBOOL LSE_CALL CFnd::NonPo2() { 01378 return CBaseApi::NonPo2(); 01379 } 01380 01386 LSE_INLINE LSUINT64 LSE_CALL CFnd::GetTrianglesDrawn() { 01387 return m_ui64TrianglesDrawn; 01388 } 01389 01393 LSE_INLINE LSVOID LSE_CALL CFnd::ClearTriangles() { 01394 m_ui64TrianglesDrawn = 0ULL; 01395 } 01396 01403 LSE_INLINE CVertexBuffer * LSE_CALL CFnd::GetPostProcVertBuf() { 01404 return CFndBase::GetPostProcVertBuf(); 01405 } 01406 01407 } // namespace lsg 01408 01409 #endif // __LSG_FND_H__ 01410