3DCoat Core API
The 3DCoat API documentation.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
coat::Model Class Reference

The class that corresponds to the retopo/modeling rooms meshes. This is advanced version of the Mesh that allows essential topology changes on the fly. It is very similar to Mesh by basic functionality, may be easily converted to Mesh and vice versa. But it is more heavy structure, use Mesh if you don't need the advanced functionality. More...

#include <CoreAPI.h>

Public Member Functions

 Model ()
 construct the lowpoly mesh, it is completely independent on retopo/modeling/uv workspace. If you need to refer any of that workspace use static functions fromRetopo, fromModeling, fromUV
 
 Model (const Model &source)
 make a reference to the source mesh. No new Mesh allocated! Use MakeCopy if you need to make a copy of the mesh
 
 Model (const Mesh &source)
 construct model from the Mesh object.
 
Modeloperator= (const Model &source)
 the assignment operator. No new Mesh allocated! Use MakeCopy if you need to make a copy of the mesh
 
Modeloperator= (const Mesh &source)
 
Modeloperator+= (const Model &source)
 
Modeloperator+= (const Mesh &source)
 
Modeltransform (const mat4 &m)
 transform the whole Model with the matrix
 
Model MakeCopy () const
 make a copy of the source mesh. Pay attention, if you taken it from the retopo/uv context, it will no longer refer to the retopo/uv mesh, it will be independent copy
 
 ~Model ()
 destroy the mesh reference (the mesh itself will not be destroyed if it is the reference to retopo/modeling/uv workspaces)
 
void displayOptions (bool showWireframe=true, bool showColored=true, bool showSeams=true, bool showSharpEdges=true, bool smoothView=false)
 Set the display options for the retopo/modeling/uv meshes.
 
int getObjectsCount ()
 get the retopo groups count
 
int getCurrentObject ()
 get the index of the current group
 
void setCurrentObject (int index)
 set the current group index
 
const char * getObjectName (int group_index)
 get the retopo group name
 
void removeObject (int group_index)
 remove the group by index
 
void setObjectName (int index, const char *name)
 rename the group by index
 
void setObjectVisibility (int index, bool visible)
 set the group visibility
 
bool getObjectVisibility (int index)
 get the group visibility
 
int addObject (const char *name)
 add new retopo group
 
int addMaterial (const char *name)
 add the new UV set/Material
 
void removeUnusedMaterials ()
 remove all unused UV sets (not referred within the mesh)
 
vec4 getObjectReferenceColor (int group_index)
 get the group reference color
 
void setObjectReferenceColor (int group_index, vec4 color)
 set the group reference color
 
void selectedToObject (int group_index)
 move the selected faces to the group
 
Mesh getWholeMesh ()
 get the whole mesh from the retopo room
 
Mesh selectedToMesh ()
 get the selected faces as the Mesh object
 
Mesh visibleToMesh ()
 get the visible faces as the Mesh object
 
void addTransformed (const Mesh &mesh, const mat4 &Transform=mat4::Identity, BoolOpType b=BOOL_MERGE, bool select=false, bool snap_to_existing=false)
 insert the mesh to the retopo/modeling room, each object of the mesh treated as the new retopo layer
 
Mesh getObjectMesh (int group_index)
 get the mesh from some retopo group
 
void setObjectMesh (int group_index, Mesh &mesh, const mat4 &transform=mat4::Identity)
 replace the retopo layer with mesh
 
int duplicateObject (int group_index, const char *name=nullptr, const mat4 &transform=mat4::Identity, bool select=false)
 duplicate the object (retopo group)
 
std::string generateName (const char *base)
 generate unique name for the object, it will start as the string in base base
 
void clearObjectMesh (int group_index)
 remove all faces from the group
 
void clear ()
 clear the whole mesh
 
void dropUndo ()
 Drop the whole mesh to the undo queue, it is important if you want allow the user to undo your mesh changes, call it before your changes. It works for UV room too.
 
std::vector< int > getSelectedFaces ()
 get the list of selected faces
 
void getSelectedFaces (list< int > &faces)
 
void setSelectedFaces (std::vector< int > &faces)
 set the selected faces list
 
void setSelectedFaces (list< int > &faces)
 
void selectFace (int face)
 select the face by index
 
void selectObject (int group_index, bool add_to_selected=true)
 select all feces in the group
 
std::vector< int > getObjectFaces (int group_index)
 get the list of faces in the group
 
void getObjectFaces (int group_index, list< int > &faces)
 
bool isFaceSelected (int face)
 check if the face selected
 
void unselectAllFaces ()
 unselect all faces
 
void expandSelection ()
 expand the faces/vertices/edges selection to the connected geometry
 
void contractSelection ()
 contract the faces/vertices/edges selection to the connected geometry
 
void selectedToEdges ()
 convert faces/vertices selection to edges selection
 
void selectedToFaces ()
 convert edges/vertices selection to faces selection
 
void selectedToVertices ()
 convert faces/edges selection to vertices selection
 
std::vector< int > getSelectedEdges ()
 returns even amount of vertex indices, pairs os start and end vertices of the selected edges
 
void getSelectedEdges (list< int > &edges)
 
void setSelectedEdges (std::vector< int > &edges)
 set the selected edges list
 
void setSelectedEdges (list< int > &edges)
 
void selectEdge (int vertex1, int vertex2)
 select the edge by vertex indices (add to selection)
 
bool isEdgeSelected (int vertex1, int vertex2)
 check if the edge is selected, order of vertices has no matter
 
void unselectAllEdges ()
 unselect all edges
 
std::vector< int > getSelectedVertices ()
 get the list of selected vertices
 
void getSelectedVertices (list< int > &vertices)
 
std::vector< float > getSelectedVerticesWeights ()
 get the soft selection weights of the selected vertices, 1 is maximum value
 
void setSelectedVertices (const std::vector< int > &vertices, const std::vector< float > &weights)
 set the selected vertices list
 
void setSelectedVertices (const list< int > &vertices, const list< float > &weights)
 
void selectVertex (int vertex, float weight=1.0f)
 add the vertex to the selection
 
bool isVertexSelected (int vertex)
 check if the vertex is selected
 
void unselectAllVertices ()
 unselect all vertices
 
int facesCount ()
 get the faces count
 
int vertsCount ()
 get the positional vertices count
 
int vertsUvCount ()
 get the uv vertices count
 
void removeFace (int face)
 remove the face by index
 
int createNewFace (int Group, int UVSet)
 create empty face, you need to call setFaceVertices to set the vertices, setFaceUVVerts to set the UV vertices
 
int getFaceVertsCount (int face)
 get the vertices count over the face
 
int getFaceVertex (int face, int vertex_index)
 get the vertex index over the face
 
std::vector< int > getFaceVerts (int face)
 get the list of UV vertex indices over the face, pay attention UV vertices are not same as position vertices
 
void getFaceVerts (int face, list< int > &vertices)
 
void setFaceVerts (int face, const std::vector< int > &vertices)
 set the list of positional vertex indices over the face
 
void setFaceVerts (int face, const list< int > &vertices)
 
bool getFaceVisibility (int face)
 get the face visibility
 
void setFaceVisibility (int face, bool visibility)
 set the face visibility
 
float getFaceSquare (int face)
 get the face square
 
float getFaceUVSquare (int face)
 get the face square in UV space
 
vec3 getFaceNormal (int face)
 get the face normal
 
int getFaceObject (int face)
 get the group index of the face
 
void setFaceObject (int face, int group)
 set the group index of the face
 
int getFaceMaterial (int face)
 get the UV set index for the face
 
void setFaceMaterial (int face, int uv_set)
 set the UV set for the face
 
int getFaceUvVertsCount (int face)
 get the amount of UV vertices over the face
 
int getFaceUvVertex (int face, int vertex_index)
 get the UV vertex index over the face
 
std::vector< int > getFaceUvVerts (int face)
 get the list of UV vertices indices over the face
 
void getFaceUvVerts (int face, list< int > &vertices)
 
void setFaceUvVerts (int face, const std::vector< int > &vertices)
 set the UV vertices for the face
 
void setFaceUvVerts (int face, const list< int > &vertices)
 
vec3 getVertex (int vertex)
 get the vertex position in space
 
void setVertex (int vertex, const vec3 &position)
 set the vertex position in space
 
int createNewVertex (const vec3 &position)
 create the positional vertex
 
vec2 getVertexUV (int uv_vertex)
 get the UV coordinates of the UV vertex
 
void setVertexUV (int uv_vertex, const vec2 &uv)
 set the UV for the UV vertex
 
int createNewUvVertex (const vec2 &uv)
 create new UV vertex to be used for faces
 
vec3 getVertexNormal (int vertex)
 get vertex normal, calculated as average of adjacent faces normals
 
void updateNormals (bool for_snapping=true)
 update the vertex normals
 
void updateTopology ()
 update the connectivity information, it should be called sometimes if you feel that the connectivity information lost due to some heavy operations
 
void cleanup ()
 complete cleanul from non-manifolds or other problems, some faces may be removed
 
std::vector< int > getVertsNearVertex (int vertex)
 get the list of vertices that are adjacent to the vertex
 
void getVertsNearVertex (int vertex, list< int > &vertices)
 
std::vector< int > getFacesNearVertex (int vertex)
 get the list of faces that are adjacent to the vertex
 
void getFacesNearVertex (int vertex, list< int > &faces)
 
std::vector< int > getFaceNeighbors (int face)
 get the list of faces that are adjacent to the face
 
void getFaceNeighbors (int face, list< int > &faces)
 
std::vector< int > getFacesNearEdge (int vertex1, int vertex2)
 get the list of faces that are adjacent to the edge
 
void getFacesNearEdge (int vertex1, int vertex2, list< int > &faces)
 
bool isOpenEdge (int vertex1, int vertex2)
 check if the edge is open
 
bool isSharpEdge (int vertex1, int vertex2)
 check if the edge is sharp
 
void setEdgeSharpness (int vertex1, int vertex2, bool sharp)
 set the sharpness state for the edge
 
bool isSeam (int vertex1, int vertex2)
 check if edge is seam
 
void setEdgeSeam (int vertex1, int vertex2, bool seam)
 set or clear the seam state for the edge
 
void collapseEdge (int vertex1, int vertex2)
 collapse the edge to the middle of the edge
 
