204 lines
5.3 KiB
C++
204 lines
5.3 KiB
C++
|
|
|
|
#pragma once
|
|
|
|
//Game용 ViewPort
|
|
|
|
#include "sViewport.h"
|
|
#include <toolkit/XFlag.h>
|
|
#include <dump/XException.h>
|
|
|
|
class K3DVertexBuffer;
|
|
class KMeshPrimitive;
|
|
class SShadowViewPort;
|
|
|
|
class SGameViewPort : public SViewPort
|
|
{
|
|
public:
|
|
//enum
|
|
//{
|
|
// HDR_TYPE_NONE = 0,
|
|
// HDR_TYPE_CROSS = 1,
|
|
// HDR_TYPE_BLUR = 2,
|
|
//};
|
|
|
|
SGameViewPort( bool bClearColorBuffer = true, bool bClearDepthBuffer = true );
|
|
virtual ~SGameViewPort();
|
|
|
|
virtual void Initilaize( K3DRenderDevice *dev, const KViewportStruct &viewarea, float nearClip, float farClip );
|
|
void Initilaize( const SGameViewPort* pViewport ); //Child Viewport
|
|
|
|
virtual void Register( K3DPrimitive *pr, DWORD flag );
|
|
//virtual void Render( K3DRenderTarget *pRT, DWORD flag = 0, bool bClearRegister = true );
|
|
|
|
virtual void Render( K3DRenderTarget *pRT, DWORD flag = 0, bool bClearRegister = true );
|
|
virtual void Render( bool bClearRegister = true, bool bSetRenderTarget = true );
|
|
virtual void ClearRegisteredList();
|
|
|
|
virtual void SetViewArea( const KRect &viewarea );
|
|
|
|
virtual void SetCamera( const K3DCamera *cam );
|
|
|
|
//void SetUseHDR( bool bUseHDR ) { m_bUseHDR = bUseHDR; }
|
|
//bool GetUseHDR() { return m_bUseHDR; }
|
|
//void SetHDRFactor( int nCross, int nBlur )
|
|
//{
|
|
// if(nCross >= 0) m_nVarFilter01 = nCross;
|
|
// if(nBlur >= 0) m_nVarFilter02 = nBlur;
|
|
//}
|
|
|
|
//void SetHDRType( int nTypeHDR )
|
|
//{
|
|
// if(nTypeHDR == HDR_TYPE_NONE)
|
|
// {
|
|
// m_nTypeHDR = nTypeHDR;
|
|
// }
|
|
// else
|
|
// {
|
|
// m_nTypeHDR |= nTypeHDR;
|
|
// }
|
|
//}
|
|
|
|
void SetHQWaterHeight( float fHeight );
|
|
|
|
//void SetLightPosition( const K3DVector & pos );
|
|
|
|
//virtual void SetRenderFlag( int nFlag );
|
|
|
|
void SetShadowViewPort( class SShadowViewPort * pViewPort )
|
|
{
|
|
m_pShadowViewPort = pViewPort;
|
|
}
|
|
void SetWaterViewPort( class SWaterViewPort * pViewPort )
|
|
{
|
|
m_pWaterViewPort = pViewPort;
|
|
}
|
|
|
|
SShadowViewPort* GetShadowViewPort()
|
|
{
|
|
return m_pShadowViewPort;
|
|
}
|
|
|
|
SWaterViewPort* GetWaterViewPort()
|
|
{
|
|
return m_pWaterViewPort;
|
|
}
|
|
|
|
int GetBloomEffect()
|
|
{
|
|
return 0;
|
|
}
|
|
void SetBloomEffect( int nLevel )
|
|
{
|
|
}
|
|
|
|
void AllViewPortClear();
|
|
|
|
bool DrawWater();
|
|
|
|
void SetWaterBumpSpeed( float fSpeed );
|
|
void SetWaterBumpSize( float fSize );
|
|
|
|
bool InitHdr();
|
|
void CreateBlurSampler();
|
|
bool CreateHdrBuffers();
|
|
void StartRTSourceScene();
|
|
void ProcessHdr();
|
|
void EndHdr();
|
|
|
|
void CreateOcclusionBuffers();
|
|
virtual void OcclusionCulling();
|
|
|
|
void SetBlurRadius( float fRadius );
|
|
void SetHdrQuality( int nQuality );
|
|
void SetHdrBlurMixRatio( float fRatio );
|
|
void SetHdrExposure( float fExposure );
|
|
void SetHdrGamma( float fGamma );
|
|
|
|
void createPostEffectData(bool enableSelectOutLine);
|
|
void setSelectColor(K3DVector const& color);
|
|
void SetEnableSelectOutLine(bool enable) { m_enableSelectOutLine = enable; }
|
|
protected:
|
|
void createSourceSceneRTData();
|
|
void createSelectRTData();
|
|
void createSelectRT();
|
|
void createSelectRTVB(float x, float y, float w, float h);
|
|
/// 화면에 m_spSelectOutLineRT를 블렌딩 해수 렌더링
|
|
void renderSelectOutLineBlend();
|
|
/// m_spSelectRT에 선택한 primitive가 들어 있는 m_prSelectMesh를 렌더링
|
|
void renderSelectRT();
|
|
/// m_rtSelectOutLine에 m_rtSelect에서 외각선을 검출해서 렌더링
|
|
void renderSelectOutLineRT();
|
|
/// m_prSelectMesh 렌더링
|
|
void renderPrSelectList(vec_rendermesh& renderlist);
|
|
void setViewPort(DWORD x, DWORD y, DWORD w, DWORD h, float minz = 0.0f, float maxz = 1.0f);
|
|
|
|
protected:
|
|
//////////////////////////////////////////////////////////////////////////
|
|
//쉐도우 맵 관련
|
|
|
|
// 참조 뷰포트 =============================
|
|
class SShadowViewPort* m_pShadowViewPort;
|
|
class SWaterViewPort* m_pWaterViewPort;
|
|
|
|
//HDR=======================================
|
|
public:
|
|
enum
|
|
{
|
|
HDR_NUMSAMPLES = 5 ///< 전체 span은 이거 * 2 + 1
|
|
//HDR_SAMPLESPAN = 5,
|
|
//HDR_NUMSAMPLES = 13, // pow( HDR_SAMPLESPAN + 1, 2 ) / 2 - HDR_SAMPLESPAN
|
|
};
|
|
|
|
K3DPoint m_BlurSamplerX[ HDR_NUMSAMPLES * 2 + 1 ]; ///< u, v
|
|
K3DPoint m_BlurSamplerY[ HDR_NUMSAMPLES * 2 + 1 ]; ///< u, v
|
|
float m_fBlurWeight[ HDR_NUMSAMPLES * 2 + 1 ];
|
|
//K3DPoint m_BlurSampler[ HDR_NUMSAMPLES ]; // u, v
|
|
//float m_fBlurWeight[ HDR_NUMSAMPLES ];
|
|
K3DRenderTargetSPtr m_spHdrBlurX;
|
|
K3DRenderTargetSPtr m_spHdrBlurY;
|
|
K3DRenderTargetSPtr m_spOcclusionBuffer;
|
|
/// 원본 render texture
|
|
K3DRenderTargetSPtr m_rtSourceScene;
|
|
/// 선택한 오브젝트를 렌더링하는 render texture
|
|
K3DRenderTargetSPtr m_rtSelect;
|
|
/// 선택한 오브젝트의 외각 라인을 출력해주는 render texture
|
|
K3DRenderTargetSPtr m_rtSelectOutLine;
|
|
K3DVertexBufferSPtr m_vbSelect;
|
|
bool m_enableSelectOutLine;
|
|
float m_selectColor[3];
|
|
//K3DRenderTargetSPtr m_spHdrBlur;
|
|
//K3DRenderTargetSPtr m_spHDRSource; // Depth 도 포함
|
|
//K3DRenderTargetSPtr m_spHDRBlurSource; // Depth 도 포함 (X) Depth 필요없음 (O)
|
|
//K3DRenderTargetSPtr m_spHDRBlurTarget;
|
|
|
|
float m_fBlurRadius;
|
|
int m_nHdrQuality;
|
|
float m_fHdrBlurMixRatio;
|
|
float m_fHdrExposure;
|
|
float m_fHdrGamma;
|
|
|
|
bool m_bRenderShadow;
|
|
|
|
//bool m_bUseHDR;
|
|
//DWORD m_dwHDR_Factor;
|
|
//
|
|
//short m_nVarFilter01;
|
|
//short m_nVarFilter02;
|
|
|
|
//short m_nTypeHDR;
|
|
|
|
KViewportStruct m_backview;
|
|
|
|
|
|
//Test 용===================================
|
|
|
|
K3DVertexBufferSPtr m_spHdrVb;
|
|
//K3DVertexBufferSPtr m_spShadowVB;
|
|
|
|
int m_nShadowStride;
|
|
|
|
float m_fWaterBumpSpeed;
|
|
float m_fWaterBumpSize;
|
|
};
|