本文整理汇总了C++中Sky::CubeMapSRV方法的典型用法代码示例。如果您正苦于以下问题:C++ Sky::CubeMapSRV方法的具体用法?C++ Sky::CubeMapSRV怎么用?C++ Sky::CubeMapSRV使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sky
的用法示例。
在下文中一共展示了Sky::CubeMapSRV方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawScene
void DuckHuntMain::DrawScene()
{
//
// Render the scene to the shadow map.
//
mSmap->BindDsvAndSetNullRenderTarget(md3dImmediateContext);
md3dImmediateContext->RSSetState(0);
md3dImmediateContext->ClearDepthStencilView(mDepthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
md3dImmediateContext->RSSetViewports(1, &mScreenViewport);
mSsao->SetNormalDepthRenderTarget(mDepthStencilView);
//
// Restore the back and depth buffer and viewport to the OM stage.
//
ID3D11RenderTargetView* renderTargets[1] = { mRenderTargetView };
md3dImmediateContext->OMSetRenderTargets(1, renderTargets, mDepthStencilView);
md3dImmediateContext->ClearRenderTargetView(mRenderTargetView, reinterpret_cast<const float*>(&Colors::Silver));
XMMATRIX view = mCam.View();
XMMATRIX proj = mCam.Proj();
XMMATRIX viewProj = mCam.ViewProj();
float blendFactor[] = { 0.0f, 0.0f, 0.0f, 0.0f };
// Set per frame constants.
Effects::BasicFX->SetDirLights(mDirLights);
Effects::BasicFX->SetEyePosW(mCam.GetPosition());
Effects::BasicFX->SetCubeMap(mSky->CubeMapSRV());
Effects::BasicFX->SetShadowMap(mSmap->DepthMapSRV());
Effects::BasicFX->SetSsaoMap(mSsao->AmbientSRV());
ID3DX11EffectTechnique* tech = Effects::BasicFX->Light3TexTech;
md3dImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
XMMATRIX world;
XMMATRIX worldInvTranspose;
XMMATRIX worldViewProj;
// Transform NDC space [-1,+1]^2 to texture space [0,1]^2
XMMATRIX toTexSpace(
0.5f, 0.0f, 0.0f, 0.0f,
0.0f, -0.5f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.5f, 0.5f, 0.0f, 1.0f);
XMMATRIX shadowTransform = XMLoadFloat4x4(&mShadowTransform);
UINT stride = sizeof(Vertex::PosNormalTexTan);
UINT offset = 0;
md3dImmediateContext->IASetInputLayout(InputLayouts::Basic32);
if (GetAsyncKeyState('1') & 0x8000)
md3dImmediateContext->RSSetState(RenderStates::WireframeRS);
mTerrain.Draw(md3dImmediateContext, mCam, mDirLights);
//
// Draw opaque objects.
//
D3DX11_TECHNIQUE_DESC techDesc;
tech->GetDesc(&techDesc);
for (UINT p = 0; p < techDesc.Passes; ++p)
{
for (UINT modelIndex = 0; modelIndex < mModelInstances.size(); ++modelIndex)
{
world = XMLoadFloat4x4(&mModelInstances[modelIndex].World);
worldInvTranspose = MathHelper::InverseTranspose(world);
worldViewProj = world*view*proj;
Effects::BasicFX->SetWorld(world);
Effects::BasicFX->SetWorldInvTranspose(worldInvTranspose);
Effects::BasicFX->SetWorldViewProj(worldViewProj);
Effects::BasicFX->SetWorldViewProjTex(worldViewProj*toTexSpace);
Effects::BasicFX->SetShadowTransform(world*shadowTransform);
Effects::BasicFX->SetTexTransform(XMMatrixScaling(1.0f, 1.0f, 1.0f));
for (UINT subset = 0; subset < mModelInstances[modelIndex].Model->SubsetCount; ++subset)
{
Effects::BasicFX->SetMaterial(mModelInstances[modelIndex].Model->Mat[subset]);
Effects::BasicFX->SetDiffuseMap(mModelInstances[modelIndex].Model->DiffuseMapSRV[subset]);
//Effects::BasicFX->SetNormalMap(mModelInstances[modelIndex].Model->NormalMapSRV[subset]);
tech->GetPassByIndex(p)->Apply(0, md3dImmediateContext);
mModelInstances[modelIndex].Model->ModelMesh.Draw(md3dImmediateContext, subset);
}
}
}
// Turn off wireframe.
md3dImmediateContext->RSSetState(0);
// Restore from RenderStates::EqualsDSS
md3dImmediateContext->OMSetDepthStencilState(0, 0);
// Debug view SSAO map.
//DrawScreenQuad(mSsao->AmbientSRV());
//.........这里部分代码省略.........
示例2: DrawScene
void Game::DrawScene()
{
md3dImmediateContext->ClearRenderTargetView(mRenderTargetView, reinterpret_cast<const float*>(&Colors::Silver));
md3dImmediateContext->ClearDepthStencilView(mDepthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
md3dImmediateContext->IASetInputLayout(InputLayouts::Basic32);
md3dImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
mCam.UpdateViewMatrix();
// Set per frame constants.
Effects::GawkyFX->SetDirLights(mDirLights);
Effects::GawkyFX->SetCubeMap( mSky->CubeMapSRV() );
Effects::GawkyFX->SetPlayerPos(PlayerOne->getPlayerPosition());
//fxColorVar->SetFloatVector((float*)&mPlayerPosition);
// Figure out which technique to use. Skull does not have texture coordinates,
// so we need a separate technique for it, and not every surface is reflective,
// so don't pay for cubemap look up.
ID3DX11EffectTechnique* activeTexTech = Effects::GawkyFX->Light1TexTech;
ID3DX11EffectTechnique* activeReflectTech = Effects::GawkyFX->Light1TexReflectTech;
ID3DX11EffectTechnique* activeSkullTech = Effects::GawkyFX->Light1ReflectTech;
ID3DX11EffectTechnique* activeSkinnedTech = Effects::GawkyFX->Light1TexSkinnedTech;
switch (mLightCount)
{
case 1:
activeTexTech = Effects::GawkyFX->Light1TexTech;
activeReflectTech = Effects::GawkyFX->Light1TexReflectTech;
activeSkullTech = Effects::GawkyFX->Light1ReflectTech;
activeSkinnedTech = Effects::GawkyFX->Light1TexSkinnedTech;
break;
case 2:
activeTexTech = Effects::GawkyFX->Light2TexTech;
activeReflectTech = Effects::GawkyFX->Light2TexReflectTech;
activeSkullTech = Effects::GawkyFX->Light2ReflectTech;
activeSkinnedTech = Effects::GawkyFX->Light2TexSkinnedTech;
break;
case 3:
activeTexTech = Effects::GawkyFX->Light3TexTech;
activeReflectTech = Effects::GawkyFX->Light3TexReflectTech;
activeSkullTech = Effects::GawkyFX->Light3ReflectTech;
activeSkinnedTech = Effects::GawkyFX->Light3TexSkinnedTech;
break;
}
//draw the enemies
theEnemies->draw(md3dImmediateContext, mCam, activeTexTech);
//draw the objects
Objects->draw(md3dImmediateContext, mCam, activeTexTech);
//draw Level
Level1->draw(md3dImmediateContext, mCam, activeTexTech);
//draw player
md3dImmediateContext->IASetInputLayout( InputLayouts::PosNormalTexTanSkinned );
PlayerOne->drawPlayer( md3dImmediateContext, mCam, activeSkinnedTech );
////////////////////////////////////////
mSky->Draw(md3dImmediateContext, mCam);
// restore default states, as the SkyFX changes them in the effect file.
md3dImmediateContext->RSSetState(0);
md3dImmediateContext->OMSetDepthStencilState(0, 0);
HR(mSwapChain->Present(0, 0));
}