Graphics Reference
In-Depth Information
ShaderBytecodePart.InputSignatureBlob),
new[]{
// input semantic SV_Position=vertex coord in object space
new InputElement("SV_Position",0,Format.R32G32B32A32_Float, 0, 0),
// input semantic COLOR = vertex color
new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 16, 0)
}));
8.
Now, we will create a new Buffer used to populate the WVP matrix constant buffer
defined within our HLSL code.
// Create the buffer that will store our WVP matrix
worldViewProjectionBuffer = ToDispose(new SharpDX.Direct3D11.
Buffer(device, Utilities.SizeOf<Matrix>(), ResourceUsage.
Default, BindFlags.ConstantBuffer, CpuAccessFlags.None,
ResourceOptionFlags.None, 0));
9.
Create the depth stencil state to control how the OM stage will handle depth:
// Configure the OM to discard pixels that are
// further than the current pixel in the depth buffer.
depthStencilState = ToDispose(new DepthStencilState(device,
new DepthStencilStateDescription()
{
IsDepthEnabled = true, // enable depth?
DepthComparison = Comparison.Less,
DepthWriteMask = SharpDX.Direct3D11.DepthWriteMask.All,
IsStencilEnabled = false,// enable stencil?
StencilReadMask = 0xff, // 0xff (no mask)
StencilWriteMask = 0xff,// 0xff (no mask)
// Configure FrontFace depth/stencil operations
FrontFace = new DepthStencilOperationDescription()
{
Comparison = Comparison.Always,
PassOperation = StencilOperation.Keep,
FailOperation = StencilOperation.Keep,
DepthFailOperation = StencilOperation.Increment
},
// Configure BackFace depth/stencil operations
BackFace = new DepthStencilOperationDescription()
{
Comparison = Comparison.Always,
PassOperation = StencilOperation.Keep,
FailOperation = StencilOperation.Keep,
DepthFailOperation = StencilOperation.Decrement
},
}));
 
Search WWH ::




Custom Search