Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquick3drenderextensions.cpp
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
5
6#include <QtQuick3D/private/qquick3dobject_p.h>
7
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
41QQuick3DRenderExtension::QQuick3DRenderExtension(QQuick3DObjectPrivate &dd, QQuick3DObject *parent)
42 : QQuick3DObject(dd, parent)
43{
44
45}
46
47QQuick3DRenderExtension::QQuick3DRenderExtension(QQuick3DObject *parent)
48 : QQuick3DRenderExtension(*new QQuick3DObjectPrivate(QQuick3DObjectPrivate::Type::RenderExtension), parent)
49{
50
51}
52
53QQuick3DRenderExtension::~QQuick3DRenderExtension()
54{
55
56}
57
58/*!
59 \fn QSSGRenderGraphObject *QQuick3DRenderExtension::updateSpatialNode(QSSGRenderGraphObject *node)
60
61 This function is called during the synchronization of the QtQuick3D scene graph when an item is
62 created or when an update is requested, usually as a result of a change in the item's properties.
63 The function should return a QSSGRenderExtension instance that contains the code that should be
64 run during QtQuick3D's rendering pipeline execution.
65
66 The \a node parameter is the previous QSSGRenderExtension instance that was returned from this
67 function, or null if this is the first time the function is called. The function can return the
68 same instance, a different instance, or null. If the function returns null, the extension will
69 be removed from the rendering pipeline.
70
71 \note The QSSGRenderExtension instance is a resource object and will be owned by the QtQuick3D
72 scene graph. If a different instance, or null, is returned, the previous instance will be
73 queued for deletion by the renderer.
74
75 \sa QSSGRenderExtension
76*/
77
78QSSGRenderGraphObject *QQuick3DRenderExtension::updateSpatialNode(QSSGRenderGraphObject *node)
79{
80 return QQuick3DObject::updateSpatialNode(node);
81}
82
83
84
85
86
87QT_END_NAMESPACE