summaryrefslogtreecommitdiff
path: root/lyt/materials/material.h
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2010-10-07 15:56:13 +0200
committerTreeki <treeki@gmail.com>2010-10-07 15:56:13 +0200
commit5f6dad55d75cbe146ff7fefc899a02ccd39078ba (patch)
tree0822df14cc6d2c0329810c9ae7b4a4a638fe82b1 /lyt/materials/material.h
downloadLayoutStudio-5f6dad55d75cbe146ff7fefc899a02ccd39078ba.tar.gz
LayoutStudio-5f6dad55d75cbe146ff7fefc899a02ccd39078ba.zip
initial commit -- everything compiles except for material.cpp. the material system still needs quite a bit of work; this will come in due time
Diffstat (limited to 'lyt/materials/material.h')
-rw-r--r--lyt/materials/material.h183
1 files changed, 183 insertions, 0 deletions
diff --git a/lyt/materials/material.h b/lyt/materials/material.h
new file mode 100644
index 0000000..73a0e57
--- /dev/null
+++ b/lyt/materials/material.h
@@ -0,0 +1,183 @@
+#ifndef LYTMATERIAL_H
+#define LYTMATERIAL_H
+
+#include <QtCore/QList>
+#include <QtCore/QString>
+#include <QtCore/QDataStream>
+#include <QtCore/QDebug>
+
+#include "../common.h"
+#include "texmap.h"
+
+class LYTLayout;
+
+
+class LYTMaterialResourceNum {
+public:
+ quint32 value;
+
+ inline int getTexMapNum() { return BitExtract(value, 4, 28); }
+ inline int getTexSRTNum() { return BitExtract(value, 4, 24); }
+ inline int getTexCoordGenNum() { return BitExtract(value, 4, 20); }
+ inline bool hasChanCtrl() { return BitExtract(value, 1, 6); }
+ inline bool hasMatCol() { return BitExtract(value, 1, 4); }
+ inline bool hasTevSwapTable() { return BitExtract(value, 1, 19); }
+ inline bool hasAlphaCompare() { return BitExtract(value, 1, 8); }
+ inline bool hasBlendMode() { return BitExtract(value, 1, 7); }
+ inline int getIndTexSRTNum() { return BitExtract(value, 2, 17); }
+ inline int getIndTexStageNum() { return BitExtract(value, 3, 14); }
+ inline int getTevStageNum() { return BitExtract(value, 5, 9); }
+};
+
+
+
+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);
+ void readFromDataStream(QDataStream &in);
+
+ void dumpToDebug();
+
+ quint8 colourMatSrc;
+ quint8 alphaMatSrc;
+};
+
+class LYTTevSwapMode {
+public:
+ void writeToDataStream(QDataStream &out);
+ void readFromDataStream(QDataStream &in);
+
+ void dumpToDebug();
+
+ int red;
+ int green;
+ int blue;
+ 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);
+ void readFromDataStream(QDataStream &in);
+
+ void dumpToDebug();
+
+};
+
+class LYTTevStage {
+public:
+ void writeToDataStream(QDataStream &out);
+ void readFromDataStream(QDataStream &in);
+
+ void dumpToDebug();
+
+};
+
+class LYTAlphaCompare {
+public:
+ void writeToDataStream(QDataStream &out);
+ void readFromDataStream(QDataStream &in);
+
+ void dumpToDebug();
+
+};
+
+class LYTBlendMode {
+public:
+ void writeToDataStream(QDataStream &out);
+ void readFromDataStream(QDataStream &in);
+
+ void dumpToDebug();
+
+};
+
+
+
+
+class LYTMaterial {
+public:
+ LYTMaterial(LYTLayout &layout);
+ ~LYTMaterial();
+
+
+ void writeToDataStream(QDataStream &out);
+ void readFromDataStream(QDataStream &in);
+
+ void dumpToDebug();
+
+ LYTLayout &layout() const;
+
+ QString name;
+
+ QColor colours[3];
+ QColor tevKColour[4];
+
+ QList<LYTTexMap> texMaps;
+ QList<LYTTexSRT> texSRTs;
+ QList<LYTTexCoordGen> texCoordGens;
+
+ bool hasChanCtrl;
+ LYTChanCtrl chanCtrl;
+
+ bool hasMatCol;
+ QColor matCol;
+
+ bool hasTevSwapTable;
+ LYTTevSwapMode tevSwapTable;
+
+ bool hasAlphaCompare;
+ LYTAlphaCompare alphaCompare;
+
+ bool hasBlendMode;
+ LYTBlendMode blendMode;
+
+ QList<LYTIndirectStage> indTexStages;
+ QList<LYTTexSRT> indTexSRTs;
+
+ QList<LYTTevStage> tevStages;
+
+
+
+protected:
+ LYTLayout &m_layout;
+
+ void readTexMap(QDataStream &in);
+ void readTexSRT(QDataStream &in);
+ void readTexCoordGen(QDataStream &in);
+ void readChanCtrl(QDataStream &in);
+ void readMatCol(QDataStream &in);
+ void readTevSwapTable(QDataStream &in);
+ void readAlphaCompare(QDataStream &in);
+ void readBlendMode(QDataStream &in);
+ void readIndirectStage(QDataStream &in);
+ void readIndTexSRT(QDataStream &in);
+ void readTevStage(QDataStream &in);
+};
+
+#endif // LYTMATERIAL_H