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