2022-09-19 13:30:03 +00:00
|
|
|
#ifndef DUST3D_APPLICATION_MODEL_OPENGL_OBJECT_H_
|
|
|
|
#define DUST3D_APPLICATION_MODEL_OPENGL_OBJECT_H_
|
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
#include "model_mesh.h"
|
2022-09-19 13:30:03 +00:00
|
|
|
#include <QMutex>
|
|
|
|
#include <QOpenGLBuffer>
|
2022-10-18 09:35:04 +00:00
|
|
|
#include <QOpenGLVertexArrayObject>
|
|
|
|
#include <memory>
|
2022-09-19 13:30:03 +00:00
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
class ModelOpenGLObject {
|
2022-09-19 13:30:03 +00:00
|
|
|
public:
|
2022-09-23 15:54:49 +00:00
|
|
|
void update(std::unique_ptr<ModelMesh> mesh);
|
2022-09-19 13:30:03 +00:00
|
|
|
void draw();
|
2022-10-18 09:35:04 +00:00
|
|
|
|
2022-09-19 13:30:03 +00:00
|
|
|
private:
|
|
|
|
void copyMeshToOpenGL();
|
|
|
|
QOpenGLVertexArrayObject m_vertexArrayObject;
|
|
|
|
QOpenGLBuffer m_buffer;
|
2022-09-23 15:54:49 +00:00
|
|
|
std::unique_ptr<ModelMesh> m_mesh;
|
2022-09-19 13:30:03 +00:00
|
|
|
bool m_meshIsDirty = false;
|
|
|
|
QMutex m_meshMutex;
|
|
|
|
int m_meshTriangleVertexCount = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|