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 UnigineScript (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
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
Members
ObjectGuiMesh ( string mesh_path, string name = 0 ) #
An ObjectGuiMesh constructor. The Gui Mesh will be created on the basis of the mesh loaded from the specified path.Arguments
- string mesh_path - Path to the source .mesh-file used for the object
- string name
ObjectGuiMesh ( ) #
Constructor. Creates a new Gui Mesh object.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.void setMeshPath ( string path ) #
Sets a new path to the source mesh for the Gui Mesh object. If the mesh is in the procedural mode, it will be reset.Notice
The mesh should contain a single surface. In case if the mesh contains several surfaces, only the one with the 0 index will be used.
Arguments
- string path - New path to the source .mesh-file to be set.
string getMeshPath ( ) #
Returns the path to the source .mesh-file currently used for the Gui Mesh object.Return value
Path to the source .mesh-file.void setMouse ( Vec3 p0, Vec3 p1, int mouse_buttons, 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_buttons - 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 - 1 to render the mouse cursor; otherwise, 0.
int isMouseShow ( ) #
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.void setBackground ( int background ) #
Sets a value indicating if the GUI background (black screen) should be rendered.Arguments
- int background - 1 to render GUI background, 0 to keep it transparent.
int isBackground ( ) #
Returns a value indicating if GUI background (black screen) is rendered.Return value
1 if background 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.Mesh getMeshCurrentRAM ( ) #
Returns the current source mesh used for the object and loaded to memory (RAM).Return value
A current source mesh used for the object.MeshRender getMeshCurrentVRAM ( ) #
Returns the current render mesh used for the object and loaded to video memory (VRAM).Return value
A current render mesh used for the object.Mesh getMeshForceRAM ( ) #
Returns the source mesh used for the object and loads it to memory (RAM) immediately.Return value
A source mesh used for the object.MeshRender getMeshForceVRAM ( ) #
Returns the render mesh used for the object and loads it to video memory (VRAM) immediately. At that, the static mesh will also be loaded to memory (RAM).Notice
Loading to VRAM must be performed in the main thread only.
Return value
A render mesh used for the object.Mesh getMeshAsyncRAM ( ) #
Returns the source mesh used for the object and loads it to memory (RAM) asynchronously.Return value
A source mesh used for the object.MeshRender getMeshAsyncVRAM ( ) #
Returns the render mesh used for the object and loads it to video memory (VRAM) asynchronously. At that, the static mesh will also be loaded to memory (RAM).Notice
Loading to VRAM must be performed in the main thread only.
Return value
A render mesh used for the object.Mesh getMeshProceduralRAM ( ) #
Returns the procedural source mesh used for the object and loads it to memory (RAM) using the specific streaming mode for procedural meshes. A procedural mesh is a mesh created via code, such meshes have a specific streaming mode — they are always kept in memory after creation and never unloaded until the object is destroyed via code or the mesh returns to its normal mode (streaming from a source file). Changing of the static mesh is possible only if it is in the procedural mode.Return value
A procedural source mesh used for the object.MeshRender getMeshProceduralVRAM ( ) #
Returns the procedural render mesh used for the object and loads it to video memory (VRAM) using the specific streaming mode for procedural meshes. A procedural mesh is a mesh created via code, such meshes have a specific streaming mode — they are always kept in memory after creation and never unloaded until the object is destroyed via code or the mesh returns to its normal mode (streaming from a source file). Changing of the static mesh is possible only if it is in the procedural mode.Return value
A procedural render mesh used for the object.int loadAsyncVRAM ( ) #
Asynchronously loads the mesh to video memory (VRAM) if the async streaming mode for meshes is enabled. Otherwise, the forced loading is performed. This method is recommended for implementing your own prefetch system (i.e. asynchronous pre-loading of meshes to video memory before they are used).Notice
Loading to VRAM must be performed in the main thread only.
Return value
1 if the mesh is loaded successfully, otherwise 0. If the mesh is already loaded to VRAM, 1 will be returned.int loadAsyncRAM ( ) #
Asynchronously loads the mesh to memory (RAM) if the async streaming mode for meshes is enabled. Otherwise, the forced loading is performed. This method is recommended for implementing your own prefetch system (i.e. asynchronous pre-loading of meshes to memory before they are used).Return value
1 if the mesh is loaded successfully, otherwise 0. If the mesh is already loaded to RAM, 1 will be returned.int loadForceVRAM ( ) #
Performs force-loading of the mesh to video memory (VRAM) immediately. The forced loading to VRAM is performed in the main thread.Notice
Loading to VRAM must be performed in the main thread only.
Return value
1 if the mesh is loaded successfully, otherwise 0. If the mesh is already loaded to VRAM, 1 will be returned.int loadForceRAM ( ) #
Performs force-loading of the mesh to memory (RAM) immediately.Return value
1 if the mesh is loaded successfully, otherwise 0. If the mesh is already loaded to RAM, 1 will be returned.int asyncCalculateNodes ( int surface ) #
Asynchronously calculates the mesh surface internal spatial tree used for quick calculation of collisions and intersections. This method is recommended for implementing your own prefetch system (i.e. asynchronous pre-loading of meshes to memory before they are used).Arguments
- int surface - Mesh surface number.
Return value
true if the internal tree is calculated successfully; otherwise, false.int asyncCalculateEdges ( int surface ) #
Asynchronously calculates the edges of the mesh surface geometry. This method is recommended for implementing your own prefetch system (i.e. asynchronous pre-loading of meshes to memory before they are used).Arguments
- int surface - Mesh surface number.
Return value
true if the edges are calculated successfully; otherwise, false.int applyMeshProcedural ( Mesh mesh ) #
Sets the specified mesh as the source mesh for the object. The object must be in the procedural mesh mode.Notice
The mesh should contain a single surface. In case if the mesh contains several surfaces, only the one with the 0 index will be used. Thus, the area of the decal will differ from the initial mesh.
Arguments
- Mesh mesh - Mesh to be applied.
void setMeshProceduralMode ( int meshproceduralmode ) #
Sets a value indicating if the source mesh used for the object is procedural. A procedural mesh is a mesh created via code, such meshes have a specific streaming mode - they are always kept in memory after creation and never unloaded until the object is destroyed via code or the mesh returns to its normal mode (streaming from a source file). Changing of the static mesh is possible only if it is in the procedural mode.Arguments
- int meshproceduralmode - 1 to switch the source mesh used for the object to procedural mode; otherwise, 0 - normal mode (the source mesh is streamed from a source file).
int isMeshProceduralMode ( ) #
Returns a value indicating if the source mesh used for the object is procedural. A procedural mesh is a mesh created via code, such meshes have a specific streaming mode - they are always kept in memory after creation and never unloaded until the object is destroyed via code or the mesh returns to its normal mode (streaming from a source file). Changing of the static mesh is possible only if it is in the procedural mode.Return value
1 if the source mesh used for the object is procedural; otherwise, 0 - normal mode (the source mesh is streamed from a source file).int isMeshNull ( ) #
Returns a value indicating if the source mesh used for the object is null (does not exist, unassigned, not loaded, etc.).Return value
1 if the source mesh used for the object is null; otherwise, 0.int isMeshLoadedRAM ( ) #
Returns a value indicating if the source mesh used for the object is loaded to memory (RAM).Return value
1 if the source mesh used for the object is loaded to RAM; otherwise, 0.int isMeshLoadedVRAM ( ) #
Returns a value indicating if the source mesh used for the object is loaded to video memory (VRAM).Return value
1 if the source mesh used for the object is loaded to VRAM; otherwise, 0.The information on this page is valid for UNIGINE 2.20 SDK.
Last update:
2024-11-06
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)