From 1ee8851fe0aeee1ffb24a096f953744458768d86 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 7 Nov 2023 20:28:44 -0600 Subject: [PATCH] shape --- src/engine/db/handlers/dbBuildingHandler.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/engine/db/handlers/dbBuildingHandler.java b/src/engine/db/handlers/dbBuildingHandler.java index 39f9032b..e2e165cb 100644 --- a/src/engine/db/handlers/dbBuildingHandler.java +++ b/src/engine/db/handlers/dbBuildingHandler.java @@ -28,6 +28,7 @@ import java.sql.SQLException; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.concurrent.ConcurrentHashMap; @@ -572,20 +573,30 @@ public class dbBuildingHandler extends dbHandlerBase { Logger.error("Prop : " + propID + " has less than 3 vertices."); continue; } + ArrayList vectors = new ArrayList<>(); + ArrayList floats = new ArrayList<>(); + for(String read : vertStrings){ + floats.add(Float.parseFloat(read)); + if(floats.size() == 2) { + vectors.add(new Vector2f(floats.get(0), floats.get(1))); + floats = new ArrayList<>(); + } + } + - for (int i = 0; i < vertStrings.length; i += 2) - vertArrayList.add(new Vector2f(Float.parseFloat(vertStrings[i]), Float.parseFloat(vertStrings[1 + 1]))); + //for (int i = 0; i < vertStrings.length; i += 2) + // vertArrayList.add(new Vector2f(Float.parseFloat(vertStrings[i]), Float.parseFloat(vertStrings[1 + 1]))); ArrayList> meshList; if (BuildingManager._hull_data.get(propID) == null) { meshList = new ArrayList<>(); - meshList.add(vertArrayList); + meshList.add(vectors); BuildingManager._hull_data.put(propID, meshList); } else { meshList = BuildingManager._hull_data.get(propID); - meshList.add(vertArrayList); + meshList.add(vectors); } }