md5mesh file parser should work now master
authorslack <slack@codemaniacs.com>
Mon, 11 Jan 2010 03:16:43 +0000 (04:16 +0100)
committerslack <slack@codemaniacs.com>
Mon, 11 Jan 2010 03:16:43 +0000 (04:16 +0100)
14 files changed:
Makefile [deleted file]
mainwindow.ui
md5joint.h
md5mesh.h
md5model.cpp
md5model.h
md5tri.h [new file with mode: 0644]
md5triangle.h [new file with mode: 0644]
md5vertex.h [new file with mode: 0644]
md5view.pro
md5view.pro.user
md5weight.h [new file with mode: 0644]
viewerwidget.cpp
viewerwidget.h

diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 4aaff0a..0000000
--- a/Makefile
+++ /dev/null
@@ -1,224 +0,0 @@
-#############################################################################
-# Makefile for building: md5view
-# Generated by qmake (2.01a) (Qt 4.5.2) on: Sun Jan 10 04:17:42 2010
-# Project:  md5view.pro
-# Template: app
-# Command: /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile md5view.pro
-#############################################################################
-
-####### Compiler, tools and options
-
-CC            = gcc
-CXX           = g++
-DEFINES       = -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
-CFLAGS        = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
-CXXFLAGS      = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
-INCPATH       = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I/usr/X11R6/include -I. -I.
-LINK          = g++
-LFLAGS        = 
-LIBS          = $(SUBLIBS)  -L/usr/lib -L/usr/X11R6/lib -lQtOpenGL -lQtGui -lQtCore -lGLU -lGL -lpthread
-AR            = ar cqs
-RANLIB        = 
-QMAKE         = /usr/bin/qmake-qt4
-TAR           = tar -cf
-COMPRESS      = gzip -9f
-COPY          = cp -f
-SED           = sed
-COPY_FILE     = $(COPY)
-COPY_DIR      = $(COPY) -r
-INSTALL_FILE  = install -m 644 -p
-INSTALL_DIR   = $(COPY_DIR)
-INSTALL_PROGRAM = install -m 755 -p
-DEL_FILE      = rm -f
-SYMLINK       = ln -sf
-DEL_DIR       = rmdir
-MOVE          = mv -f
-CHK_DIR_EXISTS= test -d
-MKDIR         = mkdir -p
-
-####### Output directory
-
-OBJECTS_DIR   = ./
-
-####### Files
-
-SOURCES       = main.cpp \
-               mainwindow.cpp \
-               viewerwidget.cpp moc_mainwindow.cpp
-OBJECTS       = main.o \
-               mainwindow.o \
-               viewerwidget.o \
-               moc_mainwindow.o
-DIST          = /usr/share/qt4/mkspecs/common/g++.conf \
-               /usr/share/qt4/mkspecs/common/unix.conf \
-               /usr/share/qt4/mkspecs/common/linux.conf \
-               /usr/share/qt4/mkspecs/qconfig.pri \
-               /usr/share/qt4/mkspecs/features/qt_functions.prf \
-               /usr/share/qt4/mkspecs/features/qt_config.prf \
-               /usr/share/qt4/mkspecs/features/exclusive_builds.prf \
-               /usr/share/qt4/mkspecs/features/default_pre.prf \
-               /usr/share/qt4/mkspecs/features/debug.prf \
-               /usr/share/qt4/mkspecs/features/default_post.prf \
-               /usr/share/qt4/mkspecs/features/warn_on.prf \
-               /usr/share/qt4/mkspecs/features/qt.prf \
-               /usr/share/qt4/mkspecs/features/unix/opengl.prf \
-               /usr/share/qt4/mkspecs/features/unix/thread.prf \
-               /usr/share/qt4/mkspecs/features/moc.prf \
-               /usr/share/qt4/mkspecs/features/resources.prf \
-               /usr/share/qt4/mkspecs/features/uic.prf \
-               /usr/share/qt4/mkspecs/features/yacc.prf \
-               /usr/share/qt4/mkspecs/features/lex.prf \
-               /usr/share/qt4/mkspecs/features/include_source_dir.prf \
-               md5view.pro
-QMAKE_TARGET  = md5view
-DESTDIR       = 
-TARGET        = md5view
-
-first: all
-####### Implicit rules
-
-.SUFFIXES: .o .c .cpp .cc .cxx .C
-
-.cpp.o:
-       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
-
-.cc.o:
-       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
-
-.cxx.o:
-       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
-
-.C.o:
-       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
-
-.c.o:
-       $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
-
-####### Build rules
-
-all: Makefile $(TARGET)
-
-$(TARGET): ui_mainwindow.h $(OBJECTS)  
-       $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
-
-Makefile: md5view.pro  /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
-               /usr/share/qt4/mkspecs/common/unix.conf \
-               /usr/share/qt4/mkspecs/common/linux.conf \
-               /usr/share/qt4/mkspecs/qconfig.pri \
-               /usr/share/qt4/mkspecs/features/qt_functions.prf \
-               /usr/share/qt4/mkspecs/features/qt_config.prf \
-               /usr/share/qt4/mkspecs/features/exclusive_builds.prf \
-               /usr/share/qt4/mkspecs/features/default_pre.prf \
-               /usr/share/qt4/mkspecs/features/debug.prf \
-               /usr/share/qt4/mkspecs/features/default_post.prf \
-               /usr/share/qt4/mkspecs/features/warn_on.prf \
-               /usr/share/qt4/mkspecs/features/qt.prf \
-               /usr/share/qt4/mkspecs/features/unix/opengl.prf \
-               /usr/share/qt4/mkspecs/features/unix/thread.prf \
-               /usr/share/qt4/mkspecs/features/moc.prf \
-               /usr/share/qt4/mkspecs/features/resources.prf \
-               /usr/share/qt4/mkspecs/features/uic.prf \
-               /usr/share/qt4/mkspecs/features/yacc.prf \
-               /usr/share/qt4/mkspecs/features/lex.prf \
-               /usr/share/qt4/mkspecs/features/include_source_dir.prf \
-               /usr/lib/libQtOpenGL.prl \
-               /usr/lib/libQtGui.prl \
-               /usr/lib/libQtCore.prl
-       $(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile md5view.pro
-/usr/share/qt4/mkspecs/common/g++.conf:
-/usr/share/qt4/mkspecs/common/unix.conf:
-/usr/share/qt4/mkspecs/common/linux.conf:
-/usr/share/qt4/mkspecs/qconfig.pri:
-/usr/share/qt4/mkspecs/features/qt_functions.prf:
-/usr/share/qt4/mkspecs/features/qt_config.prf:
-/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
-/usr/share/qt4/mkspecs/features/default_pre.prf:
-/usr/share/qt4/mkspecs/features/debug.prf:
-/usr/share/qt4/mkspecs/features/default_post.prf:
-/usr/share/qt4/mkspecs/features/warn_on.prf:
-/usr/share/qt4/mkspecs/features/qt.prf:
-/usr/share/qt4/mkspecs/features/unix/opengl.prf:
-/usr/share/qt4/mkspecs/features/unix/thread.prf:
-/usr/share/qt4/mkspecs/features/moc.prf:
-/usr/share/qt4/mkspecs/features/resources.prf:
-/usr/share/qt4/mkspecs/features/uic.prf:
-/usr/share/qt4/mkspecs/features/yacc.prf:
-/usr/share/qt4/mkspecs/features/lex.prf:
-/usr/share/qt4/mkspecs/features/include_source_dir.prf:
-/usr/lib/libQtOpenGL.prl:
-/usr/lib/libQtGui.prl:
-/usr/lib/libQtCore.prl:
-qmake:  FORCE
-       @$(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile md5view.pro
-
-dist: 
-       @$(CHK_DIR_EXISTS) .tmp/md5view1.0.0 || $(MKDIR) .tmp/md5view1.0.0 
-       $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/md5view1.0.0/ && $(COPY_FILE) --parents mainwindow.h viewerwidget.h .tmp/md5view1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp viewerwidget.cpp .tmp/md5view1.0.0/ && $(COPY_FILE) --parents mainwindow.ui .tmp/md5view1.0.0/ && (cd `dirname .tmp/md5view1.0.0` && $(TAR) md5view1.0.0.tar md5view1.0.0 && $(COMPRESS) md5view1.0.0.tar) && $(MOVE) `dirname .tmp/md5view1.0.0`/md5view1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/md5view1.0.0
-
-
-clean:compiler_clean 
-       -$(DEL_FILE) $(OBJECTS)
-       -$(DEL_FILE) *~ core *.core
-
-
-####### Sub-libraries
-
-distclean: clean
-       -$(DEL_FILE) $(TARGET) 
-       -$(DEL_FILE) Makefile
-
-
-mocclean: compiler_moc_header_clean compiler_moc_source_clean
-
-mocables: compiler_moc_header_make_all compiler_moc_source_make_all
-
-compiler_moc_header_make_all: moc_mainwindow.cpp
-compiler_moc_header_clean:
-       -$(DEL_FILE) moc_mainwindow.cpp
-moc_mainwindow.cpp: mainwindow.h
-       /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp
-
-compiler_rcc_make_all:
-compiler_rcc_clean:
-compiler_image_collection_make_all: qmake_image_collection.cpp
-compiler_image_collection_clean:
-       -$(DEL_FILE) qmake_image_collection.cpp
-compiler_moc_source_make_all:
-compiler_moc_source_clean:
-compiler_uic_make_all: ui_mainwindow.h
-compiler_uic_clean:
-       -$(DEL_FILE) ui_mainwindow.h
-ui_mainwindow.h: mainwindow.ui
-       /usr/bin/uic-qt4 mainwindow.ui -o ui_mainwindow.h
-
-compiler_yacc_decl_make_all:
-compiler_yacc_decl_clean:
-compiler_yacc_impl_make_all:
-compiler_yacc_impl_clean:
-compiler_lex_make_all:
-compiler_lex_clean:
-compiler_clean: compiler_moc_header_clean compiler_uic_clean 
-
-####### Compile
-
-main.o: main.cpp mainwindow.h
-       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
-
-mainwindow.o: mainwindow.cpp mainwindow.h \
-               ui_mainwindow.h
-       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp
-
-viewerwidget.o: viewerwidget.cpp viewerwidget.h
-       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o viewerwidget.o viewerwidget.cpp
-
-moc_mainwindow.o: moc_mainwindow.cpp 
-       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp
-
-####### Install
-
-install:   FORCE
-
-uninstall:   FORCE
-
-FORCE:
-
index e0acbec8cabe54f6d4e947811f90df3c1323693c..288f08c1ee27aa184ceee69e9e2d1247879a93ce 100644 (file)
@@ -30,7 +30,7 @@
        <widget class="QTextBrowser" name="textBrowser">
         <property name="minimumSize">
          <size>
-          <width>200</width>
+          <width>500</width>
           <height>0</height>
          </size>
         </property>
index 72ad08f0a001de56a767693e6a0720255f25dfc4..bc3be1ed7334d2a86ddfb211a0347231d7f0bd3d 100644 (file)
@@ -17,6 +17,7 @@ public:
     MD5Joint(QString name, int parent,
              float px, float py, float pz,
              float ox, float oy, float oz);
+    MD5Joint(){}
 };
 
 #endif // MD5JOINT_H
index 461990d65febe023eb6530fd027d183ac62666b2..ceb6a33c19526158dcea7b06b148bad72485293d 100644 (file)
--- a/md5mesh.h
+++ b/md5mesh.h
@@ -2,12 +2,25 @@
 #define MD5MESH_H
 
 #include <QString>
+#include <QVector>
+
+#include "md5vertex.h"
+#include "md5triangle.h"
+#include "md5weight.h"
 
 class MD5Mesh
 {
 public:
     QString shader;
 
+    int numVertices;
+    int numTriangles;
+    int numWeights;
+
+    QVector<MD5Vertex>   vertices;
+    QVector<MD5Triangle> triangles;
+    QVector<MD5Weight>   weights;
+
     MD5Mesh();
 };
 
index 7954c158434c279a6e622c9d2a638bdc89602ef3..1d4a42d5aaea4f6d9328e90a042a83fd062d38a0 100644 (file)
@@ -1,5 +1,137 @@
 #include "md5model.h"
 
-MD5Model::MD5Model()
+#include <QFile>
+#include <QTextStream>
+#include <QString>
+#include <QStringList>
+#include <QRegExp>
+
+#define EXPECT(it, token) do{ if(it.next() != token) { log += QString("ERROR:expected \"")+token+"\"\n"; return; }} while (0)
+
+MD5Model::MD5Model(const QString& filename)
 {
+    QFile file(filename);
+    QString str, tmp;
+
+    log += "Reading " + filename + "\n";
+    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+        log += "Error\n";
+        return;
+    }
+
+    QTextStream in(&file);
+    while(!in.atEnd()) {
+        tmp = in.readLine();
+        tmp.replace(QRegExp("//.*"), "");
+        tmp.replace(QRegExp("([(){}\"])"), " \\1 ");
+        str.append(tmp);
+        //log += tmp + "\n";
+        str.append(" ");
+    }
+
+    QStringList list=str.split(QRegExp("\\s+"), QString::SkipEmptyParts);
+    QStringListIterator it(list);
+
+    // check header
+    if (it.next() != "MD5Version" || it.next() != "10") {
+        log += "Not an MD5 v.10 file\n";
+        return;
+    }
+
+    // skip commandline
+    if (it.next() == "commandline") {
+        it.next(); // skip opening quotes
+        while(it.next() != "\"") {}
+    }
+
+    EXPECT(it, "numJoints");
+    numJoints = it.next().toInt();
+
+    EXPECT(it, "numMeshes");
+    numMeshes = it.next().toInt();
+
+    log += QString("numJoints=")+QString::number(numJoints)+" numMeshes="+QString::number(numMeshes)+"\n";
+
+    EXPECT(it, "joints");
+    EXPECT(it, "{");
+    for (int i=0; i<numJoints; i++){
+        QString name;
+        int parent;
+        float px, py, pz, ox, oy, oz;
+        EXPECT(it, "\"");
+        name=it.next();
+        EXPECT(it, "\"");
+        parent=it.next().toInt();
+        EXPECT(it, "(");
+        px=it.next().toFloat();
+        py=it.next().toFloat();
+        pz=it.next().toFloat();
+        EXPECT(it, ")");
+        EXPECT(it, "(");
+        ox=it.next().toFloat();
+        oy=it.next().toFloat();
+        oz=it.next().toFloat();
+        EXPECT(it, ")");
+        joints.push_back(MD5Joint(name, parent, px, py, pz, ox, oy, oz));
+    }
+    EXPECT(it, "}");
+
+    for (int i=0; i<numMeshes; i++) {
+        MD5Mesh mesh;
+        EXPECT(it, "mesh");
+        EXPECT(it, "{");
+        EXPECT(it, "shader");
+        EXPECT(it, "\"");
+        mesh.shader=it.next();
+        EXPECT(it, "\"");
+
+        EXPECT(it, "numverts");
+        mesh.numVertices = it.next().toInt();
+        for (int j=0; j<mesh.numVertices; j++) {
+            float s,t,startWeight,countWeight;
+            EXPECT(it, "vert");
+            int index=it.next().toInt();
+            if (index != j) { log += "ERROR: Unsorted vertices"; return; }
+            EXPECT(it, "(");
+            s = it.next().toInt();
+            t = it.next().toInt();
+            EXPECT(it, ")");
+            startWeight = it.next().toInt();
+            countWeight = it.next().toInt();
+            mesh.vertices.push_back(MD5Vertex(s, t, startWeight, countWeight));
+        }
+
+        EXPECT(it, "numtris");
+        mesh.numTriangles = it.next().toInt();
+        for (int j=0; j<mesh.numTriangles; j++) {
+            int a, b, c;
+            EXPECT(it, "tri");
+            int index=it.next().toInt();
+            if (index != j) { log += "ERROR: Unsorted tris"; return; }
+            a = it.next().toInt();
+            b = it.next().toInt();
+            c = it.next().toInt();
+            mesh.triangles.push_back(MD5Triangle(a,b,c));
+        }
+
+        EXPECT(it, "numweights");
+        mesh.numWeights = it.next().toInt();
+        for (int j=0; j<mesh.numWeights; j++) {
+            int joint;
+            float bias, px, py, pz;
+            EXPECT(it, "weight");
+            int index=it.next().toInt();
+            if (index != j) { log += "ERROR: Unsorted weights"; return; }
+            joint = it.next().toInt();
+            bias = it.next().toFloat();
+            EXPECT(it, "(");
+            px = it.next().toFloat();
+            py = it.next().toFloat();
+            pz = it.next().toFloat();
+            EXPECT(it, ")");
+            mesh.weights.push_back(MD5Weight(joint, bias, px, py, pz));
+        }
+        EXPECT(it, "}");
+        meshes.push_back(mesh);
+    }
 }
