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

This commit is contained in:
2015-12-09 15:44:03 +00:00
parent 64f21dc682
commit 458a516317
31 changed files with 1486 additions and 870 deletions

View File

@@ -20,10 +20,13 @@
#define GLVBO_H
#include "gltypes.h"
#include "chunkstream.h"
class GLVBO
{
friend class GLObjectBase;
friend QDataStream & operator <<(QDataStream & s, const GLVBO & m);
friend QDataStream & operator >>(QDataStream & s, GLVBO & m);
public:
GLVBO(GLenum usage = GL_DYNAMIC_DRAW);
~GLVBO();
@@ -64,4 +67,25 @@ private:
};
inline QDataStream & operator <<(QDataStream & s, const GLVBO & m) {
ChunkStream cs;
cs << cs.chunk(1, m.vertices_) << cs.chunk(2, m.normals_) << cs.chunk(3, m.texcoords_) << cs.chunk(4, m.colors_) << cs.chunk(5, m.usage);
s << cs.data(); return s;
}
inline QDataStream & operator >>(QDataStream & s, GLVBO & m) {
ChunkStream cs(s);
while (!cs.atEnd()) {
switch (cs.read()) {
case 1: m.vertices_ = cs.getData<QVector<GLfloat> >(); break;
case 2: m.normals_ = cs.getData<QVector<GLfloat> >(); break;
case 3: m.texcoords_ = cs.getData<QVector<GLfloat> >(); break;
case 4: m.colors_ = cs.getData<QVector<GLfloat> >(); break;
case 5: m.usage = cs.getData<GLenum>(); break;
}
}
m.changed = true;
return s;
}
#endif // GLVBO_H