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
qquick3dtextureproviderextension.cpp
Go to the documentation of this file.
1
// Copyright (C) 2025 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
6
#
include
"qquick3dtextureproviderextension.h"
7
#
include
<
QtQuick3D
/
private
/
qquick3dobject_p
.
h
>
8
#
include
"qquick3dtextureproviderextension_p.h"
9
10
QT_BEGIN_NAMESPACE
11
12
/*!
13
\class QQuick3DTextureProviderExtension
14
\inmodule QtQuick3D
15
\since 6.11
16
17
\brief Abstract class for implementing user side texture provider extensions.
18
19
This is the front-end side of a texture provider extension. The back-end side is implemented
20
in \l QSSGRenderExtension. The QQuick3DTextureProviderExtension is a specialization of the
21
QQuick3DRenderExtension class that is used to create a custom texture provider extension that can
22
both provide additional metadata about what type of texture will be provided and also automatically
23
register the extension with the QtQuick3D scene graph. This means it is unecessary to manually add
24
the extension to the list of extensions to be used with a \l View3D, and just using the textureProvider
25
property of the Texture component is enough to trigger the extension code to be run when necessary.
26
27
The QQuick3DTextureProviderExtension class is an abstract class that should be subclassed and
28
exposed to QML. The subclass should implement the \l QQuick3DRenderExtension::updateSpatialNode()
29
function and return a QSSGRenderExtension instance that contains the code that should be run.
30
31
\sa QSSGRenderExtension
32
*/
33
34
/*!
35
\qmltype TextureProviderExtension
36
\nativetype QQuick3DTextureProviderExtension
37
\inqmlmodule QtQuick3D
38
\inherits RenderExtension
39
\since 6.11
40
\brief An uncreatable abstract base type for texture provider extensions.
41
42
\sa QQuick3DTextureProviderExtension, QSSGRenderExtension
43
*/
44
45
/*!
46
\property QQuick3DTextureProviderExtension::samplerHint
47
\since 6.11
48
49
This property contains a hint about the type of texture that will be
50
provided by the extension. This is necessary because the texture data will
51
not be provided until it is necessary, but materials that use the Texture
52
component need to know what type of sampler to provide.
53
54
The default value is \c QQuick3DTextureProviderExtension::Sampler2D.
55
56
\note This property is only used when using CustomMaterials.
57
58
\sa SamplerHint
59
*/
60
/*!
61
\qmlproperty enumeration TextureProviderExtension::samplerHint
62
63
This property contains a hint about the type of texture that will be provided by the extension.
64
This is necessary because the texture data will not be provided until it is necessary, but materials
65
that use the Texture component need to know what type of sampler to provide. This property should
66
be set to one of the following values:
67
68
\value TextureProviderExtension.Sampler2D The texture will be a 2D texture.
69
\value TextureProviderExtension.Sampler2DArray The texture will be an array texture.
70
\value TextureProviderExtension.Sampler3D The texture will be a 3D texture.
71
\value TextureProviderExtension.SamplerCube The texture will be a cube map texture.
72
\value TextureProviderExtension.SamplerCubeArray The texture will be an array of cube map textures.
73
\value TextureProviderExtension.SamplerBuffer The texture will be a buffer texture.
74
75
The default value is \c TextureProviderExtension.Sampler2D.
76
77
\note This property is only used when using CustomMaterials.
78
*/
79
80
81
QQuick3DTextureProviderExtensionPrivate::QQuick3DTextureProviderExtensionPrivate()
82
: QQuick3DObjectPrivate(QQuick3DObjectPrivate::Type::TextureProvider)
83
{
84
85
}
86
87
88
QQuick3DTextureProviderExtension::QQuick3DTextureProviderExtension(QQuick3DObject *parent)
89
: QQuick3DRenderExtension(*
new
QQuick3DTextureProviderExtensionPrivate(), parent)
90
{
91
92
}
93
94
QQuick3DTextureProviderExtension::~QQuick3DTextureProviderExtension()
95
{
96
97
}
98
99
/*!
100
\fn QSSGRenderGraphObject *QQuick3DTextureProviderExtension::updateSpatialNode(QSSGRenderGraphObject *node)
101
102
This function is called during the synchronization of the QtQuick3D scene graph when an item is
103
created or when an update is requested, usually as a result of a change in the item's properties.
104
The function should return a QSSGRenderTextureProviderExtension instance that contains the code that should be
105
run during QtQuick3D's rendering pipeline execution.
106
107
The \a node parameter is the previous QSSGRenderTextureProviderExtension instance that was returned from this
108
function, or null if this is the first time the function is called. The function can return the
109
same instance, a different instance, or null. If the function returns null, the extension will
110
be removed from the rendering pipeline.
111
112
\note The QSSGRenderTextureProviderExtension instance is a resource object and will be owned by the QtQuick3D
113
scene graph. If a different instance, or null, is returned, the previous instance will be
114
queued for deletion by the renderer.
115
116
\sa QSSGRenderTextureProviderExtension
117
*/
118
119
QSSGRenderGraphObject *QQuick3DTextureProviderExtension::updateSpatialNode(QSSGRenderGraphObject *node)
120
{
121
return
QQuick3DRenderExtension::updateSpatialNode(node);
122
}
123
124
QQuick3DTextureProviderExtension::SamplerHint QQuick3DTextureProviderExtension::samplerHint()
const
125
{
126
Q_D(
const
QQuick3DTextureProviderExtension);
127
return
d->samplerHint;
128
}
129
130
void
QQuick3DTextureProviderExtension::setSamplerHint(SamplerHint newSamplerHint)
131
{
132
Q_D(QQuick3DTextureProviderExtension);
133
if
(d->samplerHint == newSamplerHint)
134
return
;
135
d->samplerHint = newSamplerHint;
136
emit samplerHintChanged();
137
}
138
139
bool
QQuick3DTextureProviderExtension::event(QEvent *event)
140
{
141
return
QQuick3DRenderExtension::event(event);
142
}
143
144
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qrandomaccessasyncfile_darwin.mm:17
qtquick3d
src
quick3d
extensions
qquick3dtextureproviderextension.cpp
Generated on
for Qt by
1.16.1