1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00
kgv f9ab9f7f1c 0032433: Visualization, TKService - introduce Wasm_Window implementing Aspect_Window interface using Emscripten SDK
Introduced Wasm_Window implementing Aspect_Window interface.

Aspect_WindowInputListener has been extended by touch input callbacks (moved from AIS_ViewController),
which now implements redirection of single taps to UpdateMouseClick().

AIS_ViewController::FetchNavigationKeys() now requests more frames even if Delta is zero,
but navigation keys are pressed - indicated by a new flag AIS_WalkDelta::IsDefined().

Fixed missing implementation of Xw_Window::DisplayConnection() getter.
The property has been moved to the base class Aspect_Window.

Removed unused Aspect_Convert.hxx.

DRAWEXE targeting Wasm:
- added exposing of FS interface so that it is possible uploading/downloading files to/from emulated file system on JavaScript level;
- added printer redirecting messages to Module.printMessage callback accepting message gravity;
- Run_Appli() now skips std::cin when Module.noExitRuntime is set.
2021-06-12 12:36:24 +03:00
..

OCCT WebGL Viewer sample

This sample demonstrates simple way of using OCCT libraries in Web application written in C++ and translated into WebAssembly module using Emscripten SDK (emsdk): https://emscripten.org/

Sample consists of the Open CASCADE 3D Viewer with a button for opening a model in BREP format. The sample requires a WebGL 2.0 capable browser supporting WebAssembly 1.0 (Wasm).

Installation and configuration:

  1. Install Emscripten SDK and activate minimal configuration (Python, Java and CLang) following emsdk documentation. Activate also MinGW when building sample on Windows host.
  2. Build (using emsdk) or download FreeType static library.
  3. Configure CMake for building Open CASCADE Technology (OCCT) static libraries (BUILD_LIBRARY_TYPE="Static"). For this, activate emsdk command prompt, configure CMake for building OCCT using cross-compilation toolchain, disable BUILD_MODULE_Draw.
  4. Perform building and installation steps.
    > ${EMSDK}/fastcomp/emscripten/cmake/Modules/Platform/Emscripten.cmake
  1. Configure CMake for building this WebGL sample using emsdk with paths to OCCT and FreeType. Perform building and installation steps.
  2. Copy data/occ/Ball.brep from OCCT into "samples" folder within WebGL sample installation path.
  3. Navigate to installation folder and start web server from it; Python coming with emsdk can be used for this purpose:
    > python -m SimpleHTTPServer 8080
  1. Open compatible browser and enter path taking into account your web server settings:
    > http://localhost:8080/occt-webgl-sample.html