⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 effectparticle.cpp

📁 国外网游源码....除工具源码缺少之外,其余程序都全...至于,什么游戏,因为国内还没有,所以找不到测试
💻 CPP
字号:
// 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -