StelViewportEffect.hpp   StelViewportEffect.hpp 
skipping to change at line 23 skipping to change at line 23
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _STELVIEWPORTEFFECT_HPP_ #ifndef _STELVIEWPORTEFFECT_HPP_
#define _STELVIEWPORTEFFECT_HPP_ #define _STELVIEWPORTEFFECT_HPP_
#include <QSizeF>
#include "VecMath.hpp" #include "VecMath.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "renderer/StelVertexAttribute.hpp"
#include "renderer/StelVertexBuffer.hpp"
class QGLFramebufferObject; class QOpenGLFramebufferObject;
//! @class StelViewportEffect //! @class StelViewportEffect
//! Allow to apply visual effects on the whole Stellarium viewport. //! Allow to apply visual effects on the whole Stellarium viewport.
class StelViewportEffect class StelViewportEffect
{ {
public: public:
StelViewportEffect() {;}
virtual ~StelViewportEffect() {;} virtual ~StelViewportEffect() {;}
virtual QString getName() = 0; virtual QString getName() {return "framebufferOnly";}
//! Alter the GL frame buffer, this method must not display anything
//! Apply the effect and draw the viewport. .
//! This actually puts the result of rendering onto the screen. //! The default implementation does nothing.
//! virtual void alterBuffer(QOpenGLFramebufferObject*) const {;}
//! @param renderer Renderer to draw with. //! Draw the viewport on the screen.
virtual void drawToViewport(class StelRenderer* renderer) = 0; //! @param buf the GL frame buffer containing the Stellarium viewpor
t alreay drawn.
//! The default implementation paints the buffer on the fullscreen.
virtual void paintViewportBuffer(const QOpenGLFramebufferObject* buf
) const;
//! Distort an x,y position according to the distortion. //! Distort an x,y position according to the distortion.
//! The default implementation does nothing. //! The default implementation does nothing.
virtual void distortXY(float& x, float& y) const {Q_UNUSED(x); Q_UNU SED(y);} virtual void distortXY(float& x, float& y) const {Q_UNUSED(x); Q_UNU SED(y);}
}; };
class StelViewportDistorterFisheyeToSphericMirror : public StelViewportEffe ct class StelViewportDistorterFisheyeToSphericMirror : public StelViewportEffe ct
{ {
public: public:
StelViewportDistorterFisheyeToSphericMirror(int screenWidth, int scr StelViewportDistorterFisheyeToSphericMirror(int screen_w,int screen_
eenHeight, h);
class StelRenderer* rend
erer);
~StelViewportDistorterFisheyeToSphericMirror(); ~StelViewportDistorterFisheyeToSphericMirror();
virtual QString getName() {return "sphericMirrorDistorter";} virtual QString getName() {return "sphericMirrorDistorter";}
virtual void drawToViewport(class StelRenderer* renderer); virtual void paintViewportBuffer(const QOpenGLFramebufferObject* buf ) const;
virtual void distortXY(float& x, float& y) const; virtual void distortXY(float& x, float& y) const;
private: private:
const int screen_w;
struct Vertex const int screen_h;
{
Vec2f position;
Vec2f texCoord;
Vec4f color;
VERTEX_ATTRIBUTES(Vec2f Position, Vec2f TexCoord, Vec4f Colo
r);
};
const int screenWidth;
const int screenHeight;
const StelProjector::StelProjectorParams originalProjectorParams; const StelProjector::StelProjectorParams originalProjectorParams;
StelProjector::StelProjectorParams newProjectorParams; StelProjector::StelProjectorParams newProjectorParams;
// Dimensions of the auxiliary mirror texture (used to be texture_wh int viewport_texture_offset[2];
, int texture_wh;
// because the texture used to be square); now used for convenience.
--BM Vec2f *texture_point_array;
int texture_w; int max_x,max_y;
int texture_h; double step_x,step_y;
//! Maximum texture coordinates. QVector<Vec2f> displayVertexList;
//! QVector<Vec4f> displayColorList;
//! These coordinates correspond to the extents of the used QVector<Vec2f> displayTexCoordList;
//! part of the screen texture.
QSizeF maxTexCoords;
//! Grid of texture coordinates used to distort mouse coordinates (d
istortXY)
//!
//! These are identical to texture coordinates in vertexGrid but sto
red here
//! for fast access (as vertexGrid might be in GPU memory).
Vec2f* texCoordGrid;
int maxGridX,maxGridY;
double stepX,stepY;
//! Vertices of the grid.
StelVertexBuffer<Vertex>* vertexGrid;
//! Indices specifying triangle strips representing rows of the grid
.
QVector<class StelIndexBuffer*> stripBuffers;
void constructVertexBuffer(StelRenderer* renderer);
void generateDistortion(const class QSettings& conf, const StelProje
ctorP& proj,
const double distorterMaxFOV, class StelRend
erer* renderer);
//! Load parameters of distortion generation.
//!
//! Used by generateDistortion.
//!
//! @param conf Configuration to load the parameters from.
//! @param gamma Gamma correction of the viewport effect will be out
put here.
void loadGenerationParameters(const QSettings& conf, double& gamma);
bool loadDistortionFromFile(const QString & fileName, class StelRend
erer *renderer);
//! Recalculate texture coordinates.
//!
//! Screen texture might be larger than the screen
//! if power-of-two textures are required.
//! In such cases, we need to adjust texture coordinates
//! every time screen size is changed.
//!
//! @param newMaxTexCoords New maximum texture coordinates.
//! These coordinates correspond to the extents of the used
//! part of the screen texture.
void recalculateTexCoords(const QSizeF newMaxTexCoords);
}; };
#endif // _STELVIEWPORTEFFECT_HPP_ #endif // _STELVIEWPORTEFFECT_HPP_
 End of changes. 10 change blocks. 
87 lines changed or deleted 29 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/