#include "topview.h"
#include "glutils.h"
#include "topview.h"
+
/*
refreshes camera settings using view parameters such as pan zoom etc
if a camera is selected viewport is switched to 3D
// glTranslatef(view->cameras[view->active_camera]->targetx/pow(view->cameras[view->active_camera]->r,0.125),view->cameras[view->active_camera]->targety/pow(view->cameras[view->active_camera]->r,0.125),0);
glRotatef(view->cameras[view->active_camera]->angley,1,0,0);
glRotatef(view->cameras[view->active_camera]->anglex,0,1,0);
+ glRotatef(view->cameras[view->active_camera]->anglez,0,0,1);
+
}
GetOGLPosRef(1, view->h - 5, &(view->clipX1), &(view->clipY1),
&(view->clipZ1));
glexpose_drawgraph(view);
draw_selection_box(view);
drawBorders(view);
+ drawRotatingTools();
/*DEBUG*/
/* if (view->mouse.mouse_mode == MM_PAN)
{
}
return 0;
}
+
+void drawRotatingTools()
+{
+ float x,y,z;
+ float x1,y1,z1;
+ float x2,y2,z2;
+ float R1,R2;
+ if ((view->mouse.mouse_mode == MM_ROTATE) && (view->active_camera >=0))
+ {
+ R1=25;
+ R2=200;
+ glCompDrawBegin();
+ GetOGLPosRef(1, view->h - 5, &x1, &y1,&z1);
+ GetOGLPosRef(view->w - 1, 1, &x2,&y2,&z2);
+ x=(x2-x1)/2.0;
+ y=(y2-y1)/2.0;
+ glTranslatef(x,y,0);
+ if ((view->mouse.rotate_axis==MOUSE_ROTATE_X) || (view->mouse.rotate_axis==MOUSE_ROTATE_XY))
+ {
+ glLineWidth(2);
+ glColor4f(0,1,0,0.5);
+ }
+ else
+ {
+ glLineWidth(1);
+ glColor4f(1,0,0,0.5);
+ }
+ drawEllipse(R1,R2,90,270);
+ if ((view->mouse.rotate_axis==MOUSE_ROTATE_Y) || (view->mouse.rotate_axis==MOUSE_ROTATE_XY))
+ {
+ glLineWidth(2);
+ glColor4f(0,1,0,0.5);
+ }
+ else
+ {
+ glLineWidth(1);
+ glColor4f(1,0,0,0.5);
+ }
+ drawEllipse(R2, R1,0,180);
+ if (view->mouse.rotate_axis==MOUSE_ROTATE_Z)
+ {
+ glLineWidth(2);
+ glColor4f(0,1,0,0.5);
+ }
+ else
+ {
+ glLineWidth(1);
+ glColor4f(1,0,0,0.5);
+ }
+
+ drawEllipse(R2, R2,0,360);
+ glCompDrawEnd();
+ }
+
+}
+
}
view->Topview->is_top_fisheye=1;
}
+void menu_click_rotate(void* p)
+{
+ view->mouse.mouse_mode = MM_ROTATE;
+}
+void menu_click_rotate_x(void* p)
+{
+ view->mouse.rotate_axis=MOUSE_ROTATE_X;
+}
+void menu_click_rotate_y(void* p)
+{
+ view->mouse.rotate_axis=MOUSE_ROTATE_Y;
+}
+void menu_click_rotate_xy(void* p)
+{
+ view->mouse.rotate_axis=MOUSE_ROTATE_XY;
+}
+void menu_click_rotate_z(void* p)
+{
+ view->mouse.rotate_axis=MOUSE_ROTATE_Z;
+}
#ifdef _WIN32
#define SMYRNA_ICON_ZOOMPLUS "c:/zoomplus.raw"
#define SMYRNA_ICON_ZOOMMINUS "c:/zoomminus.raw"
#define SMYRNA_ICON_FISHEYE "c:/fisheye.raw"
+#define SMYRNA_ICON_ROTATE "c:/rotate.raw"
#endif
static char* smyrna_icon_pan;
//control panel
- p = glCompPanelNew(25, 75, 165, 200);
+ p = glCompPanelNew(25, 75, 165, 277);
p->data = 1; //control panel
glCompSetAddPanel(s, p);
b->groupid = 2;
b->callbackfunc = menu_switch_to_fisheye;
glCompSetAddButton(s, b);
- //pan button
+
+ //rotate
+ b = glCompButtonNew(5, 197, 72, 72, "", SMYRNA_ICON_ROTATE,
+ 72, 72);
+ b->groupid = 3;
+ b->customptr = view;
+ b->panel = p;
+ b->callbackfunc = menu_click_rotate;
+ glCompSetAddButton(s, b);
+
+ b = glCompButtonNew(80, 251, 40, 20, "X", '\0', 0, 0);
+ b->customptr = view;
+ b->panel = p;
+ b->groupid = 1;
+ b->callbackfunc = menu_click_rotate_x;
+ glCompSetAddButton(s, b);
+ b = glCompButtonNew(125, 251, 40, 20, "Y", '\0', 0, 0);
+ b->customptr = view;
+ b->panel = p;
+ b->groupid = 1;
+ b->callbackfunc = menu_click_rotate_y;
+ glCompSetAddButton(s, b);
+ b = glCompButtonNew(80, 231, 40, 20, "XY", '\0', 0, 0);
+ b->customptr = view;
+ b->panel = p;
+ b->groupid = 1;
+ b->callbackfunc = menu_click_rotate_xy;
+ glCompSetAddButton(s, b);
+ b = glCompButtonNew(125, 231, 40, 20, "Z", '\0', 0, 0);
+ b->customptr = view;
+ b->panel = p;
+ b->groupid = 1;
+ b->callbackfunc = menu_click_rotate_z;
+ glCompSetAddButton(s, b);
+
+
+ //pan button
b = glCompButtonNew(5, 120, 72, 72, "adasasds", SMYRNA_ICON_PAN, 72,
72);
b->groupid = 3;