Axmol 3.0.0-89d6d9a
Loading...
Searching...
No Matches
RenderViewCore Class Referenceabstract

Core render view abstraction for window/surface state and scene presentation. More...

#include <RenderViewCore.h>

Inherits Object.

Public Member Functions

virtual ~RenderViewCore ()
 @lua NA
virtual void end ()=0
 Force destroying EGL view, subclass must implement this method.
virtual bool isGfxContextReady ()=0
 Get whether graphics context is ready, subclass must implement this method.
virtual void swapBuffers ()=0
 Exchanges the front and back buffers, subclass must implement this method.
virtual void setIMEKeyboardState (bool open)=0
 Open or close IME keyboard , subclass must implement this method.
virtual bool windowShouldClose ()
 When the window is closed, it will return false if the platforms is Ios or Android.
void pollEvents ()
 Polls compositor-managed events before scheduler update.
const Vec2 & getWindowSize () const
 Get the zoomed window size In general, it returns the screen size since the view is a fullscreen view.
virtual void setWindowSize (float, float)
 Set the zoomed window size.
virtual void setWindowZoomFactor (float)
 Set zoom factor for frame.
virtual float getWindowZoomFactor () const
 Get zoom factor for frame.
 AX_DEPRECATED ("3.0") const Vec2 &getFrameSize() const
 implicit deprecated APIs, use getWindowSize instead
virtual void setCursorVisible (bool)
 Hide or Show the mouse cursor if there is one.
float getRenderScale () const
 Get axmol render scale.
virtual Vec2 getVisibleSize () const
 Get the visible area size of render viewport.
virtual Vec2 getVisibleOrigin () const
 Get the visible origin point of render viewport.
virtual Rect getVisibleRect () const
 Get the visible rectangle of render viewport.
virtual Rect getSafeAreaRect () const
 Gets safe area rectangle.
virtual void setDesignResolutionSize (float width, float height, ResolutionPolicy resolutionPolicy)
 Set the design resolution size.
virtual const Vec2 & getDesignResolutionSize () const
 Get design resolution size.
virtual void setViewportInPoints (float x, float y, float w, float h)
 Set render view port rectangle with points.
virtual void setScissorInPoints (float x, float y, float w, float h)
 Set Scissor rectangle with points.
virtual bool isScissorEnabled ()
 Get whether GL_SCISSOR_TEST is enable.
virtual Rect getScissorInPoints () const
 Get the current scissor rectangle.
std::string_view getViewName () const
 Get the view name.
virtual void setIcon (std::string_view) const
 Set window icon (implemented for windows and linux).
virtual void setIcon (std::span< const std::string_view >) const
 Set window icon (implemented for windows and linux).
virtual void setDefaultIcon () const
 Set default window icon (implemented for windows and linux).
const Rect & getViewportRect () const
 Get the render view port rectangle.
float getScaleX () const
 Get scale factor of the horizontal direction.
float getScaleY () const
 Get scale factor of the vertical direction.
ResolutionPolicy getResolutionPolicy () const
 Returns the current Resolution policy.
virtual void * getNativeWindow () const
 Get the Native Window object.
virtual SurfaceHandle getNativeDisplay () const
 Get the Native Display object.
virtual WindowPlatform getWindowPlatform () const
 Get the Window Platform object.
virtual void showContextMenu (const Vec2 &, bool hasText, bool hasSelection, bool readOnly)
 Show the system edit menu (Copy/Cut/Paste) at the given point.
virtual void hideContextMenu ()
 Hide the system edit menu if visible.
void updateRenderSurface (float width, float height, uint8_t updateFlag)
 Updates the render surface size (framebuffer/render target) and synchronizes related view parameters.
void setSceneCompositor (std::unique_ptr< SceneCompositor > &&compositor)
 Replaces the active scene compositor.
Public Member Functions inherited from Object
void retain ()
 Retains the ownership.
void release ()
 Releases the ownership immediately.
Object * autorelease ()
 Releases the ownership sometime soon automatically.
unsigned int getReferenceCount () const
 Returns the Object's current reference count.
uint64_t getObjectID () const noexcept
 Returns the process-local diagnostic identifier assigned at construction.
virtual ~Object ()
 Destructor.

Detailed Description

Core render view abstraction for window/surface state and scene presentation.

RenderViewCore owns the active SceneCompositor, tracks window and render surface sizes, maintains design-resolution viewport mapping, and forwards scene rendering, scissor operations, and per-frame event polling to the active compositor.

Platform subclasses provide native window/event/swapchain behavior.

Member Function Documentation

◆ end()

virtual void end ( )
pure virtual

Force destroying EGL view, subclass must implement this method.

@lua endToLua

◆ setIMEKeyboardState()

