dust3d/application/sources/model_offscreen_render.h

51 lines
1.5 KiB
C
Raw Normal View History

#ifndef DUST3D_APPLICATION_MODEL_OFFSCREEN_RENDER_H_
#define DUST3D_APPLICATION_MODEL_OFFSCREEN_RENDER_H_
#include <QOffscreenSurface>
#include <QScreen>
#include <QOpenGLFunctions>
#include <QOpenGLContext>
#include <QImage>
#include <QThread>
2020-04-08 12:46:46 +00:00
#include <QOpenGLFramebufferObject>
#include "model_shader_program.h"
#include "model_mesh_binder.h"
#include "model.h"
class ModelOffscreenRender : QOffscreenSurface
{
public:
ModelOffscreenRender(const QSurfaceFormat &format, QScreen *targetScreen=Q_NULLPTR);
~ModelOffscreenRender();
void setXRotation(int angle);
void setYRotation(int angle);
void setZRotation(int angle);
2020-04-13 13:25:04 +00:00
void setEyePosition(const QVector3D &eyePosition);
void setMoveToPosition(const QVector3D &moveToPosition);
void setRenderPurpose(int purpose);
void setRenderThread(QThread *thread);
void enableWireframe();
void enableEnvironmentLight();
void updateMesh(Model *mesh);
void updateToonNormalAndDepthMaps(QImage *normalMap, QImage *depthMap);
void setToonShading(bool toonShading);
QImage toImage(const QSize &size);
private:
int m_xRot = 0;
int m_yRot = 0;
int m_zRot = 0;
2020-04-13 13:25:04 +00:00
QVector3D m_eyePosition;
QVector3D m_moveToPosition;
int m_renderPurpose = 0;
QOpenGLContext *m_context = nullptr;
2020-04-08 12:46:46 +00:00
QOpenGLFramebufferObject *m_renderFbo = nullptr;
Model *m_mesh = nullptr;
QImage *m_normalMap = nullptr;
QImage *m_depthMap = nullptr;
bool m_toonShading = false;
bool m_isWireframeVisible = false;
bool m_isEnvironmentLightEnabled = false;
};
#endif