2018-03-10 06:57:14 +00:00
|
|
|
#ifndef MESH_H
|
|
|
|
#define MESH_H
|
|
|
|
#include <QObject>
|
|
|
|
#include <QOpenGLFunctions>
|
2018-03-20 07:56:49 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <QVector3D>
|
2018-03-10 06:57:14 +00:00
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GLfloat posX;
|
|
|
|
GLfloat posY;
|
|
|
|
GLfloat posZ;
|
|
|
|
GLfloat normX;
|
|
|
|
GLfloat normY;
|
|
|
|
GLfloat normZ;
|
2018-03-19 13:56:10 +00:00
|
|
|
GLfloat colorR;
|
|
|
|
GLfloat colorG;
|
|
|
|
GLfloat colorB;
|
2018-03-10 06:57:14 +00:00
|
|
|
} Vertex;
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
class Mesh
|
|
|
|
{
|
|
|
|
public:
|
2018-03-19 13:56:10 +00:00
|
|
|
Mesh(void *meshlite, int meshId);
|
2018-03-10 06:57:14 +00:00
|
|
|
~Mesh();
|
2018-03-19 13:56:10 +00:00
|
|
|
Vertex *triangleVertices();
|
|
|
|
int triangleVertexCount();
|
|
|
|
Vertex *edgeVertices();
|
|
|
|
int edgeVertexCount();
|
2018-03-20 07:56:49 +00:00
|
|
|
const std::vector<QVector3D> &vertices();
|
|
|
|
const std::vector<std::vector<int>> &faces();
|
2018-03-10 06:57:14 +00:00
|
|
|
private:
|
2018-03-19 13:56:10 +00:00
|
|
|
Vertex *m_triangleVertices;
|
|
|
|
int m_triangleVertexCount;
|
|
|
|
Vertex *m_edgeVertices;
|
|
|
|
int m_edgeVertexCount;
|
2018-03-20 07:56:49 +00:00
|
|
|
std::vector<QVector3D> m_vertices;
|
|
|
|
std::vector<std::vector<int>> m_faces;
|
2018-03-10 06:57:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|