diff options
author | Janne Kangas <janne.kangas@qt.io> | 2020-02-07 11:32:25 +0200 |
---|---|---|
committer | Janne Kangas <janne.kangas@qt.io> | 2020-02-11 14:40:05 +0200 |
commit | 7ee97f3489bb1cba4095e58d4aa5241de772dc7b (patch) | |
tree | 6bacb9a0ae6aa385fd69d7915f1174e82188a13b /src/api/studio3d | |
parent | 2dff84fddcffde95e882faceb45d5797dc5c63b9 (diff) |
Add size and format to textureid query
Returns texture size and format for layer and material textures. Add
corresponding test.
Task-id: QT3DS-4005
Change-Id: I773715712dc78cf511f6c4d0095f5491834df311
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/api/studio3d')
-rw-r--r-- | src/api/studio3d/q3dspresentation.cpp | 19 | ||||
-rw-r--r-- | src/api/studio3d/q3dspresentation.h | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/api/studio3d/q3dspresentation.cpp b/src/api/studio3d/q3dspresentation.cpp index 0270e42..e6cc423 100644 --- a/src/api/studio3d/q3dspresentation.cpp +++ b/src/api/studio3d/q3dspresentation.cpp @@ -1025,6 +1025,25 @@ uint Q3DSPresentation::textureId(const QString &elementPath) } /*! + \since Qt 3D Studio 2.7 + Returns the OpenGL texture id associated with a layer or an image specified + by \a elementPath. Texture \a size and \a format are returned in corresponding parameters. + + For example, \c{Scene.Layer} returns the texture id of a layer while + \c{Scene.Layer.Rectangle.Material.diffusemap} returns the texture id of + an image or a subpresentation. + */ +uint Q3DSPresentation::textureId(const QString &elementPath, QSize &size, GLenum &format) +{ + if (d_ptr->m_viewerApp) + return d_ptr->m_viewerApp->textureId(elementPath, size, format); + + size = {}; + format = GL_INVALID_ENUM; + return 0; +} + +/*! Activate or deactivate the presentation identified by \a id depending on the value of \a active. */ diff --git a/src/api/studio3d/q3dspresentation.h b/src/api/studio3d/q3dspresentation.h index 1e8dedf..44bcad5 100644 --- a/src/api/studio3d/q3dspresentation.h +++ b/src/api/studio3d/q3dspresentation.h @@ -38,6 +38,7 @@ #include <QtCore/qstringlist.h> #include <QtStudio3D/q3dsdatainput.h> #include <QtStudio3D/q3dsdataoutput.h> +#include <QtGui/qopengl.h> QT_BEGIN_NAMESPACE @@ -130,6 +131,7 @@ public: void addImageProvider(const QString &providerId, QQmlImageProviderBase *provider); uint textureId(const QString &elementPath); + uint textureId(const QString &elementPath, QSize &size, GLenum &format); public Q_SLOTS: void setSource(const QUrl &source); |