| 1 | // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
| 2 | // Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies). |
| 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 4 | |
| 5 | /*! |
| 6 | * \class Qt3DRender::QBlendEquation |
| 7 | * \inheaderfile Qt3DRender/QBlendEquation |
| 8 | * \brief The QBlendEquation class specifies the equation used for both the RGB |
| 9 | * blend equation and the Alpha blend equation. |
| 10 | * \inmodule Qt3DRender |
| 11 | * \since 5.7 |
| 12 | * \ingroup renderstates |
| 13 | * |
| 14 | * The blend equation is used to determine how a new pixel is combined with a pixel |
| 15 | * already in the framebuffer. |
| 16 | */ |
| 17 | |
| 18 | /*! |
| 19 | \qmltype BlendEquation |
| 20 | \nativetype Qt3DRender::QBlendEquation |
| 21 | \inherits RenderState |
| 22 | \inqmlmodule Qt3D.Render |
| 23 | \since 5.5 |
| 24 | \brief The BlendEquation class specifies the equation used for both the RGB |
| 25 | blend equation and the Alpha blend equation. |
| 26 | |
| 27 | The blend equation is used to determine how a new pixel is combined with a pixel |
| 28 | already in the framebuffer. |
| 29 | */ |
| 30 | |
| 31 | #include "qblendequation.h" |
| 32 | #include "qblendequation_p.h" |
| 33 | |
| 34 | QT_BEGIN_NAMESPACE |
| 35 | |
| 36 | namespace Qt3DRender { |
| 37 | |
| 38 | /*! |
| 39 | * The constructor creates a new blend state object with the specified \a parent. |
| 40 | */ |
| 41 | QBlendEquation::QBlendEquation(QNode *parent) |
| 42 | : QRenderState(*new QBlendEquationPrivate, parent) |
| 43 | { |
| 44 | } |
| 45 | |
| 46 | /*! \internal */ |
| 47 | QBlendEquation::~QBlendEquation() |
| 48 | { |
| 49 | } |
| 50 | |
| 51 | /*! |
| 52 | \enum Qt3DRender::QBlendEquation::BlendFunction |
| 53 | |
| 54 | \value Add GL_FUNC_ADD |
| 55 | \value Subtract GL_FUNC_SUBTRACT |
| 56 | \value ReverseSubtract GL_FUNC_REVERSE_SUBTRACT |
| 57 | \value Min GL_MIN |
| 58 | \value Max GL_MAX |
| 59 | */ |
| 60 | |
| 61 | /*! |
| 62 | \qmlproperty enumeration BlendEquation::blendFunction |
| 63 | |
| 64 | Holds the blend function, which determines how source and destination colors are combined. |
| 65 | */ |
| 66 | |
| 67 | /*! |
| 68 | \property Qt3DRender::QBlendEquation::blendFunction |
| 69 | |
| 70 | Holds the blend function, which determines how source and destination colors are combined. |
| 71 | */ |
| 72 | |
| 73 | QBlendEquation::BlendFunction QBlendEquation::blendFunction() const |
| 74 | { |
| 75 | Q_D(const QBlendEquation); |
| 76 | return d->m_blendFunction; |
| 77 | } |
| 78 | |
| 79 | void QBlendEquation::setBlendFunction(QBlendEquation::BlendFunction blendFunction) |
| 80 | { |
| 81 | Q_D(QBlendEquation); |
| 82 | if (d->m_blendFunction != blendFunction) { |
| 83 | d->m_blendFunction = blendFunction; |
| 84 | emit blendFunctionChanged(blendFunction); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | } // namespace Qt3DRender |
| 89 | |
| 90 | QT_END_NAMESPACE |
| 91 | |
| 92 | #include "moc_qblendequation.cpp" |
| 93 | |