mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-21 21:20:07 -05:00
9e94170a70
--User Changes Size is no longer fixed to the window size. Size scaling is done differently in the final render dialog. This fixes several bugs. Remove Xml saving size from settings and options dialog, it no longer applies. Final render can be broken into strips. Set default save path to the desktop if none is found in the settings file. Set default output size to 1920x1080 if none is found in the settings file. --Bug Fixes Better memory size reporting in final render dialog. --Code Changes Migrate to C++11, Qt 5.3.1, and Visual Studio 2013. Change most instances of unsigned int to size_t, and int to intmax_t. Add m_OrigPixPerUnit and m_ScaleType to Ember for scaling purposes. Replace some sprintf_s() calls in XmlToEmber with ostringstream. Move more non-templated members into RendererBase. Add CopyVec() overload that takes a per element function pointer. Add vector Memset(). Replace '&' with '+' instead of "&" in XmlToEmber for much faster parsing. Break strips rendering out into EmberCommon and call from EmberRender and Fractorium. Make AddAndWriteBuffer() just call WriteBuffer(). Make AddAndWriteImage() delete the existing image first before replacing it. Add SetOutputTexture() to RendererCL to support making new textures in response to resize events. Remove multiple return statements in RendererCL, and replace with a bool that tracks results. Add ToDouble(), MakeEnd(), ToString() and Exists() wrappers in Fractorium. Add Size() wrapper in EmberFile. Make QString function arguments const QString&, and string with const string&. Make ShowCritical() wrapper for invoking a message box from another thread. Add combo box to TwoButtonWidget and rename.
80 lines
2.8 KiB
C++
80 lines
2.8 KiB
C++
#pragma once
|
|
|
|
#include "FractoriumEmberController.h"
|
|
|
|
/// <summary>
|
|
/// GLWidget class.
|
|
/// </summary>
|
|
|
|
class Fractorium;//Forward declaration since Fractorium uses this widget.
|
|
|
|
static const float GridStep = 1.0f / 8.0f;
|
|
|
|
/// <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 QGLWidget, protected QOpenGLFunctions_2_0//QOpenGLFunctions_3_2_Compatibility//QOpenGLFunctions_3_2_Core//, protected QOpenGLFunctions
|
|
{
|
|
Q_OBJECT
|
|
|
|
friend Fractorium;
|
|
friend FractoriumEmberController<float>;
|
|
friend FractoriumEmberController<double>;
|
|
friend GLEmberControllerBase;
|
|
friend GLEmberController<float>;
|
|
friend GLEmberController<double>;
|
|
|
|
public:
|
|
GLWidget(QWidget* parent);
|
|
~GLWidget();
|
|
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;
|
|
virtual void resizeEvent(QResizeEvent* e) override;
|
|
|
|
private:
|
|
void SetDimensions(int w, int h);
|
|
bool Allocate(bool force = false);
|
|
bool Deallocate();
|
|
void SetViewport();
|
|
void DrawGrid();
|
|
void DrawUnitSquare();
|
|
void DrawAffineHelper(int index, bool selected, bool pre, bool final, bool background);
|
|
GLEmberControllerBase* GLController();
|
|
|
|
bool m_Init;
|
|
bool m_Drawing;
|
|
GLint m_MaxTexSize;
|
|
GLint m_TexWidth;
|
|
GLint m_TexHeight;
|
|
GLint m_ViewWidth;
|
|
GLint m_ViewHeight;
|
|
GLuint m_OutputTexID;
|
|
Fractorium* m_Fractorium;
|
|
};
|