Add debug code for implicit normals
This commit is contained in:
parent
385a03ddbc
commit
d282b93298
1 changed files with 19 additions and 1 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <cassert>
|
||||
|
||||
#include "GL/gl.h"
|
||||
|
||||
MarchingCubes::MarchingCubes(
|
||||
const ImplicitSurface& surface,
|
||||
const Cuboid& box,
|
||||
|
@ -86,8 +88,24 @@ bool MarchingCubes::march_at(double x, double y, double z, Mesh& output) {
|
|||
};
|
||||
|
||||
size_t vert_ids[3];
|
||||
for(int i=0; i < 3; ++i)
|
||||
for(int i=0; i < 3; ++i) {
|
||||
#ifdef DEBUG_DISPLAY_NORMAL
|
||||
Point locVert = verts[i] + surface.getCenter();
|
||||
Point normal = surface.normal_at(verts[i]);
|
||||
Point outwards = locVert + normal;
|
||||
Point inwards = locVert + ((-0.2) * normal);
|
||||
glBegin(GL_LINES);
|
||||
glColor3f(1., 0., 0.);
|
||||
glVertex3f(locVert[0], locVert[1], locVert[2]);
|
||||
glVertex3f(outwards[0], outwards[1], outwards[2]);
|
||||
glColor3f(0., 0., 1.);
|
||||
glVertex3f(locVert[0], locVert[1], locVert[2]);
|
||||
glVertex3f(inwards[0], inwards[1], inwards[2]);
|
||||
glEnd();
|
||||
#endif // DEBUG_DISPLAY_NORMAL
|
||||
|
||||
vert_ids[i] = output.add_vertice(verts[i]);
|
||||
}
|
||||
|
||||
for(int i=0; i < 3; ++i) {
|
||||
output.add_face(
|
||||
|
|
Loading…
Reference in a new issue