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.
Gui Gui#
The gui instance associated with the object.
string MeshPath#
The path to the source .mesh-file used for the object.
bool IsMeshLoadedVRAM#
The value indicating if the source mesh used for the object is loaded to video memory (VRAM).
bool IsMeshLoadedRAM#
The value indicating if the source mesh used for the object is loaded to memory (RAM).
bool IsMeshNull#
The value indicating if the source mesh used for the object is null (does not exist, unassigned, not loaded, etc.).
bool MeshProceduralMode#
The 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.
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 SetMouse ( vec3 p0, vec3 p1, int mouse_buttons, bool 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.
- bool 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.
static int type ( ) #
Returns the type identifier of ObjectMeshStatic.Return value
ObjectMeshStatic type identifier.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).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).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.bool 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).Loading to VRAM must be performed in the main thread only.
Return value
true if the mesh is loaded successfully, otherwise false. If the mesh is already loaded to VRAM, true will be returned.bool 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
true if the mesh is loaded successfully, otherwise false. If the mesh is already loaded to RAM, true will be returned.bool LoadForceVRAM ( ) #
Performs force-loading of the mesh to video memory (VRAM) immediately. The forced loading to VRAM is performed in the main thread.Loading to VRAM must be performed in the main thread only.
Return value
true if the mesh is loaded successfully, otherwise false. If the mesh is already loaded to VRAM, true will be returned.bool LoadForceRAM ( ) #
Performs force-loading of the mesh to memory (RAM) immediately.Return value
true if the mesh is loaded successfully, otherwise false. If the mesh is already loaded to RAM, true will be returned.bool 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.bool 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.bool ApplyMeshProcedural ( Mesh mesh ) #
Sets the specified mesh as the source mesh for the object. The object must be in the procedural mesh mode.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.
ObjectGuiMesh my_gui_mesh;
// ...
// switch the object to procedural mesh mode
my_gui_mesh.MeshProceduralMode = true;
// update the source mesh of the "my_gui_mesh" object via the source_mesh instance
my_gui_mesh.ApplyMeshProcedural(source_mesh);
Arguments
- Mesh mesh - Mesh to be applied.
Last update:
2024-11-06
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)