Game Development Reference
In-Depth Information
RasterizerState
The final state parameter is the RasterizerState, this parameters specifies how the actual
drawing, producing the final images in pixels will behave.
No primitives will be culled, this means even back-facing primitives will be
rendered.
CullNone
CullClockwise
Any primitives with clockwise winding order will not be rendered.
CullCounterClockwise Any primitives with counter-clockwise winding order will not be rendered.
Wireframe
Primitives will be rendered in wireframe.
Custom Shaders
It's possible to override the default shaders used by a sprite batch by providing a function
that sets the new shaders to use on the device,
spriteBatch->Begin(SpriteSortMode_Deferred, nullptr, nullptr, nullptr, nullptr, [&]
{
deviceContext->PSSetShader(...);
deviceContext->PSSetConstantBuffers(...);
deviceContext->PSSetShaderResources(...);
});
Transform
The final parameter forBegin is a transform matrix that can be used to apply a global scale
ortranslation,ordependingonthewayspritebatchesaresetupcouldallowforhierarchical
transformations.
3.14.2 SpriteFont
Thisisaveryusefulclassthatwrapsthenecessary functionality torendertextusingdiffer-
entfonts.It'sbesttousethetoolMakeSpriteFontincludedaspartofDirectXTKtoconvert
any font into the format needed by SpriteFont, on XNA this is done automatically during
the building of a SpriteFont XML source, however, MakeSpriteFont is a console applica-
tion that needs to be run manually to generate the desired font's data.
Search WWH ::




Custom Search