summaryrefslogtreecommitdiffstats
path: root/src/render/texture
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/texture')
-rw-r--r--src/render/texture/qabstracttexture.cpp18
-rw-r--r--src/render/texture/qabstracttextureimage.cpp4
-rw-r--r--src/render/texture/qtexture.cpp18
-rw-r--r--src/render/texture/qtexturegenerator.cpp3
-rw-r--r--src/render/texture/texture.cpp10
5 files changed, 27 insertions, 26 deletions
diff --git a/src/render/texture/qabstracttexture.cpp b/src/render/texture/qabstracttexture.cpp
index 7fca2ba3f..258ab44dc 100644
--- a/src/render/texture/qabstracttexture.cpp
+++ b/src/render/texture/qabstracttexture.cpp
@@ -977,7 +977,7 @@ float QAbstractTexture::maximumAnisotropy() const
}
/*!
- \property Qt3DRender::QAbstractTexture::ComparisonFunction
+ \property Qt3DRender::QAbstractTexture::comparisonFunction
Holds the comparison function of the texture provider.
*/
@@ -1008,7 +1008,7 @@ QAbstractTexture::ComparisonFunction QAbstractTexture::comparisonFunction() cons
}
/*!
- \property Qt3DRender::QAbstractTexture::ComparisonMode
+ \property Qt3DRender::QAbstractTexture::comparisonMode
Holds the comparison mode of the texture provider.
*/
@@ -1055,9 +1055,12 @@ QTextureGeneratorPtr QAbstractTexture::dataGenerator() const
*/
/*!
- * \qmlproperty handleType
+ * \qmlproperty enumeration AbstractTexture::handleType
*
* Holds the current texture handle type.
+ *
+ * \value AbstractTexture.NoHandle
+ * \value AbstractTexture.OpenGLTextureId
*/
/*!
@@ -1070,7 +1073,6 @@ QAbstractTexture::HandleType QAbstractTexture::handleType() const
return d->m_handleType;
}
-
/*!
* \property Qt3DRender::QAbstractTexture::handle
*
@@ -1079,7 +1081,7 @@ QAbstractTexture::HandleType QAbstractTexture::handleType() const
*/
/*!
- * \qmlproperty handle
+ * \qmlproperty var AbstractTexture::handle
*
* Holds the current texture handle, if Qt 3D is using the OpenGL renderer,
* handle is a texture id integer.
@@ -1098,8 +1100,8 @@ QVariant QAbstractTexture::handle() const
}
/*!
- * Allow to update a sub region of the texture without having to change the data
- * generator or rely on adding or removing texture images.
+ * Updates a sub region of the texture, defined by \a update, without having
+ * to change the data generator or rely on adding or removing texture images.
* \since 5.14
*/
void QAbstractTexture::updateData(const QTextureDataUpdate &update)
@@ -1135,7 +1137,7 @@ Qt3DCore::QNodeCreatedChangeBasePtr QAbstractTexture::createNodeCreationChange()
data.dataFunctor = d->m_dataFunctor;
data.sharedTextureId = d->m_sharedTextureId;
data.initialDataUpdates = d->m_pendingDataUpdates;
- return std::move(creationChange);
+ return creationChange;
}
/*!
diff --git a/src/render/texture/qabstracttextureimage.cpp b/src/render/texture/qabstracttextureimage.cpp
index 9ca4599c5..6f68221fd 100644
--- a/src/render/texture/qabstracttextureimage.cpp
+++ b/src/render/texture/qabstracttextureimage.cpp
@@ -131,8 +131,8 @@ QTextureImageDataGeneratorPtr QAbstractTextureImagePrivate::dataGenerator() cons
/*!
\fn Qt3DRender::QTextureImageDataGeneratorPtr Qt3DRender::QAbstractTextureImage::dataGenerator() const
- Implement this method to return the \l QTextureImageDataGeneratorPtr, which will
- provide the data for the texture image.
+ Implement this method to return the QTextureImageDataGeneratorPtr instance,
+ which will provide the data for the texture image.
*/
/*!
diff --git a/src/render/texture/qtexture.cpp b/src/render/texture/qtexture.cpp
index bca66e630..84a228428 100644
--- a/src/render/texture/qtexture.cpp
+++ b/src/render/texture/qtexture.cpp
@@ -1125,7 +1125,7 @@ TextureDownloadRequest::TextureDownloadRequest(const QTextureFromSourceGenerator
}
-// Executed in aspect thread
+// Executed in main thread
void TextureDownloadRequest::onCompleted()
{
if (cancelled() || !succeeded())
@@ -1142,16 +1142,11 @@ void TextureDownloadRequest::onCompleted()
QTextureFromSourceGeneratorPtr oldGenerator = qSharedPointerCast<QTextureFromSourceGenerator>(texture->dataGenerator());
- // We create a new functor
- // Which is a copy of the old one + the downloaded sourceData
- auto newGenerator = QTextureFromSourceGeneratorPtr::create(*oldGenerator);
-
// Set raw data on functor so that it can really load something
- newGenerator->m_sourceData = m_data;
+ oldGenerator->m_sourceData = m_data;
- // Set new generator on texture
- // it implictely marks the texture as dirty so that the functor runs again with the downloaded data
- texture->setDataGenerator(newGenerator);
+ // Mark the texture as dirty so that the functor runs again with the downloaded data
+ texture->addDirtyFlag(Render::Texture::DirtyDataGenerator);
}
/*!
@@ -1520,7 +1515,10 @@ QTextureLoader::QTextureLoader(QNode *parent)
// Regenerate the texture functor when properties we support overriding
// from QAbstractTexture get changed.
Q_D(QTextureLoader);
- auto regenerate = [=] () { d->updateGenerator(); };
+ auto regenerate = [=] () {
+ if (!notificationsBlocked()) // check the change doesn't come from the backend
+ d->updateGenerator();
+ };
connect(this, &QAbstractTexture::formatChanged, regenerate);
}
diff --git a/src/render/texture/qtexturegenerator.cpp b/src/render/texture/qtexturegenerator.cpp
index 5e350af2d..36b5f6498 100644
--- a/src/render/texture/qtexturegenerator.cpp
+++ b/src/render/texture/qtexturegenerator.cpp
@@ -52,8 +52,7 @@ QTextureGenerator::~QTextureGenerator()
}
/*!
- \class QTextureGenerator
- \inherits QAbstractFunctor
+ \class Qt3DRender::QTextureGenerator
\inmodule Qt3DRender
\brief Provides the image data for a texture.
*/
diff --git a/src/render/texture/texture.cpp b/src/render/texture/texture.cpp
index d120c2b39..1414cd337 100644
--- a/src/render/texture/texture.cpp
+++ b/src/render/texture/texture.cpp
@@ -149,6 +149,8 @@ void Texture::syncFromFrontEnd(const QNode *frontEnd, bool firstTime)
auto newGenerator = node->dataGenerator();
if (newGenerator != m_dataFunctor) {
setDataGenerator(newGenerator);
+ QAbstractTexturePrivate *dTexture = static_cast<QAbstractTexturePrivate *>(QNodePrivate::get(const_cast<QNode *>(frontEnd)));
+ dTexture->setStatus(QAbstractTexture::Loading);
}
QAbstractTexturePrivate *dnode = dynamic_cast<QAbstractTexturePrivate *>(QAbstractTexturePrivate::get(const_cast<QAbstractTexture *>(node)));
@@ -163,11 +165,11 @@ void Texture::syncFromFrontEnd(const QNode *frontEnd, bool firstTime)
m_textureImageIds = ids;
addDirtyFlag(DirtyImageGenerators);
}
- }
- if (dnode->m_sharedTextureId != m_sharedTextureId) {
- m_sharedTextureId = dnode->m_sharedTextureId;
- addDirtyFlag(DirtySharedTextureId);
+ if (dnode->m_sharedTextureId != m_sharedTextureId) {
+ m_sharedTextureId = dnode->m_sharedTextureId;
+ addDirtyFlag(DirtySharedTextureId);
+ }
}
}