Material lookup by name + minor fixes
This commit is contained in:
parent
9157acd164
commit
8d90cd7e01
|
@ -211,7 +211,7 @@ namespace StringUtil
|
|||
int CodePoint;
|
||||
|
||||
// One byte
|
||||
if ((cstr[0] & 0x80000000) == 0)
|
||||
if ((cstr[0] & 0x80) == 0)
|
||||
{
|
||||
CodePoint = cstr[0] & 0x7FFFFFFF;
|
||||
cstr++;
|
||||
|
|
|
@ -1,20 +1,8 @@
|
|||
#include <QApplication>
|
||||
#include <UI/CStartWindow.h>
|
||||
#include <UI/CWorldEditorWindow.h>
|
||||
#include <UI/CModelEditorWindow.h>
|
||||
#include <UI/TestDialog.h>
|
||||
#include <Common/CTimer.h>
|
||||
#include <iostream>
|
||||
#include <QStyleFactory>
|
||||
#include <UI/CDarkStyle.h>
|
||||
#include <time.h>
|
||||
#include <Resource/factory/CTextureDecoder.h>
|
||||
#include <Resource/cooker/CTextureEncoder.h>
|
||||
#include <Common/CMatrix4f.h>
|
||||
#include <Resource/factory/CTemplateLoader.h>
|
||||
#include <Common/StringUtil.h>
|
||||
|
||||
#include <QDir>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -24,8 +12,6 @@ int main(int argc, char *argv[])
|
|||
w.show();
|
||||
|
||||
CTemplateLoader::LoadGameList();
|
||||
//CTexture *pTex = CTextureDecoder::LoadDDS(CFileInStream("E:/34f7c12211777ce8.dds", IOUtil::LittleEndian));
|
||||
//CTextureEncoder::EncodeTXTR(CFileOutStream("E:/Unpacked/Metroid Prime 3 Dolphin/Metroid4-pak/34f7c12211777ce8.TXTR", IOUtil::BigEndian), pTex);
|
||||
|
||||
app.setStyle(new CDarkStyle);
|
||||
qApp->setStyle(QStyleFactory::create("Fusion"));
|
||||
|
|
|
@ -132,7 +132,8 @@ SOURCES += \
|
|||
Resource/factory/CScanLoader.cpp \
|
||||
UI/WStringPreviewPanel.cpp \
|
||||
UI/WScanPreviewPanel.cpp \
|
||||
UI/WIntegralSpinBox.cpp
|
||||
UI/WIntegralSpinBox.cpp \
|
||||
UI/CAboutDialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
Common/AnimUtil.h \
|
||||
|
@ -278,7 +279,8 @@ HEADERS += \
|
|||
Resource/factory/CScanLoader.h \
|
||||
UI/WStringPreviewPanel.h \
|
||||
UI/WScanPreviewPanel.h \
|
||||
UI/WIntegralSpinBox.h
|
||||
UI/WIntegralSpinBox.h \
|
||||
UI/CAboutDialog.h
|
||||
|
||||
FORMS += \
|
||||
UI/CWorldEditorWindow.ui \
|
||||
|
@ -292,7 +294,8 @@ FORMS += \
|
|||
UI/WorldEditor/WModifyTab.ui \
|
||||
UI/WorldEditor/WInstancesTab.ui \
|
||||
UI/WorldEditor/CLayerEditor.ui \
|
||||
UI/WScanPreviewPanel.ui
|
||||
UI/WScanPreviewPanel.ui \
|
||||
UI/CAboutDialog.ui
|
||||
|
||||
INCLUDEPATH += E:\C++\Libraries\glm\glm .\
|
||||
|
||||
|
@ -338,3 +341,4 @@ DISTFILES += \
|
|||
RESOURCES += \
|
||||
Icons.qrc
|
||||
|
||||
|
||||
|
|
|
@ -40,3 +40,10 @@ CMaterial* CMaterialSet::MaterialByName(const std::string &name)
|
|||
if ((*it)->Name() == name) return *it;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
u32 CMaterialSet::MaterialIndexByName(const std::string& name)
|
||||
{
|
||||
for (u32 iMat = 0; iMat < mMaterials.size(); iMat++)
|
||||
if (mMaterials[iMat]->Name() == name) return iMat;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public:
|
|||
u32 NumMaterials();
|
||||
CMaterial* MaterialByIndex(u32 index);
|
||||
CMaterial* MaterialByName(const std::string& name);
|
||||
u32 MaterialIndexByName(const std::string& name);
|
||||
};
|
||||
|
||||
#endif // CMATERIALSET_H
|
||||
|
|
|
@ -15,21 +15,6 @@ CMaterialLoader::~CMaterialLoader()
|
|||
{
|
||||
}
|
||||
|
||||
CMaterialSet* CMaterialLoader::LoadMaterialSet(CInputStream& Mat, EGame Version)
|
||||
{
|
||||
CMaterialLoader Loader;
|
||||
Loader.mpSet = new CMaterialSet();
|
||||
Loader.mpFile = &Mat;
|
||||
Loader.mVersion = Version;
|
||||
|
||||
if ((Version >= ePrimeKioskDemo) && (Version <= eEchoes))
|
||||
Loader.ReadPrimeMatSet();
|
||||
else
|
||||
Loader.ReadCorruptionMatSet();
|
||||
|
||||
return Loader.mpSet;
|
||||
}
|
||||
|
||||
void CMaterialLoader::ReadPrimeMatSet()
|
||||
{
|
||||
// Textures
|
||||
|
@ -590,3 +575,19 @@ void CMaterialLoader::CreateCorruptionPasses(CMaterial *pMat)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
CMaterialSet* CMaterialLoader::LoadMaterialSet(CInputStream& Mat, EGame Version)
|
||||
{
|
||||
CMaterialLoader Loader;
|
||||
Loader.mpSet = new CMaterialSet();
|
||||
Loader.mpFile = &Mat;
|
||||
Loader.mVersion = Version;
|
||||
|
||||
if ((Version >= ePrimeKioskDemo) && (Version <= eEchoes))
|
||||
Loader.ReadPrimeMatSet();
|
||||
else
|
||||
Loader.ReadCorruptionMatSet();
|
||||
|
||||
return Loader.mpSet;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ class CMaterialLoader
|
|||
CMaterial* ReadCorruptionMaterial();
|
||||
void CreateCorruptionPasses(CMaterial *pMat);
|
||||
|
||||
// Static
|
||||
public:
|
||||
static CMaterialSet* LoadMaterialSet(CInputStream& Mat, EGame Version);
|
||||
};
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef CMODELLOADER_H
|
||||
#define CMODELLOADER_H
|
||||
|
||||
#include "../model/SModelData.h"
|
||||
#include "../model/CBasicModel.h"
|
||||
#include "../model/CModel.h"
|
||||
#include "../EFormatVersion.h"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define CMODEL_H
|
||||
|
||||
#include "CBasicModel.h"
|
||||
#include "SModelData.h"
|
||||
#include "SSurface.h"
|
||||
#include "../CMaterialSet.h"
|
||||
|
||||
|
|
Loading…
Reference in New Issue