removed several functions and moved to the gl wrapper of mixed integer
This commit is contained in:
parent
a95eb5af08
commit
70b2cd1d25
|
@ -47,28 +47,29 @@ class GLField
|
||||||
static void GLDrawFaceField(const FaceType &f,
|
static void GLDrawFaceField(const FaceType &f,
|
||||||
ScalarType &size)
|
ScalarType &size)
|
||||||
{
|
{
|
||||||
CoordType center=(f.P0(0)+f.P0(1)+f.P0(2))/3;
|
CoordType center=(f.cP0(0)+f.cP0(1)+f.cP0(2))/3;
|
||||||
CoordType normal=f.cN();
|
CoordType normal=f.cN();
|
||||||
CoordType dir[4];
|
CoordType dir[4];
|
||||||
vcg::tri::CrossField<MeshType>::CrossVector(f,dir);
|
vcg::tri::CrossField<MeshType>::CrossVector(f,dir);
|
||||||
GLDrawField(dir,center,size);
|
GLDrawField(dir,center,size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GLDrawFaceSeams(const FaceType &f,
|
// static void GLDrawFaceSeams(const FaceType &f,
|
||||||
vcg::Point3<bool> seams)
|
// vcg::Point3<bool> seams,
|
||||||
{
|
// vcg::Color4b seamCol[3])
|
||||||
glLineWidth(3);
|
// {
|
||||||
|
// glLineWidth(2);
|
||||||
|
|
||||||
glBegin(GL_LINES);
|
// glBegin(GL_LINES);
|
||||||
for (int i=0;i<3;i++)
|
// for (int i=0;i<3;i++)
|
||||||
{
|
// {
|
||||||
if (!seams[i])continue;
|
// if (!seams[i])continue;
|
||||||
|
// vcg::glColor(seamCol[i]);
|
||||||
glVertex(f.V0(i)->P());
|
// glVertex(f.V0(i)->P());
|
||||||
glVertex(f.V1(i)->P());
|
// glVertex(f.V1(i)->P());
|
||||||
}
|
// }
|
||||||
glEnd();
|
// glEnd();
|
||||||
}
|
// }
|
||||||
|
|
||||||
static void GLDrawVertField(const MeshType &mesh,
|
static void GLDrawVertField(const MeshType &mesh,
|
||||||
const VertexType &v,
|
const VertexType &v,
|
||||||
|
@ -83,49 +84,49 @@ class GLField
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
///singular vertices should be selected
|
// ///singular vertices should be selected
|
||||||
static void GLDrawSingularities(MeshType &mesh)
|
// static void GLDrawSingularities(MeshType &mesh)
|
||||||
{
|
// {
|
||||||
bool hasSingular = vcg::tri::HasPerVertexAttribute(mesh,std::string("Singular"));
|
// bool hasSingular = vcg::tri::HasPerVertexAttribute(mesh,std::string("Singular"));
|
||||||
bool hasSingularDegree = vcg::tri::HasPerVertexAttribute(mesh,std::string("SingularityDegree"));
|
// bool hasSingularDegree = vcg::tri::HasPerVertexAttribute(mesh,std::string("SingularityDegree"));
|
||||||
|
|
||||||
if (!hasSingular)return;
|
// if (!hasSingular)return;
|
||||||
|
|
||||||
typename MeshType::template PerVertexAttributeHandle<bool> Handle_Singular;
|
// typename MeshType::template PerVertexAttributeHandle<bool> Handle_Singular;
|
||||||
typename MeshType::template PerVertexAttributeHandle<int> Handle_SingularDegree;
|
// typename MeshType::template PerVertexAttributeHandle<int> Handle_SingularDegree;
|
||||||
|
|
||||||
Handle_Singular=vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<bool>(mesh,std::string("Singular"));
|
// Handle_Singular=vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<bool>(mesh,std::string("Singular"));
|
||||||
|
|
||||||
Handle_SingularDegree=vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<int>(mesh,std::string("SingularityDegree"));
|
// Handle_SingularDegree=vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<int>(mesh,std::string("SingularityDegree"));
|
||||||
|
|
||||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
// glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||||
glEnable(GL_COLOR_MATERIAL);
|
// glEnable(GL_COLOR_MATERIAL);
|
||||||
glDisable(GL_LIGHTING);
|
// glDisable(GL_LIGHTING);
|
||||||
glDepthRange(0,0.999);
|
// glDepthRange(0,0.999);
|
||||||
ScalarType size=10;
|
// ScalarType size=10;
|
||||||
glPointSize(size);
|
// glPointSize(size);
|
||||||
glBegin(GL_POINTS);
|
// glBegin(GL_POINTS);
|
||||||
for (unsigned int i=0;i<mesh.vert.size();i++)
|
// for (unsigned int i=0;i<mesh.vert.size();i++)
|
||||||
{
|
// {
|
||||||
if (mesh.vert[i].IsD())continue;
|
// if (mesh.vert[i].IsD())continue;
|
||||||
if (!Handle_Singular[i])continue;
|
// if (!Handle_Singular[i])continue;
|
||||||
int mmatch=3;
|
// int mmatch=3;
|
||||||
if (hasSingularDegree)
|
// if (hasSingularDegree)
|
||||||
mmatch=Handle_SingularDegree[i];
|
// mmatch=Handle_SingularDegree[i];
|
||||||
|
|
||||||
|
|
||||||
if (mmatch==1)vcg::glColor(vcg::Color4b(0,0,255,255));
|
// if (mmatch==1)vcg::glColor(vcg::Color4b(0,0,255,255));
|
||||||
else
|
// else
|
||||||
if (mmatch==2)vcg::glColor(vcg::Color4b(255,0,0,255));
|
// if (mmatch==2)vcg::glColor(vcg::Color4b(255,0,0,255));
|
||||||
else
|
// else
|
||||||
if (mmatch==3)vcg::glColor(vcg::Color4b(0,255,255,255));
|
// if (mmatch==3)vcg::glColor(vcg::Color4b(0,255,255,255));
|
||||||
|
|
||||||
vcg::glVertex(mesh.vert[i].P());
|
// vcg::glVertex(mesh.vert[i].P());
|
||||||
|
|
||||||
}
|
// }
|
||||||
glEnd();
|
// glEnd();
|
||||||
glPopAttrib();
|
// glPopAttrib();
|
||||||
}
|
// }
|
||||||
|
|
||||||
static void GLDrawFaceField(const MeshType &mesh)
|
static void GLDrawFaceField(const MeshType &mesh)
|
||||||
{
|
{
|
||||||
|
@ -157,29 +158,51 @@ public:
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GLDrawSeams(MeshType &mesh)
|
// static void GLDrawSeams(MeshType &mesh)
|
||||||
{
|
// {
|
||||||
bool hasSeam = vcg::tri::HasPerFaceAttribute(mesh,std::string("Seams"));
|
// bool hasSeam = vcg::tri::HasPerFaceAttribute(mesh,std::string("Seams"));
|
||||||
if(!hasSeam)return;
|
// if(!hasSeam)return;
|
||||||
typedef typename MeshType::template PerFaceAttributeHandle<vcg::Point3<bool> > SeamsHandleType;
|
// bool HasSeamIndex=vcg::tri::HasPerFaceAttribute(mesh,std::string("SeamsIndex"));
|
||||||
typedef typename vcg::tri::Allocator<MeshType> SeamsAllocator;
|
|
||||||
|
|
||||||
SeamsHandleType Handle_Seam;
|
// typedef typename MeshType::template PerFaceAttributeHandle<vcg::Point3<bool> > SeamsHandleType;
|
||||||
Handle_Seam=SeamsAllocator::template GetPerFaceAttribute<vcg::Point3<bool> >(mesh,std::string("Seams"));
|
// typedef typename MeshType::template PerFaceAttributeHandle<vcg::Point3i > SeamsIndexHandleType;
|
||||||
|
|
||||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
// typedef typename vcg::tri::Allocator<MeshType> SeamsAllocator;
|
||||||
glEnable(GL_COLOR_MATERIAL);
|
|
||||||
glDisable(GL_LIGHTING);
|
// SeamsHandleType Handle_Seam;
|
||||||
vcg::glColor(vcg::Color4b(255,0,0,255));
|
// Handle_Seam=SeamsAllocator::template GetPerFaceAttribute<vcg::Point3<bool> >(mesh,std::string("Seams"));
|
||||||
glDepthRange(0,0.999);
|
|
||||||
for (unsigned int i=0;i<mesh.face.size();i++)
|
// SeamsIndexHandleType Handle_SeamIndex;
|
||||||
{
|
// if (HasSeamIndex)
|
||||||
if (mesh.face[i].IsD())continue;
|
// Handle_SeamIndex=SeamsAllocator::template GetPerFaceAttribute<vcg::Point3i >(mesh,std::string("SeamsIndex"));
|
||||||
vcg::Point3<bool> seams=Handle_Seam[i];
|
|
||||||
GLDrawFaceSeams(mesh.face[i],seams);
|
// glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||||
}
|
// glEnable(GL_COLOR_MATERIAL);
|
||||||
glPopAttrib();
|
// glDisable(GL_LIGHTING);
|
||||||
}
|
|
||||||
|
// glDepthRange(0,0.999);
|
||||||
|
// for (unsigned int i=0;i<mesh.face.size();i++)
|
||||||
|
// {
|
||||||
|
// if (mesh.face[i].IsD())continue;
|
||||||
|
// vcg::Point3<bool> seams=Handle_Seam[i];
|
||||||
|
// vcg::Color4b seamCol[3];
|
||||||
|
// for (int j=0;j<3;j++)
|
||||||
|
// {
|
||||||
|
// seamCol[j]=vcg::Color4b(0,255,0,255);
|
||||||
|
// if (HasSeamIndex)
|
||||||
|
// {
|
||||||
|
// int index=Handle_SeamIndex[i][j];
|
||||||
|
// //assert(index>0);
|
||||||
|
// if (index>=0)
|
||||||
|
// seamCol[j]=vcg::Color4b::Scatter(100,index);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// GLDrawFaceSeams(mesh.face[i],seams,seamCol);
|
||||||
|
|
||||||
|
// }
|
||||||
|
// glPopAttrib();
|
||||||
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue