summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2010-10-07 23:48:57 +0200
committerTreeki <treeki@gmail.com>2010-10-07 23:48:57 +0200
commit532859713aaf0fdf482ee7d68676f6927a800eeb (patch)
tree304c7d60b76c0a91296087927d52360a627478c0
parent5f6dad55d75cbe146ff7fefc899a02ccd39078ba (diff)
downloadLayoutStudio-532859713aaf0fdf482ee7d68676f6927a800eeb.tar.gz
LayoutStudio-532859713aaf0fdf482ee7d68676f6927a800eeb.zip
implemented some more material stuff; added readme
-rw-r--r--LayoutStudio.pro11
-rw-r--r--README.markdown33
-rw-r--r--lyt/materials/material.cpp17
-rw-r--r--lyt/materials/material.h28
-rw-r--r--lyt/materials/texcoordgen.cpp27
-rw-r--r--lyt/materials/texcoordgen.h21
-rw-r--r--lyt/materials/texsrt.cpp31
-rw-r--r--lyt/materials/texsrt.h23
8 files changed, 160 insertions, 31 deletions
diff --git a/LayoutStudio.pro b/LayoutStudio.pro
index 7a1c8c0..aac834e 100644
--- a/LayoutStudio.pro
+++ b/LayoutStudio.pro
@@ -20,7 +20,9 @@ SOURCES += main.cpp \
lyt/window.cpp \
lyt/bounding.cpp \
lyt/group.cpp \
- lyt/materials/texmap.cpp
+ lyt/materials/texmap.cpp \
+ lyt/materials/texsrt.cpp \
+ lyt/materials/texcoordgen.cpp
HEADERS += lsmainwindow.h \
lsglobals.h \
lyt/packagebase.h \
@@ -36,7 +38,9 @@ HEADERS += lsmainwindow.h \
lyt/window.h \
lyt/bounding.h \
lyt/group.h \
- lyt/materials/texmap.h
+ lyt/materials/texmap.h \
+ lyt/materials/texsrt.h \
+ lyt/materials/texcoordgen.h
FORMS += lsmainwindow.ui
RESOURCES += resources.qrc
@@ -45,4 +49,5 @@ OTHER_FILES += \
icons/textbox.png \
icons/picture.png \
icons/pane.png \
- icons/bounding.png
+ icons/bounding.png \
+ README.markdown
diff --git a/README.markdown b/README.markdown
new file mode 100644
index 0000000..68a6871
--- /dev/null
+++ b/README.markdown
@@ -0,0 +1,33 @@
+LayoutStudio Readme
+-------------------
+
+LayoutStudio is a work-in-progress application written by Treeki which plans to
+offer graphical editing of Wii NW4R layouts/banners (.brlyt/.brlan files) with
+functional, real-time previews.
+
+The application is written in C++ (with heavy usage of Nokia's Qt toolkit).
+
+The graphical rendering will eventually use OpenGL, and build on the excellent
+GX GPU emulation in the [Dolphin][dol] GameCube/Wii emulator.
+
+[dol]: http://code.google.com/p/dolphin-emu/
+
+
+### Implemented Features ###
+- BRLYT reading (materials are not yet fully implemented)
+- Simple API for manipulating layout files from other code
+
+
+### Planned Features ###
+- BRLYT writing (partially done)
+- BRLAN reading/writing
+- Graphical interface for editing layouts and animations
+- Rendering of layouts using OpenGL and Dolphin's GX emulation
+
+
+
+Other Stuff
+-----------
+
+Special thanks to megazig, trap15 and everyone else who worked on benzin.
+Greets to #HACKERCHANNEL and the Newer team :p
diff --git a/lyt/materials/material.cpp b/lyt/materials/material.cpp
index a23534c..d09614a 100644
--- a/lyt/materials/material.cpp
+++ b/lyt/materials/material.cpp
@@ -44,7 +44,7 @@ void LYTMaterial::readFromDataStream(QDataStream &in) {
}
// TexSRT
- /*texSRTs.clear();
+ texSRTs.clear();
for (int i = 0; i < resourceNum.getTexSRTNum(); i++) {
this->readTexSRT(in);
@@ -58,7 +58,7 @@ void LYTMaterial::readFromDataStream(QDataStream &in) {
}
// ChanCtrl
- if (resourceNum.hasChanCtrl()) {
+ /*if (resourceNum.hasChanCtrl()) {
this->hasChanCtrl = true;
this->readChanCtrl(in);
} else {
@@ -124,4 +124,17 @@ void LYTMaterial::readFromDataStream(QDataStream &in) {
void LYTMaterial::readTexMap(QDataStream &in) {
this->texMaps.append(LYTTexMap());
this->texMaps.last().readFromDataStream(in, m_layout);
+ this->texMaps.last().dumpToDebug();
+}
+
+void LYTMaterial::readTexSRT(QDataStream &in) {
+ this->texSRTs.append(LYTTexSRT());
+ this->texSRTs.last().readFromDataStream(in);
+ this->texSRTs.last().dumpToDebug();
+}
+
+void LYTMaterial::readTexCoordGen(QDataStream &in) {
+ this->texCoordGens.append(LYTTexCoordGen());
+ this->texCoordGens.last().readFromDataStream(in);
+ this->texCoordGens.last().dumpToDebug();
}
diff --git a/lyt/materials/material.h b/lyt/materials/material.h
index 73a0e57..643f656 100644
--- a/lyt/materials/material.h
+++ b/lyt/materials/material.h
@@ -8,6 +8,8 @@
#include "../common.h"
#include "texmap.h"
+#include "texsrt.h"
+#include "texcoordgen.h"
class LYTLayout;
@@ -31,18 +33,6 @@ public:
-class LYTTexCoordGen {
-public:
- void writeToDataStream(QDataStream &out);
- void readFromDataStream(QDataStream &in);
-
- void dumpToDebug();
-
- quint8 genType;
- quint8 src;
- quint8 mtx;
-};
-
class LYTChanCtrl {
public:
void writeToDataStream(QDataStream &out);
@@ -67,20 +57,6 @@ public:
int alpha;
};
-class LYTTexSRT {
-public:
- void writeToDataStream(QDataStream &out);
- void readFromDataStream(QDataStream &in);
-
- void dumpToDebug();
-
- float xTrans;
- float yTrans;
- float rotate;
- float xScale;
- float yScale;
-};
-
class LYTIndirectStage {
public:
void writeToDataStream(QDataStream &out);
diff --git a/lyt/materials/texcoordgen.cpp b/lyt/materials/texcoordgen.cpp
new file mode 100644
index 0000000..9a47479
--- /dev/null
+++ b/lyt/materials/texcoordgen.cpp
@@ -0,0 +1,27 @@
+#include "texcoordgen.h"
+#include "../layout.h"
+
+LYTTexCoordGen::LYTTexCoordGen() {
+}
+
+void LYTTexCoordGen::dumpToDebug() {
+ qDebug() << "LYTTexCoordGen @" << (void*)this;
+ qDebug() << "GenType:" << genType << "- Mtx:" << mtx << "- Src:" << src;
+}
+
+
+void LYTTexCoordGen::writeToDataStream(QDataStream &out) {
+ out << (quint8)genType;
+ out << (quint8)src;
+ out << (quint8)mtx;
+ out.skipRawData(1); // padding
+}
+
+
+void LYTTexCoordGen::readFromDataStream(QDataStream &in) {
+ in >> (quint8&)genType;
+ in >> (quint8&)src;
+ in >> (quint8&)mtx;
+ in.skipRawData(1); // padding
+}
+
diff --git a/lyt/materials/texcoordgen.h b/lyt/materials/texcoordgen.h
new file mode 100644
index 0000000..5e66b8e
--- /dev/null
+++ b/lyt/materials/texcoordgen.h
@@ -0,0 +1,21 @@
+#ifndef LYTTEXCOORDGEN_H
+#define LYTTEXCOORDGEN_H
+
+#include "../common.h"
+#include <QtCore/QDataStream>
+
+class LYTTexCoordGen {
+public:
+ LYTTexCoordGen();
+
+ void writeToDataStream(QDataStream &out);
+ void readFromDataStream(QDataStream &in);
+
+ void dumpToDebug();
+
+ quint8 genType;
+ quint8 src;
+ quint8 mtx;
+};
+
+#endif // LYTTEXCOORDGEN_H
diff --git a/lyt/materials/texsrt.cpp b/lyt/materials/texsrt.cpp
new file mode 100644
index 0000000..25e28ca
--- /dev/null
+++ b/lyt/materials/texsrt.cpp
@@ -0,0 +1,31 @@
+#include "texsrt.h"
+#include "../layout.h"
+
+LYTTexSRT::LYTTexSRT() {
+}
+
+void LYTTexSRT::dumpToDebug() {
+ qDebug() << "LYTTexSRT @" << (void*)this;
+ qDebug() << "Scale:" << xScale << "," << yScale;
+ qDebug() << "Rotation:" << rotate;
+ qDebug() << "Translation:" << xTrans << "," << yTrans;
+}
+
+
+void LYTTexSRT::writeToDataStream(QDataStream &out) {
+ out << (float)xTrans;
+ out << (float)yTrans;
+ out << (float)rotate;
+ out << (float)xScale;
+ out << (float)yScale;
+}
+
+
+void LYTTexSRT::readFromDataStream(QDataStream &in) {
+ in >> (float&)xTrans;
+ in >> (float&)yTrans;
+ in >> (float&)rotate;
+ in >> (float&)xScale;
+ in >> (float&)yScale;
+}
+
diff --git a/lyt/materials/texsrt.h b/lyt/materials/texsrt.h
new file mode 100644
index 0000000..ad5e470
--- /dev/null
+++ b/lyt/materials/texsrt.h
@@ -0,0 +1,23 @@
+#ifndef LYTTEXSRT_H
+#define LYTTEXSRT_H
+
+#include "../common.h"
+#include <QtCore/QDataStream>
+
+class LYTTexSRT {
+public:
+ LYTTexSRT();
+
+ void writeToDataStream(QDataStream &out);
+ void readFromDataStream(QDataStream &in);
+
+ void dumpToDebug();
+
+ float xTrans;
+ float yTrans;
+ float rotate;
+ float xScale;
+ float yScale;
+};
+
+#endif // LYTTEXSRT_H