index b02d1589bfe056245a5b2caae08b4281ef11475c..93fd008ef01cd810e15a65219b51b5af9ca76e7c 100644 (file)
@@ -4,14 +4,18 @@
 #include <QString>
 #include <QVector>
 #include "md5joint.h"
+#include "md5mesh.h"
 
 class MD5Model
 {
+    int numJoints;
+    int numMeshes;
     QVector<MD5Joint> joints;
     QVector<MD5Mesh>  meshes;
 
 public:
-    MD5Model();
+    MD5Model(const QString& filename);
+    QString log;
 };
 
 #endif // MD5MODEL_H
diff --git a/md5tri.h b/md5tri.h
new file mode 100644 (file)
index 0000000..1389190
--- /dev/null
+++ b/md5tri.h
@@ -0,0 +1,5 @@
+#ifndef MD5TRI_H
+#define MD5TRI_H
+
+
+#endif // MD5TRI_H
diff --git a/md5triangle.h b/md5triangle.h
new file mode 100644 (file)
index 0000000..5ff8088
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef MD5TRIANGLE_H
+#define MD5TRIANGLE_H
+
+struct MD5Triangle
+{
+    int indices[3];
+
+    MD5Triangle() {}
+    MD5Triangle(int a, int b, int c) {
+        indices[0]=a;
+        indices[1]=b;
+        indices[2]=c;
+    }
+};
+
+
+#endif // MD5TRIANGLE_H
diff --git a/md5vertex.h b/md5vertex.h
new file mode 100644 (file)
index 0000000..a20393e
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef MD5VERTEX_H
+#define MD5VERTEX_H
+
+struct MD5Vertex
+{
+    float s, t; // texture coordinates
+    int startWeight;
+    int countWeight;
+
+    MD5Vertex(){}
+    MD5Vertex(float s, float t, int startWeight, int countWeight):
+            s(s), t(t), startWeight(startWeight), countWeight(countWeight) {}
+};
+
+#endif // MD5VERTEX_H
index c814c03ee7730422cbdf8ec5fa0e0421f6c6aaa7..7d124228b812398df3c768041b89aa01e21637f7 100644 (file)
@@ -14,5 +14,8 @@ HEADERS += mainwindow.h \
     viewerwidget.h \
     md5model.h \
     md5joint.h \
-    md5mesh.h
+    md5mesh.h \
+    md5vertex.h \
+    md5triangle.h \
+    md5weight.h
 FORMS += mainwindow.ui
index 91dadb7448b76bc83b03348ea209ac07b494137f..be52368819f5df0fee6b9b3fc495bc5ba4947c2c 100644 (file)
   <valuemap type="QVariantMap">
    <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
    <valuelist key="abstractProcess.Environment" type="QVariantList">
-    <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Dj3Bbe55NG,guid=c59e58cab9ff6389416a749d4b491a91</value>
+    <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-bsAmm1MSNh,guid=a5f27d3b4c48a519c47248434b49ef0d</value>
     <value type="QString">DESKTOP_SESSION=gnome</value>
     <value type="QString">DISPLAY=:0.0</value>
     <value type="QString">GDMSESSION=gnome</value>
     <value type="QString">GDM_KEYBOARD_LAYOUT=es</value>
     <value type="QString">GDM_LANG=es_ES.UTF-8</value>
     <value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
-    <value type="QString">GNOME_KEYRING_PID=2234</value>
-    <value type="QString">GNOME_KEYRING_SOCKET=/tmp/keyring-iuKvkY/socket</value>
+    <value type="QString">GNOME_KEYRING_PID=2194</value>
+    <value type="QString">GNOME_KEYRING_SOCKET=/tmp/keyring-kLJQOr/socket</value>
     <value type="QString">GTK_MODULES=canberra-gtk-module</value>
     <value type="QString">GTK_RC_FILES=/etc/gtk/gtkrc:/home/slack/.gtkrc-1.2-gnome2</value>
     <value type="QString">HOME=/home/slack</value>
     <value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games</value>
     <value type="QString">PWD=/home/slack</value>
     <value type="QString">QTDIR=/usr/share/qt4</value>
