This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
Extending Editor Functionality
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
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
创建内容
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::ObjectGuiMesh Class

Header: #include <UnigineObjects.h>
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


static ObjectGuiMeshPtr create ( const Ptr<Mesh> & mesh, const char * path = 0 ) #

ObjectGuiMesh constructor. Creates a new GUI mesh from a given file.

Arguments

  • const Ptr<Mesh> & mesh - A mesh smart pointer.
  • const char * path - A name of a new GUI mesh.

static ObjectGuiMeshPtr create ( const char * mesh_name, const char * path = 0, int unique = 0 ) #

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

Arguments

  • const char * mesh_name - Path to the mesh file.
  • const char * 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 - A new distance in units.

float getControlDistance ( ) const#

Returns the distance at which the GUI becomes controllable.

Return value

The distance in units.

Ptr<Gui> getGui ( ) const#

Returns a Gui instance associated with the object.

Return value

Gui smart pointer.

int setMesh ( const Ptr<Mesh> & mesh ) #

Copies the source mesh into the current mesh.
Source code (C++)
// create ObjectGuiMesh instances 
ObjectGuiMeshPtr guiMesh = ObjectGuiMesh::create("gui.mesh");
ObjectGuiMeshPtr guiMesh_2 = ObjectGuiMesh::create("gui_2.mesh");

// create a Mesh instance
MeshPtr firstMesh = Mesh::create();

// 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

  • const Ptr<Mesh> & mesh - Pointer to the source mesh that must be copied.

Return value

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

int getMesh ( const Ptr<Mesh> & mesh ) const#

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 (C++)
// a gui mesh from which geometry will be obtained
ObjectGuiMeshPtr guiMesh = ObjectGuiMesh::create("gui.mesh");
// create a new mesh
MeshPtr mesh = Mesh::create();
// 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

  • const Ptr<Mesh> & mesh - Pointer to the source mesh.

Return value

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

void setMeshName ( const char * name ) #

Sets a new mesh name.

Arguments

  • const char * name - Name to be set for the mesh.

const char * getMeshName ( ) const#

Returns the mesh name.

Return value

Mesh name.

void setMouse ( const Math::Vec3 & p0, const Math::Vec3 & p1, int mouse_button, int mouse_show ) #

Sets mouse cursor position in the virtual control mode.

Arguments

  • const Math::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.
  • const Math::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 ( ) const#

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 getMouseShow ( ) const#

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 ( ) const#

Returns the screen height of the mesh GUI object.

Return value

The height in pixels.

void setScreenSize ( int width, int height ) #

Sets screen dimensions of the mesh GUI object.

Arguments

  • int width - A new width in pixels.
  • int height - A new height in pixels.

int getScreenWidth ( ) const#

Returns the screen width of the mesh GUI object.

Return value

The width in pixels.

int createMesh ( const char * path, bool unique = 0 ) #

Creates the GUI mesh with the specified parameters.

Arguments

  • const char * 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

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

void flushMesh ( ) #

Flushes the mesh geometry into the video memory.

int loadMesh ( const char * path ) #

Loads a mesh file.

Arguments

  • const char * path - Mesh file name.

Return value

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

int saveMesh ( const char * path ) #

Saves the mesh into a file.

Arguments

  • const char * path - Mesh file name.

Return value

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

static int type ( ) #

Returns the type of ObjectMeshStatic.

Return value

ObjectMeshStatic type identifier.
Last update: 2021-12-13
Build: ()