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

The UV API. The mesh is taken from the current room. If paint or UV rooms is active, the mesh is taken from the paint room, otherwise the mesh is taken from the Retopo room. More...

#include <CoreAPI.h>

Static Public Member Functions

static int uvSetsCount ()
 get the UV-sets count.
 
static void setUnwrapIslandsDistance (float distance)
 set the border around the islands when we pack it
 
static float getUnwrapIslandsDistance ()
 get the border around the islands when we pack it
 
static int currentUvSet ()
 get the current uv-set index
 
static int islandsCount (int uv_set)
 get the islands count over the current uv-set
 
static 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
 
static 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
 
static 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
 
static std::vector< int > getIslandBorder (int uv_set, int island_index)
 get unsorted list of edges on the border of the island
 
static std::vector< int > getBorderBetweenIslands (int uv_set1, int island_index1, int uv_set2, int island_index2)
 get the border between two islands
 
static vec2 getIslandVertexUv (int uv_set, int island_index, int vertex_index)
 get the uv coordinate of the positional vertex in the island
 
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.
 
static 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
 
static void pack (int uv_set, bool rotate, bool shuffle)
 pack the islands in the current uv-set
 
static void unwrap (int uv_set)
 unwrap the current uv-set
 
static void toAbf (int uv_set, int island_index)
 unwrap the island using the ABF approach
 
static void toLscm (int uv_set, int island_index)
 unwrap the island using the LSCM approach
 
static void toGu (int uv_set, int island_index)
 unwrap the island using the GU (Globally Uniform) approach
 
static void toPlanar (int uv_set, int island_index)
 unwrap the island using the Planar approach
 
static void toStripe (int uv_set, int island_index)
 try to uwrap the island as the regular stripe
 
static void toUvSet (int uv_set, int island_index, int destination_uv_set)
 move the island from one uv-set to another one
 
static Mesh getWholeMesh ()
 get the whole mesh from the paint/UV/Retopo room - in dependence on current room
 
static Mesh selectedToMesh ()
 get the selected faces as the Mesh object
 
static std::vector< int > getSeams ()
 get all seams across the mesh
 
static void addSeam (DWORDS2 start_vertex_index, int end_vertex_index)
 add the seam to the mesh
 
static void removeSeam (int start_vertex_index, int end_vertex_index)
 remove the seam from the mesh
 
static std::vector< int > getSharpEdges ()
 get the sharp edges across the mesh
 
static void addSharpEdge (int start_vertex_index, int end_vertex_index)
 add the sharp edge to the mesh
 
static void removeSharpEdge (int start_vertex_index, int end_vertex_index)
 remove the sharp edge from the mesh
 
static void unwrapUnassigned ()
 re-wrap/extend islands in correspondence to the changed seams and inserted faces. Pay attention, that it may lead to islands intersection.
 
static void applyUVSet ()
 apply uv changes to the paint room mesh (if we use uv/paint context)
 

Detailed Description

The UV API. The mesh is taken from the current room. If paint or UV rooms is active, the mesh is taken from the paint room, otherwise the mesh is taken from the Retopo room.

Examples
TreesGenerator.cpp.

Member Function Documentation

◆ addSeam()

static void coat::uv::addSeam ( DWORDS2  start_vertex_index,
int  end_vertex_index 
)
static

add the seam to the mesh

Parameters
start_vertex_indexthe start positional vertex index
end_vertex_indexthe end positional vertex index

◆ addSharpEdge()

static void coat::uv::addSharpEdge ( int  start_vertex_index,
int  end_vertex_index 
)
static

add the sharp edge to the mesh

Parameters
start_vertex_indexthe start positional vertex index
end_vertex_indexthe end positional vertex index

◆ currentUvSet()

static int coat::uv::currentUvSet ( )
static

get the current uv-set index

Returns
the index

◆ flattenSingleIsland()

static Mesh coat::uv::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

◆ getBorderBetweenIslands()

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

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

◆ getIslandBorder()

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

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

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

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

static vec2 coat::uv::getIslandVertexUv ( int  uv_set,
int  island_index,
int  vertex_index 
)
static

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

◆ getSeams()

static std::vector< int > coat::uv::getSeams ( )
static

get all seams across the mesh

Returns
the list of integer values, each value is the index of the vertex in the mesh, the even index is start of the seam, the odd index is the end of the seam

◆ getSharpEdges()

static std::vector< int > coat::uv::getSharpEdges ( )
static

get the sharp edges across the mesh

Returns
the list of integer values, each value is the index of the vertex in the mesh, the even index is start of the edge, the odd index is the end of the edge

◆ getUnwrapIslandsDistance()

static float coat::uv::getUnwrapIslandsDistance ( )
static

get the border around the islands when we pack it

Returns
the border size in percents

◆ getWholeMesh()

static Mesh coat::uv::getWholeMesh ( )
static

get the whole mesh from the paint/UV/Retopo room - in dependence on current room

Returns
the whole paint or retopo mesh (in dependence on current room)

◆ islandsCount()

static int coat::uv::islandsCount ( int  uv_set)
static

get the islands count over the current uv-set

Parameters
uv_setthe uv-set index
Returns
teh islands count

◆ islandToMesh()

static Mesh coat::uv::islandToMesh ( int  uv_set,
int  island_index 
)
static

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

static Mesh coat::uv::islandToMeshInSpace ( int  uv_set,
int  island_index 
)
static

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

◆ meshToIsland()

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

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

◆ pack()

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

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

◆ removeSeam()

static void coat::uv::removeSeam ( int  start_vertex_index,
int  end_vertex_index 
)
static

remove the seam from the mesh

Parameters
start_vertex_indexthe start positional vertex index
end_vertex_indexthe end positional vertex index

◆ removeSharpEdge()

static void coat::uv::removeSharpEdge ( int  start_vertex_index,
int  end_vertex_index 
)
static

remove the sharp edge from the mesh

Parameters
start_vertex_indexthe start positional vertex index
end_vertex_indexthe end positional vertex index

◆ selectedToMesh()

static Mesh coat::uv::selectedToMesh ( )
static

get the selected faces as the Mesh object

Returns
the Mesh

◆ setUnwrapIslandsDistance()

static void coat::uv::setUnwrapIslandsDistance ( float  distance)
static

set the border around the islands when we pack it

Parameters
distancethe border size in percents

◆ toAbf()

static void coat::uv::toAbf ( int  uv_set,
int  island_index 
)
static

unwrap the island using the ABF approach

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

◆ toGu()

static void coat::uv::toGu ( int  uv_set,
int  island_index 
)
static

unwrap the island using the GU (Globally Uniform) approach

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

◆ toLscm()

static void coat::uv::toLscm ( int  uv_set,
int  island_index 
)
static

unwrap the island using the LSCM approach

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

◆ toPlanar()

static void coat::uv::toPlanar ( int  uv_set,
int  island_index 
)
static

unwrap the island using the Planar approach

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

◆ toStripe()

static void coat::uv::toStripe ( int  uv_set,
int  island_index 
)
static

try to uwrap the island as the regular stripe

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

◆ toUvSet()

static void coat::uv::toUvSet ( int  uv_set,
int  island_index,
int  destination_uv_set 
)
static

move the island from one uv-set to another one

Parameters
uv_setthe source uv set index
island_indexthe island index within the source uv set
destination_uv_setthe destination uv set index

◆ unwrap()

static void coat::uv::unwrap ( int  uv_set)
static

unwrap the current uv-set

Parameters
uv_setthe uv set index

◆ uvSetsCount()

static int coat::uv::uvSetsCount ( )
static

get the UV-sets count.

Returns
the amount

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