![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include "qquick3dquadtextureprovider_p.h"#include <QtQuick3DRuntimeRender/private/qssgshadermaterialadapter_p.h>#include <ssg/qssgrenderextensions.h>#include <ssg/qssgrenderhelpers.h>#include <ssg/qssgrendercontextcore.h>#include <ssg/qquick3dextensionhelpers.h>Go to the source code of this file.
Classes | |
| class | QSSGQuadTextureProvider |
Functions | |
| static void | insertVertexMainArgs (QByteArray &snippet) |
Variables | |
| static QT_BEGIN_NAMESPACE constexpr float | g_vertexData [] |
| \qmltype QuadTextureProvider \nativetype QQuick3DQuadTextureProvider \inqmlmodule QtQuick3D.Helpers \inherits TextureProviderExtension | |
| static constexpr uint16_t | g_indexData [] = { 0, 1, 2, 0, 2, 3 } |
| static const QByteArray | mainVertexSnippet |
| static const QByteArray | mainVertexSnippetFlipped |
| static const QByteArray | mainFragmentSnippet |
| static const QByteArray | fallbackFragmentShaderStr |
|
inlinestatic |
Definition at line 263 of file qquick3dquadtextureprovider.cpp.
|
static |
Definition at line 256 of file qquick3dquadtextureprovider.cpp.
|
staticconstexpr |
Definition at line 230 of file qquick3dquadtextureprovider.cpp.
|
staticconstexpr |
\qmltype QuadTextureProvider \nativetype QQuick3DQuadTextureProvider \inqmlmodule QtQuick3D.Helpers \inherits TextureProviderExtension
Used to render a quad texture using a custom fragment shader.
This type is used to render quad textures using custom shader code, enabling a convenient way to get programmable textures. By providing a fragment shader and wanted properties, a pass is created and a shader pipeline is built based on the provided data, passing the properties in as uniform values to the fragment shader.
Built-ins provided:
\table \header
Custom properties gets mapped to uniforms. Any time the values change, the updated value will become visible in the shader. This concept may already be familiar from \l ShaderEffect.
The name of the QML property and the GLSL variable must match. There is no separate declaration in the shader code for the individual uniforms. Rather, the QML property name can be used as-is.
The following table lists how the types are mapped:
\table \header
w \row An example of outputting a simple red texture could be done the following way: \badcode Texture { textureProvider: QuadTextureProvider { width: 128 height: 128 fragmentShaderCode: void MAIN() { FRAGCOLOR = vec4(1.0, 0.0, 0.0, 1.0); } } }
Another example sampling from a \l Texture property and mixing with UV colors: \badcode Texture { textureProvider: QuadTextureProvider { fragmentShaderCode: void MAIN() { vec2 uv = INPUT_UV; vec4 c = texture(checkers, uv); FRAGCOLOR = mix(c, vec4(uv, 1, 1), 0.5); }
property Texture checkers : Texture { source: "../shared/maps/checkers2.png" } } }
The result is the following:
\qmlproperty url QuadTextureProvider::fragmentShader
Specifies the file with the snippet of custom fragment shader code.
The value is a URL and must either be a local file or use the qrc scheme to access files embedded via the Qt resource system. Relative file paths (without a scheme) are also accepted, in which case the file is treated as relative to the component (the {.qml} file).
\qmlproperty string QuadTextureProvider::fragmentShaderCode
Specifies a snippet of custom fragment shader code.
Used as a way to inline shader code as a string instead of providing a file.
\qmlproperty int QuadTextureProvider::width
Specifies the width in pixels of the output texture.
\qmlproperty int QuadTextureProvider::height
Specifies the height in pixels of the output texture.
\qmlproperty enumeration QuadTextureProvider::format
This property holds the format of the output texture.
\value TexureData.RGBA8 The color format is considered as 8-bit integer in R, G, B and alpha channels. \value TexureData.RGBA16F The color format is considered as 16-bit float in R,G,B and alpha channels. \value TexureData.RGBA32F The color format is considered as 32-bit float in R, G, B and alpha channels. \value TexureData.RGBE8 The color format is considered as 8-bit mantissa in the R, G, and B channels and 8-bit shared exponent. \value TexureData.R8 The color format is considered as 8-bit integer in R channel. \value TexureData.R16 The color format is considered as 16-bit integer in R channel. \value TexureData.R16F The color format is considered as 16-bit float in R channel. \value TexureData.R32F The color format is considered as 32-bit float R channel.
TexureData.RGBA8, not every format is supported at runtime as this depends on which backend is being used as well which hardware is being used. Definition at line 227 of file qquick3dquadtextureprovider.cpp.
Referenced by QSSGQuadTextureProvider::prepareRender().
|
static |
Definition at line 249 of file qquick3dquadtextureprovider.cpp.
|
static |
Definition at line 232 of file qquick3dquadtextureprovider.cpp.
|
static |
Definition at line 240 of file qquick3dquadtextureprovider.cpp.