Commit: 51c1927ccb546cffe30ebcd9e4ecf6aa07b96ce1
Author: Sergey Sharybin
Date:   Wed Jul 29 17:41:57 2015 +0200
Branches: master
https://developer.blender.org/rB51c1927ccb546cffe30ebcd9e4ecf6aa07b96ce1

OpenSubdiv: Make topology orientation optional

===================================================================

M       intern/opensubdiv/opensubdiv_converter.cc
M       intern/opensubdiv/opensubdiv_intern.h

===================================================================

diff --git a/intern/opensubdiv/opensubdiv_converter.cc 
b/intern/opensubdiv/opensubdiv_converter.cc
index a84939f..fe12c84 100644
--- a/intern/opensubdiv/opensubdiv_converter.cc
+++ b/intern/opensubdiv/opensubdiv_converter.cc
@@ -134,6 +134,7 @@ inline bool 
TopologyRefinerFactory<OpenSubdiv_Converter>::assignComponentTopolog
                int num_vert_edges = conv.get_num_vert_edges(&conv, vert);
                int *vert_edges = new int[num_vert_edges];
                conv.get_vert_edges(&conv, vert, vert_edges);
+#ifdef OPENSUBDIV_ORIENT_TOPOLOGY
                /* Order vertex edges and faces in a CCW order. */
                /* TODO(sergey): Look into possible optimizations here. */
                bool *face_used = new bool[num_faces];
@@ -253,6 +254,10 @@ inline bool 
TopologyRefinerFactory<OpenSubdiv_Converter>::assignComponentTopolog
                        }
                }
 #endif
+#else  /* OPENSUBDIV_ORIENT_TOPOLOGY */
+               memcpy(&dst_vert_edges[0], vert_edges, sizeof(int) * 
num_vert_edges);
+               memcpy(&dst_vert_faces[0], vert_faces, sizeof(int) * 
num_vert_faces);
+#endif  /* OPENSUBDIV_ORIENT_TOPOLOGY */
 
                delete [] vert_edges;
                delete [] vert_faces;
diff --git a/intern/opensubdiv/opensubdiv_intern.h 
b/intern/opensubdiv/opensubdiv_intern.h
index 034677f..3e3925e 100644
--- a/intern/opensubdiv/opensubdiv_intern.h
+++ b/intern/opensubdiv/opensubdiv_intern.h
@@ -33,4 +33,11 @@
 #  define OPENSUBDIV_VALIDATE_TOPOLOGY
 #endif
 
+/* Currently OpenSubdiv expects topology to be oriented,
+ * but sometimes it's handy to disable orientation code
+ * to check whether it causes some weird issues by using
+ * pre-oriented model.
+ */
+#define OPENSUBDIV_ORIENT_TOPOLOGY
+
 #endif  /* __OPENSUBDIV_INTERN_H__ */

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to