From: arif Date: Wed, 9 Apr 2008 18:52:26 +0000 (+0000) Subject: new 3d navigation X-Git-Tag: LAST_LIBGRAPH~32^2~4344 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c7c97797969490090926bf01fb5b7b0873b2e236;p=graphviz new 3d navigation --- diff --git a/cmd/smyrna/glexpose.c b/cmd/smyrna/glexpose.c index 77b8092ca..a40c25952 100644 --- a/cmd/smyrna/glexpose.c +++ b/cmd/smyrna/glexpose.c @@ -38,11 +38,17 @@ int glupdatecamera(ViewInfo * view) /*toggle to active camera*/ else { - gluLookAt(view->cameras[view->active_camera]->x,view->cameras[view->active_camera]->y,view->cameras[view->active_camera]->z, + /*gluLookAt(view->cameras[view->active_camera]->x,view->cameras[view->active_camera]->y,view->cameras[view->active_camera]->z, view->cameras[view->active_camera]->targetx,view->cameras[view->active_camera]->targety,view->cameras[view->active_camera]->targetz, view->cameras[view->active_camera]->camera_vectorx, view->cameras[view->active_camera]->camera_vectory, - view->cameras[view->active_camera]->camera_vectorz); + view->cameras[view->active_camera]->camera_vectorz);*/ + gluLookAt(view->panx, view->pany, view->zoom * -1, view->panx, + view->pany, 0.0, 0.0, 1.0, 0.0); + glRotatef(view->cameras[view->active_camera]->angley,1,0,0); + glRotatef(view->cameras[view->active_camera]->anglex,0,1,0); + + } GetOGLPosRef(1, view->h - 5, &(view->clipX1), &(view->clipY1), &(view->clipZ1)); diff --git a/cmd/smyrna/gltemplate.c b/cmd/smyrna/gltemplate.c index 35f014628..c1dd51236 100755 --- a/cmd/smyrna/gltemplate.c +++ b/cmd/smyrna/gltemplate.c @@ -369,9 +369,9 @@ static gboolean motion_notify_event(GtkWidget * widget, } else { - view->cameras[view->active_camera]->anglexyz+=gldy; - view->cameras[view->active_camera]->anglexy+=gldx; - set_camera_x_y(view->cameras[view->active_camera]); + view->cameras[view->active_camera]->angley-=dy/5; + view->cameras[view->active_camera]->anglex-=dx/5; +// set_camera_x_y(view->cameras[view->active_camera]); } redraw = TRUE; } diff --git a/cmd/smyrna/smyrnadefs.h b/cmd/smyrna/smyrnadefs.h index ae1a4c676..48bfeba23 100644 --- a/cmd/smyrna/smyrnadefs.h +++ b/cmd/smyrna/smyrnadefs.h @@ -144,6 +144,10 @@ typedef struct _viewport_camera{ float anglexy; float anglexyz; + float anglex; + float angley; + + float camera_vectorx; float camera_vectory; float camera_vectorz; diff --git a/cmd/smyrna/viewportcamera.c b/cmd/smyrna/viewportcamera.c index b2d19b56b..8044dd982 100644 --- a/cmd/smyrna/viewportcamera.c +++ b/cmd/smyrna/viewportcamera.c @@ -91,14 +91,20 @@ void menu_click_add_camera(void *p) c->targetx=view->panx; c->targety=view->pany; c->targetz=view->panz; + c->x=view->panx; + c->y=view->pany; + c->z=view->zoom; c->camera_vectorx=0; c->camera_vectory=1; c->camera_vectorz=0; c->anglexy=90; c->anglexyz=0; + c->anglex=0; + c->angley=0; + c->r=view->zoom*-1; - set_camera_x_y(c); +// set_camera_x_y(c); attach_camera_widget(view);