Add VRChat and GitHub packages to Unity project

This commit is contained in:
gunnbr committed 2021-01-18 09:14:18 -08:00
1 parent 0334a52b21
commit 85538aaccc
3297 files changed
+847877

No files matched your search

@@ -0,0 +1,34 @@
using System.Collections.Generic;
using UnityEngine;
namespace VRCSDK2.Validation.Performance
{
public static class MeshUtils
{
private const uint INDICES_PER_TRIANGLE = 3U;
public static uint GetMeshTriangleCount(Mesh sourceMesh)
{
if(sourceMesh == null)
{
return 0;
}
// We can't use GetIndexCount if the mesh isn't readable so just return a huge number.
// The SDK Control Panel should show a warning in this case.
if(!sourceMesh.isReadable)
{
return uint.MaxValue;
}
uint count = 0;
for(int i = 0; i < sourceMesh.subMeshCount; i++)
{
uint indexCount = sourceMesh.GetIndexCount(i);
count += indexCount / INDICES_PER_TRIANGLE;
}
return count;
}
}
}