vcglib/apps/test/segmentation3d/simpleglwidget.h

149 lines
2.4 KiB
C
Raw Normal View History

2004-12-17 12:17:36 +01:00
#include <GL\glew.h>
#include <qgl.h>
#include <wrap\gl\trimesh.h>
#include <wrap\gui\trackball.h>
#include <segmentator.h>
#include <sim/tri_pde_integrator.h>
#include <vcg/complex/trimesh/update/bounding.h>
#include <vcg/complex/trimesh/update/bounding.h>
#include <wrap/io_trimesh/export_ply.h>
#include <segmentform.h>
2004-12-21 18:38:42 +01:00
#include <qpushbutton.h>
2004-12-17 12:17:36 +01:00
class SimpleGLWidget: public QGLWidget{
Q_OBJECT
private :
int _H;
int _W;
vcg::Trackball Track;
double zoom;
GLdouble projection[16];
GLdouble modelMatrix[16];
GLint viewport[4];
bool _showslides;
int _numslide;
bool wire;
bool blocked;
bool extForces;
bool intForces;
bool resultForces;
bool continue_int;
2004-12-21 18:38:42 +01:00
GLuint texName;
2004-12-17 12:17:36 +01:00
//vcg::GlTrimesh<Segmentator::MyTriMesh> *Wrap;
public:
2004-12-21 18:38:42 +01:00
QString path;
2004-12-17 12:17:36 +01:00
SegmentForm *w;
SimpleGLWidget( QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0 );
virtual void glDraw();
//virtual void paintEvent ( QPaintEvent * ) ;
void resizeGL( int w, int h );
virtual void mousePressEvent ( QMouseEvent * e );
virtual void mouseReleaseEvent(QMouseEvent * e );
virtual void mouseMoveEvent ( QMouseEvent * e );
virtual void wheelEvent ( QWheelEvent * e );
//virtual void keyPressEvent(QKeyEvent *k);
virtual void initializeGL();
virtual void SaveMatrix();
virtual void Save();
void LoadMatrix();
2004-12-21 18:38:42 +01:00
void LoadTexture(QString path,int level);
2004-12-17 12:17:36 +01:00
void drawSlide();
void SmoothMesh();
void Step();
void SetExtractionParameters();
void WriteInfo();
void ClearMesh();
void OpenDirectory();
//virtual void keyPressEvent(QKeyEvent *qk);
public slots:
void Open()
{
OpenDirectory();
}
void ShowSlides()
{
_showslides=!_showslides;
repaint();
}
void SetWire()
{
wire=!wire;
repaint();
}
void SetShowBlocked()
{
blocked=!blocked;
repaint();
}
void ShowExternalForces()
{
extForces=!extForces;
repaint();
}
void ShowInternalForces()
{
intForces=!intForces;
repaint();
}
void ShowResultForces()
{
resultForces=!resultForces;
repaint();
}
void Smooth()
{
SmoothMesh();
repaint();
}
void SavePly()
{
Save();
}
void Apply()
{
SetExtractionParameters();
}
void Extract()
{
continue_int=!continue_int;
2004-12-21 18:38:42 +01:00
if (continue_int)
{
_showslides=false;
w->SlidesButton->setOn(false);
}
else
{
_showslides=true;
w->SlidesButton->setOn(true);
}
2004-12-17 12:17:36 +01:00
}
void Update()
{
Step();
}
void Clear()
{
ClearMesh();
}
};