Stellarium 0.11.1
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure
core/StelViewportEffect.hpp
00001 /*
00002  * Stellarium
00003  * Copyright (C) 2010 Fabien Chereau
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 #ifndef _STELVIEWPORTEFFECT_HPP_
00021 #define _STELVIEWPORTEFFECT_HPP_
00022 
00023 #include "VecMath.hpp"
00024 #include "StelProjector.hpp"
00025 
00026 class QGLFramebufferObject;
00027 
00030 class StelViewportEffect
00031 {
00032 public:
00033     StelViewportEffect() {;}
00034     virtual ~StelViewportEffect() {;}
00035     virtual QString getName() {return "framebufferOnly";}
00038     virtual void alterBuffer(QGLFramebufferObject*) const {;}
00042     virtual void paintViewportBuffer(const QGLFramebufferObject* buf) const;
00045     virtual void distortXY(float& x, float& y) const {Q_UNUSED(x); Q_UNUSED(y);}
00046 };
00047 
00048 
00049 class StelViewportDistorterFisheyeToSphericMirror : public StelViewportEffect
00050 {
00051 public:
00052     StelViewportDistorterFisheyeToSphericMirror(int screen_w,int screen_h);
00053     ~StelViewportDistorterFisheyeToSphericMirror();
00054     virtual QString getName() {return "sphericMirrorDistorter";}
00055     virtual void paintViewportBuffer(const QGLFramebufferObject* buf) const;
00056     virtual void distortXY(float& x, float& y) const;
00057 private:
00058     const int screen_w;
00059     const int screen_h;
00060     const StelProjector::StelProjectorParams originalProjectorParams;
00061     StelProjector::StelProjectorParams newProjectorParams;
00062     int viewport_texture_offset[2];
00063     int texture_wh;
00064 
00065     Vec2f *texture_point_array;
00066     int max_x,max_y;
00067     double step_x,step_y;
00068 
00069     QVector<Vec2f> displayVertexList;
00070     QVector<Vec4f> displayColorList;
00071     QVector<Vec2f> displayTexCoordList;
00072 };
00073 
00074 #endif // _STELVIEWPORTEFFECT_HPP_
00075