-    <value type="QString">SESSION_MANAGER=local/ommadawn:@/tmp/.ICE-unix/2249,unix/ommadawn:/tmp/.ICE-unix/2249</value>
+    <value type="QString">SESSION_MANAGER=local/ommadawn:@/tmp/.ICE-unix/2209,unix/ommadawn:/tmp/.ICE-unix/2209</value>
     <value type="QString">SHELL=/bin/bash</value>
     <value type="QString">SPEECHD_PORT=7560</value>
-    <value type="QString">SSH_AGENT_PID=2300</value>
-    <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-iuKvkY/socket.ssh</value>
+    <value type="QString">SSH_AGENT_PID=2260</value>
+    <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-kLJQOr/socket.ssh</value>
     <value type="QString">USER=slack</value>
     <value type="QString">USERNAME=slack</value>
-    <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-slack-dbUjQ9/database</value>
+    <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-slack-AEj533/database</value>
     <value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
-    <value type="QString">XDG_SESSION_COOKIE=b95e9de5c0255c87d4458400462bf263-1263082128.724084-492310790</value>
+    <value type="QString">XDG_SESSION_COOKIE=b95e9de5c0255c87d4458400462bf263-1263136524.238355-1968136452</value>
    </valuelist>
    <valuelist key="abstractProcess.arguments" type="QVariantList">
     <value type="QString">/home/slack/md5view/md5view.pro</value>
   <valuemap type="QVariantMap">
    <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
    <valuelist key="abstractProcess.Environment" type="QVariantList">
