Changeset View
Changeset View
Standalone View
Standalone View
source/blender/bmesh/intern/bmesh_query_uv.c
| Show First 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | float BM_face_uv_calc_cross(const BMFace *f, const int cd_loop_uv_offset) | ||||
| l_iter = l_first = BM_FACE_FIRST_LOOP(f); | l_iter = l_first = BM_FACE_FIRST_LOOP(f); | ||||
| do { | do { | ||||
| const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); | const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); | ||||
| copy_v2_v2(uvs[i++], luv->uv); | copy_v2_v2(uvs[i++], luv->uv); | ||||
| } while ((l_iter = l_iter->next) != l_first); | } while ((l_iter = l_iter->next) != l_first); | ||||
| return cross_poly_v2(uvs, f->len); | return cross_poly_v2(uvs, f->len); | ||||
| } | } | ||||
| void BM_face_uv_minmax(const BMFace *f, float min[2], float max[2], const int cd_loop_uv_offset) | |||||
| { | |||||
| const BMLoop *l_iter; | |||||
| const BMLoop *l_first; | |||||
| l_iter = l_first = BM_FACE_FIRST_LOOP(f); | |||||
| do { | |||||
| const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); | |||||
| minmax_v2v2_v2(min, max, luv->uv); | |||||
| } while ((l_iter = l_iter->next) != l_first); | |||||
| } | |||||
| void BM_face_uv_transform(BMFace *f, const float matrix[2][2], const int cd_loop_uv_offset) | |||||
| { | |||||
| BMLoop *l_iter; | |||||
| BMLoop *l_first; | |||||
| l_iter = l_first = BM_FACE_FIRST_LOOP(f); | |||||
| do { | |||||
| MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); | |||||
| mul_m2_v2(matrix, luv->uv); | |||||
| } while ((l_iter = l_iter->next) != l_first); | |||||
| } | |||||
| /** | /** | ||||
| * Check if two loops that share an edge also have the same UV coordinates. | * Check if two loops that share an edge also have the same UV coordinates. | ||||
| */ | */ | ||||
| bool BM_loop_uv_share_edge_check(BMLoop *l_a, BMLoop *l_b, const int cd_loop_uv_offset) | bool BM_loop_uv_share_edge_check(BMLoop *l_a, BMLoop *l_b, const int cd_loop_uv_offset) | ||||
| { | { | ||||
| BLI_assert(l_a->e == l_b->e); | BLI_assert(l_a->e == l_b->e); | ||||
| MLoopUV *luv_a_curr = BM_ELEM_CD_GET_VOID_P(l_a, cd_loop_uv_offset); | MLoopUV *luv_a_curr = BM_ELEM_CD_GET_VOID_P(l_a, cd_loop_uv_offset); | ||||
| MLoopUV *luv_a_next = BM_ELEM_CD_GET_VOID_P(l_a->next, cd_loop_uv_offset); | MLoopUV *luv_a_next = BM_ELEM_CD_GET_VOID_P(l_a->next, cd_loop_uv_offset); | ||||
| ▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines | |||||