This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

ObjectGuiMesh Class

Warning
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScipt (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
Inherits: Object

This class allows for rendering GUI onto an arbitrary mesh. Unlike ObjectGui, it can be used to create non-flat displays positioned in the world. If the mesh contains several surfaces, the same GUI will be rendered on each of them. Note that the GUI will be rendered according to the UV mapping of surfaces.

See Also#

A UnigineScript API sample <UnigineSDK>/data/samples/objects/gui_01

ObjectGuiMesh Class

Members


static ObjectGuiMesh ( string mesh_name, variable v, string path = 0, int unique = 0 ) #

An ObjectGuiMesh constructor. The ObjectGuiMesh will be created on the basis of the specified mesh.

Arguments

  • string mesh_name - Path to the mesh file.
  • variable v - A variable of one of the following types:
    • Mesh mesh - The source mesh.
    • string name - The path to the .mesh file.
  • string path - Name of the new GUI mesh.
  • int unique - When you create several objects out of a single .mesh file, the instance of the mesh geometry is created. If you then change the source geometry, its instances will be changed as well. To avoid this, set the unique flag to 1, so a copy of the mesh geometry will be created and changes won't be applied.
    Notice
    This argument is available only if the first argument is string.

void setControlDistance ( float distance ) #

Sets a distance, at which the GUI becomes controllable.

Arguments

  • float distance - New distance in units. If a negative value is provided, 0 will be used instead.

float getControlDistance ( ) #

Returns the distance, at which the GUI becomes controllable.

Return value

Distance in units.

Gui getGui ( ) #

Returns a Gui instance associated with the object. This function is used when assigning a widget to the GUI mesh.
Notice
When you create an instance of the ObjectGuiMesh class, it is automatically associated with a Gui instance.

Return value

GUI associated with the object.

int setMesh ( Mesh mesh ) #

Copies the source mesh into the current mesh.
Source code (UnigineScript)
// create ObjectGuiMesh instances 
ObjectGuiMesh guiMesh = new ObjectGuiMesh("gui.mesh");
ObjectGuiMesh guiMesh_2 = new ObjectGuiMesh("gui_2.mesh");

// create a Mesh instance
Mesh firstMesh = new Mesh();

// get the mesh of the ObjectGuiMesh and copy it to the Mesh class instance
guiMesh.getMesh(firstMesh);

// put the firstMesh mesh to the guiMesh_2 instance
guiMesh_2.setMesh(firstMesh);

Arguments

  • Mesh mesh - The source mesh to be copied.

Return value

1 if the mesh is copied successfully; otherwise, 0.

int getMesh ( Mesh mesh ) #

Copies the current mesh into the source mesh passed as an argument. For example, you can obtain geometry of the gui mesh and then change it:
Source code (UnigineScript)
// a gui mesh from which geometry will be obtained
ObjectGuiMesh guiMesh = new ObjectGuiMesh("gui.mesh");
// create a new mesh
Mesh mesh = new Mesh();
// copy geometry to the created mesh
if (guiMesh.getMesh(mesh)) {
	// do something with the obtained mesh
}
else {
	log.error("Failed to copy a mesh\n");
}

Arguments

  • Mesh mesh - Source mesh.

Return value

1 if the mesh is copied successfully.

void setMeshName ( string name ) #

Sets the new name for the mesh.

Arguments

  • string name - Name to be set for the mesh.

string getMeshName ( ) #

Returns the name of the mesh.

Return value

Name of the mesh.

void setMouse ( Vec3 p0, Vec3 p1, int mouse_button, int mouse_show ) #

Sets mouse cursor position in the virtual control mode.

Arguments

  • Vec3 p0 - Start point. A line segment between the start and the end points must intersect ObjectGui. The point of intersection determines x and y coordinates on the ObjectGui.
  • Vec3 p1 - End point. A line segment between the start and the end points must intersect ObjectGui. The point of intersection determines x and y coordinates on the ObjectGui.
  • int mouse_button - Mouse button status. Set 1 to indicate that the button is clicked; otherwise, 0.
  • int mouse_show - Mouse cursor status. Set 1 to show mouse cursor; otherwise, 0.

void setMouseMode ( int mode ) #

Sets mouse mode. This method can be used to set a virtual control mode for the mouse.

Arguments

  • int mode - Mouse mode. One of the MOUSE_* variables.

int getMouseMode ( ) #

Returns the current mouse mode.

Return value

Mouse mode. One of the MOUSE_* variables.

void setMouseShow ( int show ) #

Sets a value indicating if the mouse cursor should be rendered in the mesh GUI object.

Arguments

  • int show - Positive number to render the mouse cursor; otherwise, 0.

int getMouseShow ( ) #

Returns a value indicating if the mouse cursor is rendered in the mesh GUI object.

Return value

1 if the cursor is rendered; otherwise, 0.

int getScreenHeight ( ) #

Returns the screen height of the mesh GUI object.

Return value

Height in pixels.

void setScreenSize ( int width, int height ) #

Sets screen dimensions of the mesh GUI object.

Arguments

  • int width - New width in pixels. If a negative value is provided, 0 will be used instead.
  • int height - New height in pixels. If a negative value is provided, 0 will be used instead.

int getScreenWidth ( ) #

Returns the screen width of the mesh GUI object.

Return value

Width in pixels.

int createMesh ( string path, int unique = 0 ) #

Creates the GUI mesh with the specified parameters.

Arguments

  • string path - Path to the *.mesh file.
  • int unique - Dynamic flag:
    • 0 - If the mesh vertices are changed in run-time, meshes loaded from the same file will be also changed.
    • 1 - If the mesh vertices are changed in run-time, meshes loaded from the same file won't be changed.

Return value

1 if the mesh is created successfully; otherwise - 0.

void flushMesh ( ) #

Flushes the mesh geometry into the video memory.

int loadMesh ( string path ) #

Loads a new mesh instead of the current mesh from the .mesh file. This function doesn't change the mesh name.

Arguments

  • string path - The path to the .mesh file.

Return value

1 if the mesh is loaded successfully; otherwise, 0.

int saveMesh ( string path ) #

Saves the mesh into the .mesh format.

Arguments

  • string path - The path to the file.

Return value

1 if the mesh is saved successfully; otherwise, 0.
Last update: 2020-07-31
Build: ()