1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #ifndef ESCAPETIMEVISUALWIDGET_H
- #define ESCAPETIMEVISUALWIDGET_H
- #include <QOpenGLWidget>
- #include "Bitmap.h"
- #include "Gradient.h"
- class QOpenGLShaderProgram;
- class EscapeTimeVisualWidget;
- class ETVImage
- {
- GLuint textureId;
- EscapeTimeVisualWidget& owner;
- public:
- ETVImage(EscapeTimeVisualWidget& owner,
- const Bitmap<float>& img);
- ~ETVImage(void);
- void draw(float x, float y, float w, float h,
- float tx = 0.0f, float ty = 0.0f,
- float tw = 1.0f, float th = 1.0f);
- };
- class EscapeTimeVisualWidget :
- public QOpenGLWidget
- {
- Q_OBJECT
- friend class ETVImage;
- QOpenGLShaderProgram* program;
- QOpenGLShaderProgram* renderTextures;
- QOpenGLShaderProgram* juliaPreviewer;
- GLuint gradientTextureId;
- float gradientTextureMax;
- float maxIterations;
- Gradient gradient;
- bool gradientNeedsUpdate;
- float resolutionX;
- float resolutionY;
- GLuint tileFramebuffer;
- GLuint tileTexture;
- public:
- EscapeTimeVisualWidget(QWidget* parent = nullptr);
- void setGradient(Gradient newGradient);
- const Gradient& getGradient(void);
- virtual void initializeGL(void) override;
- virtual void resizeGL(int w, int h) override;
- virtual void paintGL(void) override;
- void drawJulia(float jx, float jy);
- void setMaxIterationCutoff(float maxIter);
- void setResolutionX(int w);
- void setResolutionY(int h);
- int getResolutionX(void) const;
- int getResolutionY(void) const;
- private:
- void updateGradient(void);
- };
- #endif // ESCAPETIMEVISUALWIDGET_H
|