diff options
Diffstat (limited to 'intern/opensubdiv')
-rw-r--r-- | intern/opensubdiv/internal/topology/mesh_topology_compare.cc | 30 | ||||
-rw-r--r-- | intern/opensubdiv/internal/topology/topology_refiner_impl_compare.cc | 18 |
2 files changed, 31 insertions, 17 deletions
diff --git a/intern/opensubdiv/internal/topology/mesh_topology_compare.cc b/intern/opensubdiv/internal/topology/mesh_topology_compare.cc index a2561568c71..0aa217ac711 100644 --- a/intern/opensubdiv/internal/topology/mesh_topology_compare.cc +++ b/intern/opensubdiv/internal/topology/mesh_topology_compare.cc @@ -32,9 +32,7 @@ namespace opensubdiv { namespace { //////////////////////////////////////////////////////////////////////////////// -// Geometry. - -// Edges. +// Quick preliminary checks. int getEffectiveNumEdges(const OpenSubdiv_Converter *converter) { @@ -45,6 +43,27 @@ int getEffectiveNumEdges(const OpenSubdiv_Converter *converter) return converter->getNumEdges(converter); } +bool isEqualGeometryCounters(const MeshTopology &mesh_topology, + const OpenSubdiv_Converter *converter) +{ + if (converter->getNumVertices(converter) != mesh_topology.getNumVertices()) { + return false; + } + if (converter->getNumFaces(converter) != mesh_topology.getNumFaces()) { + return false; + } + if (getEffectiveNumEdges(converter) != mesh_topology.getNumEdges()) { + return false; + } + + return true; +} + +//////////////////////////////////////////////////////////////////////////////// +// Geometry. + +// Edges. + bool isEqualGeometryEdge(const MeshTopology &mesh_topology, const OpenSubdiv_Converter *converter) { const int num_requested_edges = getEffectiveNumEdges(converter); @@ -192,6 +211,11 @@ bool isEqualTags(const MeshTopology &mesh_topology, const OpenSubdiv_Converter * bool MeshTopology::isEqualToConverter(const OpenSubdiv_Converter *converter) const { + // Preliminary checks. + if (!isEqualGeometryCounters(*this, converter)) { + return false; + } + // Geometry. if (!isEqualGeometry(*this, converter)) { return false; diff --git a/intern/opensubdiv/internal/topology/topology_refiner_impl_compare.cc b/intern/opensubdiv/internal/topology/topology_refiner_impl_compare.cc index 41727d5664a..2d0c5ec599f 100644 --- a/intern/opensubdiv/internal/topology/topology_refiner_impl_compare.cc +++ b/intern/opensubdiv/internal/topology/topology_refiner_impl_compare.cc @@ -67,22 +67,11 @@ bool checkOptionsMatches(const TopologyRefinerImpl *topology_refiner_impl, return true; } -bool checkGeometryCountersMatches(const TopologyRefinerImpl *topology_refiner_impl, - const OpenSubdiv_Converter *converter) -{ - using OpenSubdiv::Far::TopologyLevel; - const TopologyLevel &base_level = getOSDTopologyBaseLevel(topology_refiner_impl); - return ((converter->getNumVertices(converter) == base_level.GetNumVertices()) && - (converter->getNumEdges(converter) == base_level.GetNumEdges()) && - (converter->getNumFaces(converter) == base_level.GetNumFaces())); -} - bool checkPreliminaryMatches(const TopologyRefinerImpl *topology_refiner_impl, const OpenSubdiv_Converter *converter) { return checkSchemeTypeMatches(topology_refiner_impl, converter) && - checkOptionsMatches(topology_refiner_impl, converter) && - checkGeometryCountersMatches(topology_refiner_impl, converter); + checkOptionsMatches(topology_refiner_impl, converter); } //////////////////////////////////////////////////////////////////////////////// @@ -142,11 +131,12 @@ bool TopologyRefinerImpl::isEqualToConverter(const OpenSubdiv_Converter *convert if (!blender::opensubdiv::checkPreliminaryMatches(this, converter)) { return false; } - if (!blender::opensubdiv::checkTopologyAttributesMatch(this, converter)) { + + if (!base_mesh_topology.isEqualToConverter(converter)) { return false; } - if (!base_mesh_topology.isEqualToConverter(converter)) { + if (!blender::opensubdiv::checkTopologyAttributesMatch(this, converter)) { return false; } |