effectparticle.cpp
来自「国外网游源码....除工具源码缺少之外,其余程序都全...至于,什么游戏,因为国」· C++ 代码 · 共 63 行
CPP
63 行
// EffectParticle.cpp: implementation of the CEffectParticle class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "EffectParticle.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CEffectParticle::CEffectParticle()
{
m_pVBParticle = NULL;
}
CEffectParticle::~CEffectParticle()
{
Release();
}
HRESULT CEffectParticle::Create()
{
if(FAILED(g_pApp->GetD3dDevice()->CreateVertexBuffer( sizeof(POINTVERTEXEX),
D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY | D3DUSAGE_POINTS,
POINTVERTEXEX::FVF, D3DPOOL_DEFAULT, &m_pVBParticle, NULL))) {
return E_FAIL;
}
return S_OK;
}
HRESULT CEffectParticle::Release()
{
SAFE_RELEASE(m_pVBParticle);
return S_OK;
}
void CEffectParticle::Render()
{
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ONE );
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE );
// Set the render states for using point sprites
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_POINTSPRITEENABLE, TRUE );
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_POINTSCALEENABLE, TRUE );
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_POINTSIZE, FtoDW(100.0f) );
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_POINTSIZE_MIN, FtoDW(0.00f) );
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_POINTSIZE_MAX, FtoDW(1000.00f) );
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_POINTSCALE_A, FtoDW(0.00f) );
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_POINTSCALE_B, FtoDW(0.00f) );
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_POINTSCALE_C, FtoDW(1.00f) );
g_pApp->GetD3dDevice()->SetStreamSource( 0, m_pVBParticle, 0, sizeof(POINTVERTEXEX) );
g_pApp->GetD3dDevice()->SetFVF( POINTVERTEXEX::FVF );
g_pApp->GetD3dDevice()->DrawPrimitive( D3DPT_POINTLIST, 0, 1 );
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_POINTSPRITEENABLE, FALSE );
g_pApp->GetD3dDevice()->SetRenderState( D3DRS_POINTSCALEENABLE, FALSE );
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?