88 int layer_offset =
sizeof(
float[3]);
93 layer_offset +=
sizeof(
float);
106 layer_offset +=
sizeof(
float[3]);
117 const int num_faces = topology_refiner->
getNumFaces(topology_refiner);
119 for (
int face_index = 0; face_index < num_faces; face_index++) {
132 const int num_faces = topology_refiner->
getNumFaces(topology_refiner);
135 const int grid_area = grid_size * grid_size;
140 num_grids, ((
size_t)grid_area) * element_size,
"subdiv ccg grids storage");
141 const size_t grid_size_in_bytes = (size_t)grid_area * element_size;
142 for (
int grid_index = 0; grid_index < num_grids; grid_index++) {
143 const size_t grid_offset = grid_size_in_bytes * grid_index;
148 num_grids,
sizeof(
DMFlagMat),
"ccg grid material flags");
151 num_grids,
sizeof(
BLI_bitmap *),
"ccg grid material flags");
152 for (
int grid_index = 0; grid_index < num_grids; grid_index++) {
161 num_grids,
sizeof(
SubdivCCGFace *),
"Subdiv CCG grid faces");
180 const int ptex_face_index,
204 const int ptex_face_index,
215 *mask_value_ptr =
data->mask_evaluator->eval_mask(
data->mask_evaluator, ptex_face_index, u,
v);
218 *mask_value_ptr = 0.0f;
223 const int ptex_face_index,
235 const int ptex_face_index =
data->face_ptex_offset[face_index];
236 const int grid_size = subdiv_ccg->
grid_size;
237 const float grid_size_1_inv = 1.0f / (grid_size - 1);
244 unsigned char *grid = (
unsigned char *)subdiv_ccg->
grids[grid_index];
245 for (
int y = 0;
y < grid_size;
y++) {
246 const float grid_v =
y * grid_size_1_inv;
247 for (
int x = 0;
x < grid_size;
x++) {
248 const float grid_u =
x * grid_size_1_inv;
251 const size_t grid_element_index = (size_t)
y * grid_size +
x;
252 const size_t grid_element_offset = grid_element_index * element_size;
257 grid_faces[grid_index] = &
faces[face_index];
259 subdiv_ccg->
grid_flag_mats[grid_index] =
data->material_flags_evaluator->eval_material_flags(
260 data->material_flags_evaluator, face_index);
267 const int grid_size = subdiv_ccg->
grid_size;
268 const float grid_size_1_inv = 1.0f / (grid_size - 1);
275 const int ptex_face_index =
data->face_ptex_offset[face_index] +
corner;
276 unsigned char *grid = (
unsigned char *)subdiv_ccg->
grids[grid_index];
277 for (
int y = 0;
y < grid_size;
y++) {
278 const float u = 1.0f - (
y * grid_size_1_inv);
279 for (
int x = 0;
x < grid_size;
x++) {
280 const float v = 1.0f - (
x * grid_size_1_inv);
281 const size_t grid_element_index = (size_t)
y * grid_size +
x;
282 const size_t grid_element_offset = grid_element_index * element_size;
287 grid_faces[grid_index] = &
faces[face_index];
289 subdiv_ccg->
grid_flag_mats[grid_index] =
data->material_flags_evaluator->eval_material_flags(
290 data->material_flags_evaluator, face_index);
295 const int face_index,
315 const int num_faces = topology_refiner->
getNumFaces(topology_refiner);
318 data.subdiv_ccg = subdiv_ccg;
319 data.subdiv = subdiv;
321 data.mask_evaluator = mask_evaluator;
322 data.material_flags_evaluator = material_flags_evaluator;
342 const int num_faces = subdiv_ccg->
num_faces;
343 int corner_index = 0;
344 for (
int face_index = 0; face_index < num_faces; face_index++) {
345 const int num_corners = topology_refiner->
getNumFaceVertices(topology_refiner, face_index);
348 corner_index += num_corners;
371 if (size <= storage->static_storage_size) {
412 const int grid_size = subdiv_ccg->
grid_size * 2;
429 const int num_edges = topology_refiner->
getNumEdges(topology_refiner);
430 const int grid_size = subdiv_ccg->
grid_size;
431 if (num_edges == 0) {
442 const int num_faces = subdiv_ccg->
num_faces;
443 for (
int face_index = 0; face_index < num_faces; face_index++) {
445 const int num_face_grids = face->
num_grids;
446 const int num_face_edges = num_face_grids;
448 topology_refiner->
getFaceVertices(topology_refiner, face_index, face_vertices);
452 topology_refiner->
getFaceEdges(topology_refiner, face_index, face_edges);
455 const int vertex_index = face_vertices[
corner];
456 const int edge_index = face_edges[
corner];
457 int edge_vertices[2];
458 topology_refiner->
getEdgeVertices(topology_refiner, edge_index, edge_vertices);
459 const bool is_edge_flipped = (edge_vertices[0] != vertex_index);
469 int boundary_element_index = 0;
470 if (is_edge_flipped) {
471 for (
int i = 0; i < grid_size; i++) {
473 next_grid_index, grid_size - i - 1, grid_size - 1);
475 for (
int i = 0; i < grid_size; i++) {
477 current_grid_index, grid_size - 1, i);
481 for (
int i = 0; i < grid_size; i++) {
483 current_grid_index, grid_size - 1, grid_size - i - 1);
485 for (
int i = 0; i < grid_size; i++) {
487 next_grid_index, i, grid_size - 1);
502 "ccg adjacent vertices");
524 const int num_vertices = topology_refiner->
getNumVertices(topology_refiner);
525 const int grid_size = subdiv_ccg->
grid_size;
526 if (num_vertices == 0) {
538 const int num_faces = subdiv_ccg->
num_faces;
539 for (
int face_index = 0; face_index < num_faces; face_index++) {
541 const int num_face_grids = face->
num_grids;
542 const int num_face_edges = num_face_grids;
544 topology_refiner->
getFaceVertices(topology_refiner, face_index, face_vertices);
546 const int vertex_index = face_vertices[
corner];
578 subdiv_ccg->
subdiv = subdiv;
596 const Mesh *coarse_mesh)
611 subdiv, settings, has_mask ? &mask_evaluator :
NULL, &material_flags_evaluator);
613 mask_evaluator.
free(&mask_evaluator);
615 material_flags_evaluator.
free(&material_flags_evaluator);
616 if (subdiv_ccg ==
NULL) {
620 result->runtime.subdiv_ccg = subdiv_ccg;
626 const int num_grids = subdiv_ccg->
num_grids;
633 for (
int grid_index = 0; grid_index < num_grids; grid_index++) {
646 for (
int face_index = 0; face_index < adjacent_edge->
num_adjacent_faces; face_index++) {
705 const int grid_index)
707 const int grid_size = subdiv_ccg->
grid_size;
708 const int grid_size_1 = grid_size - 1;
712 grid_size_1 * grid_size_1,
sizeof(
float[3]),
"CCG TLS normals");
714 for (
int y = 0;
y < grid_size - 1;
y++) {
715 for (
int x = 0;
x < grid_size - 1;
x++) {
728 const int face_index =
y * grid_size_1 +
x;
739 const int grid_index)
741 const int grid_size = subdiv_ccg->
grid_size;
742 const int grid_size_1 = grid_size - 1;
745 for (
int y = 0;
y < grid_size;
y++) {
746 for (
int x = 0;
x < grid_size;
x++) {
747 float normal_acc[3] = {0.0f, 0.0f, 0.0f};
750 if (
x < grid_size_1 &&
y < grid_size_1) {
751 add_v3_v3(normal_acc, face_normals[
y * grid_size_1 +
x]);
755 if (
y < grid_size_1) {
756 add_v3_v3(normal_acc, face_normals[
y * grid_size_1 + (
x - 1)]);
760 add_v3_v3(normal_acc, face_normals[(
y - 1) * grid_size_1 + (
x - 1)]);
764 if (
y >= 1 &&
x < grid_size_1) {
765 add_v3_v3(normal_acc, face_normals[(
y - 1) * grid_size_1 +
x]);
775 const int grid_index,
785 void *__restrict tls_v)
797 .subdiv_ccg = subdiv_ccg,
810 ¶llel_range_settings);
830 const int face_index,
839 const int num_face_grids = face->
num_grids;
840 for (
int i = 0; i < num_face_grids; i++) {
849 void *__restrict tls_v)
856 struct CCGFace **effected_faces,
857 int num_effected_faces)
862 .subdiv_ccg = subdiv_ccg,
876 ¶llel_range_settings);
880 struct CCGFace **effected_faces,
881 int num_effected_faces)
887 if (num_effected_faces == 0) {
947 accumulator->
mask = 0.0f;
968 accumulator->
mask *= f;
990 const int num_face_grids = face->
num_grids;
991 const int grid_size = subdiv_ccg->
grid_size;
996 for (
int i = 1; i < grid_size; i++) {
1021 const int face_index,
1047 const int grid_size2 = subdiv_ccg->
grid_size * 2;
1048 if (num_adjacent_faces == 1) {
1057 for (
int i = 1; i < grid_size2 - 1; i++) {
1061 for (
int face_index = 0; face_index < num_adjacent_faces; face_index++) {
1062 for (
int i = 1; i < grid_size2 - 1; i++) {
1068 for (
int i = 1; i < grid_size2 - 1; i++) {
1072 for (
int face_index = 0; face_index < num_adjacent_faces; face_index++) {
1073 for (
int i = 1; i < grid_size2 - 1; i++) {
1082 const int adjacent_edge_index,
1094 void *__restrict tls_v)
1110 if (num_adjacent_faces == 1) {
1116 for (
int face_index = 0; face_index < num_adjacent_faces; face_index++) {
1118 key, subdiv_ccg, &adjacent_vertex->
corner_coords[face_index]);
1123 for (
int face_index = 0; face_index < num_adjacent_faces; face_index++) {
1125 key, subdiv_ccg, &adjacent_vertex->
corner_coords[face_index]);
1131 const int adjacent_vertex_index,
1157 ¶llel_range_settings);
1172 ¶llel_range_settings);
1197 ¶llel_range_settings);
1208 void *__restrict userdata_v,
1209 const int face_index,
1215 struct CCGFace **effected_ccg_faces =
data->effected_ccg_faces;
1216 struct CCGFace *effected_ccg_face = effected_ccg_faces[face_index];
1222 struct CCGFace **effected_faces,
1223 int num_effected_faces)
1228 .subdiv_ccg = subdiv_ccg,
1230 .effected_ccg_faces = effected_faces,
1238 ¶llel_range_settings);
1245 int *r_num_vertices,
1250 const int num_grids = subdiv_ccg->
num_grids;
1251 const int grid_size = subdiv_ccg->
grid_size;
1252 const int grid_area = grid_size * grid_size;
1253 const int num_edges_per_grid = 2 * (grid_size * (grid_size - 1));
1254 *r_num_vertices = num_grids * grid_area;
1255 *r_num_edges = num_grids * num_edges_per_grid;
1256 *r_num_faces = num_grids * (grid_size - 1) * (grid_size - 1);
1257 *r_num_loops = *r_num_faces * 4;
1268 printf(
"%s: grid index: %d, coord: (%d, %d)\n", message, coord->
grid_index, coord->
x, coord->
y);
1276 const int grid_size = subdiv_ccg->
grid_size;
1277 if (coord->
x < 0 || coord->
x >= grid_size) {
1280 if (coord->
y < 0 || coord->
y >= grid_size) {
1287 const int num_unique,
1288 const int num_duplicates)
1290 const int size = num_unique + num_duplicates;
1298 "SubdivCCGNeighbors.coords");
1305 const int grid_size_1 = subdiv_ccg->
grid_size - 1;
1306 return (coord->
x == 0 && coord->
y == 0) || (coord->
x == 0 && coord->
y == grid_size_1) ||
1307 (coord->
x == grid_size_1 && coord->
y == grid_size_1) ||
1308 (coord->
x == grid_size_1 && coord->
y == 0);
1314 const int grid_size_1 = subdiv_ccg->
grid_size - 1;
1315 return coord->
x == 0 || coord->
y == 0 || coord->
x == grid_size_1 || coord->
y == grid_size_1;
1322 const int grid_size_1 = subdiv_ccg->
grid_size - 1;
1323 if (coord->
x == 0) {
1324 return coord->
y > 0 && coord->
y < grid_size_1;
1326 if (coord->
y == 0) {
1327 return coord->
x > 0 && coord->
x < grid_size_1;
1374 const int grid_size_1 = subdiv_ccg->
grid_size - 1;
1375 if (
result.x == grid_size_1) {
1378 else if (
result.y == grid_size_1) {
1381 else if (
result.x == 0) {
1384 else if (
result.y == 0) {
1397 const int face_grid_index = coord->
grid_index;
1399 if (next_face_grid_index == face->
num_grids) {
1400 next_face_grid_index = 0;
1407 const int face_grid_index = coord->
grid_index;
1409 if (prev_face_grid_index < 0) {
1410 prev_face_grid_index = face->
num_grids - 1;
1419 const bool include_duplicates,
1423 const int num_adjacent_grids = face->
num_grids;
1426 r_neighbors, num_adjacent_grids, (include_duplicates) ? num_adjacent_grids - 1 : 0);
1428 int duplicate_face_grid_index = num_adjacent_grids;
1429 for (
int face_grid_index = 0; face_grid_index < num_adjacent_grids; ++face_grid_index) {
1432 neighbor_coord.
x = 1;
1433 neighbor_coord.
y = 0;
1434 r_neighbors->
coords[face_grid_index] = neighbor_coord;
1437 neighbor_coord.
x = 0;
1438 r_neighbors->
coords[duplicate_face_grid_index++] = neighbor_coord;
1451 const int face_index = face - subdiv_ccg->
faces;
1453 const int num_face_grids = face->
num_grids;
1454 const int num_face_vertices = num_face_grids;
1460 topology_refiner->
getFaceVertices(topology_refiner, face_index, face_vertices);
1462 const int adjacent_vertex_index = face_vertices[face_grid_index];
1464 return adjacent_vertex_index;
1470 const bool include_duplicates,
1478 BLI_assert(adjacent_vertex_index < subdiv_ccg->num_adjacent_vertices);
1479 const int num_vertex_edges = topology_refiner->
getNumVertexEdges(topology_refiner,
1480 adjacent_vertex_index);
1486 r_neighbors, num_vertex_edges, (include_duplicates) ? num_adjacent_faces - 1 : 0);
1492 topology_refiner->
getVertexEdges(topology_refiner, adjacent_vertex_index, vertex_edges);
1494 for (
int i = 0; i < num_vertex_edges; ++i) {
1495 const int edge_index = vertex_edges[i];
1498 const int edge_face_index = 0;
1501 int edge_vertices_indices[2];
1502 topology_refiner->
getEdgeVertices(topology_refiner, edge_index, edge_vertices_indices);
1503 int edge_point_index, duplicate_edge_point_index;
1504 if (edge_vertices_indices[0] == adjacent_vertex_index) {
1505 duplicate_edge_point_index = 0;
1506 edge_point_index = duplicate_edge_point_index + 1;
1512 duplicate_edge_point_index = subdiv_ccg->
grid_size * 2 - 1;
1513 edge_point_index = duplicate_edge_point_index - 1;
1520 if (include_duplicates) {
1522 for (
int i = 0, duplicate_i = num_vertex_edges; i < num_adjacent_faces; i++) {
1525 r_neighbors->
coords[duplicate_i++] = neighbor_coord;
1540 const int face_index = face - subdiv_ccg->
faces;
1541 const int num_face_edges = topology_refiner->
getNumFaceEdges(topology_refiner, face_index);
1546 topology_refiner->
getFaceEdges(topology_refiner, face_index, face_edges_indices);
1548 const int grid_size_1 = subdiv_ccg->
grid_size - 1;
1549 int adjacent_edge_index = -1;
1550 if (coord->
x == grid_size_1) {
1551 adjacent_edge_index = face_edges_indices[face_grid_index];
1555 adjacent_edge_index =
1556 face_edges_indices[face_grid_index == 0 ? face->
num_grids - 1 : face_grid_index - 1];
1561 return adjacent_edge_index;
1566 const int adjacent_edge_index)
1572 int edge_vertices_indices[2];
1573 topology_refiner->
getEdgeVertices(topology_refiner, adjacent_edge_index, edge_vertices_indices);
1579 int directional_edge_vertex_index = -1;
1581 const int grid_size_1 = subdiv_ccg->
grid_size - 1;
1582 int adjacent_edge_point_index = -1;
1583 if (coord->
x == grid_size_1) {
1584 adjacent_edge_point_index = subdiv_ccg->
grid_size - coord->
y - 1;
1585 directional_edge_vertex_index = edge_vertices_indices[0];
1589 adjacent_edge_point_index = subdiv_ccg->
grid_size + coord->
x;
1590 directional_edge_vertex_index = edge_vertices_indices[1];
1594 if (adjacent_vertex_index != directional_edge_vertex_index) {
1595 const int num_edge_points = subdiv_ccg->
grid_size * 2;
1596 adjacent_edge_point_index = num_edge_points - adjacent_edge_point_index - 1;
1599 return adjacent_edge_point_index;
1608 if (point_index == subdiv_ccg->
grid_size - 1) {
1609 return point_index + 2;
1611 return point_index + 1;
1615 if (point_index == subdiv_ccg->
grid_size) {
1616 return point_index - 2;
1618 return point_index - 1;
1625 const int point_index)
1627 if (point_index == subdiv_ccg->
grid_size) {
1628 return point_index - 1;
1630 return point_index + 1;
1637 const bool include_duplicates,
1644 BLI_assert(adjacent_edge_index < subdiv_ccg->num_adjacent_edges);
1649 int num_duplicates = 0;
1650 if (include_duplicates) {
1651 num_duplicates += num_adjacent_faces - 1;
1655 num_duplicates += num_adjacent_faces;
1661 subdiv_ccg, coord, adjacent_edge_index);
1668 int duplicate_i = num_adjacent_faces;
1669 for (
int i = 0; i < num_adjacent_faces; ++i) {
1677 r_neighbors->
coords[0] = boundary_coords[prev_point_index];
1678 r_neighbors->
coords[1] = boundary_coords[next_point_index];
1680 else if (include_duplicates) {
1682 r_neighbors->
coords[duplicate_i + 2] = grid_coord;
1687 if (include_duplicates && is_corner) {
1688 SubdivCCGCoord duplicate_corner_grid_coord = boundary_coords[point_index_duplicate];
1689 r_neighbors->
coords[duplicate_i + 2] = duplicate_corner_grid_coord;
1693 BLI_assert(duplicate_i - num_adjacent_faces == num_duplicates);
1699 const bool include_duplicates,
1708 const bool include_duplicates,
1711 if (coord->
x == 0 && coord->
y == 0) {
1715 const int grid_size_1 = subdiv_ccg->
grid_size - 1;
1716 if (coord->
x == grid_size_1 && coord->
y == grid_size_1) {
1730 const bool include_duplicates,
1735 if (coord->
x == 0) {
1741 r_neighbors->
coords[3].
x = coord->
y;
1744 if (include_duplicates) {
1749 else if (coord->
y == 0) {
1756 r_neighbors->
coords[3].
y = coord->
x;
1758 if (include_duplicates) {
1768 const bool include_duplicates,
1779 const bool include_duplicates,
1805 const bool include_duplicates,
1826 for (
int i = 0; i < r_neighbors->
size; i++) {
1835 const int face_index = face - subdiv_ccg->
faces;
1844 if (topology_refiner ==
NULL) {
1848 const int num_coarse_faces = topology_refiner->
getNumFaces(topology_refiner);
1851 sizeof(
int), num_coarse_faces,
"start_face_grid_index");
1853 int start_grid_index = 0;
1854 for (
int face_index = 0; face_index < num_coarse_faces; face_index++) {
1858 start_grid_index += num_face_grids;
1877 const int grid_size_1 = subdiv_ccg->
grid_size - 1;
1879 const MPoly *p = &mpoly[poly_index];
1883 if (coord->
x == grid_size_1) {
1887 if (coord->
y == grid_size_1) {
1901 const int grid_size_1 = subdiv_ccg->
grid_size - 1;
1903 if (coord->
x == 0 && coord->
y == 0) {
1907 if (coord->
x == grid_size_1 && coord->
y == grid_size_1) {
1940 int *r_ptex_face_index,
1946 const float grid_size = subdiv_ccg->
grid_size;
1947 const float grid_size_1_inv = 1.0f / (grid_size - 1);
1949 const float grid_u = coord->
x * grid_size_1_inv;
1950 const float grid_v = coord->
y * grid_size_1_inv;
1956 *r_ptex_face_index = face_ptex_offset[face_index];
1964 *r_ptex_face_index +=
corner;
1965 *r_u = 1.0f - grid_v;
1966 *r_v = 1.0f - grid_u;
1975 int ptex_face_index;
typedef float(TangentPoint)[2]
BLI_INLINE CCGElem * CCG_grid_elem(const CCGKey *key, CCGElem *elem, int x, int y)
BLI_INLINE float * CCG_elem_mask(const CCGKey *key, CCGElem *elem)
BLI_INLINE float * CCG_grid_elem_no(const CCGKey *key, CCGElem *elem, int x, int y)
BLI_INLINE float * CCG_elem_no(const CCGKey *key, CCGElem *elem)
BLI_INLINE float * CCG_elem_co(const CCGKey *key, CCGElem *elem)
struct Mesh * BKE_mesh_new_nomain_from_template(const struct Mesh *me_src, int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len)
int poly_find_loop_from_vert(const struct MPoly *poly, const struct MLoop *loopstart, uint vert)
BLI_INLINE void BKE_subdiv_rotate_grid_to_quad(const int corner, const float grid_u, const float grid_v, float *r_quad_u, float *r_quad_v)
@ SUBDIV_STATS_SUBDIV_TO_CCG
void BKE_subdiv_stats_end(SubdivStats *stats, eSubdivStatsValue value)
BLI_INLINE int BKE_subdiv_grid_size_from_level(const int level)
void BKE_subdiv_stats_begin(SubdivStats *stats, eSubdivStatsValue value)
void BKE_subdiv_free(Subdiv *subdiv)
int * BKE_subdiv_face_ptex_offset_get(Subdiv *subdiv)
bool BKE_subdiv_ccg_mask_init_from_paint(SubdivCCGMaskEvaluator *mask_evaluator, const struct Mesh *mesh)
@ SUBDIV_CCG_ADJACENT_EDGE
@ SUBDIV_CCG_ADJACENT_VERTEX
@ SUBDIV_CCG_ADJACENT_NONE
void BKE_subdiv_ccg_material_flags_init_from_mesh(SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator, const struct Mesh *mesh)
void BKE_subdiv_eval_limit_point_and_normal(struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3], float r_N[3])
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_from_mesh(struct Subdiv *subdiv, const struct Mesh *mesh, const float(*coarse_vertex_cos)[3])
void BKE_subdiv_eval_final_point(struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3])
#define BLI_BITMAP_NEW(_tot, _alloc_string)
MINLINE int bitscan_forward_i(int a)
float normal_quad_v3(float n[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[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)
#define UNUSED_VARS_NDEBUG(...)
#define ME_POLY_LOOP_PREV(mloop, mp, i)
#define ME_POLY_LOOP_NEXT(mloop, mp, i)
_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
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
ATTR_WARN_UNUSED_RESULT const void * element
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
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)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
GridElementAccumulator * accumulators
SubdivCCGMaskEvaluator * mask_evaluator
SubdivCCGMaterialFlagsEvaluator * material_flags_evaluator
int(* getNumVertexEdges)(const struct OpenSubdiv_TopologyRefiner *topology_refiner, const int vertex_index)
int(* getNumFaceVertices)(const struct OpenSubdiv_TopologyRefiner *topology_refiner, const int face_index)
void(* getFaceEdges)(const struct OpenSubdiv_TopologyRefiner *topology_refiner, const int face_index, int *face_edges_indices)
void(* getFaceVertices)(const struct OpenSubdiv_TopologyRefiner *topology_refiner, const int face_index, int *face_vertices_indices)
void(* getVertexEdges)(const struct OpenSubdiv_TopologyRefiner *topology_refiner, const int vertex_index, int *vertex_edges_indices)
void(* getEdgeVertices)(const struct OpenSubdiv_TopologyRefiner *topology_refiner, const int edge_index, int edge_vertices_indices[2])
int(* getNumFaceEdges)(const struct OpenSubdiv_TopologyRefiner *topology_refiner, const int face_index)
int(* getNumFaces)(const struct OpenSubdiv_TopologyRefiner *topology_refiner)
int(* getNumEdges)(const struct OpenSubdiv_TopologyRefiner *topology_refiner)
int(* getNumVertices)(const struct OpenSubdiv_TopologyRefiner *topology_refiner)
SubdivCCGFace ** effected_ccg_faces
struct CCGFace ** effected_ccg_faces
struct SubdivCCGCoord ** boundary_coords
struct SubdivCCGCoord * corner_coords
void(* free)(struct SubdivCCGMaskEvaluator *mask_evaluator)
void(* free)(struct SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator)
SubdivCCGCoord coords_fixed[256]
unsigned char * grids_storage
struct SubdivCCG::@69 cache_
SubdivCCGAdjacentVertex * adjacent_vertices
int * start_face_grid_index
int num_adjacent_vertices
SubdivCCGFace ** grid_faces
BLI_bitmap ** grid_hidden
SubdivCCGAdjacentEdge * adjacent_edges
struct DMFlagMat * grid_flag_mats
struct CCGElem * vertices
struct SubdivDisplacement * displacement_evaluator
struct OpenSubdiv_TopologyRefiner * topology_refiner
TaskParallelFreeFunc func_free
size_t userdata_chunk_size
static void subdiv_ccg_recalc_modified_inner_normal_free(const void *__restrict UNUSED(userdata), void *__restrict tls_v)
static void subdiv_ccg_stitch_face_inner_grids_task(void *__restrict userdata_v, const int face_index, const TaskParallelTLS *__restrict UNUSED(tls_v))
static void neighbor_coords_inner_get(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, SubdivCCGNeighbors *r_neighbors)
BLI_INLINE int prev_grid_index_from_coord(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord)
void BKE_subdiv_ccg_recalc_normals(SubdivCCG *subdiv_ccg)
static void neighbor_coords_edge_get(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, const bool include_duplicates, SubdivCCGNeighbors *r_neighbors)
static int next_adjacent_edge_point_index(const SubdivCCG *subdiv_ccg, const int point_index)
static void subdiv_ccg_init_faces_edge_neighborhood(SubdivCCG *subdiv_ccg)
BLI_INLINE bool is_boundary_grid_coord(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord)
static void subdiv_ccg_eval_grids_task(void *__restrict userdata_v, const int face_index, const TaskParallelTLS *__restrict UNUSED(tls))
static void subdiv_ccg_alloc_elements(SubdivCCG *subdiv_ccg, Subdiv *subdiv)
static void element_accumulator_copy(SubdivCCG *subdiv_ccg, CCGKey *key, CCGElem *destination, const GridElementAccumulator *accumulator)
static void subdiv_ccg_eval_grid_element(CCGEvalGridsData *data, const int ptex_face_index, const float u, const float v, unsigned char *element)
static void subdiv_ccg_eval_grid_element_limit(CCGEvalGridsData *data, const int ptex_face_index, const float u, const float v, unsigned char *element)
static void subdiv_ccg_average_all_boundaries_and_corners(SubdivCCG *subdiv_ccg, CCGKey *key)
BLI_INLINE bool is_inner_edge_grid_coordinate(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord)
static void neighbor_coords_boundary_inner_get(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, const bool include_duplicates, SubdivCCGNeighbors *r_neighbors)
static void subdiv_ccg_recalc_inner_normal_task(void *__restrict userdata_v, const int grid_index, const TaskParallelTLS *__restrict tls_v)
SubdivCCGAdjacencyType BKE_subdiv_ccg_coarse_mesh_adjacency_info_get(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, const MLoop *mloop, const MPoly *mpoly, int *r_v1, int *r_v2)
static void static_or_heap_storage_free(StaticOrHeapIntStorage *storage)
struct AverageGridsBoundariesTLSData AverageGridsBoundariesTLSData
struct StaticOrHeapIntStorage StaticOrHeapIntStorage
struct AverageGridsBoundariesData AverageGridsBoundariesData
struct RecalcInnerNormalsData RecalcInnerNormalsData
struct RecalcInnerNormalsTLSData RecalcInnerNormalsTLSData
const int * BKE_subdiv_ccg_start_face_grid_index_get(const SubdivCCG *subdiv_ccg)
BLI_INLINE int next_grid_index_from_coord(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord)
static int num_element_float_get(const SubdivCCG *subdiv_ccg)
void BKE_subdiv_ccg_neighbor_coords_get(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, const bool include_duplicates, SubdivCCGNeighbors *r_neighbors)
static void element_accumulator_add(GridElementAccumulator *accumulator, const SubdivCCG *subdiv_ccg, CCGKey *key, CCGElem *grid_element)
static void subdiv_ccg_init_faces(SubdivCCG *subdiv_ccg)
BLI_INLINE SubdivCCGCoord coord_at_prev_col(const SubdivCCG *UNUSED(subdiv_ccg), const SubdivCCGCoord *coord)
static SubdivCCGCoord * subdiv_ccg_adjacent_edge_add_face(SubdivCCG *subdiv_ccg, SubdivCCGAdjacentEdge *adjacent_edge)
void BKE_subdiv_ccg_eval_limit_point(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, float r_point[3])
static void subdiv_ccg_allocate_adjacent_vertices(SubdivCCG *subdiv_ccg, const int num_vertices)
static void element_accumulator_init(GridElementAccumulator *accumulator)
void BKE_subdiv_ccg_average_grids(SubdivCCG *subdiv_ccg)
struct GridElementAccumulator GridElementAccumulator
static void subdiv_ccg_eval_regular_grid(CCGEvalGridsData *data, const int face_index)
static int prev_adjacent_edge_point_index(const SubdivCCG *subdiv_ccg, const int point_index)
static CCGElem * subdiv_ccg_coord_to_elem(const CCGKey *key, const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord)
static void subdiv_ccg_average_inner_face_grids(SubdivCCG *subdiv_ccg, CCGKey *key, SubdivCCGFace *face)
struct AverageInnerGridsData AverageInnerGridsData
static void subdiv_ccg_average_grids_corners_task(void *__restrict userdata_v, const int adjacent_vertex_index, const TaskParallelTLS *__restrict UNUSED(tls_v))
BLI_INLINE SubdivCCGCoord coord_at_next_row(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord)
void BKE_subdiv_ccg_destroy(SubdivCCG *subdiv_ccg)
static void subdiv_ccg_average_grids_boundaries_free(const void *__restrict UNUSED(userdata), void *__restrict tls_v)
BLI_INLINE bool is_corner_grid_coord(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord)
static SubdivCCGCoord coord_step_inside_from_boundary(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord)
static void neighbor_coords_corner_center_get(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, const bool include_duplicates, SubdivCCGNeighbors *r_neighbors)
static int * static_or_heap_storage_get(StaticOrHeapIntStorage *storage, int size)
static void subdiv_ccg_average_grids_boundary(SubdivCCG *subdiv_ccg, CCGKey *key, SubdivCCGAdjacentEdge *adjacent_edge, AverageGridsBoundariesTLSData *tls)
const int * BKE_subdiv_ccg_start_face_grid_index_ensure(SubdivCCG *subdiv_ccg)
static int adjacent_vertex_index_from_coord(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord)
static int adjacent_grid_corner_point_index_on_edge(const SubdivCCG *subdiv_ccg, const int point_index)
void BKE_subdiv_ccg_key_top_level(CCGKey *key, const SubdivCCG *subdiv_ccg)
static void neighbor_coords_corner_get(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, const bool include_duplicates, SubdivCCGNeighbors *r_neighbors)
static void subdiv_ccg_eval_grid_element_mask(CCGEvalGridsData *data, const int ptex_face_index, const float u, const float v, unsigned char *element)
static int adjacent_edge_point_index_from_coord(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, const int adjacent_edge_index)
void BKE_subdiv_ccg_update_normals(SubdivCCG *subdiv_ccg, struct CCGFace **effected_faces, int num_effected_faces)
void BKE_subdiv_ccg_key(CCGKey *key, const SubdivCCG *subdiv_ccg, int level)
BLI_INLINE SubdivCCGCoord coord_at_prev_row(const SubdivCCG *UNUSED(subdiv_ccg), const SubdivCCGCoord *coord)
static void element_accumulator_mul_fl(GridElementAccumulator *accumulator, const float f)
struct StitchFacesInnerGridsData StitchFacesInnerGridsData
static void adjacet_vertices_index_from_adjacent_edge(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, const MLoop *mloop, const MPoly *mpoly, int *r_v1, int *r_v2)
static void average_grid_element_value_v3(float a[3], float b[3])
static void subdiv_ccg_recalc_inner_normal_free(const void *__restrict UNUSED(userdata), void *__restrict tls_v)
static void subdiv_ccg_eval_special_grid(CCGEvalGridsData *data, const int face_index)
static void subdiv_ccg_average_all_corners(SubdivCCG *subdiv_ccg, CCGKey *key)
static SubdivCCGCoord subdiv_ccg_coord(int grid_index, int x, int y)
Mesh * BKE_subdiv_to_ccg_mesh(Subdiv *subdiv, const SubdivToCCGSettings *settings, const Mesh *coarse_mesh)
static void subdiv_ccg_average_inner_grids_task(void *__restrict userdata_v, const int face_index, const TaskParallelTLS *__restrict UNUSED(tls_v))
void BKE_subdiv_ccg_average_stitch_faces(SubdivCCG *subdiv_ccg, struct CCGFace **effected_faces, int num_effected_faces)
void BKE_subdiv_ccg_grid_hidden_ensure(SubdivCCG *subdiv_ccg, int grid_index)
void BKE_subdiv_ccg_topology_counters(const SubdivCCG *subdiv_ccg, int *r_num_vertices, int *r_num_edges, int *r_num_faces, int *r_num_loops)
static void subdiv_ccg_average_grids_corners(SubdivCCG *subdiv_ccg, CCGKey *key, SubdivCCGAdjacentVertex *adjacent_vertex)
static bool subdiv_ccg_evaluate_grids(SubdivCCG *subdiv_ccg, Subdiv *subdiv, SubdivCCGMaskEvaluator *mask_evaluator, SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator)
static void neighbor_coords_corner_vertex_get(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, const bool include_duplicates, SubdivCCGNeighbors *r_neighbors)
static void neighbor_coords_boundary_outer_get(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, const bool include_duplicates, SubdivCCGNeighbors *r_neighbors)
int BKE_subdiv_ccg_grid_to_face_index(const SubdivCCG *subdiv_ccg, const int grid_index)
static void neighbor_coords_corner_edge_get(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, const bool include_duplicates, SubdivCCGNeighbors *r_neighbors)
static void average_grid_element(SubdivCCG *subdiv_ccg, CCGKey *key, CCGElem *grid_element_a, CCGElem *grid_element_b)
static int topology_refiner_count_face_corners(OpenSubdiv_TopologyRefiner *topology_refiner)
static void subdiv_ccg_coord_to_ptex_coord(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, int *r_ptex_face_index, float *r_u, float *r_v)
void BKE_subdiv_ccg_print_coord(const char *message, const SubdivCCGCoord *coord)
BLI_INLINE void subdiv_ccg_neighbors_init(SubdivCCGNeighbors *neighbors, const int num_unique, const int num_duplicates)
static void subdiv_ccg_recalc_inner_grid_normals(SubdivCCG *subdiv_ccg)
static void subdiv_ccg_recalc_inner_face_normals(SubdivCCG *subdiv_ccg, CCGKey *key, RecalcInnerNormalsTLSData *tls, const int grid_index)
static void subdiv_ccg_recalc_modified_inner_normal_task(void *__restrict userdata_v, const int face_index, const TaskParallelTLS *__restrict tls_v)
static int adjacent_edge_index_from_coord(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord)
static void subdiv_ccg_average_grids_boundaries_task(void *__restrict userdata_v, const int adjacent_edge_index, const TaskParallelTLS *__restrict tls_v)
static void subdiv_ccg_average_all_boundaries(SubdivCCG *subdiv_ccg, CCGKey *key)
static void neighbor_coords_boundary_get(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, const bool include_duplicates, SubdivCCGNeighbors *r_neighbors)
SubdivCCG * BKE_subdiv_to_ccg(Subdiv *subdiv, const SubdivToCCGSettings *settings, SubdivCCGMaskEvaluator *mask_evaluator, SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator)
struct CCGEvalGridsData CCGEvalGridsData
static void static_or_heap_storage_init(StaticOrHeapIntStorage *storage)
bool BKE_subdiv_ccg_check_coord_valid(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord)
BLI_INLINE SubdivCCGCoord coord_at_next_col(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord)
static void subdiv_ccg_init_layers(SubdivCCG *subdiv_ccg, const SubdivToCCGSettings *settings)
static void subdiv_ccg_average_inner_face_normals(SubdivCCG *subdiv_ccg, CCGKey *key, RecalcInnerNormalsTLSData *tls, const int grid_index)
static SubdivCCGCoord * subdiv_ccg_adjacent_vertex_add_face(SubdivCCGAdjacentVertex *adjacent_vertex)
static void subdiv_ccg_init_faces_vertex_neighborhood(SubdivCCG *subdiv_ccg)
static int element_size_bytes_get(const SubdivCCG *subdiv_ccg)
static void subdiv_ccg_init_faces_neighborhood(SubdivCCG *subdiv_ccg)
struct RecalcModifiedInnerNormalsData RecalcModifiedInnerNormalsData
struct AverageGridsCornerData AverageGridsCornerData
static void subdiv_ccg_allocate_adjacent_edges(SubdivCCG *subdiv_ccg, const int num_edges)
static void subdiv_ccg_recalc_modified_inner_grid_normals(SubdivCCG *subdiv_ccg, struct CCGFace **effected_faces, int num_effected_faces)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)