2022-09-19 13:30:03 +00:00
|
|
|
#ifndef DUST3D_APPLICATION_MODEL_OFFSCREEN_RENDER_H_
|
|
|
|
#define DUST3D_APPLICATION_MODEL_OFFSCREEN_RENDER_H_
|
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
#include "model_mesh.h"
|
2022-09-19 13:30:03 +00:00
|
|
|
#include <QOffscreenSurface>
|
2022-09-23 17:33:55 +00:00
|
|
|
#include <QOpenGLFramebufferObject>
|
2022-09-19 13:30:03 +00:00
|
|
|
#include <QSurfaceFormat>
|
|
|
|
#include <QVector3D>
|
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
class ModelOffscreenRender : public QOffscreenSurface {
|
2022-09-19 13:30:03 +00:00
|
|
|
public:
|
2022-10-18 09:35:04 +00:00
|
|
|
ModelOffscreenRender(const QSurfaceFormat& format, QScreen* targetScreen = Q_NULLPTR);
|
2022-09-19 13:30:03 +00:00
|
|
|
~ModelOffscreenRender();
|
|
|
|
void setXRotation(int angle);
|
|
|
|
void setYRotation(int angle);
|
|
|
|
void setZRotation(int angle);
|
2022-10-18 09:35:04 +00:00
|
|
|
void setEyePosition(const QVector3D& eyePosition);
|
|
|
|
void setMoveToPosition(const QVector3D& moveToPosition);
|
|
|
|
void setRenderThread(QThread* thread);
|
|
|
|
void updateMesh(ModelMesh* mesh);
|
|
|
|
QImage toImage(const QSize& size);
|
|
|
|
|
2022-09-23 17:33:55 +00:00
|
|
|
private:
|
|
|
|
int m_xRot = 0;
|
|
|
|
int m_yRot = 0;
|
|
|
|
int m_zRot = 0;
|
|
|
|
QVector3D m_eyePosition;
|
|
|
|
QVector3D m_moveToPosition;
|
2022-10-18 09:35:04 +00:00
|
|
|
QOpenGLContext* m_context = nullptr;
|
|
|
|
QOpenGLFramebufferObject* m_renderFbo = nullptr;
|
|
|
|
ModelMesh* m_mesh = nullptr;
|
2022-09-19 13:30:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|