109 lines
2.0 KiB
C++
109 lines
2.0 KiB
C++
|
|
|
|
#pragma once
|
|
|
|
#include "K3DTypes.h"
|
|
#include "SGameEnv.h"
|
|
#include "KPrimitiveSprite.h"
|
|
|
|
class K3DCamera;
|
|
struct K3DLight;
|
|
|
|
const int LENS_FLARE_NUM = 13; ///< 렌즈 플레어.
|
|
|
|
class SGameFlare : public SGameEnv
|
|
{
|
|
public:
|
|
SGameFlare();
|
|
~SGameFlare();
|
|
|
|
virtual void Init( K3DRenderDevice *pDevice, K3DIndexBuffer * pIndexBuf=NULL );
|
|
|
|
virtual void Process( DWORD dwTime );
|
|
virtual void Render( KViewportObject *viewport );
|
|
|
|
void SetLinePos( float fLinePos ) { m_fLinePos = fLinePos; }
|
|
void SetSize( float fSize ) { m_fSize = fSize; }
|
|
void CalsPos( float fRealIntensity, int nScreenX, int nScreenY, int nDistanceX, int nDistanceY );
|
|
|
|
protected:
|
|
float m_fLinePos;
|
|
float m_fSize;
|
|
KColor m_Color;
|
|
KSpritePrimitive m_prSprite;
|
|
// KWireUtilPrimitive m_prViewWire;
|
|
|
|
K3DVERTEX_LENS m_Vertex[SLensPrimitive::NUM_VERTEX];
|
|
};
|
|
|
|
|
|
class SGameLensFlare
|
|
{
|
|
public:
|
|
SGameLensFlare();
|
|
~SGameLensFlare();
|
|
|
|
void Init( K3DRenderDevice *pDevice );
|
|
|
|
void SetRenderFlag( BOOL bRenderFlag ) { m_bRenderFlag = bRenderFlag; }
|
|
|
|
void Process( DWORD dwTime );
|
|
void Render( KViewportObject *viewport );
|
|
|
|
void SetCamera( K3DCamera* pCamera );
|
|
void SetLight( const K3DLight* pLight );
|
|
void SetProjMatrix( const K3DMatrix* pProjMatrix )
|
|
{
|
|
m_pProjMatrix = pProjMatrix;
|
|
}
|
|
|
|
void SetExtent( int nWidth, int nHeight )
|
|
{
|
|
m_nScreenWidth = nWidth;
|
|
m_nScreenHeight = nHeight;
|
|
}
|
|
|
|
void SetPosition( K3DVector & pos, K3DVector & vSun )
|
|
{
|
|
m_Pos = pos;
|
|
m_vSunDir = vSun - m_Pos;
|
|
m_vSunDir.Normalize();
|
|
}
|
|
|
|
static void SetForceRenderFlag( bool bFlag )
|
|
{
|
|
s_bRenderFlag = bFlag;
|
|
}
|
|
|
|
static bool GetForceRenderFlag()
|
|
{
|
|
return s_bRenderFlag;
|
|
}
|
|
protected:
|
|
|
|
static bool s_bRenderFlag;
|
|
|
|
void CalsFlarePos();
|
|
|
|
float m_fIntensityBorder;
|
|
|
|
K3DVector m_Pos;
|
|
K3DVector m_vSunDir;
|
|
|
|
K3DCamera* m_pCamera;
|
|
const K3DLight* m_pLight;
|
|
const K3DMatrix* m_pProjMatrix;
|
|
|
|
K3DTextureSPtr m_spTextureArray[3];
|
|
|
|
int m_nScreenWidth;
|
|
int m_nScreenHeight;
|
|
|
|
|
|
K3DMaterial* m_pMat;
|
|
SGameFlare * m_pFlare[LENS_FLARE_NUM];
|
|
|
|
BOOL m_bRenderFlag;
|
|
};
|
|
|