本文整理汇总了C++中GeometryGenerator::CreateFullscreenQuad方法的典型用法代码示例。如果您正苦于以下问题:C++ GeometryGenerator::CreateFullscreenQuad方法的具体用法?C++ GeometryGenerator::CreateFullscreenQuad怎么用?C++ GeometryGenerator::CreateFullscreenQuad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeometryGenerator
的用法示例。
在下文中一共展示了GeometryGenerator::CreateFullscreenQuad方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildScreenQuadGeometryBuffers
void DuckHuntMain::BuildScreenQuadGeometryBuffers()
{
GeometryGenerator::MeshData quad;
GeometryGenerator geoGen;
geoGen.CreateFullscreenQuad(quad);
//
// Extract the vertex elements we are interested in and pack the
// vertices of all the meshes into one vertex buffer.
//
std::vector<Vertex::Basic32> vertices(quad.Vertices.size());
for (UINT i = 0; i < quad.Vertices.size(); ++i)
{
vertices[i].Pos = quad.Vertices[i].Position;
vertices[i].Normal = quad.Vertices[i].Normal;
vertices[i].Tex = quad.Vertices[i].TexC;
}
D3D11_BUFFER_DESC vbd;
vbd.Usage = D3D11_USAGE_IMMUTABLE;
vbd.ByteWidth = sizeof(Vertex::Basic32) * quad.Vertices.size();
vbd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vbd.CPUAccessFlags = 0;
vbd.MiscFlags = 0;
D3D11_SUBRESOURCE_DATA vinitData;
vinitData.pSysMem = &vertices[0];
HR(md3dDevice->CreateBuffer(&vbd, &vinitData, &mScreenQuadVB));
//
// Pack the indices of all the meshes into one index buffer.
//
D3D11_BUFFER_DESC ibd;
ibd.Usage = D3D11_USAGE_IMMUTABLE;
ibd.ByteWidth = sizeof(UINT) * quad.Indices.size();
ibd.BindFlags = D3D11_BIND_INDEX_BUFFER;
ibd.CPUAccessFlags = 0;
ibd.MiscFlags = 0;
D3D11_SUBRESOURCE_DATA iinitData;
iinitData.pSysMem = &quad.Indices[0];
HR(md3dDevice->CreateBuffer(&ibd, &iinitData, &mScreenQuadIB));
}
示例2: vertices
void D3DPBRApp::CreateLUT()
{
D3D11_TEXTURE2D_DESC texDesc;
texDesc.Width = 512;
texDesc.Height = 512;
texDesc.MipLevels = 0;
texDesc.ArraySize = 1;
texDesc.SampleDesc.Count = 1;
texDesc.SampleDesc.Quality = 0;
texDesc.Format = DXGI_FORMAT_R16G16_FLOAT;
texDesc.Usage = D3D11_USAGE_DEFAULT;
texDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
texDesc.CPUAccessFlags = 0;
texDesc.MiscFlags = 0;
ID3D11Texture2D* LUTTex = 0;
HR(md3dDevice->CreateTexture2D(&texDesc, 0, &LUTTex));
//
// Create a render target view to each cube map face
// (i.e., each element in the texture array).
//
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
rtvDesc.Format = texDesc.Format;
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
rtvDesc.Texture2D.MipSlice = 0;
HR(md3dDevice->CreateRenderTargetView(LUTTex, &rtvDesc, &mLUTRTV));
//
// Create a shader resource view to the cube map.
//
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
srvDesc.Format = texDesc.Format;
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
srvDesc.Texture2D.MipLevels = -1;
srvDesc.Texture2D.MostDetailedMip = 0;
HR(md3dDevice->CreateShaderResourceView(LUTTex, &srvDesc, &mLUTSRV));
D3D11_TEXTURE2D_DESC depthTexDesc;
depthTexDesc.Width = 512;
depthTexDesc.Height = 512;
depthTexDesc.MipLevels = 1;
depthTexDesc.ArraySize = 1;
depthTexDesc.SampleDesc.Count = 1;
depthTexDesc.SampleDesc.Quality = 0;
depthTexDesc.Format = DXGI_FORMAT_D32_FLOAT;
depthTexDesc.Usage = D3D11_USAGE_DEFAULT;
depthTexDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
depthTexDesc.CPUAccessFlags = 0;
depthTexDesc.MiscFlags = 0;
ID3D11Texture2D* depthTex = 0;
HR(md3dDevice->CreateTexture2D(&depthTexDesc, 0, &depthTex));
D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
dsvDesc.Format = depthTexDesc.Format;
dsvDesc.Flags = 0;
dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
dsvDesc.Texture2D.MipSlice = 0;
HR(md3dDevice->CreateDepthStencilView(depthTex, &dsvDesc, &mLUTDSV));
ReleaseCOM(depthTex);
//
// Viewport for drawing into cubemap.
//
mLUTViewport.TopLeftX = 0.0f;
mLUTViewport.TopLeftY = 0.0f;
mLUTViewport.Width = (float)512;
mLUTViewport.Height = (float)512;
mLUTViewport.MinDepth = 0.0f;
mLUTViewport.MaxDepth = 1.0f;
GeometryGenerator::MeshData quad;
GeometryGenerator geoGen;
geoGen.CreateFullscreenQuad(quad);
mQuadIndexNum = quad.Indices.size();
std::vector<Vertex::Basic32> vertices(quad.Vertices.size());
for (int i = 0; i < vertices.size(); i++)
{
vertices[i].Normal = quad.Vertices[i].Normal;
vertices[i].Pos = quad.Vertices[i].Position;
vertices[i].Tangent = quad.Vertices[i].TangentU;
vertices[i].Tex = quad.Vertices[i].TexC;
//.........这里部分代码省略.........