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)
Casts an ObjectMeshStatic out of the Object instance.Arguments
- const Ptr<Object> & base - Pointer to Object.
Return value
Pointer to ObjectMeshStatic.Ptr<ObjectMeshStatic> cast(const Ptr<Node> & node)
Casts an ObjectMeshStatic out of the Node instance.Arguments
- const Ptr<Node> & node - Pointer to Node.
Return value
Pointer to ObjectMeshStatic.void setCIndex(int num, int index, int surface)
Updates an coordinate index.Arguments
- int num - Index number in the index buffer.
- int index - The index to be set.
- int surface - The number of the mesh surface.
int getCIndex(int num, int surface)
Returns the coordinate index.Arguments
- int num - The number of the index in the index buffer.
- int surface - The number of the mesh surface.
Return value
The coordinate index.void setColor(int num, const Math::vec4 & color, int surface)
Updates the 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 the vertex color.Arguments
- int num - Vertex number.
- int surface - Surface number.
Return value
Vertex color.int setMesh(const Ptr<Mesh> & mesh)
Copies the source mesh into the current 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)
Copies the current mesh into the source mesh.MeshPtr m = Mesh::create();
objectmeshstatic->getMesh(m);
Arguments
- const Ptr<Mesh> & mesh - The source mesh.
Return value
1 if the mesh is copied successfully.void setMeshName(const char * name, int force_load = 0)
Sets the new mesh name and forces creating of the mesh with this name.Arguments
- const char * name - The name of the mesh.
- int force_load - Force flag.
- If 1 is specified, the mesh with the new name will be created immediately with the unique flag set to 0.
- If 0 is specified, only the mesh name will be updated.
const char * getMeshName()
Returns the name of the current mesh.Return value
The name of the mesh.int getMeshSurface(const Ptr<Mesh> & mesh, int surface, int target = -1)
Copies the specified mesh surface into the source mesh.Arguments
- const Ptr<Mesh> & mesh - Mesh pointer to copy a surface into.
- int surface - The number of the mesh surface to be copied.
- int target - The number of the surface target to be copied.
Return value
Number of the added mesh surface.Math::vec3 getNormal(int num, int surface, int target = 0)
Returns a normal vector of a given vertex.Arguments
- int num - Number of the vertex in the vertex buffer.
- int surface - Number of the surface.
- int target - Number of the surface's morph target.
Return value
Normal vector.int getNumCIndices(int surface)
Returns the number of coordinate indices for the given mesh surface.Arguments
- int surface - The number of the mesh surface.
Return value
The 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 for the given mesh surface.Arguments
- int surface - The number of the mesh surface.
Return value
The number of surface targets.int getNumTangents(int surface)
Returns the number of tangent vectors of the given mesh surface.Arguments
- int surface - Number of the mesh surface.
Return value
Number of the surface vertices.void setNumTexCoords0(int num, int surface)
Sets the number of the first texture coordinates for the given mesh surface.Arguments
- int num - Number of the first texture coordinates to be set.
- int surface - The number of the mesh surface.
int getNumTexCoords0(int surface)
Returns the number of the first UV map texture coordinates for the given mesh surface.Arguments
- int surface - The number of the mesh surface.
Return value
The number of the first UV map texture coordinates.void setNumTexCoords1(int num, int surface)
Sets the number of the second texture coordinates for the given mesh surface.Arguments
- int num - Number of the second texture coordinates to be set.
- int surface - The number of the mesh surface.
int getNumTexCoords1(int surface)
Returns the number of the second UV map texture coordinates for the given mesh surface.Arguments
- int surface - The number of the mesh surface.
Return value
The number of the second UV map texture coordinates.int getNumTIndices(int surface)
Returns the number of triangle indices for the given mesh surface.Arguments
- int surface - The number of the mesh surface.
Return value
The number of triangle indices.int getNumVertex(int surface)
Returns the number of vertices for the given mesh surface.Arguments
- int surface - The number of the mesh surface.
Return value
Number of the surface vertices.const char * getSurfaceTargetName(int surface, int target)
Returns the name of the target for the given mesh surface by the target number.Arguments
- int surface - The number of the mesh surface.
- int target - The number of the surface target.
Return value
The name of the surface target.void setSurfaceTransform(const Math::mat4 & transform, int surface, int target = -1)
Transforms the mesh surface.Arguments
- const Math::mat4 & transform - The transformation matrix.
- int surface - The number of the mesh surface.
- int target - The number of the surface target.
void setTangent(int num, const Math::quat & tangent, int surface, int target = 0)
Sets the new tangent vector for the given vertex.Arguments
- int num - Number of the vertex in the vertex buffer.
- const Math::quat & tangent - Tangent vector to be set.
- int surface - Number of the mesh surface.
- int target - Number of the surface's morph target.
Math::quat getTangent(int num, int surface, int target = 0)
Returns the tangent vector of the given vertex.Arguments
- int num - Number of the vertex in the vertex buffer.
- int surface - Number of the mesh surface.
- int target - Number of the surface's morph target.
Return value
Tangent vector.void setTexCoord0(int num, const Math::vec2 & texcoord, int surface)
Sets new coordinates for the first UV map of the mesh surface.Arguments
- int num - Vertex number.
- const Math::vec2 & texcoord - Coordinates of the first UV map to be set.
- int surface - The number of the mesh surface.
Math::vec2 getTexCoord0(int num, int surface)
Returns the first UV map texture coordinates.Arguments
- int num - Vertex number.
- int surface - Surface number.
Return value
void setTexCoord1(int num, const Math::vec2 & texcoord, int surface)
Sets new coordinates for the second UV map of the given mesh surface.Arguments
- int num
- const Math::vec2 & texcoord - Coordinates of the second UV map to be set.
- int surface - The number of the mesh surface.
Math::vec2 getTexCoord1(int num, int surface)
Returns the second UV map texture coordinates.Arguments
- int num - The number of the vertex in the vertex buffer.
- int surface - Surface number.
Return value
The second UV map texture coordinates.void setTIndex(int num, int index, int surface)
Sets the new triangle index for the given mesh surface.Arguments
- int num - The number of the index in the index buffer.
- int index - The index to be set.
- int surface - The number of the mesh surface.
int getTIndex(int num, int surface)
Returns the triangle index for the given mesh surface.Arguments
- int num - The number of the index in the index buffer.
- int surface - The number of the mesh surface.
Return value
The triangle index.void setVertex(int num, const Math::vec3 & vertex, int surface, int target = 0)
Sets new coordinates for the given vertex.Arguments
- int num - The number of the vertex in the vertex buffer.
- const Math::vec3 & vertex - Coordinates of the vertex to be set.
- int surface - The number of the mesh surface.
- int target - The number of the surface target.
Math::vec3 getVertex(int num, int surface, int target = 0)
Returns coordinate of a given vertex.Arguments
- int num - The number of the vertex in the vertex buffer.
- int surface - The number of the mesh surface.
- int target - The number of the surface target.
Return value
Vertex coordinates.int addEmptySurface(const char * name, int num_vertex, int num_indices)
Appends a new empty surface to the current mesh.Arguments
- const char * name - The name of the new surface.
- int num_vertex - The number of the new surface vertices.
- int num_indices - The number of the new surface indices.
Return value
The number of the appended surface.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)
Adds a new target to the specified surface of the current mesh.Arguments
- int surface - Surface number.
- const char * name - The name of the new target.
Return value
The number of the added target.void clearTopology()
int createMesh(const char * name, int unique = 0)
Creates the static mesh with the specified parameters.Arguments
- const char * name - Path to the mesh file.
- int unique - Create dynamic mesh.
Return value
1 if the mesh is created successfully; otherwise - 0.int findSurfaceTarget(const char * name, int surface)
Searches for the target number by the target name.Arguments
- const char * name - The name of the target.
- int surface - The number of the mesh surface.
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 the mesh for the current mesh from the .mesh file. This function doesn't change the mesh name.Arguments
- const char * name - Mesh file name.
Return value
1 if the mesh is loaded successfully; otherwise, 0.int saveMesh(const char * name)
Saves the mesh into the .mesh format.Arguments
- const char * name - The path to the file.
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()
Bends the mesh geometry if it is a child of GeodeticPivot.Last update: 03.07.2017
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter