diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-10-01 18:28:48 +0200 |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-10-01 18:31:27 +0200 |
commit | 180996ae0031c3eb47079d5d9a11e32c81f91faa (patch) | |
tree | 48e4b04e37313bc2bdde48906af9b59272033314 /model.h | |
parent | 6dc84d85ea7d16057e6d298ee439f926414e765b (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.h | 28 |
1 files changed, 18 insertions, 10 deletions
@@ -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 |