Blender V4.3
GEO_uv_parametrizer.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include "BLI_sys_types.h" /* for intptr_t support */
8
9namespace slim {
10struct MatrixTransfer;
11}
12
17struct GHash;
18struct Heap;
19struct MemArena;
20struct RNG;
21
22namespace blender::geometry {
23
24struct PChart;
25struct PHash;
26
27using ParamKey = uintptr_t; /* Key (hash) for identifying verts and faces. */
28#define PARAM_KEY_MAX UINTPTR_MAX
29
36
38 public:
41
43 MemArena *arena = nullptr;
45 Heap *polyfill_heap = nullptr;
46
48 PHash *hash_verts = nullptr;
49 PHash *hash_edges = nullptr;
50 PHash *hash_faces = nullptr;
51
52 GHash *pin_hash = nullptr;
54
55 PChart **charts = nullptr;
56 int ncharts = 0;
57
58 float aspect_y = 1.0f;
59
60 RNG *rng = nullptr;
61 float blend = 0.0f;
62
63 /* SLIM uv unwrapping */
65};
66
67/* -------------------------------------------------------------------- */
82void uv_parametrizer_aspect_ratio(ParamHandle *handle, float aspect_y);
83
84void uv_prepare_pin_index(ParamHandle *handle, const int bmvertindex, const float uv[2]);
85
86ParamKey uv_find_pin_index(ParamHandle *handle, const int bmvertindex, const float uv[2]);
87
89 const ParamKey key,
90 const int nverts,
91 const ParamKey *vkeys,
92 const float **co,
93 float **uv, /* Output will eventually be written to `uv`. */
94 const float *weight,
95 const bool *pin,
96 const bool *select);
97
98void uv_parametrizer_edge_set_seam(ParamHandle *phandle, const ParamKey *vkeys);
99
101 bool fill_holes,
102 bool topology_from_uvs,
103 int *r_count_failed = nullptr);
104
107/* -------------------------------------------------------------------- */
116 float weight_influence = 0.0f;
117 int iterations = 0;
118 bool no_flip = false;
119 bool skip_init = false;
120};
121
123 const ParamSlimOptions *slim_options,
124 int *count_changed,
125 int *count_failed);
126
127void uv_parametrizer_slim_live_begin(ParamHandle *phandle, const ParamSlimOptions *slim_options);
131bool uv_parametrizer_is_slim(const ParamHandle *phandle);
132
135/* -------------------------------------------------------------------- */
148void uv_parametrizer_lscm_begin(ParamHandle *handle, bool live, bool abf);
149void uv_parametrizer_lscm_solve(ParamHandle *handle, int *count_changed, int *count_failed);
151
154/* -------------------------------------------------------------------- */
162
165/* -------------------------------------------------------------------- */
169void uv_parametrizer_pack(ParamHandle *handle, float margin, bool do_rotate, bool ignore_pinned);
170
173/* -------------------------------------------------------------------- */
177void uv_parametrizer_average(ParamHandle *handle, bool ignore_pinned, bool scale_uv, bool shear);
178
181/* -------------------------------------------------------------------- */
187
190} // namespace blender::geometry
ccl_device_inline float4 select(const int4 mask, const float4 a, const float4 b)
bool uv_parametrizer_is_slim(const ParamHandle *phandle)
void uv_parametrizer_construct_end(ParamHandle *phandle, bool fill_holes, bool topology_from_uvs, int *r_count_failed=nullptr)
void uv_parametrizer_edge_set_seam(ParamHandle *phandle, const ParamKey *vkeys)
void uv_parametrizer_average(ParamHandle *handle, bool ignore_pinned, bool scale_uv, bool shear)
void uv_parametrizer_flush(ParamHandle *handle)
void uv_parametrizer_slim_live_begin(ParamHandle *phandle, const ParamSlimOptions *slim_options)
void uv_parametrizer_slim_stretch_iteration(ParamHandle *phandle, float blend)
void uv_parametrizer_slim_live_solve_iteration(ParamHandle *phandle)
ParamKey uv_find_pin_index(ParamHandle *handle, const int bmvertindex, const float uv[2])
void uv_prepare_pin_index(ParamHandle *handle, const int bmvertindex, const float uv[2])
void uv_parametrizer_slim_live_end(ParamHandle *phandle)
void uv_parametrizer_stretch_blend(ParamHandle *handle, float blend)
void uv_parametrizer_slim_solve(ParamHandle *phandle, const ParamSlimOptions *slim_options, int *count_changed, int *count_failed)
void uv_parametrizer_lscm_end(ParamHandle *handle)
void uv_parametrizer_aspect_ratio(ParamHandle *handle, float aspect_y)
void uv_parametrizer_stretch_begin(ParamHandle *handle)
void uv_parametrizer_flush_restore(ParamHandle *handle)
void uv_parametrizer_lscm_begin(ParamHandle *handle, bool live, bool abf)
void uv_parametrizer_lscm_solve(ParamHandle *handle, int *count_changed, int *count_failed)
void uv_parametrizer_stretch_iter(ParamHandle *handle)
void uv_parametrizer_pack(ParamHandle *handle, float margin, bool do_rotate, bool ignore_pinned)
void uv_parametrizer_stretch_end(ParamHandle *handle)
void uv_parametrizer_face_add(ParamHandle *handle, const ParamKey key, const int nverts, const ParamKey *vkeys, const float **co, float **uv, const float *weight, const bool *pin, const bool *select)
_W64 unsigned int uintptr_t
Definition stdint.h:119
Definition rand.cc:33