Qt3DRenderer::QCamera Alternative
-
Hi,
absolute newbe to this forum so please forgive (and tell) me if I'm doing somthing terribly wrong.I'm looking to port a Qt-application to WebAssembly but am stuck. The application allows the user to "fly" through 3D space using a first person type camera. The issue here is, that the Qt3DRenderer::QCamera is used to facilitate this movement, but does not seem to be supported by WebAssembly.
The question I now have is: am I just out of luck and it can't be done, or is there some alternative for a first person camera with free 3D movement that is supported by WebAssembly?
This is how I create the *.pro file (and add some include directories):
@echo off set QT_DIR=C:\... START /WAIT %QT_DIR%\wasm_32\bin\qmake -project ECHO # Additional Include Paths >> .\app.pro ECHO INCLUDEPATH += .\..\.. >> .\app.pro ECHO INCLUDEPATH += %QT_DIR%\wasm_32\include\QtWidgets >> .\app.pro ECHO INCLUDEPATH += %QT_DIR%\wasm_32\include\QtMultimedia >> .\app.pro ECHO # Define Cpp Version >> .\app.pro ECHO CONFIG += c++1z >> .\app.pro ECHO # Suppress Warnings >> .\app.pro ECHO CONFIG += warn_off >> .\app.pro
This is how I try to compile the whole thing into WebAssembly:
set QT_DIR=C:\... set VS_COMPILER_TOOLS_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2017\..." set PATH=%VS_COMPILER_TOOLS_PATH%\cl.exe;%PATH% call E:\pcr\emsdk\emsdk.bat activate START /WAIT %QT_DIR%\msvc2017_64\bin\uic app.ui -o ui_app.h START /WAIT %QT_DIR%\wasm_32\bin\qmake make
And these are the error messages ...
... without adding %QT_DIR%\msvc2017_64\include as include location to the project file:..\..\tools/app/apprenderwidget.h:19:10: fatal error: 'Qt3DRender/QCamera' file not found
... after adding %QT_DIR%\msvc2017_64\include as include location to the project file:
(basically a bunch of undefined symbol errors, which include but are not limited to the QCamera functions)... warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0` ... error: undefined symbol: _ZN10Qt3DRender7QCamera11setPositionERK9QVector3D error: undefined symbol: _ZN10Qt3DRender7QCamera11setUpVectorERK9QVector3D error: undefined symbol: _ZN10Qt3DRender7QCamera13setViewCenterERK9QVector3D error: undefined symbol: _ZN10Qt3DRender7QCamera3panEfRK9QVector3D error: undefined symbol: _ZN10Qt3DRender7QCamera4tiltEf error: undefined symbol: _ZN10Qt3DRender7QCamera9translateERK9QVector3DNS0_23CameraTranslationOptionE error: undefined symbol: _ZN10Qt3DRender7QCameraC1EPN8Qt3DCore5QNodeE error: undefined symbol: _ZN10Qt3DRender7QCameraD1Ev ...
-
For the undefined symbols, make sure includes like
#include <QObject>
is replaced with an explicit path
#include <QtCore/QObject> -
-
@FrogCastOrg No, Qt headers should not be included with explicit path.
And undefined symbol errors are related to not linked libraries, not includes. -
Qt3D is not supported in Qt WebAssembly, so no work has been done to make it work. Qt3D requires OpenGL (desktop) and WebAssembly only supports OpenGL ES2/3, so I doubt it would even build correctly.