int islandsCount (int uv_set)
 get the islands count over the current uv-set
 
Mesh islandToMesh (int uv_set, int island_index)
 get the mesh that contains the island, xy of each point is the UV coordinate. The mesh contains only one island
 
Mesh islandToMeshInSpace (int uv_set, int island_index)
 get the mesh that contains the island, each point is the coordinate in space (not the uv coordinate!). The mesh contains only one island. The faces correspond to the faces of the mesh that was got by islandToMesh
 
std::vector< int > getIslandVertexMapping (int uv_set, int island_index)
 get the mapping from the vertex index in the mesh that was got by islandToMesh to the vertex index in the original mesh
 
std::vector< int > getIslandBorder (int uv_set, int island_index)
 get unsorted list of edges on the border of the island
 
std::vector< int > getBorderBetweenIslands (int uv_set1, int island_index1, int uv_set2, int island_index2)
 get the border between two islands
 
vec2 getIslandVertexUv (int uv_set, int island_index, int vertex_index)
 get the uv coordinate of the positional vertex in the island
 
void meshToIsland (const Mesh &mesh, int uv_set, int island_index)
 use the mesh (that was previously got by islandToMesh) to replace the island in the current uv-set
 
void pack (int uv_set, bool rotate, bool shuffle)
 pack the islands in the current uv-set
 
void unwrap (int uv_set)
 unwrap the current uv-set
 
void toAbf (int uv_set, int island_index)
 unwrap the island using the ABF approach
 
void toLscm (int uv_set, int island_index)
 unwrap the island using the LSCM approach
 
void toGu (int uv_set, int island_index)
 unwrap the island using the GU (Globally Uniform) approach
 
void toPlanar (int uv_set, int island_index)
 unwrap the island using the Planar approach
 
void toStripe (int uv_set, int island_index)
 try to uwrap the island as the regular stripe
 
void extrudeSelected ()
 Extrude the selected edges or selected faces without the actual moving of the extruded elements. They stay selected, so you amy apply some transform to the selected elements.
 
void moveSelectedFacesAlongFacesNormals (float displacement)
 move selected faces along the faces normals, trying to keep faces parallel to the original direction
 
void moveSelectedFacesAlongVertexNormals (float displacement)
 move selected faces along the vertex normals, each vertex displace on the same distance
 
void subdivideSelectedFaces (bool apply_catmull_clark=false)
 subdivide the selected faces
 
void subdivide (bool apply_catmull_clark=true)
 subdivide the whole mesh
 
void transformSelected (const mat4 &transform, bool apply_symmetry)
 apply the transformation to the selected elements
 
void scaleSelectedFacesClusters (float scale, ClusterScale method=Uniform_Scaling)
 scale each selection cluster separately, to own center mass
 
void bevelOverSelectedVertices (float size)
 perform the bevel over the selected vertices. As result, new faces will be selected
 
void bevelOverSelectedEdges (float size, int segments=1, bool OldVariant=false)
 perform the bevel over the selected edges.
 
int splitEdge (int vertex1, int vertex2, float position)
 split existing edge somewhere between vertices.
 
bool connect (int vertex1, int vertex2)
 split existing edge somewhere between vertices.
 
bool checkConnectivity (int vertex1, int vertex2)
 check if connecting the two vertices is possible
 
void connectSelectedVerts ()
 connect selected vertices in smart way
 
void invertSelectedFacesTopoplogically ()
 invert selected faces only within the connective area, if some objects has no selected faces, the selection there will not change
 
void inset (float distance)
 perform the inset over the selected faces
 
void shell ()
 perform the shell operation over the selected faces. After calling the shell() you should call the moveSelectedFacesAlongFacesNormals or moveSelectedFacesAlongVertexNormals to give some thickness to the resulting figure
 
void intrude ()
 perform the intrude operation over the selected faces. After calling the intrude() you should call the moveSelectedFacesAlongFacesNormals or moveSelectedFacesAlongVertexNormals to give some thickness to the resulting figure
 
void relaxSelected ()
 relax selected vergtices
 
void selectPath (int vertex1, int vertex2)
 select all edges on the path from vertex1 to vertex2 (add to existing edges selection)
 
std::vector< int > getPath (int vertex1, int vertex2)
 get all vertices on the path from vertex1 to vertex2
 

Static Public Member Functions

static Model fromRetopo ()
 get the reference to the mesh in the retopo room
 
static Model fromModeling ()
 get the reference to the mesh in the modeling room, currently it is the same mesh as in the retopo room
 
static Model fromUv ()
 get the reference to the mesh in the uv room, pay attention that topology changes to that mesh may lead to instability!
 
static Mesh flattenSingleIsland (const Mesh &mesh, int method, bool optimize_rotation=true, bool scale_to_geometry=true)
 Flatten the mesh that consists of the single island.
 

Protected Member Functions

ClusteredMesh & _mctx ()
 
ClusteredMesh * _pmctx () const
 

Static Protected Member Functions

static void inc_ref (ClusteredMesh *m)
 
static void dec_ref (ClusteredMesh *m)
 
static bool has_ref (ClusteredMesh *m)
 
static ClusteredMesh * allocate ()
 
static ClusteredMesh * allocate (ClusteredMesh *src)
 

