mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-13 23:26:19 +00:00
Material lookup by name + minor fixes
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user