Editor API
UnigineEditor public API
UnigineEditor::ViewportWindow Class Reference

This class is used to manage viewport windows in the Editor. More...

Inherits APIInterface.

Public Member Functions

void show ()
 Shows the viewport window. More...
 
void hide ()
 Hides the viewport window. More...
 
const char * getName () const
 Returns the name of the viewport window. More...
 
void setPlayer (const Unigine::Ptr< Unigine::Player > &player)
 Sets a new main player (camera) whose current view is to be rendered to the viewport window. More...
 
Unigine::Ptr< Unigine::Player > getPlayer () const
 Returns a new main player (camera) whose current view is to be rendered to the viewport window. More...
 
Unigine::Ptr< Unigine::Viewport > getViewport () const
 Returns the Engine Viewport instance for the viewport window. More...
 
Unigine::Ptr< Unigine::Gui > getGui () const
 Returns the Gui instance for the viewport window. You can use it to add and manage your UI elements. More...
 
int getMousePosX () const
 Returns the X coordinate of the mouse position relative to the viewport window. While the mouse cursor is within the window the coordinate is in the [0, getWidth() - 1] range, otherwise the value can be negative or greater than window width (depending on the mouse cursor position relative to the window). More...
 
int getMousePosY () const
 Returns the Y coordinate of the mouse position relative to the viewport window. While the mouse cursor is within the window the coordinate is in the [0, getHeight() - 1] range, otherwise the value can be negative or greater than window height (depending on the mouse cursor position relative to the window). More...
 
Unigine::Math::ivec2 getMousePos () const
 Returns the coordinates of the mouse position relative to the viewport window. Coordinates are returned as a two-component vector (X, Y). While the mouse cursor is within the window the coordinates are within the following ranges: X - [0, getWidth() - 1]; Y - [0, getHeight() - 1]. Otherwise the values can be negative or greater than window height and width (depending on the mouse cursor position relative to the window). More...
 
int getWidth () const
 Returns the current width (in pixels) of the viewport window. More...
 
int getHeight () const
 Returns the current height (in pixels) of the viewport window. More...
 
Unigine::Math::ivec2 getSize () const
 Returns the current size of the viewport window. The value is returned as a two-component vector (Width, Height). More...
 
void focusOnNode (const Unigine::Ptr< Unigine::Node > &node)
 Sets the camera focus for the viewport window on the specified node. More...
 
void focusOnNodeList (const Unigine::Vector< Unigine::Ptr< Unigine::Node >> &nodes)
 Sets the camera focus for the viewport window on the specified nodes (the viewport will be adjusted to display all the specified nodes). More...
 
void focusOnNodeBoundBased (const Unigine::Ptr< Unigine::Node > &node)
 Sets the current camera focus for the viewport window on the specified node based on its bounds (the viewport will be adjusted to display the specified node with its bounds). More...
 
void focusOnNodeListBoundBased (const Unigine::Vector< Unigine::Ptr< Unigine::Node >> &nodes)
 Sets the current camera focus for the viewport window on the specified nodes based on their bounds (the viewport will be adjusted to display the specified nodes with their bounds). More...
 
void focusOnSurface (const Unigine::Ptr< Unigine::Object > &object, int surface)
 Sets the camera focus for the viewport window on the specified surface of the specified object (the viewport will be adjusted to display the specified surface). More...
 
void focusOnSurfaceList (const Unigine::Ptr< Unigine::Object > &object, const Unigine::Vector< int > &surfaces)
 Sets the camera focus for the viewport window on the specified surfaces of the specified object (the viewport will be adjusted to display all the specified surfaces). More...
 
void focusOnCenter (const Unigine::Math::Vec3 &center, float radius)
 Sets the camera focus for the viewport window on an imaginary sphere with the specified center point and radius. More...
 

Detailed Description

This class is used to manage viewport windows in the Editor.

Member Function Documentation

◆ focusOnCenter()

void UnigineEditor::ViewportWindow::focusOnCenter ( const Unigine::Math::Vec3 &  center,
float  radius 
)

Sets the camera focus for the viewport window on an imaginary sphere with the specified center point and radius.

Parameters
centerCoordinates of the center of an imaginary sphere to be focused on.
radiusRadius of an imaginary sphere to be focused on.

◆ focusOnNode()

void UnigineEditor::ViewportWindow::focusOnNode ( const Unigine::Ptr< Unigine::Node > &  node)

Sets the camera focus for the viewport window on the specified node.

Parameters
nodeNode to be focused on.

◆ focusOnNodeBoundBased()

void UnigineEditor::ViewportWindow::focusOnNodeBoundBased ( const Unigine::Ptr< Unigine::Node > &  node)

