mirror of https://github.com/AxioDL/metaforce.git
MREA cooker fixes
This commit is contained in:
parent
42d39bf6b9
commit
4cdb93f980
|
@ -1656,7 +1656,30 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
|
|||
const std::vector<Mesh>& meshes, zeus::CAABox& fullAABB, std::vector<zeus::CAABox>& meshAABBs)
|
||||
{
|
||||
/* Build material set */
|
||||
std::vector<size_t> surfToGlobalMats;
|
||||
{
|
||||
struct MaterialPool
|
||||
{
|
||||
std::vector<const Mesh::Material*> materials;
|
||||
size_t addMaterial(const Mesh::Material& mat)
|
||||
{
|
||||
size_t ret = 0;
|
||||
for (const Mesh::Material* testMat : materials)
|
||||
{
|
||||
if (mat == *testMat)
|
||||
return ret;
|
||||
++ret;
|
||||
}
|
||||
materials.push_back(&mat);
|
||||
return ret;
|
||||
}
|
||||
} matPool;
|
||||
|
||||
size_t surfCount = 0;
|
||||
for (const Mesh& mesh : meshes)
|
||||
surfCount += mesh.surfaces.size();
|
||||
surfToGlobalMats.reserve(surfCount);
|
||||
|
||||
MaterialSet matSet;
|
||||
hecl::Frontend::Frontend FE;
|
||||
size_t endOff = 0;
|
||||
|
@ -1665,8 +1688,16 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
|
|||
{
|
||||
if (mesh.materialSets.size())
|
||||
{
|
||||
std::vector<size_t> meshToGlobalMats;
|
||||
meshToGlobalMats.reserve(mesh.materialSets[0].size());
|
||||
|
||||
for (const Mesh::Material& mat : mesh.materialSets[0])
|
||||
{
|
||||
size_t idx = matPool.addMaterial(mat);
|
||||
meshToGlobalMats.push_back(idx);
|
||||
if (idx < matPool.materials.size() - 1)
|
||||
continue;
|
||||
|
||||
for (const hecl::ProjectPath& path : mat.texs)
|
||||
{
|
||||
bool found = false;
|
||||
|
@ -1687,6 +1718,9 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
|
|||
endOff = matSet.materials.back().binarySize(endOff);
|
||||
matSet.head.addMaterialEndOff(endOff);
|
||||
}
|
||||
|
||||
for (const Mesh::Surface& surf : mesh.surfaces)
|
||||
surfToGlobalMats.push_back(meshToGlobalMats[surf.materialIdx]);
|
||||
}
|
||||
}
|
||||
for (const hecl::ProjectPath& path : texPaths)
|
||||
|
@ -1698,6 +1732,7 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
|
|||
}
|
||||
|
||||
/* Iterate meshes */
|
||||
auto matIt = surfToGlobalMats.cbegin();
|
||||
for (const Mesh& mesh : meshes)
|
||||
{
|
||||
zeus::CTransform meshXf(mesh.sceneXf.val);
|
||||
|
@ -1769,7 +1804,7 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
|
|||
|
||||
SurfaceHeader header;
|
||||
header.centroid = meshXf * zeus::CVector3f(osurf.centroid);
|
||||
header.matIdx = osurf.materialIdx;
|
||||
header.matIdx = *matIt++;
|
||||
header.reflectionNormal = (meshXf.basis * zeus::CVector3f(osurf.reflectionNormal)).normalized();
|
||||
header.idxStart = surf.m_start;
|
||||
header.idxCount = surf.m_count;
|
||||
|
|
|
@ -114,6 +114,11 @@ bool ReadMAPAToBlender(hecl::BlenderConnection& conn,
|
|||
"bpy.types.Object.retro_mappable_unk = bpy.props.IntProperty(name='Retro: MAPA object unk')\n"
|
||||
"bpy.types.Object.retro_mappable_sclyid = bpy.props.StringProperty(name='Retro: MAPA object SCLY ID')\n"
|
||||
"\n"
|
||||
"for ar in bpy.context.screen.areas:\n"
|
||||
" for sp in ar.spaces:\n"
|
||||
" if sp.type == 'VIEW_3D':\n"
|
||||
" sp.viewport_shade = 'SOLID'\n"
|
||||
"\n"
|
||||
"# Clear Scene\n"
|
||||
"for ob in bpy.data.objects:\n"
|
||||
" if ob.type != 'CAMERA':\n"
|
||||
|
|
|
@ -344,7 +344,7 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
|
|||
FILE* yamlFile = hecl::Fopen(layer.getAbsolutePath().c_str(), _S("r"));
|
||||
if (!yamlFile)
|
||||
continue;
|
||||
if (!BigYAML::ValidateFromYAMLFile<DNAMP1::SCLY>(yamlFile))
|
||||
if (!BigYAML::ValidateFromYAMLFile<DNAMP1::SCLY::ScriptLayer>(yamlFile))
|
||||
{
|
||||
fclose(yamlFile);
|
||||
continue;
|
||||
|
|
|
@ -27,6 +27,10 @@ URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
|||
|
||||
void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
|
||||
{
|
||||
SObjectTag areaTag = m_projManager.resourceFactoryMP1().ProjectResourceFactoryBase::TagFromPath(
|
||||
_S("MP1/Metroid1/!1IntroLevel1027/01 Air Lock/!area.blend"));
|
||||
auto areaData = m_projManager.resourceFactoryMP1().LoadResourceSync(areaTag);
|
||||
|
||||
//m_modelTest = objStore.GetObj("gun_cmdl");
|
||||
m_modelTest = objStore.GetObj("MP1/Shared/CMDL_B2B41738.blend");
|
||||
//m_modelTest = objStore.GetObj("CMDL_GameCube");
|
||||
|
|
|
@ -60,7 +60,7 @@ struct Application : boo::IApplicationCallback
|
|||
void initialize(boo::IApplication* /*app*/)
|
||||
{
|
||||
zeus::detectCPU();
|
||||
//hecl::VerbosityLevel = 1;
|
||||
hecl::VerbosityLevel = 1;
|
||||
|
||||
const zeus::CPUInfo& cpuInf = zeus::cpuFeatures();
|
||||
Log.report(logvisor::Info, "CPU Name: %s", cpuInf.cpuBrand);
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit 700b166efaf9d548f1fc9e92f65894a398efee42
|
||||
Subproject commit 52b3ba6582d7b5e19be8ad01eb47c95c3c8e9039
|
Loading…
Reference in New Issue