dust3d/application/sources/model_offscreen_render.h

35 lines
1.0 KiB
C
Raw Normal View History

2022-09-19 13:30:03 +00:00
#ifndef DUST3D_APPLICATION_MODEL_OFFSCREEN_RENDER_H_
#define DUST3D_APPLICATION_MODEL_OFFSCREEN_RENDER_H_
#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>
class ModelOffscreenRender : public QOffscreenSurface {
2022-09-19 13:30:03 +00:00
public:
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);
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;
QOpenGLContext* m_context = nullptr;
QOpenGLFramebufferObject* m_renderFbo = nullptr;
ModelMesh* m_mesh = nullptr;
2022-09-19 13:30:03 +00:00
};
#endif