| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the Qt3D module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #include "qnopicking.h" |
| 41 | |
| 42 | |
| 43 | QT_BEGIN_NAMESPACE |
| 44 | |
| 45 | namespace Qt3DRender { |
| 46 | |
| 47 | /*! |
| 48 | \class Qt3DRender::QNoPicking |
| 49 | \inmodule Qt3DRender |
| 50 | \since 5.14 |
| 51 | |
| 52 | \brief When a Qt3DRender::QNoPicking node is present in a FrameGraph |
| 53 | branch, this prevents the render aspect from performing picking selection |
| 54 | for the given branch. |
| 55 | |
| 56 | When disabled, a Qt3DRender::QNoPicking node won't prevent picking from |
| 57 | being performed. Toggling the enabled property is therefore a way to make a |
| 58 | Qt3DRender::QNoPicking active or inactive. |
| 59 | |
| 60 | When using multiple subviewports in the FrameGraph, QNoPicking can be |
| 61 | useful to prevent picking conflicts between overlapping viewports or non |
| 62 | visual ones. It can also be used as an optimization to prevent unnecessary |
| 63 | work for hidden viewports or for sections of the scenes which don't require |
| 64 | any picking. |
| 65 | |
| 66 | \code |
| 67 | Qt3DRender::QViewport *viewport = new Qt3DRender::QViewport(); |
| 68 | Qt3DRender::QCameraSelector *cameraSelector = new Qt3DRender::QCameraSelector(viewport); |
| 69 | Qt3DRender::QNoPicking *noPicking = new Qt3DRender::QNoPicking(cameraSelector); |
| 70 | |
| 71 | Qt3DRender::QClearBuffers *clearBuffers = new Qt3DRender::QClearBuffers(noPicking); |
| 72 | clearBuffers->setBuffers(Qt3DRender::QClearBuffers::ColorDepthBuffer); |
| 73 | |
| 74 | Qt3DRender::QRenderPassFilter *mainPass = new Qt3DRender::QRenderPassFilter(cameraSelector); |
| 75 | .... |
| 76 | Qt3DRender::QRenderPassFilter *previewPass = new Qt3DRender::QRenderPassFilter(cameraSelector); |
| 77 | .... |
| 78 | \endcode |
| 79 | \sa Qt3DRender::QObjectPicker, Qt3DRender::QRayCaster, Qt3DRender::QScreenRayCaster |
| 80 | */ |
| 81 | |
| 82 | /*! |
| 83 | \qmltype NoPicking |
| 84 | \instantiates Qt3DRender::QNoPicking |
| 85 | \inherits FrameGraphNode |
| 86 | \inqmlmodule Qt3D.Render |
| 87 | \since 5.14 |
| 88 | |
| 89 | \brief When a NoPicking node is present in a FrameGraph branch, this |
| 90 | prevents the render aspect from performing picking selection for the given |
| 91 | branch. |
| 92 | |
| 93 | When disabled, a NoPicking node won't prevent picking from being performed. |
| 94 | Toggling the enabled property is therefore a way to make a NoPicking active |
| 95 | or inactive. |
| 96 | |
| 97 | When using multiple subviewports in the FrameGraph, NoPicking can be useful |
| 98 | to prevent picking conflicts between overlapping viewports or non visual |
| 99 | ones. It can also be used as an optimization to prevent unnecessary work for |
| 100 | hidden viewports or for sections of the scenes which don't require any |
| 101 | picking. |
| 102 | |
| 103 | |
| 104 | \code |
| 105 | |
| 106 | Viewport { |
| 107 | CameraSelector { |
| 108 | NoPicking { |
| 109 | ClearBuffers { |
| 110 | buffers: ClearBuffers.ColorDepthBuffer |
| 111 | NoDraw { } // Prevents from drawing anything |
| 112 | } |
| 113 | RenderPassFilter { |
| 114 | ... |
| 115 | } |
| 116 | RenderPassFilter { |
| 117 | ... |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | \endcode |
| 124 | \sa ObjectPicker, RayCaster, ScreenRayCaster |
| 125 | |
| 126 | */ |
| 127 | |
| 128 | QNoPicking::QNoPicking(Qt3DCore::QNode *parent) |
| 129 | : QFrameGraphNode(parent) |
| 130 | { |
| 131 | } |
| 132 | |
| 133 | QNoPicking::~QNoPicking() |
| 134 | { |
| 135 | } |
| 136 | |
| 137 | } // namespace Qt3DRender |
| 138 | |
| 139 | QT_END_NAMESPACE |
| 140 | |