some data structures <unfinished>
authorslack <slack@codemaniacs.com>
Sun, 10 Jan 2010 20:52:30 +0000 (21:52 +0100)
committerslack <slack@codemaniacs.com>
Sun, 10 Jan 2010 20:52:30 +0000 (21:52 +0100)
md5joint.cpp [new file with mode: 0644]
md5joint.h [new file with mode: 0644]
md5mesh.cpp [new file with mode: 0644]
md5mesh.h [new file with mode: 0644]
md5model.cpp [new file with mode: 0644]
md5model.h [new file with mode: 0644]
md5view.pro

diff --git a/md5joint.cpp b/md5joint.cpp
new file mode 100644 (file)
index 0000000..cefb377
--- /dev/null
@@ -0,0 +1,23 @@
+#include "md5joint.h"
+#include <cmath>
+
+MD5Joint::MD5Joint(QString name, int parent,
+                   float px, float py, float pz,
+                   float ox, float oy, float oz)
+{
+    this->name=name;
+    this->parent=parent;
+    position.x = px;
+    position.y = py;
+    position.z = pz;
+    orientation.x = ox;
+    orientation.y = oy;
+    orientation.z = oz;
+
+    float t = 1.0f-(ox*ox)-(oy*oy)-(oz*oz);
+    if (t<0.0f)
+        orientation.w = 0.0f;
+    else
+        orientation.w = -sqrtf(t);
+}
+
diff --git a/md5joint.h b/md5joint.h
new file mode 100644 (file)
index 0000000..72ad08f
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef MD5JOINT_H
+#define MD5JOINT_H
+
+#include <QString>
+#include "glm/glm.hpp"
+#include "glm/gtc/quaternion.hpp"
+
+
+class MD5Joint
+{
+public:
+    QString   name;
+    int       parent;
+    glm::vec3 position;
+    glm::quat orientation;
+
+    MD5Joint(QString name, int parent,
+             float px, float py, float pz,
+             float ox, float oy, float oz);
+};
+
+#endif // MD5JOINT_H
diff --git a/md5mesh.cpp b/md5mesh.cpp
new file mode 100644 (file)
index 0000000..d90adb2
--- /dev/null
@@ -0,0 +1,5 @@
+#include "md5mesh.h"
+
+MD5Mesh::MD5Mesh()
+{
+}
diff --git a/md5mesh.h b/md5mesh.h
new file mode 100644 (file)
index 0000000..461990d
--- /dev/null
+++ b/md5mesh.h
@@ -0,0 +1,14 @@
+#ifndef MD5MESH_H
+#define MD5MESH_H
+
+#include <QString>
+
+class MD5Mesh
+{
+public:
+    QString shader;
+
+    MD5Mesh();
+};
+
+#endif // MD5MESH_H
diff --git a/md5model.cpp b/md5model.cpp
new file mode 100644 (file)
index 0000000..7954c15
--- /dev/null
@@ -0,0 +1,5 @@
+#include "md5model.h"
+
+MD5Model::MD5Model()
+{
+}
diff --git a/md5model.h b/md5model.h
new file mode 100644 (file)
index 0000000..b02d158
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef MD5MODEL_H
+#define MD5MODEL_H
+
+#include <QString>
+#include <QVector>
+#include "md5joint.h"
+
+class MD5Model
+{
+    QVector<MD5Joint> joints;
+    QVector<MD5Mesh>  meshes;
+
+public:
+    MD5Model();
+};
+
+#endif // MD5MODEL_H
index 589322cf92514e323324d88838b6d6ecac8f45ba..c814c03ee7730422cbdf8ec5fa0e0421f6c6aaa7 100644 (file)
@@ -7,8 +7,12 @@ TEMPLATE = app
 SOURCES += main.cpp \
     mainwindow.cpp \
     viewerwidget.cpp \
-    md5model.cpp
+    md5model.cpp \
+    md5joint.cpp \
+    md5mesh.cpp
 HEADERS += mainwindow.h \
     viewerwidget.h \
-    md5model.h
+    md5model.h \
+    md5joint.h \
+    md5mesh.h
 FORMS += mainwindow.ui