This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
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
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
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.

MeshStatic 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.

This class is used to procedurally create static meshes (i.e. triangles, lines or points) and modify them at run time.

MeshStatic Class

Members


MeshStatic ( ) #

Constructor. Creates an empty static mesh.

int info ( string path ) #

Returns an information about the given mesh.

Arguments

  • string path - Path to the mesh.

Return value

1 if the information returned successfully; otherwise, 0.

int load ( string path ) #

Loads the mesh using the specified path.

Arguments

  • string path - Path to the mesh.

Return value

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

int save ( string path ) #

Saves the mesh to the specified location.

Arguments

  • string path - Path to the mesh.

Return value

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

int setMesh ( Mesh mesh ) #

Copies a given source mesh into the current mesh.

Arguments

  • Mesh mesh - 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 destination mesh.

Arguments

  • Mesh & mesh - Destination mesh.

Return value

true if the mesh is copied successfully; otherwise, false.

void clear ( ) #

Clears the mesh (including its surfaces and bounds).

void destroy ( ) #

Destroys the mesh.

void flush ( ) #

Flushes the mesh geometry into the video memory.

void asyncCreate ( ) #

Creates the mesh asynchronously (in anoher thread).

void asyncDestroy ( ) #

Destroys the mesh asynchronously (in anoher thread).

void bind ( ) #

Binds static mesh data (index and vertex buffers) to the input assembler stage.

void unbind ( ) #

Unbinds static mesh data (index and vertex buffers).

int renderSurface ( int mode, int surface, int target = 0 ) #

Renders the surface.

Arguments

  • int mode - Rendering mode. One of the MODE_* variables.
  • int surface
  • int target - Surface target number. The default value is 0.

Return value

Number of primitives rendered. Primitive type is determined by the rendering mode.

int renderInstancedSurface ( int mode, int num, int surface, int target = 0 ) #

Renders the specified number of instances of the surface.

Arguments

  • int mode - Rendering mode. One of the MODE_* variables.
  • int num - Number of instances to be rendered.
  • int surface
  • int target - Surface target number. The default value is 0.

Return value

Number of primitives rendered. Primitive type is determined by the rendering mode.

int render ( int mode, int surface = -1, int target = 0 ) #

Renders the static mesh with the specified settings and mode.

Arguments

  • int mode - Rendering mode. One of the MODE_* variables.
  • int surface - Surface number (use -1 for all surfaces).
  • int target - Surface target number. The default value is 0.

int renderInstanced ( int mode, int num, int surface = -1, int target = 0 ) #

Renders the specified number of instances of the surface.

Arguments

  • int mode - Rendering mode. One of the MODE_* variables.
  • int num - Number of instances to be rendered.
  • int surface - Surface number (use -1 for all surfaces).
  • int target - Surface target number. The default value is 0.

Return value

Number of primitives rendered. Primitive type is determined by the rendering mode.

int getSystemMemoryUsage ( ) #

Returns the current amount of system memory used by the static mesh, in bytes.

Return value

System memory amount used by the static mesh, in bytes.

int getVideoMemoryUsage ( ) #

Returns the current amount of video memory used by the static mesh.

Return value

Video memory amount used by the static mesh, in bytes.

int getNumSurfaces ( ) #

Returns the total number of mesh surfaces.

Return value

Number of mesh surfaces.

string getSurfaceName ( int surface ) #

Returns the name of the given surface.

Arguments

  • int surface - Mesh surface number.

Return value

Surface name.

void setSurfaceLightmapUVChannel ( int surface, char uv_channel ) #

Sets a new UV channel to be used for lightmaps of the surface with the specified number.

Arguments

  • int surface - Mesh surface number.
  • char uv_channel - UV channel to be used for lightmaps of the surface with the specified number.

char getSurfaceLightmapUVChannel ( int surface ) #

Returns the current UV channel used for lightmaps of the surface with the specified number.

Arguments

  • int surface - Mesh surface number.

Return value

UV channel currently used for lightmaps of the surface with the specified number.

void setSurfaceLightmapResolution ( int surface, int resolution ) #

Sets a new lightmap resolution for the surface with the specified number.

Arguments

  • int surface - Mesh surface number.
  • int resolution - Lightmap resolution to be used for the surface with the specified number.

int getSurfaceLightmapResolution ( int surface ) #

Returns the current lightmap resolution for the surface with the specified number.

Arguments

  • int surface - Mesh surface number.

Return value

Current lightmap resolution for the surface with the specified number.

int findSurface ( string name ) #

Searches for the surface number by its name.

Arguments

  • string name - Mesh surface name.

Return value

Mesh surface number, if it is found; otherwise, -1.

int getNumSurfaceTargets ( int surface ) #

Returns the number of surface targets for the given surface.

