summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-10-12 11:31:54 (GMT)
committerclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-10-12 11:31:54 (GMT)
commit962977d4b6425e3165f2a65e0e18014c88f1389d (patch)
treef440097e532fb2a0a0707d41782668c853dbcfa9
parent754a3dc15287bf90deb10f75afd099e2a47fe5ef (diff)
Clifford Wolf:
Added orthogonal display mode git-svn-id: http://svn.clifford.at/openscad/trunk@96 b57f626f-c46c-0410-a088-ec61d464b74c
-rw-r--r--glview.cc9
-rw-r--r--mainwin.cc24
-rw-r--r--openscad.h7
3 files changed, 35 insertions, 5 deletions
diff --git a/glview.cc b/glview.cc
index 3d25f25..eaf061e 100644
--- a/glview.cc
+++ b/glview.cc
@@ -35,6 +35,8 @@ GLView::GLView(QWidget *parent) : QGLWidget(parent)
last_mouse_x = 0;
last_mouse_y = 0;
+ orthomode = false;
+
renderfunc = NULL;
renderfunc_vp = NULL;
@@ -168,7 +170,12 @@ void GLView::paintGL()
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glFrustum(-w_h_ratio, +w_h_ratio, -(1/w_h_ratio), +(1/w_h_ratio), +10.0, +FAR_FAR_AWAY);
+ if (orthomode)
+ glOrtho(-w_h_ratio*viewer_distance/10, +w_h_ratio*viewer_distance/10,
+ -(1/w_h_ratio)*viewer_distance/10, +(1/w_h_ratio)*viewer_distance/10,
+ -FAR_FAR_AWAY, +FAR_FAR_AWAY);
+ else
+ glFrustum(-w_h_ratio, +w_h_ratio, -(1/w_h_ratio), +(1/w_h_ratio), +10.0, +FAR_FAR_AWAY);
gluLookAt(0.0, -viewer_distance, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0);
glMatrixMode(GL_MODELVIEW);
diff --git a/mainwin.cc b/mainwin.cc
index 564a5a1..4a79de4 100644
--- a/mainwin.cc
+++ b/mainwin.cc
@@ -172,9 +172,12 @@ MainWindow::MainWindow(const char *filename)
menu->addAction("Front", this, SLOT(viewAngleFront()));
menu->addAction("Back", this, SLOT(viewAngleBack()));
menu->addAction("Diagonal", this, SLOT(viewAngleDiagonal()));
+
menu->addSeparator();
- menu->addAction("Perspective");
- menu->addAction("Orthogonal");
+ actViewPerspective = menu->addAction("Perspective", this, SLOT(viewPerspective()));
+ actViewPerspective->setCheckable(true);
+ actViewOrthogonal = menu->addAction("Orthogonal", this, SLOT(viewOrthogonal()));
+ actViewOrthogonal->setCheckable(true);
}
console->setReadOnly(true);
@@ -205,6 +208,7 @@ MainWindow::MainWindow(const char *filename)
#else
viewModeThrownTogether();
#endif
+ viewPerspective();
setCentralWidget(s1);
current_win = NULL;
@@ -1173,3 +1177,19 @@ void MainWindow::viewAngleDiagonal()
screen->updateGL();
}
+void MainWindow::viewPerspective()
+{
+ actViewPerspective->setChecked(true);
+ actViewOrthogonal->setChecked(false);
+ screen->orthomode = false;
+ screen->updateGL();
+}
+
+void MainWindow::viewOrthogonal()
+{
+ actViewPerspective->setChecked(false);
+ actViewOrthogonal->setChecked(true);
+ screen->orthomode = true;
+ screen->updateGL();
+}
+
diff --git a/openscad.h b/openscad.h
index 0088723..b12e901 100644
--- a/openscad.h
+++ b/openscad.h
@@ -644,6 +644,7 @@ public:
void (*renderfunc)(void*);
void *renderfunc_vp;
+ bool orthomode;
double viewer_distance;
double object_rot_y;
double object_rot_z;
@@ -751,6 +752,8 @@ public:
QAction *actViewModeThrownTogether;
QAction *actViewModeShowEdges;
QAction *actViewModeAnimate;
+ QAction *actViewPerspective;
+ QAction *actViewOrthogonal;
void viewModeActionsUncheck();
private slots:
@@ -764,8 +767,6 @@ private slots:
void viewModeThrownTogether();
void viewModeShowEdges();
void viewModeAnimate();
-
-private slots:
void viewAngleTop();
void viewAngleBottom();
void viewAngleLeft();
@@ -773,6 +774,8 @@ private slots:
void viewAngleFront();
void viewAngleBack();
void viewAngleDiagonal();
+ void viewPerspective();
+ void viewOrthogonal();
};
extern AbstractModule *parse(const char *text, int debug);
contact: Jan Huwald // Impressum