API Reference

Class List

DepthState

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.

Summary

Static Properties

DEFAULT

A default depth state that has the depth testing function set to FUNC_LESSEQUAL and depth writes enabled.[read only]

NODEPTH

A depth state that always passes the fragment but does not write depth to the depth buffer.[read only]

WRITEDEPTH

A depth state that always passes the fragment and writes depth to the depth buffer.[read only]

Properties

func

Controls how the depth of the fragment is compared against the current depth contained in the depth buffer.

test

If true, a shader fragment is only written to the current render target if it passes the depth test.

write

If true, shader write a depth value to the depth buffer of the currently active render target.

Methods

clone

Returns an identical copy of the specified depth state.

copy

Copies the contents of a source depth state to this depth state.

equals

Reports whether two DepthStates are equal.

Details

Static Properties

DEFAULT

A default depth state that has the depth testing function set to FUNC_LESSEQUAL and depth writes enabled.

[read only]
NODEPTH

A depth state that always passes the fragment but does not write depth to the depth buffer.

[read only]
WRITEDEPTH

A depth state that always passes the fragment and writes depth to the depth buffer.

[read only]

Constructor

DepthState(func, write)

Create a new Depth State instance.

Parameters

funcnumber

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.

writeboolean

If true, depth values are written to the depth buffer of the currently active render target. Defaults to true.

Properties

numberfunc

Controls how the depth of the fragment is compared against the current depth contained in the depth buffer. Can be:

booleantest

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.

booleanwrite

If true, shader write a depth value to the depth buffer of the currently active render target. If false, no depth value is written.

Methods

clone()

Returns an identical copy of the specified depth state.

Returns

this

The result of the cloning.

copy(rhs)

Copies the contents of a source depth state to this depth state.

Parameters

rhsDepthState

A depth state to copy from.

Returns

DepthState

Self for chaining.

equals(rhs)

Reports whether two DepthStates are equal.

Parameters

rhsDepthState

The depth state to compare to.

Returns

boolean

True if the depth states are equal and false otherwise.