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.
|
|
|
|
|
2013-02-26 08:32:57 +04:00
|
|
|
This class is inherited by
|
2013-02-25 05:04:50 +04:00
|
|
|
|
|
|
|
*QGLview (for Qt GUI)
|
|
|
|
*OffscreenView (used in tests and for offscreen command-line rendering).
|
2013-02-24 07:14:07 +04:00
|
|
|
|
2013-03-02 04:41:50 +04:00
|
|
|
There are two different types of cameras
|
2013-02-26 08:32:57 +04:00
|
|
|
|
|
|
|
*Gimbal camera - uses Euler Angles, object translation, and viewer distance
|
|
|
|
*Vector camera - uses 'eye', 'center', and 'up' vectors
|
|
|
|
|
2013-03-02 04:41:50 +04:00
|
|
|
Currently, the two cameras are not kept in sync and they are not easily
|
2013-03-03 19:22:36 +04:00
|
|
|
interchangable. QGLView uses GimbalCamera while OffscreenView can
|
|
|
|
use either (defaulting to Vector).
|
2013-02-24 07:14:07 +04:00
|
|
|
|
|
|
|
*/
|
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-27 10:37:37 +04:00
|
|
|
#include "Camera.h"
|
2013-02-24 01:34:06 +04:00
|
|
|
|
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
|
|
|
|
2013-02-25 00:31:03 +04:00
|
|
|
void initializeGL();
|
2013-02-24 05:58:06 +04:00
|
|
|
void resizeGL(int w, int h);
|
2013-02-27 10:37:37 +04:00
|
|
|
virtual void paintGL();
|
2013-02-24 05:58:06 +04:00
|
|
|
|
2013-02-24 04:50:20 +04:00
|
|
|
void setGimbalCamera(const Eigen::Vector3d &pos, const Eigen::Vector3d &rot, double distance);
|
2013-02-26 08:32:57 +04:00
|
|
|
void setupGimbalCamPerspective();
|
|
|
|
void setupGimbalCamOrtho(double distance, bool offset=false);
|
2013-02-27 10:37:37 +04:00
|
|
|
void gimbalCamPaintGL();
|
2013-02-24 04:50:20 +04:00
|
|
|
|
2013-02-26 08:32:57 +04:00
|
|
|
void setVectorCamera(const Eigen::Vector3d &pos, const Eigen::Vector3d ¢er);
|
|
|
|
void setupVectorCamPerspective();
|
|
|
|
void setupVectorCamOrtho(bool offset=false);
|
2013-02-27 10:37:37 +04:00
|
|
|
void vectorCamPaintGL();
|
2013-02-26 08:32:57 +04:00
|
|
|
|
|
|
|
void setCamera( Camera &cam );
|
2013-02-24 01:34:06 +04:00
|
|
|
|
2013-02-25 05:04:50 +04:00
|
|
|
void showCrosshairs();
|
|
|
|
void showAxes();
|
|
|
|
void showSmallaxes();
|
|
|
|
|
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 w_h_ratio;
|
|
|
|
bool orthomode;
|
|
|
|
bool showaxes;
|
|
|
|
bool showfaces;
|
|
|
|
bool showedges;
|
2013-02-24 07:54:53 +04:00
|
|
|
bool showcrosshairs;
|
2013-02-26 08:32:57 +04:00
|
|
|
|
2013-02-27 10:37:37 +04:00
|
|
|
Camera::CameraType camtype;
|
2013-02-26 08:32:57 +04:00
|
|
|
VectorCamera vcam;
|
|
|
|
GimbalCamera gcam;
|
2013-02-24 04:50:20 +04:00
|
|
|
|
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 22:33:11 +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 01:34:06 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|