Protected Attributes

ClusteredMesh * _mesh
 
bool _from_retopo
 
bool _from_uv
 

Static Protected Attributes

static std::vector< std::pair< ClusteredMesh *, int > > allocated_meshes
 

Friends

class Mesh
 

Detailed Description

The class that corresponds to the retopo/modeling rooms meshes. This is advanced version of the Mesh that allows essential topology changes on the fly. It is very similar to Mesh by basic functionality, may be easily converted to Mesh and vice versa. But it is more heavy structure, use Mesh if you don't need the advanced functionality.

Constructor & Destructor Documentation

◆ Model() [1/2]

coat::Model::Model ( const Model source)

make a reference to the source mesh. No new Mesh allocated! Use MakeCopy if you need to make a copy of the mesh

Parameters
sourcethe source mesh

◆ Model() [2/2]

coat::Model::Model ( const Mesh source)

construct model from the Mesh object.

Parameters
sourcethe source Mesh object

Member Function Documentation

◆ addMaterial()

int coat::Model::addMaterial ( const char *  name)

add the new UV set/Material

Parameters
namethe name
Returns
the new UV set/Material index

◆ addObject()

int coat::Model::addObject ( const char *  name)

add new retopo group

Parameters
namethe group name
Returns
the index of new group

◆ addTransformed()

void coat::Model::addTransformed ( const Mesh mesh,
const mat4 Transform = mat4::Identity,
BoolOpType  b = BOOL_MERGE,
bool  select = false,
bool  snap_to_existing = false 
)

insert the mesh to the retopo/modeling room, each object of the mesh treated as the new retopo layer

Parameters
meshthe Mesh object
Transformthe transformation matrix
bthe boolean operation type
selectthe flag that indicates if we need to select faces of the the inserted mesh, used only if b is BOOL_MERGE
snap_to_existingthe flag that indicates if we need to snap the mesh to the existing sculpt/paint objects

◆ bevelOverSelectedEdges()

void coat::Model::bevelOverSelectedEdges ( float  size,
int  segments = 1,
bool  OldVariant = false 
)

perform the bevel over the selected edges.

Parameters
sizethe bevel width
OldVariantif true the older variant of the bevel (splits edges in strightforward way), in some cases it works more stable.

◆ bevelOverSelectedVertices()

void coat::Model::bevelOverSelectedVertices ( float  size)

perform the bevel over the selected vertices. As result, new faces will be selected

Parameters
sizethe bevel size

◆ checkConnectivity()

bool coat::Model::checkConnectivity ( int  vertex1,
int  vertex2 
)

check if connecting the two vertices is possible

Parameters
vertex1the positional vertex index (1)
vertex2the positional vertex index (2)
Returns
true if connection is possible

◆ clearObjectMesh()

void coat::Model::clearObjectMesh ( int  group_index)

remove all faces from the group

Parameters
group_indexthe group index

◆ collapseEdge()

void coat::Model::collapseEdge ( int  vertex1,
int  vertex2 
)

collapse the edge to the middle of the edge

Parameters
vertex1the positional vertex index (1)
vertex2the positional vertex index (2)

◆ connect()

bool coat::Model::connect ( int  vertex1,
int  vertex2 
)

split existing edge somewhere between vertices.

Parameters
vertex1the positional vertex index (1)
vertex2the positional vertex index (2)
Returns
true if succeeed to connect

◆ createNewFace()

int coat::Model::createNewFace ( int  Group,
int  UVSet 
)

create empty face, you need to call setFaceVertices to set the vertices, setFaceUVVerts to set the UV vertices

Parameters
Groupthe face group index
UVSetthe UV set index
Returns
the new face index

◆ createNewUvVertex()

int coat::Model::createNewUvVertex ( const vec2 uv)

create new UV vertex to be used for faces

Parameters
uvthe texture coordinates
Returns
the index

◆ createNewVertex()

int coat::Model::createNewVertex ( const vec3 position)

create the positional vertex

Parameters
positionthe position
Returns
the positional vertex index

◆ displayOptions()

void coat::Model::displayOptions ( bool  showWireframe = true,
bool  showColored = true,
bool  showSeams = true,
bool  showSharpEdges = true,
bool  smoothView = false 
)

Set the display options for the retopo/modeling/uv meshes.

Parameters
showWireframeshow the wireframe
showColoredshow colored clusters
showSeamsshow seams
showSharpEdgesshow sharp edges
smoothViewsmooth view

◆ duplicateObject()

int coat::Model::duplicateObject ( int  group_index,
const char *  name = nullptr,
const mat4 transform = mat4::Identity,
bool  select = false 
)

duplicate the object (retopo group)

Parameters
group_indexthe object/group index
namethe new name, if not passed the name will be generated automatically
transformthe additional transformation matrix
selectthe flag that indicates if we need to select the new object's faces (in addition to existing selection)
Returns
the new object index

◆ facesCount()

int coat::Model::facesCount ( )

get the faces count

Returns
the faces count

◆ flattenSingleIsland()

static Mesh coat::Model::flattenSingleIsland ( const Mesh mesh,
int  method,
bool  optimize_rotation = true,
bool  scale_to_geometry = true 
)
static

Flatten the mesh that consists of the single island.

