GeometryEngine.h 929 Bytes
Newer Older
Anakin's avatar
Anakin committed
1
#pragma once
Anakin's avatar
Anakin committed
2
#include "..\Header\FileInterface.h"
Anakin's avatar
Anakin committed
3
#include <QObject>
4 5 6
#include <QOpenGLFunctions>
#include <QOpenGLShaderProgram>
#include <QOpenGLBuffer>
Anakin's avatar
Anakin committed
7
#include <QOpenGLTexture>
Anakin's avatar
Anakin committed
8
#include <QVector>
9

Anakin's avatar
Anakin committed
10 11 12 13 14 15 16
struct DrawInformation {
	unsigned int offset;
	unsigned int size;
	unsigned int textureIndex;
	QMatrix4x4 modelMatrix;
};

Anakin's avatar
Anakin committed
17
class GeometryEngine : public QObject, protected QOpenGLFunctions
18
{
Anakin's avatar
Anakin committed
19 20
	Q_OBJECT

21
public:
22
	GeometryEngine(QObject *parent = Q_NULLPTR);
Anakin's avatar
Anakin committed
23
	virtual ~GeometryEngine();
24 25

private:
Anakin's avatar
Anakin committed
26 27 28
	QOpenGLBuffer m_arrayBuf;
	QOpenGLBuffer m_indexBuf;
	QVector<QOpenGLTexture*> m_textures;
Anakin's avatar
Anakin committed
29
	QVector<DrawInformation> m_drawList;
Anakin's avatar
Anakin committed
30
	BoundingBox m_boundings;
Anakin's avatar
Anakin committed
31

Anakin's avatar
Anakin committed
32
	void loadTexture(const char* filePath);
Anakin's avatar
Anakin committed
33
	void clearData();
Anakin's avatar
Anakin committed
34

Anakin's avatar
Anakin committed
35
public slots:
Anakin's avatar
Anakin committed
36
	void loadFile(const char* filePath);
Anakin's avatar
Anakin committed
37
	void drawGeometry(QOpenGLShaderProgram *program);
Anakin's avatar
Anakin committed
38 39 40

signals:
	void requestResetView();
41 42
	void sendMessage(QString message, int severity);
	void requestUpdate();
43 44
};