Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/BKE_subdiv_ccg.h36
-rw-r--r--source/blender/blenkernel/intern/subdiv_ccg.c36
2 files changed, 24 insertions, 48 deletions
diff --git a/source/blender/blenkernel/BKE_subdiv_ccg.h b/source/blender/blenkernel/BKE_subdiv_ccg.h
index 89e0322e37f..f232d32b112 100644
--- a/source/blender/blenkernel/BKE_subdiv_ccg.h
+++ b/source/blender/blenkernel/BKE_subdiv_ccg.h
@@ -73,8 +73,7 @@ typedef struct SubdivToCCGSettings {
* evaluated. This defines how many vertices final mesh will have: every
* regular ptex has resolution^2 vertices. Special (irregular, or ptex
* created for a corner of non-quad polygon) will have resolution of
- * `resolution - 1`.
- */
+ * `resolution - 1`. */
int resolution;
/* Denotes which extra layers to be added to CCG elements. */
bool need_normal;
@@ -86,8 +85,7 @@ typedef struct SubdivCCGFace {
/* Total number of grids in this face.
*
* This 1:1 corresponds to a number of corners (or loops) from a coarse
- * face.
- */
+ * face. */
int num_grids;
/* Index of first grid from this face in SubdivCCG->grids array. */
int start_grid_index;
@@ -99,8 +97,7 @@ typedef struct SubdivCCGAdjacentEdge {
/* Indexed by adjacent face index. */
SubdivCCGFace **faces;
/* Indexed by adjacent face index, then by point index on the edge.
- * points to a grid element.
- */
+ * points to a grid element. */
struct CCGElem ***boundary_elements;
} SubdivCCGAdjacentEdge;
@@ -109,8 +106,7 @@ typedef struct SubdivCCGAdjacentVertex {
int num_adjacent_faces;
/* Indexed by adjacent face index. */
SubdivCCGFace **faces;
- /* Indexed by adjacent face index, points to a grid element.
- */
+ /* Indexed by adjacent face index, points to a grid element. */
struct CCGElem **corner_elements;
} SubdivCCGAdjacentVertex;
@@ -119,37 +115,31 @@ typedef struct SubdivCCG {
/* This is a subdivision surface this CCG was created for.
*
* TODO(sergey): Make sure the whole descriptor is valid, including all the
- * displacement attached to the surface.
- */
+ * displacement attached to the surface. */
struct Subdiv *subdiv;
/* A level at which geometry was subdivided. This is what defines grid
- * resolution. It is NOT the topology refinement level.
- */
+ * resolution. It is NOT the topology refinement level. */
int level;
/* Resolution of grid. All grids have matching resolution, and resolution
- * is same as ptex created for non-quad polygons.
- */
+ * is same as ptex created for non-quad polygons. */
int grid_size;
/* Grids represent limit surface, with displacement applied. Grids are
* corresponding to face-corners of coarse mesh, each grid has
* grid_size^2 elements.
*/
/* Indexed by a grid index, points to a grid data which is stored in
- * grids_storage.
- */
+ * grids_storage. */
struct CCGElem **grids;
/* Flat array of all grids' data. */
unsigned char *grids_storage;
int num_grids;
/* Loose edges, each array element contains grid_size elements
- * corresponding to vertices created by subdividing coarse edges.
- */
+ * corresponding to vertices created by subdividing coarse edges. */
struct CCGElem **edges;
int num_edges;
/* Loose vertices. Every element corresponds to a loose vertex from a coarse
* mesh, every coarse loose vertex corresponds to a single sundivided
- * element.
- */
+ * element. */
struct CCGElem *vertices;
int num_vertices;
/* Denotes which layers present in the elements.
@@ -194,8 +184,7 @@ typedef struct SubdivCCG {
/* Integration with sculpting. */
/* TODO(sergey): Is this really best way to go? Kind of annoying to have
- * such use-related flags in a more or less generic structure.
- */
+ * such use-related flags in a more or less generic structure. */
struct {
/* Corresponds to MULTIRES_COORDS_MODIFIED. */
bool coords;
@@ -211,8 +200,7 @@ typedef struct SubdivCCG {
*
* TODO(sergey): Allow some user-counter or more explicit control over who owns
* the Subdiv. The goal should be to allow viewport GL Mesh and CCG to share
- * same Subsurf without conflicts.
- */
+ * same Subsurf without conflicts. */
struct SubdivCCG *BKE_subdiv_to_ccg(
struct Subdiv *subdiv,
const SubdivToCCGSettings *settings,
diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c
index 9802c8a0088..7b8ca795ee6 100644
--- a/source/blender/blenkernel/intern/subdiv_ccg.c
+++ b/source/blender/blenkernel/intern/subdiv_ccg.c
@@ -92,8 +92,7 @@ static void subdiv_ccg_init_layers(SubdivCCG *subdiv_ccg,
/* Normals.
*
* NOTE: Keep them at the end, matching old CCGDM. Doesn't really matter
- * here, but some other area might in theory depend memory layout.
- */
+ * here, but some other area might in theory depend memory layout. */
if (settings->need_normal) {
subdiv_ccg->has_normal = true;
subdiv_ccg->normal_offset = layer_offset;
@@ -119,8 +118,7 @@ static int topology_refiner_count_face_corners(
}
/* NOTE: Grid size and layer flags are to be filled in before calling this
- * function.
- */
+ * function. */
static void subdiv_ccg_alloc_elements(SubdivCCG *subdiv_ccg, Subdiv *subdiv)
{
OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
@@ -313,8 +311,7 @@ static bool subdiv_ccg_evaluate_grids(
subdiv_ccg_eval_grids_task,
&parallel_range_settings);
/* If displacement is used, need to calculate normals after all final
- * coordinates are known.
- */
+ * coordinates are known. */
if (subdiv->displacement_evaluator != NULL) {
BKE_subdiv_ccg_recalc_normals(subdiv_ccg);
}
@@ -322,8 +319,7 @@ static bool subdiv_ccg_evaluate_grids(
}
/* Initialize face descriptors, assuming memory for them was already
- * allocated.
- */
+ * allocated. */
static void subdiv_ccg_init_faces(SubdivCCG *subdiv_ccg)
{
Subdiv *subdiv = subdiv_ccg->subdiv;
@@ -443,8 +439,7 @@ static void subdiv_ccg_init_faces_edge_neighborhood(SubdivCCG *subdiv_ccg)
topology_refiner->getFaceVertices(
topology_refiner, face_index, face_vertices);
/* Note that order of edges is same as order of MLoops, which also
- * means it's the same as order of grids.
- */
+ * means it's the same as order of grids. */
int *face_edges = static_or_heap_storage_get(
&face_edges_storage, num_face_edges);
topology_refiner->getFaceEdges(
@@ -521,8 +516,7 @@ static void subdiv_ccg_allocate_adjacent_vertices(SubdivCCG *subdiv_ccg,
}
/* Returns storage where corner elements are to be stored. This is a pointer
- * to the actual storage.
- */
+ * to the actual storage. */
static CCGElem **subdiv_ccg_adjacent_vertex_add_face(
SubdivCCGAdjacentVertex *adjacent_vertex,
SubdivCCGFace *face)
@@ -733,8 +727,7 @@ typedef struct RecalcInnerNormalsTLSData {
*
* {(x, y), {x + 1, y}, {x + 1, y + 1}, {x, y + 1}}
*
- * The result is stored in normals storage from TLS.
- */
+ * The result is stored in normals storage from TLS. */
static void subdiv_ccg_recalc_inner_face_normals(
RecalcInnerNormalsData *data,
RecalcInnerNormalsTLSData *tls,
@@ -972,16 +965,14 @@ static void subdiv_ccg_average_grids_boundary(
/* Incrementall average result to elements of a first adjacent face.
*
* Arguably, this is less precise than accumulating and then diving once,
- * but on another hand this is more stable when coordinates are big.
- */
+ * but on another hand this is more stable when coordinates are big. */
for (int face_index = 1; face_index < num_adjacent_faces; face_index++) {
/* NOTE: We ignore very first and very last elements, they correspond
* to corner vertices, and they can belong to multiple edges.
* The fact, that they can belong to multiple edges means we can't
* safely average them.
* The fact, that they correspond to a corner elements, means they will
- * be handled at the upcoming pass over corner elements.
- */
+ * be handled at the upcoming pass over corner elements. */
for (int i = 1; i < grid_size2 - 1; i++) {
CCGElem *grid_element_0 =
adjacent_edge->boundary_elements[0][i];
@@ -1037,8 +1028,7 @@ static void subdiv_ccg_average_grids_corners(
return;
}
/* Incrementall average result to elements of a first adjacent face.
- * See comment to the boundary averaging.
- */
+ * See comment to the boundary averaging. */
for (int face_index = 1; face_index < num_adjacent_faces; face_index++) {
CCGElem *grid_element_0 =
adjacent_vertex->corner_elements[0];
@@ -1108,8 +1098,7 @@ void BKE_subdiv_ccg_average_grids(SubdivCCG *subdiv_ccg)
ParallelRangeSettings parallel_range_settings;
BLI_parallel_range_settings_defaults(&parallel_range_settings);
/* Average inner boundaries of grids (within one face), across faces
- * from different face-corners.
- */
+ * from different face-corners. */
AverageInnerGridsData inner_data = {
.subdiv_ccg = subdiv_ccg,
.key = &key,
@@ -1159,8 +1148,7 @@ void BKE_subdiv_ccg_average_stitch_faces(SubdivCCG *subdiv_ccg,
subdiv_ccg_stitch_face_inner_grids_task,
&parallel_range_settings);
/* TODO(sergey): Only average elements which are adjacent to modified
- * faces.
- */
+ * faces. */
subdiv_ccg_average_all_boundaries_and_corners(subdiv_ccg, &key);
}