Add debugging display (on compilation switches)
DEBUG_DISPLAY_WIREFRAME: show a wireframe structure DEBUG_DISPLAY_NORMAL: show the vertices' normal vectors
This commit is contained in:
parent
aaaebdc042
commit
b404c2301f
|
@ -126,8 +126,31 @@ void GlutRender::display_mesh(Mesh& mesh) const {
|
||||||
glEnd();
|
glEnd();
|
||||||
#endif // DEBUG_DISPLAY_NORMAL
|
#endif // DEBUG_DISPLAY_NORMAL
|
||||||
|
|
||||||
|
#ifdef DEBUG_DISPLAY_WIREFRAME
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
for(const Face& face: mesh.get_faces()) {
|
||||||
|
Point n0 = mesh.get_normal(face[0]),
|
||||||
|
n1 = mesh.get_normal(face[1]),
|
||||||
|
n2 = mesh.get_normal(face[2]);
|
||||||
|
Point p0 = face.pt(0, points) + mesh_center + 0.01 * n0,
|
||||||
|
p1 = face.pt(1, points) + mesh_center + 0.01 * n1,
|
||||||
|
p2 = face.pt(2, points) + mesh_center + 0.01 * n2;
|
||||||
|
glColor3f(0., 1., 0.);
|
||||||
|
glVertex3f(p0[0], p0[1], p0[2]);
|
||||||
|
glVertex3f(p1[0], p1[1], p1[2]);
|
||||||
|
|
||||||
|
glVertex3f(p1[0], p1[1], p1[2]);
|
||||||
|
glVertex3f(p2[0], p2[1], p2[2]);
|
||||||
|
|
||||||
|
glVertex3f(p2[0], p2[1], p2[2]);
|
||||||
|
glVertex3f(p0[0], p0[1], p0[2]);
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
#endif // DEBUG_DISPLAY_WIREFRAME
|
||||||
|
|
||||||
|
|
||||||
glBegin(GL_TRIANGLES);
|
glBegin(GL_TRIANGLES);
|
||||||
|
glColor3f(1., 1., 1.);
|
||||||
for(const Face& face: mesh.get_faces()) {
|
for(const Face& face: mesh.get_faces()) {
|
||||||
Point p0 = face.pt(0, points) + mesh_center,
|
Point p0 = face.pt(0, points) + mesh_center,
|
||||||
p1 = face.pt(1, points) + mesh_center,
|
p1 = face.pt(1, points) + mesh_center,
|
||||||
|
|
Loading…
Reference in a new issue