virtual void setIMEKeyboardState ( bool open)
pure virtual

Open or close IME keyboard , subclass must implement this method.

Parameters
openOpen or close IME keyboard.

◆ windowShouldClose()

virtual bool windowShouldClose ( )
inlinevirtual

When the window is closed, it will return false if the platforms is Ios or Android.

If the platforms is windows or Mac,it will return true.

Returns
In ios and android it will return false,if in windows or Mac it will return true.

◆ pollEvents()

void pollEvents ( )

Polls compositor-managed events before scheduler update.

The active SceneCompositor decides how native platform events and optional runtime events are polled. The default compositor forwards to pollNativeEvents().

◆ getWindowSize()

const Vec2 & getWindowSize ( ) const
inline

Get the zoomed window size In general, it returns the screen size since the view is a fullscreen view.

Returns
The window size (aka logic size)

◆ setWindowSize()

virtual void setWindowSize ( float ,
float  )
inlinevirtual

Set the zoomed window size.

Parameters
widthThe width of the fram size.
heightThe height of the fram size.

◆ setWindowZoomFactor()

virtual void setWindowZoomFactor ( float )
inlinevirtual

Set zoom factor for frame.

This methods are for debugging big resolution (e.g.new ipad) app on desktop.

Parameters
zoomFactorThe zoom factor for frame.

◆ getWindowZoomFactor()

virtual float getWindowZoomFactor ( ) const
inlinevirtual

Get zoom factor for frame.

This methods are for debugging big resolution (e.g.new ipad) app on desktop.

Returns
The zoom factor for frame.

◆ setCursorVisible()

virtual void setCursorVisible ( bool )
inlinevirtual

Hide or Show the mouse cursor if there is one.

Parameters
isVisibleHide or Show the mouse cursor if there is one.

◆ getRenderScale()

float getRenderScale ( ) const
inline

Get axmol render scale.

Returns
The render scale fbSize/windowSize aka backing scale factor

Notes:

  • On mobile platforms, this value is always 1.0f (no DPI scaling).
  • On PC platforms, when renderScaleMode == Physical, this value usually reflects the monitor's DPI scaling factor (e.g. Windows HiDPI).

◆ getVisibleSize()

virtual Vec2 getVisibleSize ( ) const
virtual

Get the visible area size of render viewport.

Returns
The visible area size of render viewport.

◆ getVisibleOrigin()

virtual Vec2 getVisibleOrigin ( ) const
virtual

Get the visible origin point of render viewport.

Returns
The visible origin point of render viewport.

◆ getVisibleRect()

virtual Rect getVisibleRect ( ) const
virtual

Get the visible rectangle of render viewport.

Returns
The visible rectangle of render viewport.

◆ setDesignResolutionSize()

virtual void setDesignResolutionSize ( float width,
float height,
ResolutionPolicy resolutionPolicy )
virtual

Set the design resolution size.

Parameters
widthDesign resolution width.
heightDesign resolution height.
resolutionPolicyThe resolution policy desired, you may choose: [1] EXACT_FIT Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched. [2] NO_BORDER Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut. [3] SHOW_ALL Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown.
Remarks
For applications with a static design resolution, this method should typically be called only once during initialization.

◆ getDesignResolutionSize()

virtual const Vec2 & getDesignResolutionSize ( ) const
virtual

Get design resolution size.

Default resolution size is the same as 'getWindowSize'.

Returns
The design resolution size.

◆ setViewportInPoints()

virtual void setViewportInPoints ( float x,
float y,
float w,
float h )
virtual

Set render view port rectangle with points.

Parameters
xSet the points of x.
ySet the points of y.
wSet the width of the view port
hSet the Height of the view port.

◆ setScissorInPoints()

virtual void setScissorInPoints ( float x,
float y,
float w,
float h )
virtual

Set Scissor rectangle with points.

Parameters
xSet the points of x.
ySet the points of y.
wSet the width of the view port
hSet the Height of the view port.

◆ isScissorEnabled()

virtual bool isScissorEnabled ( )
virtual

Get whether GL_SCISSOR_TEST is enable.

Returns
Whether GL_SCISSOR_TEST is enable.

◆ getScissorInPoints()

virtual Rect getScissorInPoints ( ) const
virtual

Get the current scissor rectangle.

Returns
The current scissor rectangle.

◆ getViewName()

std::string_view getViewName ( ) const

Get the view name.

Returns
The view name.

◆ setIcon() [1/2]

virtual void setIcon ( std::string_view ) const
inlinevirtual

Set window icon (implemented for windows and linux).

Parameters
filenameA path to image file, e.g., "icons/cusom.png".

◆ setIcon() [2/2]

