简体   繁体   中英

Qt3DRenderer::QCamera WebAssembly supported alternative

VenomousByte 4 minutes ago

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
...

Qt3D is not supported yet by Qt WebAssembly, so it will not work with the binary install you get from the maintenance app.

You would need to configure Qt yourself with the -feature-thread argument. You will also need emscripten version greater than 1.38.30.

Qt3d requires opengl (desktop) which Qt WebAssembly does not support, only opengl es2 and opengl es3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM