From e8a39e596ecd4fdcb54b8a15a9388ba1023b4bd3 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Mon, 15 Jan 2024 19:08:38 -0600 Subject: [PATCH] load mesh data and structure meshes --- src/engine/gameManager/BuildingManager.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index 6a923f3e..3e3c3593 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -985,14 +985,14 @@ public enum BuildingManager { building.buildingMeshes = new ArrayList<>(); float rotation = building.getRot().getRotation(); Vector3f buildingLoc = new Vector3f(building.loc.x, building.loc.y, building.loc.z); - + int buildingMeshUUID = building.meshUUID; + int blueprintMeshUUID = building.getBlueprint().getMeshForRank(building.rank); if(prop_meshes.containsKey(building.meshUUID) == false) return;//no meshes to load for this prop //ArrayList meshes = prop_meshes.get(building.meshUUID); - int buildingMeshUUID = building.meshUUID; - int blueprintMeshUUID = building.getBlueprint().getMeshForRank(building.rank); ArrayList meshes = prop_meshes.get(building.getBlueprint().getMeshForRank(building.rank)); + for (int mesh : meshes) { if (!mesh_heights.containsKey(mesh) || !mesh_triangle_points.containsKey(mesh)) @@ -1001,7 +1001,7 @@ public enum BuildingManager { Mesh generatedMesh = new Mesh(); generatedMesh.maxY = building.loc.y + mesh_heights.get(mesh).x; generatedMesh.minY = building.loc.y + mesh_heights.get(mesh).y; - ArrayList> triPoints = mesh_triangle_points.get(building.meshUUID); + ArrayList> triPoints = mesh_triangle_points.get(mesh); if (mesh_bounding_boxes.containsKey(mesh)) { Rectangle2D boundingBox = mesh_bounding_boxes.get(mesh); @@ -1012,11 +1012,6 @@ public enum BuildingManager { Vector3f topRight = new Vector3f(building.loc.x + halfX, building.loc.y, building.loc.z - halfZ); Vector3f bottomLeft = new Vector3f(building.loc.x - halfX, building.loc.y, building.loc.z + halfZ); - topLeft.x *= -1; - bottomLeft.x *= -1; - topRight.x *= -1; - bottomRight.x *= -1; - generatedMesh.BoundingLines = new ArrayList<>(); Point2D.Float p1 = new Point2D.Float(topLeft.x, topLeft.z); Point2D.Float p2 = new Point2D.Float(topRight.x, topRight.z);