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:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-01-15 17:34:11 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-01-16 13:00:43 +0300
commitb0c6c65e7b45bf66f2f9e0aa3718be7eb0f72f81 (patch)
tree74f3aeb53634bd80bdca4d5626ee9e8fe09b5caf /source/blender/blenkernel/BKE_subdiv.h
parente064777cac02a065e20a9453f6d2a03651250d56 (diff)
Subdiv: Initial implementation of topology cache
This commit makes it so OpenSubdiv's topology refiner is kept in memory and reused for until topology changes. There are the following modifications which causes topology refiner to become invalid: - Change in a mesh topology (for example, vertices, edges, and faces connectivity). - Change in UV islands (adding new islands, merging them and so on), - Change in UV smoothing options. - Change in creases. - Change in Catmull-Clark / Simple subdivisions. The following limitations are known: - CPU evaluator is not yet cached. - UV islands topology is not checked. The UV limitation is currently a stopper for making this cache enabled by default.
Diffstat (limited to 'source/blender/blenkernel/BKE_subdiv.h')
-rw-r--r--source/blender/blenkernel/BKE_subdiv.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_subdiv.h b/source/blender/blenkernel/BKE_subdiv.h
index 81d605ffb63..d79ea1ca646 100644
--- a/source/blender/blenkernel/BKE_subdiv.h
+++ b/source/blender/blenkernel/BKE_subdiv.h
@@ -79,6 +79,7 @@ typedef enum eSubdivStatsValue {
SUBDIV_STATS_EVALUATOR_REFINE,
SUBDIV_STATS_SUBDIV_TO_CCG,
SUBDIV_STATS_SUBDIV_TO_CCG_ELEMENTS,
+ SUBDIV_STATS_TOPOLOGY_COMPARE,
NUM_SUBDIV_STATS_VALUES,
} eSubdivStatsValue;
@@ -102,6 +103,8 @@ typedef struct SubdivStats {
double subdiv_to_ccg_time;
/* Time spent on CCG elements evaluation/initialization. */
double subdiv_to_ccg_elements_time;
+ /* Time spent on CCG elements evaluation/initialization. */
+ double topology_compare_time;
};
double values_[NUM_SUBDIV_STATS_VALUES];
};
@@ -187,14 +190,37 @@ void BKE_subdiv_stats_end(SubdivStats *stats, eSubdivStatsValue value);
void BKE_subdiv_stats_print(const SubdivStats *stats);
+/* ================================ SETTINGS ================================ */
+
+bool BKE_subdiv_settings_equal(const SubdivSettings *settings_a,
+ const SubdivSettings *settings_b);
+
/* ============================== CONSTRUCTION ============================== */
+/* Construct new subdivision surface descriptor, from scratch, using given
+ * settings and topology. */
Subdiv *BKE_subdiv_new_from_converter(const SubdivSettings *settings,
struct OpenSubdiv_Converter *converter);
-
Subdiv *BKE_subdiv_new_from_mesh(const SubdivSettings *settings,
const struct Mesh *mesh);
+/* Similar to above, but will not re-create descriptor if it was created for the
+ * same settings and topology.
+ * If settings or topology did change, the existing descriptor is freed and a
+ * new one is created from scratch.
+ *
+ * NOTE: It is allowed to pass NULL as an existing subdivision surface
+ * descriptor. This will create enw descriptor without any extra checks.
+ */
+Subdiv *BKE_subdiv_update_from_converter(
+ Subdiv *subdiv,
+ const SubdivSettings *settings,
+ struct OpenSubdiv_Converter *converter);
+Subdiv *BKE_subdiv_update_from_mesh(
+ Subdiv *subdiv,
+ const SubdivSettings *settings,
+ const struct Mesh *mesh);
+
void BKE_subdiv_free(Subdiv *subdiv);
/* ============================ DISPLACEMENT API ============================ */