Stellarium 0.15.2
StelViewportEffect.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2010 Fabien Chereau
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 #ifndef _STELVIEWPORTEFFECT_HPP_
21 #define _STELVIEWPORTEFFECT_HPP_
22 
23 #include "VecMath.hpp"
24 #include "StelProjector.hpp"
25 
26 class QOpenGLFramebufferObject;
27 
31 {
32 public:
33  StelViewportEffect() {;}
34  virtual ~StelViewportEffect() {;}
35  virtual QString getName() {return "framebufferOnly";}
38  virtual void alterBuffer(QOpenGLFramebufferObject*) const {;}
42  virtual void paintViewportBuffer(const QOpenGLFramebufferObject* buf) const;
45  virtual void distortXY(float& x, float& y) const {Q_UNUSED(x); Q_UNUSED(y);}
46 };
47 
48 
50 {
51 public:
52  StelViewportDistorterFisheyeToSphericMirror(int screen_w,int screen_h);
54  virtual QString getName() {return "sphericMirrorDistorter";}
55  virtual void paintViewportBuffer(const QOpenGLFramebufferObject* buf) const;
56  virtual void distortXY(float& x, float& y) const;
57 private:
58  const int screen_w;
59  const int screen_h;
60  const StelProjector::StelProjectorParams originalProjectorParams;
61  StelProjector::StelProjectorParams newProjectorParams;
62  int viewport_texture_offset[2];
63 
64  Vec2f *texture_point_array;
65  int max_x,max_y;
66  double step_x,step_y;
67 
68  QVector<Vec2f> displayVertexList;
69  QVector<Vec4f> displayColorList;
70  QVector<Vec2f> displayTexCoordList;
71 };
72 
73 #endif // _STELVIEWPORTEFFECT_HPP_
74 
virtual void distortXY(float &x, float &y) const
Distort an x,y position according to the distortion.
virtual void paintViewportBuffer(const QOpenGLFramebufferObject *buf) const
Draw the viewport on the screen.
Allow to apply visual effects on the whole Stellarium viewport.
Contains all the param needed to initialize a StelProjector.
virtual void alterBuffer(QOpenGLFramebufferObject *) const
Alter the GL frame buffer, this method must not display anything.