本文整理汇总了C++中ParticleEffect::GetTech方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleEffect::GetTech方法的具体用法?C++ ParticleEffect::GetTech怎么用?C++ ParticleEffect::GetTech使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleEffect
的用法示例。
在下文中一共展示了ParticleEffect::GetTech方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawParticles
void InClassProj::DrawParticles()
{
XMVECTOR eyePos = m2DCam->GetPos();
XMMATRIX proj = XMLoadFloat4x4(&mProj);
XMMATRIX view = m2DCam->GetView();
XMMATRIX vp = view * proj;
mParticleEffect->SetPerFrameParams(eyePos);
mParticleEffect->SetPerObjectParams(vp, mParticleTexture);
md3dImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
md3dImmediateContext->IASetInputLayout(Vertex::GetParticleVertLayout());
UINT stride = sizeof(Vertex::ParticleVertex);
UINT offset = 0;
md3dImmediateContext->IASetVertexBuffers(0, 1, &mParticleVB, &stride, &offset);
md3dImmediateContext->OMSetDepthStencilState(mNoDepthDS, 0);
float blendFactor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
md3dImmediateContext->OMSetBlendState(mAdditiveBS, blendFactor, 0xffffffff);
D3DX11_TECHNIQUE_DESC techDesc;
mParticleEffect->GetTech()->GetDesc(&techDesc);
for (UINT p = 0; p < techDesc.Passes; ++p)
{
mParticleEffect->GetTech()->GetPassByIndex(p)->Apply(0, md3dImmediateContext);
md3dImmediateContext->Draw(mParticles.size(), 0);
}
md3dImmediateContext->OMSetBlendState(0, blendFactor, 0xffffffff);
md3dImmediateContext->OMSetDepthStencilState(NULL, 0);
}
示例2: Init
bool InClassProj::Init()
{
if(!D3DApp::Init())
return false;
//FMOD sounds
result = FMOD::System_Create(&sys);
result = sys->getVersion(&version);
if (version < FMOD_VERSION)
{
OutputDebugString(L"FMOD lib version doesn't match header version");
}
result = sys->init(32, FMOD_INIT_NORMAL, extradriverdata);
result = sys->createSound("Sounds/choo.ogg", FMOD_DEFAULT, 0, &sound1); //fire arrow sfx (placeholder?)
result = sound1->setMode(FMOD_LOOP_OFF);
mLitTexEffect = new LitTexEffect();
mLitTexEffect->LoadEffect(L"FX/lighting.fx", md3dDevice);
mParticleEffect = new ParticleEffect();
mParticleEffect->LoadEffect(L"FX/ParticleEffect.fx", md3dDevice);
Vertex::InitLitTexLayout(md3dDevice, mLitTexEffect->GetTech());
//camera
m2DCam = new BaseCamera(XMVectorSet(0.0f, 0.0f, -0.5f, 0.0f), XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f), XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f));
m2DCam->Update();
BuildSceneLights();
Vertex::InitParticleVertLayout(md3dDevice, mParticleEffect->GetTech());
BuildParticleVB();
D3DX11CreateShaderResourceViewFromFile(md3dDevice, L"Textures/TestAdditive.png", 0, 0, &mParticleTexture, 0);
BuildBlendStates();
BuildDSStates();
//font
ID3D11ShaderResourceView* font;
D3DX11CreateShaderResourceViewFromFile(md3dDevice, L"Textures/font.png", 0, 0, &font, 0);
mFont = new FontRasterizer(m2DCam, XMLoadFloat4x4(&m2DProj), mLitTexEffect, 10, 10, font, md3dDevice);
//projectile image
ID3D11ShaderResourceView* projImage;
D3DX11CreateShaderResourceViewFromFile(md3dDevice, L"Textures/arrow.png", 0, 0, &projImage, 0);
//projectile frame
projectileFrame->imageWidth = 22;
projectileFrame->imageHeight = 9;
projectileFrame->x = 0;
projectileFrame->y = 0;
projectileFrame->image = projImage;
projFrame.push_back(projectileFrame);
//bg image
Sprite::Frame* BGFrame = new Sprite::Frame();
ID3D11ShaderResourceView* BGimage;
D3DX11CreateShaderResourceViewFromFile(md3dDevice, L"Textures/TFAbgTiled.png", 0, 0, &BGimage, 0);
//bg frame
BGFrame->imageWidth = 1024;
BGFrame->imageHeight = 768;
BGFrame->x = 0;
BGFrame->y = 0;
BGFrame->image = BGimage;
std::vector<Sprite::Frame*> bgFrame;
bgFrame.push_back(BGFrame);
//Player spritesheet image
Sprite::Frame* newFrame = new Sprite::Frame();
ID3D11ShaderResourceView* image;
D3DX11CreateShaderResourceViewFromFile(md3dDevice, L"Textures/player.png", 0, 0, &image, 0);
//player frame1
newFrame->imageWidth = 96;
newFrame->imageHeight = 96;
newFrame->x = 0;
newFrame->y = 0;
newFrame->image = image;
std::vector<Sprite::Frame*> frames;
frames.push_back(newFrame);
//player frame2
newFrame = new Sprite::Frame();
newFrame->imageWidth = 96;
newFrame->imageHeight = 96;
newFrame->x = 32;
newFrame->y = 0;
newFrame->image = image;
frames.push_back(newFrame);
//player frame3
newFrame = new Sprite::Frame();
newFrame->imageWidth = 96;
newFrame->imageHeight = 96;
newFrame->x = 64;
newFrame->y = 0;
newFrame->image = image;
frames.push_back(newFrame);
//Enemy1 spritesheet image
Sprite::Frame* enemyFrame1 = new Sprite::Frame();
ID3D11ShaderResourceView* enemyImage1;
//.........这里部分代码省略.........