Commit c58d06a0 by Alisa Jung Committed by Philipp Adolf

removed redundant code

parent 8a65f39d
...@@ -106,9 +106,9 @@ void Mesh::MeshEntry::init(QOpenGLFunctions_4_3_Core *f,QVector<Vertex>& Vertice ...@@ -106,9 +106,9 @@ void Mesh::MeshEntry::init(QOpenGLFunctions_4_3_Core *f,QVector<Vertex>& Vertice
QMap<Edge,unsigned int> sharpEdges; QMap<Edge,unsigned int> sharpEdges;
if (fakeSharpness){ if (fakeSharpness){
for (int i = 0; i < Indices.size(); i+= 3){ for (int i = 0; i < Indices.size(); i+= 3){
sharpEdges.insert(Edge(Indices[i],Indices[i+1]),2); sharpEdges.insert(Edge(Indices[i],Indices[i+1]),3);
sharpEdges.insert(Edge(Indices[i+1],Indices[i+2]),2); sharpEdges.insert(Edge(Indices[i+1],Indices[i+2]),3);
sharpEdges.insert(Edge(Indices[i+2],Indices[i]),2); sharpEdges.insert(Edge(Indices[i+2],Indices[i]),3);
} }
} }
buffers[0].reset(new SubdivEntry); buffers[0].reset(new SubdivEntry);
......
...@@ -927,11 +927,6 @@ QVector<unsigned int> Subdivision::patchIBToTriangleIB(QVector<unsigned int> ib) ...@@ -927,11 +927,6 @@ QVector<unsigned int> Subdivision::patchIBToTriangleIB(QVector<unsigned int> ib)
bool isVertexRegular(Triangle &triangle, Triangle::Neighbor current_neighbor, QMap<Triangle, Triangle::Neighbors> neighbors) { bool isVertexRegular(Triangle &triangle, Triangle::Neighbor current_neighbor, QMap<Triangle, Triangle::Neighbors> neighbors) {
assert(current_neighbor.triangle != NULL); assert(current_neighbor.triangle != NULL);
unsigned int count = 1; unsigned int count = 1;
bool is_sharp =
triangle.get_sharpness_uv() > 0 ||
triangle.get_sharpness_vw() > 0 ||
triangle.get_sharpness_wu() > 0;
if (is_sharp) return false;
while (count < 6 && *current_neighbor.triangle != triangle) { while (count < 6 && *current_neighbor.triangle != triangle) {
count++; count++;
current_neighbor = neighbors.value(*current_neighbor.triangle).get_neighbor(rotate_edge_name(current_neighbor.edge.name)); current_neighbor = neighbors.value(*current_neighbor.triangle).get_neighbor(rotate_edge_name(current_neighbor.edge.name));
...@@ -951,7 +946,9 @@ void Subdivision::findRegular(QVector<Triangle> triangles, QMap<Triangle, Triang ...@@ -951,7 +946,9 @@ void Subdivision::findRegular(QVector<Triangle> triangles, QMap<Triangle, Triang
Triangle::Neighbors ns = neighbors.value(triangle); Triangle::Neighbors ns = neighbors.value(triangle);
bool is_regular = true; bool is_regular = true;
if (triangle.has_sharp_edge()){
is_regular = false;
}
if (!isVertexRegular(triangle, ns.uv, neighbors)) { if (!isVertexRegular(triangle, ns.uv, neighbors)) {
is_regular = false; is_regular = false;
} }
......
...@@ -62,6 +62,10 @@ unsigned int Triangle::get_sharpness_wu() const { ...@@ -62,6 +62,10 @@ unsigned int Triangle::get_sharpness_wu() const {
return sharpness_wu; return sharpness_wu;
} }
bool Triangle::has_sharp_edge() const{
return (sharpness_uv > 0 || sharpness_vw > 0 || sharpness_wu > 0);
}
bool Triangle::get_shared_edge(Triangle other, Edge &edge_a, Edge &edge_b) const { bool Triangle::get_shared_edge(Triangle other, Edge &edge_a, Edge &edge_b) const {
if (get_shared_edge_(other, edge_a, edge_b)) { if (get_shared_edge_(other, edge_a, edge_b)) {
return true; return true;
......
...@@ -55,6 +55,8 @@ class Triangle { ...@@ -55,6 +55,8 @@ class Triangle {
unsigned int get_sharpness_vw() const; unsigned int get_sharpness_vw() const;
unsigned int get_sharpness_wu() const; unsigned int get_sharpness_wu() const;
bool has_sharp_edge() const;
bool get_shared_edge(Triangle other, Edge &edge_a, Edge &edge_b) const; bool get_shared_edge(Triangle other, Edge &edge_a, Edge &edge_b) const;
bool hasSharedEdge(Triangle other); bool hasSharedEdge(Triangle other);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment