2022-09-19 13:30:03 +00:00
|
|
|
#ifndef DUST3D_APPLICATION_MODEL_OFFSCREEN_RENDER_H_
|
|
|
|
#define DUST3D_APPLICATION_MODEL_OFFSCREEN_RENDER_H_
|
|
|
|
|
|
|
|
#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-09-23 15:54:49 +00:00
|
|
|
#include "model_mesh.h"
|
2022-09-19 13:30:03 +00:00
|
|
|
|
|
|
|
class ModelOffscreenRender: public QOffscreenSurface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ModelOffscreenRender(const QSurfaceFormat &format, QScreen *targetScreen=Q_NULLPTR);
|
|
|
|
~ModelOffscreenRender();
|
|
|
|
void setXRotation(int angle);
|
|
|
|
void setYRotation(int angle);
|
|
|
|
void setZRotation(int angle);
|
|
|
|
void setEyePosition(const QVector3D &eyePosition);
|
|
|
|
void setMoveToPosition(const QVector3D &moveToPosition);
|
|
|
|
void setRenderThread(QThread *thread);
|
2022-09-23 15:54:49 +00:00
|
|
|
void updateMesh(ModelMesh *mesh);
|
2022-09-19 13:30:03 +00:00
|
|
|
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;
|
|
|
|
QOpenGLContext *m_context = nullptr;
|
|
|
|
QOpenGLFramebufferObject *m_renderFbo = nullptr;
|
|
|
|
ModelMesh *m_mesh = nullptr;
|
2022-09-19 13:30:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|