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:
Diffstat (limited to 'intern/opensubdiv/internal/topology/mesh_topology.h')
-rw-r--r--intern/opensubdiv/internal/topology/mesh_topology.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/intern/opensubdiv/internal/topology/mesh_topology.h b/intern/opensubdiv/internal/topology/mesh_topology.h
index 6edbc59b230..196d79c87df 100644
--- a/intern/opensubdiv/internal/topology/mesh_topology.h
+++ b/intern/opensubdiv/internal/topology/mesh_topology.h
@@ -19,6 +19,8 @@
#ifndef OPENSUBDIV_MESH_TOPOLOGY_H_
#define OPENSUBDIV_MESH_TOPOLOGY_H_
+#include <cstring>
+
#include "internal/base/memory.h"
#include "internal/base/type.h"
@@ -43,6 +45,37 @@ class EdgeTopology {
int v2 = -1;
};
+class FaceTopology {
+ public:
+ void setNumVertices(int num_vertices)
+ {
+ vertex_indices.resize(num_vertices, -1);
+ }
+
+ void setVertexIndices(int *face_vertex_indices)
+ {
+ memcpy(vertex_indices.data(), face_vertex_indices, sizeof(int) * vertex_indices.size());
+ }
+
+ bool isValid() const
+ {
+ for (int vertex_index : vertex_indices) {
+ if (vertex_index < 0) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ int getNumVertices() const
+ {
+ return vertex_indices.size();
+ }
+
+ vector<int> vertex_indices;
+};
+
class EdgeTopologyTag {
public:
float sharpness = 0.0f;
@@ -88,6 +121,19 @@ class MeshTopology {
float getEdgeSharpness(int edge_index) const;
//////////////////////////////////////////////////////////////////////////////
+ // Faces.
+
+ void setNumFaces(int num_faces);
+
+ int getNumFaces() const;
+
+ FaceTopology &getFace(int face_index);
+ const FaceTopology &getFace(int face_index) const;
+
+ void setNumFaceVertices(int face_index, int num_face_vertices);
+ void setFaceVertexIndices(int face_index, int *face_vertex_indices);
+
+ //////////////////////////////////////////////////////////////////////////////
// Comparison.
// Check whether this topology refiner defines same topology as the given
@@ -113,6 +159,9 @@ class MeshTopology {
vector<EdgeTopology> edges_;
vector<EdgeTopologyTag> edge_tags_;
+ int num_faces_;
+ vector<FaceTopology> faces_;
+
MEM_CXX_CLASS_ALLOC_FUNCS("MeshTopology");
};