diff options
author | Treeki <treeki@gmail.com> | 2010-10-14 20:17:20 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2010-10-14 20:17:20 +0200 |
commit | ebcc95da4c26369511caa90d89c5ed06e1e4853a (patch) | |
tree | 6ed445f0204a6e6615088d135c4b29c4309077a4 /lyt/materials/material.cpp | |
parent | fdf8cfec2b795393d7ee901abaf747575067068b (diff) | |
download | LayoutStudio-ebcc95da4c26369511caa90d89c5ed06e1e4853a.tar.gz LayoutStudio-ebcc95da4c26369511caa90d89c5ed06e1e4853a.zip |
brlyt packing added, plus some changes in the existing API (mostly for const correctness). brlyt writing may still need some testing (especially for the material structs)
Diffstat (limited to '')
-rw-r--r-- | lyt/materials/material.cpp | 82 |
1 files changed, 80 insertions, 2 deletions
diff --git a/lyt/materials/material.cpp b/lyt/materials/material.cpp index a4498c5..a775553 100644 --- a/lyt/materials/material.cpp +++ b/lyt/materials/material.cpp @@ -29,7 +29,7 @@ LYTLayout &LYTMaterial::layout() const { } -void LYTMaterial::dumpToDebug() { +void LYTMaterial::dumpToDebug() const { qDebug() << "LYTMaterial" << name << "@" << (void*)this; for (int i = 0; i < 3; i++) @@ -90,8 +90,86 @@ void LYTMaterial::dumpToDebug() { -void LYTMaterial::writeToDataStream(QDataStream &out) { +void LYTMaterial::writeToDataStream(QDataStream &out) const { WriteFixedLengthASCII(out, name, 0x14); + + for (int i = 0; i < 3; i++) + WriteS10Color(this->colours[i], out); + + for (int i = 0; i < 4; i++) + WriteRGBA8Color(this->tevKColour[i], out); + + + LYTMaterialResourceNum resourceNum; + resourceNum.setTexMapNum(texMaps.count()); + resourceNum.setTexSRTNum(texSRTs.count()); + resourceNum.setTexCoordGenNum(texCoordGens.count()); + resourceNum.setHasChanCtrl(hasChanCtrl); + resourceNum.setHasMatCol(hasMatCol); + resourceNum.setHasTevSwapTable(hasTevSwapTable); + resourceNum.setIndTexSRTNum(indTexSRTs.count()); + resourceNum.setIndTexStageNum(indTexStages.count()); + resourceNum.setTevStageNum(tevStages.count()); + resourceNum.setHasAlphaCompare(hasAlphaCompare); + resourceNum.setHasBlendMode(hasBlendMode); + out << (quint32)resourceNum.value(); + + + // TexMap + for (int i = 0; i < texMaps.count(); i++) { + texMaps.at(i).writeToDataStream(out, this->m_layout); + } + + // TexSRT + for (int i = 0; i < texSRTs.count(); i++) { + texSRTs.at(i).writeToDataStream(out); + } + + // TexCoordGen + for (int i = 0; i < texCoordGens.count(); i++) { + texCoordGens.at(i).writeToDataStream(out); + } + + // ChanCtrl + if (hasChanCtrl) { + chanCtrl.writeToDataStream(out); + } + + // MatCol + if (hasMatCol) { + WriteRGBA8Color(this->matCol, out); + } + + // TevSwapTable + if (hasTevSwapTable) { + tevSwapTable.writeToDataStream(out); + } + + // IndTexSRT + for (int i = 0; i < indTexSRTs.count(); i++) { + indTexSRTs.at(i).writeToDataStream(out); + } + + // IndTexStage + for (int i = 0; i < indTexStages.count(); i++) { + indTexStages.at(i).writeToDataStream(out); + } + + // TevStage + for (int i = 0; i < tevStages.count(); i++) { + tevStages.at(i).writeToDataStream(out); + } + + // AlphaCompare + if (hasAlphaCompare) { + alphaCompare.writeToDataStream(out); + } + + // BlendMode + if (hasBlendMode) { + blendMode.writeToDataStream(out); + } + } void LYTMaterial::readFromDataStream(QDataStream &in) { |