| 1 | // Copyright (C) 2015 Paul Lemire | 
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only | 
| 3 |  | 
| 4 | #include "qstencilmask.h" | 
| 5 | #include "qstencilmask_p.h" | 
| 6 |  | 
| 7 | QT_BEGIN_NAMESPACE | 
| 8 |  | 
| 9 | namespace Qt3DRender { | 
| 10 |  | 
| 11 | /*! | 
| 12 |     \class Qt3DRender::QStencilMask | 
| 13 |     \brief The QStencilMask class controls the front and back writing of | 
| 14 |     individual bits in the stencil planes. | 
| 15 |     \since 5.7 | 
| 16 |     \ingroup renderstates | 
| 17 |     \inmodule Qt3DRender | 
| 18 |  | 
| 19 |     A Qt3DRender::QStencilMask class specifies a write mask for the stencil values | 
| 20 |     after the stencil test. Mask can be specified separately for the front-facing | 
| 21 |     and back-facing polygons. The fragment stencil value is and'd with the mask | 
| 22 |     before it is written to the stencil buffer. | 
| 23 |  | 
| 24 |     \sa Qt3DRender::QStencilTest | 
| 25 |  */ | 
| 26 |  | 
| 27 | /*! | 
| 28 |     \qmltype StencilMask | 
| 29 |     \brief The StencilMask type controls the front and back writing of | 
| 30 |     individual bits in the stencil planes. | 
| 31 |     \since 5.7 | 
| 32 |     \ingroup renderstates | 
| 33 |     \inqmlmodule Qt3D.Render | 
| 34 |     \nativetype Qt3DRender::QStencilMask | 
| 35 |     \inherits RenderState | 
| 36 |  | 
| 37 |     A StencilMask type specifies the mask for the stencil test. Mask can be specified | 
| 38 |     separately for the front-facing and back-facing polygons. The stencil test reference | 
| 39 |     value and stencil buffer value gets and'd with the mask prior to applying stencil function. | 
| 40 |  | 
| 41 |     \sa StencilTest | 
| 42 |  */ | 
| 43 |  | 
| 44 | /*! | 
| 45 |     \qmlproperty int StencilMask::frontOutputMask | 
| 46 |     Holds the write mask for the fragment stencil values for front-facing polygons. | 
| 47 | */ | 
| 48 |  | 
| 49 | /*! | 
| 50 |     \qmlproperty int StencilMask::backOutputMask | 
| 51 |     Holds the write mask for the fragment stencil values for back-facing polygons. | 
| 52 | */ | 
| 53 |  | 
| 54 | /*! | 
| 55 |     \property Qt3DRender::QStencilMask::frontOutputMask | 
| 56 |     Holds the write mask for the fragment stencil values for front-facing polygons. | 
| 57 | */ | 
| 58 |  | 
| 59 | /*! | 
| 60 |     \property Qt3DRender::QStencilMask::backOutputMask | 
| 61 |     Holds the write mask for the fragment stencil values for back-facing polygons. | 
| 62 | */ | 
| 63 |  | 
| 64 | /*! | 
| 65 |     The constructor creates a new QStencilMask::QStencilMask instance with the | 
| 66 |     specified \a parent. | 
| 67 |  */ | 
| 68 | QStencilMask::QStencilMask(QNode *parent) | 
| 69 |     : QRenderState(*new QStencilMaskPrivate(), parent) | 
| 70 | { | 
| 71 | } | 
| 72 |  | 
| 73 | /*! \internal */ | 
| 74 | QStencilMask::~QStencilMask() | 
| 75 | { | 
| 76 | } | 
| 77 |  | 
| 78 | void QStencilMask::setFrontOutputMask(uint mask) | 
| 79 | { | 
| 80 |     Q_D(QStencilMask); | 
| 81 |     if (d->m_frontOutputMask != mask) { | 
| 82 |         d->m_frontOutputMask = mask; | 
| 83 |         Q_EMIT frontOutputMaskChanged(frontOutputMask: mask); | 
| 84 |     } | 
| 85 | } | 
| 86 |  | 
| 87 | void QStencilMask::setBackOutputMask(uint mask) | 
| 88 | { | 
| 89 |     Q_D(QStencilMask); | 
| 90 |     if (d->m_backOutputMask != mask) { | 
| 91 |         d->m_backOutputMask = mask; | 
| 92 |         Q_EMIT backOutputMaskChanged(backOutputMask: mask); | 
| 93 |     } | 
| 94 | } | 
| 95 |  | 
| 96 | uint QStencilMask::frontOutputMask() const | 
| 97 | { | 
| 98 |     Q_D(const QStencilMask); | 
| 99 |     return d->m_frontOutputMask; | 
| 100 | } | 
| 101 |  | 
| 102 | uint QStencilMask::backOutputMask() const | 
| 103 | { | 
| 104 |     Q_D(const QStencilMask); | 
| 105 |     return d->m_backOutputMask; | 
| 106 | } | 
| 107 |  | 
| 108 | } // namespace Qt3DRender | 
| 109 |  | 
| 110 | QT_END_NAMESPACE | 
| 111 |  | 
| 112 | #include "moc_qstencilmask.cpp" | 
| 113 |  |