summaryrefslogtreecommitdiff
path: root/src/GLView.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/GLView.h')
-rw-r--r--src/GLView.h124
1 files changed, 53 insertions, 71 deletions
diff --git a/src/GLView.h b/src/GLView.h
index 5552e4b..f7ae5a7 100644
--- a/src/GLView.h
+++ b/src/GLView.h
@@ -1,95 +1,77 @@
#ifndef GLVIEW_H_
#define GLVIEW_H_
-#include "system-gl.h"
-#include <QGLWidget>
-#include <QLabel>
+/* GLView: A basic OpenGL rectangle for rendering images.
-class GLView : public QGLWidget
-{
- Q_OBJECT
- Q_PROPERTY(bool showFaces READ showFaces WRITE setShowFaces);
- Q_PROPERTY(bool showEdges READ showEdges WRITE setShowEdges);
- Q_PROPERTY(bool showAxes READ showAxes WRITE setShowAxes);
- Q_PROPERTY(bool showCrosshairs READ showCrosshairs WRITE setShowCrosshairs);
- Q_PROPERTY(bool orthoMode READ orthoMode WRITE setOrthoMode);
+Inherited by QGLview (for QT GUI) and OffscreenView.
-public:
- GLView(QWidget *parent = NULL);
- GLView(const QGLFormat & format, QWidget *parent = NULL);
- void setRenderer(class Renderer* r);
-#ifdef ENABLE_OPENCSG
- bool hasOpenCSGSupport() { return this->opencsg_support; }
-#endif
- // Properties
- bool showFaces() const { return this->showfaces; }
- void setShowFaces(bool enabled) { this->showfaces = enabled; }
- bool showEdges() const { return this->showedges; }
- void setShowEdges(bool enabled) { this->showedges = enabled; }
- bool showAxes() const { return this->showaxes; }
- void setShowAxes(bool enabled) { this->showaxes = enabled; }
- bool showCrosshairs() const { return this->showcrosshairs; }
- void setShowCrosshairs(bool enabled) { this->showcrosshairs = enabled; }
- bool orthoMode() const { return this->orthomode; }
- void setOrthoMode(bool enabled) { this->orthomode = enabled; }
- const QString &getRendererInfo() const { return this->rendererInfo; }
+There are two different types of cameras. A 'gimbal' based camera set
+using position & euler-angles (object_trans/object_rot/distance) and a
+'plain' camera set using eye-position, 'look at' center point, and 'up'
-public:
- QLabel *statusLabel;
- double object_rot_x;
- double object_rot_y;
- double object_rot_z;
- double object_trans_x;
- double object_trans_y;
- double object_trans_z;
- GLint shaderinfo[11];
+*/
-#ifdef ENABLE_OPENCSG
- bool opencsg_support;
- int opencsg_id;
+#include <Eigen/Core>
+#include <Eigen/Geometry>
+#include <string>
+#ifndef _MSC_VER
+#include <stdint.h>
#endif
+#include "system-gl.h"
+#include <iostream>
+#include "renderer.h"
-private:
- void init();
- Renderer *renderer;
-
- QString rendererInfo;
+#define FAR_FAR_AWAY 100000.0
- bool showfaces;
- bool showedges;
- bool showaxes;
- bool showcrosshairs;
- bool orthomode;
+class GLView
+{
+public:
+ GLView();
+ void setRenderer(Renderer* r);
+ Renderer *renderer;
+/*
+ void initializeGL(); //
- double viewer_distance;
+*/
+ void resizeGL(int w, int h);
- double w_h_ratio;
+ void setGimbalCamera(const Eigen::Vector3d &pos, const Eigen::Vector3d &rot, double distance);
+ void setupGimbalPerspective();
+ void setupGimbalOrtho(double distance, bool offset=false);
- bool mouse_drag_active;
- QPoint last_mouse;
+ void setCamera(const Eigen::Vector3d &pos, const Eigen::Vector3d &center);
+ void setupPerspective();
+ void setupOrtho(bool offset=false);
- void keyPressEvent(QKeyEvent *event);
- void wheelEvent(QWheelEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
+ virtual bool save(const char *filename) = 0;
+ virtual std::string getRendererInfo() const = 0;
- void initializeGL();
- void resizeGL(int w, int h);
- void setupPerspective();
- void setupOrtho(double distance,bool offset=false);
- void paintGL();
- void normalizeAngle(GLdouble& angle);
+ size_t width;
+ size_t height;
+ double viewer_distance;
+ double w_h_ratio;
+ bool orthomode;
+ bool showaxes;
+ bool showfaces;
+ bool showedges;
+ bool showcrosshairs;
+ Eigen::Vector3d object_trans;
+ Eigen::Vector3d object_rot;
+ Eigen::Vector3d camera_eye;
+ Eigen::Vector3d camera_center;
#ifdef ENABLE_OPENCSG
+ GLint shaderinfo[11];
bool is_opencsg_capable;
bool has_shaders;
-private slots:
- void display_opencsg_warning();
+// void enable_opencsg_shaders();
+ bool opencsg_support;
+ int opencsg_id;
#endif
+/*
+ void paintGL(); //
+*/
-signals:
- void doAnimateUpdate();
};
#endif
contact: Jan Huwald // Impressum