minor changes
This commit is contained in:
parent
7f0b7037ac
commit
fe1ec241f0
|
@ -99,6 +99,8 @@ public:
|
||||||
glColor4d(0.8,0.8,0.8,0.9);
|
glColor4d(0.8,0.8,0.8,0.9);
|
||||||
for (Fi=m->face.begin();Fi<m->face.end();Fi++)
|
for (Fi=m->face.begin();Fi<m->face.end();Fi++)
|
||||||
{
|
{
|
||||||
|
if (!Fi->IsD())
|
||||||
|
{
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA);
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
|
@ -119,6 +121,7 @@ public:
|
||||||
glVertex(Fi->V(1)->P());
|
glVertex(Fi->V(1)->P());
|
||||||
glVertex(Fi->V(2)->P());
|
glVertex(Fi->V(2)->P());
|
||||||
glEnd();
|
glEnd();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,19 +30,26 @@
|
||||||
|
|
||||||
#include<vcg\simplex\face\pos.h>
|
#include<vcg\simplex\face\pos.h>
|
||||||
#include<vcg\simplex\face\topology.h>
|
#include<vcg\simplex\face\topology.h>
|
||||||
|
#include<vcg\complex\trimesh\update\topology.h>
|
||||||
#include<vcg\complex\trimesh\allocate.h>
|
#include<vcg\complex\trimesh\allocate.h>
|
||||||
|
|
||||||
/// This Class is used for insertiong a vertex in a face
|
/// This Class is used for insertiong a vertex in a face
|
||||||
namespace vcg{
|
namespace vcg{
|
||||||
namespace tri{
|
namespace tri{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class MESH_TYPE>
|
template <class MESH_TYPE>
|
||||||
///insert a vertex iside a face and re-triangolarize v will be pointer to inserted vertex
|
///insert a vertex iside a face and re-triangolarize v will be pointer to inserted vertex
|
||||||
void InsertVert(MESH_TYPE &m,typename MESH_TYPE::FaceType *f,typename MESH_TYPE::VertexType* &v)
|
void InsertVert(MESH_TYPE &m,typename MESH_TYPE::FaceType* &f,typename MESH_TYPE::VertexType* &v)
|
||||||
{
|
{
|
||||||
MESH_TYPE::FaceIterator Finit=vcg::tri::Allocator<MESH_TYPE>::AddFaces(m,3);
|
std::vector<MESH_TYPE::FaceType **> local_var;
|
||||||
|
local_var.push_back(&f);
|
||||||
|
MESH_TYPE::FaceIterator Finit=vcg::tri::Allocator<MESH_TYPE>::AddFaces(m,3,local_var);
|
||||||
MESH_TYPE::VertexIterator Vi=vcg::tri::Allocator<MESH_TYPE>::AddVertices(m,1);
|
MESH_TYPE::VertexIterator Vi=vcg::tri::Allocator<MESH_TYPE>::AddVertices(m,1);
|
||||||
|
|
||||||
|
if (MESH_TYPE::HasVFTopology())
|
||||||
|
Vi->VFp()=0;
|
||||||
|
|
||||||
MESH_TYPE::FaceIterator Fi=Finit;
|
MESH_TYPE::FaceIterator Fi=Finit;
|
||||||
MESH_TYPE::FaceType *F;
|
MESH_TYPE::FaceType *F;
|
||||||
//set vertex pointer of new face
|
//set vertex pointer of new face
|
||||||
|
@ -56,7 +63,9 @@ namespace vcg{
|
||||||
|
|
||||||
//assign topology in substitution of the old one
|
//assign topology in substitution of the old one
|
||||||
if (MESH_TYPE::HasFFTopology())
|
if (MESH_TYPE::HasFFTopology())
|
||||||
vcg::face::Attach<MESH_TYPE::FaceType>(F,0,f->FFp(i),f->FFi(i));
|
{
|
||||||
|
vcg::face::FFAttach<MESH_TYPE::FaceType>(F,0,f->FFp(i),f->FFi(i));
|
||||||
|
}
|
||||||
if (MESH_TYPE::HasVFTopology())
|
if (MESH_TYPE::HasVFTopology())
|
||||||
{
|
{
|
||||||
vcg::face::VFDetach(f,i);
|
vcg::face::VFDetach(f,i);
|
||||||
|
@ -76,20 +85,24 @@ namespace vcg{
|
||||||
MESH_TYPE::FaceType *F0=&(*Fi);
|
MESH_TYPE::FaceType *F0=&(*Fi);
|
||||||
MESH_TYPE::FaceType *F1=&(*Fsucc);
|
MESH_TYPE::FaceType *F1=&(*Fsucc);
|
||||||
|
|
||||||
/*vcg::face::Attach<MESH_TYPE::FaceType>(F0,1,F1,2);*/
|
vcg::face::FFAttach<MESH_TYPE::FaceType>(F0,1,F1,2);
|
||||||
|
|
||||||
Fi++;
|
Fi++;
|
||||||
Fsucc++;
|
Fsucc++;
|
||||||
F0=&(*Fi);
|
F0=&(*Fi);
|
||||||
F1=&(*Fsucc);
|
F1=&(*Fsucc);
|
||||||
/*vcg::face::Attach<MESH_TYPE::FaceType>(F0,1,F1,2);*/
|
|
||||||
|
vcg::face::FFAttach<MESH_TYPE::FaceType>(F0,1,F1,2);
|
||||||
Fsucc=Finit;
|
Fsucc=Finit;
|
||||||
Fi++;
|
Fi++;
|
||||||
F0=&(*Fi);
|
F0=&(*Fi);
|
||||||
F1=&(*Fsucc);
|
F1=&(*Fsucc);
|
||||||
/*vcg::face::Attach<MESH_TYPE::FaceType>(F0,1,F1,2);*/
|
|
||||||
|
vcg::face::FFAttach<MESH_TYPE::FaceType>(F0,1,F1,2);
|
||||||
//at the end set as deleted the old face that was substituted
|
//at the end set as deleted the old face that was substituted
|
||||||
f->SetD();
|
f->SetD();
|
||||||
v=&(*Vi);
|
v=&(*Vi);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
#include <vcg\physics\methods\lem\interface_lem_vertex.h>
|
#include <vcg\physics\methods\lem\interface_lem_vertex.h>
|
||||||
//#include <vcg\physics\methods\lem\interface_lem_face.h>
|
//#include <vcg\physics\methods\lem\interface_lem_face.h>
|
||||||
#include <vcg\physics\methods\lem\interface_lem_remesher.h>
|
#include <vcg\physics\methods\lem\interface_lem_remesher.h>
|
||||||
//#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
//#include <qgl.h>
|
#include <qgl.h>
|
||||||
|
|
||||||
//#include <bardrawer.h>
|
#include <bardrawer.h>
|
||||||
|
|
||||||
#include <simplex\vertex\with\afvn.h>
|
#include <simplex\vertex\with\afvn.h>
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#include "form1.h"
|
#include "form1.h"
|
||||||
|
|
||||||
|
|
||||||
class MyFace;
|
class MyFace;
|
||||||
|
@ -50,94 +50,94 @@ vcg::tri::UpdateTopology<MyTriMesh> UT;
|
||||||
MyTriMesh *tm;
|
MyTriMesh *tm;
|
||||||
vcg::tri::UpdateBounding<MyTriMesh> UB;
|
vcg::tri::UpdateBounding<MyTriMesh> UB;
|
||||||
|
|
||||||
//vcg::GLWrapBar<LemType::LemModel::vectBar> *WB;
|
vcg::GLWrapBar<LemType::LemModel::vectBar> *WB;
|
||||||
//vcg::GlTrimesh<MyTriMesh> *glT;
|
//vcg::GlTrimesh<MyTriMesh> *glT;
|
||||||
|
|
||||||
//struct MyGl: public QGLWidget{
|
struct MyGl: public QGLWidget{
|
||||||
// MyGl( QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0 )
|
MyGl( QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0 )
|
||||||
// :QGLWidget(parent,name){}
|
:QGLWidget(parent,name){}
|
||||||
// //void QGLWidget::paintEvent ( QPaintEvent * ) [virtual protected]
|
//void QGLWidget::paintEvent ( QPaintEvent * ) [virtual protected]
|
||||||
// double lr,ud,tz;
|
double lr,ud,tz;
|
||||||
// int cx,cy,z;
|
int cx,cy,z;
|
||||||
//
|
|
||||||
// virtual void glDraw(){
|
virtual void glDraw(){
|
||||||
//
|
|
||||||
// glClearColor(0.2,0.2,0.2,1);
|
glClearColor(0.2,0.2,0.2,1);
|
||||||
// glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||||
// glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
// glLoadIdentity();
|
glLoadIdentity();
|
||||||
// gluPerspective(45,1,0.01,20);
|
gluPerspective(45,1,0.01,20);
|
||||||
// glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
// glLoadIdentity();
|
glLoadIdentity();
|
||||||
// gluLookAt(0,0,1,0,0,0,0,10,0);
|
gluLookAt(0,0,1,0,0,0,0,10,0);
|
||||||
//
|
|
||||||
//
|
|
||||||
// glTranslatef(0,0,tz);
|
glTranslatef(0,0,tz);
|
||||||
// glRotatef(lr,0,1,0);
|
glRotatef(lr,0,1,0);
|
||||||
// glRotatef(ud,1,0,0);
|
glRotatef(ud,1,0,0);
|
||||||
//
|
|
||||||
// glScalef(1/tm->bbox.Diag(),1/tm->bbox.Diag(),1/tm->bbox.Diag());
|
glScalef(1/tm->bbox.Diag(),1/tm->bbox.Diag(),1/tm->bbox.Diag());
|
||||||
// vcg::Point3d p=tm->bbox.Center();
|
vcg::Point3d p=tm->bbox.Center();
|
||||||
// glTranslate(-p);
|
glTranslate(-p);
|
||||||
//
|
|
||||||
// WB->Draw();
|
//WB->Draw();
|
||||||
// WB->DrawMesh<MyTriMesh>(tm);
|
WB->DrawMesh<MyTriMesh>(tm);
|
||||||
//
|
|
||||||
// /*glT->Draw<vcg::GLW:: DMFlatWire,vcg::GLW:: CMNone,vcg::GLW:: TMNone> ();*/
|
/*glT->Draw<vcg::GLW:: DMFlatWire,vcg::GLW:: CMNone,vcg::GLW:: TMNone> ();*/
|
||||||
// QGLWidget::glDraw();
|
QGLWidget::glDraw();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// void resizeGL( int w, int h )
|
void resizeGL( int w, int h )
|
||||||
// {
|
{
|
||||||
// //// setup viewport, projection etc.:
|
//// setup viewport, projection etc.:
|
||||||
// glViewport( 0, 0, (GLint)w, (GLint)h );
|
glViewport( 0, 0, (GLint)w, (GLint)h );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// virtual void mousePressEvent ( QMouseEvent * e ){
|
virtual void mousePressEvent ( QMouseEvent * e ){
|
||||||
// cx = e->x();
|
cx = e->x();
|
||||||
// cy = e->y();
|
cy = e->y();
|
||||||
//
|
|
||||||
// //tr.MouseDown(e->x(),e->y(),(Trackball::Button)(int)(e->button()));
|
//tr.MouseDown(e->x(),e->y(),(Trackball::Button)(int)(e->button()));
|
||||||
// //QWidget::mousePressEvent(e);
|
//QWidget::mousePressEvent(e);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// virtual void mouseMoveEvent ( QMouseEvent * e ){
|
virtual void mouseMoveEvent ( QMouseEvent * e ){
|
||||||
// //tr.MouseMove(e->x(),e->y());
|
//tr.MouseMove(e->x(),e->y());
|
||||||
// //QWidget::mouseMoveEvent(e);
|
//QWidget::mouseMoveEvent(e);
|
||||||
// lr+=e->x()-cx;
|
lr+=e->x()-cx;
|
||||||
// ud-=e->y()-cy;
|
ud-=e->y()-cy;
|
||||||
// cx = e->x();
|
cx = e->x();
|
||||||
// cy = e->y();
|
cy = e->y();
|
||||||
// repaint();
|
repaint();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// virtual void wheelEvent ( QWheelEvent * e ){
|
virtual void wheelEvent ( QWheelEvent * e ){
|
||||||
// tz +=e->delta()/360.f;
|
tz +=e->delta()/360.f;
|
||||||
// repaint();
|
repaint();
|
||||||
// QWidget::wheelEvent(e);
|
QWidget::wheelEvent(e);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// virtual void initializeGL(){
|
virtual void initializeGL(){
|
||||||
//
|
|
||||||
//
|
|
||||||
// GLfloat f[4]={0.2,0.2,0.2,1.f};
|
GLfloat f[4]={0.2,0.2,0.2,1.f};
|
||||||
// GLfloat p[4]={3,3,5,0};
|
GLfloat p[4]={3,3,5,0};
|
||||||
// glLightfv(GL_LIGHT0, GL_AMBIENT,f);
|
glLightfv(GL_LIGHT0, GL_AMBIENT,f);
|
||||||
// glLightfv(GL_LIGHT1, GL_POSITION,p);
|
glLightfv(GL_LIGHT1, GL_POSITION,p);
|
||||||
// glLightfv(GL_LIGHT1, GL_DIFFUSE,f);
|
glLightfv(GL_LIGHT1, GL_DIFFUSE,f);
|
||||||
// glLightfv(GL_LIGHT1, GL_SPECULAR,f);
|
glLightfv(GL_LIGHT1, GL_SPECULAR,f);
|
||||||
//
|
|
||||||
// glEnable(GL_LIGHT0);
|
glEnable(GL_LIGHT0);
|
||||||
// glEnable(GL_LIGHT1);
|
glEnable(GL_LIGHT1);
|
||||||
// glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
// glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
// glDepthFunc(GL_LESS);
|
glDepthFunc(GL_LESS);
|
||||||
// glPolygonMode(GL_FRONT,GL_FILL);
|
glPolygonMode(GL_FRONT,GL_FILL);
|
||||||
// glEnable(GL_BACK);
|
glEnable(GL_BACK);
|
||||||
// glCullFace(GL_BACK);
|
glCullFace(GL_BACK);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
//};
|
};
|
||||||
|
|
||||||
|
|
||||||
int main( int argc, char ** argv )
|
int main( int argc, char ** argv )
|
||||||
|
@ -161,26 +161,26 @@ int main( int argc, char ** argv )
|
||||||
UB.Box(*tm);
|
UB.Box(*tm);
|
||||||
|
|
||||||
LR._SetDir(0);
|
LR._SetDir(0);
|
||||||
LR._SetDir(1);
|
/*LR._SetDir(1);
|
||||||
LR._SetDir(2);
|
LR._SetDir(2);
|
||||||
LR._SetDir(3);
|
LR._SetDir(3);
|
||||||
LR._SetDir(4);
|
LR._SetDir(4);
|
||||||
LR._SetDir(5);
|
LR._SetDir(5);*/
|
||||||
LR.Remesh((*tm),0.5,0.2);
|
LR.Remesh((*tm),0.5,0.05);
|
||||||
LS.Init(tm,0.5);
|
//LS.Init(tm,0.5);
|
||||||
|
|
||||||
/*WB=new vcg::GLWrapBar<std::vector<LemType::BarType> >(LS.LEM.Bars);*/
|
/*WB=new vcg::GLWrapBar<std::vector<LemType::BarType> >(LS.LEM.Bars);*/
|
||||||
|
|
||||||
LS.SetTouchedBar(&LS.LEM.Bars[9],1);
|
/*LS.SetTouchedBar(&LS.LEM.Bars[9],1);
|
||||||
LS.ComputeStep(tm);
|
LS.ComputeStep(tm);*/
|
||||||
|
|
||||||
/* glT=new vcg::GlTrimesh<MyTriMesh>();
|
/* glT=new vcg::GlTrimesh<MyTriMesh>();
|
||||||
glT->m=tm;*/
|
glT->m=tm;*/
|
||||||
/*QApplication a( argc, argv );*/
|
QApplication a( argc, argv );
|
||||||
/* Form1 w;*/
|
Form1 w;
|
||||||
/*MyGl *gl = new MyGl(&w);
|
MyGl *gl = new MyGl(&w);
|
||||||
gl->setMinimumSize(800,800);
|
gl->setMinimumSize(800,800);
|
||||||
w.show();
|
w.show();
|
||||||
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
|
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
|
||||||
return a.exec();*/
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue