![]() |
Qt 6.x
The Qt SDK
|
Public Types | |
enum | { NVideoFrameSlots = 4 } |
![]() | |
enum | Flag { Blending = 0x0001 , RequiresDeterminant = 0x0002 , RequiresFullMatrixExceptTranslate = 0x0004 | RequiresDeterminant , RequiresFullMatrix = 0x0008 | RequiresFullMatrixExceptTranslate , NoBatching = 0x0010 } |
\value Blending Set this flag to true if the material requires blending to be enabled during rendering. More... | |
Public Member Functions | |
QSGVideoMaterial (const QVideoFrameFormat &format) | |
QSGMaterialType * | type () const override |
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialShader instantiated by createShader(). | |
QSGMaterialShader * | createShader (QSGRendererInterface::RenderMode) const override |
This function returns a new instance of a the QSGMaterialShader implementation used to render geometry for a specific implementation of QSGMaterial. | |
int | compare (const QSGMaterial *other) const override |
Compares this material to other and returns 0 if they are equal; -1 if this material should sort before other and 1 if other should sort before. | |
void | updateBlending () |
void | setCurrentFrame (const QVideoFrame &frame) |
void | updateTextures (QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates) |
![]() | |
QSGMaterial () | |
virtual | ~QSGMaterial () |
virtual QSGMaterialType * | type () const =0 |
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialShader instantiated by createShader(). | |
virtual QSGMaterialShader * | createShader (QSGRendererInterface::RenderMode renderMode) const =0 |
This function returns a new instance of a the QSGMaterialShader implementation used to render geometry for a specific implementation of QSGMaterial. | |
virtual int | compare (const QSGMaterial *other) const |
Compares this material to other and returns 0 if they are equal; -1 if this material should sort before other and 1 if other should sort before. | |
QSGMaterial::Flags | flags () const |
Returns the material's flags. | |
void | setFlag (Flags flags, bool on=true) |
Sets the flags flags on this material if on is true; otherwise clears the attribute. | |
Public Attributes | |
QVideoFrameFormat | m_format |
float | m_planeWidth [3] |
float | m_opacity |
QMutex | m_frameMutex |
bool | m_texturesDirty = false |
QVideoFrame | m_currentFrame |
QVideoFrame | m_videoFrameSlots [NVideoFrameSlots] |
QScopedPointer< QSGVideoTexture > | m_textures [3] |
std::unique_ptr< QVideoFrameTextures > | m_videoFrameTextures |
Definition at line 62 of file qsgvideonode_p.cpp.
anonymous enum |
Enumerator | |
---|---|
NVideoFrameSlots |
Definition at line 109 of file qsgvideonode_p.cpp.
QSGVideoMaterial::QSGVideoMaterial | ( | const QVideoFrameFormat & | format | ) |
Definition at line 171 of file qsgvideonode_p.cpp.
References QSGMaterial::Blending, m_textures, QScopedPointer< T, Cleanup >::reset(), and QSGMaterial::setFlag().
|
inlineoverridevirtual |
Compares this material to other and returns 0 if they are equal; -1 if this material should sort before other and 1 if other should sort before.
The scene graph can reorder geometry nodes to minimize state changes. The compare function is called during the sorting process so that the materials can be sorted to minimize state changes in each call to QSGMaterialShader::updateState().
The this pointer and other is guaranteed to have the same type().
Reimplemented from QSGMaterial.
Definition at line 76 of file qsgvideonode_p.cpp.
References QSGVideoTexture::comparisonKey(), m_textures, and other().
|
inlineoverridevirtual |
This function returns a new instance of a the QSGMaterialShader implementation used to render geometry for a specific implementation of QSGMaterial.
The function will be called only once for each combination of material type and renderMode and will be cached internally.
For most materials, the renderMode can be ignored. A few materials may need custom handling for specific render modes. For instance if the material implements antialiasing in a way that needs to account for perspective transformations when RenderMode3D is in use.
Implements QSGMaterial.
Definition at line 72 of file qsgvideonode_p.cpp.
References m_format.
|
inline |
Definition at line 93 of file qsgvideonode_p.cpp.
References frame, lock, m_currentFrame, m_frameMutex, and m_texturesDirty.
Referenced by QSGVideoNode::setCurrentFrame().
|
inlineoverridevirtual |
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialShader instantiated by createShader().
For many materials, the typical approach will be to return a pointer to a static, and so globally available, QSGMaterialType instance. The QSGMaterialType is an opaque object. Its purpose is only to serve as a type-safe, simple way to generate unique material identifiers.
Implements QSGMaterial.
Definition at line 67 of file qsgvideonode_p.cpp.
References m_format, QVideoFrameFormat::NPixelFormats, and QVideoFrameFormat::pixelFormat().
|
inline |
Definition at line 88 of file qsgvideonode_p.cpp.
References QSGMaterial::Blending, m_opacity, qFuzzyCompare(), and QSGMaterial::setFlag().
void QSGVideoMaterial::updateTextures | ( | QRhi * | rhi, |
QRhiResourceUpdateBatch * | resourceUpdates | ||
) |
Definition at line 115 of file qsgvideonode_p.cpp.
References QVideoTextureHelper::createTextures(), QRhi::currentFrameSlot(), QRhi::FramesInFlight, m_currentFrame, m_frameMutex, m_textures, m_texturesDirty, m_videoFrameSlots, m_videoFrameTextures, NVideoFrameSlots, Q_ASSERT, and QRhi::resourceLimit().
QVideoFrame QSGVideoMaterial::m_currentFrame |
Definition at line 107 of file qsgvideonode_p.cpp.
Referenced by setCurrentFrame(), QSGVideoNode::setTexturedRectGeometry(), and updateTextures().
QVideoFrameFormat QSGVideoMaterial::m_format |
Definition at line 101 of file qsgvideonode_p.cpp.
Referenced by createShader(), and type().
QMutex QSGVideoMaterial::m_frameMutex |
Definition at line 105 of file qsgvideonode_p.cpp.
Referenced by setCurrentFrame(), and updateTextures().
float QSGVideoMaterial::m_opacity |
Definition at line 103 of file qsgvideonode_p.cpp.
Referenced by updateBlending(), and QSGVideoMaterialRhiShader::updateUniformData().
float QSGVideoMaterial::m_planeWidth[3] |
Definition at line 102 of file qsgvideonode_p.cpp.
QScopedPointer<QSGVideoTexture> QSGVideoMaterial::m_textures[3] |
Definition at line 111 of file qsgvideonode_p.cpp.
Referenced by QSGVideoMaterial(), compare(), QSGVideoMaterialRhiShader::updateSampledImage(), and updateTextures().
bool QSGVideoMaterial::m_texturesDirty = false |
Definition at line 106 of file qsgvideonode_p.cpp.
Referenced by setCurrentFrame(), and updateTextures().
QVideoFrame QSGVideoMaterial::m_videoFrameSlots[NVideoFrameSlots] |
Definition at line 110 of file qsgvideonode_p.cpp.
Referenced by updateTextures().
std::unique_ptr<QVideoFrameTextures> QSGVideoMaterial::m_videoFrameTextures |
Definition at line 112 of file qsgvideonode_p.cpp.
Referenced by updateTextures().