Arguments

  • int surface - Mesh surface number.

Return value

Number of surface targets.

string getSurfaceTargetName ( int surface, int target ) #

Returns the name of the given surface target.

Arguments

  • int surface - Mesh surface number.
  • int target - Surface target number.

Return value

Surface target name.

int findSurfaceTarget ( string name, int surface ) #

Searches for the target number by the target name.

Arguments

  • string name - The name of the target.
  • int surface - Mesh surface number.

Return value

Target number, if exists; otherwise, -1.

void updateSurfaceBounds ( int surface = -1 ) #

Updates mesh bounds. This method is to be called to recalculate bounds after changing a mesh surface (e.g. modifying positions of coordinate vertices).

Arguments

  • int surface - Surface number (use -1 for all surfaces).

void setSurfaceTransform ( mat4 transform, int surface, int target = -1 ) #

Sets the transformation matrix for the given surface target.

Arguments

  • mat4 transform - Transformation matrix to be set.
  • int surface - Mesh surface number.
  • int target - Surface target number. The default value is -1 (apply to all of the surface targets).

int addEmptySurface ( string name, int num_vertex, int num_indices ) #

Appends a new empty surface to the current mesh.
Notice
This function allocates only vertex and index arrays. Texture coordinates, tangent basis, weights and color arrays must be allocated manually.

Arguments

  • string name - Surface name.
  • int num_vertex - Number of surface vertices.
  • int num_indices - Number of surface indices.

Return value

Number of the mesh surfaces.

int addSurfaceTarget ( int surface, string name ) #

Appends a target with the given name to the given surface.

Arguments

  • int surface - Mesh surface number.
  • string name - Name of the surface target.

Return value

Number of surface targets.

int getIntersection ( const vec3 & p0, const vec3 & p1, vec3 * ret_point, vec3 * ret_normal, vec4 * ret_texcoord, int * ret_index, int surface, int target = 0 ) #

Performs the search for the intersection of the given surface target with the given traced line.
Notice
Mesh local space coordinates are used for this method.

Arguments

  • const vec3 & p0 - Start point coordinates.
  • const vec3 & p1 - End point coordinates.
  • vec3 * ret_point - Return array to write the intersection point coordinates into.
  • vec3 * ret_normal - Return array to write the intersection point normal into.
  • vec4 * ret_texcoord - Return array to write the texture coordinates into.
  • int * ret_index - Return array to write the intersection point indices into.
  • int surface - Mesh surface number.
  • int target - Surface target number. The default value is 0.

Return value

1 if the intersection is found; otherwise, 0.

void setBoundBox ( BoundBox bb ) #

Sets the bounding box for the mesh.

Arguments

void setBoundBox ( BoundBox bb, int surface ) #

Sets the bounding box for the given mesh surface.

Arguments

  • BoundBox bb - Bounding box to be set.
  • int surface - Mesh surface number.

BoundBox getBoundBox ( ) #

Returns the bounding box of the mesh.

Return value

Bounding box.

BoundBox getBoundBox ( int surface ) #

Returns the bounding box of the given mesh surface.

Arguments

  • int surface - Mesh surface number.

Return value

Bounding box.

void setBoundSphere ( BoundSphere bs ) #

Sets the bounding sphere for the mesh.

Arguments

void setBoundSphere ( BoundSphere bs, int surface ) #

Sets the bounding sphere for the given mesh surface.

Arguments

  • BoundSphere bs - Bounding sphere to be set.
  • int surface - Mesh surface number.

BoundSphere getBoundSphere ( ) #

Returns the bounding sphere of the mesh.

Return value

Bounding sphere.

BoundSphere getBoundSphere ( int surface ) #

Returns the bounding sphere of the given mesh surface.

Arguments

  • int surface - Mesh surface number.

Return value

Bounding sphere.

void setDebugName ( string name ) #

Sets a friendly name for GPU debugging (RenderDoc, NVIDIA Nsight). It can be used to help you determine if the corresponding object interface pointer caused the leak. Memory leaks are reported by the debug software layer by outputting a list of object interface pointers along with their friendly names.

Arguments

  • string name - Friendly debug name to be set.

string getDebugName ( ) #

Returns the currently used friendly name for GPU debugging (RenderDoc, NVIDIA Nsight). It can be used to help you determine if the corresponding object interface pointer caused the leak. Memory leaks are reported by the debug software layer by outputting a list of object interface pointers along with their friendly names.

Return value

Friendly debug name.

void updateDebugName ( ) #

Updates the friendly name for GPU debugging (RenderDoc, NVIDIA Nsight).

void createNodes ( ) #

Forced creation of the Mesh Static internal tree for quick calculation of collisions and intersections.
Last update: 2021-12-13
Build: ()