From f4a4c6340ba27a9dafe899dadd6ffbc585dd7c63 Mon Sep 17 00:00:00 2001 From: slack Date: Sun, 10 Jan 2010 21:52:30 +0100 Subject: [PATCH] some data structures --- md5joint.cpp | 23 +++++++++++++++++++++++ md5joint.h | 22 ++++++++++++++++++++++ md5mesh.cpp | 5 +++++ md5mesh.h | 14 ++++++++++++++ md5model.cpp | 5 +++++ md5model.h | 17 +++++++++++++++++ md5view.pro | 8 ++++++-- 7 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 md5joint.cpp create mode 100644 md5joint.h create mode 100644 md5mesh.cpp create mode 100644 md5mesh.h create mode 100644 md5model.cpp create mode 100644 md5model.h diff --git a/md5joint.cpp b/md5joint.cpp new file mode 100644 index 0000000..cefb377 --- /dev/null +++ b/md5joint.cpp @@ -0,0 +1,23 @@ +#include "md5joint.h" +#include + +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 index 0000000..72ad08f --- /dev/null +++ b/md5joint.h @@ -0,0 +1,22 @@ +#ifndef MD5JOINT_H +#define MD5JOINT_H + +#include +#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 index 0000000..d90adb2 --- /dev/null +++ b/md5mesh.cpp @@ -0,0 +1,5 @@ +#include "md5mesh.h" + +MD5Mesh::MD5Mesh() +{ +} diff --git a/md5mesh.h b/md5mesh.h new file mode 100644 index 0000000..461990d --- /dev/null +++ b/md5mesh.h @@ -0,0 +1,14 @@ +#ifndef MD5MESH_H +#define MD5MESH_H + +#include + +class MD5Mesh +{ +public: + QString shader; + + MD5Mesh(); +}; + +#endif // MD5MESH_H diff --git a/md5model.cpp b/md5model.cpp new file mode 100644 index 0000000..7954c15 --- /dev/null +++ b/md5model.cpp @@ -0,0 +1,5 @@ +#include "md5model.h" + +MD5Model::MD5Model() +{ +} diff --git a/md5model.h b/md5model.h new file mode 100644 index 0000000..b02d158 --- /dev/null +++ b/md5model.h @@ -0,0 +1,17 @@ +#ifndef MD5MODEL_H +#define MD5MODEL_H + +#include +#include +#include "md5joint.h" + +class MD5Model +{ + QVector joints; + QVector meshes; + +public: + MD5Model(); +}; + +#endif // MD5MODEL_H diff --git a/md5view.pro b/md5view.pro index 589322c..c814c03 100644 --- a/md5view.pro +++ b/md5view.pro @@ -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 -- 2.34.1