Cleanup: More proper sections in subdiv code

Follows the code style.
This commit is contained in:
Sergey Sharybin
2022-05-12 09:43:19 +02:00
parent 9599c5415d
commit 0c9892020b
3 changed files with 48 additions and 16 deletions

View File

@@ -186,13 +186,17 @@ typedef struct Subdiv {
} cache_;
} Subdiv;
/* =================----====--===== MODULE ==========================------== */
/* --------------------------------------------------------------------
* Module.
*/
/* (De)initialize the entire subdivision surface module. */
void BKE_subdiv_init(void);
void BKE_subdiv_exit(void);
/* ========================== CONVERSION HELPERS ============================ */
/* --------------------------------------------------------------------
* Conversion helpers.
*/
/* NOTE: uv_smooth is eSubsurfUVSmooth. */
eSubdivFVarLinearInterpolation BKE_subdiv_fvar_interpolation_from_uv_smooth(int uv_smooth);
@@ -200,7 +204,9 @@ eSubdivFVarLinearInterpolation BKE_subdiv_fvar_interpolation_from_uv_smooth(int
eSubdivVtxBoundaryInterpolation BKE_subdiv_vtx_boundary_interpolation_from_subsurf(
int boundary_smooth);
/* =============================== STATISTICS =============================== */
/* --------------------------------------------------------------------
* Statistics.
*/
void BKE_subdiv_stats_init(SubdivStats *stats);
@@ -211,11 +217,15 @@ void BKE_subdiv_stats_reset(SubdivStats *stats, eSubdivStatsValue value);
void BKE_subdiv_stats_print(const SubdivStats *stats);
/* ================================ SETTINGS ================================ */
/* --------------------------------------------------------------------
* Settings.
*/
bool BKE_subdiv_settings_equal(const SubdivSettings *settings_a, const SubdivSettings *settings_b);
/* ============================== CONSTRUCTION ============================== */
/* --------------------------------------------------------------------
* Construction.
*/
/* Construct new subdivision surface descriptor, from scratch, using given
* settings and topology. */
@@ -240,7 +250,9 @@ Subdiv *BKE_subdiv_update_from_mesh(Subdiv *subdiv,
void BKE_subdiv_free(Subdiv *subdiv);
/* ============================ DISPLACEMENT API ============================ */
/* --------------------------------------------------------------------
* Displacemnt API.
*/
void BKE_subdiv_displacement_attach_from_multires(Subdiv *subdiv,
struct Mesh *mesh,
@@ -248,14 +260,18 @@ void BKE_subdiv_displacement_attach_from_multires(Subdiv *subdiv,
void BKE_subdiv_displacement_detach(Subdiv *subdiv);
/* ============================ TOPOLOGY HELPERS ============================ */
/* --------------------------------------------------------------------
* Topology helpers.
*/
/* For each element in the array, this stores the total number of ptex faces up to that element,
* with the total number of ptex faces being the last element in the array. The array is of length
* `base face count + 1`. */
int *BKE_subdiv_face_ptex_offset_get(Subdiv *subdiv);
/* =========================== PTEX FACES AND GRIDS ========================= */
/* --------------------------------------------------------------------
* PTex faces and grids.
*/
/* For a given (ptex_u, ptex_v) within a ptex face get corresponding
* (grid_u, grid_v) within a grid. */

View File

@@ -25,7 +25,9 @@
#include "opensubdiv_evaluator_capi.h"
#include "opensubdiv_topology_refiner_capi.h"
/* =================----====--===== MODULE ==========================------== */
/* --------------------------------------------------------------------
* Module.
*/
void BKE_subdiv_init()
{
@@ -37,7 +39,9 @@ void BKE_subdiv_exit()
openSubdiv_cleanup();
}
/* ========================== CONVERSION HELPERS ============================ */
/* --------------------------------------------------------------------
* Conversion helpers.
*/
eSubdivFVarLinearInterpolation BKE_subdiv_fvar_interpolation_from_uv_smooth(int uv_smooth)
{
@@ -72,7 +76,9 @@ eSubdivVtxBoundaryInterpolation BKE_subdiv_vtx_boundary_interpolation_from_subsu
return SUBDIV_VTX_BOUNDARY_EDGE_ONLY;
}
/* ================================ SETTINGS ================================ */
/* --------------------------------------------------------------------
* Settings.
*/
bool BKE_subdiv_settings_equal(const SubdivSettings *settings_a, const SubdivSettings *settings_b)
{
@@ -83,7 +89,9 @@ bool BKE_subdiv_settings_equal(const SubdivSettings *settings_a, const SubdivSet
settings_a->fvar_linear_interpolation == settings_b->fvar_linear_interpolation);
}
/* ============================== CONSTRUCTION ============================== */
/* --------------------------------------------------------------------
* Construction.
*/
/* Creation from scratch. */
@@ -194,7 +202,9 @@ void BKE_subdiv_free(Subdiv *subdiv)
MEM_freeN(subdiv);
}
/* =========================== PTEX FACES AND GRIDS ========================= */
/* --------------------------------------------------------------------
* Topology helpers.
*/
int *BKE_subdiv_face_ptex_offset_get(Subdiv *subdiv)
{

View File

@@ -23,7 +23,9 @@
#include "opensubdiv_evaluator_capi.h"
#include "opensubdiv_topology_refiner_capi.h"
/* ============================ Helper Function ============================ */
/* --------------------------------------------------------------------
* Helper functions.
*/
static eOpenSubdivEvaluator opensubdiv_evalutor_from_subdiv_evaluator_type(
eSubdivEvaluatorType evaluator_type)
@@ -40,7 +42,9 @@ static eOpenSubdivEvaluator opensubdiv_evalutor_from_subdiv_evaluator_type(
return OPENSUBDIV_EVALUATOR_CPU;
}
/* ====================== Main Subdivision Evaluation ====================== */
/* --------------------------------------------------------------------
* Main subdivision evaluation.
*/
bool BKE_subdiv_eval_begin(Subdiv *subdiv,
eSubdivEvaluatorType evaluator_type,
@@ -226,7 +230,9 @@ void BKE_subdiv_eval_init_displacement(Subdiv *subdiv)
subdiv->displacement_evaluator->initialize(subdiv->displacement_evaluator);
}
/* ========================== Single point queries ========================== */
/* --------------------------------------------------------------------
* Single point queries.
*/
void BKE_subdiv_eval_limit_point(
Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3])