2014-04-28 21:09:25 +04:00
|
|
|
#pragma once
|
2013-02-24 01:34:06 +04:00
|
|
|
|
2013-02-24 07:14:07 +04:00
|
|
|
/* GLView: A basic OpenGL rectangle for rendering images.
|
|
|
|
|
2013-03-03 20:11:56 +04:00
|
|
|
This class is inherited by:
|
2013-02-25 05:04:50 +04:00
|
|
|
|
2013-03-03 20:11:56 +04:00
|
|
|
*QGLview - for Qt GUI
|
|
|
|
*OffscreenView - for offscreen rendering, in tests and from command-line
|
2014-01-31 04:21:32 +04:00
|
|
|
(This class is also overridden by NULLGL.cc for special experiments)
|
2013-02-24 07:14:07 +04:00
|
|
|
|
2013-03-03 20:52:25 +04:00
|
|
|
The view assumes either a Gimbal Camera (rotation,translation,distance)
|
|
|
|
or Vector Camera (eye,center/target) is being used. See Camera.h. The
|
|
|
|
cameras are not kept in sync.
|
2013-02-26 08:32:57 +04:00
|
|
|
|
2013-03-03 20:52:25 +04:00
|
|
|
QGLView only uses GimbalCamera while OffscreenView can use either one.
|
|
|
|
Some actions (showCrossHairs) only work properly on Gimbal Camera.
|
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>
|
2013-02-27 10:37:37 +04:00
|
|
|
#include "Camera.h"
|
2014-08-15 01:16:24 +04:00
|
|
|
#include "colormap.h"
|
2013-02-24 01:34:06 +04:00
|
|
|
|
|
|
|
class GLView
|
|
|
|
{
|
|
|
|
public:
|
2013-02-24 04:50:20 +04:00
|
|
|
GLView();
|
2014-06-22 00:12:55 +04:00
|
|
|
void setRenderer(class Renderer* r);
|
|
|
|
Renderer *getRenderer() const { return this->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
|
|
|
|
2014-06-20 01:47:38 +04:00
|
|
|
void setCamera(const Camera &cam);
|
|
|
|
void setupCamera();
|
2013-02-26 08:32:57 +04:00
|
|
|
|
2014-08-15 01:16:24 +04:00
|
|
|
void setColorScheme(const ColorScheme &cs);
|
|
|
|
void setColorScheme(const std::string &cs);
|
|
|
|
void updateColorScheme();
|
|
|
|
|
2013-02-24 05:19:33 +04:00
|
|
|
virtual bool save(const char *filename) = 0;
|
|
|
|
virtual std::string getRendererInfo() const = 0;
|
2014-02-05 09:54:39 +04:00
|
|
|
virtual float getDPI() { return 1.0f; }
|
2013-02-24 01:34:06 +04:00
|
|
|
|
2013-03-04 06:23:03 +04:00
|
|
|
Renderer *renderer;
|
2014-08-15 01:16:24 +04:00
|
|
|
const ColorScheme *colorscheme;
|
2013-03-04 06:23:03 +04:00
|
|
|
Camera cam;
|
2013-03-04 07:37:57 +04:00
|
|
|
double far_far_away;
|
2013-02-24 05:58:06 +04:00
|
|
|
size_t width;
|
|
|
|
size_t height;
|
2014-06-20 01:47:38 +04:00
|
|
|
double aspectratio;
|
2013-03-04 06:08:04 +04:00
|
|
|
bool orthomode;
|
|
|
|
bool showaxes;
|
|
|
|
bool showfaces;
|
|
|
|
bool showedges;
|
|
|
|
bool showcrosshairs;
|
2015-01-02 10:32:37 +03:00
|
|
|
bool showscale;
|
2013-02-26 08:32:57 +04:00
|
|
|
|
2013-02-24 05:58:06 +04:00
|
|
|
#ifdef ENABLE_OPENCSG
|
2013-03-04 06:08:04 +04:00
|
|
|
GLint shaderinfo[11];
|
|
|
|
bool is_opencsg_capable;
|
|
|
|
bool has_shaders;
|
|
|
|
void enable_opencsg_shaders();
|
2013-02-24 21:21:45 +04:00
|
|
|
virtual void display_opencsg_warning() = 0;
|
2013-03-04 06:08:04 +04:00
|
|
|
bool opencsg_support;
|
|
|
|
int opencsg_id;
|
2013-02-24 05:58:06 +04:00
|
|
|
#endif
|
2014-11-30 04:29:29 +03:00
|
|
|
private:
|
|
|
|
void showCrosshairs();
|
|
|
|
void showAxes(const Color4f &col);
|
|
|
|
void showSmallaxes(const Color4f &col);
|
2015-01-02 10:32:37 +03:00
|
|
|
void showScalemarkers(const Color4f &col);
|
|
|
|
void decodeMarkerValue(double i, double l, int size_div_sm);
|
2013-02-24 01:34:06 +04:00
|
|
|
};
|