1 | // Copyright (C) 2023 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #include "qquick3drenderextensions.h" |
5 | |
6 | #include <QtQuick3D/private/qquick3dobject_p.h> |
7 | |
8 | QT_BEGIN_NAMESPACE |
9 | |
10 | /*! |
11 | \class QQuick3DRenderExtension |
12 | \inmodule QtQuick3D |
13 | \since 6.7 |
14 | |
15 | \brief Abstract class for implementing user side render extensions. |
16 | |
17 | This is the front-end side of a render extension. The back-end side is implemented |
18 | in \l QSSGRenderExtension. The QQuick3DRenderExtension class is used to create a custom |
19 | render extension that can be used in the QtQuick3D scene graph by adding it to the list of |
20 | extensions to be used with a \l View3D. The extension code will then be run as part of |
21 | QtQuick3D's rendering pipeline execution. |
22 | |
23 | The QQuick3DRenderExtension class is an abstract class that should be subclassed and |
24 | exposed to QML. The subclass should implement the \l QQuick3DRenderExtension::updateSpatialNode() |
25 | function and return a QSSGRenderExtension instance that contains the code that should be run. |
26 | |
27 | \sa QSSGRenderExtension |
28 | */ |
29 | |
30 | /*! |
31 | \qmltype RenderExtension |
32 | \nativetype QQuick3DRenderExtension |
33 | \inqmlmodule QtQuick3D |
34 | \inherits Object3D |
35 | \since 6.7 |
36 | \brief An uncreatable abstract base type for render extensions. |
37 | |
38 | \sa QQuick3DRenderExtension, QSSGRenderExtension, QQuick3DViewport::extensions() |
39 | */ |
40 | |
41 | |
42 | QQuick3DRenderExtension::QQuick3DRenderExtension(QQuick3DObject *parent) |
43 | : QQuick3DObject(*new QQuick3DObjectPrivate(QQuick3DObjectPrivate::Type::RenderExtension), parent) |
44 | { |
45 | |
46 | } |
47 | |
48 | QQuick3DRenderExtension::~QQuick3DRenderExtension() |
49 | { |
50 | |
51 | } |
52 | |
53 | /*! |
54 | \fn QSSGRenderGraphObject *QQuick3DRenderExtension::updateSpatialNode(QSSGRenderGraphObject *node) |
55 | |
56 | This function is called during the synchronization of the QtQuick3D scene graph when an item is |
57 | created or when an update is requested, usually as a result of a change in the item's properties. |
58 | The function should return a QSSGRenderExtension instance that contains the code that should be |
59 | run during QtQuick3D's rendering pipeline execution. |
60 | |
61 | \note The QSSGRenderExtension instance is a resource object and will be owned by the QtQuick3D |
62 | scene graph. If a different instance, or null, is returned, the previous instance will be |
63 | queued for deletion by the renderer. |
64 | |
65 | \sa QSSGRenderExtension |
66 | */ |
67 | |
68 | QSSGRenderGraphObject *QQuick3DRenderExtension::updateSpatialNode(QSSGRenderGraphObject *node) |
69 | { |
70 | return QQuick3DObject::updateSpatialNode(node); |
71 | } |
72 | |
73 | |
74 | |
75 | QT_END_NAMESPACE |
76 | |