git-svn-id: svn://db.shs.com.ru/libs@627 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2019-11-22 20:22:30 +00:00
parent 09248aae34
commit e65ee56ee4
21 changed files with 527 additions and 208 deletions

View File

@@ -32,7 +32,7 @@ class Mesh
friend QDataStream & operator <<(QDataStream & s, const Mesh * m);
friend QDataStream & operator >>(QDataStream & s, Mesh *& m);
public:
Mesh();
Mesh(GLenum geom_type_ = GL_TRIANGLES);
~Mesh();
Mesh * clone();
@@ -50,6 +50,7 @@ public:
int verticesCount() const {return vertices_.size();}
int trianglesCount() const {return triangles_.size();}
int linesCount() const {return lines_.size();}
bool isInit() const {return vao != 0;}
bool isEmpty() const {return vertices_.isEmpty();}
uint hash() const;
@@ -57,10 +58,12 @@ public:
QVector<QVector3D> & vertices () {changed = hash_changed = true; return vertices_;}
QVector<QVector3D> & normals () {changed = hash_changed = true; return normals_;}
QVector<QVector2D> & texcoords() {changed = hash_changed = true; return texcoords_;}
QVector< Vector3i> & indices () {changed = hash_changed = true; return triangles_;}
QVector< Vector3i> & indicesTriangles() {changed = hash_changed = true; return triangles_;}
QVector< Vector2i> & indicesLines () {changed = hash_changed = true; return lines_;}
void translatePoints(const QVector3D & dp);
void scalePoints (const QVector3D & dp);
void scalePoints (const double & s) {scalePoints(QVector3D(s, s, s));}
void append(const Mesh * m);
bool saveToFile(const QString & filename);
@@ -80,9 +83,10 @@ private:
QVector<QVector3D> vertices_, normals_, tangents_, bitangents_;
QVector<QVector2D> texcoords_;
QVector< Vector3i> triangles_;
QVector< Vector2i> lines_;
QVector<QGLEngineShaders::Vertex> data_;
GLenum vao;
GLenum vao, geom_type;
Buffer buffer_geom, buffer_ind, buffer_obj, buffer_sel;
mutable uint hash_;
mutable bool hash_changed;