diff options
author | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2019-09-10 11:00:57 +0300 |
---|---|---|
committer | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2019-09-17 12:35:55 +0300 |
commit | fe29ee5c5b0c1edbfabccf211bd8d73bb61672dc (patch) | |
tree | 21fb79747816ff315ed0f5526321bea2e616b326 /src/engine/Qt3DSRuntimeView.cpp | |
parent | ef8b07e32a9ecc8375c1031ba5c7119ac75b81f0 (diff) |
Support QQuickImageProvider in the runtime
With QQuickImageProvider the user can make a callback method returning a
custom QPixmap or QImage to the engine without accessing the filesystem.
Texture sourcepaths are set using an image url scheme. For example
"image://colors/blue" where "image://" tells the runtime to look for an
image provider, "colors" is the image provider id and rest are the image
id the provider uses to create the image.
Task-number: QT3DS-3761
Change-Id: I830649359f9969e957a972a0c08d0ede6e46ee78
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/engine/Qt3DSRuntimeView.cpp')
-rw-r--r-- | src/engine/Qt3DSRuntimeView.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/engine/Qt3DSRuntimeView.cpp b/src/engine/Qt3DSRuntimeView.cpp index 3ab577c..c5448e3 100644 --- a/src/engine/Qt3DSRuntimeView.cpp +++ b/src/engine/Qt3DSRuntimeView.cpp @@ -225,6 +225,7 @@ public: void deleteMaterials(const QStringList &materialNames) override; void createMesh(const QString &name, qt3dsimp::Mesh *mesh) override; void deleteMeshes(const QStringList &meshNames) override; + void addImageProvider(const QString &providerId, QQmlImageProviderBase *provider) override; void SetAttribute(const char *elementPath, const char *attributeName, const char *value) override; bool GetAttribute(const char *elementPath, const char *attributeName, void *value) override; @@ -733,6 +734,15 @@ void CRuntimeView::deleteMeshes(const QStringList &meshNames) } } +void CRuntimeView::addImageProvider(const QString &providerId, QQmlImageProviderBase *provider) +{ + if (m_Application) { + IBufferManager &bufferManager + = m_RuntimeFactory->GetQt3DSRenderContext().GetBufferManager(); + bufferManager.addImageProvider(providerId, provider); + } +} + void CRuntimeView::SetAttribute(const char *elementPath, const char *attributeName, const char *value) { |