Parameters
meshthe mesh that consists of the single island
methodthe flattening method. 0 - flatten to the plane, 1 - LSCM, 2 - ABF, 3 - GU, 4 - Stripe (if possible)
optimize_rotationoptimize the rotation of the island, place it approximately horizontally or vertically
scale_to_geometryscale the island to keep average edge length equal to the average edge length of the original mesh
Returns
the flat mesh

◆ fromModeling()

static Model coat::Model::fromModeling ( )
static

get the reference to the mesh in the modeling room, currently it is the same mesh as in the retopo room

Returns
the reference to the mesh

◆ fromRetopo()

static Model coat::Model::fromRetopo ( )
static

get the reference to the mesh in the retopo room

Returns
the reference to the mesh

◆ fromUv()

static Model coat::Model::fromUv ( )
static

get the reference to the mesh in the uv room, pay attention that topology changes to that mesh may lead to instability!

Returns
the reference to the mesh

◆ generateName()

std::string coat::Model::generateName ( const char *  base)

generate unique name for the object, it will start as the string in base base

Parameters
basethe base name
Returns
the unique name

◆ getBorderBetweenIslands()

std::vector< int > coat::Model::getBorderBetweenIslands ( int  uv_set1,
int  island_index1,
int  uv_set2,
int  island_index2 
)

get the border between two islands

Parameters
uv_set1the uv set index of the first island
island_index1the island index within the uv set of the first island
uv_set2the uv set index of the second island
island_index2the island index within the uv set of the second island
Returns
the list of edges that are common for both islands, even amount of elements, each pair of elements is the positional vertex indices of the original mesh

◆ getCurrentObject()

int coat::Model::getCurrentObject ( )

get the index of the current group

Returns
the index

◆ getFaceMaterial()

int coat::Model::getFaceMaterial ( int  face)

get the UV set index for the face

Parameters
facethe face index
Returns
the UV set index, -1 if out of range

◆ getFaceNeighbors()

std::vector< int > coat::Model::getFaceNeighbors ( int  face)

get the list of faces that are adjacent to the face

Parameters
facethe face index
Returns
the list of adjacent faces

◆ getFaceNormal()

vec3 coat::Model::getFaceNormal ( int  face)

get the face normal

Parameters
facethe face index
Returns
the face normal

◆ getFaceObject()

int coat::Model::getFaceObject ( int  face)

get the group index of the face

Parameters
facethe face index
Returns
the group index

◆ getFacesNearEdge()

std::vector< int > coat::Model::getFacesNearEdge ( int  vertex1,
int  vertex2 
)

get the list of faces that are adjacent to the edge

Parameters
vertex1the positional vertex index (1)
vertex2the positional vertex index (2)
Returns
the list of adjacent faces

◆ getFacesNearVertex()

std::vector< int > coat::Model::getFacesNearVertex ( int  vertex)

get the list of faces that are adjacent to the vertex

Parameters
vertexthe vertex index
Returns
the list of adjacent faces

◆ getFaceSquare()

float coat::Model::getFaceSquare ( int  face)

get the face square

Parameters
facethe face index
Returns
the square

◆ getFaceUVSquare()

float coat::Model::getFaceUVSquare ( int  face)

get the face square in UV space

Parameters
facethe face index
Returns
the square

◆ getFaceUvVertex()

int coat::Model::getFaceUvVertex ( int  face,
int  vertex_index 
)

get the UV vertex index over the face

Parameters
facethe face index
vertex_indexthe vertex index over the face
Returns
the UV vertex index, -1 if the vertex/face index is out of range

◆ getFaceUvVerts()

std::vector< int > coat::Model::getFaceUvVerts ( int  face)

get the list of UV vertices indices over the face

Parameters
facethe face index
Returns
the list of UV vertices indices

◆ getFaceUvVertsCount()

int coat::Model::getFaceUvVertsCount ( int  face)

get the amount of UV vertices over the face

Parameters
facethe face index
Returns
amount of vertices over the face, 0 if UV-s not assigned

◆ getFaceVertex()

int coat::Model::getFaceVertex ( int  face,
int  vertex_index 
)

get the vertex index over the face

Parameters
facethe face index
vertex_indexthe vertex index over the face
Returns
the vertex index, -1 if the vertex/face index is out of range

◆ getFaceVerts()

std::vector< int > coat::Model::getFaceVerts ( int  face)

get the list of UV vertex indices over the face, pay attention UV vertices are not same as position vertices

Parameters
facethe face index
Returns
the list of vertex indices

◆ getFaceVertsCount()

int coat::Model::getFaceVertsCount ( int  face)

get the vertices count over the face

Parameters
facethe face index
Returns
the vertices count

◆ getFaceVisibility()

bool coat::Model::getFaceVisibility ( int  face)

get the face visibility

Parameters
facethe face index
Returns
the visibility state

◆ getIslandBorder()

std::vector< int > coat::Model::getIslandBorder ( int  uv_set,
int  island_index 
)

get unsorted list of edges on the border of the island

Parameters
uv_setthe uv set index
island_indexthe island index within the uv set
Returns
the list of edges, even amount of elements, each pair of elements is the positional vertex indices of the original mesh

◆ getIslandVertexMapping()

