From: kgv Date: Sun, 16 Feb 2020 18:53:08 +0000 (+0300) Subject: 0031373: Samples - provide sample combining OCCT and 3 viewer X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FCR31373;p=occt-copy.git 0031373: Samples - provide sample combining OCCT and 3 viewer --- diff --git a/samples/webgl/WasmOcctView.cpp b/samples/webgl/WasmOcctView.cpp index 68a8b86bba..7f78ee6b9d 100644 --- a/samples/webgl/WasmOcctView.cpp +++ b/samples/webgl/WasmOcctView.cpp @@ -52,6 +52,14 @@ namespace return aDevicePixelRatio; }); + /*EM_JS(void, jsSetOcctCamera, (float theFOV, float theAspect, float theNear, float theFar), { + setOcctCamera(); + });*/ + + EM_JS(void, jsPostFrameRender, (), { + postFrameRender(); + }); + //! Return cavas size in pixels. static Graphic3d_Vec2i jsCanvasSize() { @@ -336,7 +344,13 @@ void WasmOcctView::handleViewRedraw (const Handle(AIS_InteractiveContext)& theCt const Handle(V3d_View)& theView) { myUpdateRequests = 0; + + theView->Invalidate(); /// Three.js cannot be rendered properly without full redraw + glEnable (GL_POLYGON_OFFSET_FILL); /// reset defaults Graphic3d_PolygonOffset after Three.js + glPolygonOffset (1.0f, 1.0f); + AIS_ViewController::handleViewRedraw (theCtx, theView); + jsPostFrameRender(); if (myToAskNextFrame) { // ask more frames diff --git a/samples/webgl/occt-webgl-sample.html b/samples/webgl/occt-webgl-sample.html index 80f7e6f4d8..fc417b2e8f 100644 --- a/samples/webgl/occt-webgl-sample.html +++ b/samples/webgl/occt-webgl-sample.html @@ -16,6 +16,7 @@

Console output:

+