This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and 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
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::ObjectMeshStatic Class

Header:#include <UnigineObjects.h>
Inherits:Object

This class is used for handling static meshes.

ObjectMeshStatic Class

Members


static ObjectMeshStaticPtr create(const Ptr<Mesh> & mesh)

ObjectMeshStatic constructor. Creates a new mesh object from a given file.

Arguments

  • const Ptr<Mesh> & mesh - A mesh smart pointer.

static ObjectMeshStaticPtr create(const char * name, int unique = 0)

ObjectMeshStatic constructor. Creates a new mesh object from a given file.

Arguments

  • const char * name - Path to the mesh file.
  • 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.

Ptr<ObjectMeshStatic> cast(const Ptr<Object> & base)

Arguments

  • const Ptr<Object> & base

Ptr<ObjectMeshStatic> cast(const Ptr<Node> & node)

Arguments

  • const Ptr<Node> & node

void setCIndex(int num, int index, int surface)

Updates an coordinate index.

Arguments

  • int num - Index number in the index buffer.
  • int index - Coordinate index.
  • int surface - Surface number.

int getCIndex(int num, int surface)

Returns an coordinate index.

Arguments

  • int num - Index number in the index buffer.
  • int surface - Surface number.

Return value

Coordinate index.

void setColor(int num, const Math::vec4 & color, int surface)

Updates vertex color.

Arguments

  • int num - Vertex number.
  • const Math::vec4 & color - Vertex color.
  • int surface - Surface number.

Math::vec4 getColor(int num, int surface)

Returns vertex color.

Arguments

  • int num - Vertex number.
  • int surface - Surface number.

Return value

Vertex color.

int setMesh(const Ptr<Mesh> & mesh)

Sets a mesh.

Arguments

  • const Ptr<Mesh> & mesh - The source mesh to be copied.

Return value

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

int getMesh(const Ptr<Mesh> & mesh)

Returns a mesh.

Arguments

  • const Ptr<Mesh> & mesh - The source mesh.

Return value

1 if the mesh is copied successfully.

void setMeshName(const char * name)

Sets the new mesh name.

Arguments

  • const char * name - The name of the mesh.

const char * getMeshName()

Returns the new mesh name.

Return value

The name of the mesh.

int getMeshSurface(const Ptr<Mesh> & mesh, int surface, int target = -1)

Gets the mesh surface from the current mesh

Arguments

  • const Ptr<Mesh> & mesh - Mesh pointer to copy a surface into.
  • int surface - Mesh surface number to copy.
  • int target - Mesh target number to copy.

Return value

Number of the added mesh surface.

Math::vec3 getNormal(int num, int surface, int target = 0)

Returns normal of a given vertex.

Arguments

  • int num - Vertex number.
  • int surface - Surface number.
  • int target - Target number.

Return value

Normal vector.

int getNumCIndices(int surface)

Returns the number of coordinate indices.

Arguments

  • int surface - Surface number.

Return value

Number of coordinate indices.

int getNumColors(int surface)

Returns the number of vertex colors.

Arguments

  • int surface - Surface number.

Return value

Number of vertex colors.

int getNumSurfaceTargets(int surface)

Returns the number of surface targets.

Arguments

  • int surface - Surface number.

Return value

Number of surface targets.

int getNumTangents(int surface)

Returns the number of tangents in a given mesh surface.

Arguments

  • int surface - Surface number.

Return value

Number of the surface vertices.

void setNumTexCoords0(int num, int surface)

Sets the number of first texture coordinates.

Arguments

  • int num - Number of first texture coordinates.
  • int surface - Surface number.

int getNumTexCoords0(int surface)

Returns the number of first texture coordinates.

Arguments

  • int surface - Surface number.

Return value

Number of first texture coordinates.

void setNumTexCoords1(int num, int surface)

Sets the number of second texture coordinates.

Arguments

  • int num - Number of second texture coordinates.
  • int surface - Surface number.

int getNumTexCoords1(int surface)

Returns the number of second texture coordinates.

Arguments

  • int surface - Surface number.

Return value

Number of second texture coordinates.

int getNumTIndices(int surface)

Returns the number of triangle indices.

Arguments

  • int surface - Surface number.

Return value

Number of triangle indices.

int getNumVertex(int surface)

Returns the number of vertices in a given mesh surface.

Arguments

  • int surface - Surface number.

Return value

Number of the surface vertices.

const char * getSurfaceTargetName(int surface, int target)

Returns the name of a given surface target.

Arguments

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

Return value

Target name.

void setSurfaceTransform(const Math::mat4 & transform, int surface, int target = -1)

Transforms the mesh surface.

Arguments

  • const Math::mat4 & transform - Transformation matrix.
  • int surface - Surface number.
  • int target - Target number.

void setTangent(int num, const Math::quat & tangent, int surface, int target = 0)

Updates tangent of a given vertex.

