dust3d/application/sources/model_mesh_binder.h

76 lines
2.5 KiB
C
Raw Normal View History

#ifndef DUST3D_APPLICATION_MODEL_MESH_BINDER_H_
#define DUST3D_APPLICATION_MODEL_MESH_BINDER_H_
#include <QOpenGLVertexArrayObject>
#include <QMutex>
#include <QOpenGLBuffer>
#include <QString>
#include <QOpenGLTexture>
#include "model.h"
#include "model_shader_program.h"
class ModelMeshBinder
{
public:
2019-07-07 06:27:58 +00:00
ModelMeshBinder(bool toolEnabled=false);
~ModelMeshBinder();
Model *fetchCurrentMesh();
void updateMesh(Model *mesh);
2020-11-17 14:31:51 +00:00
void updateColorTexture(QImage *colorTextureImage);
void initialize();
void paint(ModelShaderProgram *program);
void cleanup();
void showWireframe();
void hideWireframe();
bool isWireframeVisible();
2019-08-09 22:27:26 +00:00
void enableCheckUv();
void disableCheckUv();
void enableEnvironmentLight();
bool isEnvironmentLightEnabled();
2019-08-09 22:27:26 +00:00
bool isCheckUvEnabled();
void reloadMesh();
void fetchCurrentToonNormalAndDepthMaps(QImage *normalMap, QImage *depthMap);
void updateToonNormalAndDepthMaps(QImage *normalMap, QImage *depthMap);
private:
Model *m_mesh = nullptr;
Model *m_newMesh = nullptr;
2019-07-07 06:27:58 +00:00
int m_renderTriangleVertexCount = 0;
int m_renderEdgeVertexCount = 0;
int m_renderToolVertexCount = 0;
bool m_newMeshComing = false;
bool m_showWireframe = false;
2019-07-07 06:27:58 +00:00
bool m_hasTexture = false;
QOpenGLTexture *m_texture = nullptr;
bool m_hasNormalMap = false;
QOpenGLTexture *m_normalMap = nullptr;
bool m_hasMetalnessMap = false;
bool m_hasRoughnessMap = false;
bool m_hasAmbientOcclusionMap = false;
QOpenGLTexture *m_metalnessRoughnessAmbientOcclusionMap = nullptr;
bool m_toolEnabled = false;
2019-08-09 22:27:26 +00:00
bool m_checkUvEnabled = false;
bool m_environmentLightEnabled = false;
QOpenGLTexture *m_environmentIrradianceMap = nullptr;
QOpenGLTexture *m_environmentSpecularMap = nullptr;
QOpenGLTexture *m_toonNormalMap = nullptr;
QOpenGLTexture *m_toonDepthMap = nullptr;
QImage *m_newToonNormalMap = nullptr;
QImage *m_newToonDepthMap = nullptr;
QImage *m_currentToonNormalMap = nullptr;
QImage *m_currentToonDepthMap = nullptr;
2020-11-17 14:31:51 +00:00
QImage *m_colorTextureImage = nullptr;
bool m_newToonMapsComing = false;
QOpenGLVertexArrayObject m_vaoTriangle;
QOpenGLBuffer m_vboTriangle;
QOpenGLVertexArrayObject m_vaoEdge;
QOpenGLBuffer m_vboEdge;
2019-07-07 06:27:58 +00:00
QOpenGLVertexArrayObject m_vaoTool;
QOpenGLBuffer m_vboTool;
QMutex m_meshMutex;
QMutex m_newMeshMutex;
QMutex m_toonNormalAndDepthMapMutex;
2020-11-17 14:31:51 +00:00
QMutex m_colorTextureMutex;
};
#endif