/*! Sets the target rect of this texture node to \a r. */ void QSGSimpleTextureNode::setRect(const QRectF &r) { if (m_rect == r) return; m_rect = r; qsgsimpletexturenode_update(&m_geometry, texture(), m_rect); markDirty(DirtyGeometry); }
/*! Sets the method used to generate texture coordinates to \a mode. This can be used to obtain correct orientation of the texture. This is commonly needed when using a third party OpenGL library to render to texture as OpenGL has an inverted y-axis relative to Qt Quick. \sa textureCoordinatesTransform() */ void QSGSimpleTextureNode::setTextureCoordinatesTransform(QSGSimpleTextureNode::TextureCoordinatesTransformMode mode) { Q_D(QSGSimpleTextureNode); if (d->m_texCoordMode == mode) return; d->m_texCoordMode = mode; qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->m_texCoordMode); markDirty(DirtyMaterial); }
/*! Sets the texture of this texture node to \a texture. \warning A texture node must have a texture before being added to the scenegraph to be rendered. */ void QSGSimpleTextureNode::setTexture(QSGTexture *texture) { if (m_material.texture() == texture) return; m_material.setTexture(texture); m_opaque_material.setTexture(texture); qsgsimpletexturenode_update(&m_geometry, texture, m_rect); markDirty(DirtyMaterial); }
/*! Sets the source rect of this texture node to \a r. \since 5.5 */ void QSGSimpleTextureNode::setSourceRect(const QRectF &r) { Q_D(QSGSimpleTextureNode); if (d->sourceRect == r) return; d->sourceRect = r; qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->sourceRect, d->texCoordMode); markDirty(DirtyGeometry); }
/*! Sets the texture of this texture node to \a texture. \warning A texture node must have a texture before being added to the scenegraph to be rendered. */ void QSGSimpleTextureNode::setTexture(QSGTexture *texture) { Q_ASSERT(texture); m_material.setTexture(texture); m_opaque_material.setTexture(texture); Q_D(QSGSimpleTextureNode); qsgsimpletexturenode_update(&m_geometry, texture, m_rect, d->m_texCoordMode); DirtyState dirty = DirtyMaterial; // It would be tempting to skip the extra bit here and instead use // m_material.texture to get the old state, but that texture could // have been deleted in the mean time. bool wasAtlas = d->isAtlasTexture; d->isAtlasTexture = texture->isAtlasTexture(); if (wasAtlas || d->isAtlasTexture) dirty |= DirtyGeometry; markDirty(dirty); }