144 lines
3.1 KiB
C++
144 lines
3.1 KiB
C++
|
|
|
|
#pragma once
|
|
|
|
#include "KRenderDevice.h"
|
|
#include "SEnvPrimitive.h"
|
|
|
|
class SGameEnv
|
|
{
|
|
public:
|
|
SGameEnv()
|
|
{
|
|
m_fVis = 1.f;
|
|
|
|
m_nWidth = 100;
|
|
m_nHeight = 100;
|
|
|
|
m_pMat = NULL;
|
|
|
|
m_pParentMat = NULL; ///< SkyBox 위치
|
|
K3DMatrixIdentity( m_LocalMat ); ///< 구름 위치
|
|
|
|
m_pPrimitive = NULL; ///< Render Object
|
|
}
|
|
|
|
virtual ~SGameEnv()
|
|
{
|
|
SAFE_DELETE( m_pPrimitive );
|
|
}
|
|
|
|
virtual void Init( K3DRenderDevice *pDevice, K3DIndexBuffer * pIndexBuf=NULL ) = 0;
|
|
virtual void Process( DWORD dwTime ) = 0;
|
|
virtual void Render( KViewportObject *viewport ) = 0;
|
|
|
|
inline void SetIndexBuffer( K3DIndexBuffer * pIB )
|
|
{
|
|
m_spIB = pIB;
|
|
if(m_pPrimitive) m_pPrimitive->SetIndexBuffer(m_spIB);
|
|
}
|
|
inline void SetVisibility( float fVis ) { m_fVis = fVis; }
|
|
|
|
inline void SetMaterial( K3DMaterial* pMat )
|
|
{
|
|
m_pMat = pMat;
|
|
if(m_pPrimitive) m_pPrimitive->SetMaterial(m_pMat);
|
|
}
|
|
|
|
inline void SetTexture( K3DTexture* pTex )
|
|
{
|
|
m_spTexture = pTex;
|
|
if( m_pPrimitive ) m_pPrimitive->SetTexture( 0, m_spTexture );
|
|
}
|
|
|
|
// { [sonador]
|
|
inline void SetAlphaTexture( K3DTexture* pTex )
|
|
{
|
|
m_spAlphaTexture = pTex;
|
|
if( m_pPrimitive ) m_pPrimitive->SetAlphaTexture( 0, m_spAlphaTexture );
|
|
}
|
|
// }
|
|
|
|
inline void SetParentMat( K3DMatrix * pParentMat )
|
|
{
|
|
m_pParentMat = pParentMat;
|
|
}
|
|
|
|
protected:
|
|
// K3DVertexBufferSPtr m_spVB; //기본 사각형
|
|
K3DVertexBuffer* m_pVB;
|
|
K3DIndexBufferSPtr m_spIB; ///< Index Buf
|
|
|
|
K3DTextureSPtr m_spTexture; ///< Tex
|
|
K3DTextureSPtr m_spAlphaTexture; ///< [sonador] alpha texture for multi texture
|
|
|
|
//Visibility
|
|
float m_fVis;
|
|
|
|
//크기
|
|
int m_nWidth;
|
|
int m_nHeight;
|
|
|
|
K3DMaterial* m_pMat;
|
|
|
|
K3DMatrix * m_pParentMat; ///< SkyBox 위치
|
|
K3DMatrix m_LocalMat; ///< 구름 위치
|
|
K3DMatrix m_WorldMat; ///< 구름 위치
|
|
|
|
SEnvPrimitive * m_pPrimitive; ///< Render Object
|
|
};
|
|
|
|
|
|
#ifdef CLOUD_LUA
|
|
class SGameEnvCloud
|
|
{
|
|
public:
|
|
SGameEnvCloud()
|
|
{
|
|
// m_fVis = 1.f;
|
|
|
|
// m_nWidth = 100;
|
|
// m_nHeight = 100;
|
|
|
|
// m_pMat = NULL;
|
|
|
|
m_pParentMat = NULL; ///< SkyBox 위치
|
|
K3DMatrixIdentity( m_LocalMat ); ///< 구름 위치
|
|
|
|
m_pPrimitive = new SCloudLumpPrimitive; ///< Render Object
|
|
}
|
|
|
|
virtual ~SGameEnvCloud()
|
|
{
|
|
SAFE_DELETE( m_pPrimitive );
|
|
}
|
|
|
|
virtual void Init( K3DRenderDevice *pDevice, K3DIndexBuffer * pIndexBuf=NULL ) = 0;
|
|
virtual void Process( DWORD dwTime ) = 0;
|
|
virtual void Render( KViewportObject *viewport ) = 0;
|
|
|
|
void SetIndexBuffer( int nColorType, K3DIndexBuffer * pIB )
|
|
{
|
|
if(m_pPrimitive) m_pPrimitive->SetIndexBuffer(nColorType, pIB);
|
|
}
|
|
void SetVertexBuffer( int nColorType, K3DVertexBuffer * pVB )
|
|
{
|
|
if(m_pPrimitive) m_pPrimitive->SetVertexBuffer(nColorType, pVB);
|
|
}
|
|
void SetTexture( int nColorType, K3DTexture* pTex )
|
|
{
|
|
if( m_pPrimitive ) m_pPrimitive->SetTexture( nColorType, pTex );
|
|
}
|
|
void SetParentMat( K3DMatrix * pParentMat )
|
|
{
|
|
m_pParentMat = pParentMat;
|
|
}
|
|
|
|
protected:
|
|
K3DMatrix * m_pParentMat; ///< SkyBox 위치
|
|
K3DMatrix m_LocalMat; ///< 구름 위치
|
|
K3DMatrix m_WorldMat; ///< 구름 위치
|
|
|
|
SCloudLumpPrimitive* m_pPrimitive; ///< Render Object
|
|
};
|
|
#endif |