QDepthTest Class | Qt 3D 5.13.0

Qt 5.13 | Qt 3D | C++ Classes | QDepthTest

Qt 5.13.0 Reference Documentation

# QDepthTest Class

(Qt3DRender::QDepthTest)

The QDepthTest class tests the fragment shader's depth value against the depth of a sample being written to. More...

Header: | #include <QDepthTest>
qmake: | QT += 3drender
Since: | Qt 5.7
Instantiated By: | DepthTest
Inherits: | Qt3DRender::QRenderState

This class was introduced in Qt 5.7.

- List of all members, including inherited members
- Obsolete members

## Public Types

enum | DepthFunction { Never, Always, Less, LessOrEqual, ..., NotEqual }

## Properties

- depthFunction : DepthFunction

- 3 properties inherited from Qt3DCore::QNode
- 1 property inherited from QObject

## Public Functions

| QDepthTest(Qt3DCore::QNode *parent = nullptr)
Qt3DRender::QDepthTest::DepthFunction | depthFunction() const

- 13 public functions inherited from Qt3DCore::QNode
- 30 public functions inherited from QObject

## Public Slots

void | setDepthFunction(Qt3DRender::QDepthTest::DepthFunction depthFunction)

- 3 public slots inherited from Qt3DCore::QNode
- 1 public slot inherited from QObject

## Signals

void | depthFunctionChanged(Qt3DRender::QDepthTest::DepthFunction depthFunction)

- 4 signals inherited from Qt3DCore::QNode
- 2 signals inherited from QObject

## Related Non-Members

typedef | QNodePtr
typedef | QNodeVector
typedef | QObjectList
QList<T> | qFindChildren(const QObject *obj, const QRegExp &regExp)
Qt3DCore::QNodeId | qIdForNode(Qt3DCore::QNode *node)
Qt3DCore::QNodeIdVector | qIdsForNodes(const T &nodes)
T | qobject_cast(QObject *object)
T | qobject_cast(const QObject *object)

## Macros

| QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
| Q_CLASSINFO(Name, Value)
| Q_DISABLE_COPY(Class)
| Q_DISABLE_COPY_MOVE(Class)
| Q_DISABLE_MOVE(Class)
| Q_EMIT
| Q_ENUM(...)
| Q_ENUM_NS(...)
| Q_FLAG(...)
| Q_FLAG_NS(...)
| Q_GADGET
| Q_INTERFACES(...)
| Q_INVOKABLE
| Q_NAMESPACE
| Q_OBJECT
| Q_PROPERTY(...)
| Q_REVISION
| Q_SET_OBJECT_NAME(Object)
| Q_SIGNAL
| Q_SIGNALS
| Q_SLOT
| Q_SLOTS

### Additional Inherited Members

- 9 static public members inherited from QObject
- 2 protected functions inherited from Qt3DCore::QNode
- 9 protected functions inherited from QObject

## Detailed Description

A QDepthTest class is used to enable depth testing with a given depth test function. The depth test enables writing fragment color values when the depth test passes, and reject fragments which fail the test. The depth test uses the depth function to test the fragments depth value to the value against z-buffer. If the underlying surface does not have z-buffer, then QDepthTest does nothing.

See also QAlphaTest and QStencilTest.

## Member Type Documentation

### enum QDepthTest::DepthFunction

Enumeration for the depth function values

Constant | Value | Description
--- | --- | ---
`Qt3DRender::QDepthTest::Never` | `0x0200` | Never pass depth test
`Qt3DRender::QDepthTest::Always` | `0x0207` | Always pass depth test
`Qt3DRender::QDepthTest::Less` | `0x0201` | Pass depth test if fragment depth is less than z-buffer value
`Qt3DRender::QDepthTest::LessOrEqual` | `0x0203` | Pass depth test if fragment depth is less than or equal to z-buffer value
`Qt3DRender::QDepthTest::Equal` | `0x0202` | Pass depth test if fragment depth is equal to z-buffer value
`Qt3DRender::QDepthTest::GreaterOrEqual` | `0x0206` | Pass depth test if fragment depth is greater than or equal to z-buffer value
`Qt3DRender::QDepthTest::Greater` | `0x0204` | Pass depth test if fragment depth is greater than z-buffer value
`Qt3DRender::QDepthTest::NotEqual` | `0x0205` | Pass depth test if fragment depth is not equal to z-buffer value

## Property Documentation

### depthFunction : DepthFunction

Holds the current function used by depth test. The default is Never.

Access functions:

Qt3DRender::QDepthTest::DepthFunction | depthFunction() const
void | setDepthFunction(Qt3DRender::QDepthTest::DepthFunction depthFunction)

Notifier signal:

void | depthFunctionChanged(Qt3DRender::QDepthTest::DepthFunction depthFunction)

## Member Function Documentation

### QDepthTest::QDepthTest(Qt3DCore::QNode *parent = nullptr)

The constructor creates a new QDepthTest::QDepthTest instance with the specified parent.