virtual void setIcon ( std::span< const std::string_view > ) const
inlinevirtual

Set window icon (implemented for windows and linux).

Best icon (based on size) will be auto selected.

Parameters
filelistThe array contains icons.

◆ setDefaultIcon()

virtual void setDefaultIcon ( ) const
inlinevirtual

Set default window icon (implemented for windows and linux).

On windows it will use icon from .exe file (if included). On linux it will use default window icon.

◆ getViewportRect()

const Rect & getViewportRect ( ) const

Get the render view port rectangle.

Returns
Return the render view port rectangle.

◆ getScaleX()

float getScaleX ( ) const
inline

Get scale factor of the horizontal direction.

Returns
Scale factor of the horizontal direction.

◆ getScaleY()

float getScaleY ( ) const
inline

Get scale factor of the vertical direction.

Returns
Scale factor of the vertical direction.

◆ getResolutionPolicy()

ResolutionPolicy getResolutionPolicy ( ) const
inline

Returns the current Resolution policy.

Returns
The current Resolution policy.

◆ getNativeWindow()

virtual void * getNativeWindow ( ) const
inlinevirtual

Get the Native Window object.

Returns
void* win32: HWND winrt: PresentTarget* linux: x11 or wayland window macOS: NSWindow* iOS: UIWindow*

◆ getNativeDisplay()

virtual SurfaceHandle getNativeDisplay ( ) const
inlinevirtual

Get the Native Display object.

Returns
void* linux: x11 or wayland display macOS: NSGLContext* iOS/tvOS: EARenderViewBase*

◆ getWindowPlatform()

virtual WindowPlatform getWindowPlatform ( ) const
inlinevirtual

Get the Window Platform object.

Returns
WindowPlatform

◆ showContextMenu()

virtual void showContextMenu ( const Vec2 & ,
bool hasText,
bool hasSelection,
bool readOnly )
inlinevirtual

Show the system edit menu (Copy/Cut/Paste) at the given point.

The point is specified in screen coordinates (engine pixels), not platform view points. Callers that have platform view coordinates must convert by dividing by the view's content scale factor before calling.

This method must be called on the main/UI thread. Implementations should present the platform's standard edit menu at the requested location and route menu actions back to the engine (e.g. via InputSystem).

Note
Currently implemented only on iOS. On other platforms this method may be a no-op until a platform-specific implementation is provided.
Parameters
screenPointTarget location in screen coordinates.
hasSelectionWhether there is a text selection.
hasTextWhether the input field has text.
readOnlyWhether the current input field is read-only

◆ hideContextMenu()

virtual void hideContextMenu ( )
inlinevirtual

Hide the system edit menu if visible.

Must be safe to call on the main/UI thread. Implementations should dismiss any visible system edit menu.

Note
Currently implemented only on iOS. On other platforms this method may be a no-op until a platform-specific implementation is provided.

◆ updateRenderSurface()

void updateRenderSurface ( float width,
float height,
uint8_t updateFlag )

Updates the render surface size (framebuffer/render target) and synchronizes related view parameters.

This method performs the following actions:

  • Sets _renderSize to the specified dimensions;
  • On mobile platforms (Android/iOS), _windowSize is synchronized to match _renderSize;
  • On desktop platforms, _windowSize is only initialized to _renderSize if it hasn't been set yet;
  • If _designResolutionSize is unset (Vec2::zero), it is initialized to _renderSize;
  • Calls updateDesignResolution() to recalculate _viewScale and _viewportRect based on the current ResolutionPolicy, and updates the Director's canvas size and projection matrix accordingly.
Parameters
widthThe target width of the render surface. Its meaning depends on updateFlag: it may represent the framebuffer width, logical window width, or design resolution width.
heightThe target height of the render surface. Its meaning depends on updateFlag: it may represent the framebuffer height, logical window height, or design resolution height.
updateFlagOptional flags to control which parts of the view should be updated. Defaults to SurfaceUpdateFlag::AllUpdates.
Warning
This method may initialize _windowSize and _designResolutionSize on first invocation.
Note
No update will occur if the given size is (0, 0).

◆ setSceneCompositor()

void setSceneCompositor ( std::unique_ptr< SceneCompositor > && compositor)

Replaces the active scene compositor.

Pass nullptr to restore the default SceneCompositor. The new compositor is immediately bound to this RenderViewCore via SceneCompositor::onRenderViewChanged(). The previous compositor is destroyed synchronously.

Parameters
compositorNew compositor, or nullptr for the default compositor.
Note
The default compositor renders all visible cameras in the scene. VRSceneCompositor provides the product OpenXR path, while preview compositors may provide non-runtime stereo rendering.

The documentation for this class was generated from the following file:
  • RenderViewCore.h