Sets the current camera focus for the viewport window on the specified node based on its bounds (the viewport will be adjusted to display the specified node with its bounds).

Parameters
nodeNode to be focused on.

◆ focusOnNodeList()

void UnigineEditor::ViewportWindow::focusOnNodeList ( const Unigine::Vector< Unigine::Ptr< Unigine::Node >> &  nodes)

Sets the camera focus for the viewport window on the specified nodes (the viewport will be adjusted to display all the specified nodes).

Parameters
nodesVector containing nodes to be focused on.

◆ focusOnNodeListBoundBased()

void UnigineEditor::ViewportWindow::focusOnNodeListBoundBased ( const Unigine::Vector< Unigine::Ptr< Unigine::Node >> &  nodes)

Sets the current camera focus for the viewport window on the specified nodes based on their bounds (the viewport will be adjusted to display the specified nodes with their bounds).

Parameters
nodesList of nodes to be focused on.

◆ focusOnSurface()

void UnigineEditor::ViewportWindow::focusOnSurface ( const Unigine::Ptr< Unigine::Object > &  object,
int  surface 
)

Sets the camera focus for the viewport window on the specified surface of the specified object (the viewport will be adjusted to display the specified surface).

Parameters
objectObject to be focused on.
surfaceThe number of the surface of the specified object to be focused on.

◆ focusOnSurfaceList()

void UnigineEditor::ViewportWindow::focusOnSurfaceList ( const Unigine::Ptr< Unigine::Object > &  object,
const Unigine::Vector< int > &  surfaces 
)

Sets the camera focus for the viewport window on the specified surfaces of the specified object (the viewport will be adjusted to display all the specified surfaces).

Parameters
objectObject to be focused on.
surfacesVector containing the numbers of surfaces of the specified object to be focused on.

◆ getGui()

Unigine::Ptr<Unigine::Gui> UnigineEditor::ViewportWindow::getGui ( ) const

Returns the Gui instance for the viewport window. You can use it to add and manage your UI elements.

◆ getHeight()

int UnigineEditor::ViewportWindow::getHeight ( ) const

Returns the current height (in pixels) of the viewport window.

◆ getMousePos()

Unigine::Math::ivec2 UnigineEditor::ViewportWindow::getMousePos ( ) const

Returns the coordinates of the mouse position relative to the viewport window. Coordinates are returned as a two-component vector (X, Y). While the mouse cursor is within the window the coordinates are within the following ranges: X - [0, getWidth() - 1]; Y - [0, getHeight() - 1]. Otherwise the values can be negative or greater than window height and width (depending on the mouse cursor position relative to the window).

◆ getMousePosX()

int UnigineEditor::ViewportWindow::getMousePosX ( ) const

Returns the X coordinate of the mouse position relative to the viewport window. While the mouse cursor is within the window the coordinate is in the [0, getWidth() - 1] range, otherwise the value can be negative or greater than window width (depending on the mouse cursor position relative to the window).

◆ getMousePosY()

int UnigineEditor::ViewportWindow::getMousePosY ( ) const

Returns the Y coordinate of the mouse position relative to the viewport window. While the mouse cursor is within the window the coordinate is in the [0, getHeight() - 1] range, otherwise the value can be negative or greater than window height (depending on the mouse cursor position relative to the window).

◆ getName()

const char* UnigineEditor::ViewportWindow::getName ( ) const

Returns the name of the viewport window.

◆ getPlayer()

Unigine::Ptr<Unigine::Player> UnigineEditor::ViewportWindow::getPlayer ( ) const

Returns a new main player (camera) whose current view is to be rendered to the viewport window.

◆ getSize()

Unigine::Math::ivec2 UnigineEditor::ViewportWindow::getSize ( ) const

Returns the current size of the viewport window. The value is returned as a two-component vector (Width, Height).

◆ getViewport()

Unigine::Ptr<Unigine::Viewport> UnigineEditor::ViewportWindow::getViewport ( ) const

Returns the Engine Viewport instance for the viewport window.

◆ getWidth()

int UnigineEditor::ViewportWindow::getWidth ( ) const

Returns the current width (in pixels) of the viewport window.

◆ hide()

void UnigineEditor::ViewportWindow::hide ( )

Hides the viewport window.

◆ setPlayer()

void UnigineEditor::ViewportWindow::setPlayer ( const Unigine::Ptr< Unigine::Player > &  player)

Sets a new main player (camera) whose current view is to be rendered to the viewport window.

Parameters
playerPlayer to be used as the main camera for the viewport window.

◆ show()

void UnigineEditor::ViewportWindow::show ( )

Shows the viewport window.