blob: d09614a44bce1d983855c241f1f5863d6f266e34 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
#include "material.h"
#include "../layout.h"
LYTMaterial::LYTMaterial(LYTLayout &layout) : m_layout(layout) {
}
LYTMaterial::~LYTMaterial() {
}
LYTLayout &LYTMaterial::layout() const {
return m_layout;
}
void LYTMaterial::dumpToDebug() {
qDebug() << "LYTMaterial" << name << "@" << (void*)this;
}
void LYTMaterial::writeToDataStream(QDataStream &out) {
WriteFixedLengthASCII(out, name, 0x14);
}
void LYTMaterial::readFromDataStream(QDataStream &in) {
name = ReadFixedLengthASCII(in, 0x14);
for (int i = 0; i < 3; i++)
ReadS10Color(this->colours[i], in);
for (int i = 0; i < 4; i++)
ReadRGBA8Color(this->tevKColour[i], in);
LYTMaterialResourceNum resourceNum;
in >> (quint32&)resourceNum.value;
// this is really complicated -_-
// first off: TexMap
texMaps.clear();
for (int i = 0; i < resourceNum.getTexMapNum(); i++) {
this->readTexMap(in);
}
// TexSRT
texSRTs.clear();
for (int i = 0; i < resourceNum.getTexSRTNum(); i++) {
this->readTexSRT(in);
}
// TexCoordGen
texCoordGens.clear();
for (int i = 0; i < resourceNum.getTexCoordGenNum(); i++) {
this->readTexCoordGen(in);
}
// ChanCtrl
/*if (resourceNum.hasChanCtrl()) {
this->hasChanCtrl = true;
this->readChanCtrl(in);
} else {
this->hasChanCtrl = false;
}
// MatCol
if (resourceNum.hasMatCol()) {
this->hasMatCol = true;
this->readMatCol(in);
} else {
this->hasMatCol = false;
}
// TevSwapTable
if (resourceNum.hasTevSwapTable()) {
this->hasTevSwapTable = true;
this->readTevSwapTable(in);
} else {
this->hasTevSwapTable = false;
}
// IndTexSRT
indTexSRTs.clear();
for (int i = 0; i < resourceNum.getIndTexSRTNum(); i++) {
this->readIndTexSRT(in);
}
// IndTexStage
indTexStages.clear();
for (int i = 0; i < resourceNum.getIndTexStageNum(); i++) {
this->readIndirectStage(in);
}
// TevStage
tevStages.clear();
for (int i = 0; i < resourceNum.getTevStageNum(); i++) {
this->readTevStage(in);
}
// AlphaCompare
if (resourceNum.hasAlphaCompare()) {
this->hasAlphaCompare = true;
this->readAlphaCompare(in);
} else {
this->hasAlphaCompare = false;
}
// BlendMode
if (resourceNum.hasBlendMode()) {
this->hasBlendMode = true;
this->readBlendMode(in);
} else {
this->hasBlendMode = false;
}*/
}
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();
}
|