Arguments

  • int num - Vertex number.
  • const Math::quat & tangent - Vertex tangent.
  • int surface - Surface number.
  • int target - Target number.

Math::quat getTangent(int num, int surface, int target = 0)

Returns tangent of a given vertex.

Arguments

  • int num - Vertex number.
  • int surface - Surface number.
  • int target - Target number.

Return value

Tangent normal.

void setTexCoord0(int num, const Math::vec2 & texcoord, int surface)

Updates first texture coordinate.

Arguments

  • int num - Vertex number.
  • const Math::vec2 & texcoord - Second texture coordinate.
  • int surface - Surface number.

Math::vec2 getTexCoord0(int num, int surface)

Returns first texture coordinate.

Arguments

  • int num - Vertex number.
  • int surface - Surface number.

Return value

Vertex first texture coordinate.

void setTexCoord1(int num, const Math::vec2 & texcoord, int surface)

Updates second texture coordinate.

Arguments

  • int num - Vertex number.
  • const Math::vec2 & texcoord - Second texture coordinate.
  • int surface - Surface number.

Math::vec2 getTexCoord1(int num, int surface)

Returns second texture coordinate.

Arguments

  • int num - Vertex number.
  • int surface - Surface number.

Return value

Vertex second texture coordinate.

void setTIndex(int num, int index, int surface)

Updates a triangle index.

Arguments

  • int num - Index number in the index buffer.
  • int index - Triangle index.
  • int surface - Surface number.

int getTIndex(int num, int surface)

Returns a triangle index.

Arguments

  • int num - Index number in the index buffer.
  • int surface - Surface number.

Return value

Triangle index.

void setVertex(int num, const Math::vec3 & vertex, int surface, int target = 0)

Updates coordinate of a given vertex.

Arguments

  • int num - Vertex number.
  • const Math::vec3 & vertex - Vertex coordinate.
  • int surface - Surface number.
  • int target - Target number.

Math::vec3 getVertex(int num, int surface, int target = 0)

Returns coordinate of a given vertex.

Arguments

  • int num - Vertex number.
  • int surface - Surface number.
  • int target - Target number.

Return value

Vertex coordinate.

int addEmptySurface(const char * name, int num_vertex, int num_indices)

Appends a new surface into the mesh.

Arguments

  • const char * name - New surface name.
  • int num_vertex - Number of surface vertices.
  • int num_indices - Number of surface indices.

Return value

Appended surface number.

int addMeshSurface(int dest_surface, const Ptr<ObjectMeshStatic> & mesh, int surface, int target = -1)

Appends a new mesh surface to the current mesh.

Arguments

  • int dest_surface - Name of the new surface of the current mesh.
  • const Ptr<ObjectMeshStatic> & mesh - Mesh pointer to copy a surface from.
  • int surface - Mesh surface number to copy.
  • int target - Mesh target number to copy.

Return value

The number of the surface, appended to the current mesh.

int addMeshSurface(const char * name, const Ptr<Mesh> & mesh, int surface, int target = -1)

Appends a new mesh surface to the current mesh.

Arguments

  • const char * name - Name of the new surface of the current mesh.
  • const Ptr<Mesh> & mesh - Mesh pointer to copy a surface from.
  • int surface - Mesh surface number to copy.
  • int target - Mesh target number to copy.

Return value

Number of the added mesh surface.

int addMeshSurface(const char * name, const Ptr<ObjectMeshStatic> & mesh, int surface, int target = -1)

Appends a new mesh surface to the current mesh.

Arguments

  • const char * name - Name of the new surface of the current mesh.
  • const Ptr<ObjectMeshStatic> & mesh - Mesh pointer to copy a surface from.
  • int surface - Mesh surface number to copy.
  • int target - Mesh target number to copy.

Return value

Number of the added mesh surface.

int addSurfaceTarget(int surface, const char * name = 0)

Appends a surface target into the mesh.

Arguments

  • int surface - Surface number.
  • const char * name - New target name.

Return value

Appended target number.

void clearTopology()

int createMesh(const char * name, int unique = 0)

Creates a mesh.

Arguments

  • const char * name - Path to the mesh file.
  • int unique - Create dynamic mesh.

Return value

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

int findSurfaceTarget(const char * name, int surface)

Searches for an surface target with a given name.

Arguments

  • const char * name - Target name.
  • int surface - Surface number.

Return value

Target number if it is exists; otherwise, -1.

void flushMesh()

Flushes the mesh geometry into the video memory.

int loadMesh(const char * name)

Loads a mesh file.

Arguments

  • const char * name - Mesh file name.

Return value

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

int saveMesh(const char * name)

Saves the mesh into a file.

Arguments

  • const char * name - Mesh file name.

Return value

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

static int type()

Returns the type of ObjectMeshStatic.

Return value

ObjectMeshStatic type identifier.

void updateSurfaceBounds(int surface = -1)

Updates mesh bounds.

Arguments

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

void updateTopology()

Last update: 2017-07-03
Build: ()