2013-02-24 01:34:06 +04:00
|
|
|
#ifndef GLVIEW_H_
|
|
|
|
#define GLVIEW_H_
|
|
|
|
|
2013-02-24 07:14:07 +04:00
|
|
|
/* GLView: A basic OpenGL rectangle for rendering images.
|
|
|
|
|
|
|
|
Inherited by QGLview (for QT GUI) and OffscreenView.
|
|
|
|
|
|
|
|
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'
|
|
|
|
|
|
|
|
*/
|
2013-02-24 05:58:06 +04:00
|
|
|
|
2013-02-24 01:34:06 +04:00
|
|
|
#include <Eigen/Core>
|
|
|
|
#include <Eigen/Geometry>
|
|
|
|
#include <string>
|
|
|
|
#ifndef _MSC_VER
|
|
|
|
#include <stdint.h>
|
|
|
|
#endif
|
|
|
|
#include "system-gl.h"
|
|
|
|
#include <iostream>
|
|
|
|
#include "renderer.h"
|
|
|
|
|
2013-02-24 04:50:20 +04:00
|
|
|
#define FAR_FAR_AWAY 100000.0
|
|
|
|
|
2013-02-24 01:34:06 +04:00
|
|
|
class GLView
|
|
|
|
{
|
|
|
|
public:
|
2013-02-24 04:50:20 +04:00
|
|
|
GLView();
|
2013-02-24 01:34:06 +04:00
|
|
|
void setRenderer(Renderer* r);
|
2013-02-24 04:50:20 +04:00
|
|
|
Renderer *renderer;
|
2013-02-24 01:34:06 +04:00
|
|
|
/*
|
|
|
|
void initializeGL(); //
|
|
|
|
|
2013-02-24 04:50:20 +04:00
|
|
|
*/
|
2013-02-24 05:58:06 +04:00
|
|
|
void resizeGL(int w, int h);
|
|
|
|
|
2013-02-24 04:50:20 +04:00
|
|
|
void setGimbalCamera(const Eigen::Vector3d &pos, const Eigen::Vector3d &rot, double distance);
|
|
|
|
void setupGimbalPerspective();
|
|
|
|
void setupGimbalOrtho(double distance, bool offset=false);
|
|
|
|
|
|
|
|
void setCamera(const Eigen::Vector3d &pos, const Eigen::Vector3d ¢er);
|
|
|
|
void setupPerspective();
|
|
|
|
void setupOrtho(bool offset=false);
|
2013-02-24 01:34:06 +04:00
|
|
|
|
2013-02-24 05:19:33 +04:00
|
|
|
virtual bool save(const char *filename) = 0;
|
|
|
|
virtual std::string getRendererInfo() const = 0;
|
2013-02-24 01:34:06 +04:00
|
|
|
|
2013-02-24 05:58:06 +04:00
|
|
|
size_t width;
|
|
|
|
size_t height;
|
2013-02-24 07:33:28 +04:00
|
|
|
double viewer_distance;
|
|
|
|
double w_h_ratio;
|
|
|
|
bool orthomode;
|
|
|
|
bool showaxes;
|
|
|
|
bool showfaces;
|
|
|
|
bool showedges;
|
2013-02-24 07:54:53 +04:00
|
|
|
bool showcrosshairs;
|
2013-02-24 04:50:20 +04:00
|
|
|
Eigen::Vector3d object_trans;
|
|
|
|
Eigen::Vector3d object_rot;
|
|
|
|
Eigen::Vector3d camera_eye;
|
|
|
|
Eigen::Vector3d camera_center;
|
|
|
|
|
2013-02-24 05:58:06 +04:00
|
|
|
#ifdef ENABLE_OPENCSG
|
|
|
|
GLint shaderinfo[11];
|
2011-11-28 01:52:28 +04:00
|
|
|
bool is_opencsg_capable;
|
|
|
|
bool has_shaders;
|
2013-02-24 07:54:53 +04:00
|
|
|
// void enable_opencsg_shaders();
|
2013-02-24 21:21:45 +04:00
|
|
|
virtual void display_opencsg_warning() = 0;
|
2013-02-24 07:54:53 +04:00
|
|
|
bool opencsg_support;
|
|
|
|
int opencsg_id;
|
2013-02-24 05:58:06 +04:00
|
|
|
#endif
|
2013-02-24 04:50:20 +04:00
|
|
|
/*
|
2013-02-24 01:34:06 +04:00
|
|
|
void paintGL(); //
|
|
|
|
*/
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|