本文整理汇总了C++中CDXUTSDKMesh::ComputeInFrustumFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ CDXUTSDKMesh::ComputeInFrustumFlags方法的具体用法?C++ CDXUTSDKMesh::ComputeInFrustumFlags怎么用?C++ CDXUTSDKMesh::ComputeInFrustumFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDXUTSDKMesh
的用法示例。
在下文中一共展示了CDXUTSDKMesh::ComputeInFrustumFlags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void App::Render(ID3D11DeviceContext* d3dDeviceContext,
ID3D11RenderTargetView* backBuffer,
CDXUTSDKMesh& mesh_opaque,
CDXUTSDKMesh& mesh_alpha,
ID3D11ShaderResourceView* skybox,
const D3DXMATRIXA16& worldMatrix,
const CFirstPersonCamera* viewerCamera,
const D3D11_VIEWPORT* viewport,
const UIConstants* ui)
{
D3DXMATRIXA16 cameraProj = *viewerCamera->GetProjMatrix();
D3DXMATRIXA16 cameraView = *viewerCamera->GetViewMatrix();
D3DXMATRIXA16 cameraViewInv;
D3DXMatrixInverse(&cameraViewInv, 0, &cameraView);
// Compute composite matrices
D3DXMATRIXA16 cameraViewProj = cameraView * cameraProj;
D3DXMATRIXA16 cameraWorldViewProj = worldMatrix * cameraViewProj;
// Fill in frame constants
{
D3D11_MAPPED_SUBRESOURCE mappedResource;
d3dDeviceContext->Map(mPerFrameConstants, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
PerFrameConstants* constants = static_cast<PerFrameConstants *>(mappedResource.pData);
constants->mCameraWorldViewProj = cameraWorldViewProj;
constants->mCameraWorldView = worldMatrix * cameraView;
constants->mCameraViewProj = cameraViewProj;
constants->mCameraProj = cameraProj;
// NOTE: Complementary Z => swap near/far back
constants->mCameraNearFar = D3DXVECTOR4(viewerCamera->GetFarClip(), viewerCamera->GetNearClip(), 0.0f, 0.0f);
constants->mFramebufferDimensionsX = mGBufferWidth;
constants->mFramebufferDimensionsY = mGBufferHeight;
constants->mFramebufferDimensionsZ = 0; // Unused
constants->mFramebufferDimensionsW = 0; // Unused
constants->mUI = *ui;
d3dDeviceContext->Unmap(mPerFrameConstants, 0);
}
// Geometry phase
if (mesh_opaque.IsLoaded()) {
mesh_opaque.ComputeInFrustumFlags(cameraWorldViewProj);
}
if (mesh_alpha.IsLoaded()) {
mesh_alpha.ComputeInFrustumFlags(cameraWorldViewProj);
}
// Setup lights
ID3D11ShaderResourceView *lightBufferSRV = SetupLights(d3dDeviceContext, cameraView);
// Forward rendering takes a different path here
if (ui->lightCullTechnique == CULL_FORWARD_NONE) {
RenderForward(d3dDeviceContext, mesh_opaque, mesh_alpha, lightBufferSRV, viewerCamera, viewport, ui, false);
} else if (ui->lightCullTechnique == CULL_FORWARD_PREZ_NONE) {
RenderForward(d3dDeviceContext, mesh_opaque, mesh_alpha, lightBufferSRV, viewerCamera, viewport, ui, true);
} else {
RenderGBuffer(d3dDeviceContext, mesh_opaque, mesh_alpha, viewerCamera, viewport, ui);
ComputeLighting(d3dDeviceContext, lightBufferSRV, viewport, ui);
}
// Render skybox and tonemap
RenderSkyboxAndToneMap(d3dDeviceContext, backBuffer, skybox,
mDepthBuffer->GetShaderResource(), viewport, ui);
}