Windows 8 and Windows Phone 8 Game Development by Adam Dawes

Windows 8 and Windows Phone 8 Game Development by Adam Dawes

Author:Adam Dawes [Dawes, Adam]
Language: eng
Format: epub, pdf
Tags: C#, Computers, Programming, Microsoft, Programming Languages
ISBN: 9781430258360
Publisher: Apress
Published: 2013-06-24T04:00:00+00:00


There is another mode that can be set for the depth buffer: read-only mode. In this mode, MonoGame will observe the values in the depth buffer when rendering objects and will use it to prevent objects from being drawn if they are behind existing objects. However, the depth buffer will not be updated in response to rendered objects.

This mode might seem like an unlikely feature to need, but it has various uses. One such use is for drawing particles in a 3-D scene. We’ll discuss particles in more detail in the next chapter, but they can be used for creating effects such as sparks, fire, and smoke. Although it is important that these correctly appear behind objects in the scene, we need to ensure that they don’t obscure one another or else they won’t display correctly.

MonoGame can be set to use a read-only depth buffer by setting the GraphicsDevice.DepthStencilState property to DepthStencilState.DepthRead. Don’t forget to set it back to DepthStencilState.Default once you are finished with this mode.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.