Commit 1139c553 by Philipp Adolf

temp

parent f0257839
...@@ -536,6 +536,14 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision, ...@@ -536,6 +536,14 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
f->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, entry->IB_irregular_handle); f->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, entry->IB_irregular_handle);
f->glPatchParameteri(GL_PATCH_VERTICES, 3); f->glPatchParameteri(GL_PATCH_VERTICES, 3);
f->glDrawElements(GL_PATCHES, entry->indices_irregular.size(), GL_UNSIGNED_INT, 0); f->glDrawElements(GL_PATCHES, entry->indices_irregular.size(), GL_UNSIGNED_INT, 0);
shader->setUniformValue("materialInfo.Diffuse", QVector3D(255.0, 0.0, 0.0)/255.0);
f->glBindBuffer(GL_ARRAY_BUFFER, entry->VB_handle);
f->glVertexAttribPointer(positionIndex, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
f->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, entry->IB_irregular_handle);
f->glPatchParameteri(GL_PATCH_VERTICES, 3);
//f->glDrawElements(GL_PATCHES, entry->indices_irregular.size(), GL_UNSIGNED_INT, 0);
} }
if (!entry->indices_extra.isEmpty() && false) { if (!entry->indices_extra.isEmpty() && false) {
......
...@@ -1284,19 +1284,36 @@ void Subdivision::updateIrregularForDraw(const QVector<Triangle> &triangles,QMap ...@@ -1284,19 +1284,36 @@ void Subdivision::updateIrregularForDraw(const QVector<Triangle> &triangles,QMap
result.vertex_buffer_irregular[triangle.v_idx()] = result.vertex_buffer.at(triangle.v_idx()); result.vertex_buffer_irregular[triangle.v_idx()] = result.vertex_buffer.at(triangle.v_idx());
result.vertex_buffer_irregular[triangle.w_idx()] = result.vertex_buffer.at(triangle.w_idx()); result.vertex_buffer_irregular[triangle.w_idx()] = result.vertex_buffer.at(triangle.w_idx());
bool uv_sharp = (triangle.get_sharpness_uv() > 0);
bool vw_sharp = (triangle.get_sharpness_vw() > 0);
bool wu_sharp = (triangle.get_sharpness_wu() > 0);
Triangle::Neighbors ns = neighbors.value(triangle); Triangle::Neighbors ns = neighbors.value(triangle);
if (!(uv_sharp || wu_sharp)) { bool u_sharp = triangle.get_sharpness_uv() > 0;
bool v_sharp = triangle.get_sharpness_vw() > 0;
bool w_sharp = triangle.get_sharpness_wu() > 0;
Triangle::Neighbor n;
n = ns.uv;
while (*n.triangle != triangle) {
u_sharp = u_sharp || n.triangle->get_sharpness(rotate_edge_name(n.edge.name)) > 0;
n = neighbors[*n.triangle].get_neighbor(rotate_edge_name(n.edge.name));
}
n = ns.vw;
while (*n.triangle != triangle) {
v_sharp = v_sharp || n.triangle->get_sharpness(rotate_edge_name(n.edge.name)) > 0;
n = neighbors[*n.triangle].get_neighbor(rotate_edge_name(n.edge.name));
}
n = ns.wu;
while (*n.triangle != triangle) {
w_sharp = w_sharp || n.triangle->get_sharpness(rotate_edge_name(n.edge.name)) > 0;
n = neighbors[*n.triangle].get_neighbor(rotate_edge_name(n.edge.name));
}
if (!u_sharp) {
result.vertex_buffer_irregular[triangle.u_idx()].pos = updateIrregularVertexForDraw(triangle.u(), vertexNeighbors(triangle, ns.uv, neighbors)); result.vertex_buffer_irregular[triangle.u_idx()].pos = updateIrregularVertexForDraw(triangle.u(), vertexNeighbors(triangle, ns.uv, neighbors));
} }
if (!(uv_sharp || vw_sharp)) { if (!v_sharp) {
result.vertex_buffer_irregular[triangle.v_idx()].pos = updateIrregularVertexForDraw(triangle.v(), vertexNeighbors(triangle, ns.vw, neighbors)); result.vertex_buffer_irregular[triangle.v_idx()].pos = updateIrregularVertexForDraw(triangle.v(), vertexNeighbors(triangle, ns.vw, neighbors));
} }
if (!(vw_sharp || wu_sharp)) { if (!w_sharp) {
result.vertex_buffer_irregular[triangle.w_idx()].pos = updateIrregularVertexForDraw(triangle.w(), vertexNeighbors(triangle, ns.wu, neighbors)); result.vertex_buffer_irregular[triangle.w_idx()].pos = updateIrregularVertexForDraw(triangle.w(), vertexNeighbors(triangle, ns.wu, neighbors));
} }
} }
...@@ -1341,7 +1358,6 @@ bool removeVertex(QVector<Vertex> &vertices, const Vertex &vertex) { ...@@ -1341,7 +1358,6 @@ bool removeVertex(QVector<Vertex> &vertices, const Vertex &vertex) {
QVector3D Subdivision::updateIrregularVertexForDraw(Vertex currentCorner, QVector<Triangle> neighboring_triangles) { QVector3D Subdivision::updateIrregularVertexForDraw(Vertex currentCorner, QVector<Triangle> neighboring_triangles) {
QVector<Vertex> surroundingVertex; QVector<Vertex> surroundingVertex;
return currentCorner.pos;
surroundingVertex = getAllVertices(neighboring_triangles); surroundingVertex = getAllVertices(neighboring_triangles);
bool removed = removeVertex(surroundingVertex, currentCorner); bool removed = removeVertex(surroundingVertex, currentCorner);
......
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