本文整理汇总了C++中CommandContext::SetDepthStencilState方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandContext::SetDepthStencilState方法的具体用法?C++ CommandContext::SetDepthStencilState怎么用?C++ CommandContext::SetDepthStencilState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandContext
的用法示例。
在下文中一共展示了CommandContext::SetDepthStencilState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void Render()
{
CommandQueue* queue = RenderCore::GetCommandQueue(CommandListType::Graphics);
CommandContext* ctx = RenderCore::AllocateContext(CommandListType::Graphics);
float clearColor[] = { 0.0f, 0.0f, 0.0f, 0.0f };
ctx->ClearRenderTarget(myRenderOutput->GetBackbufferRtv(), clearColor);
ctx->ClearDepthStencilTarget(myRenderOutput->GetDepthStencilDsv(), 1.0f, 0u);
ctx->SetViewport(glm::uvec4(0, 0, myWindow->GetWidth(), myWindow->GetHeight()));
ctx->SetClipRect(glm::uvec4(0, 0, myWindow->GetWidth(), myWindow->GetHeight()));
ctx->SetRenderTarget(myRenderOutput->GetBackbufferRtv(), myRenderOutput->GetDepthStencilDsv());
ctx->SetDepthStencilState(nullptr);
ctx->SetBlendState(nullptr);
ctx->SetCullMode(CullMode::NONE);
ctx->SetFillMode(FillMode::SOLID);
ctx->SetWindingOrder(WindingOrder::CCW);
ctx->SetGpuProgramPipeline(myDebugGeoShader);
struct Cbuffer_DebugGeo
{
glm::float4x4 myWorldViewProj;
glm::float4 myColor;
};
Cbuffer_DebugGeo cbuffer_debugGeo
{
myCamera.myViewProj,
glm::float4(1.0f, 0.0f, 0.0f, 1.0f),
};
ctx->BindConstantBuffer(&cbuffer_debugGeo, sizeof(cbuffer_debugGeo), 0u);
for (SharedPtr<GeometryData>& geometry : myGridMesh->myGeometryDatas)
ctx->RenderGeometry(geometry.get());
ctx->SetGpuProgramPipeline(myUnlitTexturedShader);
for (int i = 0; i < myScene.myModels.size(); ++i)
{
Model* model = myScene.myModels[i].get();
struct Cbuffer_PerObject
{
glm::float4x4 myWorldViewProj;
};
Cbuffer_PerObject cbuffer_perObject
{
myCamera.myViewProj * myScene.myTransforms[i],
};
ctx->BindConstantBuffer(&cbuffer_perObject, sizeof(cbuffer_perObject), 0u);
struct GridGeoVertex
{
glm::float3 myPos;
glm::u8vec4 myColor;
};
GridGeoVertex vertices[4] = {
{ { 0.0f, 0.0f, -1.0f }, {0,0,255,255} },
{ { 0.0f, 0.0f, 1.0f }, {0.0f, 0.0f, 1.0f, 1.0f} },
{ { -1.0f, 0.0f, 0.0f }, {1.0f, 0.0f, 0.0f, 1.0f } },
{ { 1.0f, 0.0f, 0.0f },{1.0f, 0.0f, 0.0f, 1.0f } }
};
ctx->BindVertexBuffer(vertices, sizeof(vertices), sizeof(vertices[0]));
uint indices[] = {
0, 1, 2, 3
};
ctx->BindIndexBuffer(indices, sizeof(indices), sizeof(indices[0]));
/*
Material* mat = model->myMaterial.get();
BindResources_UnlitTextured(ctx, mat);
Mesh* mesh = model->myMesh.get();
for (SharedPtr<GeometryData>& geometry : mesh->myGeometryDatas)
ctx->RenderGeometry(geometry.get());
*/
}
queue->ExecuteContext(ctx);
RenderCore::FreeContext(ctx);
myRuntime->EndFrame();
}