summaryrefslogtreecommitdiffstats
path: root/model.h
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-10-01 18:28:48 +0200
committerSamuel Rødal <sroedal@trolltech.com>2009-10-01 18:31:27 +0200
commit180996ae0031c3eb47079d5d9a11e32c81f91faa (patch)
tree48e4b04e37313bc2bdde48906af9b59272033314 /model.h
parent6dc84d85ea7d16057e6d298ee439f926414e765b (diff)
Port to Qt 4.6 etc...
Ported to use Qt 4.6's matrix and vector classes, as well as using QGLShaderProgram to make the OpenGL rendering code work both on desktop OpenGL and OpenGL ES 2.0 (the desktop version requires GLEW atm). Also added auto-walk toggler to improve navigation on a touchscreen device.
Diffstat (limited to 'model.h')
-rw-r--r--model.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/model.h b/model.h
index e79c9dd..5380b0d 100644
--- a/model.h
+++ b/model.h
@@ -30,8 +30,8 @@
#include <math.h>
-#include "point3d.h"
-#include "matrix4x4.h"
+#include <QMatrix4x4>
+#include <QVector3D>
class Model
{
@@ -40,25 +40,33 @@ public:
Model(const QString &filePath);
void render(bool wireframe = false, bool normals = false) const;
- void render(QPainter *painter, const Matrix4x4 &matrix, bool normals = false) const;
+ void render(QPainter *painter, const QMatrix4x4 &matrix, bool normals = false) const;
QString fileName() const { return m_fileName; }
int faces() const { return m_pointIndices.size() / 3; }
int edges() const { return m_edgeIndices.size() / 2; }
int points() const { return m_points.size(); }
- Point3d size() const;
+ QVector3D size() const;
private:
QString m_fileName;
- QVector<Point3d> m_points;
- QVector<Point3d> m_normals;
- QVector<int> m_edgeIndices;
- QVector<int> m_pointIndices;
- Point3d m_size;
+
+ QVector<QVector3D> m_points;
+ QVector<QVector3D> m_normals;
+
+#ifdef QT_OPENGL_ES_2
+ QVector<ushort> m_edgeIndices;
+ QVector<ushort> m_pointIndices;
+#else
+ QVector<uint> m_edgeIndices;
+ QVector<uint> m_pointIndices;
+#endif
+
+ QVector3D m_size;
mutable QVector<QLineF> m_lines;
- mutable QVector<Point3d> m_mapped;
+ mutable QVector<QVector3D> m_mapped;
};
#endif