Blender V5.0
BKE_subdiv.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2018 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "BLI_array.hh"
12#include "BLI_compiler_compat.h"
14
15struct Mesh;
22
23namespace blender::bke::subdiv {
24
33
42
80
96
130
140 void (*initialize)(Displacement *displacement);
141
154 void (*eval_displacement)(Displacement *displacement,
155 int ptex_face_index,
156 float u,
157 float v,
158 const float3 &dPdu,
159 const float3 &dPdv,
160 float3 &r_D);
161
163 void (*free)(Displacement *displacement);
164
166};
167
211
212/* -------------------------------------------------------------------- */
215
216/* (De)initialize the entire subdivision surface module. */
217void init();
218void exit();
219
221
222/* -------------------------------------------------------------------- */
225
230
232
234
235/* -------------------------------------------------------------------- */
238
239void stats_init(SubdivStats *stats);
240
241void stats_begin(SubdivStats *stats, StatsValue value);
242void stats_end(SubdivStats *stats, StatsValue value);
243
244void stats_reset(SubdivStats *stats, StatsValue value);
245
246void stats_print(const SubdivStats *stats);
247
249
250/* -------------------------------------------------------------------- */
253
254bool settings_equal(const Settings *settings_a, const Settings *settings_b);
255
257
258/* -------------------------------------------------------------------- */
261
266Subdiv *new_from_converter(const Settings *settings, OpenSubdiv_Converter *converter);
267Subdiv *new_from_mesh(const Settings *settings, const Mesh *mesh);
268
278Subdiv *update_from_converter(Subdiv *subdiv,
279 const Settings *settings,
280 OpenSubdiv_Converter *converter);
281Subdiv *update_from_mesh(Subdiv *subdiv, const Settings *settings, const Mesh *mesh);
282
283void free(Subdiv *subdiv);
284
286
287/* -------------------------------------------------------------------- */
290
292 const Mesh *mesh,
293 const MultiresModifierData *mmd);
294
295void displacement_detach(Subdiv *subdiv);
296
298
299/* -------------------------------------------------------------------- */
302
309
311
312/* -------------------------------------------------------------------- */
315
320BLI_INLINE void ptex_face_uv_to_grid_uv(float ptex_u,
321 float ptex_v,
322 float *r_grid_u,
323 float *r_grid_v);
325
327BLI_INLINE void grid_uv_to_ptex_face_uv(float grid_u,
328 float grid_v,
329 float *r_ptex_u,
330 float *r_ptex_v);
331
336BLI_INLINE int grid_size_from_level(int level);
337
344BLI_INLINE int rotate_quad_to_corner(float quad_u,
345 float quad_v,
346 float *r_corner_u,
347 float *r_corner_v);
349
355 int corner, float grid_u, float grid_v, float *r_quad_u, float *r_quad_v);
356
358BLI_INLINE float crease_to_sharpness(float crease);
359BLI_INLINE float sharpness_to_crease(float sharpness);
360
362
363} // namespace blender::bke::subdiv
364
365#include "intern/subdiv_inline.hh" // IWYU pragma: export
#define BLI_INLINE
ATTR_WARN_UNUSED_RESULT const BMVert * v
blender::gpu::Batch * quad
void free(Subdiv *subdiv)
Definition subdiv.cc:190
BLI_INLINE float crease_to_sharpness(float crease)
BLI_INLINE void rotate_grid_to_quad(int corner, float grid_u, float grid_v, float *r_quad_u, float *r_quad_v)
void displacement_attach_from_multires(Subdiv *subdiv, const Mesh *mesh, const MultiresModifierData *mmd)
@ SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_AND_JUNCTIONS
Definition BKE_subdiv.hh:37
@ SUBDIV_FVAR_LINEAR_INTERPOLATION_BOUNDARIES
Definition BKE_subdiv.hh:39
@ SUBDIV_FVAR_LINEAR_INTERPOLATION_NONE
Definition BKE_subdiv.hh:35
@ SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY
Definition BKE_subdiv.hh:36
@ SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_JUNCTIONS_AND_CONCAVE
Definition BKE_subdiv.hh:38
Subdiv * new_from_mesh(const Settings *settings, const Mesh *mesh)
Definition subdiv.cc:131
BLI_INLINE void grid_uv_to_ptex_face_uv(float grid_u, float grid_v, float *r_ptex_u, float *r_ptex_v)
void stats_init(SubdivStats *stats)
void displacement_detach(Subdiv *subdiv)
BLI_INLINE float sharpness_to_crease(float sharpness)
BLI_INLINE void ptex_face_uv_to_grid_uv(float ptex_u, float ptex_v, float *r_grid_u, float *r_grid_v)
BLI_INLINE int grid_size_from_level(int level)
BLI_INLINE int rotate_quad_to_corner(float quad_u, float quad_v, float *r_corner_u, float *r_corner_v)
FVarLinearInterpolation fvar_interpolation_from_uv_smooth(int uv_smooth)
Definition subdiv.cc:47
void stats_reset(SubdivStats *stats, StatsValue value)
Subdiv * update_from_converter(Subdiv *subdiv, const Settings *settings, OpenSubdiv_Converter *converter)
Definition subdiv.cc:145
Subdiv * new_from_converter(const Settings *settings, OpenSubdiv_Converter *converter)
Definition subdiv.cc:98
void stats_begin(SubdivStats *stats, StatsValue value)
void stats_end(SubdivStats *stats, StatsValue value)
VtxBoundaryInterpolation vtx_boundary_interpolation_from_subsurf(int boundary_smooth)
Definition subdiv.cc:67
void stats_print(const SubdivStats *stats)
@ SUBDIV_STATS_TOPOLOGY_REFINER_CREATION_TIME
Definition BKE_subdiv.hh:85
Subdiv * update_from_mesh(Subdiv *subdiv, const Settings *settings, const Mesh *mesh)
Definition subdiv.cc:179
bool settings_equal(const Settings *settings_a, const Settings *settings_b)
Definition subdiv.cc:83
Span< int > face_ptex_offset_get(Subdiv *subdiv)
Definition subdiv.cc:214
VecBase< float, 2 > float2
VecBase< float, 3 > float3
void(* eval_displacement)(Displacement *displacement, int ptex_face_index, float u, float v, const float3 &dPdu, const float3 &dPdv, float3 &r_D)
void(* free)(Displacement *displacement)
void(* initialize)(Displacement *displacement)
VtxBoundaryInterpolation vtx_boundary_interpolation
Definition BKE_subdiv.hh:77
FVarLinearInterpolation fvar_linear_interpolation
Definition BKE_subdiv.hh:78
double values_[NUM_SUBDIV_STATS_VALUES]
double begin_timestamp_[NUM_SUBDIV_STATS_VALUES]
blender::Array< int > face_ptex_offset
Displacement * displacement_evaluator
struct blender::bke::subdiv::Subdiv::@175004354316036271255360353077017055312262350106 cache_
OpenSubdiv_Evaluator * evaluator
blender::opensubdiv::TopologyRefinerImpl * topology_refiner