std::vector< int > coat::Model::getIslandVertexMapping ( int  uv_set,
int  island_index 
)

get the mapping from the vertex index in the mesh that was got by islandToMesh to the vertex index in the original mesh

Parameters
uv_setthe uv set index
island_indexthe island index within the uv set
Returns
the list of the positional vertex indices of the original mesh in same order as the vertices in the mesh that was got by islandToMesh

◆ getIslandVertexUv()

vec2 coat::Model::getIslandVertexUv ( int  uv_set,
int  island_index,
int  vertex_index 
)

get the uv coordinate of the positional vertex in the island

Parameters
uv_setthe uv set index
island_indexthe island index within the uv set
vertex_indexthe positional vertex index
Returns
the uv coordinate of the vertex, vec2(0,0) if the vertex is not in the island

◆ getObjectFaces()

std::vector< int > coat::Model::getObjectFaces ( int  group_index)

get the list of faces in the group

Parameters
group_indexthe group index
Returns
the list of faces

◆ getObjectMesh()

Mesh coat::Model::getObjectMesh ( int  group_index)

get the mesh from some retopo group

Parameters
group_indexthe group index
Returns
the Mesh object

◆ getObjectName()

const char * coat::Model::getObjectName ( int  group_index)

get the retopo group name

Parameters
group_indexthe group index
Returns
the name

◆ getObjectReferenceColor()

vec4 coat::Model::getObjectReferenceColor ( int  group_index)

get the group reference color

Parameters
group_indexthe group index
Returns
the (r,g,b,a) vector, 0..255

◆ getObjectsCount()

int coat::Model::getObjectsCount ( )

get the retopo groups count

Returns
the amount

◆ getObjectVisibility()

bool coat::Model::getObjectVisibility ( int  index)

get the group visibility

Parameters
indexthe group index
Returns
the visibility state

◆ getPath()

std::vector< int > coat::Model::getPath ( int  vertex1,
int  vertex2 
)

get all vertices on the path from vertex1 to vertex2

Parameters
vertex1the first vertex
vertex2the second vertex

◆ getSelectedEdges()

std::vector< int > coat::Model::getSelectedEdges ( )

returns even amount of vertex indices, pairs os start and end vertices of the selected edges

Returns
the list of vertex indices (pairs)

◆ getSelectedFaces()

std::vector< int > coat::Model::getSelectedFaces ( )

get the list of selected faces

Returns
the list of selected faces

◆ getSelectedVertices()

std::vector< int > coat::Model::getSelectedVertices ( )

get the list of selected vertices

Returns
the list of selected vertices

◆ getSelectedVerticesWeights()

std::vector< float > coat::Model::getSelectedVerticesWeights ( )

get the soft selection weights of the selected vertices, 1 is maximum value

Returns
the list of weights, the size of the list is equal to the size of the selected vertices list

◆ getVertex()

vec3 coat::Model::getVertex ( int  vertex)

get the vertex position in space

Parameters
vertexthe vertex index
Returns
the position

◆ getVertexNormal()

vec3 coat::Model::getVertexNormal ( int  vertex)

get vertex normal, calculated as average of adjacent faces normals

Parameters
vertexthe vertex index
Returns
the normal

◆ getVertexUV()

vec2 coat::Model::getVertexUV ( int  uv_vertex)

get the UV coordinates of the UV vertex

Parameters
uv_vertexthe uv vertex index
Returns
teh UV coordinates

◆ getVertsNearVertex()

std::vector< int > coat::Model::getVertsNearVertex ( int  vertex)

get the list of vertices that are adjacent to the vertex

Parameters
vertexthe vertex index
Returns
the list of adjacent vertices

◆ getWholeMesh()

Mesh coat::Model::getWholeMesh ( )

get the whole mesh from the retopo room

Returns
the Mesh object

◆ isEdgeSelected()

bool coat::Model::isEdgeSelected ( int  vertex1,
int  vertex2 
)

check if the edge is selected, order of vertices has no matter

Parameters
vertex1the first vertex index
vertex2the second vertex index
Returns
true if the edge is selected

◆ isFaceSelected()

bool coat::Model::isFaceSelected ( int  face)

check if the face selected

Parameters
facethe face index
Returns
the selection state

◆ islandsCount()

int coat::Model::islandsCount ( int  uv_set)

get the islands count over the current uv-set

Parameters
uv_setthe uv-set index
Returns
teh islands count

◆ islandToMesh()

Mesh coat::Model::islandToMesh ( int  uv_set,
int  island_index 
)

get the mesh that contains the island, xy of each point is the UV coordinate. The mesh contains only one island

Parameters
uv_setthe uv set index
island_indexthe island index within the uv set
Returns
the flat mesh

◆ islandToMeshInSpace()

Mesh coat::Model::islandToMeshInSpace ( int  uv_set,
int  island_index 
)

get the mesh that contains the island, each point is the coordinate in space (not the uv coordinate!). The mesh contains only one island. The faces correspond to the faces of the mesh that was got by islandToMesh

Parameters
uv_setthe uv set index
island_indexthe island index within the uv set
Returns
mesh the 3D mesh

◆ isOpenEdge()

bool coat::Model::isOpenEdge ( int  vertex1,
int  vertex2 
)

check if the edge is open

