summaryrefslogtreecommitdiff
path: root/lyt/materials
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 /lyt/materials
parent5f6dad55d75cbe146ff7fefc899a02ccd39078ba (diff)
downloadLayoutStudio-532859713aaf0fdf482ee7d68676f6927a800eeb.tar.gz
LayoutStudio-532859713aaf0fdf482ee7d68676f6927a800eeb.zip
implemented some more material stuff; added readme
Diffstat (limited to 'lyt/materials')
-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
6 files changed, 119 insertions, 28 deletions
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