opensubdiv_converter_orient.cc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Copyright 2018 Blender Foundation. All rights reserved.
  2. //
  3. // This program is free software; you can redistribute it and/or
  4. // modify it under the terms of the GNU General Public License
  5. // as published by the Free Software Foundation; either version 2
  6. // of the License, or (at your option) any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software Foundation,
  15. // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. //
  17. // Author: Sergey Sharybin
  18. #include "internal/opensubdiv_converter_orient.h"
  19. #include "internal/opensubdiv_internal.h"
  20. namespace opensubdiv_capi {
  21. void checkOrientedVertexConnectivity(const int num_vertex_edges,
  22. const int num_vertex_faces,
  23. const int *vertex_edges,
  24. const int *vertex_faces,
  25. const int *dst_vertex_edges,
  26. const int *dst_vertex_faces)
  27. {
  28. #ifndef NDEBUG
  29. for (int i = 0; i < num_vertex_faces; ++i) {
  30. bool found = false;
  31. for (int j = 0; j < num_vertex_faces; ++j) {
  32. if (vertex_faces[i] == dst_vertex_faces[j]) {
  33. found = true;
  34. break;
  35. }
  36. }
  37. if (!found) {
  38. assert(!"vert-faces connectivity ruined");
  39. }
  40. }
  41. for (int i = 0; i < num_vertex_edges; ++i) {
  42. bool found = false;
  43. for (int j = 0; j < num_vertex_edges; ++j) {
  44. if (vertex_edges[i] == dst_vertex_edges[j]) {
  45. found = true;
  46. break;
  47. }
  48. }
  49. if (!found) {
  50. assert(!"vert-edges connectivity ruined");
  51. }
  52. }
  53. #else
  54. (void)num_vertex_edges;
  55. (void)num_vertex_faces;
  56. (void)vertex_edges;
  57. (void)vertex_faces;
  58. (void)dst_vertex_edges;
  59. (void)dst_vertex_faces;
  60. #endif
  61. }
  62. } // namespace opensubdiv_capi