Parameters
vertex1the positional vertex index (1)
vertex2the positional vertex index (2)
Returns
true if open

◆ isSeam()

bool coat::Model::isSeam ( int  vertex1,
int  vertex2 
)

check if edge is seam

Parameters
vertex1the positional vertex index (1)
vertex2the positional vertex index (2)
Returns
true if seam

◆ isSharpEdge()

bool coat::Model::isSharpEdge ( int  vertex1,
int  vertex2 
)

check if the edge is sharp

Parameters
vertex1the positional vertex index (1)
vertex2the positional vertex index (2)
Returns
true if sharp

◆ isVertexSelected()

bool coat::Model::isVertexSelected ( int  vertex)

check if the vertex is selected

Parameters
vertexthe vertex index
Returns
true if the vertex is selected

◆ meshToIsland()

void coat::Model::meshToIsland ( const Mesh mesh,
int  uv_set,
int  island_index 
)

use the mesh (that was previously got by islandToMesh) to replace the island in the current uv-set

Parameters
meshthe mesh that was previously got by islandToMesh
uv_setthe uv set index
island_indexthe island index within the uv set

◆ moveSelectedFacesAlongFacesNormals()

void coat::Model::moveSelectedFacesAlongFacesNormals ( float  displacement)

move selected faces along the faces normals, trying to keep faces parallel to the original direction

Parameters
displacementthe displacement value

◆ moveSelectedFacesAlongVertexNormals()

void coat::Model::moveSelectedFacesAlongVertexNormals ( float  displacement)

move selected faces along the vertex normals, each vertex displace on the same distance

Parameters
displacementthe displacement value

◆ operator=()

Model & coat::Model::operator= ( const Model source)

the assignment operator. No new Mesh allocated! Use MakeCopy if you need to make a copy of the mesh

Parameters
sourcethe source mesh
Returns
the Mesh reference

◆ pack()

void coat::Model::pack ( int  uv_set,
bool  rotate,
bool  shuffle 
)

pack the islands in the current uv-set

Parameters
uv_setthe uv set index
rotateallow rotation while packing
shuffleshuffle the identical islands to avoid the exact overlapping

◆ removeFace()

void coat::Model::removeFace ( int  face)

remove the face by index

Parameters
facethe face index

◆ scaleSelectedFacesClusters()

void coat::Model::scaleSelectedFacesClusters ( float  scale,
ClusterScale  method = Uniform_Scaling 
)

scale each selection cluster separately, to own center mass

Parameters
scalethe scale coefficient

◆ selectEdge()

void coat::Model::selectEdge ( int  vertex1,
int  vertex2 
)

select the edge by vertex indices (add to selection)

Parameters
vertex1the first vertex index
vertex2the second vertex index

◆ selectedToMesh()

Mesh coat::Model::selectedToMesh ( )

get the selected faces as the Mesh object

Returns
the Mesh

◆ selectedToObject()

void coat::Model::selectedToObject ( int  group_index)

move the selected faces to the group

Parameters
group_indexthe group index

◆ selectFace()

void coat::Model::selectFace ( int  face)

select the face by index

Parameters
facethe face index

◆ selectObject()

void coat::Model::selectObject ( int  group_index,
bool  add_to_selected = true 
)

select all feces in the group

Parameters
group_indexthe group index

◆ selectPath()

void coat::Model::selectPath ( int  vertex1,
int  vertex2 
)

select all edges on the path from vertex1 to vertex2 (add to existing edges selection)

Parameters
vertex1the first vertex
vertex2the second vertex

◆ selectVertex()

void coat::Model::selectVertex ( int  vertex,
float  weight = 1.0f 
)

add the vertex to the selection

Parameters
vertexthe vertex index
weightthe soft selection weight, 1 is maximum value

◆ setCurrentObject()

void coat::Model::setCurrentObject ( int  index)

set the current group index

Parameters
indexthe index

◆ setEdgeSeam()

void coat::Model::setEdgeSeam ( int  vertex1,
int  vertex2,
bool  seam 
)

set or clear the seam state for the edge

Parameters
vertex1the positional vertex index (1)
vertex2the positional vertex index (2)
seamthe seam state

◆ setEdgeSharpness()

void coat::Model::setEdgeSharpness ( int  vertex1,
int  vertex2,
bool  sharp 
)

set the sharpness state for the edge

Parameters
vertex1the positional vertex index (1)
vertex2the positional vertex index (2)
sharpthe sharpness state

◆ setFaceMaterial()

void coat::Model::setFaceMaterial ( int  face,
int  uv_set 
)

set the UV set for the face

Parameters
facethe face index
uv_setthe UV set index

◆ setFaceObject()

void coat::Model::setFaceObject ( int  face,
int  group 
)

set the group index of the face

Parameters
facethe face index
groupthe group index

◆ setFaceUvVerts()

void coat::Model::setFaceUvVerts ( int  face,
const std::vector< int > &  vertices 
)

set the UV vertices for the face

Parameters
facethe face index
verticesthe UV vertices list

◆ setFaceVerts()

void coat::Model::setFaceVerts ( int  face,
const std::vector< int > &  vertices 
)

set the list of positional vertex indices over the face

Parameters
facethe face index
verticesthe list of vertex indices

