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 QGLFramebufferObject;
//! @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() {return "framebufferOnly";} virtual QString getName() = 0;
//! Alter the GL frame buffer, this method must not display anything
. //! Apply the effect and draw the viewport.
//! The default implementation does nothing. //! This actually puts the result of rendering onto the screen.
virtual void alterBuffer(QGLFramebufferObject*) const {;} //!
//! Draw the viewport on the screen. //! @param renderer Renderer to draw with.
//! @param buf the GL frame buffer containing the Stellarium viewpor virtual void drawToViewport(class StelRenderer* renderer) = 0;
t alreay drawn.
//! The default implementation paints the buffer on the fullscreen.
virtual void paintViewportBuffer(const QGLFramebufferObject* buf) co
nst;
//! 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 screen_w,int screen_ StelViewportDistorterFisheyeToSphericMirror(int screenWidth, int scr
h); eenHeight,
class StelRenderer* rend
erer);
~StelViewportDistorterFisheyeToSphericMirror(); ~StelViewportDistorterFisheyeToSphericMirror();
virtual QString getName() {return "sphericMirrorDistorter";} virtual QString getName() {return "sphericMirrorDistorter";}
virtual void paintViewportBuffer(const QGLFramebufferObject* buf) co nst; virtual void drawToViewport(class StelRenderer* renderer);
virtual void distortXY(float& x, float& y) const; virtual void distortXY(float& x, float& y) const;
private: private:
const int screen_w;
const int screen_h; struct Vertex
{
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;
int viewport_texture_offset[2]; int viewportTextureOffset[2];
int texture_wh; int texture_wh;
Vec2f *texture_point_array; //! Maximum texture coordinates.
int max_x,max_y; //!
double step_x,step_y; //! These coordinates correspond to the extents of the used
//! part of the screen texture.
QVector<Vec2f> displayVertexList; QSizeF maxTexCoords;
QVector<Vec4f> displayColorList;
QVector<Vec2f> displayTexCoordList; //! 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. 
26 lines changed or deleted 80 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/