fix: Fix error on polygon elements with holes
This commit is contained in:
@@ -77,7 +77,13 @@ namespace Cryville.EEW.Unity.Map {
|
|||||||
DTSweep.Triangulate(tcx);
|
DTSweep.Triangulate(tcx);
|
||||||
|
|
||||||
var codeToIndex = new Dictionary<uint, int>();
|
var codeToIndex = new Dictionary<uint, int>();
|
||||||
var vertices = ArrayPool<Vector3>.Shared.Rent(convertedPolygon.Points.Count);
|
int vertexCount = convertedPolygon.Points.Count;
|
||||||
|
if (convertedPolygon.Holes != null) {
|
||||||
|
foreach (var hole in convertedPolygon.Holes) {
|
||||||
|
vertexCount += hole.Points.Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var vertices = ArrayPool<Vector3>.Shared.Rent(vertexCount);
|
||||||
var triangles = ArrayPool<int>.Shared.Rent(convertedPolygon.Triangles.Count * 3);
|
var triangles = ArrayPool<int>.Shared.Rent(convertedPolygon.Triangles.Count * 3);
|
||||||
int vi = 0, ii = 0;
|
int vi = 0, ii = 0;
|
||||||
foreach (var tri in convertedPolygon.Triangles) {
|
foreach (var tri in convertedPolygon.Triangles) {
|
||||||
|
Reference in New Issue
Block a user