2 Commits

Author SHA1 Message Date
14202714cc fix: Fix error on polygon elements with holes 2025-02-26 01:20:18 +08:00
ce0c23805a refactor: Remove useless suppressions 2025-02-22 15:39:38 +08:00
2 changed files with 7 additions and 4 deletions

View File

@@ -1,6 +1,5 @@
using Cryville.EEW.Core.Map;
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Net.Http;
using System.Threading;
@@ -67,7 +66,6 @@ namespace Cryville.EEW.Unity.Map {
_downloadDone = true;
}
[SuppressMessage("CodeQuality", "IDE0051", Justification = "Unity message")]
void Update() {
if (_downloadDone) {
try {
@@ -100,7 +98,6 @@ namespace Cryville.EEW.Unity.Map {
_callback?.Invoke(this);
}
[SuppressMessage("CodeQuality", "IDE0051", Justification = "Unity message")]
void OnDestroy() {
if (_req != null) {
_req.Abort();

View File

@@ -77,7 +77,13 @@ namespace Cryville.EEW.Unity.Map {
DTSweep.Triangulate(tcx);
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);
int vi = 0, ii = 0;
foreach (var tri in convertedPolygon.Triangles) {