212 lines
6.0 KiB
C++
212 lines
6.0 KiB
C++
#pragma once
|
|
|
|
#include <mmo/ArType.h>
|
|
#include "K3DTypes.h"
|
|
#include "KViewport.h"
|
|
#include "SGameEnv.h"
|
|
//#include "SGameMessageUI.h" /// 2010.10.13 - prodongi
|
|
|
|
class K3DRenderDevice;
|
|
|
|
const short c_SelectTargetSegment = 7;
|
|
const short c_SelectTargetSegmentIndexedCount = (c_SelectTargetSegment-1)*(c_SelectTargetSegment-1)*2;
|
|
|
|
struct HeightPropInfo
|
|
{
|
|
K3DVertexBufferDX* m_pVb;
|
|
K3DIndexBufferDX* m_pIb;
|
|
K3DMatrix m_matProp;
|
|
K3DMatrix m_matPropTexture;
|
|
|
|
HeightPropInfo() : m_pVb( NULL )
|
|
, m_pIb( NULL )
|
|
{
|
|
K3DMatrixIdentity( m_matProp );
|
|
}
|
|
};
|
|
|
|
class SSelectTargetPrimitive : public K3DPrimitive
|
|
{
|
|
private:
|
|
K3DTexture* m_pTexture;
|
|
K3DBLENDEDBUMPVERTEX* m_pVertex;
|
|
K3DINDEXED_WATER* m_pIndexed;
|
|
|
|
K3DMatrix m_matTerrainTexture;
|
|
|
|
std::vector< HeightPropInfo > m_vHeightPropInfo;
|
|
|
|
unsigned short m_nVbSize;
|
|
unsigned short m_nVbCount;
|
|
/// 2010.10.12 - prodongi
|
|
int m_vertexCount;
|
|
int m_indexCount;
|
|
public:
|
|
void SetVertexBuffer( K3DBLENDEDBUMPVERTEX* pVertexBuffer )
|
|
{
|
|
m_pVertex = pVertexBuffer;
|
|
}
|
|
void SetIndexBuffer( K3DINDEXED_WATER* pIndexBuffer )
|
|
{
|
|
m_pIndexed = pIndexBuffer;
|
|
}
|
|
void SetTexture( K3DTexture* pTexture )
|
|
{
|
|
m_pTexture = pTexture;
|
|
}
|
|
|
|
K3DBLENDEDBUMPVERTEX* GetVertexBuffer()
|
|
{
|
|
return m_pVertex;
|
|
}
|
|
|
|
void SetTerrainTextureMatrix( K3DMatrix & matTex )
|
|
{
|
|
m_matTerrainTexture = matTex;
|
|
}
|
|
|
|
void SetHeightPropInfo( HeightPropInfo & propinfo )
|
|
{
|
|
m_vHeightPropInfo.push_back( propinfo );
|
|
}
|
|
void ClearHeightPropInfo()
|
|
{
|
|
m_vHeightPropInfo.clear();
|
|
}
|
|
/// 2010.10.12 - prodongi
|
|
void setIndexCount(int count) { m_indexCount = count; }
|
|
void setVertexCount(int count) { m_vertexCount = count; }
|
|
|
|
public:
|
|
void Render( KViewportObject *viewport, class K3DRenderDevice *dev, bool bUseAccum = true )
|
|
{
|
|
static float fVisibility = 1.f;
|
|
dev->SetVertexShaderConstant( CONSTANT_VISIBILITY, &fVisibility, 1 );
|
|
|
|
// dev->SetVertexShaderMatrix( CONSTANT_SELECT_TARGET_MATRIX, &m_matTerrainTexture );
|
|
|
|
// int nOldCull = dev->GetCullMode();
|
|
// dev->SetCullMode( K3DRenderDevice::KCM_NONE );
|
|
|
|
dev->SetTexture( 0, m_pTexture );
|
|
/// 2010.10.12 - prodongi
|
|
//dev->DrawIndexedPrimitiveUP_VS( 0, m_pVertex, (c_SelectTargetSegment*c_SelectTargetSegment), sizeof(K3DBLENDEDBUMPVERTEX), (WORD*)m_pIndexed, c_SelectTargetSegmentIndexedCount*3 );
|
|
dev->DrawIndexedPrimitiveUP_VS( 0, m_pVertex, m_vertexCount, sizeof(K3DBLENDEDBUMPVERTEX), (WORD*)m_pIndexed, m_indexCount );
|
|
|
|
/* if( !m_vHeightPropInfo.empty() )
|
|
{
|
|
const K3DCamera* pCamera = viewport->GetBackUpViewCamera();
|
|
|
|
K3DVector vCam, vTrans;
|
|
vCam = pCamera->GetCamPos();
|
|
|
|
std::vector< HeightPropInfo >::iterator propinfo = m_vHeightPropInfo.begin();
|
|
for( ; propinfo != m_vHeightPropInfo.end(); ++propinfo )
|
|
{
|
|
dev->SetVertexShaderMatrix( CONSTANT_SELECT_TARGET_MATRIX, &(*propinfo).m_matPropTexture );
|
|
|
|
K3DMatrixGetPosVector( vTrans, (*propinfo).m_matProp );
|
|
|
|
vTrans -= vCam;
|
|
|
|
K3DMatrix matWorld = (*propinfo).m_matProp;
|
|
|
|
matWorld._41 = vTrans.x;
|
|
matWorld._42 = vTrans.y;
|
|
matWorld._43 = vTrans.z+0.1f;
|
|
|
|
dev->SetTransform( K3DRenderDevice::TS_WORLD, &matWorld );
|
|
dev->DrawIndexedTriangleVB_VS( (*propinfo).m_pVb, (*propinfo).m_pIb );
|
|
}
|
|
}
|
|
|
|
dev->SetCullMode( nOldCull );*/
|
|
}
|
|
public:
|
|
SSelectTargetPrimitive() : m_pVertex( NULL )
|
|
, m_pIndexed( NULL ),
|
|
m_indexCount(0), /// 2010.10.12 - prodongi
|
|
m_vertexCount(0) /// 2010.10.12 - prodongi
|
|
|
|
{}
|
|
~SSelectTargetPrimitive()
|
|
{
|
|
m_pTexture = NULL;
|
|
SAFE_DELETE_ARRAY( m_pVertex );
|
|
SAFE_DELETE_ARRAY( m_pIndexed );
|
|
}
|
|
};
|
|
|
|
class SGameSelectTargetFx
|
|
{
|
|
private:
|
|
class SGame* m_pGame;
|
|
SSelectTargetPrimitive* m_pSelectTargetPrimitive;
|
|
K3DTextureSPtr m_spTexture;
|
|
|
|
K3DVector m_vPos;
|
|
float m_fHeight;
|
|
float m_fSelectTargetRot;
|
|
DWORD m_dwTime;
|
|
DWORD m_dwCheckTime;
|
|
|
|
AR_HANDLE m_arHandle;
|
|
|
|
bool m_bRender;
|
|
|
|
float m_fRadius;
|
|
|
|
class CTerrainProp* m_pTerrainProp;
|
|
public:
|
|
void Init( K3DRenderDeviceDX *pDevice, K3DIndexBuffer * pIndexBuf=NULL ) {}
|
|
void Initialize( SGame* pGame, const char* pTextureName );
|
|
void Process( DWORD dwTime );
|
|
void Render( KViewportObject *viewport );
|
|
void SetRotation( DWORD dwTime );
|
|
void SetHeight( float fHeight );
|
|
void SetArHandle( AR_HANDLE handle );
|
|
void SetRadius( float fRadius ) { m_fRadius = fRadius; }
|
|
void SetArLocalHandle( AR_HANDLE handle ) {m_arHandle = handle;}
|
|
|
|
AR_HANDLE GetArHandle() { return m_arHandle; }
|
|
K3DVector GetCenterPosition() { return K3DVector( m_vPos.x, m_vPos.y, m_vPos.z+m_fHeight); }
|
|
void setMsg(SIMSG_UI_ACT_USESKILL const& msg);
|
|
public:
|
|
SGameSelectTargetFx();
|
|
virtual ~SGameSelectTargetFx();
|
|
};
|
|
|
|
//// 2010.10.12 범위 선택 할 때 쓰임, SGameSelectTargetFx과는 약간 틀려서 새로 만듬 - prodongi
|
|
class cGameRegionSelectTargetFx
|
|
{
|
|
public:
|
|
cGameRegionSelectTargetFx();
|
|
~cGameRegionSelectTargetFx();
|
|
|
|
void Initialize( SGame* pGame, const char* pTextureName );
|
|
void Process( K3DVector const& pos, K3DVector const* playerPos );
|
|
void Render( KViewportObject *viewport );
|
|
void SetHeight( float fHeight ) { m_fHeight = fHeight; }
|
|
void SetRadius( float fRadius ) { m_fRadius = fRadius; }
|
|
void SetIsRender(bool render) { m_bRender = render; }
|
|
bool IsRender() const { return m_bRender; }
|
|
K3DVector GetCenterPosition() { return K3DVector( m_vPos.x, m_vPos.y, m_vPos.z+m_fHeight); }
|
|
void setMsg(SIMSG_UI_ACT_USESKILL const& msg);/// 2010.10.13 - prodongi
|
|
void sendMsg(class SGameManager* gameMng); /// 2010.10.13 - prodongi
|
|
|
|
private:
|
|
void procCheckRange(K3DVector const* playerPos); /// 2010.10.13 시전 가능 거리 체크 - prodongi
|
|
|
|
private:
|
|
class SGame* m_pGame;
|
|
SSelectTargetPrimitive* m_pSelectTargetPrimitive;
|
|
K3DTextureSPtr m_spTexture;
|
|
K3DVector m_vPos;
|
|
float m_fHeight;
|
|
bool m_bRender;
|
|
float m_fRadius;
|
|
class CTerrainProp* m_pTerrainProp;
|
|
SIMSG_UI_ACT_USESKILL m_msg;
|
|
AR_UNIT m_rangeSqr; /// 2010.10.13 시전 가능 거리 - prodongi
|
|
};
|