-    <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Dj3Bbe55NG,guid=c59e58cab9ff6389416a749d4b491a91</value>
+    <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-bsAmm1MSNh,guid=a5f27d3b4c48a519c47248434b49ef0d</value>
     <value type="QString">DESKTOP_SESSION=gnome</value>
     <value type="QString">DISPLAY=:0.0</value>
     <value type="QString">GDMSESSION=gnome</value>
     <value type="QString">GDM_KEYBOARD_LAYOUT=es</value>
     <value type="QString">GDM_LANG=es_ES.UTF-8</value>
     <value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
-    <value type="QString">GNOME_KEYRING_PID=2234</value>
-    <value type="QString">GNOME_KEYRING_SOCKET=/tmp/keyring-iuKvkY/socket</value>
+    <value type="QString">GNOME_KEYRING_PID=2194</value>
+    <value type="QString">GNOME_KEYRING_SOCKET=/tmp/keyring-kLJQOr/socket</value>
     <value type="QString">GTK_MODULES=canberra-gtk-module</value>
     <value type="QString">GTK_RC_FILES=/etc/gtk/gtkrc:/home/slack/.gtkrc-1.2-gnome2</value>
     <value type="QString">HOME=/home/slack</value>
     <value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games</value>
     <value type="QString">PWD=/home/slack</value>
     <value type="QString">QTDIR=/usr/share/qt4</value>
