Commit 3ead38ca by Philipp Adolf

Make one side of the box sharp

parent 00ad9737
...@@ -106,11 +106,23 @@ void Mesh::MeshEntry::init(QOpenGLFunctions_4_3_Core *f,QVector<Vertex>& Vertice ...@@ -106,11 +106,23 @@ 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){
Vertex a = Vertices[Indices[i+0]];
Vertex b = Vertices[Indices[i+1]];
Vertex c = Vertices[Indices[i+2]];
if (a.pos.z() > 0.9 && b.pos.z() > 0.9) {
if (a.pos.x() == b.pos.x() || a.pos.y() == b.pos.y())
sharpEdges.insert(Edge(Indices[i],Indices[i+1]),3); sharpEdges.insert(Edge(Indices[i],Indices[i+1]),3);
}
if (b.pos.z() > 0.9 && c.pos.z() > 0.9) {
if (b.pos.x() == c.pos.x() || b.pos.y() == c.pos.y())
sharpEdges.insert(Edge(Indices[i+1],Indices[i+2]),3); sharpEdges.insert(Edge(Indices[i+1],Indices[i+2]),3);
}
if (c.pos.z() > 0.9 && a.pos.z() > 0.9) {
if (c.pos.x() == a.pos.x() || c.pos.y() == a.pos.y())
sharpEdges.insert(Edge(Indices[i+2],Indices[i]),3); sharpEdges.insert(Edge(Indices[i+2],Indices[i]),3);
} }
} }
}
buffers[0].reset(new SubdivEntry); buffers[0].reset(new SubdivEntry);
buffers[0]->init(f,Vertices,Indices, sharpEdges); buffers[0]->init(f,Vertices,Indices, sharpEdges);
......
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