Blender V5.0
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 <cstdint>
8
9namespace slim {
10struct MatrixTransfer;
11}
12
13namespace blender::geometry {
14class UVPackIsland_Params;
15}
16
20
21struct GHash;
22struct Heap;
23struct MemArena;
24struct RNG;
25
26namespace blender::geometry {
27
28struct PChart;
29struct PHash;
30
31using ParamKey = uintptr_t; /* Key (hash) for identifying verts and faces. */
32#define PARAM_KEY_MAX UINTPTR_MAX
33
40
42 public:
45
47 MemArena *arena = nullptr;
49 Heap *polyfill_heap = nullptr;
50
52 PHash *hash_verts = nullptr;
53 PHash *hash_edges = nullptr;
54 PHash *hash_faces = nullptr;
55
56 GHash *pin_hash = nullptr;
58
59 PChart **charts = nullptr;
60 int ncharts = 0;
61
62 float aspect_y = 1.0f;
63
64 RNG *rng = nullptr;
65 float blend = 0.0f;
66
67 /* SLIM uv unwrapping */
69};
70
71/* -------------------------------------------------------------------- */
85
86void uv_parametrizer_aspect_ratio(ParamHandle *handle, float aspect_y);
87
88void uv_prepare_pin_index(ParamHandle *handle, const int bmvertindex, const float uv[2]);
89
90ParamKey uv_find_pin_index(ParamHandle *handle, const int bmvertindex, const float uv[2]);
91
93 const ParamKey key,
94 const int nverts,
95 const ParamKey *vkeys,
96 const float **co,
97 float **uv, /* Output will eventually be written to `uv`. */
98 const float *weight,
99 const bool *pin,
100 const bool *select);
101
102void uv_parametrizer_edge_set_seam(ParamHandle *phandle, const ParamKey *vkeys);
103
105 bool fill_holes,
106 bool topology_from_uvs,
107 int *r_count_failed = nullptr);
108
110
111/* -------------------------------------------------------------------- */
118
120 float weight_influence = 0.0f;
121 int iterations = 0;
122 bool no_flip = false;
123 bool skip_init = false;
124};
125
127 const ParamSlimOptions *slim_options,
128 int *count_changed,
129 int *count_failed);
130
131void uv_parametrizer_slim_live_begin(ParamHandle *phandle, const ParamSlimOptions *slim_options);
135bool uv_parametrizer_is_slim(const ParamHandle *phandle);
136
138
139/* -------------------------------------------------------------------- */
151
152void uv_parametrizer_lscm_begin(ParamHandle *handle, bool live, bool abf);
153void uv_parametrizer_lscm_solve(ParamHandle *handle, int *count_changed, int *count_failed);
155
157
158/* -------------------------------------------------------------------- */
161
166
168
169/* -------------------------------------------------------------------- */
172
174
176
177/* -------------------------------------------------------------------- */
180
181void uv_parametrizer_average(ParamHandle *handle, bool ignore_pinned, bool scale_uv, bool shear);
182
184
185/* -------------------------------------------------------------------- */
188
191
193
194} // namespace blender::geometry
#define select(A, B, C)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
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_pack(ParamHandle *handle, const UVPackIsland_Params &params)
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_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)
Definition rand.cc:33
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)