mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-21 21:20:07 -05:00
26c558a2f5
-Give tabs a height of 4px in the qss files. Looks a little large on 4k screens, but just right on HD screens which are much more common. -Allow for styling of zero and non-zero variation tree nodes via qss. -Allow for toggling whether to interpolate between colors in the palette editor, or to do hard cuts between colors. -Allow for adjusting spinner values with the + = or up arrow keys to increase, and - _ or down arrow keys to decrease. -Allow for responding to global presses of + = and - _ to cycle up or down to specify which xform is set as the current one. -Allow for adding "layers" via xaos which will add a user-specified number of xforms, and set certain xaos values to 0 or 1. -Add a new menu item under the Edit menu to copy the OpenCL iteration kernel source to the clipboard. -Show text on the status bar which indicates that an OpenCL kernel compilation is taking place. -Show xform name on xform combo box when expanded. Adjust size to fit all names. -Draw post affine circles using dashed lines. -Prevent QSS dialog from styling its editor, which makes it easier to see text when creating styles which have custom colors for text boxes. --Bug fixes -Fix up some table layouts which seemed to have regressed/decayed over time for reasons unknown. -Using undo/redo would create a new flame in the library every time. -Solo was not being preserved when using undo/redo. --Code changes -Make the solo flag be a part of the flame data now. -Fix some tabification in the OpenCL code for EllipticVariation. -Fix tabification in the varState code for OpenCL. -Add an event called m_CompileBegun to RendererCL that is called right before an OpenCL compile is begun. --This required making RendererCLBase not a pure virtual base class. Member functions just return defaults. -Filter key presses on main window to only process the third one. This is due to Qt triggering three events for every key press. -The palette preview table was installing an event filter for seemingly no reason. Remove it. -Mark certain virtual functions as override in SpinBox and DoubleSpinBox.
116 lines
3.7 KiB
C++
116 lines
3.7 KiB
C++
#pragma once
|
|
|
|
#include "FractoriumEmberController.h"
|
|
|
|
/// <summary>
|
|
/// GLWidget class.
|
|
/// </summary>
|
|
|
|
class Fractorium;//Forward declaration since Fractorium uses this widget.
|
|
class GLEmberControllerBase;
|
|
template<typename T> class GLEmberController;
|
|
template<typename T> class FractoriumEmberController;
|
|
|
|
/// <summary>
|
|
/// The main drawing area.
|
|
/// This uses the Qt wrapper around OpenGL to draw the output of the render to a texture whose
|
|
/// size matches the size of the window.
|
|
/// On top of that, the circles that represent the pre and post affine transforms for each xform are drawn.
|
|
/// Based on values specified on the GUI, it will either draw the presently selected xform, or all of them.
|
|
/// It can show/hide pre/post affine as well.
|
|
/// The currently selected xform is drawn with a circle around it, with all others only showing their axes.
|
|
/// The current xform is set by either clicking on it, or by changing the index of the xforms combo box on the main window.
|
|
/// A problem here is that all drawing is done using the legacy OpenGL fixed function pipeline which is deprecated
|
|
/// and even completely disabled on Mac OS. This will need to be replaced with shader programs for every draw operation.
|
|
/// Since this window has to know about various states of the renderer and the main window, it retains pointers to
|
|
/// the main window and several of its members.
|
|
/// This class uses a controller-based design similar to the main window.
|
|
/// </summary>
|
|
class GLWidget : public QOpenGLWidget, protected
|
|
#ifdef USE_GLSL
|
|
QOpenGLFunctions
|
|
#else
|
|
QOpenGLFunctions_2_0
|
|
#endif
|
|
{
|
|
Q_OBJECT
|
|
|
|
friend Fractorium;
|
|
friend FractoriumEmberController<float>;
|
|
friend GLEmberControllerBase;
|
|
friend GLEmberController<float>;
|
|
|
|
#ifdef DO_DOUBLE
|
|
friend GLEmberController<double>;
|
|
friend FractoriumEmberController<double>;
|
|
#endif
|
|
|
|
public:
|
|
GLWidget(QWidget* p = nullptr);
|
|
~GLWidget();
|
|
void InitGL();
|
|
void DrawQuad();
|
|
void SetMainWindow(Fractorium* f);
|
|
bool Init();
|
|
bool Drawing();
|
|
GLint MaxTexSize();
|
|
GLuint OutputTexID();
|
|
|
|
protected:
|
|
virtual void initializeGL() override;
|
|
virtual void paintGL() override;
|
|
virtual void keyPressEvent(QKeyEvent* e) override;
|
|
virtual void keyReleaseEvent(QKeyEvent* e) override;
|
|
virtual void mousePressEvent(QMouseEvent* e) override;
|
|
virtual void mouseReleaseEvent(QMouseEvent* e) override;
|
|
virtual void mouseMoveEvent(QMouseEvent* e) override;
|
|
virtual void wheelEvent(QWheelEvent* e) override;
|
|
|
|
void DrawPointOrLine(const QVector4D& col, const GLfloat* vertices, int size, int drawType, bool dashed = false, GLfloat pointSize = 1.0f);
|
|
void DrawPointOrLine(const QVector4D& col, const std::vector<float>& vertices, int drawType, bool dashed = false, GLfloat pointSize = 1.0f);
|
|
|
|
private:
|
|
void SetDimensions(int w, int h);
|
|
bool Allocate(bool force = false);
|
|
bool Deallocate();
|
|
void SetViewport();
|
|
void DrawUnitSquare();
|
|
void DrawAffineHelper(int index, bool selected, bool pre, bool final, bool background);
|
|
GLEmberControllerBase* GLController();
|
|
|
|
bool m_Init = false;
|
|
bool m_Drawing = false;
|
|
GLint m_MaxTexSize = 16384;
|
|
GLint m_TexWidth = 0;
|
|
GLint m_TexHeight = 0;
|
|
GLint m_ViewWidth = 0;
|
|
GLint m_ViewHeight = 0;
|
|
GLuint m_OutputTexID = 0;
|
|
#ifdef USE_GLSL
|
|
GLuint m_PosAttr;
|
|
GLuint m_ColAttr;
|
|
GLuint m_PointSizeUniform;
|
|
GLuint m_MatrixUniform;
|
|
GLuint m_TexturePosAttr;
|
|
GLuint m_TextureUniform;
|
|
GLuint m_TextureMatrixUniform;
|
|
glm::ivec4 m_Viewport;
|
|
QMatrix4x4 m_ProjMatrix;
|
|
QMatrix4x4 m_ModelViewMatrix;
|
|
QMatrix4x4 m_ModelViewProjectionMatrix;
|
|
QMatrix4x4 m_TextureProjMatrix;
|
|
vector<float> m_Verts;
|
|
std::array<GLfloat, 10> m_TexVerts = std::array<GLfloat, 10>
|
|
{
|
|
0, 0,
|
|
0, 1,
|
|
1, 1,
|
|
1, 0,
|
|
0, 0
|
|
};
|
|
QOpenGLShaderProgram* m_Program = nullptr;
|
|
QOpenGLShaderProgram* m_QuadProgram = nullptr;
|
|
#endif
|
|
Fractorium* m_Fractorium = nullptr;
|
|
};
|