Create a new Depth State instance.
Controls how the depth of the fragment is compared against the current depth contained in the depth buffer. See DepthState#func for details. Defaults to FUNC_LESSEQUAL.
If true, depth values are written to the depth buffer of the currently active render target. Defaults to true.
A unique number representing the depth state. You can use this number to quickly compare two depth states for equality. The key is always maintained valid without a dirty flag, to avoid condition check at runtime, considering these change rarely.
Static
Readonly
DEFAULTA default depth state that has the depth testing function set to FUNC_LESSEQUAL and depth writes enabled.
Static
Readonly
NODEPTHA depth state that always passes the fragment but does not write depth to the depth buffer.
Static
Readonly
WRITEDEPTHA depth state that always passes the fragment and writes depth to the depth buffer.
Gets the constant depth bias added to each fragment's depth.
Sets the constant depth bias added to each fragment's depth. Useful for decals to prevent z-fighting. Typically a small negative value (-0.1) is used to render the mesh slightly closer to the camera. Defaults to 0.
Gets the depth bias that scales with the fragment's slope.
Sets the depth bias that scales with the fragment's slope. Defaults to 0.
Gets the depth testing function.
Sets the depth testing function. Controls how the depth of the fragment is compared against the current depth contained in the depth buffer. Can be:
Gets whether depth testing is performed.
Sets whether depth testing is performed. If true, a shader fragment is only written to the current render target if it passes the depth test. If false, it is written regardless of what is in the depth buffer. Note that when depth testing is disabled, writes to the depth buffer are also disabled. Defaults to true.
Gets whether depth writing is performed.
Sets whether depth writing is performed. If true, shader write a depth value to the depth buffer of the currently active render target. If false, no depth value is written.
Returns an identical copy of the specified depth state.
The result of the cloning.
Copies the contents of a source depth state to this depth state.
A depth state to copy from.
Self for chaining.
Reports whether two DepthStates are equal.
The depth state to compare to.
True if the depth states are equal and false otherwise.
DepthState is a descriptor that defines how the depth value of the fragment is used by the rendering pipeline. A depth state can be set on a material using Material#depthState, or in some cases on the graphics device using GraphicsDevice#setDepthState.
For the best performance, do not modify depth state after it has been created, but create multiple depth states and assign them to the material or graphics device as needed.