From d573534f6ddfd3dd0edc71c545d4bf44876f5cbc Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Mon, 15 Jan 2024 20:36:11 -0600 Subject: [PATCH] load mesh data and structure meshes --- src/engine/db/handlers/dbBuildingHandler.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/engine/db/handlers/dbBuildingHandler.java b/src/engine/db/handlers/dbBuildingHandler.java index bb060348..5b6fe1fc 100644 --- a/src/engine/db/handlers/dbBuildingHandler.java +++ b/src/engine/db/handlers/dbBuildingHandler.java @@ -940,7 +940,8 @@ public class dbBuildingHandler extends dbHandlerBase { ResultSet rs = preparedStatement.executeQuery(); BuildingManager.mesh_bounding_boxes = new HashMap<>(); while (rs.next()) { - if(BuildingManager.mesh_bounding_boxes.containsKey(rs.getInt("meshId")) == false){ + int meshID = rs.getInt("meshId"); + if(BuildingManager.mesh_bounding_boxes.containsKey(meshID) == false){ float endX = Float.parseFloat(rs.getString("end").split(";")[0]); float endZ = Float.parseFloat(rs.getString("end").split(";")[1]); float refX = Float.parseFloat(rs.getString("ref").split(";")[0]); @@ -948,11 +949,11 @@ public class dbBuildingHandler extends dbHandlerBase { Vector2f topLeft = new Vector2f(refX,refZ); - float width = Math.abs(endX-refX); - float height = Math.abs(endZ-refZ); + float width = Math.abs(Math.abs(endX)-Math.abs(refX)); + float height = Math.abs(Math.abs(endZ)-Math.abs(refZ)); Rectangle2D boundRect = new Rectangle2D.Float(); boundRect.setRect(topLeft.x,topLeft.y,width,height); - BuildingManager.mesh_bounding_boxes.put(rs.getInt("meshId"),boundRect); + BuildingManager.mesh_bounding_boxes.put(meshID,boundRect); } }