本文整理汇总了C++中Sky::cubeMapSRV方法的典型用法代码示例。如果您正苦于以下问题:C++ Sky::cubeMapSRV方法的具体用法?C++ Sky::cubeMapSRV怎么用?C++ Sky::cubeMapSRV使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sky
的用法示例。
在下文中一共展示了Sky::cubeMapSRV方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawScene
void Projekt::DrawScene()
{
//---------------------------------------------------------------------------
// Render scene to shadow map
//---------------------------------------------------------------------------
mShadowMap->BindDsvAndSetNullRenderTarget(mDirect3D->GetImmediateContext());
mShadowMap->DrawSceneToShadowMap(mGenericInstances, *mGame->GetCamera(), mDirect3D->GetImmediateContext());
mDirect3D->GetImmediateContext()->RSSetState(0);
// Restore back and depth buffer and viewport to the OM stage
ID3D11RenderTargetView* renderTargets[1] = {mDirect3D->GetRenderTargetView()};
mDirect3D->GetImmediateContext()->OMSetRenderTargets(1, renderTargets, mDirect3D->GetDepthStencilView());
mDirect3D->GetImmediateContext()->ClearRenderTargetView(mDirect3D->GetRenderTargetView(), reinterpret_cast<const float*>(&Colors::LightSteelBlue));
mDirect3D->GetImmediateContext()->ClearDepthStencilView(mDirect3D->GetDepthStencilView(), D3D11_CLEAR_DEPTH|D3D11_CLEAR_STENCIL, 1.0f, 0);
mDirect3D->GetImmediateContext()->RSSetViewports(1, &mDirect3D->GetScreenViewport());
//---------------------------------------------------------------------------
// Possible Wireframe render state
// if (mDirectInput->GetKeyboardState()[DIK_E] && 0x80)
// mDirect3D->GetImmediateContext()->RSSetState(RenderStates::WireFrameRS);
//--------------------------------------------------------------
// Set shader constants
//--------------------------------------------------------------
Effects::BasicFX->SetDirLights(mDirLights);
Effects::BasicFX->SetEyePosW(mGame->GetCamera()->GetPosition());
Effects::BasicFX->SetShadowMap(mShadowMap->getDepthMapSRV());
Effects::BasicFX->SetCubeMap(mSky->cubeMapSRV());
Effects::NormalMapFX->SetDirLights(mDirLights);
Effects::NormalMapFX->SetEyePosW(mGame->GetCamera()->GetPosition());
Effects::NormalMapFX->SetShadowMap(mShadowMap->getDepthMapSRV());
Effects::NormalMapFX->SetCubeMap(mSky->cubeMapSRV());
// Draw sky
mSky->draw(mDirect3D->GetImmediateContext(), *mGame->GetCamera(), Gui->InMenu());
// Draw game
mGame->Draw(mDirect3D->GetImmediateContext(), mShadowMap);
this->soundModule->updateAndPlay(mGame->GetCamera(), mGame->GetCamera()->GetPosition());
// Draw the GUI
Gui->Render(mDirect3D->GetImmediateContext(), mGame->GetPlayer()->GetPosition());
// Unbind shadow map and AmbientMap as a shader input because we are going to render
// to it next frame. These textures can be at any slot, so clear all slots.
ID3D11ShaderResourceView* nullSRV[16] = { 0 };
mDirect3D->GetImmediateContext()->PSSetShaderResources(0, 16, nullSRV);
// Restore default states
float blendFactor[] = {0.0f, 0.0f, 0.0f, 0.0f};
mDirect3D->GetImmediateContext()->RSSetState(0);
mDirect3D->GetImmediateContext()->OMSetDepthStencilState(0, 0);
mDirect3D->GetImmediateContext()->OMSetBlendState(0, blendFactor, 0xffffffff);
HR(mDirect3D->GetSwapChain()->Present(0, 0));
}
示例2: DrawScene
void Projekt::DrawScene()
{
//---------------------------------------------------------------------------
// Render scene to shadow map
//---------------------------------------------------------------------------
mShadowMap->BindDsvAndSetNullRenderTarget(mDirect3D->GetImmediateContext());
drawSceneToShadowMap();
mDirect3D->GetImmediateContext()->RSSetState(0);
// Restore back and depth buffer and viewport to the OM stage
ID3D11RenderTargetView* renderTargets[1] = {mDirect3D->GetRenderTargetView()};
mDirect3D->GetImmediateContext()->OMSetRenderTargets(1, renderTargets, mDirect3D->GetDepthStencilView());
mDirect3D->GetImmediateContext()->ClearRenderTargetView(mDirect3D->GetRenderTargetView(), reinterpret_cast<const float*>(&Colors::LightSteelBlue));
mDirect3D->GetImmediateContext()->ClearDepthStencilView(mDirect3D->GetDepthStencilView(), D3D11_CLEAR_DEPTH|D3D11_CLEAR_STENCIL, 1.0f, 0);
mDirect3D->GetImmediateContext()->RSSetViewports(1, &mDirect3D->GetScreenViewport());
// Possible Wireframe render state
if (GetAsyncKeyState('E') & 0x8000)
mDirect3D->GetImmediateContext()->RSSetState(WireFrameRS);
XMMATRIX shadowTransform = XMLoadFloat4x4(&mShadowTransform);
//---------------------------------------------------------------------------
// Draw terrain
//---------------------------------------------------------------------------
//mTerrain.Draw(mDirect3D->GetImmediateContext(), mCam, mDirLights);
mTerrain.DrawShadowed(mDirect3D->GetImmediateContext(), *mPlayer.GetCamera(), mDirLights,
mShadowMap->getDepthMapSRV(), &shadowTransform);
// --------------------------------------------------------------------------
// Camera matrices
XMMATRIX view = mPlayer.GetCamera()->getViewMatrix();
XMMATRIX proj = mPlayer.GetCamera()->getProjMatrix();
XMMATRIX viewproj = mPlayer.GetCamera()->getViewProjMatrix();
float blendFactor[] = {0.0f, 0.0f, 0.0f, 0.0f};
// Set per frame constants
Effects::BasicFX->SetDirLights(mDirLights);
Effects::BasicFX->SetEyePosW(mPlayer.GetCamera()->getPosition());
Effects::BasicFX->setShadowMap(mShadowMap->getDepthMapSRV());
Effects::BasicFX->SetCubeMap(mSky->cubeMapSRV());
Effects::NormalMapFX->SetDirLights(mDirLights);
Effects::NormalMapFX->SetEyePosW(mPlayer.GetCamera()->getPosition());
Effects::NormalMapFX->setShadowMap(mShadowMap->getDepthMapSRV());
Effects::NormalMapFX->SetCubeMap(mSky->cubeMapSRV());
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);
// Vertex size & offset
UINT stride = sizeof(Vertex::Basic32);
UINT offset = 0;
// Draw player
//mPlayer.Draw(mDirect3D->GetImmediateContext(), mDirLights,
//mShadowMap->getDepthMapSRV(), &shadowTransform);
//---------------------------------------------------------------------------
// Draw opaque objects
//---------------------------------------------------------------------------
// Bind information about primitive type, and set input layout
mDirect3D->GetImmediateContext()->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
mDirect3D->GetImmediateContext()->IASetInputLayout(InputLayouts::Basic32);
// Set our effect technique to use
ID3DX11EffectTechnique* activeTech = Effects::BasicFX->DirLights3FogTexTech;
ID3DX11EffectTechnique* activeSkinnedTech = Effects::NormalMapFX->DirLights3TexTech;
D3DX11_TECHNIQUE_DESC techDesc;
//--------------------------------------------------------------------------------
// Draw opaque tessellated objects
//--------------------------------------------------------------------------------
Effects::BasicTessFX->SetDirLights(mDirLights);
Effects::BasicTessFX->SetEyePosW(mPlayer.GetCamera()->getPosition());
Effects::BasicTessFX->setShadowMap(mShadowMap->getDepthMapSRV());
Effects::BasicTessFX->SetCubeMap(mSky->cubeMapSRV());
mDirect3D->GetImmediateContext()->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST);
mDirect3D->GetImmediateContext()->IASetInputLayout(InputLayouts::PosNormalTexTan);
activeTech = Effects::BasicTessFX->TessDirLights3FogTexTech;
activeTech->GetDesc(&techDesc);
for (UINT p = 0; p < techDesc.Passes; ++p)
{
for (UINT mIndex = 0; mIndex < mGenericInstances.size(); ++mIndex)
//.........这里部分代码省略.........