This class defines WebAssembly window (HTML5 canvas) intended for creation of OpenGL (WebGL) context.
More...
|
| | Wasm_Window (const TCollection_AsciiString &theCanvasId, const bool theToScaleBacking=true) |
| | Wraps existing HTML5 canvas into window.
|
| |
| | ~Wasm_Window () override |
| | Destroys the window.
|
| |
| bool | IsMapped () const override |
| | Return true if window is not hidden.
|
| |
| void | Map () const override |
| | Change window mapped flag to TRUE.
|
| |
| void | Unmap () const override |
| | Change window mapped flag to FALSE.
|
| |
| Aspect_TypeOfResize | DoResize () override |
| | Resize window. In case of ToScaleBacking flag, this method will resize the backing store of canvas basing on DevicePixelRatio() scale factor and CSS canvas size.
|
| |
| bool | DoMapping () const override |
| | Apply the mapping change to the window.
|
| |
| double | Ratio () const override |
| | Returns window ratio equal to the physical width/height dimensions.
|
| |
| void | Position (int &theX1, int &theY1, int &theX2, int &theY2) const override |
| | Returns The Window POSITION in PIXEL.
|
| |
| void | Size (int &theWidth, int &theHeight) const override |
| | Return the window size in pixels.
|
| |
| void | SetSizeLogical (const NCollection_Vec2< double > &theSize) |
| | Set new window size in logical (density-independent units). Backing store will be resized basing on DevicePixelRatio().
|
| |
| void | SetSizeBacking (const NCollection_Vec2< int > &theSize) |
| | Set new window size in pixels. Logical size of the element will be resized basing on DevicePixelRatio().
|
| |
| const TCollection_AsciiString & | CanvasId () const |
| | Returns canvas id.
|
| |
| Aspect_Drawable | NativeHandle () const override |
| | Current EGL implementation in Emscripten accepts only 0 for native window id.
|
| |
| Aspect_Drawable | NativeParentHandle () const override |
| | Always returns 0 for this class.
|
| |
| Aspect_FBConfig | NativeFBConfig () const override |
| | Always returns 0 for this class.
|
| |
| double | DevicePixelRatio () const override |
| | Return device pixel ratio (logical to backing store scale factor).
|
| |
| void | SetDevicePixelRatio (double theDevicePixelRatio) |
| | Sets device pixel ratio for a window with IsVirtual() flag.
|
| |
| void | InvalidateContent (const occ::handle< Aspect_DisplayConnection > &theDisp) override |
| | Invalidate entire window content through generation of Expose event.
|
| |
| virtual bool | ProcessMessage (Aspect_WindowInputListener &theListener, int theEventType, const void *theEvent) |
| | Process a single window message.
|
| |
| virtual bool | ProcessMouseEvent (Aspect_WindowInputListener &theListener, int theEventType, const EmscriptenMouseEvent *theEvent) |
| | Process a mouse input message.
|
| |
| virtual bool | ProcessWheelEvent (Aspect_WindowInputListener &theListener, int theEventType, const EmscriptenWheelEvent *theEvent) |
| | Process a (mouse) wheel input message.
|
| |
| virtual bool | ProcessTouchEvent (Aspect_WindowInputListener &theListener, int theEventType, const EmscriptenTouchEvent *theEvent) |
| | Process a mouse input message.
|
| |
| virtual bool | ProcessKeyEvent (Aspect_WindowInputListener &theListener, int theEventType, const EmscriptenKeyboardEvent *theEvent) |
| | Process a keyboard input message.
|
| |
| virtual bool | ProcessUiEvent (Aspect_WindowInputListener &theListener, int theEventType, const EmscriptenUiEvent *theEvent) |
| | Process a UI input message (like window resize).
|
| |
| virtual bool | ProcessFocusEvent (Aspect_WindowInputListener &theListener, int theEventType, const EmscriptenFocusEvent *theEvent) |
| | Process a focus input change message.
|
| |
| bool | IsVirtual () const |
| | Returns True if the window <me> is virtual.
|
| |
| void | SetVirtual (const bool theVirtual) |
| | Setup the virtual state.
|
| |
| NCollection_Vec2< int > | TopLeft () const |
| | Returns window top-left corner.
|
| |
| NCollection_Vec2< int > | Dimensions () const |
| | Returns window dimensions.
|
| |
| const occ::handle< Aspect_DisplayConnection > & | DisplayConnection () const |
| | Returns connection to Display or NULL.
|
| |
| Aspect_Background | Background () const |
| | Returns the window background.
|
| |
| Aspect_FillMethod | BackgroundFillMethod () const |
| | Returns the current image background fill mode.
|
| |
| Aspect_GradientBackground | GradientBackground () const |
| | Returns the window gradient background.
|
| |
| void | SetBackground (const Aspect_Background &theBack) |
| | Modifies the window background.
|
| |
| void | SetBackground (const Quantity_Color &theColor) |
| | Modifies the window background.
|
| |
| void | SetBackground (const Aspect_GradientBackground &theBackground) |
| | Modifies the window gradient background.
|
| |
| void | SetBackground (const Quantity_Color &theFirstColor, const Quantity_Color &theSecondColor, const Aspect_GradientFillMethod theFillMethod) |
| | Modifies the window gradient background.
|
| |
| virtual void | SetTitle (const TCollection_AsciiString &theTitle) |
| | Sets window title.
|
| |
| virtual NCollection_Vec2< double > | ConvertPointToBacking (const NCollection_Vec2< double > &thePnt) const |
| | Convert point from logical units into backing store units.
|
| |
| virtual NCollection_Vec2< double > | ConvertPointFromBacking (const NCollection_Vec2< double > &thePnt) const |
| | Convert point from backing store units to logical units.
|
| |
| void | DumpJson (Standard_OStream &theOStream, int theDepth=-1) const |
| | Dumps the content of me into the stream.
|
| |
Public Member Functions inherited from Standard_Transient |
| | Standard_Transient () |
| | Empty constructor.
|
| |
| | Standard_Transient (const Standard_Transient &) |
| | Copy constructor – does nothing.
|
| |
| Standard_Transient & | operator= (const Standard_Transient &) |
| | Assignment operator, needed to avoid copying reference counter.
|
| |
| virtual | ~Standard_Transient ()=default |
| | Destructor must be virtual.
|
| |
| virtual const opencascade::handle< Standard_Type > & | DynamicType () const |
| | Returns a type descriptor about this object.
|
| |
| bool | IsInstance (const opencascade::handle< Standard_Type > &theType) const |
| | Returns a true value if this is an instance of Type.
|
| |
| bool | IsInstance (const char *const theTypeName) const |
| | Returns a true value if this is an instance of TypeName.
|
| |
| bool | IsKind (const opencascade::handle< Standard_Type > &theType) const |
| | Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
|
| |
| bool | IsKind (const char *const theTypeName) const |
| | Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
|
| |
| Standard_Transient * | This () const |
| | Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
|
| |
| int | GetRefCount () const noexcept |
| | Get the reference counter of this object.
|
| |
| void | IncrementRefCounter () noexcept |
| | Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
|
| |
| int | DecrementRefCounter () noexcept |
| | Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
|
| |
| virtual void | Delete () const |
| | Memory deallocator for transient classes.
|
| |
This class defines WebAssembly window (HTML5 canvas) intended for creation of OpenGL (WebGL) context.
Note that canvas may define an independent dimensions for backing store (WebGL buffer to render) and for CSS (logical units to present buffer onto screen). These dimensions differ when browser is dragged into a high pixel density screen (HiDPI), or when user scales page in the browser (in both cases window.devicePixelRatio JavaScript property becomes not equal to 1.0).
By default, Wasm_Window::DoResize() will scale backing store of a canvas basing on DevicePixelRatio() scale factor to ensure canvas content being rendered with the native resolution and not stretched by browser. This, however, might have side effects:
- a slow GPU might experience performance issues on drawing into larger buffer (e.g. HiDPI);
- user interface displayed in 3D Viewer (e.g. AIS presentations) should be scaled proportionally to be accessible, which might require extra processing at application level. Consider changing ToScaleBacking flag passed to Wasm_Window constructor in case of issues.