netgen/libsrc/visualization/mvdraw.hpp

260 lines
6.2 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
2015-10-21 20:50:39 +05:00
static int DLL_HEADER selface;
2009-07-20 14:36:36 +06:00
static int selelement;
2016-12-11 16:12:05 +05:00
static PointIndex DLL_HEADER selpoint;
static PointIndex selpoint2;
2009-07-20 14:36:36 +06:00
static int locpi;
2015-10-21 20:50:39 +05:00
static int DLL_HEADER 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);
2019-07-09 13:39:16 +05:00
DLL_HEADER void ArbitraryRotation (const NgArray<double> & alpha, const NgArray<Vec3d> & vec);
DLL_HEADER void ArbitraryRotation (const double alpha, const Vec3d & vec);
2009-01-13 04:40:13 +05:00
DLL_HEADER virtual void MouseMove(int oldx, int oldy,
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);
2014-10-08 18:46:25 +06:00
DLL_HEADER extern void Set_OpenGLText_Callback ( void (*fun) (const char * text) );
DLL_HEADER extern VisualScene visual_scene_cross;
DLL_HEADER extern VisualScene *visual_scene;
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
{
double scalex = 1., scaley = 1., shiftx = 0., shifty = 0.;
2009-07-20 14:36:36 +06:00
public:
2019-09-29 19:22:00 +05:00
shared_ptr<NgArray<Point<3>>> locpointsptr;
2019-09-22 01:08:35 +05:00
shared_ptr<NgArray<INDEX_2>> loclinesptr;
2019-09-29 19:22:00 +05:00
shared_ptr<NgArray<Point<2>>> plainpointsptr;
int oldnl;
2019-09-22 01:08:35 +05:00
bool clearptr;
2009-07-20 14:36:36 +06:00
VisualSceneSurfaceMeshing ();
virtual ~VisualSceneSurfaceMeshing ();
2009-01-13 04:40:13 +05:00
void BuildScene (int zoomall = 0) override;
void DrawScene () override;
void MouseMove(int oldx, int oldy, int newx, int newy,
char mode) override;
2009-07-20 14:36:36 +06:00
};
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
2019-07-09 13:39:16 +05:00
NgArray<int> par_linelists;
NgArray<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
2015-01-09 02:18:33 +05:00
// weak_ptr<Mesh> wp_mesh;
2014-10-06 15:57:44 +06:00
2009-07-20 14:36:36 +06:00
public:
2015-10-19 13:08:30 +05:00
DLL_HEADER VisualSceneMesh ();
DLL_HEADER virtual ~VisualSceneMesh ();
2009-01-13 04:40:13 +05:00
2015-10-19 13:08:30 +05:00
DLL_HEADER virtual void BuildScene (int zoomall = 0);
DLL_HEADER virtual void DrawScene ();
DLL_HEADER virtual void MouseDblClick (int px, int py);
2009-01-13 04:40:13 +05:00
2015-01-09 02:18:33 +05:00
// void SetMesh (shared_ptr<Mesh> mesh) { wp_mesh = mesh; }
// shared_ptr<Mesh> GetMesh () { return shared_ptr<Mesh>(wp_mesh); }
shared_ptr<Mesh> GetMesh () const { return shared_ptr<Mesh>(global_mesh); }
2014-10-06 15:57:44 +06:00
2012-08-30 19:40:17 +06:00
void SetMouseEventHandler (MouseEventHandler * handler)
{ user_me_handler = handler; }
2015-10-19 13:08:30 +05:00
DLL_HEADER int SelectedFace () const
2009-01-13 04:40:13 +05:00
{ return selface; }
2015-10-19 13:08:30 +05:00
DLL_HEADER void SetSelectedFace (int asf);
2009-07-20 14:36:36 +06:00
// { selface = asf; selecttimestamp = GetTimeStamp(); }
2009-01-13 04:40:13 +05:00
2015-10-19 13:08:30 +05:00
DLL_HEADER int SelectedEdge () const
2009-01-13 04:40:13 +05:00
{ return seledge; }
2015-10-19 13:08:30 +05:00
DLL_HEADER int SelectedElement () const
2009-01-13 04:40:13 +05:00
{ return selelement; }
2015-10-19 13:08:30 +05:00
DLL_HEADER 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();
2021-01-08 12:30:47 +05:00
bool Unproject (int px, int py, Point<3> &p);
2009-07-20 14:36:36 +06:00
};
2009-01-13 04:40:13 +05:00
2015-10-19 13:08:30 +05:00
DLL_HEADER extern VisualSceneMesh vsmesh;
2014-10-06 15:57:44 +06:00
2009-01-13 04:40:13 +05:00
2015-10-19 13:08:30 +05:00
class DLL_HEADER VisualSceneSpecPoints : public VisualScene
2009-07-20 14:36:36 +06:00
{
public:
VisualSceneSpecPoints ();
virtual ~VisualSceneSpecPoints ();
virtual void BuildScene (int zoomall = 0);
virtual void DrawScene ();
double len;
};
2011-01-11 01:18:01 +05:00
2014-10-12 17:40:12 +06:00
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,
2016-12-11 16:12:05 +05:00
int & selelement, int & selface, int & seledge, PointIndex & selpoint,
PointIndex & selpoint2, int & locpi);
2009-01-13 04:40:13 +05:00
DLL_HEADER std::vector<unsigned char> Snapshot( int w, int h );
2009-07-20 14:36:36 +06:00
}
2009-01-13 04:40:13 +05:00
#endif