-    <value type="QString">SESSION_MANAGER=local/ommadawn:@/tmp/.ICE-unix/2249,unix/ommadawn:/tmp/.ICE-unix/2249</value>
+    <value type="QString">SESSION_MANAGER=local/ommadawn:@/tmp/.ICE-unix/2209,unix/ommadawn:/tmp/.ICE-unix/2209</value>
     <value type="QString">SHELL=/bin/bash</value>
     <value type="QString">SPEECHD_PORT=7560</value>
-    <value type="QString">SSH_AGENT_PID=2300</value>
-    <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-iuKvkY/socket.ssh</value>
+    <value type="QString">SSH_AGENT_PID=2260</value>
+    <value type="QString">SSH_AUTH_SOCK=/tmp/keyring-kLJQOr/socket.ssh</value>
     <value type="QString">USER=slack</value>
     <value type="QString">USERNAME=slack</value>
-    <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-slack-dbUjQ9/database</value>
+    <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-slack-AEj533/database</value>
     <value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
-    <value type="QString">XDG_SESSION_COOKIE=b95e9de5c0255c87d4458400462bf263-1263082128.724084-492310790</value>
+    <value type="QString">XDG_SESSION_COOKIE=b95e9de5c0255c87d4458400462bf263-1263136524.238355-1968136452</value>
    </valuelist>
    <value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>
    <valuelist key="abstractProcess.arguments" type="QVariantList">
