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:
authorBastien Montagne <montagne29@wanadoo.fr>2019-03-07 13:13:40 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-03-07 13:29:50 +0300
commitab0bc65c24bdf68c356adb2566f3669153c931ea (patch)
tree23909478874a13d84e504a905809eb211e62a9e2 /source/blender/depsgraph/intern/depsgraph_type.h
parentcee53160d2bd9067a3d43cc862ce61e36ff70454 (diff)
Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc., 'simply' do the same for the mask flags we use all around Blender code to request some data, or limit some operation to some layers, etc. Reason we need this is that some cddata types (like Normals) are actually shared between verts/polys/loops, and we don’t want to generate clnors everytime we request vnors! As a side note, this also does final fix to T59338, which was the trigger for this patch (need to request computed loop normals for another mesh than evaluated one). Reviewers: brecht, campbellbarton, sergey Differential Revision: https://developer.blender.org/D4407
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph_type.h')
-rw-r--r--source/blender/depsgraph/intern/depsgraph_type.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_type.h b/source/blender/depsgraph/intern/depsgraph_type.h
index 5233b6d018d..d34b6d724cb 100644
--- a/source/blender/depsgraph/intern/depsgraph_type.h
+++ b/source/blender/depsgraph/intern/depsgraph_type.h
@@ -39,6 +39,8 @@
struct Depsgraph;
+struct CustomData_MeshMasks;
+
namespace DEG {
/* Commonly used types. */
@@ -70,4 +72,94 @@ enum eUpdateSource {
DEG_UPDATE_SOURCE_VISIBILITY = (1 << 3),
};
+/* C++ wrapper around DNA's CustomData_MeshMasks struct. */
+struct DEGCustomDataMeshMasks {
+ uint64_t vert_mask;
+ uint64_t edge_mask;
+ uint64_t face_mask;
+ uint64_t loop_mask;
+ uint64_t poly_mask;
+
+ DEGCustomDataMeshMasks()
+ : vert_mask(0),
+ edge_mask(0),
+ face_mask(0),
+ loop_mask(0),
+ poly_mask(0)
+ {
+ }
+
+ explicit DEGCustomDataMeshMasks(const CustomData_MeshMasks *other);
+
+ DEGCustomDataMeshMasks& operator|=(const DEGCustomDataMeshMasks& other)
+ {
+ this->vert_mask |= other.vert_mask;
+ this->edge_mask |= other.edge_mask;
+ this->face_mask |= other.face_mask;
+ this->loop_mask |= other.loop_mask;
+ this->poly_mask |= other.poly_mask;
+ return *this;
+ }
+
+ DEGCustomDataMeshMasks operator|(const DEGCustomDataMeshMasks& other) const
+ {
+ DEGCustomDataMeshMasks result;
+ result.vert_mask = this->vert_mask | other.vert_mask;
+ result.edge_mask = this->edge_mask | other.edge_mask;
+ result.face_mask = this->face_mask | other.face_mask;
+ result.loop_mask = this->loop_mask | other.loop_mask;
+ result.poly_mask = this->poly_mask | other.poly_mask;
+ return result;
+ }
+
+ bool operator==(const DEGCustomDataMeshMasks& other) const
+ {
+ return (this->vert_mask == other.vert_mask &&
+ this->edge_mask == other.edge_mask &&
+ this->face_mask == other.face_mask &&
+ this->loop_mask == other.loop_mask &&
+ this->poly_mask == other.poly_mask);
+ }
+
+ bool operator!=(const DEGCustomDataMeshMasks& other) const
+ {
+ return !(*this == other);
+ }
+
+ static DEGCustomDataMeshMasks MaskVert(const uint64_t vert_mask)
+ {
+ DEGCustomDataMeshMasks result;
+ result.vert_mask = vert_mask;
+ return result;
+ }
+
+ static DEGCustomDataMeshMasks MaskEdge(const uint64_t edge_mask)
+ {
+ DEGCustomDataMeshMasks result;
+ result.edge_mask = edge_mask;
+ return result;
+ }
+
+ static DEGCustomDataMeshMasks MaskFace(const uint64_t face_mask)
+ {
+ DEGCustomDataMeshMasks result;
+ result.face_mask = face_mask;
+ return result;
+ }
+
+ static DEGCustomDataMeshMasks MaskLoop(const uint64_t loop_mask)
+ {
+ DEGCustomDataMeshMasks result;
+ result.loop_mask = loop_mask;
+ return result;
+ }
+
+ static DEGCustomDataMeshMasks MaskPoly(const uint64_t poly_mask)
+ {
+ DEGCustomDataMeshMasks result;
+ result.poly_mask = poly_mask;
+ return result;
+ }
+};
+
} // namespace DEG