summaryrefslogtreecommitdiff
path: root/lyt
diff options
context:
space:
mode:
Diffstat (limited to 'lyt')
-rw-r--r--lyt/materials/material.h12
-rw-r--r--lyt/materials/tevstage.cpp91
-rw-r--r--lyt/materials/tevstage.h85
3 files changed, 178 insertions, 10 deletions
diff --git a/lyt/materials/material.h b/lyt/materials/material.h
index f881803..43eb62f 100644
--- a/lyt/materials/material.h
+++ b/lyt/materials/material.h
@@ -29,7 +29,8 @@
#include "texcoordgen.h"
#include "chanctrl.h"
#include "tevswaptable.h"
-#include "indtexstage.h"
+#include "indirectstage.h"
+#include "tevstage.h"
class LYTLayout;
@@ -54,15 +55,6 @@ public:
-class LYTTevStage {
-public:
- void writeToDataStream(QDataStream &out);
- void readFromDataStream(QDataStream &in);
-
- void dumpToDebug();
-
-};
-
class LYTAlphaCompare {
public:
void writeToDataStream(QDataStream &out);
diff --git a/lyt/materials/tevstage.cpp b/lyt/materials/tevstage.cpp
new file mode 100644
index 0000000..31e55b1
--- /dev/null
+++ b/lyt/materials/tevstage.cpp
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ This file is part of LayoutStudio (http://github.com/Treeki/LayoutStudio)
+ Copyright (c) 2010 Treeki (treeki@gmail.com)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, version 2.0.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License 2.0 for more details.
+
+ You should have received a copy of the GNU General Public License 2.0
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*******************************************************************************/
+
+#include "tevstage.h"
+#include "../layout.h"
+
+LYTTevStage::LYTTevStage() {
+}
+
+void LYTTevStage::dumpToDebug() {
+ qDebug() << "LYTTevStage @" << (void*)this;
+}
+
+
+void LYTTevStage::writeToDataStream(QDataStream &out) {
+}
+
+
+void LYTTevStage::readFromDataStream(QDataStream &in) {
+ // not fun. at all.
+
+ char data[0x10];
+ in.readRawData(data, 0x10);
+
+ // TEV order:
+ texCoord = data[0];
+ colour = data[1];
+ texMap = data[2] | (BitExtract(data[3], 1, 32 - 1) << 8);
+
+ // SwapMode:
+ rasSwapMode = BitExtract(data[3], 2, 32 - 3);
+ texSwapMode = BitExtract(data[3], 2, 32 - 5);
+
+ // Colour In:
+ colourInA = BitExtract(data[4], 4, 32 - 4);
+ colourInB = BitExtract(data[4], 4, 32 - 8);
+ colourInC = BitExtract(data[5], 4, 32 - 4);
+ colourInD = BitExtract(data[5], 4, 32 - 8);
+
+ // Colour Op:
+ colourOp = BitExtract(data[6], 4, 32 - 4);
+ colourBias = BitExtract(data[6], 2, 32 - 6);
+ colourScale = BitExtract(data[6], 2, 32 - 8);
+ colourClamp = BitExtract(data[7], 1, 32 - 1);
+ colourOutReg = BitExtract(data[7], 2, 32 - 3);
+
+ // Alpha In:
+ alphaInA = BitExtract(data[8], 4, 32 - 4);
+ alphaInB = BitExtract(data[8], 4, 32 - 8);
+ alphaInC = BitExtract(data[9], 4, 32 - 4);
+ alphaInD = BitExtract(data[9], 4, 32 - 8);
+
+ // Alpha Op:
+ alphaOp = BitExtract(data[10], 4, 32 - 4);
+ alphaBias = BitExtract(data[10], 2, 32 - 6);
+ alphaScale = BitExtract(data[10], 2, 32 - 8);
+ alphaClamp = BitExtract(data[11], 1, 32 - 1);
+ alphaOutReg = BitExtract(data[11], 2, 32 - 3);
+
+ // Constants:
+ colourConst = BitExtract(data[7], 5, 32 - 8);
+ alphaConst = BitExtract(data[11], 5, 32 - 8);
+
+ // Indirect:
+ indStage = data[12];
+ indFormat = BitExtract(data[15], 2, 32 - 2);
+ indBias = BitExtract(data[13], 3, 32 - 3);
+ indMatrix = BitExtract(data[13], 4, 32 - 7);
+ indWrapS = BitExtract(data[14], 3, 32 - 3);
+ indWrapT = BitExtract(data[14], 3, 32 - 6);
+ indAddPrev = BitExtract(data[15], 1, 32 - 3);
+ indUtcLod = BitExtract(data[15], 1, 32 - 4);
+ indAlphaSel = BitExtract(data[15], 2, 32 - 6);
+}
+
+
+
diff --git a/lyt/materials/tevstage.h b/lyt/materials/tevstage.h
new file mode 100644
index 0000000..6132800
--- /dev/null
+++ b/lyt/materials/tevstage.h
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ This file is part of LayoutStudio (http://github.com/Treeki/LayoutStudio)
+ Copyright (c) 2010 Treeki (treeki@gmail.com)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, version 2.0.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License 2.0 for more details.
+
+ You should have received a copy of the GNU General Public License 2.0
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*******************************************************************************/
+
+#ifndef LYTTEVSTAGE_H
+#define LYTTEVSTAGE_H
+
+#include "../common.h"
+#include <QtCore/QDataStream>
+
+class LYTTevStage {
+public:
+ LYTTevStage();
+
+ void writeToDataStream(QDataStream &out);
+ void readFromDataStream(QDataStream &in);
+
+ void dumpToDebug();
+
+ // TEV order:
+ int texCoord;
+ int colour;
+ int texMap;
+
+ // SwapMode;
+ int rasSwapMode;
+ int texSwapMode;
+
+ // Colour In:
+ int colourInA;
+ int colourInB;
+ int colourInC;
+ int colourInD;
+
+ // Colour Op:
+ int colourOp;
+ int colourBias;
+ int colourScale;
+ int colourClamp;
+ int colourOutReg;
+
+ // Alpha In:
+ int alphaInA;
+ int alphaInB;
+ int alphaInC;
+ int alphaInD;
+
+ // Alpha Op:
+ int alphaOp;
+ int alphaBias;
+ int alphaScale;
+ int alphaClamp;
+ int alphaOutReg;
+
+ // Constants:
+ int colourConst;
+ int alphaConst;
+
+ // Indirect:
+ int indStage;
+ int indFormat;
+ int indBias;
+ int indMatrix;
+ int indWrapS;
+ int indWrapT;
+ int indAddPrev;
+ int indUtcLod;
+ int indAlphaSel;
+};
+
+
+#endif // LYTTEVSAGE_H