{
glLoadIdentity();
- gluLookAt(view->panx, view->pany, view->zoom * -1, view->panx,
- view->pany, 0.0, 0.0, 1.0, 0.0);
-/* gluLookAt(view->panx, view->pany, view->zoom * -1, 0,
- 0, 0.0, 0.0, 1.0, 0.0);
-*/
+ if (view->active_camera==-1)
+ gluLookAt(view->panx, view->pany, view->zoom * -1, view->panx,
+ view->pany, 0.0, 0.0, 1.0, 0.0);
+ else
+ 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,
+ 0.0, 1.0, 0.0);
GetOGLPosRef(1, view->h - 5, &(view->clipX1), &(view->clipY1),
&(view->clipZ1));
GetOGLPosRef(view->w - 1, 1, &(view->clipX2), &(view->clipY2),
float targetz;
cam_t type; //
- float panx;
- float pany;
- float panz;
- float zoom;
} viewport_camera;
view->zoom = (float) MAX_ZOOM;
}
+void menu_click_3d_view(void *p)
+{
+ if ((view->zoom + ZOOM_STEP) < MAX_ZOOM)
+ view->zoom = view->zoom + ZOOM_STEP;
+ else
+ view->zoom = (float) MAX_ZOOM;
+
+}
+
+
#ifdef _WIN32
#define SMYRNA_ICON_PAN "c:/pan.raw"
*/
//small panel left bottom
- p = glCompPanelNew(25, 25, 245, 40);
+ p = glCompPanelNew(25, 25, 325, 40);
p->data = 0;
glCompSetAddPanel(s, p);
glCompSetAddButton(s, b);
- b = glCompButtonNew(165, 7, 75, 25, "HIDE", '\0', 0, 0);
+ b = glCompButtonNew(165, 7, 75, 25, "CAMERAS", '\0', 0, 0);
+ b->customptr = view;
+ b->panel = p;
+ b->groupid = 1;
+ b->callbackfunc = menu_click_3d_view;
+ glCompSetAddButton(s, b);
+
+ b = glCompButtonNew(245, 7, 75, 25, "HIDE", '\0', 0, 0);
b->color.R = 1;
b->customptr = view;
b->panel = p;
b->callbackfunc = menu_click_hide;
glCompSetAddButton(s, b);
+
//control panel
p = glCompPanelNew(25, 75, 165, 200);
p->data = 1; //control panel
view->Selection.Anti = 0;
view->Topview = malloc(sizeof(topview));
view->Topview->topviewmenu = '\0';
+ view->cameras='\0';;
+ view->camera_count=0;
+ view->active_camera=-1;
+
set_viewport_settings_from_template(view, view->default_attributes);
}
void glexpose() {
expose_event(view->drawing_area, NULL, NULL);
}
-
-
-
-
-
-static viewport_camera* new_viewport_camera(ViewInfo * view)
-{
- viewport_camera* c=malloc(sizeof(viewport_camera));
- return c;
-}
-
-viewport_camera* add_camera_to_viewport(ViewInfo * view)
-{
- view->cameras= RALLOC(view->camera_count,view->cameras,viewport_camera*);
- view->cameras[view->camera_count]=new_viewport_camera(view);
- view->camera_count++;
- return view->cameras[view->camera_count-1];
-}
-int delete_camera_from_viewport(ViewInfo * view,viewport_camera* c)
-{
- int ind = 0;
- int found = 0;
- for (ind; ind < view->camera_count - 1; ind++)
- {
- if ((view->cameras[ind] == c) && found == 0)
- found = 1;
- if (found == 1)
- view->cameras[ind] =view->cameras[ind + 1];
- }
- if (found)
- {
- free(c);
- view->camera_count--;
- view->cameras =
- realloc(view->cameras, sizeof(viewport_camera*) * view->camera_count);
- return 1;
- }
- return 0;
-}
-int activate_viewport_camera (ViewInfo * view,int cam_index)
-{
- if (cam_index < view);
-
-
-
-}
-
-
-
void glexpose();
void move_nodes(Agraph_t * g);
-viewport_camera* add_camera_to_viewport(ViewInfo * view);
-int delete_camera_from_viewport(ViewInfo * view,viewport_camera* c);
-int activate_viewport_camera (ViewInfo * view,int cam_index);
/* helper functions */
extern int setGdkColor(GdkColor * c, char *color);
--- /dev/null
+#include "viewportcamera.h"
+static viewport_camera* new_viewport_camera(ViewInfo * view)
+{
+ viewport_camera* c=malloc(sizeof(viewport_camera));
+ return c;
+}
+
+viewport_camera* add_camera_to_viewport(ViewInfo * view)
+{
+ view->cameras=(viewport_camera**)realloc(view->cameras,sizeof(viewport_camera *)*view->camera_count);
+
+ view->cameras[view->camera_count]=new_viewport_camera(view);
+ view->camera_count++;
+ return view->cameras[view->camera_count-1];
+}
+int delete_camera_from_viewport(ViewInfo * view,viewport_camera* c)
+{
+ int ind = 0;
+ int found = 0;
+ for (ind; ind < view->camera_count - 1; ind++)
+ {
+ if ((view->cameras[ind] == c) && found == 0)
+ found = 1;
+ if (found == 1)
+ view->cameras[ind] =view->cameras[ind + 1];
+ }
+ if (found)
+ {
+ free(c);
+ view->camera_count--;
+ view->cameras =
+ realloc(view->cameras, sizeof(viewport_camera*) * view->camera_count);
+ return 1;
+ }
+ return 0;
+}
+int activate_viewport_camera (ViewInfo * view,int cam_index)
+{
+ if (cam_index < view)
+ {
+ view->active_camera=cam_index;
+ return refresh_viewport_camera(view);
+ }
+ else
+ return 0;
+}
+int refresh_viewport_camera (ViewInfo * view)
+{
+ if(view->active_camera >=0)
+ {
+
+/* view->panx=view->cameras[view->active_camera]->panx;
+ view->pany=view->cameras[view->active_camera]->pany;
+ view->panz=view->cameras[view->active_camera]->panz;
+ view->zoom=view->cameras[view->active_camera]->zoom;*/
+ return 1;
+ }
+ else
+ return 0;
+
+
+
+}
--- /dev/null
+#ifndef VIEWPORTCAMERA_H
+#define VIEWPORTCAMERA_H
+#include "smyrnadefs.h"
+viewport_camera* add_camera_to_viewport(ViewInfo * view);
+int delete_camera_from_viewport(ViewInfo * view,viewport_camera* c);
+int activate_viewport_camera (ViewInfo * view,int cam_index);
+int refresh_viewport_camera (ViewInfo * view);
+
+#endif
\ No newline at end of file