mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
dbl-clk function with point coordinates
This commit is contained in:
parent
361ea96704
commit
725a714bf3
@ -59,7 +59,7 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
SetClippingPlane ();
|
SetClippingPlane ();
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ namespace netgen
|
|||||||
glLineWidth (1.0f);
|
glLineWidth (1.0f);
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
// glEnable (GL_COLOR);
|
// glEnable (GL_COLOR);
|
||||||
// glDisable (GL_COLOR_MATERIAL);
|
// glDisable (GL_COLOR_MATERIAL);
|
||||||
|
@ -39,7 +39,7 @@ namespace netgen
|
|||||||
// glEnable (GL_LIGHT0);
|
// glEnable (GL_LIGHT0);
|
||||||
glDisable (GL_LIGHTING);
|
glDisable (GL_LIGHTING);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
// SetClippingPlane ();
|
// SetClippingPlane ();
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ namespace netgen
|
|||||||
SetLight();
|
SetLight();
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
glShadeModel (GL_SMOOTH);
|
glShadeModel (GL_SMOOTH);
|
||||||
glDisable (GL_COLOR_MATERIAL);
|
glDisable (GL_COLOR_MATERIAL);
|
||||||
@ -654,7 +654,7 @@ namespace netgen
|
|||||||
glMatrixMode (GL_MODELVIEW);
|
glMatrixMode (GL_MODELVIEW);
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
glInitNames();
|
glInitNames();
|
||||||
glPushName (1);
|
glPushName (1);
|
||||||
|
@ -84,7 +84,7 @@ void VisualSceneSTLMeshing :: DrawScene ()
|
|||||||
SetLight();
|
SetLight();
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
SetClippingPlane ();
|
SetClippingPlane ();
|
||||||
|
|
||||||
@ -865,7 +865,7 @@ void VisualSceneSTLMeshing :: MouseDblClick (int px, int py)
|
|||||||
glMatrixMode (GL_MODELVIEW);
|
glMatrixMode (GL_MODELVIEW);
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
|
|
||||||
glInitNames();
|
glInitNames();
|
||||||
@ -1101,7 +1101,7 @@ void VisualSceneSTLMeshing :: MouseDblClick (int px, int py)
|
|||||||
|
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ void VisualSceneMeshDoctor :: DrawScene ()
|
|||||||
SetLight();
|
SetLight();
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
glInitNames ();
|
glInitNames ();
|
||||||
glPushName (0);
|
glPushName (0);
|
||||||
@ -479,7 +479,7 @@ void VisualSceneMeshDoctor :: MouseDblClick (int px, int py)
|
|||||||
glMatrixMode (GL_MODELVIEW);
|
glMatrixMode (GL_MODELVIEW);
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
glInitNames();
|
glInitNames();
|
||||||
glPushName (1);
|
glPushName (1);
|
||||||
|
@ -41,11 +41,11 @@ namespace netgen
|
|||||||
int VisualScene :: ntexcols = -1;
|
int VisualScene :: ntexcols = -1;
|
||||||
|
|
||||||
|
|
||||||
float VisualScene :: lookatmat[16];
|
double VisualScene :: lookatmat[16];
|
||||||
float VisualScene :: transmat[16];
|
double VisualScene :: transmat[16];
|
||||||
float VisualScene :: rotmat[16];
|
double VisualScene :: rotmat[16];
|
||||||
float VisualScene :: centermat[16];
|
double VisualScene :: centermat[16];
|
||||||
float VisualScene :: transformationmat[16];
|
double VisualScene :: transformationmat[16];
|
||||||
|
|
||||||
int VisualScene :: selface;
|
int VisualScene :: selface;
|
||||||
int VisualScene :: selelement;
|
int VisualScene :: selelement;
|
||||||
@ -158,25 +158,25 @@ namespace netgen
|
|||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
gluLookAt (0, 0, 6, 0, 0, 0, 0, 1, 0);
|
gluLookAt (0, 0, 6, 0, 0, 0, 0, 1, 0);
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, lookatmat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, lookatmat);
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glTranslatef(0.0f, 0.0f, -dist);
|
glTranslatef(0.0f, 0.0f, -dist);
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, transmat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, transmat);
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, rotmat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, rotmat);
|
||||||
|
|
||||||
glScalef (1/rad, 1/rad, 1/rad);
|
glScaled (1/rad, 1/rad, 1/rad);
|
||||||
glTranslated (-center.X(), -center.Y(), -center.Z());
|
glTranslated (-center.X(), -center.Y(), -center.Z());
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, centermat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, centermat);
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glMultMatrixf (lookatmat);
|
glMultMatrixd (lookatmat);
|
||||||
glMultMatrixf (transmat);
|
glMultMatrixd (transmat);
|
||||||
glMultMatrixf (rotmat);
|
glMultMatrixd (rotmat);
|
||||||
glMultMatrixf (centermat);
|
glMultMatrixd (centermat);
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, transformationmat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, transformationmat);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
@ -193,14 +193,14 @@ namespace netgen
|
|||||||
glRotatef(alpha[i], vec[i].X(), vec[i].Y(), vec[i].Z());
|
glRotatef(alpha[i], vec[i].X(), vec[i].Y(), vec[i].Z());
|
||||||
}
|
}
|
||||||
|
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, rotmat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, rotmat);
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glMultMatrixf (lookatmat);
|
glMultMatrixd (lookatmat);
|
||||||
glMultMatrixf (transmat);
|
glMultMatrixd (transmat);
|
||||||
glMultMatrixf (rotmat);
|
glMultMatrixd (rotmat);
|
||||||
glMultMatrixf (centermat);
|
glMultMatrixd (centermat);
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, transformationmat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, transformationmat);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
@ -241,14 +241,14 @@ namespace netgen
|
|||||||
glRotatef(90.0, 0.0f, 1.0f, 0.0f);
|
glRotatef(90.0, 0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
|
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, rotmat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, rotmat);
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glMultMatrixf (lookatmat);
|
glMultMatrixd (lookatmat);
|
||||||
glMultMatrixf (transmat);
|
glMultMatrixd (transmat);
|
||||||
glMultMatrixf (rotmat);
|
glMultMatrixd (rotmat);
|
||||||
glMultMatrixf (centermat);
|
glMultMatrixd (centermat);
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, transformationmat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, transformationmat);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
@ -269,8 +269,8 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
glRotatef(float(deltax)/2, 0.0f, 1.0f, 0.0f);
|
glRotatef(float(deltax)/2, 0.0f, 1.0f, 0.0f);
|
||||||
glRotatef(float(deltay)/2, 1.0f, 0.0f, 0.0f);
|
glRotatef(float(deltay)/2, 1.0f, 0.0f, 0.0f);
|
||||||
glMultMatrixf (rotmat);
|
glMultMatrixd (rotmat);
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, rotmat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, rotmat);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'm':
|
case 'm':
|
||||||
@ -310,8 +310,8 @@ namespace netgen
|
|||||||
|
|
||||||
glTranslated (px2-px1, py2-py1, pz2-pz1);
|
glTranslated (px2-px1, py2-py1, pz2-pz1);
|
||||||
|
|
||||||
glMultMatrixf (transmat);
|
glMultMatrixd (transmat);
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, transmat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, transmat);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'z':
|
case 'z':
|
||||||
@ -324,18 +324,18 @@ namespace netgen
|
|||||||
exp (double (-deltay)/100),
|
exp (double (-deltay)/100),
|
||||||
exp (double (-deltay)/100));
|
exp (double (-deltay)/100));
|
||||||
// glTranslatef(0.0f, 0.0f, dist);
|
// glTranslatef(0.0f, 0.0f, dist);
|
||||||
glMultMatrixf (transmat);
|
glMultMatrixd (transmat);
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, transmat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, transmat);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glMultMatrixf (lookatmat);
|
glMultMatrixd (lookatmat);
|
||||||
glMultMatrixf (transmat);
|
glMultMatrixd (transmat);
|
||||||
glMultMatrixf (rotmat);
|
glMultMatrixd (rotmat);
|
||||||
glMultMatrixf (centermat);
|
glMultMatrixd (centermat);
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, transformationmat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, transformationmat);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
@ -349,8 +349,8 @@ namespace netgen
|
|||||||
gluLookAt (cam(0), cam(1), cam(2),
|
gluLookAt (cam(0), cam(1), cam(2),
|
||||||
obj(0), obj(1), obj(2),
|
obj(0), obj(1), obj(2),
|
||||||
camup(0), camup(1), camup(2));
|
camup(0), camup(1), camup(2));
|
||||||
glMultMatrixf (centermat);
|
glMultMatrixd (centermat);
|
||||||
glGetFloatv (GL_MODELVIEW_MATRIX, transformationmat);
|
glGetDoublev (GL_MODELVIEW_MATRIX, transformationmat);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,7 +631,7 @@ namespace netgen
|
|||||||
glTranslatef (-1, -1, 0.0);
|
glTranslatef (-1, -1, 0.0);
|
||||||
glScalef (40.0 / viewport[2], 40.0 / viewport[3], 1);
|
glScalef (40.0 / viewport[2], 40.0 / viewport[3], 1);
|
||||||
glTranslatef (2.0, 2.0, 0.0);
|
glTranslatef (2.0, 2.0, 0.0);
|
||||||
glMultMatrixf (rotmat);
|
glMultMatrixd (rotmat);
|
||||||
|
|
||||||
glEnable (GL_COLOR_MATERIAL);
|
glEnable (GL_COLOR_MATERIAL);
|
||||||
glDisable (GL_LIGHTING);
|
glDisable (GL_LIGHTING);
|
||||||
|
@ -22,12 +22,12 @@ namespace netgen
|
|||||||
static DLL_HEADER Point3d center;
|
static DLL_HEADER Point3d center;
|
||||||
static DLL_HEADER double rad;
|
static DLL_HEADER double rad;
|
||||||
|
|
||||||
static float lookatmat[16];
|
static double lookatmat[16];
|
||||||
static float transmat[16];
|
static double transmat[16];
|
||||||
static float rotmat[16];
|
static double rotmat[16];
|
||||||
static float centermat[16];
|
static double centermat[16];
|
||||||
|
|
||||||
static DLL_HEADER float transformationmat[16];
|
static DLL_HEADER double transformationmat[16];
|
||||||
|
|
||||||
GLdouble clipplane[4];
|
GLdouble clipplane[4];
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ namespace netgen
|
|||||||
|
|
||||||
void MouseDblClickSelect (const int px, const int py,
|
void MouseDblClickSelect (const int px, const int py,
|
||||||
const GLdouble * clipplane, const GLdouble backcolor,
|
const GLdouble * clipplane, const GLdouble backcolor,
|
||||||
const float * transformationmat,
|
const double * transformationmat,
|
||||||
const Point3d & center,
|
const Point3d & center,
|
||||||
const double rad,
|
const double rad,
|
||||||
const int displaylist,
|
const int displaylist,
|
||||||
|
@ -113,7 +113,7 @@ namespace netgen
|
|||||||
class DLL_HEADER MouseEventHandler
|
class DLL_HEADER MouseEventHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void DblClick (int elnr) { ; }
|
virtual void DblClick (int elnr, double x, double y, double z) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -97,9 +97,9 @@ namespace netgen
|
|||||||
SetLight();
|
SetLight();
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
GLdouble projmat[16];
|
GLdouble projmat[16]; // brauchen wir das ?
|
||||||
glGetDoublev (GL_PROJECTION_MATRIX, projmat);
|
glGetDoublev (GL_PROJECTION_MATRIX, projmat);
|
||||||
|
|
||||||
|
|
||||||
@ -3093,30 +3093,31 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
klappt noch nicht ...
|
|
||||||
GLdouble modelview[16], projection[16];
|
GLdouble modelview[16], projection[16];
|
||||||
GLint viewport[4];
|
GLint viewport[4];
|
||||||
GLdouble result[3];
|
GLdouble result[3];
|
||||||
glGetDoublev(GL_MODELVIEW_MATRIX, &modelview[0]);
|
|
||||||
glGetDoublev(GL_PROJECTION_MATRIX, &projection[0]);
|
glGetDoublev(GL_PROJECTION_MATRIX, &projection[0]);
|
||||||
glGetIntegerv(GL_VIEWPORT, &viewport[0]);
|
glGetIntegerv(GL_VIEWPORT, &viewport[0]);
|
||||||
|
|
||||||
int hy = viewport[3]-py;
|
int hy = viewport[3]-py;
|
||||||
|
|
||||||
GLfloat pz;
|
GLfloat pz;
|
||||||
cout << "x, y = " << px << ", " << hy << endl;
|
// cout << "x, y = " << px << ", " << hy << endl;
|
||||||
glReadPixels (px, hy, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &pz);
|
glReadPixels (px, hy, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &pz);
|
||||||
cout << "pz = " << pz << endl; gluUnProject(px, hy, pz, modelview, projection, viewport,
|
cout << "pz = " << pz << endl;
|
||||||
|
gluUnProject(px, hy, pz, transformationmat, projection, viewport,
|
||||||
&result[0], &result[1], &result[2]);
|
&result[0], &result[1], &result[2]);
|
||||||
cout << "3d point : " << result[0] << ", " << result[1] << ", " << result[2] << endl;
|
|
||||||
*/
|
if (pz < 1.0)
|
||||||
|
cout << "point : " << result[0] << ", " << result[1] << ", " << result[2] << endl;
|
||||||
|
|
||||||
|
|
||||||
if (user_me_handler)
|
if (user_me_handler && pz < 1.0)
|
||||||
{
|
{
|
||||||
if (selelement != -1)
|
if (selelement != -1)
|
||||||
user_me_handler -> DblClick (selelement-1);
|
user_me_handler -> DblClick (selelement-1, result[0], result[1], result[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
selecttimestamp = NextTimeStamp();
|
selecttimestamp = NextTimeStamp();
|
||||||
@ -3298,7 +3299,7 @@ namespace netgen
|
|||||||
|
|
||||||
void MouseDblClickSelect (const int px, const int py,
|
void MouseDblClickSelect (const int px, const int py,
|
||||||
const GLdouble * clipplane, const GLdouble backcolor,
|
const GLdouble * clipplane, const GLdouble backcolor,
|
||||||
const float * transformationmat,
|
const double * transformationmat,
|
||||||
const Point3d & center,
|
const Point3d & center,
|
||||||
const double rad,
|
const double rad,
|
||||||
const int displaylist,
|
const int displaylist,
|
||||||
@ -3337,7 +3338,7 @@ namespace netgen
|
|||||||
glMatrixMode (GL_MODELVIEW);
|
glMatrixMode (GL_MODELVIEW);
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
|
|
||||||
// SetClippingPlane();
|
// SetClippingPlane();
|
||||||
|
@ -362,7 +362,7 @@ namespace netgen
|
|||||||
SetLight();
|
SetLight();
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
glMatrixMode (GL_MODELVIEW);
|
glMatrixMode (GL_MODELVIEW);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user