try to fix combined mesh export error

This commit is contained in:
Perfare
2018-07-17 01:47:55 +08:00
parent 66a2dbe730
commit 9b1e3435d6
3 changed files with 95 additions and 9 deletions

View File

@@ -5,10 +5,18 @@ using System.Text;
namespace AssetStudio
{
public class StaticBatchInfo
{
public ushort firstSubMesh;
public ushort subMeshCount;
}
public class MeshRenderer
{
public PPtr m_GameObject;
public PPtr[] m_Materials;
public StaticBatchInfo m_StaticBatchInfo;
public uint[] m_SubsetIndices;
protected MeshRenderer() { }
@@ -56,6 +64,27 @@ namespace AssetStudio
{
m_Materials[m] = sourceFile.ReadPPtr();
}
if (version[0] < 3)
{
reader.Position += 16;//m_LightmapTilingOffset vector4d
}
else
{
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)//5.5.0 and up
{
m_StaticBatchInfo = new StaticBatchInfo
{
firstSubMesh = reader.ReadUInt16(),
subMeshCount = reader.ReadUInt16()
};
}
else
{
int numSubsetIndices = reader.ReadInt32();
m_SubsetIndices = reader.ReadUInt32Array(numSubsetIndices);
}
}
}
}
}

View File

@@ -64,12 +64,16 @@ namespace AssetStudio
{
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)//5.5.0 and up
{
reader.Position += 4;//m_StaticBatchInfo
m_StaticBatchInfo = new StaticBatchInfo
{
firstSubMesh = reader.ReadUInt16(),
subMeshCount = reader.ReadUInt16()
};
}
else
{
int m_SubsetIndices_size = reader.ReadInt32();
reader.Position += m_SubsetIndices_size * 4;
int numSubsetIndices = reader.ReadInt32();
m_SubsetIndices = reader.ReadUInt32Array(numSubsetIndices);
}
var m_StaticBatchRoot = sourceFile.ReadPPtr();