From 7ee97f3489bb1cba4095e58d4aa5241de772dc7b Mon Sep 17 00:00:00 2001 From: Janne Kangas Date: Fri, 7 Feb 2020 11:32:25 +0200 Subject: Add size and format to textureid query MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ä Reviewed-by: Miikka Heikkinen Reviewed-by: Tomi Korpipää --- src/engine/Qt3DSRuntimeView.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/engine/Qt3DSRuntimeView.cpp') diff --git a/src/engine/Qt3DSRuntimeView.cpp b/src/engine/Qt3DSRuntimeView.cpp index 7cebdd6..c3dc8e1 100644 --- a/src/engine/Qt3DSRuntimeView.cpp +++ b/src/engine/Qt3DSRuntimeView.cpp @@ -53,6 +53,8 @@ #include "foundation/Qt3DSSimpleTypes.h" #include "foundation/TrackingAllocator.h" #include "foundation/Qt3DSPerfTimer.h" +#include + // For perf log timestamp #include #include "Qt3DSArray.h" @@ -229,6 +231,7 @@ public: void deleteMeshes(const QStringList &meshNames) override; void addImageProvider(const QString &providerId, QQmlImageProviderBase *provider) override; uint textureId(const QString &elementPath) override; + uint textureId(const QString &elementPath, QSize &size, GLenum &format) override; void SetAttribute(const char *elementPath, const char *attributeName, const char *value) override; bool GetAttribute(const char *elementPath, const char *attributeName, void *value) override; @@ -779,6 +782,20 @@ uint CRuntimeView::textureId(const QString &elementPath) return 0; } +uint CRuntimeView::textureId(const QString &elementPath, QSize &size, GLenum &format) +{ + if (m_Application) { + Q3DStudio::CQmlEngine &theBridgeEngine + = static_cast(m_RuntimeFactoryCore->GetScriptEngineQml()); + return theBridgeEngine.textureId(elementPath, + &m_RuntimeFactory->GetQt3DSRenderContext().GetRenderer(), + size, format); + } + size = {}; + format = GL_INVALID_ENUM; + return 0; +} + void CRuntimeView::SetAttribute(const char *elementPath, const char *attributeName, const char *value) { -- cgit v1.2.3