added GLDrawSeams function

This commit is contained in:
Nico Pietroni 2012-09-03 15:58:38 +00:00
parent be2d3613b9
commit a4ee21d5d7
1 changed files with 53 additions and 15 deletions

View File

@ -4,25 +4,34 @@ class GLField
{
typedef typename MeshType::FaceType FaceType;
typedef typename MeshType::VertexType VertexType;
typedef typename MeshType::CoordType CoordType;
typedef typename MeshType::ScalarType ScalarType;
static void GLDrawField(CoordType dir[4],
CoordType center,
ScalarType &size)
{
glLineWidth(1);
vcg::Color4b c;
vcg::glColor(vcg::Color4b(0,0,0,255));
glLineWidth(3);
vcg::glColor(vcg::Color4b(0,0,255,255));
glBegin(GL_LINES);
glVertex(center);
glVertex(center+dir[0]*size);
glEnd();
glLineWidth(1);
vcg::glColor(vcg::Color4b(0,0,0,255));
glBegin(GL_LINES);
for (int i=0;i<4;i++)
{
glVertex(center);
glVertex(center+dir[i]*size);
for (int i=1;i<4;i++)
{
glVertex(center);
glVertex(center+dir[i]*size);
}
glEnd();
}
///draw the cross field of a given face
static void GLDrawFaceField(const MeshType &mesh,
const FaceType &f,
@ -35,6 +44,21 @@ class GLField
GLDrawField(dir,center,size);
}
static void GLDrawFaceSeams(const FaceType &f)
{
glLineWidth(3);
glBegin(GL_LINES);
for (int i=0;i<3;i++)
{
if (!f.IsSeam(i))continue;
glVertex(f.V0(i)->P());
glVertex(f.V1(i)->P());
}
glEnd();
}
static void GLDrawVertField(const MeshType &mesh,
const VertexType &v,
ScalarType &size)
@ -55,7 +79,7 @@ public:
glEnable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
glDepthRange(0,0.999);
MyScalarType size=10;
ScalarType size=10;
glPointSize(size);
glBegin(GL_POINTS);
for (int i=0;i<mesh.vert.size();i++)
@ -86,9 +110,8 @@ public:
glPushAttrib(GL_ALL_ATTRIB_BITS);
glEnable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
MyScalarType size=mesh.bbox.Diag()/100.0;
vcg::Color4b c=vcg::Color4b(255,0,0,255);
for (int i=0;i<mesh.face.size();i++)
ScalarType size=mesh.bbox.Diag()/400.0;
for (int i=0;i<mesh.face.size();i++)
{
if (mesh.face[i].IsD())continue;
//if (!mesh.face[i].leading)continue;
@ -102,9 +125,8 @@ public:
glPushAttrib(GL_ALL_ATTRIB_BITS);
glEnable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
MyScalarType size=mesh.bbox.Diag()/100.0;
vcg::Color4b c=vcg::Color4b(255,0,0,255);
for (int i=0;i<mesh.vert.size();i++)
ScalarType size=mesh.bbox.Diag()/100.0;
for (int i=0;i<mesh.vert.size();i++)
{
if (mesh.vert[i].IsD())continue;
//if (!mesh.face[i].leading)continue;
@ -112,5 +134,21 @@ public:
}
glPopAttrib();
}
static void GLDrawSeams(const MeshType &mesh)
{
glPushAttrib(GL_ALL_ATTRIB_BITS);
glEnable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
vcg::glColor(vcg::Color4b(255,0,0,255));
glDepthRange(0,0.999);
for (int i=0;i<mesh.face.size();i++)
{
if (mesh.face[i].IsD())continue;
GLDrawFaceSeams(mesh.face[i]);
}
glPopAttrib();
}
};
}
}