Unigine.ObjectGuiMesh Class
Inherits from: | 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
Properties
int ScreenHeight#
The screen height of the mesh GUI object.
int ScreenWidth#
The screen width of the mesh gui object.
float ControlDistance#
The distance at which the GUI becomes controllable.
int MouseMode#
The current mouse mode.
bool MouseShow#
The value indicating if the mouse cursor is rendered in the mesh GUI object.
bool Background#
The value indicating if gui background (black screen) is rendered.
string MeshName#
The mesh name.
Gui Gui#
The A gui instance associated with the object.
Members
ObjectGuiMesh ( Mesh mesh, string path = 0 ) #
ObjectGuiMesh constructor. Creates a new GUI mesh from a given file.Arguments
- Mesh mesh - Source Mesh to be used.
- string path - A name of a new GUI mesh.
ObjectGuiMesh ( string mesh_name, string path = 0, bool unique = false ) #
An ObjectGuiMesh constructor. The ObjectGuiMesh will be created on the basis of the specified mesh.Arguments
- string mesh_name - Path to the .mesh file.
- string path - Name of the new GUI mesh.
- bool 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.
This argument is available only if the first argument is string.
int SetMesh ( Mesh mesh ) #
Copies the source mesh into the current mesh.// 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:// 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) == 1) {
// 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; otherwise, 0.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 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 CreateMesh ( string path, bool unique = 0 ) #
Creates the GUI mesh with the specified parameters.Arguments
- string path - Path to the *.mesh file.
- bool unique - Dynamic flag:
- false - If the mesh vertices are changed in run-time, meshes loaded from the same file will be also changed.
- true - If the mesh vertices are changed in run-time, meshes loaded from the same file won't be changed
Return value
true if the mesh is created successfully; otherwise, false.void FlushMesh ( ) #
Flushes the mesh geometry into the video memory.int LoadMesh ( string path ) #
Loads a mesh file.Arguments
- string path - 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 - Path to the .mesh file.
Return value
1 if the mesh is saved successfully; otherwise, 0.static int type ( ) #
Returns the type identifier of ObjectMeshStatic.Return value
ObjectMeshStatic type identifier.Last update:
2022-12-14
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)