本文整理汇总了C++中CFirstPersonCamera::GetNearClip方法的典型用法代码示例。如果您正苦于以下问题:C++ CFirstPersonCamera::GetNearClip方法的具体用法?C++ CFirstPersonCamera::GetNearClip怎么用?C++ CFirstPersonCamera::GetNearClip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFirstPersonCamera
的用法示例。
在下文中一共展示了CFirstPersonCamera::GetNearClip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//--------------------------------------------------------------------------------------
// Render the scene using the D3D11 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext, double fTime,
float fElapsedTime, void* pUserContext )
{
// If the settings dialog is being shown, then render it instead of rendering the app's scene
if( g_D3DSettingsDlg.IsActive() )
{
g_D3DSettingsDlg.OnRender( fElapsedTime );
return;
}
// WVP
XMMATRIX mProj = g_Camera.GetProjMatrix();
XMMATRIX mView = g_Camera.GetViewMatrix();
XMMATRIX mViewProjection = mView * mProj;
// Update per-frame variables
D3D11_MAPPED_SUBRESOURCE MappedResource;
pd3dImmediateContext->Map( g_pcbPerFrame, 0, D3D11_MAP_WRITE_DISCARD, 0, &MappedResource );
auto pData = reinterpret_cast<CB_PER_FRAME_CONSTANTS*>( MappedResource.pData );
XMStoreFloat4x4( &pData->mViewProjection, XMMatrixTranspose( mViewProjection ) );
XMStoreFloat3( &pData->vCameraPosWorld, g_Camera.GetEyePt() );
pData->CameraNear = g_Camera.GetNearClip();
pData->fTessellationFactor = (float)g_fSubdivs;
pData->NumControlPoints = ARRAYSIZE(g_MobiusStrip);
pd3dImmediateContext->Unmap( g_pcbPerFrame, 0 );
// Clear the render target and depth stencil
auto pRTV = DXUTGetD3D11RenderTargetView();
pd3dImmediateContext->ClearRenderTargetView( pRTV, Colors::Black );
auto pDSV = DXUTGetD3D11DepthStencilView();
pd3dImmediateContext->ClearDepthStencilView( pDSV, D3D11_CLEAR_DEPTH, 1.0, 0 );
// Set state for solid rendering
pd3dImmediateContext->RSSetState( g_pRasterizerStateSolid );
// Render the meshes
// Bind all of the CBs
pd3dImmediateContext->VSSetConstantBuffers( g_iBindPerFrame, 1, &g_pcbPerFrame );
pd3dImmediateContext->HSSetConstantBuffers( g_iBindPerFrame, 1, &g_pcbPerFrame );
pd3dImmediateContext->DSSetConstantBuffers( g_iBindPerFrame, 1, &g_pcbPerFrame );
pd3dImmediateContext->PSSetConstantBuffers( g_iBindPerFrame, 1, &g_pcbPerFrame );
// Set the shaders
pd3dImmediateContext->VSSetShader( g_pVertexShader, nullptr, 0 );
// For this sample, choose either the "integer", "fractional_even",
// or "fractional_odd" hull shader
if (g_iPartitionMode == PARTITION_INTEGER)
pd3dImmediateContext->HSSetShader( g_pHullShaderInteger, nullptr, 0 );
else if (g_iPartitionMode == PARTITION_FRACTIONAL_EVEN)
pd3dImmediateContext->HSSetShader( g_pHullShaderFracEven, nullptr, 0 );
else if (g_iPartitionMode == PARTITION_FRACTIONAL_ODD)
pd3dImmediateContext->HSSetShader( g_pHullShaderFracOdd, nullptr, 0 );
pd3dImmediateContext->DSSetShader( g_pDomainShader, nullptr, 0 );
pd3dImmediateContext->GSSetShader( nullptr, nullptr, 0 );
pd3dImmediateContext->PSSetShader( g_pPixelShader, nullptr, 0 );
// Optionally draw the wireframe
if( g_bDrawWires )
{
pd3dImmediateContext->PSSetShader( g_pSolidColorPS, nullptr, 0 );
pd3dImmediateContext->RSSetState( g_pRasterizerStateWireframe );
}
// Set the input assembler
// This sample uses patches with 16 control points each
// Although the Mobius strip only needs to use a vertex buffer,
// you can use an index buffer as well by calling IASetIndexBuffer().
pd3dImmediateContext->IASetInputLayout( NULL );
pd3dImmediateContext->VSSetShaderResources( 0, 1, &g_pControlPointSRV );
pd3dImmediateContext->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST );
// Draw the mesh
pd3dImmediateContext->Draw( (ARRAYSIZE(g_MobiusStrip) - 1)*4, 0 );
pd3dImmediateContext->RSSetState( g_pRasterizerStateSolid );
// Render the HUD
DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR, L"HUD / Stats" );
g_HUD.OnRender( fElapsedTime );
g_SampleUI.OnRender( fElapsedTime );
RenderText();
DXUT_EndPerfEvent();
}