Blender V5.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
10
11#include <cstdint>
12
13namespace slim {
14struct MatrixTransfer;
15}
16
17namespace blender {
18
19namespace geometry {
20class UVPackIsland_Params;
21}
22
23struct GHash;
24struct Heap;
25struct MemArena;
26struct RNG;
27
28namespace geometry {
29
30struct PChart;
31struct PHash;
32
33using ParamKey = uintptr_t; /* Key (hash) for identifying verts and faces. */
34#define PARAM_KEY_MAX UINTPTR_MAX
35
42
44 public:
47
49 MemArena *arena = nullptr;
51 Heap *polyfill_heap = nullptr;
52
54 PHash *hash_verts = nullptr;
55 PHash *hash_edges = nullptr;
56 PHash *hash_faces = nullptr;
57
58 GHash *pin_hash = nullptr;
60
61 PChart **charts = nullptr;
62 int ncharts = 0;
63
64 float aspect_y = 1.0f;
65
66 RNG *rng = nullptr;
67 float blend = 0.0f;
68
69 /* SLIM uv unwrapping */
71};
72
73/* -------------------------------------------------------------------- */
87
88void uv_parametrizer_aspect_ratio(ParamHandle *handle, float aspect_y);
89
90void uv_prepare_pin_index(ParamHandle *handle, const int bmvertindex, const float uv[2]);
91
92ParamKey uv_find_pin_index(ParamHandle *handle, const int bmvertindex, const float uv[2]);
93
95 const ParamKey key,
96 const int nverts,
97 const ParamKey *vkeys,
98 const float **co,
99 float **uv, /* Output will eventually be written to `uv`. */
100 const float *weight,
101 const bool *pin,
102 const bool *select);
103
104void uv_parametrizer_edge_set_seam(ParamHandle *phandle, const ParamKey *vkeys);
105
107 bool fill_holes,
108 bool topology_from_uvs,
109 int *r_count_failed = nullptr);
110
112
113/* -------------------------------------------------------------------- */
120
122 float weight_influence = 0.0f;
123 int iterations = 0;
124 bool no_flip = false;
125 bool skip_init = false;
126};
127
129 const ParamSlimOptions *slim_options,
130 bool use_original_bounds,
131 int *count_changed,
132 int *count_failed);
133
134void uv_parametrizer_slim_live_begin(ParamHandle *phandle, const ParamSlimOptions *slim_options);
137void uv_parametrizer_slim_stretch_iteration(ParamHandle *phandle, float blend);
138bool uv_parametrizer_is_slim(const ParamHandle *phandle);
139
141
142/* -------------------------------------------------------------------- */
154
156 bool live,
157 bool abf,
158 bool use_original_bounds);
159void uv_parametrizer_lscm_solve(ParamHandle *handle, int *count_changed, int *count_failed);
161
163
164/* -------------------------------------------------------------------- */
167
169void uv_parametrizer_stretch_blend(ParamHandle *handle, float blend);
172
174
175/* -------------------------------------------------------------------- */
178
179void uv_parametrizer_pack(ParamHandle *handle, const UVPackIsland_Params &params);
180
182
183/* -------------------------------------------------------------------- */
186
188
190
191/* -------------------------------------------------------------------- */
194
195void uv_parametrizer_average(ParamHandle *handle, bool ignore_pinned, bool scale_uv, bool shear);
196
198
199/* -------------------------------------------------------------------- */
202
205
207
208} // namespace geometry
209} // namespace blender
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_lscm_begin(ParamHandle *handle, bool live, bool abf, bool use_original_bounds)
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_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_pack(ParamHandle *handle, const UVPackIsland_Params &params)
void uv_parametrizer_lscm_solve(ParamHandle *handle, int *count_changed, int *count_failed)
void uv_parametrizer_stretch_iter(ParamHandle *handle)
void uv_parametrizer_slim_solve(ParamHandle *phandle, const ParamSlimOptions *slim_options, bool use_original_bounds, int *count_changed, int *count_failed)
void uv_parametrizer_original_bounds(ParamHandle *phandle)
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)
BMesh Iterators.
_W64 unsigned int uintptr_t
Definition BKE_text.h:120