summaryrefslogtreecommitdiffstats
path: root/src/engine/Qt3DSRuntimeView.cpp
diff options
context:
space:
mode:
authorJanne Kangas <janne.kangas@qt.io>2020-02-07 11:32:25 +0200
committerJanne Kangas <janne.kangas@qt.io>2020-02-11 14:40:05 +0200
commit7ee97f3489bb1cba4095e58d4aa5241de772dc7b (patch)
tree6bacb9a0ae6aa385fd69d7915f1174e82188a13b /src/engine/Qt3DSRuntimeView.cpp
parent2dff84fddcffde95e882faceb45d5797dc5c63b9 (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/engine/Qt3DSRuntimeView.cpp')
-rw-r--r--src/engine/Qt3DSRuntimeView.cpp17
1 files changed, 17 insertions, 0 deletions
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 <QtGui/qopengl.h>
+
// For perf log timestamp
#include <time.h>
#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<Q3DStudio::CQmlEngine &>(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)
{