2023-01-14 11:31:39 -05:00

29 lines
774 B
C#

using AssetRipper.SourceGenerated.Subclasses.StaticBatchInfo;
namespace AssetRipper.SourceGenerated.Extensions
{
public static class StaticBatchInfoExtensions
{
public static void Initialize(this IStaticBatchInfo staticBatchInfo, uint[] subsetIndices)
{
if (subsetIndices.Length == 0)
{
staticBatchInfo.FirstSubMesh = 0;
staticBatchInfo.SubMeshCount = 0;
}
else
{
staticBatchInfo.FirstSubMesh = (ushort)subsetIndices[0];
staticBatchInfo.SubMeshCount = (ushort)subsetIndices.Length;
for (int i = 0, j = staticBatchInfo.FirstSubMesh; i < staticBatchInfo.SubMeshCount; i++, j++)
{
if (subsetIndices[i] != j)
{
throw new Exception("Can't create static batch info from subset indices");
}
}
}
}
}
}