netgen/libsrc/visualization/mvdraw.hpp

246 lines
5.3 KiB
C++
Raw Normal View History

2009-01-13 04:40:13 +05:00
#ifndef FILE_MVDRAW
#define FILE_MVDRAW
2009-07-20 14:36:36 +06:00
namespace netgen
{
2009-01-13 04:40:13 +05:00
2009-09-07 21:15:22 +06:00
2009-07-20 14:36:36 +06:00
class VisualScene
{
protected:
static DLL_HEADER Point3d center;
static DLL_HEADER double rad;
2009-01-13 04:40:13 +05:00
static double lookatmat[16];
static double transmat[16];
static double rotmat[16];
static double centermat[16];
2012-10-29 23:52:31 +06:00
static DLL_HEADER double transformationmat[16];
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
GLdouble clipplane[4];
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
int changeval;
static DLL_HEADER GLdouble backcolor;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
static int selface;
static int selelement;
static int selpoint;
static int selpoint2;
static int locpi;
static int seledge;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
static int selecttimestamp;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
public:
2014-10-06 15:57:44 +06:00
static int viewport[4];
2009-07-20 14:36:36 +06:00
static GLuint coltexname;
static int ntexcols;
int invcolor;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
public:
DLL_HEADER VisualScene ();
DLL_HEADER virtual ~VisualScene();
2009-01-13 04:40:13 +05:00
DLL_HEADER virtual void BuildScene (int zoomall = 0);
DLL_HEADER virtual void DrawScene ();
2009-01-13 04:40:13 +05:00
DLL_HEADER void CalcTransformationMatrices();
DLL_HEADER void StandardRotation (const char * dir);
DLL_HEADER void ArbitraryRotation (const Array<double> & alpha, const Array<Vec3d> & vec);
DLL_HEADER void ArbitraryRotation (const double alpha, const Vec3d & vec);
2009-01-13 04:40:13 +05:00
DLL_HEADER void MouseMove(int oldx, int oldy,
2009-07-20 14:36:36 +06:00
int newx, int newy,
char mode);
2009-01-13 04:40:13 +05:00
DLL_HEADER void LookAt (const Point<3> & cam, const Point<3> & obj,
2009-07-20 14:36:36 +06:00
const Point<3> & camup);
2009-01-13 04:40:13 +05:00
DLL_HEADER void SetClippingPlane ();
2009-01-13 04:40:13 +05:00
DLL_HEADER virtual void MouseDblClick (int px, int py);
2009-01-13 04:40:13 +05:00
DLL_HEADER void SetLight ();
2009-07-20 14:36:36 +06:00
static void SetBackGroundColor (double col)
2009-01-13 04:40:13 +05:00
{ backcolor = col; }
DLL_HEADER void CreateTexture (int ncols, int linear, double alpha, int typ);
DLL_HEADER void DrawColorBar (double minval, double maxval, int logscale = 0, bool linear = 1);
DLL_HEADER void DrawCoordinateCross ();
DLL_HEADER void DrawNetgenLogo ();
DLL_HEADER void SetOpenGlColor(double val, double valmin, double valmax, int logscale = 0);
2012-10-29 23:52:31 +06:00
2009-01-13 04:40:13 +05:00
#ifdef PARALLELGL
DLL_HEADER void InitParallelGL ();
DLL_HEADER void Broadcast ();
2009-01-13 04:40:13 +05:00
#endif
2009-07-20 14:36:36 +06:00
};
2009-01-13 04:40:13 +05:00
2012-10-29 23:52:31 +06:00
DLL_HEADER extern void MyOpenGLText (const char * text);
2009-09-07 21:15:22 +06:00
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
class VisualSceneSurfaceMeshing : public VisualScene
{
public:
VisualSceneSurfaceMeshing ();
virtual ~VisualSceneSurfaceMeshing ();
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
virtual void BuildScene (int zoomall = 0);
virtual void DrawScene ();
};
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
class VisualSceneMesh : public VisualScene
{
int filledlist;
int linelist;
int edgelist;
int pointnumberlist;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
int tetlist;
int prismlist;
int pyramidlist;
int hexlist;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
int badellist;
int identifiedlist;
int domainsurflist;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
int vstimestamp;//, selecttimestamp;
int filledtimestamp;
int linetimestamp;
int edgetimestamp;
int pointnumbertimestamp;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
int tettimestamp;
int prismtimestamp;
int pyramidtimestamp;
int hextimestamp;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
int badeltimestamp;
int identifiedtimestamp;
int domainsurftimestamp;
2009-01-13 04:40:13 +05:00
#ifdef PARALLELGL
2009-07-20 14:36:36 +06:00
Array<int> par_linelists;
Array<int> par_filledlists;
2009-01-13 04:40:13 +05:00
#endif
2012-08-30 19:40:17 +06:00
MouseEventHandler * user_me_handler;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
NgLock *lock;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
// int selface, selelement;
// int selpoint, selpoint2, locpi;
// int seledge;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
double minh, maxh; // for meshsize coloring
2009-01-13 04:40:13 +05:00
2014-10-06 15:57:44 +06:00
weak_ptr<Mesh> wp_mesh;
2009-07-20 14:36:36 +06:00
public:
VisualSceneMesh ();
virtual ~VisualSceneMesh ();
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
virtual void BuildScene (int zoomall = 0);
virtual void DrawScene ();
virtual void MouseDblClick (int px, int py);
2009-01-13 04:40:13 +05:00
2014-10-06 15:57:44 +06:00
void SetMesh (shared_ptr<Mesh> mesh) { wp_mesh = mesh; }
shared_ptr<Mesh> GetMesh () { return shared_ptr<Mesh>(wp_mesh); }
2012-08-30 19:40:17 +06:00
void SetMouseEventHandler (MouseEventHandler * handler)
{ user_me_handler = handler; }
2009-07-20 14:36:36 +06:00
int SelectedFace () const
2009-01-13 04:40:13 +05:00
{ return selface; }
2009-07-20 14:36:36 +06:00
void SetSelectedFace (int asf);
// { selface = asf; selecttimestamp = GetTimeStamp(); }
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
int SelectedEdge () const
2009-01-13 04:40:13 +05:00
{ return seledge; }
2009-07-20 14:36:36 +06:00
int SelectedElement () const
2009-01-13 04:40:13 +05:00
{ return selelement; }
2009-07-20 14:36:36 +06:00
int SelectedPoint () const
2009-01-13 04:40:13 +05:00
{ return selpoint; }
2011-01-15 01:50:12 +05:00
void BuildFilledList (bool names);
2009-07-20 14:36:36 +06:00
// private:
void BuildLineList();
void BuildEdgeList();
void BuildPointNumberList();
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
void BuildTetList();
void BuildPrismList();
void BuildPyramidList();
void BuildHexList();
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
void BuildBadelList();
void BuildIdentifiedList();
void BuildDomainSurfList();
};
2009-01-13 04:40:13 +05:00
2014-10-06 15:57:44 +06:00
extern VisualSceneMesh vsmesh;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
class VisualSceneSpecPoints : public VisualScene
{
public:
VisualSceneSpecPoints ();
virtual ~VisualSceneSpecPoints ();
virtual void BuildScene (int zoomall = 0);
virtual void DrawScene ();
double len;
};
2011-01-11 01:18:01 +05:00
2009-07-20 14:36:36 +06:00
// extern struct Tcl_Interp * hinterp;
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
extern void AddVisualizationScene (const string & name,
VisualScene * vs);
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
void MouseDblClickSelect (const int px, const int py,
const GLdouble * clipplane, const GLdouble backcolor,
const double * transformationmat,
2009-07-20 14:36:36 +06:00
const Point3d & center,
const double rad,
const int displaylist,
int & selelement, int & selface, int & seledge, int & selpoint,
int & selpoint2, int & locpi);
2009-01-13 04:40:13 +05:00
2009-07-20 14:36:36 +06:00
}
2009-01-13 04:40:13 +05:00
#endif