+++ /dev/null
-#############################################################################
-# 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:
-
<widget class="QTextBrowser" name="textBrowser">
<property name="minimumSize">
<size>
- <width>200</width>
+ <width>500</width>
<height>0</height>
</size>
</property>
MD5Joint(QString name, int parent,
float px, float py, float pz,
float ox, float oy, float oz);
+ MD5Joint(){}
};
#endif // MD5JOINT_H
#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();
};
#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);
+ }
}
#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
--- /dev/null
+#ifndef MD5TRI_H
+#define MD5TRI_H
+
+
+#endif // MD5TRI_H
--- /dev/null
+#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
--- /dev/null
+#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
viewerwidget.h \
md5model.h \
md5joint.h \
- md5mesh.h
+ md5mesh.h \
+ md5vertex.h \
+ md5triangle.h \
+ md5weight.h
FORMS += mainwindow.ui
<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">
--- /dev/null
+#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
#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");
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.:
#ifndef VIEWERWIDGET_H
#define VIEWERWIDGET_H
+#define GL_GLEXT_PROTOTYPES
#include <QGLWidget>
#include <QString>
#include <QByteArray>
class MainWindow;
+class MD5Model;
class ViewerWidget : public QGLWidget
{
private:
QByteArray readFile(QString filename);
MainWindow *mainWindow;
+ MD5Model *model;
QByteArray vertexShaderSource;
QByteArray fragmentShaderSource;