◆ setFaceVisibility()

void coat::Model::setFaceVisibility ( int  face,
bool  visibility 
)

set the face visibility

Parameters
facethe face index
visibilitythe visibility state

◆ setObjectMesh()

void coat::Model::setObjectMesh ( int  group_index,
Mesh mesh,
const mat4 transform = mat4::Identity 
)

replace the retopo layer with mesh

Parameters
group_indexthe group index
meshthe Mesh object to insert
transformthe transformation matrix

◆ setObjectName()

void coat::Model::setObjectName ( int  index,
const char *  name 
)

rename the group by index

Parameters
indexthe group index to rename
namethe new name

◆ setObjectReferenceColor()

void coat::Model::setObjectReferenceColor ( int  group_index,
vec4  color 
)

set the group reference color

Parameters
group_indexthe group index
colorthe (r,g,b,a) vector, 0..255

◆ setObjectVisibility()

void coat::Model::setObjectVisibility ( int  index,
bool  visible 
)

set the group visibility

Parameters
indexthe group index
visiblethe visibility state

◆ setSelectedEdges()

void coat::Model::setSelectedEdges ( std::vector< int > &  edges)

set the selected edges list

Parameters
edgesthe edges indices list (should be even amount of indices)

◆ setSelectedFaces()

void coat::Model::setSelectedFaces ( std::vector< int > &  faces)

set the selected faces list

Parameters
facesthe faces indices list

◆ setSelectedVertices()

void coat::Model::setSelectedVertices ( const std::vector< int > &  vertices,
const std::vector< float > &  weights 
)

set the selected vertices list

Parameters
verticesthe list of vertices indices
weightsthe list of soft selection weights, the size of the list should be zero or equal to the size of the vertices list. If it is empty, the vertices will be selected with the maximal weight

◆ setVertex()

void coat::Model::setVertex ( int  vertex,
const vec3 position 
)

set the vertex position in space

Parameters
vertexthe vertex index
positionthe position

◆ setVertexUV()

void coat::Model::setVertexUV ( int  uv_vertex,
const vec2 uv 
)

set the UV for the UV vertex

Parameters
uv_vertexthe uv vertex index
uvthe UV coordinates

◆ splitEdge()

int coat::Model::splitEdge ( int  vertex1,
int  vertex2,
float  position 
)

split existing edge somewhere between vertices.

Parameters
vertex1the positional vertex index (1)
vertex2the positional vertex index (2)
positionthe position to split the edge, [0..1], 0 - near the vertex1, 1 - near the vertex2
Returns
the new vertex index

◆ subdivide()

void coat::Model::subdivide ( bool  apply_catmull_clark = true)

subdivide the whole mesh

Parameters
apply_catmull_clarkapply the catmull-clark subdivision

◆ subdivideSelectedFaces()

void coat::Model::subdivideSelectedFaces ( bool  apply_catmull_clark = false)

subdivide the selected faces

Parameters
apply_catmull_clarkapply the catmull-clark subdivision

◆ toAbf()

void coat::Model::toAbf ( int  uv_set,
int  island_index 
)

unwrap the island using the ABF approach

Parameters
uv_setthe uv set index
island_indexthe island index within the uv set

◆ toGu()

void coat::Model::toGu ( int  uv_set,
int  island_index 
)

unwrap the island using the GU (Globally Uniform) approach

Parameters
uv_setthe uv set index
island_indexthe island index within the uv set

◆ toLscm()

void coat::Model::toLscm ( int  uv_set,
int  island_index 
)

unwrap the island using the LSCM approach

Parameters
uv_setthe uv set index
island_indexthe island index within the uv set

◆ toPlanar()

void coat::Model::toPlanar ( int  uv_set,
int  island_index 
)

unwrap the island using the Planar approach

Parameters
uv_setthe uv set index
island_indexthe island index within the uv set

◆ toStripe()

void coat::Model::toStripe ( int  uv_set,
int  island_index 
)

try to uwrap the island as the regular stripe

Parameters
uv_setthe uv set index
island_indexthe island index within the uv set

◆ transform()

Model & coat::Model::transform ( const mat4 m)

transform the whole Model with the matrix

Parameters
mthe transformation matrix
Returns
the reference to the Model

◆ transformSelected()

void coat::Model::transformSelected ( const mat4 transform,
bool  apply_symmetry 
)

apply the transformation to the selected elements

Parameters
transformthe transformation matrix
apply_symmetryapply the global symmetry

◆ unwrap()

void coat::Model::unwrap ( int  uv_set)

unwrap the current uv-set

Parameters
uv_setthe uv set index

◆ updateNormals()

void coat::Model::updateNormals ( bool  for_snapping = true)

update the vertex normals

Parameters
for_snappingif true, the normals will lay in the middle of faces, ne respecting the faces square.

◆ vertsCount()

int coat::Model::vertsCount ( )

get the positional vertices count

Returns
the vertices count

◆ vertsUvCount()

int coat::Model::vertsUvCount ( )

get the uv vertices count

Returns
the uv vertices count

◆ visibleToMesh()

Mesh coat::Model::visibleToMesh ( )

get the visible faces as the Mesh object

Returns
teh Mesh

The documentation for this class was generated from the following file: