165 lines
4.8 KiB
C++
165 lines
4.8 KiB
C++
#include "xmaterialtechniqueset.h"
|
|
|
|
XMaterialTechniqueSet::XMaterialTechniqueSet()
|
|
: XAsset()
|
|
, mTechniqueSetName()
|
|
, mWorldVertFormat(0)
|
|
, mTechniques()
|
|
{
|
|
SetType(ASSET_TYPE_TECHNIQUE_SET);
|
|
SetName("Material Technique Set");
|
|
}
|
|
|
|
XMaterialTechniqueSet::~XMaterialTechniqueSet()
|
|
{
|
|
|
|
}
|
|
|
|
void XMaterialTechniqueSet::ParseData(XDataStream *aStream)
|
|
{
|
|
if (IsDebug())
|
|
{
|
|
qDebug() << QString("[%1] Parsing data for %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(GetName());
|
|
}
|
|
mTechniqueSetName.ParsePtr(aStream, false);
|
|
|
|
mWorldVertFormat = aStream->ParseUInt8(QString("%1 world vertex format").arg(GetName()));
|
|
mHasBeenUploaded = aStream->ParseUInt8(QString("%1 has been uploaded").arg(GetName()));
|
|
|
|
aStream->skipRawData(2 + 4);
|
|
|
|
if (IsDebug())
|
|
{
|
|
qDebug() << QString("Parsing techniques.");
|
|
}
|
|
|
|
for (int i = 0; i < GetMaxTechniqueCount(); i++)
|
|
{
|
|
XMaterialTechnique newTechnique;
|
|
newTechnique.SetCommonInfo(GetCommonInfo());
|
|
newTechnique.ParsePtr(aStream, false);
|
|
mTechniques.push_back(newTechnique);
|
|
|
|
if (IsDebug())
|
|
{
|
|
qDebug() << QString("[%1] material technique ptr = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(newTechnique.GetPtr());
|
|
}
|
|
}
|
|
|
|
mTechniqueSetName.SetRemoveString(",");
|
|
mTechniqueSetName.ParseDataSafe(aStream);
|
|
SetDisplayName(mTechniqueSetName.GetString());
|
|
AddSubAsset(&mTechniqueSetName);
|
|
|
|
if (IsDebug())
|
|
{
|
|
qDebug() << QString("[%1] technique set name = %2").arg(aStream->device()->pos(), 10, 10, QChar('0')).arg(mTechniqueSetName.GetString());
|
|
}
|
|
|
|
for (int i = 0; i < mTechniques.size(); i++)
|
|
{
|
|
if (IsDebug())
|
|
{
|
|
qDebug() << QString("Parsing technique: %1").arg(i);
|
|
}
|
|
mTechniques[i].SetCommonInfo(GetCommonInfo());
|
|
mTechniques[i].ParseDataSafe(aStream);
|
|
AddSubAsset(&mTechniques[i]);
|
|
}
|
|
}
|
|
|
|
void XMaterialTechniqueSet::Clear()
|
|
{
|
|
mTechniqueSetName.Clear();
|
|
mWorldVertFormat = 0;
|
|
|
|
mTechniques.clear();
|
|
mTechniques = QVector<XMaterialTechnique>(GetMaxTechniqueCount());
|
|
}
|
|
|
|
quint32 XMaterialTechniqueSet::GetMaxTechniqueCount() const
|
|
{
|
|
if (GetCommonInfo()->GetPlatform() == PLATFORM_PS3) {
|
|
if (GetCommonInfo()->GetGame() == GAME_COD4) {
|
|
return 26;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD5) {
|
|
return 51;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD6) {
|
|
return 37;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD7) {
|
|
return 71;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD8) {
|
|
return 41;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD10) {
|
|
return 39;
|
|
}
|
|
} else if (GetCommonInfo()->GetPlatform() == PLATFORM_XBOX) {
|
|
if (GetCommonInfo()->GetGame() == GAME_COD4) {
|
|
return 26;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD5) {
|
|
return 51;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD6) {
|
|
return 33;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD7) {
|
|
return 71;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD8) {
|
|
return 37;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD10) {
|
|
return 36;
|
|
}
|
|
} else if (GetCommonInfo()->GetPlatform() == PLATFORM_PC) {
|
|
if (GetCommonInfo()->GetGame() == GAME_COD4) {
|
|
return 34;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD5) {
|
|
return 59;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD6) {
|
|
return 48;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD7) {
|
|
return 130;
|
|
} else if (GetCommonInfo()->GetGame() == GAME_COD8) {
|
|
return 54;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
XString XMaterialTechniqueSet::TechniqueSetName() const
|
|
{
|
|
return mTechniqueSetName;
|
|
}
|
|
|
|
void XMaterialTechniqueSet::SetTechniqueSetName(const XString &aName)
|
|
{
|
|
mTechniqueSetName = aName;
|
|
}
|
|
|
|
quint8 XMaterialTechniqueSet::WorldVertFormat() const
|
|
{
|
|
return mWorldVertFormat;
|
|
}
|
|
|
|
void XMaterialTechniqueSet::SetWorldVertFormat(quint8 aWorldVertFormat)
|
|
{
|
|
mWorldVertFormat = aWorldVertFormat;
|
|
}
|
|
|
|
bool XMaterialTechniqueSet::HasBeenUploaded() const
|
|
{
|
|
return mHasBeenUploaded;
|
|
}
|
|
|
|
void XMaterialTechniqueSet::SetHasBeenUploaded(bool aHasBeenUploaded)
|
|
{
|
|
mHasBeenUploaded = aHasBeenUploaded;
|
|
}
|
|
|
|
QVector<XMaterialTechnique> XMaterialTechniqueSet::Techniques() const
|
|
{
|
|
return mTechniques;
|
|
}
|
|
|
|
void XMaterialTechniqueSet::SetTechniques(const QVector<XMaterialTechnique> &aTechniques)
|
|
{
|
|
mTechniques = aTechniques;
|
|
}
|