187 linear_grids->
level = 0;
196 const size_t grid_area = grid_size * grid_size;
197 const size_t num_grid_elements = num_grids * grid_area;
200 linear_grids->
level = level;
207 for (
int i = 0; i < num_grids; ++i) {
208 const size_t element_offset = grid_area * i;
219 const int grid_size = linear_grids->
grid_size;
221 const int grid_x = lround(grid_coord->
u * (grid_size - 1));
222 const int grid_y = lround(grid_coord->
v * (grid_size - 1));
223 const int grid_element_index = grid_y * grid_size + grid_x;
226 return &grid->
elements[grid_element_index];
237 linear_grid_element->
mask = 0.0f;
250 const float weights[4])
252 result->mask = elements[0].
mask * weights[0] + elements[1].
mask * weights[1] +
253 elements[2].
mask * weights[2] + elements[3].
mask * weights[3];
266 const int num_grids = reshape_context->
num_grids;
268 const int grid_area = grid_size * grid_size;
272 for (
int grid_index = 0; grid_index < num_grids; ++grid_index) {
274 sizeof(
SurfacePoint), grid_area,
"delta grid displacement");
288 const int num_grids = reshape_context->
num_grids;
289 for (
int grid_index = 0; grid_index < num_grids; ++grid_index) {
300 const int grid_index = grid_coord->
grid_index;
302 const int grid_x = lround(grid_coord->
u * (grid_size - 1));
303 const int grid_y = lround(grid_coord->
v * (grid_size - 1));
304 const int grid_element_index = grid_y * grid_size + grid_x;
307 return &surface_grid->
points[grid_element_index];
313 float tangent_matrix[3][3])
347 const int grid_index = first_corner->
grid_index;
350 for (
int face_corner = 0; face_corner < face->
num_corners; ++face_corner) {
390 static float lerp(
float t,
float a,
float b)
392 return (
a +
t * (b -
a));
412 const float u01 =
lerp(u, face_grid_coords[0]->u, face_grid_coords[1]->u);
413 const float u32 =
lerp(u, face_grid_coords[3]->u, face_grid_coords[2]->u);
415 const float v03 =
lerp(
v, face_grid_coords[0]->
v, face_grid_coords[3]->
v);
416 const float v12 =
lerp(
v, face_grid_coords[1]->
v, face_grid_coords[2]->
v);
424 const int face_index,
430 const int inner_grid_size =
data->inner_grid_size;
431 const float inner_grid_size_1_inv =
data->inner_grid_size_1_inv;
437 for (
int y = 0;
y < inner_grid_size; ++
y) {
438 const float ptex_v = (
float)
y * inner_grid_size_1_inv;
439 for (
int x = 0;
x < inner_grid_size; ++
x) {
440 const float ptex_u = (
float)
x * inner_grid_size_1_inv;
444 ptex_coord.
u = ptex_u;
445 ptex_coord.
v = ptex_v;
450 data->callback(reshape_smooth_context, &ptex_coord, &grid_coord,
data->callback_userdata_v);
457 void *callback_userdata_v)
463 data.reshape_smooth_context = reshape_smooth_context;
464 data.inner_grid_size = (1 << level_difference) + 1;
465 data.inner_grid_size_1_inv = 1.0f / (
float)(
data.inner_grid_size - 1);
467 data.callback_userdata_v = callback_userdata_v;
566 const int num_vertices,
569 const int num_polygons)
579 sizeof(
Vertex), num_vertices,
"smooth vertices");
583 sizeof(
Edge), max_edges,
"smooth edges");
587 sizeof(
Corner), num_loops,
"smooth corners");
591 sizeof(
Face), num_polygons,
"smooth faces");
598 const int subdiv_vertex_index)
602 BLI_assert(subdiv_vertex_index < reshape_smooth_context->geometry.num_vertices);
615 const int subdiv_vertex_index)
625 const MPoly *base_poly = &base_mesh->
mpoly[face_index];
626 const int num_corners = base_poly->
totloop;
630 if (grid_coord.
u == 0.0f && grid_coord.
v == 0.0f) {
631 for (
int current_corner = 0; current_corner < num_corners; ++current_corner) {
632 GridCoord corner_grid_coord = grid_coord;
633 corner_grid_coord.
grid_index = start_grid_index + current_corner;
641 if (grid_coord.
u == 0.0f) {
643 prev_grid_coord.
grid_index = start_grid_index + ((
corner + num_corners - 1) % num_corners);
644 prev_grid_coord.
u = grid_coord.
v;
645 prev_grid_coord.
v = 0.0f;
650 if (grid_coord.
v == 0.0f) {
652 next_grid_coord.
grid_index = start_grid_index + ((
corner + 1) % num_corners);
653 next_grid_coord.
u = 0.0f;
654 next_grid_coord.
v = grid_coord.
u;
662 const int ptex_face_index,
663 const float ptex_face_u,
664 const float ptex_face_v,
665 const int UNUSED(coarse_poly_index),
666 const int UNUSED(coarse_corner),
667 const int subdiv_vertex_index)
674 foreach_vertex(foreach_context, &ptex_coord, subdiv_vertex_index);
679 const int ptex_face_index,
680 const float ptex_face_u,
681 const float ptex_face_v,
682 const int UNUSED(coarse_vertex_index),
683 const int UNUSED(coarse_face_index),
684 const int UNUSED(coarse_face_corner),
685 const int subdiv_vertex_index)
692 foreach_vertex(foreach_context, &ptex_coord, subdiv_vertex_index);
697 const int ptex_face_index,
698 const float ptex_face_u,
699 const float ptex_face_v,
700 const int UNUSED(coarse_edge_index),
701 const int UNUSED(coarse_face_index),
702 const int UNUSED(coarse_face_corner),
703 const int subdiv_vertex_index)
710 foreach_vertex(foreach_context, &ptex_coord, subdiv_vertex_index);
715 const int UNUSED(ptex_face_index),
716 const float UNUSED(ptex_face_u),
717 const float UNUSED(ptex_face_v),
718 const int UNUSED(coarse_loop_index),
719 const int coarse_poly_index,
720 const int coarse_corner,
721 const int subdiv_loop_index,
722 const int subdiv_vertex_index,
723 const int UNUSED(subdiv_edge_index))
728 BLI_assert(subdiv_loop_index < reshape_smooth_context->geometry.num_corners);
734 corner->grid_index = first_grid_index + coarse_corner;
739 const int UNUSED(coarse_poly_index),
740 const int subdiv_poly_index,
741 const int start_loop_index,
746 BLI_assert(subdiv_poly_index < reshape_smooth_context->geometry.num_faces);
755 const int UNUSED(coarse_edge_index),
757 const int vertex_index)
775 BLI_assert(edge_index < reshape_smooth_context->geometry.max_edges);
778 edge->
v1 = subdiv_v1;
779 edge->
v2 = subdiv_v2;
785 const int coarse_edge_index,
786 const int UNUSED(subdiv_edge_index),
794 store_edge(reshape_smooth_context, subdiv_v1, subdiv_v2, (
char)255);
810 const MEdge *base_edge = &base_mesh->
medge[coarse_edge_index];
815 store_edge(reshape_smooth_context, subdiv_v1, subdiv_v2, crease);
827 "non_loose_base_edge_map");
829 int num_used_edges = 0;
830 for (
int poly_index = 0; poly_index < base_mesh->
totpoly; ++poly_index) {
831 const MPoly *base_poly = &base_mpoly[poly_index];
838 &base_edge[loop->
e]);
847 const int num_subdiv_vertices_per_base_edge = resolution - 2;
849 (num_subdiv_vertices_per_base_edge + 1);
865 .user_data = reshape_smooth_context,
876 reshape_context->
subdiv, &foreach_context, &mesh_settings, reshape_context->
base_mesh);
932 BLI_assert(face_index < reshape_smooth_context->geometry.num_faces);
943 BLI_assert(face_index < reshape_smooth_context->geometry.num_faces);
961 const int edge_index,
962 int edge_vertices[2])
965 BLI_assert(edge_index < reshape_smooth_context->geometry.num_edges);
968 edge_vertices[0] = edge->
v1;
969 edge_vertices[1] = edge->
v2;
975 BLI_assert(edge_index < reshape_smooth_context->geometry.num_edges);
985 BLI_assert(vertex_index < reshape_smooth_context->geometry.num_vertices);
1027 converter->
user_data = (
void *)reshape_smooth_context;
1062 for (
int i = 0; i < num_vertices; ++i) {
1065 coarse_position_cb(reshape_smooth_context, vertex,
P);
1092 if (grid_coord ==
NULL) {
1098 float tangent_matrix[3][3];
1122 if (grid_coord ==
NULL) {
1128 reshape_context, grid_coord);
1144 float r_tangent_matrix[3][3])
1148 float dPdu[3], dPdv[3];
1161 reshape_context, face_index,
corner, dPdu, dPdv, r_tangent_matrix);
1180 linear_grid_element.
mask = orig_grid_element.
mask;
1182 return linear_grid_element;
1190 reshape_context, grid_coord);
1195 if (final_grid_element.
mask !=
NULL) {
1196 linear_grid_element.
mask = *final_grid_element.
mask;
1199 return linear_grid_element;
1214 const int reshape_level = reshape_context->
reshape.
level;
1216 const int reshape_level_grid_size_1 = reshape_level_grid_size - 1;
1217 const float reshape_level_grid_size_1_inv = 1.0f / (
float)(reshape_level_grid_size_1);
1219 const float x_f = grid_coord->
u * reshape_level_grid_size_1;
1220 const float y_f = grid_coord->
v * reshape_level_grid_size_1;
1222 const int x_i = x_f;
1223 const int y_i = y_f;
1224 const int x_n_i = (x_i == reshape_level_grid_size - 1) ? (x_i) : (x_i + 1);
1225 const int y_n_i = (y_i == reshape_level_grid_size - 1) ? (y_i) : (y_i + 1);
1227 const int corners_int_coords[4][2] = {{x_i, y_i}, {x_n_i, y_i}, {x_n_i, y_n_i}, {x_i, y_n_i}};
1230 for (
int i = 0; i < 4; ++i) {
1233 corner_grid_coord.
u = corners_int_coords[i][0] * reshape_level_grid_size_1_inv;
1234 corner_grid_coord.
v = corners_int_coords[i][1] * reshape_level_grid_size_1_inv;
1237 &corner_grid_coord);
1239 &corner_grid_coord);
1243 const float u = x_f - x_i;
1244 const float v = y_f - y_i;
1245 const float weights[4] = {(1.0f - u) * (1.0f -
v), u * (1.0f -
v), u *
v, (1.0f - u) *
v};
1254 void *
UNUSED(userdata_v))
1265 const int num_grids = reshape_context->
num_grids;
1266 const int top_level = reshape_context->
top.
level;
1285 if (final_grid_element->
mask !=
NULL) {
1287 orig_grid_element.
mask + linear_delta_element->
mask, 0.0f, 1.0f);
1301 void *
UNUSED(userdata_v))
1304 float tangent_matrix[3][3];
1306 reshape_smooth_context, ptex_coord, grid_coord, limit_P, tangent_matrix);
1327 float r_orig_final_P[3])
1336 float base_mesh_limit_P[3];
1337 float base_mesh_tangent_matrix[3][3];
1339 reshape_context, grid_coord, base_mesh_limit_P, base_mesh_tangent_matrix);
1342 float orig_displacement[3];
1346 add_v3_v3v3(r_orig_final_P, base_mesh_limit_P, orig_displacement);
1353 void *
UNUSED(userdata_v))
1358 float orig_final_P[3];
1366 float original_detail_delta[3];
1367 sub_v3_v3v3(original_detail_delta, orig_final_P, orig_sculpt_point->
P);
1371 float original_detail_delta_tangent[3];
1372 float original_sculpt_tangent_matrix_inv[3][3];
1375 original_detail_delta_tangent, original_sculpt_tangent_matrix_inv, original_detail_delta);
1378 float smooth_limit_P[3];
1379 float smooth_tangent_matrix[3][3];
1381 reshape_smooth_context, ptex_coord, grid_coord, smooth_limit_P, smooth_tangent_matrix);
1384 float smooth_delta[3];
1385 mul_v3_m3v3(smooth_delta, smooth_tangent_matrix, original_detail_delta_tangent);
1410 void *
UNUSED(userdata_v))
1446 if (level_difference == 0) {
1478 if (level_difference == 0) {
1484 context_init(&reshape_smooth_context, reshape_context, mode);
typedef float(TangentPoint)[2]
CustomData interface, see also DNA_customdata_types.h.
eMultiresSubdivideModeType
@ MULTIRES_SUBDIVIDE_LINEAR
@ MULTIRES_SUBDIVIDE_CATMULL_CLARK
@ MULTIRES_SUBDIVIDE_SIMPLE
BLI_INLINE float BKE_subdiv_edge_crease_to_sharpness_char(char edge_crease)
BLI_INLINE int BKE_subdiv_grid_size_from_level(const int level)
void BKE_subdiv_free(Subdiv *subdiv)
Subdiv * BKE_subdiv_new_from_converter(const SubdivSettings *settings, struct OpenSubdiv_Converter *converter)
void BKE_subdiv_eval_limit_point(struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3])
bool BKE_subdiv_eval_begin(struct Subdiv *subdiv)
void BKE_subdiv_eval_limit_point_and_derivatives(struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3], float r_dPdu[3], float r_dPdv[3])
bool BKE_subdiv_foreach_subdiv_geometry(struct Subdiv *subdiv, const struct SubdivForeachContext *context, const struct SubdivToMeshSettings *mesh_settings, const struct Mesh *coarse_mesh)
#define BLI_BITMAP_ENABLE(_bitmap, _index)
#define BLI_BITMAP_TEST_BOOL(_bitmap, _index)
#define BLI_BITMAP_NEW(_tot, _alloc_string)
MINLINE float clamp_f(float value, float min, float max)
void copy_m3_m3(float m1[3][3], const float m2[3][3])
bool invert_m3_m3(float R[3][3], const float A[3][3])
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void zero_v3(float r[3])
void BLI_task_parallel_range(const int start, const int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
Provides wrapper around system-specific atomic primitives, and some extensions (faked-atomic operatio...
ATOMIC_INLINE size_t atomic_fetch_and_add_z(size_t *p, size_t x)
ATTR_WARN_UNUSED_RESULT const BMVert * v
DEGForeachIDComponentCallback callback
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
int multires_reshape_grid_to_face_index(const MultiresReshapeContext *reshape_context, int grid_index)
ReshapeGridElement multires_reshape_grid_element_for_grid_coord(const MultiresReshapeContext *reshape_context, const GridCoord *grid_coord)
int multires_reshape_grid_to_corner(const MultiresReshapeContext *reshape_context, int grid_index)
void multires_reshape_tangent_matrix_for_corner(const MultiresReshapeContext *reshape_context, const int face_index, const int corner, const float dPdu[3], const float dPdv[3], float r_tangent_matrix[3][3])
ReshapeConstGridElement multires_reshape_orig_grid_element_for_grid_coord(const MultiresReshapeContext *reshape_context, const GridCoord *grid_coord)
GridCoord multires_reshape_ptex_coord_to_grid(const MultiresReshapeContext *reshape_context, const PTexCoord *ptex_coord)
void multires_reshape_evaluate_limit_at_grid(const MultiresReshapeContext *reshape_context, const GridCoord *grid_coord, float r_P[3], float r_tangent_matrix[3][3])
void multires_reshape_smooth_object_grids(const MultiresReshapeContext *reshape_context, const eMultiresSubdivideModeType mode)
static LinearGridElement linear_grid_element_final_get(const MultiresReshapeSmoothContext *reshape_smooth_context, const GridCoord *grid_coord)
static void reshape_subdiv_evaluate_limit_at_grid(const MultiresReshapeSmoothContext *reshape_smooth_context, const PTexCoord *ptex_coord, const GridCoord *grid_coord, float limit_P[3], float r_tangent_matrix[3][3])
static int get_num_edges(const struct OpenSubdiv_Converter *converter)
void(* ForeachTopLevelGridCoordCallback)(const MultiresReshapeSmoothContext *reshape_smooth_context, const PTexCoord *ptex_coord, const GridCoord *grid_coord, void *userdata_v)
static void foreach_edge(const struct SubdivForeachContext *foreach_context, void *UNUSED(tls), const int coarse_edge_index, const int UNUSED(subdiv_edge_index), const int subdiv_v1, const int subdiv_v2)
static void reshape_subdiv_refine_final_P(const MultiresReshapeSmoothContext *reshape_smooth_context, const Vertex *vertex, float r_P[3])
static void foreach_vertex_every_edge(const struct SubdivForeachContext *foreach_context, void *UNUSED(tls_v), const int ptex_face_index, const float ptex_face_u, const float ptex_face_v, const int UNUSED(coarse_edge_index), const int UNUSED(coarse_face_index), const int UNUSED(coarse_face_corner), const int subdiv_vertex_index)
static void foreach_toplevel_grid_coord_task(void *__restrict userdata_v, const int face_index, const TaskParallelTLS *__restrict UNUSED(tls))
void multires_reshape_smooth_object_grids_with_details(const MultiresReshapeContext *reshape_context)
static void propagate_linear_data_delta(const MultiresReshapeSmoothContext *reshape_smooth_context, ReshapeGridElement *final_grid_element, const GridCoord *grid_coord)
static void reshape_subdiv_refine(const MultiresReshapeSmoothContext *reshape_smooth_context, ReshapeSubdivCoarsePositionCb coarse_position_cb)
static bool specifies_full_topology(const OpenSubdiv_Converter *UNUSED(converter))
static LinearGridElement * linear_grid_element_get(const LinearGrids *linear_grids, const GridCoord *grid_coord)
struct LinearGrid LinearGrid
struct SurfacePoint SurfacePoint
static float get_edge_sharpness(const OpenSubdiv_Converter *converter, const int edge_index)
struct MultiresReshapeSmoothContext MultiresReshapeSmoothContext
static OpenSubdiv_SchemeType get_scheme_type(const OpenSubdiv_Converter *UNUSED(converter))
static void evaluate_higher_grid_positions_callback(const MultiresReshapeSmoothContext *reshape_smooth_context, const PTexCoord *ptex_coord, const GridCoord *grid_coord, void *UNUSED(userdata_v))
static void foreach_poly(const SubdivForeachContext *foreach_context, void *UNUSED(tls), const int UNUSED(coarse_poly_index), const int subdiv_poly_index, const int start_loop_index, const int num_loops)
static void linear_grids_free(LinearGrids *linear_grids)
static void reshape_subdiv_create(MultiresReshapeSmoothContext *reshape_smooth_context)
static void linear_grid_element_sub(LinearGridElement *result, const LinearGridElement *a, const LinearGridElement *b)
static void evaluate_higher_grid_positions(const MultiresReshapeSmoothContext *reshape_smooth_context)
static LinearGridElement linear_grid_element_orig_get(const MultiresReshapeSmoothContext *reshape_smooth_context, const GridCoord *grid_coord)
static void foreach_single_vertex(const SubdivForeachContext *foreach_context, const GridCoord *grid_coord, const int subdiv_vertex_index)
static OpenSubdiv_VtxBoundaryInterpolation get_vtx_boundary_interpolation(const struct OpenSubdiv_Converter *converter)
static void foreach_toplevel_grid_coord(const MultiresReshapeSmoothContext *reshape_smooth_context, ForeachTopLevelGridCoordCallback callback, void *callback_userdata_v)
static void linear_grid_element_delta_interpolate(const MultiresReshapeSmoothContext *reshape_smooth_context, const GridCoord *grid_coord, LinearGridElement *result)
static int get_num_faces(const OpenSubdiv_Converter *converter)
static void evaluate_base_surface_grids(const MultiresReshapeSmoothContext *reshape_smooth_context)
static void evaluate_higher_grid_positions_with_details(const MultiresReshapeSmoothContext *reshape_smooth_context)
BLI_INLINE const GridCoord * reshape_subdiv_refine_vertex_grid_coord(const Vertex *vertex)
static void linear_grid_element_interpolate(LinearGridElement *result, const LinearGridElement elements[4], const float weights[4])
static void context_free(MultiresReshapeSmoothContext *reshape_smooth_context)
static void linear_grid_element_init(LinearGridElement *linear_grid_element)
static SurfacePoint * base_surface_grids_read(const MultiresReshapeSmoothContext *reshape_smooth_context, const GridCoord *grid_coord)
struct ForeachTopLevelGridCoordTaskData ForeachHighLevelCoordTaskData
static void grid_coords_from_face_vertices(const MultiresReshapeSmoothContext *reshape_smooth_context, const Face *face, const GridCoord *grid_coords[])
static char get_effective_edge_crease_char(const MultiresReshapeSmoothContext *reshape_smooth_context, const MEdge *base_edge)
static void context_init(MultiresReshapeSmoothContext *reshape_smooth_context, const MultiresReshapeContext *reshape_context, const eMultiresSubdivideModeType mode)
struct SurfaceGrid SurfaceGrid
static GridCoord * vertex_grid_coord_with_grid_index(const Vertex *vertex, const int grid_index)
static void foreach_vertex(const SubdivForeachContext *foreach_context, const PTexCoord *ptex_coord, const int subdiv_vertex_index)
static int get_num_vertices(const OpenSubdiv_Converter *converter)
static void foreach_vertex_of_loose_edge(const struct SubdivForeachContext *foreach_context, void *UNUSED(tls), const int UNUSED(coarse_edge_index), const float UNUSED(u), const int vertex_index)
static void linear_grids_allocate(LinearGrids *linear_grids, int num_grids, int level)
static void base_surface_grids_write(const MultiresReshapeSmoothContext *reshape_smooth_context, const GridCoord *grid_coord, float P[3], float tangent_matrix[3][3])
static void evaluate_base_surface_grids_callback(const MultiresReshapeSmoothContext *reshape_smooth_context, const PTexCoord *ptex_coord, const GridCoord *grid_coord, void *UNUSED(userdata_v))
static void base_surface_grids_free(MultiresReshapeSmoothContext *reshape_smooth_context)
static void reshape_subdiv_refine_final(const MultiresReshapeSmoothContext *reshape_smooth_context)
static bool foreach_topology_info(const SubdivForeachContext *foreach_context, const int num_vertices, const int num_edges, const int num_loops, const int num_polygons)
struct LinearGridElement LinearGridElement
static float lerp(float t, float a, float b)
static void evaluate_linear_delta_grids(MultiresReshapeSmoothContext *reshape_smooth_context)
struct LinearGrids LinearGrids
static void geometry_init_loose_information(MultiresReshapeSmoothContext *reshape_smooth_context)
void() ReshapeSubdivCoarsePositionCb(const MultiresReshapeSmoothContext *reshape_smooth_context, const Vertex *vertex, float r_P[3])
static void get_edge_vertices(const OpenSubdiv_Converter *converter, const int edge_index, int edge_vertices[2])
static void foreach_vertex_every_corner(const struct SubdivForeachContext *foreach_context, void *UNUSED(tls_v), const int ptex_face_index, const float ptex_face_u, const float ptex_face_v, const int UNUSED(coarse_vertex_index), const int UNUSED(coarse_face_index), const int UNUSED(coarse_face_corner), const int subdiv_vertex_index)
static void reshape_subdiv_refine_orig(const MultiresReshapeSmoothContext *reshape_smooth_context)
static int get_num_face_vertices(const OpenSubdiv_Converter *converter, int face_index)
static void base_surface_grids_allocate(MultiresReshapeSmoothContext *reshape_smooth_context)
static void store_edge(MultiresReshapeSmoothContext *reshape_smooth_context, const int subdiv_v1, const int subdiv_v2, const char crease)
static void converter_init(const MultiresReshapeSmoothContext *reshape_smooth_context, OpenSubdiv_Converter *converter)
static void foreach_vertex_inner(const struct SubdivForeachContext *foreach_context, void *UNUSED(tls), const int ptex_face_index, const float ptex_face_u, const float ptex_face_v, const int UNUSED(coarse_poly_index), const int UNUSED(coarse_corner), const int subdiv_vertex_index)
static void evaluate_linear_delta_grids_callback(const MultiresReshapeSmoothContext *reshape_smooth_context, const PTexCoord *UNUSED(ptex_coord), const GridCoord *grid_coord, void *UNUSED(userdata_v))
static void linear_grids_init(LinearGrids *linear_grids)
static int get_reshape_level_resolution(const MultiresReshapeContext *reshape_context)
static void foreach_loop(const struct SubdivForeachContext *foreach_context, void *UNUSED(tls), const int UNUSED(ptex_face_index), const float UNUSED(ptex_face_u), const float UNUSED(ptex_face_v), const int UNUSED(coarse_loop_index), const int coarse_poly_index, const int coarse_corner, const int subdiv_loop_index, const int subdiv_vertex_index, const int UNUSED(subdiv_edge_index))
static bool is_infinite_sharp_vertex(const OpenSubdiv_Converter *converter, int vertex_index)
static void reshape_subdiv_refine_orig_P(const MultiresReshapeSmoothContext *reshape_smooth_context, const Vertex *vertex, float r_P[3])
static OpenSubdiv_FVarLinearInterpolation get_fvar_linear_interpolation(const OpenSubdiv_Converter *converter)
static void evaluate_higher_grid_positions_with_details_callback(const MultiresReshapeSmoothContext *reshape_smooth_context, const PTexCoord *ptex_coord, const GridCoord *grid_coord, void *UNUSED(userdata_v))
static void evaluate_final_original_point(const MultiresReshapeSmoothContext *reshape_smooth_context, const GridCoord *grid_coord, float r_orig_final_P[3])
static int get_face_grid_index(const MultiresReshapeSmoothContext *reshape_smooth_context, const Face *face)
static void geometry_create(MultiresReshapeSmoothContext *reshape_smooth_context)
static void context_free_geometry(MultiresReshapeSmoothContext *reshape_smooth_context)
static void context_free_subdiv(MultiresReshapeSmoothContext *reshape_smooth_context)
static void interpolate_grid_coord(GridCoord *result, const GridCoord *face_grid_coords[4], const float u, const float v)
static void get_face_vertices(const OpenSubdiv_Converter *converter, int face_index, int *face_vertices)
OpenSubdiv_FVarLinearInterpolation
OpenSubdiv_VtxBoundaryInterpolation
const MultiresReshapeSmoothContext * reshape_smooth_context
float inner_grid_size_1_inv
ForeachTopLevelGridCoordCallback callback
void * callback_userdata_v
LinearGridElement * elements
LinearGridElement * elements_storage
struct MultiresReshapeContext::@99 reshape
int * face_start_grid_index
struct MultiresReshapeContext::@100 top
const MultiresReshapeContext * reshape_context
SurfaceGrid * base_surface_grids
BLI_bitmap * non_loose_base_edge_map
eMultiresSubdivideModeType smoothing_type
LinearGrids linear_delta_grids
struct MultiresReshapeSmoothContext::@102 geometry
int(* getNumVertexFaces)(const struct OpenSubdiv_Converter *converter, const int vertex_index)
bool(* specifiesFullTopology)(const struct OpenSubdiv_Converter *converter)
void(* freeUserData)(const struct OpenSubdiv_Converter *converter)
void(* getFaceVertices)(const struct OpenSubdiv_Converter *converter, const int face_index, int *face_vertices)
float(* getVertexSharpness)(const struct OpenSubdiv_Converter *converter, const int vertex_index)
void(* getFaceEdges)(const struct OpenSubdiv_Converter *converter, const int face_index, int *face_edges)
int(* getNumUVLayers)(const struct OpenSubdiv_Converter *converter)
int(* getNumVertexEdges)(const struct OpenSubdiv_Converter *converter, const int vertex_index)
OpenSubdiv_FVarLinearInterpolation(* getFVarLinearInterpolation)(const struct OpenSubdiv_Converter *converter)
void(* getEdgeVertices)(const struct OpenSubdiv_Converter *converter, const int edge_index, int edge_vertices[2])
OpenSubdiv_SchemeType(* getSchemeType)(const struct OpenSubdiv_Converter *converter)
bool(* isInfiniteSharpVertex)(const struct OpenSubdiv_Converter *converter, const int vertex_index)
void(* getVertexFaces)(const struct OpenSubdiv_Converter *converter, const int vertex_index, int *vertex_faces)
int(* getNumVertices)(const struct OpenSubdiv_Converter *converter)
float(* getEdgeSharpness)(const struct OpenSubdiv_Converter *converter, const int edge_index)
int(* getNumEdges)(const struct OpenSubdiv_Converter *converter)
int(* getNumFaces)(const struct OpenSubdiv_Converter *converter)
int(* getNumEdgeFaces)(const struct OpenSubdiv_Converter *converter, const int edge_index)
int(* getNumUVCoordinates)(const struct OpenSubdiv_Converter *converter)
void(* getVertexEdges)(const struct OpenSubdiv_Converter *converter, const int vertex_index, int *vertex_edges)
void(* finishUVLayer)(const struct OpenSubdiv_Converter *converter)
void(* getEdgeFaces)(const struct OpenSubdiv_Converter *converter, const int edge, int *edge_faces)
OpenSubdiv_VtxBoundaryInterpolation(* getVtxBoundaryInterpolation)(const struct OpenSubdiv_Converter *converter)
void(* precalcUVLayer)(const struct OpenSubdiv_Converter *converter, const int layer_index)
int(* getFaceCornerUVIndex)(const struct OpenSubdiv_Converter *converter, const int face_index, const int corner_index)
int(* getNumFaceVertices)(const struct OpenSubdiv_Converter *converter, const int face_index)
void(* setCoarsePositions)(struct OpenSubdiv_Evaluator *evaluator, const float *positions, const int start_vertex_index, const int num_vertices)
void(* refine)(struct OpenSubdiv_Evaluator *evaluator)
SubdivForeachTopologyInformationCb topology_info
struct OpenSubdiv_Evaluator * evaluator
float tangent_matrix[3][3]
int BKE_subdiv_converter_fvar_linear_from_settings(const SubdivSettings *settings)
void BKE_subdiv_converter_free(struct OpenSubdiv_Converter *converter)
int BKE_subdiv_converter_vtx_boundary_interpolation_from_settings(const SubdivSettings *settings)
BLI_INLINE float D(const float *data, const int res[3], int x, int y, int z)