mirror of
https://github.com/AssetRipper/AssetRipper.git
synced 2025-12-11 20:15:29 +01:00
34 lines
935 B
C#
34 lines
935 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");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public static bool IsDefault(this IStaticBatchInfo staticBatchInfo)
|
|
{
|
|
return staticBatchInfo.FirstSubMesh == 0 && staticBatchInfo.SubMeshCount == 0;
|
|
}
|
|
}
|
|
}
|