本文整理汇总了C++中CFirstPersonCamera::GetViewMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ CFirstPersonCamera::GetViewMatrix方法的具体用法?C++ CFirstPersonCamera::GetViewMatrix怎么用?C++ CFirstPersonCamera::GetViewMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFirstPersonCamera
的用法示例。
在下文中一共展示了CFirstPersonCamera::GetViewMatrix方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderSprites
// Render the given sprites. They must already be sorted into back-to-front order.
void SpriteRenderer::renderSprites(ID3D11DeviceContext* context, const std::vector<SpriteVertex>& sprites, const CFirstPersonCamera& camera) {
HRESULT hr;
if (sprites.size() > 1) {
std::cout;
}
D3D11_BOX box;
box.left = 0; box.right = sprites.size() * sizeof(SpriteVertex);
box.top = 0; box.bottom = 1; box.front = 0; box.back = 1;
context->UpdateSubresource(m_pVertexBuffer, 0, &box, sprites.data(), 0, 0);
// Bind the vertex buffer to the input assembler stage
unsigned int strides[] = { sizeof(SpriteVertex), }, offsets[] = { 0, };
context->IASetVertexBuffers(0, 1, &m_pVertexBuffer, strides, offsets);
// Set the Input Layout
context->IASetInputLayout(m_pInputLayout);
context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
// Load variables to shader
SAFE_GET_MATRIX(m_pEffect, "g_ViewProjection", g_ViewProjection);
SAFE_GET_VECTOR(m_pEffect, "g_CamRVec", camRightVec);
SAFE_GET_VECTOR(m_pEffect, "g_CamUVec", camUpVec);
SAFE_GET_RESOURCE(m_pEffect, "g_SprTexGatling", sprTexGatling);
SAFE_GET_RESOURCE(m_pEffect, "g_SprTexPlasma", sprTexPlasma);
SAFE_GET_RESOURCE(m_pEffect, "g_SprTexBoom", sprTexBoom);
// Set view and projection transformations to get sprites to the right positions in world space
DirectX::XMMATRIX viewProj = camera.GetViewMatrix() * camera.GetProjMatrix();
V(g_ViewProjection->SetMatrix((float*)&viewProj));
// Set Textures
V(sprTexGatling->SetResource(m_spriteSRV[0]));
V(sprTexPlasma->SetResource(m_spriteSRV[1]));
V(sprTexBoom->SetResource(m_spriteSRV[2]));
// Get camera's right and up vector
V(camRightVec->SetFloatVector((float*)&camera.GetWorldRight()));
V(camUpVec->SetFloatVector((float*)&camera.GetWorldUp()));
// Apply the pass from the effect
V(m_pEffect->GetTechniqueByName("sRender")->GetPassByName("P0")->Apply(0, context));
// Draw
context->Draw(sprites.size(), 0);
}
示例2: V
//--------------------------------------------------------------------------------------
// Render the scene using the D3D11 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext, double fTime,
float fElapsedTime, void* pUserContext )
{
HRESULT hr;
// 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;
}
//Render light arrow
D3DXMATRIX mView;
D3DXMATRIX mProj;
mProj = ( *g_Camera.GetProjMatrix() );
mView = ( *g_Camera.GetViewMatrix() );
D3DXCOLOR arrowColor = D3DXCOLOR( 1, 1, 0, 1 );
//hr = g_LightControl.OnRender11( arrowColor, &mView, &mProj, g_Camera.GetEyePt() );
FirePart.calculate_particle(pd3dDevice,pd3dImmediateContext,fElapsedTime,&g_Camera,&g_LightControl);
MissilePart.calculate_particle(pd3dDevice,pd3dImmediateContext,fElapsedTime,&g_Camera,&g_LightControl);
board1.RenderTexture(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_LightControl);
deboard.RenderTexture(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_LightControl);
// Clear the render target and depth stencil
float ClearColor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
//ID3D11RenderTargetView* pRTV = DXUTGetD3D11RenderTargetView();
ID3D11RenderTargetView* pRTV = DXUTGetD3D11RenderTargetView();
pd3dImmediateContext->ClearRenderTargetView( rtv_render_to_texture_ori, ClearColor );
ID3D11DepthStencilView* pDSV = DXUTGetD3D11DepthStencilView();
pd3dImmediateContext->ClearDepthStencilView( pDSV, D3D11_CLEAR_DEPTH, 1.0, 0 );
pd3dImmediateContext->OMSetRenderTargets(1,&rtv_render_to_texture_ori,pDSV);
pd3dImmediateContext->OMSetDepthStencilState(NULL, 0);
sky.Render(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_Camera,lightpos);
lightsphere.Render(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_Camera,lightpos);
tessplane.Render(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_Camera,lightpos);
tesscube.Render(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_Camera,lightpos);
fuse.Render(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_Camera,&g_LightControl);
board1.Render(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_Camera,lightpos);
deboard.Render(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_Camera,lightpos);
test.Render(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_Camera,lightpos);
if(show_buildings)
{
buildings.Render(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_Camera,lightpos);
}
geo_alien.Render(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_Camera,lightpos);
FirePart.Render(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_Camera);
MissilePart.Render(pd3dDevice,pd3dImmediateContext,fTime,fElapsedTime,pUserContext,&g_Camera);
//ID3D11RenderTargetView* pRTV = DXUTGetD3D11RenderTargetView();
pd3dImmediateContext->OMSetDepthStencilState(NULL, 0);
pd3dImmediateContext->OMSetBlendState(NULL,NULL,0xffffffff);
//find bright spot
pd3dImmediateContext->ClearRenderTargetView( rtv_render_to_texture_1, ClearColor );
pDSV = DXUTGetD3D11DepthStencilView();
pd3dImmediateContext->ClearDepthStencilView( pDSV, D3D11_CLEAR_DEPTH, 1.0, 0 );
pd3dImmediateContext->OMSetRenderTargets(1,&rtv_render_to_texture_1,pDSV);
pd3dImmediateContext->VSSetShader( VSPPFirstPass, NULL, 0 );
pd3dImmediateContext->PSSetShader( PSPPFirstPass, NULL, 0 );
pd3dImmediateContext->HSSetShader( NULL, NULL, 0 );
pd3dImmediateContext->DSSetShader( NULL, NULL, 0 );
pd3dImmediateContext->GSSetShader( NULL, NULL, 0 );
pd3dImmediateContext->PSSetSamplers(0, 1, &g_pSamLinear);
pd3dImmediateContext->PSSetShaderResources(0,1,&sr_texture_original);
//pd3dImmediateContext->RSSetState( g_pRasterizerStateSolid );
pd3dImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
pd3dImmediateContext->Draw(9,0);
//blur hori
pd3dImmediateContext->ClearRenderTargetView( rtv_render_to_texture_2, ClearColor );
pDSV = DXUTGetD3D11DepthStencilView();
pd3dImmediateContext->ClearDepthStencilView( pDSV, D3D11_CLEAR_DEPTH, 1.0, 0 );
pd3dImmediateContext->OMSetRenderTargets(1,&rtv_render_to_texture_2,pDSV);
Compute_blur(1.0f / width, 0);
D3D11_MAPPED_SUBRESOURCE MappedResource;
V( pd3dImmediateContext->Map( blur_cb_buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &MappedResource ) );
blur_cbuffer* pPerFrame = ( blur_cbuffer* )MappedResource.pData;
std::copy(&blur_cb_data.offset[0], &blur_cb_data.offset[15], pPerFrame->offset);
//std::copy(&blur_cb_data.offset[0], &blur_cb_data.offset[15], pPerFrame->offset);
//std::copy(&blur_cb_data.weight[0], &blur_cb_data.weight[15], pPerFrame->weight);
pd3dImmediateContext->Unmap( blur_cb_buffer, 0 );
pd3dImmediateContext->VSSetShader( VSPPBlur, NULL, 0 );
//.........这里部分代码省略.........
示例3: V
//--------------------------------------------------------------------------------------
// Render the scene using the D3D9 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D9FrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
{
HRESULT hr;
D3DXMATRIXA16 mWorld;
D3DXMATRIXA16 mView;
D3DXMATRIXA16 mProj;
D3DXMATRIXA16 mWorldViewProjection;
// If the settings dialog is being shown, then render it instead of rendering the app's scene
if( g_SettingsDlg.IsActive() )
{
g_SettingsDlg.OnRender( fElapsedTime );
return;
}
// Clear the render target and the zbuffer
V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 0, 0, 0 ), 1.0f, 0 ) );
//V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_COLORVALUE( 0.0f, 0.0f, 0.0f, 1.0f ), 1.0f, 0 ) );
// Render the scene
if( SUCCEEDED( pd3dDevice->BeginScene() ) )
{
// Get the projection & view matrix from the camera class
//mWorld = *g_Camera.GetWorldMatrix();
mProj = *g_Camera.GetProjMatrix();
mView = *g_Camera.GetViewMatrix();
D3DXMatrixIdentity(&mWorld);
//mWorldViewProjection = mWorld * mView * mProj;
//*
pd3dDevice->SetTransform(D3DTS_WORLD, &mWorld);
pd3dDevice->SetTransform(D3DTS_VIEW, &mView);
pd3dDevice->SetTransform(D3DTS_PROJECTION, &mProj);
//*/
/*
pd3dDevice->SetTransform(D3DTS_PROJECTION, &g_pCamera->m_mProj);
pd3dDevice->SetTransform(D3DTS_VIEW, &g_pCamera->m_mView);
pd3dDevice->SetTransform(D3DTS_WORLD, &mWorld);
//*/
// Update the effect's variables. Instead of using strings, it would
// be more efficient to cache a handle to the parameter by calling
// ID3DXEffect::GetParameterByName
/*
V( g_pEffect9->SetMatrix( "g_mWorldViewProjection", &mWorldViewProjection ) );
V( g_pEffect9->SetMatrix( "g_mWorld", &mWorld ) );
V( g_pEffect9->SetFloat( "g_fTime", ( float )fTime ) );
*/
pd3dDevice->SetRenderState( D3DRS_AMBIENT, D3DCOLOR_COLORVALUE( 0.8f, 0.8f, 0.8f, 1.0f ));
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, false );
pd3dDevice->SetRenderState( D3DRS_COLORVERTEX, true );
DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR, L"Draw scene" );
particleSystem.render();
DXUT_EndPerfEvent();
DXUT_BeginPerfEvent( DXUT_PERFEVENTCOLOR, L"HUD / Stats" ); // These events are to help PIX identify what the code is doing
RenderText();
V( g_HUD.OnRender( fElapsedTime ) );
V( g_SampleUI.OnRender( fElapsedTime ) );
DXUT_EndPerfEvent();
V( pd3dDevice->EndScene() );
}
}
示例4: RenderAOFromMesh
//--------------------------------------------------------------------------------------
void RenderAOFromMesh(ID3D11Device* pd3dDevice,
ID3D11DeviceContext* pd3dImmediateContext,
ID3D11RenderTargetView* pBackBufferRTV,
SceneMesh *pMesh)
{
UINT SampleCount = g_MSAADesc[g_MSAACurrentSettings].SampleCount;
SceneViewInfo ViewInfo;
pd3dImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
pd3dImmediateContext->RSSetViewports(1, &g_FullViewport);
//--------------------------------------------------------------------------------------
// Clear render target and depth buffer
//--------------------------------------------------------------------------------------
float BgColor[4] = { 1.0f, 1.0f, 1.0f };
pd3dImmediateContext->ClearRenderTargetView(g_ColorRTV, BgColor);
pd3dImmediateContext->ClearDepthStencilView(g_DepthStencilDSV, D3D11_CLEAR_DEPTH, 1.0, 0);
//--------------------------------------------------------------------------------------
// Render color and depth with the Scene3D class
//--------------------------------------------------------------------------------------
pd3dImmediateContext->OMSetRenderTargets(1, &g_ColorRTV, g_DepthStencilDSV);
if (g_UseOrbitalCamera)
{
ViewInfo.WorldViewMatrix = (*g_OrbitalCamera.GetWorldMatrix()) * (*g_OrbitalCamera.GetViewMatrix());
ViewInfo.ProjectionMatrix = *g_OrbitalCamera.GetProjMatrix();
}
else
{
D3DXMATRIX WorldMatrix;
D3DXMatrixRotationX(&WorldMatrix, -D3DX_PI * 0.5f);
ViewInfo.WorldViewMatrix = WorldMatrix * (*g_FirstPersonCamera.GetViewMatrix());
ViewInfo.ProjectionMatrix = *g_FirstPersonCamera.GetProjMatrix();
}
g_pSceneRenderer.OnFrameRender(&ViewInfo, pMesh);
//--------------------------------------------------------------------------------------
// Render the SSAO
//--------------------------------------------------------------------------------------
GFSDK_SSAO_InputDepthData InputDepthData;
InputDepthData.pFullResDepthTextureSRV = g_DepthStencilSRV;
InputDepthData.pProjectionMatrix = (CONST FLOAT*)ViewInfo.ProjectionMatrix;
InputDepthData.ProjectionMatrixLayout = GFSDK_SSAO_ROW_MAJOR_ORDER;
InputDepthData.MetersToViewSpaceUnits = pMesh->GetSceneScale();
GFSDK_SSAO_Status status;
status = g_AORenderer.RenderAO(pd3dImmediateContext, &InputDepthData, &g_AOParams, g_ColorRTV);
assert(status == GFSDK_SSAO_OK);
//--------------------------------------------------------------------------------------
// Copy/resolve colors to the 1xAA backbuffer
//--------------------------------------------------------------------------------------
pd3dImmediateContext->OMSetRenderTargets(1, &pBackBufferRTV, NULL);
ID3D11Texture2D* pBackBufferTexture;
pBackBufferRTV->GetResource((ID3D11Resource**)&pBackBufferTexture);
if (SampleCount > 1)
{
pd3dImmediateContext->ResolveSubresource(pBackBufferTexture, 0, g_ColorTexture, 0, DXGI_FORMAT_R8G8B8A8_UNORM);
}
else
{
pd3dImmediateContext->CopyResource(pBackBufferTexture, g_ColorTexture);
}
SAFE_RELEASE(pBackBufferTexture);
}
示例5: if
//--------------------------------------------------------------------------------------
// render callback
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice,
ID3D11DeviceContext* pd3dImmediateContext,
double fTime,
float fElapsedTime, void* pUserContext )
{
static int s_iCounter = 0;
// 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;
}
if( g_pScenePS == NULL && s_iCounter == 0 )
{
s_iCounter = 4;
}
if( s_iCounter > 0 )
s_iCounter --;
if( s_iCounter == 1 && g_pScenePS == NULL )
{
HRESULT hr = S_OK;
// Create the shaders
ID3DBlob* pBlob = NULL;
// VS
hr = CompileShaderFromFile( L"ContactHardeningShadows11.hlsl", "VS_RenderScene", "vs_5_0", &pBlob );
hr = pd3dDevice->CreateVertexShader( pBlob->GetBufferPointer(), pBlob->GetBufferSize(), NULL, &g_pSceneVS );
DXUT_SetDebugName( g_pSceneVS, "VS_RenderScene" );
// Define our scene vertex data layout
const D3D11_INPUT_ELEMENT_DESC SceneLayout[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXTURE", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
hr = pd3dDevice->CreateInputLayout( SceneLayout, ARRAYSIZE( SceneLayout ), pBlob->GetBufferPointer(),
pBlob->GetBufferSize(), &g_pSceneVertexLayout );
SAFE_RELEASE( pBlob );
DXUT_SetDebugName( g_pSceneVertexLayout, "SceneLayout" );
hr = CompileShaderFromFile( L"ContactHardeningShadows11.hlsl", "VS_RenderSceneSM", "vs_5_0", &pBlob );
hr = pd3dDevice->CreateVertexShader( pBlob->GetBufferPointer(), pBlob->GetBufferSize(), NULL, &g_pSM_VS );
SAFE_RELEASE( pBlob );
DXUT_SetDebugName( g_pSM_VS, "VS_RenderSceneSM" );
// PS
hr = CompileShaderFromFile( L"ContactHardeningShadows11.hlsl", "PS_RenderScene", "ps_5_0", &pBlob );
hr = pd3dDevice->CreatePixelShader( pBlob->GetBufferPointer(), pBlob->GetBufferSize(), NULL, &g_pScenePS );
SAFE_RELEASE( pBlob );
DXUT_SetDebugName( g_pScenePS, "PS_RenderScene" );
s_iCounter = 0;
}
else if( g_pScenePS != NULL )
{
ID3D11RenderTargetView* pRTV[2] = { NULL,NULL };
ID3D11ShaderResourceView* pSRV[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
// Array of our samplers
ID3D11SamplerState* ppSamplerStates[3] = { g_pSamplePoint, g_pSampleLinear, g_pSamplePointCmp };
pd3dImmediateContext->PSSetSamplers( 0, 3, ppSamplerStates );
// Store off original render target, this is the back buffer of the swap chain
ID3D11RenderTargetView* pOrigRTV = DXUTGetD3D11RenderTargetView();
ID3D11DepthStencilView* pOrigDSV = DXUTGetD3D11DepthStencilView();
// Clear the render target
float ClearColor[4] = { 0.0f, 0.25f, 0.25f, 0.55f };
pd3dImmediateContext->ClearRenderTargetView( DXUTGetD3D11RenderTargetView(),
ClearColor );
pd3dImmediateContext->ClearDepthStencilView( DXUTGetD3D11DepthStencilView(),
D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL,
1.0, 0 );
// Get the projection & view matrix from the camera class
D3DXMATRIXA16 mWorld;
D3DXMATRIXA16 mView;
D3DXMATRIXA16 mProj;
D3DXMATRIXA16 mViewProjLight;
D3DXMATRIXA16 mWorldViewProjection;
D3DXVECTOR3 vLightDir;
// disable color writes
pd3dImmediateContext->OMSetBlendState(g_pBlendStateColorWritesOff, 0, 0xffffffff);
RenderShadowMap( pd3dDevice, pd3dImmediateContext, mViewProjLight, vLightDir );
// enable color writes
pd3dImmediateContext->OMSetBlendState(g_pBlendStateNoBlend, 0, 0xffffffff);
mView = *g_Camera.GetViewMatrix();
//.........这里部分代码省略.........
示例6: 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();
}