diff --git a/md5weight.h b/md5weight.h
new file mode 100644 (file)
index 0000000..e6bafc9
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef MD5WEIGHT_H
+#define MD5WEIGHT_H
+
+#include "glm/glm.hpp"
+
+struct MD5Weight
+{
+    int joint;
+    float bias;
+    glm::vec3 position;
+
+    MD5Weight(){}
+    MD5Weight(int joint, float bias, float px, float py, float pz):
+            joint(joint), bias(bias), position(px,py,pz) {}
+};
+
+#endif // MD5WEIGHT_H
index a5353332bc93944d941314d758d7866c8d4ee83c..3c8c16995859a267a93d9610789e1afbb36e65c0 100644 (file)
@@ -2,16 +2,19 @@
 
 #include <QFile>
 #include "mainwindow.h"
+#include "md5model.h"
 
 
 ViewerWidget::ViewerWidget(MainWindow *parent):
         QGLWidget(parent)
 {
     mainWindow = parent;
+    model = new MD5Model("meshes/imp.md5mesh");
+    mainWindow->writeLog(model->log);
 }
 
 void ViewerWidget::initializeGL()
-{
+{    
     mainWindow->writeLog("Initializing...\n");
     if (context()->format().openGLVersionFlags() & QGLFormat::OpenGL_Version_2_1)
         mainWindow->writeLog("OpenGL 2.1 is available :)\n");
@@ -32,9 +35,9 @@ void ViewerWidget::initializeGL()
     glAttachShader(shaderProgramID, fragmentShaderID);
 
     glEnableVertexAttribArray(0);
-    glBindAttribLocation(shaderprogram, 0, "in_Position");
+    glBindAttribLocation(shaderProgramID, 0, "in_Position");
 
-    glLinkProgram();
+    glLinkProgram(shaderProgramID);
 
 
     // Set up the rendering context, define display lists etc.:
index d6a28cfa1b93d3cbccbfa490fed2145fe98d571f..03a0860c16b5375de4feb352f690bb709af27f48 100644 (file)
@@ -1,11 +1,13 @@
 #ifndef VIEWERWIDGET_H
 #define VIEWERWIDGET_H
 
+#define GL_GLEXT_PROTOTYPES
 #include <QGLWidget>
 #include <QString>
 #include <QByteArray>
 
 class MainWindow;
+class MD5Model;
 
 class ViewerWidget : public QGLWidget
 {
@@ -20,6 +22,7 @@ protected:
 private:
     QByteArray readFile(QString filename);
     MainWindow *mainWindow;
+    MD5Model   *model;
 
     QByteArray vertexShaderSource;
     QByteArray fragmentShaderSource;